pycram.robot_plans#
Submodules#
Attributes#
Exceptions#
Thrown when an attempt to find an object by perception fails -- and this can still be interpreted as the robot |
|
Thrown when no base positioning can assure a reachable pose to grasp the object from. |
|
Implementation of plan failures. |
|
Thrown when container manipulation fails. |
|
Thrown when the look at goal is not reached. |
|
Thrown when the navigation goal is not reached. |
|
Thrown when the object was not placed at the target location. |
|
Thrown when the object is still in contact with the robot after placing. |
|
Thrown when the torso moved as a result of a torso action but the goal was not reached. |
|
Thrown when the tool pose is not reached. |
Classes#
A partial designator_description is somewhat between a DesignatorDescription and a specified designator_description. Basically it is a |
|
A pose in 3D space with a timestamp. |
|
Creates a plan which executes its children in sequential order |
|
Base class for everything that contains potentially parameters for a plan. |
|
Turn the robot chassis such that is faces the |
|
Enum for techniques for detection tasks. |
|
Uses Costmaps to create locations for complex constrains |
|
Creates a plan that executes all children in sequential order but does not stop if one of them throws an error |
|
Searches for a target object around the given location. |
|
Moves the Tool center point (TCP) of the robot |
|
Enum for Arms. |
|
Enum for translating the axis name to a vector along that axis. |
|
Base class for grasp enums. |
|
Enum for the approach direction of a gripper. |
|
Enum for the vertical alignment of a gripper. |
|
Base class of a robot description. Contains all necessary information about a robot, like the URDF, the base link, |
|
Mixes contents of an object using a tool in a spiral motion. |
|
Performs a pouring action with a tool over an object, typically used for liquids. |
|
Performs a cutting action on an object using a specified tool. |
|
Represents a grasp description with a side grasp, top face, and orientation alignment. |
|
Uses Costmaps to create locations for complex constrains. |
|
Description for Objects that are only believed in. |
|
Transports an object to a position using an arm |
|
Transports an object to a position using an arm without moving the base of the robot |
|
Navigate to standing_position, then turn towards the object and pick it up. |
|
Navigate to standing_position, then turn towards the object and pick it up. |
|
To transport an object to a target location by choosing the closest |
|
Designator for opening container |
|
Designator for closing a container |
|
Opens or closes the gripper |
|
Enum for the different motions of the gripper. |
|
Enum for the different types of container manipulation. |
|
Opens a container like object |
|
Closes a container like object. |
|
Enum for the different movement types of the robot. |
|
Enum for the different methods to find a body in a region. |
|
Describes an end effector of robot. Contains all necessary information about the end effector, like the |
|
Represents a kinematic chain of a robot. A Kinematic chain is a chain of links and joints that are connected to each |
|
Let the robot reach a specific pose. |
|
Let the robot pick up an object. |
|
Grasps an object described by the given Object Designator description |
|
Enum for the state of the detection task. |
|
Detects an object that fits the object description and returns an object designator_description describing the object. |
|
Moves the robot to a designated location |
|
Lets the robot look at a point |
|
An abstract class that resembles an error checker. It has two main methods, one for calculating the error between |
|
Navigates the Robot to a position. |
|
Lets the robot look at a position. |
|
Places an Object at a position using an arm. |
|
A Vector3 with an attached ROS Header (timestamp and frame). |
|
Moves any joint on the robot |
|
Move the torso of the robot up and down. |
|
Set the gripper state of the robot. |
|
Park the arms of the robot. |
|
Parks the robot's arms. And align the arm with the given Axis of a frame. |
|
Generic enumeration. |
|
Enum for the different motions of the gripper. |
|
Enum for the different states of the torso. |
|
Represents a named joint state of a robot. For example, the park position of the arms. |
|
Represents a named joint state of a robot. For example, the park position of the arms. |
|
Manages joint states for different robot arms and their configurations. |
|
Helper class that provides a standard way to create an ABC using |
|
Enum for Arms. |
|
Base class for managing process modules, any new process modules have to implement this class to register the |
|
Designator for opening container |
|
Designator for closing a container |
|
Enum for the different motions of the gripper. |
|
Enum for the different movement types of the robot. |
|
Enum for the different movement types of the robot. |
|
Represents a grasp description with a side grasp, top face, and orientation alignment. |
|
A pose in 3D space with a timestamp. |
|
Moves the joints of each arm into the given position |
|
Opens or closes the gripper |
|
Moves the Tool center point (TCP) of the robot |
|
Moves the Tool center point (TCP) of the robot |
|
Tries to detect an object in the FOV of the robot |
|
Moves the robot to a designated location |
|
Lets the robot look at a point |
|
A Vector3 with an attached ROS Header (timestamp and frame). |
|
Moves any joint on the robot |
Functions#
|
Insert parameters of a class post construction. |
|
Return quaternion from Euler angles and axis sequence. |
|
Validates if the container is opened or closed by checking the joint position of the container. |
|
|
|
|
Translate a pose along a given 3d vector (axis) by a given distance. The axis is given in the local coordinate |
|
Validate the multiple joint goals, and wait until the goal is achieved. |
|
|
A generic function to retry a motion a certain number of times before giving up, with a specific exception. |
Translate a pose along a given 3d vector (axis) by a given distance. The axis is given in the local coordinate |
Package Contents#
- pycram.robot_plans.LookAtActionDescription#
- class pycram.robot_plans.ActionConfig#
- pick_up_prepose_distance = 0.03#
- grasping_prepose_distance = 0.03#
- face_at_keep_joint_states = True#
- execution_delay: datetime.timedelta#
The delay between the execution of actions/motions to imitate real world execution time.
- class pycram.robot_plans.PartialDesignator(performable: T, *args, **kwargs)#
Bases:
typing_extensions.Iterable[T]A partial designator_description is somewhat between a DesignatorDescription and a specified designator_description. Basically it is a partially initialized specified designator_description which can take a list of input arguments (like a DesignatorDescription) and generate a list of specified designators with all possible permutations of the input arguments.
PartialDesignators are designed as generators, as such they need to be iterated over to yield the possible specified designators. Please also keep in mind that at the time of iteration all parameter of the specified designator_description need to be filled, otherwise a TypeError will be raised, see the example below for usage.
# Example usage partial_designator = PartialDesignator(PickUpAction, milk_object_designator, arm=[Arms.RIGHT, Arms.LEFT]) for performable in partial_designator(Grasp.FRONT): performable.perform()
- performable: T = None#
Reference to the performable class that should be initialized
- args: typing_extensions.Tuple[typing_extensions.Any, Ellipsis] = None#
Arguments that are passed to the performable
- kwargs: typing_extensions.Dict[str, typing_extensions.Any] = None#
Keyword arguments that are passed to the performable
- _plan_node: pycram.plan.PlanNode = None#
Reference to the PlanNode that is used to execute the performable
- __call__(*fargs, **fkwargs)#
Creates a new PartialDesignator with the given arguments and keyword arguments added. Existing arguments will be prioritized over the new arguments.
- Parameters:
fargs – Additional arguments that should be added to the new PartialDesignator
fkwargs – Additional keyword arguments that should be added to the new PartialDesignator
- Returns:
A new PartialDesignator with the given arguments and keyword arguments added
- __iter__() typing_extensions.Iterator[T]#
Iterates over all possible permutations of the arguments and keyword arguments and creates a new performable object for each permutation. In case there are conflicting parameters the args will be used over the keyword arguments.
- Returns:
A new performable object for each permutation of arguments and keyword arguments
- generate_permutations() typing_extensions.Iterator[typing_extensions.Dict[str, typing_extensions.Any]]#
Generates the cartesian product of the given arguments. Arguments can also be a list of lists of arguments.
- Yields:
A list with a possible permutation of the given arguments
- missing_parameter() typing_extensions.List[str]#
Returns a list of all parameters that are missing for the performable to be initialized.
- Returns:
A list of parameter names that are missing from the performable
- resolve() T#
Returns the Designator with the first set of parameters
- Returns:
A fully parametrized Designator
- to_dict()#
- flatten() typing_extensions.List[pycram.has_parameters.leaf_types]#
Flattens a partial designator, very similar to HasParameters.flatten but this method can deal with parameters thet are None.
- Returns:
A list of flattened field values from the object.
- flatten_parameters() typing_extensions.Dict[str, pycram.has_parameters.leaf_types]#
The flattened parameter types of the performable.
- Returns:
A dict with the flattened parameter types of the performable.
- property plan_node: pycram.plan.PlanNode#
Returns the PlanNode that is used to execute the performable.
- Returns:
The PlanNode that is used to execute the performable.
- class pycram.robot_plans.PoseStamped#
Bases:
pycram.has_parameters.HasParametersA pose in 3D space with a timestamp.
- property position#
- property orientation#
- property frame_id#
- __repr__()#
- ros_message()#
Convert the pose to a ROS message of type PoseStamped.
- Returns:
The ROS message.
- classmethod from_ros_message(message: ROSPoseStamped) typing_extensions.Self#
Create a PoseStamped from a ROS message.
- Parameters:
message – The PoseStamped ROS message.
- Returns:
A new PoseStamped object created from the ROS message.
- classmethod from_list(position: typing_extensions.Optional[typing_extensions.List[float]] = None, orientation: typing_extensions.Optional[typing_extensions.List[float]] = None, frame: typing_extensions.Optional[semantic_digital_twin.world_description.world_entity.Body] = None) typing_extensions.Self#
Factory to create a PoseStamped from a list of position and orientation.
- Parameters:
position – Position as a list of [x, y, z].
orientation – Orientation as a list of [x, y, z, w].
frame – Frame in which the pose is defined.
- Returns:
A new PoseStamped object.
- classmethod from_matrix(matrix: numpy.ndarray, frame: semantic_digital_twin.world_description.world_entity.Body) typing_extensions.Self#
Create a PoseStamped from a 4x4 transformation matrix and a frame.
- Parameters:
matrix – A 4x4 transformation matrix as numpy array.
frame – The frame in which the pose is defined.
- Returns:
A PoseStamped object created from the matrix and frame.
- classmethod from_spatial_type(spatial_type: semantic_digital_twin.spatial_types.spatial_types.TransformationMatrix) typing_extensions.Self#
Create a PoseStamped from a SpatialTransformationMatrix and a frame.
- Parameters:
spatial_type – A SpatialTransformationMatrix object.
- Returns:
A PoseStamped object created from the spatial type and frame.
- to_transform_stamped(child_link_id: semantic_digital_twin.world_description.world_entity.Body) TransformStamped#
Converts the PoseStamped to a TransformStamped given a frame to which the transform is pointing.
- Parameters:
child_link_id – Frame to which the transform is pointing.
- Returns:
A TransformStamped object.
- to_spatial_type() semantic_digital_twin.spatial_types.spatial_types.TransformationMatrix#
Converts the PoseStamped to a SpatialTransformationMatrix.
- Returns:
A SpatialTransformationMatrix object representing the pose in 3D space.
- round(decimals: int = 4)#
Rounds the components of the pose (position and orientation) to the specified number of decimal places.
- Parameters:
decimals – Number of decimal places to round to.
- to_list()#
Convert the pose to a list of [position, orientation, frame_id].
- Returns:
A list of [pose, frame_id].
- almost_equal(other: PoseStamped, position_tolerance: float = 1e-06, orientation_tolerance: float = 1e-05) bool#
Check if two PoseStamped objects are almost equal within given tolerances for position and orientation and if the frame_id is the same.
- Parameters:
other – The other PoseStamped object to compare to.
position_tolerance – Tolerance for position comparison as number of decimal places.
orientation_tolerance – Tolerance for orientation comparison as number of decimal places.
- Returns:
True if the PoseStamped objects are almost equal, False otherwise.
- rotate_by_quaternion(quaternion: typing_extensions.List[float])#
Rotates the orientation of the pose by a given quaternion.
- Parameters:
quaternion – A list representing the quaternion [x, y, z, w].
- is_facing_2d_axis(pose_b: PoseStamped, axis: typing_extensions.Optional[pycram.datastructures.enums.AxisIdentifier] = AxisIdentifier.X, threshold_deg=82) typing_extensions.Tuple[bool, float]#
Check if this pose is facing another pose along a specific axis (X or Y) within a given angular threshold.
- Parameters:
pose_b – The target pose to compare against.
axis – The axis to check alignment with (‘x’ or ‘y’). Defaults to ‘x’.
threshold_deg – The maximum angular difference in degrees to consider as ‘facing’. Defaults to 82 degrees.
- Returns:
Tuple of (True/False if facing, signed angular difference in radians).
- is_facing_x_or_y(pose_b: PoseStamped) bool#
Check if this pose is facing another pose along either the X or Y axis within a default angular threshold.
- Parameters:
pose_b – The target pose to compare against.
- Returns:
True if this pose is facing the target along either X or Y axis, False otherwise.
- pycram.robot_plans.has_parameters(target_class: T) T#
Insert parameters of a class post construction. Use this when dataclasses should be combined with HasParameters.
- Parameters:
target_class – The class to get the parameters from.
- Returns:
The updated class
- class pycram.robot_plans.SequentialPlan(context: pycram.datastructures.dataclasses.Context, *children: typing_extensions.Union[pycram.plan.Plan, pycram.datastructures.partial_designator.PartialDesignator, pycram.robot_plans.BaseMotion])#
Bases:
LanguagePlanCreates a plan which executes its children in sequential order
- class pycram.robot_plans.ActionDescription#
Bases:
pycram.has_parameters.HasParametersBase class for everything that contains potentially parameters for a plan.
- execution_data: pycram.datastructures.dataclasses.ExecutionData#
Additional data that is collected before and after the execution of the action.
- _plan_node: pycram.plan.PlanNode = None#
- _pre_perform_callbacks = []#
- _post_perform_callbacks = []#
- property plan_node: pycram.plan.PlanNode#
- property plan_struct: pycram.plan.Plan#
- property world: semantic_digital_twin.world.World#
- property context: pycram.datastructures.dataclasses.Context#
- property robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot#
- __post_init__()#
- perform() typing_extensions.Any#
Full execution: pre-check, plan, post-check
- abstract plan() typing_extensions.Any#
Symbolic plan. Should only call motions or sub-actions.
- abstract validate_precondition()#
Symbolic/world state precondition validation.
- abstract validate_postcondition(result: typing_extensions.Optional[typing_extensions.Any] = None)#
Symbolic/world state postcondition validation.
- classmethod pre_perform(func) typing_extensions.Callable#
- classmethod post_perform(func) typing_extensions.Callable#
- pycram.robot_plans.quaternion_from_euler(ai, aj, ak, axes='sxyz')#
Return quaternion from Euler angles and axis sequence.
ai, aj, ak : Euler’s roll, pitch and yaw angles axes : One of 24 axis sequences as string or encoded tuple
>>> q = quaternion_from_euler(1, 2, 3, 'ryxz') >>> numpy.allclose(q, [0.310622, -0.718287, 0.444435, 0.435953]) True
- class pycram.robot_plans.FaceAtAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionTurn the robot chassis such that is faces the
poseand after that perform a look at action.- pose: pycram.datastructures.pose.PoseStamped#
The pose to face
- keep_joint_states: bool#
Keep the joint states of the robot the same during the navigation.
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#
- classmethod description(pose: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.pose.PoseStamped], pycram.datastructures.pose.PoseStamped], keep_joint_states: typing_extensions.Union[typing_extensions.Iterable[bool], bool] = ActionConfig.face_at_keep_joint_states) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[FaceAtAction]]#
- pycram.robot_plans.FaceAtActionDescription#
- pycram.robot_plans.DetectActionDescription#
- class pycram.robot_plans.DetectionTechnique#
Bases:
int,enum.EnumEnum for techniques for detection tasks.
- ALL = 0#
- HUMAN = 1#
- TYPES = 2#
- REGION = 3#
- HUMAN_ATTRIBUTES = 4#
- HUMAN_WAVING = 5#
- class pycram.robot_plans.CostmapLocation(target: typing_extensions.Union[pycram.datastructures.pose.PoseStamped, semantic_digital_twin.world_description.world_entity.Body], reachable_for: semantic_digital_twin.robots.abstract_robot.AbstractRobot = None, visible_for: semantic_digital_twin.robots.abstract_robot.AbstractRobot = None, reachable_arm: typing_extensions.Optional[typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.Arms], pycram.datastructures.enums.Arms]] = None, ignore_collision_with: typing_extensions.Optional[typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Body], semantic_digital_twin.world_description.world_entity.Body]] = None, grasp_descriptions: typing_extensions.Optional[typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.grasp.GraspDescription], pycram.datastructures.grasp.GraspDescription]] = None, rotation_agnostic: bool = False)#
Bases:
pycram.designator.LocationDesignatorDescriptionUses Costmaps to create locations for complex constrains
- target: typing_extensions.Union[pycram.datastructures.pose.PoseStamped, semantic_digital_twin.world_description.world_entity.Body]#
- reachable_for: semantic_digital_twin.robots.abstract_robot.AbstractRobot = None#
- visible_for: semantic_digital_twin.robots.abstract_robot.AbstractRobot = None#
- reachable_arm: typing_extensions.Optional[pycram.datastructures.enums.Arms] = None#
- ignore_collision_with = None#
- grasps: typing_extensions.List[typing_extensions.Optional[pycram.datastructures.enums.Grasp]] = None#
- ground() pycram.datastructures.pose.PoseStamped#
Default specialized_designators which returns the first result from the iterator of this instance.
- Returns:
A resolved location
- setup_costmaps(target: pycram.datastructures.pose.PoseStamped, visible_for, reachable_for) pycram.costmaps.Costmap#
Sets up the costmaps for the given target and robot. The costmaps are merged and stored in the final_map
- __iter__() typing_extensions.Iterator[pycram.datastructures.pose.PoseStamped]#
Generates positions for a given set of constrains from a costmap and returns them. The generation is based of a costmap which itself is the product of merging costmaps, each for a different purpose. In any case an occupancy costmap is used as the base, then according to the given constrains a visibility or gaussian costmap is also merged with this. Once the costmaps are merged, a generator generates pose candidates from the costmap. Each pose candidate is then validated against the constraints given by the designator if all validators pass the pose is considered valid and yielded.
- yield:
An instance of CostmapLocation.Location with a valid position that satisfies the given constraints
- exception pycram.robot_plans.PerceptionObjectNotFound(obj_type: typing_extensions.Type[PhysicalObject], technique: pycram.datastructures.enums.DetectionTechnique, region: pycram.datastructures.pose.PoseStamped, *args, **kwargs)#
Bases:
PerceptionLowLevelFailureThrown when an attempt to find an object by perception fails – and this can still be interpreted as the robot not looking in the right direction, as opposed to the object being absent.
- class pycram.robot_plans.TryInOrderPlan(context: pycram.datastructures.dataclasses.Context, *children: typing_extensions.Union[pycram.plan.Plan, pycram.datastructures.partial_designator.PartialDesignator, pycram.robot_plans.BaseMotion])#
Bases:
LanguagePlanCreates a plan that executes all children in sequential order but does not stop if one of them throws an error
- class pycram.robot_plans.SearchAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionSearches for a target object around the given location.
- target_location: pycram.datastructures.pose.PoseStamped#
Location around which to look for a target object.
- object_sem_annotation: typing_extensions.Type[semantic_digital_twin.world_description.world_entity.SemanticAnnotation]#
Type of the object which is searched for.
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#
- classmethod description(target_location: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.pose.PoseStamped], pycram.datastructures.pose.PoseStamped], object_type: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.SemanticAnnotation], semantic_digital_twin.world_description.world_entity.SemanticAnnotation]) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[SearchAction]]#
- pycram.robot_plans.SearchActionDescription#
- class pycram.robot_plans.MoveTCPMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionMoves the Tool center point (TCP) of the robot
- target: pycram.datastructures.pose.PoseStamped#
Target pose to which the TCP should be moved
- arm: pycram.datastructures.enums.Arms#
Arm with the TCP that should be moved to the target
- allow_gripper_collision: bool | None = None#
If the gripper can collide with something
- movement_type: pycram.datastructures.enums.MovementType | None#
The type of movement that should be performed.
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.Arms#
Bases:
enum.IntEnumEnum for Arms.
- LEFT = 0#
- RIGHT = 1#
- BOTH = 2#
- __str__()#
Return str(self).
- __repr__()#
Return repr(self).
- class pycram.robot_plans.AxisIdentifier#
Bases:
enum.EnumEnum for translating the axis name to a vector along that axis.
- X = (1, 0, 0)#
- Y = (0, 1, 0)#
- Z = (0, 0, 1)#
- Undefined = (0, 0, 0)#
- classmethod from_tuple(axis_tuple)#
- class pycram.robot_plans.Grasp#
Base class for grasp enums.
- __hash__()#
- classmethod from_axis_direction(axis: AxisIdentifier, direction: int)#
Get the Grasp face from an axis-index tuple
- class pycram.robot_plans.ApproachDirection#
Bases:
Grasp,enum.EnumEnum for the approach direction of a gripper. The AxisIdentifier is used to identify the axis of the gripper, and the int is used to identify the direction along
that axis.
- FRONT#
- BACK#
- RIGHT#
- LEFT#
- property axis: AxisIdentifier#
Returns the axis of the approach direction.
- class pycram.robot_plans.VerticalAlignment#
Bases:
Grasp,enum.EnumEnum for the vertical alignment of a gripper. The AxisIdentifier is used to identify the axis of the gripper, and the int is used to identify the direction along
that axis.
- TOP#
- BOTTOM#
- NoAlignment#
- class pycram.robot_plans.RobotDescription(name: str, base_link: str, torso_link: str, torso_joint: str, urdf_path: str, virtual_mobile_base_joints: typing_extensions.Optional[pycram.datastructures.dataclasses.VirtualMobileBaseJoints] = None, mjcf_path: typing_extensions.Optional[str] = None, ignore_joints: typing_extensions.Optional[typing_extensions.List[str]] = None, gripper_name: typing_extensions.Optional[str] = None)#
Base class of a robot description. Contains all necessary information about a robot, like the URDF, the base link, the torso link and joint, the kinematic chains and cameras.
- current_robot_description: RobotDescription = None#
The currently loaded robot description.
- name: str#
Name of the robot
- base_link: str#
Base link of the robot
- torso_link: str#
Torso link of the robot
- torso_joint: str#
Torso joint of the robot
- urdf_object: urdf_parser_py.urdf.URDF#
Parsed URDF of the robot
- kinematic_chains: typing_extensions.Dict[str, KinematicChainDescription]#
All kinematic chains defined for this robot
- cameras: typing_extensions.Dict[str, CameraDescription]#
All cameras defined for this robot
- links: typing_extensions.List[str]#
All links defined in the URDF
- joints: typing_extensions.List[str]#
All joints defined in the URDF, by default fixed joints are not included
- virtual_mobile_base_joints: typing_extensions.Optional[pycram.datastructures.dataclasses.VirtualMobileBaseJoints] = None#
Virtual mobile base joint names for mobile robots, these joints are not part of the URDF, however they are used to move the robot in the simulation (e.g. set_pose for the robot would actually move these joints)
- gripper_name: typing_extensions.Optional[str] = None#
Name of the gripper of the robot if it has one, this is used when the gripper is a different Object with its own description file outside the robot description file.
- neck: typing_extensions.Dict[str, typing_extensions.List[str]]#
Dictionary of neck links and joints. Keys are yaw, pitch and roll, values are [link, joint]
- ignore_joints = []#
- joint_types#
- joint_actuators: typing_extensions.Optional[typing_extensions.Dict]#
- add_arm(end_link: str, arm_type: pycram.datastructures.enums.Arms = Arms.RIGHT, arm_name: str = 'manipulator', arm_home_values: typing_extensions.Optional[typing_extensions.Dict[str, float]] = None, arm_start: typing_extensions.Optional[str] = None) KinematicChainDescription#
Creates and adds an arm to the RobotDescription.
- Parameters:
end_link – Last link of the arm
arm_type – Type of the arm
arm_name – Name of the arm
arm_home_values – Dictionary of joint names and their home values (default configuration) (e.g. park arms)
arm_start – Start link of the arm
- property has_actuators#
Property to check if the robot has actuators defined in the MJCF file.
- Returns:
True if the robot has actuators, False otherwise
- get_actuator_for_joint(joint: str) typing_extensions.Optional[str]#
Get the actuator name for a given joint.
- Parameters:
joint – Name of the joint
- Returns:
Name of the actuator
- add_kinematic_chain_description(chain: KinematicChainDescription)#
Adds a KinematicChainDescription object to the RobotDescription. The chain is stored with the name of the chain as key.
- Parameters:
chain – KinematicChainDescription object to add
- add_kinematic_chain(name: str, start_link: str, end_link: str)#
Creates and adds a KinematicChainDescription object to the RobotDescription.
- Parameters:
name – Name of the KinematicChainDescription object
start_link – First link of the chain
end_link – Last link of the chain
- add_camera_description(camera: CameraDescription)#
Adds a CameraDescription object to the RobotDescription. The camera is stored with the name of the camera as key. :param camera: The CameraDescription object to add
- add_camera(name: str, camera_link: str, minimal_height: float, maximal_height: float)#
Creates and adds a CameraDescription object to the RobotDescription. Minimal and maximal height of the camera are relevant if the robot has a moveable torso or the camera is mounted on a moveable part of the robot. Otherwise both values can be the same.
- Parameters:
name – Name of the CameraDescription object
camera_link – Link of the camera in the URDF
minimal_height – Minimal height of the camera
maximal_height – Maximal height of the camera
- Returns:
- get_manipulator_chains() typing_extensions.List[KinematicChainDescription]#
Get a list of all manipulator chains of the robot which posses an end effector.
- Returns:
A list of KinematicChainDescription objects
- get_camera_frame(robot_object_name: str = None) str#
Quick method to get the name of a link of a camera. Uses the first camera in the list of cameras.
- Returns:
A name of the link of a camera
- get_camera_link() str#
Quick method to get the name of a link of a camera. Uses the first camera in the list of cameras.
- Returns:
A name of the link of a camera
- get_default_camera() CameraDescription#
Get the first camera in the list of cameras.
- Returns:
A CameraDescription object
- get_static_joint_chain(kinematic_chain_name: str, configuration_name: typing_extensions.Union[str, enum.Enum])#
Get the static joint states of a kinematic chain for a specific configuration. When trying to access one of the robot arms the function :func: get_arm_chain should be used.
- Parameters:
kinematic_chain_name
configuration_name
- Returns:
- get_offset(name: str) typing_extensions.Optional[pycram.datastructures.pose.PoseStamped]#
Returns the offset of a Joint in the URDF.
- Parameters:
name – The name of the Joint for which the offset will be returned.
- Returns:
The offset of the Joint
- get_parent(name: str) str#
Get the parent of a link or joint in the URDF. Always returns the immediate parent, for a link this is a joint and vice versa.
- Parameters:
name – Name of the link or joint in the URDF
- Returns:
Name of the parent link or joint
- get_child(name: str, return_multiple_children: bool = False) typing_extensions.Union[str, typing_extensions.List[str]]#
Get the child of a link or joint in the URDF. Always returns the immediate child, for a link this is a joint and vice versa. Since a link can have multiple children, the return_multiple_children parameter can be set to True to get a list of all children.
- Parameters:
name – Name of the link or joint in the URDF
return_multiple_children – If True, a list of all children is returned
- Returns:
Name of the child link or joint or a list of all children
- get_arm_tool_frame(arm: pycram.datastructures.enums.Arms) str#
Get the name of the tool frame of a specific arm.
- Parameters:
arm – Arm for which the tool frame should be returned
- Returns:
The name of the link of the tool frame in the URDF.
- get_arm_chain(arm: pycram.datastructures.enums.Arms) typing_extensions.Union[KinematicChainDescription, typing_extensions.List[KinematicChainDescription]]#
Get the kinematic chain of a specific arm. If the arm is set to BOTH, all kinematic chains are returned.
- Parameters:
arm – Arm for which the chain should be returned
- Returns:
KinematicChainDescription object of the arm
- set_neck(yaw_joint: typing_extensions.Optional[str] = None, pitch_joint: typing_extensions.Optional[str] = None, roll_joint: typing_extensions.Optional[str] = None)#
Defines the neck configuration of the robot by setting the yaw, pitch, and roll joints along with their corresponding links.
- Parameters:
yaw_joint – The joint name for the yaw movement of the neck.
pitch_joint – The joint name for the pitch movement of the neck.
roll_joint – The joint name for the roll movement of the neck.
- get_neck() typing_extensions.Dict[str, typing_extensions.List[typing_extensions.Optional[str]]]#
Retrieves the neck configuration of the robot, including links and joints for yaw, pitch, and roll.
- Returns:
A dictionary containing the neck configuration. Keys are yaw, pitch, and roll. Values are [link, joint].
- load()#
Loads the robot description in the robot description manager, can be overridden to take more parameter into account.
- unload()#
Unloads the robot description in the robot description manager, can be overridden to take more parameter into account.
- class pycram.robot_plans.MixingAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionMixes contents of an object using a tool in a spiral motion.
- object_: semantic_digital_twin.world_description.world_entity.Body#
The object to be mixed.
- tool: semantic_digital_twin.world_description.world_entity.SemanticAnnotation#
The tool to be used for mixing.
- arm: pycram.datastructures.enums.Arms#
The arm to be used for the mixing action.
- technique: typing_extensions.Optional[str] = None#
The technique to be used for mixing, e.g. ‘Spiral Mixing’.
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- classmethod description(object_: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Body], semantic_digital_twin.world_description.world_entity.Body], tool: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.SemanticAnnotation], semantic_digital_twin.world_description.world_entity.SemanticAnnotation], arm: typing_extensions.Optional[typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.Arms], pycram.datastructures.enums.Arms]] = None, technique: typing_extensions.Optional[typing_extensions.Union[typing_extensions.Iterable[str], str]] = None)#
- class pycram.robot_plans.PouringAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionPerforms a pouring action with a tool over an object, typically used for liquids.
- object_: semantic_digital_twin.world_description.world_entity.Body#
The object over which the pouring action is performed.
- tool: semantic_digital_twin.world_description.world_entity.SemanticAnnotation#
The tool used for pouring, e.g., a jug or a bottle.
- arm: pycram.datastructures.enums.Arms#
The arm to be used for the pouring action.
- technique: typing_extensions.Optional[str] = None#
The technique to be used for pouring, e.g., ‘Pouring’.
- angle: typing_extensions.Optional[float] = 90#
The angle at which the tool is tilted during the pouring action, in degrees.
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- classmethod description(object_: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Body], semantic_digital_twin.world_description.world_entity.Body], tool: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.SemanticAnnotation], semantic_digital_twin.world_description.world_entity.SemanticAnnotation], arm: typing_extensions.Optional[typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.Arms], pycram.datastructures.enums.Arms]] = None, technique: typing_extensions.Optional[typing_extensions.Union[typing_extensions.Iterable[str], str]] = None, angle: typing_extensions.Optional[typing_extensions.Union[typing_extensions.Iterable[float], float]] = 90)#
- class pycram.robot_plans.CuttingAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionPerforms a cutting action on an object using a specified tool.
- object_: semantic_digital_twin.world_description.world_entity.Body#
The object to be cut.
- tool: semantic_digital_twin.world_description.world_entity.SemanticAnnotation#
The tool used for cutting, e.g., a knife or a saw.
- arm: pycram.datastructures.enums.Arms#
The arm to be used for the cutting action.
- technique: typing_extensions.Optional[str] = None#
The technique to be used for cutting, e.g., ‘Slicing’, ‘Halving’, etc.
- slice_thickness: typing_extensions.Optional[float] = 0.03#
The thickness of each slice to be cut from the object, in meters.
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- classmethod description(object_: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Body], semantic_digital_twin.world_description.world_entity.Body], tool: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.SemanticAnnotation], semantic_digital_twin.world_description.world_entity.SemanticAnnotation], arm: typing_extensions.Optional[typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.Arms], pycram.datastructures.enums.Arms]] = None, technique: typing_extensions.Optional[typing_extensions.Union[typing_extensions.Iterable[str], str]] = None, slice_thickness: typing_extensions.Optional[float] = 0.03)#
- calculate_slices(obj_length)#
- static perpendicular_pose(slice_pose, angle) pycram.datastructures.pose.PoseStamped#
- static get_rotation_offset_from_axis_preference(pose_a, pose_b: pycram.datastructures.pose.PoseStamped) Tuple[int, float]#
Compute a discrete rotation offset (-90 or 90 degrees) to align this pose’s local axes with the direction toward a target pose, based on which axis (X or Y) is more aligned.
- Parameters:
pose_a – The source pose.
pose_b – The target pose to align with.
- Returns:
Tuple of (rotation offset in degrees, signed angle difference in radians for Y axis).
- pycram.robot_plans.CuttingActionDescription#
- pycram.robot_plans.PouringActionDescription#
- pycram.robot_plans.MixingActionDescription#
- pycram.robot_plans.ParkArmsActionDescription#
- pycram.robot_plans.PickUpActionDescription#
- pycram.robot_plans.PlaceActionDescription#
- pycram.robot_plans.OpenActionDescription#
- class pycram.robot_plans.GraspDescription#
Bases:
pycram.has_parameters.HasParametersRepresents a grasp description with a side grasp, top face, and orientation alignment.
- approach_direction: pycram.datastructures.enums.ApproachDirection#
The primary approach direction.
- vertical_alignment: pycram.datastructures.enums.VerticalAlignment#
The vertical alignment when grasping the pose
- rotate_gripper: bool = False#
Indicates if the gripper should be rotated by 90°. Must be a boolean.
- __hash__()#
- as_list() typing_extensions.List[typing_extensions.Union[pycram.datastructures.enums.Grasp, typing_extensions.Optional[pycram.datastructures.enums.Grasp], bool]]#
- Returns:
A list representation of the grasp description.
- get_grasp_pose(end_effector: semantic_digital_twin.robots.abstract_robot.Manipulator, body: semantic_digital_twin.world_description.world_entity.Body, translate_rim_offset: bool = False) pycram.datastructures.pose.PoseStamped#
Translates the grasp pose of the object using the desired grasp description and object knowledge. Leaves the orientation untouched. Returns the translated grasp pose.
- Parameters:
end_effector – The end effector that will be used to grasp the object.
body – The body of the object to be grasped.
translate_rim_offset – If True, the grasp pose will be translated along the rim offset.
- Returns:
The grasp pose of the object.
- calculate_grasp_orientation(front_orientation: numpy.ndarray) typing_extensions.List[float]#
Calculates the grasp orientation based on the approach axis and the grasp description.
- Parameters:
front_orientation – The front-facing orientation of the end effector as a numpy array.
- Returns:
The calculated orientation as a quaternion.
- static calculate_grasp_descriptions(robot: semantic_digital_twin.robots.abstract_robot.AbstractRobot, pose: pycram.datastructures.pose.PoseStamped, grasp_alignment: typing_extensions.Optional[PreferredGraspAlignment] = None) typing_extensions.List[GraspDescription]#
This method determines the possible grasp configurations (approach axis and vertical alignment) of the body, taking into account the bodies orientation, position, and whether the gripper should be rotated by 90°.
- Parameters:
robot – The robot for which the grasp configurations are being calculated.
grasp_alignment – An optional PreferredGraspAlignment object that specifies preferred grasp axis,
pose – The pose of the object to be grasped.
- Returns:
A sorted list of GraspDescription instances representing all grasp permutations.
- static calculate_closest_faces(pose_to_robot_vector: pycram.datastructures.pose.Vector3, specified_grasp_axis: pycram.datastructures.enums.AxisIdentifier = AxisIdentifier.Undefined) typing_extensions.Union[Tuple[pycram.datastructures.enums.ApproachDirection, pycram.datastructures.enums.ApproachDirection], Tuple[pycram.datastructures.enums.VerticalAlignment, pycram.datastructures.enums.VerticalAlignment]]#
Determines the faces of the object based on the input vector.
If specified_grasp_axis is None, it calculates the primary and secondary faces based on the vector’s magnitude determining which sides of the object are most aligned with the robot. This will either be the x, y plane for side faces or the z axis for top/bottom faces. If specified_grasp_axis is provided, it only considers the specified axis and calculates the faces aligned with that axis.
- Parameters:
pose_to_robot_vector – A 3D vector representing one of the robot’s axes in the pose’s frame, with irrelevant components set to np.nan.
specified_grasp_axis – Specifies a specific axis (e.g., X, Y, Z) to focus on.
- Returns:
A tuple of two Grasp enums representing the primary and secondary faces.
- class pycram.robot_plans.ProbabilisticCostmapLocation(target: typing_extensions.Union[pycram.datastructures.pose.PoseStamped, semantic_digital_twin.world_description.world_entity.Body], reachable_for: typing_extensions.Optional[typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.robots.abstract_robot.AbstractRobot], semantic_digital_twin.robots.abstract_robot.AbstractRobot]] = None, visible_for: typing_extensions.Optional[typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.robots.abstract_robot.AbstractRobot], semantic_digital_twin.robots.abstract_robot.AbstractRobot]] = None, reachable_arm: typing_extensions.Optional[typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.Arms], pycram.datastructures.enums.Arms]] = None, ignore_collision_with: typing_extensions.Optional[typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Body], semantic_digital_twin.world_description.world_entity.Body]] = None, grasp_descriptions: typing_extensions.Optional[typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.grasp.GraspDescription], pycram.datastructures.grasp.GraspDescription]] = None, object_in_hand: typing_extensions.Optional[typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Body], semantic_digital_twin.world_description.world_entity.Body]] = None, rotation_agnostic: bool = False, number_of_samples: int = 300, costmap_resolution: float = 0.1)#
Bases:
pycram.designator.LocationDesignatorDescriptionUses Costmaps to create locations for complex constrains. The construction of the probabilistic circuit can be quite time-consuming, but the majority of the computational load is done during the first iteration only. In this case the exact time is highly dependent on the number of links in the world.
- target_x#
Variable representing the x coordinate of the target pose
- target_y#
Variable representing the y coordinate of the target pose
- number_of_samples = 300#
- costmap_resolution = 0.05#
- target: typing_extensions.Union[pycram.datastructures.pose.PoseStamped, semantic_digital_twin.world_description.world_entity.Body]#
- reachable_for: semantic_digital_twin.robots.abstract_robot.AbstractRobot = None#
- visible_for: semantic_digital_twin.robots.abstract_robot.AbstractRobot = None#
- reachable_arm: typing_extensions.Optional[pycram.datastructures.enums.Arms] = None#
- ignore_collision_with = None#
- grasps: typing_extensions.List[typing_extensions.Optional[pycram.datastructures.enums.Grasp]] = None#
- ground() pycram.datastructures.pose.PoseStamped#
Default specialized_designators which returns the first element of the iterator of this instance.
- Returns:
A resolved location
- static _calculate_room_event(world: semantic_digital_twin.world.World, free_space_graph: semantic_digital_twin.world_description.graph_of_convex_sets.GraphOfConvexSets, target_position: pycram.datastructures.pose.Vector3) random_events.product_algebra.Event#
Calculates an event for the free space inside the room around the target position is located in, in 2d.
- Parameters:
world – The current world
free_space_graph – The free space graph that is used as basis for the room calculation
target_position – The position of the target in the world
- Returns:
An Event that describes the room around the target position in 2d
- _create_free_space_conditions(world: semantic_digital_twin.world.World, target_position: pycram.datastructures.pose.Vector3, search_distance: float = 1.5) typing_extensions.Tuple[random_events.product_algebra.Event, random_events.product_algebra.Event, random_events.product_algebra.Event]#
Creates the conditions for the free space around the target position. 1. reachable_space_condition: The condition that describes the reachable space around the target position in 3d 2. navigation_space_condition: The condition that describes the navigation space around the target position in 2d 3. room_condition: The condition that describes the room around the target position in 2d
- Parameters:
world – The current world
target_position – The position of the target in the world
search_distance – The distance around the target position to search for free space, defaults to 1.5 meters
- Returns:
A tuple containing the reachable space condition, navigation space condition and room condition
Creates a probabilistic circuit that samples navigation poses around the target position.
- __iter__() typing_extensions.Iterator[pycram.datastructures.pose.PoseStamped]#
Creates a costmap on top of a link of an Object and creates positions from it. If there is a specific Object for which the position should be found, a height offset will be calculated which ensures that the bottom of the Object is at the position in the Costmap and not the origin of the Object which is usually in the centre of the Object.
- Yield:
An instance of ProbabilisticSemanticLocation.Location with the found valid position of the Costmap.
- class pycram.robot_plans.BelieveObject#
Bases:
ObjectDesignatorDescriptionDescription for Objects that are only believed in.
- exception pycram.robot_plans.ObjectUnfetchable(*args, **kwargs)#
Bases:
HighLevelFailureThrown when no base positioning can assure a reachable pose to grasp the object from.
- exception pycram.robot_plans.ConfigurationNotReached(goal_validator: pycram.validation.goal_validator.MultiJointPositionGoalValidator, configuration_type: pycram.datastructures.enums.StaticJointState, *args, **kwargs)#
Bases:
PlanFailureImplementation of plan failures.
- goal_validator: pycram.validation.goal_validator.MultiJointPositionGoalValidator#
The goal validator that was used to check if the goal was reached.
- configuration_type: pycram.datastructures.enums.StaticJointState#
The configuration type that should be reached.
- class pycram.robot_plans.TransportAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionTransports an object to a position using an arm
- object_designator: semantic_digital_twin.world_description.world_entity.Body#
Object designator_description describing the object that should be transported.
- target_location: pycram.datastructures.pose.PoseStamped#
Target Location to which the object should be transported
- arm: typing_extensions.Optional[pycram.datastructures.enums.Arms]#
Arm that should be used
- place_rotation_agnostic: typing_extensions.Optional[bool] = False#
If True, the robot will place the object in the same orientation as it is itself, no matter how the object was grasped.
- _pre_perform_callbacks = []#
List to save the callbacks which should be called before performing the action.
- __post_init__()#
- inside_container() List[semantic_digital_twin.world_description.world_entity.Body]#
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#
- classmethod description(object_designator: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Body], semantic_digital_twin.world_description.world_entity.Body], target_location: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.pose.PoseStamped], pycram.datastructures.pose.PoseStamped], arm: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.Arms], pycram.datastructures.enums.Arms] = None, place_rotation_agnostic: typing_extensions.Optional[bool] = False) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[TransportAction]]#
- class pycram.robot_plans.PickAndPlaceAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionTransports an object to a position using an arm without moving the base of the robot
- object_designator: semantic_digital_twin.world_description.world_entity.Body#
Object designator_description describing the object that should be transported.
- target_location: pycram.datastructures.pose.PoseStamped#
Target Location to which the object should be transported
- arm: pycram.datastructures.enums.Arms#
Arm that should be used
- grasp_description: pycram.datastructures.grasp.GraspDescription#
Description of the grasp to pick up the target
- _pre_perform_callbacks = []#
List to save the callbacks which should be called before performing the action.
- __post_init__()#
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#
- classmethod description(object_designator: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Body], semantic_digital_twin.world_description.world_entity.Body], target_location: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.pose.PoseStamped], pycram.datastructures.pose.PoseStamped], arm: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.Arms], pycram.datastructures.enums.Arms] = None, grasp_description=GraspDescription) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[PickAndPlaceAction]]#
- class pycram.robot_plans.MoveAndPlaceAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionNavigate to standing_position, then turn towards the object and pick it up.
- standing_position: pycram.datastructures.pose.PoseStamped#
The pose to stand before trying to pick up the object
- object_designator: semantic_digital_twin.world_description.world_entity.Body#
The object to pick up
- target_location: pycram.datastructures.pose.PoseStamped#
The location to place the object.
- arm: pycram.datastructures.enums.Arms#
The arm to use
- keep_joint_states: bool#
Keep the joint states of the robot the same during the navigation.
- plan()#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#
- classmethod description(standing_position: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.pose.PoseStamped], pycram.datastructures.pose.PoseStamped], object_designator: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Body], semantic_digital_twin.world_description.world_entity.Body], target_location: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.pose.PoseStamped], pycram.datastructures.pose.PoseStamped], arm: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.Arms], pycram.datastructures.enums.Arms] = None, keep_joint_states: typing_extensions.Union[typing_extensions.Iterable[bool], bool] = ActionConfig.navigate_keep_joint_states) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[MoveAndPlaceAction]]#
- class pycram.robot_plans.MoveAndPickUpAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionNavigate to standing_position, then turn towards the object and pick it up.
- standing_position: pycram.datastructures.pose.PoseStamped#
The pose to stand before trying to pick up the object
- object_designator: semantic_digital_twin.world_description.world_entity.Body#
The object to pick up
- arm: pycram.datastructures.enums.Arms#
The arm to use
- grasp_description: pycram.datastructures.grasp.GraspDescription#
The grasp to use
- keep_joint_states: bool#
Keep the joint states of the robot the same during the navigation.
- _pre_perform_callbacks = []#
List to save the callbacks which should be called before performing the action.
- __post_init__()#
- plan()#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#
- classmethod description(standing_position: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.pose.PoseStamped], pycram.datastructures.pose.PoseStamped], object_designator: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.pose.PoseStamped], pycram.datastructures.pose.PoseStamped], arm: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.Arms], pycram.datastructures.enums.Arms] = None, grasp_description: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.Grasp], pycram.datastructures.enums.Grasp] = None, keep_joint_states: typing_extensions.Union[typing_extensions.Iterable[bool], bool] = ActionConfig.navigate_keep_joint_states) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[MoveAndPickUpAction]]#
- class pycram.robot_plans.EfficientTransportAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionTo transport an object to a target location by choosing the closest available arm using simple Euclidean distance.
- object_designator: semantic_digital_twin.world_description.world_entity.Body#
- target_location: pycram.datastructures.pose.PoseStamped#
- _choose_best_arm(robot: semantic_digital_twin.world_description.world_entity.Body, obj: semantic_digital_twin.world_description.world_entity.Body) pycram.datastructures.enums.Arms#
Function to find the closest available arm.
- plan() None#
The main plan for the transport action, optimized for a stationary robot.
- classmethod description(object_designator: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Body], semantic_digital_twin.world_description.world_entity.Body], target_location: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.pose.PoseStamped], pycram.datastructures.pose.PoseStamped]) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[EfficientTransportAction]]#
- pycram.robot_plans.TransportActionDescription#
- pycram.robot_plans.PickAndPlaceActionDescription#
- pycram.robot_plans.MoveAndPlaceActionDescription#
- pycram.robot_plans.MoveAndPickUpActionDescription#
- pycram.robot_plans.EfficientTransportActionDescription#
- pycram.robot_plans.GraspingActionDescription#
- class pycram.robot_plans.OpeningMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionDesignator for opening container
- object_part: semantic_digital_twin.world_description.world_entity.Body#
Object designator for the drawer handle
- arm: pycram.datastructures.enums.Arms#
Arm that should be used
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.ClosingMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionDesignator for closing a container
- object_part: semantic_digital_twin.world_description.world_entity.Body#
Object designator for the drawer handle
- arm: pycram.datastructures.enums.Arms#
Arm that should be used
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.MoveGripperMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionOpens or closes the gripper
- motion: pycram.datastructures.enums.GripperState#
Motion that should be performed, either ‘open’ or ‘close’
- gripper: pycram.datastructures.enums.Arms#
Name of the gripper that should be moved
- allow_gripper_collision: bool | None = None#
If the gripper is allowed to collide with something
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.GripperState#
Bases:
enum.EnumEnum for the different motions of the gripper.
- OPEN#
- CLOSE#
- MEDIUM#
- __str__()#
- __repr__()#
- class pycram.robot_plans.ContainerManipulationType#
Bases:
enum.EnumEnum for the different types of container manipulation.
- Opening#
The Opening type is used to open a container.
- Closing#
The Closing type is used to close a container.
- exception pycram.robot_plans.ContainerManipulationError(robot: Object, arms: typing_extensions.List[pycram.datastructures.enums.Arms], body: PhysicalBody, container_joint: Joint, manipulation_type: pycram.datastructures.enums.ContainerManipulationType, *args, **kwargs)#
Bases:
ManipulationLowLevelFailure,abc.ABCThrown when container manipulation fails.
- container_joint: Joint#
The joint of the container that should be manipulated.
- manipulation_type: pycram.datastructures.enums.ContainerManipulationType#
The type of manipulation that should be performed on the container.
- class pycram.robot_plans.OpenAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionOpens a container like object
- object_designator: semantic_digital_twin.world_description.world_entity.Body#
Object designator_description describing the object that should be opened
- arm: pycram.datastructures.enums.Arms#
Arm that should be used for opening the container
- grasping_prepose_distance: float#
The distance in meters the gripper should be at in the x-axis away from the handle.
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#
Check if the container is opened, this assumes that the container state can be read accurately from the real world.
- classmethod description(object_designator_description: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Body], semantic_digital_twin.world_description.world_entity.Body], arm: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.Arms], pycram.datastructures.enums.Arms] = None, grasping_prepose_distance: typing_extensions.Union[typing_extensions.Iterable[float], float] = ActionConfig.grasping_prepose_distance) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[OpenAction]]#
- class pycram.robot_plans.CloseAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionCloses a container like object.
- object_designator: semantic_digital_twin.world_description.world_entity.Body#
Object designator_description describing the object that should be closed
- arm: pycram.datastructures.enums.Arms#
Arm that should be used for closing
- grasping_prepose_distance: float#
The distance in meters between the gripper and the handle before approaching to grasp.
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#
Check if the container is closed, this assumes that the container state can be read accurately from the real world.
- classmethod description(object_designator_description: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Body], semantic_digital_twin.world_description.world_entity.Body], arm: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.Arms], pycram.datastructures.enums.Arms] = None, grasping_prepose_distance: typing_extensions.Union[typing_extensions.Iterable[float], float] = ActionConfig.grasping_prepose_distance) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[CloseAction]]#
- pycram.robot_plans.validate_close_open(object_designator: semantic_digital_twin.world_description.world_entity.Body, arm: pycram.datastructures.enums.Arms, action_type: typing_extensions.Union[typing_extensions.Type[OpenAction], typing_extensions.Type[CloseAction]])#
Validates if the container is opened or closed by checking the joint position of the container.
- Parameters:
object_designator – The object designator_description describing the object that should be opened or closed.
arm – The arm that should be used for opening or closing the container.
action_type – The type of the action that should be validated.
- pycram.robot_plans.check_opened(joint_obj: semantic_digital_twin.world_description.world_entity.Connection, obj_part: semantic_digital_twin.world_description.world_entity.Body, arm: pycram.datastructures.enums.Arms, upper_limit: float)#
- pycram.robot_plans.check_closed(joint_obj: semantic_digital_twin.world_description.world_entity.Connection, obj_part: semantic_digital_twin.world_description.world_entity.Body, arm: pycram.datastructures.enums.Arms, lower_limit: float)#
- pycram.robot_plans.CloseActionDescription#
- class pycram.robot_plans.MovementType#
Bases:
enum.EnumEnum for the different movement types of the robot.
- STRAIGHT_TRANSLATION#
- STRAIGHT_CARTESIAN#
- TRANSLATION#
- CARTESIAN#
- class pycram.robot_plans.FindBodyInRegionMethod#
Bases:
enum.EnumEnum for the different methods to find a body in a region.
- FingerToCentroid#
- The FingerToCentroid method is used to find the body in a region by casting a ray from each finger to the
centroid of the region.
- Centroid#
The Centroid method is used to find the body in a region by calculating the centroid of the region and casting two rays from opposite sides of the region to the centroid.
- MultiRay#
The MultiRay method is used to find the body in a region by casting multiple rays covering the region.
- exception pycram.robot_plans.ObjectNotGraspedError(obj: Object, robot: Object, arm: pycram.datastructures.enums.Arms, grasp=None, *args, **kwargs)#
Bases:
Grasping
- exception pycram.robot_plans.ObjectNotInGraspingArea(obj: Object, robot: Object, arm: pycram.datastructures.enums.Arms, grasp, *args, **kwargs)#
Bases:
ReachabilityFailure
- class pycram.robot_plans.EndEffectorDescription(name: str, start_link: str, tool_frame: str, urdf_object: urdf_parser_py.urdf.URDF, gripper_object_name: typing_extensions.Optional[str] = None, opening_distance: typing_extensions.Optional[float] = None, fingers_link_names: typing_extensions.Optional[typing_extensions.List[str]] = None)#
Describes an end effector of robot. Contains all necessary information about the end effector, like the base link, the tool frame, the URDF object and the static joint states.
- name: str#
Name of the end effector
- start_link: str#
Root link of the end effector, every link below this link in the URDF is part of the end effector
- tool_frame: str#
Name of the tool frame link in the URDf
- urdf_object: urdf_parser_py.urdf.URDF#
Parsed URDF of the robot
- link_names: typing_extensions.List[str]#
List of all links in the end effector
- joint_names: typing_extensions.List[str]#
List of all joints in the end effector
- static_joint_states: typing_extensions.Dict[pycram.datastructures.enums.GripperState, typing_extensions.Dict[str, float]]#
Dictionary of static joint states for the end effector
- end_effector_type: pycram.datastructures.enums.GripperType#
Type of the gripper
- opening_distance: float#
Distance the gripper can open, in cm
- gripper_object_name: typing_extensions.Optional[str] = None#
Name of the gripper of the robot if it has one, this is used when the gripper is a different Object with its own description file outside the robot description file.
- fingers_link_names: typing_extensions.Optional[typing_extensions.List[str]] = None#
List of all links of the fingers of the gripper
- grasps: typing_extensions.Dict[pycram.datastructures.grasp.GraspDescription, typing_extensions.List[float]]#
Dictionary of all grasp orientations of the end effector
- approach_axis: typing_extensions.List[float]#
Relative axis along which the end effector is approaching an object
- _init_links_joints()#
Traverses the URDF object to get all links and joints of the end effector below the start link.1
- add_static_joint_states(name: pycram.datastructures.enums.GripperState, states: dict)#
Adds static joint states to the end effector. These define a specific configuration of the end effector. Like open and close configurations of a gripper.
- Parameters:
name – Name of the static joint states
states – Dictionary of joint names and their values
- property links: typing_extensions.List[str]#
Property to get the links of the chain.
- Returns:
List of link names
- property joints: typing_extensions.List[str]#
Property to get the joints of the chain.
- Returns:
List of joint names
- update_all_grasp_orientations(front_orientation: typing_extensions.List[float])#
Generates all grasp quaternion orientations based on a given front-facing quaternion orientation in-place, covering combinations of side grasps (front, back, left, right), top/bottom grasps, and horizontal rotation options.
- Parameters:
front_orientation – A quaternion representing the front-facing orientation as [x, y, z, w] quaternion.
- get_grasp(approach_direction: pycram.datastructures.enums.ApproachDirection, vertical_alignment: pycram.datastructures.enums.VerticalAlignment = VerticalAlignment.NoAlignment, rotate_gripper: bool = False) typing_extensions.List[float]#
Retrieves the quaternion orientation of the end effector for a specific grasp.
- Parameters:
approach_direction – The approach direction of the end effector.
vertical_alignment – The vertical alignment of the end effector.
rotate_gripper – True, the gripper should be rotated 90°.
- Returns:
List of floats representing the quaternion orientation of the end effector
- set_approach_axis(axis: typing_extensions.List[float])#
Sets the approach axis for the robot’s palm.
- Parameters:
axis – A list representing the approach axis.
- get_approach_axis() typing_extensions.List[float]#
Retrieves the approach axis.
- Returns:
A list representing the approach axis.
- class pycram.robot_plans.ViewManager#
- static get_end_effector_view(arm: pycram.datastructures.enums.Arms, robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot) typing_extensions.Optional[semantic_digital_twin.robots.abstract_robot.Manipulator]#
- static get_arm_view(arm: pycram.datastructures.enums.Arms, robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot) typing_extensions.Optional[semantic_digital_twin.robots.abstract_robot.KinematicChain]#
Get the arm view for a given arm and robot view.
- Parameters:
arm – The arm to get the view for.
robot_view – The robot view to search in.
- Returns:
The Manipulator object representing the arm.
- static get_neck_view(robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot) typing_extensions.Optional[semantic_digital_twin.robots.abstract_robot.Neck]#
Get the neck view for a given robot view.
- Parameters:
robot_view – The robot view to search in.
- Returns:
The Neck object representing the neck.
- class pycram.robot_plans.KinematicChainDescription(name: str, start_link: str, end_link: str, urdf_object: urdf_parser_py.urdf.URDF, arm_type: pycram.datastructures.enums.Arms = None, include_fixed_joints=False)#
Represents a kinematic chain of a robot. A Kinematic chain is a chain of links and joints that are connected to each other and can be moved.
This class contains all necessary information about the chain, like the start and end link, the URDF object and the joints of the chain.
- name: str#
Name of the chain
- start_link: str#
First link of the chain
- end_link: str#
Last link of the chain
- urdf_object: urdf_parser_py.urdf.URDF#
Parsed URDF of the robot
- include_fixed_joints: bool#
If True, fixed joints are included in the chain
- link_names: typing_extensions.List[str]#
List of all links in the chain
- joint_names: typing_extensions.List[str]#
List of all joints in the chain
- end_effector: EndEffectorDescription#
End effector of the chain, if there is one
- arm_type: pycram.datastructures.enums.Arms#
Type of the arm, if the chain is an arm
- static_joint_states: typing_extensions.Dict[typing_extensions.Union[str, enum.Enum], typing_extensions.Dict[str, float]]#
Dictionary of static joint states for the chain
- _init_links()#
Initializes the links of the chain by getting the chain from the URDF object.
- _init_joints()#
Initializes the joints of the chain by getting the chain from the URDF object.
- create_end_effector(name: str, tool_frame, opened_joint_values: typing_extensions.Dict[str, float], closed_joint_values: typing_extensions.Dict[str, float], relative_dir: typing_extensions.Optional[str] = None, resources_dir: typing_extensions.Optional[str] = None, description_name: str = 'gripper', opening_distance: typing_extensions.Optional[float] = None) EndEffectorDescription#
Create a gripper end effector description.
- Parameters:
name – The name of the gripper.
tool_frame – The name of the tool frame.
opened_joint_values – The joint values when the gripper is open.
closed_joint_values – The joint values when the gripper is closed.
relative_dir – The relative directory of the gripper in the Multiverse resources/robots directory.
resources_dir – The path to the resources directory.
description_name – The name of the gripper description.
opening_distance – The openning distance of the gripper.
- Returns:
The gripper end effector description.
- get_joints() typing_extensions.List[str]#
Get a list of all joints of the chain.
- Returns:
List of joint names
- get_links() typing_extensions.List[str]#
- Returns:
A list of all links of the chain.
- property links: typing_extensions.List[str]#
Property to get the links of the chain.
- Returns:
List of link names
- property joints: typing_extensions.List[str]#
Property to get the joints of the chain.
- Returns:
List of joint names
- add_static_joint_states(name: typing_extensions.Union[str, enum.Enum], states: dict)#
Adds static joint states to the chain. These define a specific configuration of the chain.
- Parameters:
name – Name of the static joint states
states – Dictionary of joint names and their values
- get_static_joint_states(name: typing_extensions.Union[str, enum.Enum]) typing_extensions.Dict[str, float]#
Get the dictionary of static joint states for a given name of the static joint states.
- Parameters:
name – Name of the static joint states
- Returns:
Dictionary of joint names and their values
- get_tool_frame() str#
Get the name of the tool frame of the end effector of this chain, if it has an end effector.
- Returns:
The name of the link of the tool frame in the URDF.
- get_static_gripper_state(state: pycram.datastructures.enums.GripperState) typing_extensions.Dict[str, float]#
Get the static joint states for the gripper of the chain.
- Parameters:
state – Name of the static joint states
- Returns:
Dictionary of joint names and their values
- pycram.robot_plans.translate_pose_along_local_axis(pose: pycram.datastructures.pose.PoseStamped, axis: typing_extensions.List | numpy.ndarray, distance: float) pycram.datastructures.pose.PoseStamped#
Translate a pose along a given 3d vector (axis) by a given distance. The axis is given in the local coordinate frame of the pose. The axis is normalized and then scaled by the distance.
- Parameters:
pose – The pose that should be translated
axis – The local axis along which the translation should be performed
distance – The distance by which the pose should be translated
- Returns:
The translated pose
- pycram.robot_plans.logger#
- class pycram.robot_plans.ReachToPickUpAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionLet the robot reach a specific pose.
- object_designator: semantic_digital_twin.world_description.world_entity.Body#
Object designator_description describing the object that should be picked up
- arm: pycram.datastructures.enums.Arms#
The arm that should be used for pick up
- grasp_description: pycram.datastructures.grasp.GraspDescription#
The grasp description that should be used for picking up the object
- _pre_perform_callbacks = []#
List to save the callbacks which should be called before performing the action.
- __post_init__()#
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- move_gripper_to_pose(pose: pycram.datastructures.pose.PoseStamped, movement_type: pycram.datastructures.enums.MovementType = MovementType.CARTESIAN, add_vis_axis: bool = True)#
Move the gripper to a specific pose.
- Parameters:
pose – The pose to go to.
movement_type – The type of movement that should be performed.
add_vis_axis – If a visual axis should be added to the world.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#
Check if object is contained in the gripper such that it can be grasped and picked up.
- classmethod description(object_designator: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Body], semantic_digital_twin.world_description.world_entity.Body], arm: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.Arms], pycram.datastructures.enums.Arms] = None, grasp_description: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.grasp.GraspDescription], pycram.datastructures.grasp.GraspDescription] = None) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[ReachToPickUpAction]]#
- class pycram.robot_plans.PickUpAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionLet the robot pick up an object.
- object_designator: semantic_digital_twin.world_description.world_entity.Body#
Object designator_description describing the object that should be picked up
- arm: pycram.datastructures.enums.Arms#
The arm that should be used for pick up
- grasp_description: pycram.datastructures.grasp.GraspDescription#
The GraspDescription that should be used for picking up the object
- _pre_perform_callbacks = []#
List to save the callbacks which should be called before performing the action.
- __post_init__()#
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#
Check if picked up object is in contact with the gripper.
- classmethod description(object_designator: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Body], semantic_digital_twin.world_description.world_entity.Body], arm: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.Arms], pycram.datastructures.enums.Arms] = None, grasp_description: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.grasp.GraspDescription], pycram.datastructures.grasp.GraspDescription] = None) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[PickUpAction]]#
- class pycram.robot_plans.GraspingAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionGrasps an object described by the given Object Designator description
- object_designator: semantic_digital_twin.world_description.world_entity.Body#
Object Designator for the object that should be grasped
- arm: pycram.datastructures.enums.Arms#
The arm that should be used to grasp
- prepose_distance: float#
The distance in meters the gripper should be at before grasping the object
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#
- classmethod description(object_designator: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Body], semantic_digital_twin.world_description.world_entity.Body], arm: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.Arms], pycram.datastructures.enums.Arms] = None, prepose_distance: typing_extensions.Union[typing_extensions.Iterable[float], float] = ActionConfig.grasping_prepose_distance) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[GraspingAction]]#
- pycram.robot_plans.ReachToPickUpActionDescription#
- class pycram.robot_plans.PerceptionQuery#
- semantic_annotation: typing_extensions.Type[semantic_digital_twin.world_description.world_entity.SemanticAnnotation]#
The semantic annotation for which to perceive
- region: semantic_digital_twin.world_description.geometry.BoundingBox#
The region in which the object should be detected
- robot: semantic_digital_twin.robots.abstract_robot.AbstractRobot#
‘ Robot annotation of the robot that should perceive the object.
- world: semantic_digital_twin.world.World#
The world in which the object should be detected.
- from_world() typing_extensions.List[semantic_digital_twin.world_description.world_entity.Body]#
- from_robokudo()#
- class pycram.robot_plans.DetectionState#
Bases:
int,enum.EnumEnum for the state of the detection task.
- START = 0#
- STOP = 1#
- PAUSE = 2#
- class pycram.robot_plans.DetectAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionDetects an object that fits the object description and returns an object designator_description describing the object.
If no object is found, an PerceptionObjectNotFound error is raised.
- technique: pycram.datastructures.enums.DetectionTechnique#
The technique that should be used for detection
- state: typing_extensions.Optional[pycram.datastructures.enums.DetectionState] = None#
The state of the detection, e.g Start Stop for continues perception
- object_sem_annotation: typing_extensions.Type[semantic_digital_twin.world_description.world_entity.SemanticAnnotation] = None#
The type of the object that should be detected, only considered if technique is equal to Type
- region: typing_extensions.Optional[semantic_digital_twin.world_description.world_entity.Region] = None#
The region in which the object should be detected
- __post_init__()#
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#
- classmethod description(technique: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.DetectionTechnique], pycram.datastructures.enums.DetectionTechnique], state: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.DetectionState], pycram.datastructures.enums.DetectionState] = None, object_sem_annotation: typing_extensions.Union[typing_extensions.Iterable[typing_extensions.Type[semantic_digital_twin.world_description.world_entity.SemanticAnnotation]], typing_extensions.Type[semantic_digital_twin.world_description.world_entity.SemanticAnnotation]] = None, region: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Region], semantic_digital_twin.world_description.world_entity.Region] = None) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[DetectAction]]#
- class pycram.robot_plans.MoveMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionMoves the robot to a designated location
- target: pycram.datastructures.pose.PoseStamped#
Location to which the robot should be moved
- keep_joint_states: bool = False#
Keep the joint states of the robot during/at the end of the motion
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.LookingMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionLets the robot look at a point
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- exception pycram.robot_plans.LookAtGoalNotReached(robot: Object, target: pycram.datastructures.pose.PoseStamped, *args, **kwargs)#
Bases:
LookingHighLevelFailureThrown when the look at goal is not reached.
Bases:
PlanFailureThrown when the navigation goal is not reached.
The current pose of the robot.
The goal pose of the robot.
- class pycram.robot_plans.PoseErrorChecker(acceptable_error: typing_extensions.Union[typing_extensions.Tuple[float], typing_extensions.Iterable[typing_extensions.Tuple[float]]] = (0.001, np.pi / 180), is_iterable: typing_extensions.Optional[bool] = False)#
Bases:
ErrorCheckerAn abstract class that resembles an error checker. It has two main methods, one for calculating the error between two values and another for checking if the error is acceptable.
- _calculate_error(value_1: typing_extensions.Any, value_2: typing_extensions.Any) typing_extensions.List[float]#
Calculate the error between two poses.
- Parameters:
value_1 – The first pose.
value_2 – The second pose.
Bases:
pycram.robot_plans.actions.base.ActionDescriptionNavigates the Robot to a position.
Location to which the robot should be navigated
Keep the joint states of the robot the same during the navigation.
Symbolic plan. Should only call motions or sub-actions.
- class pycram.robot_plans.LookAtAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionLets the robot look at a position.
- target: pycram.datastructures.pose.PoseStamped#
Position at which the robot should look, given as 6D pose
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#
Check if the robot is looking at the target location by spawning a virtual object at the target location and creating a ray from the camera and checking if it intersects with the object.
- classmethod description(target: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.pose.PoseStamped], pycram.datastructures.pose.PoseStamped]) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[LookAtAction]]#
- exception pycram.robot_plans.ObjectNotPlacedAtTargetLocation(obj: Object, placing_pose: pycram.datastructures.pose.PoseStamped, robot: Object, arm: pycram.datastructures.enums.Arms, *args, **kwargs)#
Bases:
ObjectPlacingErrorThrown when the object was not placed at the target location.
- exception pycram.robot_plans.ObjectStillInContact(obj: Object, contact_links: typing_extensions.List[Link], placing_pose: pycram.datastructures.pose.PoseStamped, robot: Object, arm: pycram.datastructures.enums.Arms, *args, **kwargs)#
Bases:
ObjectPlacingErrorThrown when the object is still in contact with the robot after placing.
- contact_links: typing_extensions.List[Link]#
The links of the robot that are still in contact with the object.
- class pycram.robot_plans.PlaceAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionPlaces an Object at a position using an arm.
- object_designator: semantic_digital_twin.world_description.world_entity.Body#
Object designator_description describing the object that should be place
- target_location: pycram.datastructures.pose.PoseStamped#
Pose in the world at which the object should be placed
- arm: pycram.datastructures.enums.Arms#
Arm that is currently holding the object
- _pre_perform_callbacks = []#
List to save the callbacks which should be called before performing the action.
- __post_init__()#
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#
Check if the object is placed at the target location.
- validate_loss_of_contact()#
Check if the object is still in contact with the robot after placing it.
- validate_placement_location()#
Check if the object is placed at the target location.
- classmethod description(object_designator: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Body], semantic_digital_twin.world_description.world_entity.Body], target_location: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.pose.PoseStamped], pycram.datastructures.pose.PoseStamped], arm: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.Arms], pycram.datastructures.enums.Arms]) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[PlaceAction]]#
- class pycram.robot_plans.Vector3Stamped#
Bases:
Vector3A Vector3 with an attached ROS Header (timestamp and frame). Inherits all vector operations and adds frame/time metadata.
- property frame_id#
- __repr__()#
- ros_message()#
Convert to a ROS Vector3Stamped message.
- Returns:
The ROS message.
- classmethod from_ros_message(message)#
Create a Vector3Stamped from a ROS message.
- Parameters:
message – The Vector3Stamped ROS message.
- Returns:
A new Vector3Stamped object.
- to_spatial_type() semantic_digital_twin.spatial_types.spatial_types.Vector3#
- exception pycram.robot_plans.TorsoGoalNotReached(goal_validator: typing_extensions.Optional[pycram.validation.goal_validator.MultiJointPositionGoalValidator] = None, *args, **kwargs)#
Bases:
TorsoLowLevelFailureThrown when the torso moved as a result of a torso action but the goal was not reached.
- class pycram.robot_plans.MoveJointsMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionMoves any joint on the robot
- names: list#
List of joint names that should be moved
- positions: list#
Target positions of joints, should correspond to the list of names
- align: bool | None = False#
If True, aligns the end-effector with a specified axis (optional).
- tip_link: str | None = None#
Name of the tip link to align with, e.g the object (optional).
- tip_normal: pycram.datastructures.pose.Vector3Stamped | None = None#
Normalized vector representing the current orientation axis of the end-effector (optional).
- root_link: str | None = None#
Base link of the robot; typically set to the torso (optional).
- root_normal: pycram.datastructures.pose.Vector3Stamped | None = None#
Normalized vector representing the desired orientation axis to align with (optional).
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- pycram.robot_plans.create_multiple_joint_goal_validator(robot: Object, joint_positions: typing_extensions.Union[typing_extensions.Dict[Joint, float], typing_extensions.Dict[str, float]]) MultiJointPositionGoalValidator#
Validate the multiple joint goals, and wait until the goal is achieved.
- Parameters:
robot – The robot object.
joint_positions – The joint positions to validate.
- class pycram.robot_plans.MoveTorsoAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionMove the torso of the robot up and down.
- torso_state: pycram.robot_descriptions.pr2_states.TorsoState#
The state of the torso that should be set
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: datetime.timedelta = timedelta(seconds=2))#
Create a goal validator for the joint positions and wait until the goal is achieved or the timeout is reached.
- classmethod description(torso_state: typing_extensions.Union[typing_extensions.Iterable[pycram.robot_descriptions.pr2_states.TorsoState], pycram.robot_descriptions.pr2_states.TorsoState]) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[MoveTorsoAction]]#
- class pycram.robot_plans.SetGripperAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionSet the gripper state of the robot.
- gripper: pycram.robot_descriptions.pr2_states.Arms#
The gripper that should be set
- motion: pycram.robot_descriptions.pr2_states.GripperStateEnum#
The motion that should be set on the gripper
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: datetime.timedelta = timedelta(seconds=2))#
Needs gripper state to be read or perceived.
- classmethod description(gripper: typing_extensions.Union[typing_extensions.Iterable[pycram.robot_descriptions.pr2_states.Arms], pycram.robot_descriptions.pr2_states.Arms], motion: typing_extensions.Union[typing_extensions.Iterable[pycram.robot_descriptions.pr2_states.GripperState], pycram.robot_descriptions.pr2_states.GripperState] = None) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[SetGripperAction]]#
- class pycram.robot_plans.ParkArmsAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionPark the arms of the robot.
- arm: pycram.robot_descriptions.pr2_states.Arms#
Entry from the enum for which arm should be parked.
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- get_joint_poses() Tuple[List[str], List[float]]#
- Returns:
The joint positions that should be set for the arm to be in the park position.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: datetime.timedelta = timedelta(seconds=2))#
Create a goal validator for the joint positions and wait until the goal is achieved or the timeout is reached.
- classmethod description(arm: typing_extensions.Union[typing_extensions.Iterable[pycram.robot_descriptions.pr2_states.Arms], pycram.robot_descriptions.pr2_states.Arms]) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[ParkArmsAction]]#
- class pycram.robot_plans.CarryAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionParks the robot’s arms. And align the arm with the given Axis of a frame.
- arm: pycram.robot_descriptions.pr2_states.Arms#
Entry from the enum for which arm should be parked.
- align: typing_extensions.Optional[bool] = False#
If True, aligns the end-effector with a specified axis.
- tip_link: typing_extensions.Optional[str] = None#
Name of the tip link to align with, e.g the object.
- tip_axis: typing_extensions.Optional[pycram.datastructures.enums.AxisIdentifier] = None#
Tip axis of the tip link, that should be aligned.
- root_link: typing_extensions.Optional[str] = None#
Base link of the robot; typically set to the torso.
- root_axis: typing_extensions.Optional[pycram.datastructures.enums.AxisIdentifier] = None#
Goal axis of the root link, that should be used to align with.
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- get_joint_poses() typing_extensions.Dict[str, float]#
- Returns:
The joint positions that should be set for the arm to be in the park position.
- axis_to_vector3_stamped(axis: pycram.datastructures.enums.AxisIdentifier, link: str = 'base_link') pycram.datastructures.pose.Vector3Stamped#
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: datetime.timedelta = timedelta(seconds=2))#
Create a goal validator for the joint positions and wait until the goal is achieved or the timeout is reached.
- classmethod description(arm: typing_extensions.Union[typing_extensions.Iterable[pycram.robot_descriptions.pr2_states.Arms], pycram.robot_descriptions.pr2_states.Arms], align: typing_extensions.Optional[bool] = False, tip_link: typing_extensions.Optional[str] = None, tip_axis: typing_extensions.Optional[pycram.datastructures.enums.AxisIdentifier] = None, root_link: typing_extensions.Optional[str] = None, root_axis: typing_extensions.Optional[pycram.datastructures.enums.AxisIdentifier] = None) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[CarryAction]]#
- pycram.robot_plans.MoveTorsoActionDescription#
- pycram.robot_plans.SetGripperActionDescription#
- pycram.robot_plans.CarryActionDescription#
- class pycram.robot_plans.StaticJointState#
Bases:
enum.EnumGeneric enumeration.
Derive from this class to define new enumerations.
- Park = 'park'#
- class pycram.robot_plans.GripperStateEnum#
Bases:
enum.EnumEnum for the different motions of the gripper.
- OPEN#
- CLOSE#
- MEDIUM#
- __str__()#
- __repr__()#
- class pycram.robot_plans.TorsoState#
Bases:
enum.IntEnumEnum for the different states of the torso.
- HIGH#
- MID#
- LOW#
- class pycram.robot_plans.JointState#
Represents a named joint state of a robot. For example, the park position of the arms.
- name: semantic_digital_twin.datastructures.prefixed_name.PrefixedName#
Name of the joint state
- joint_names: List[str]#
Names of the joints in this state
- joint_positions: List[float]#
position of the joints in this state, must correspond to the joint_names
- state_type: enum.Enum = None#
Enum type of the joints tate (e.g., Park, Open)
- apply_to_world(world: semantic_digital_twin.world.World)#
Applies the joint state to the robot in the given world. :param world: The world in which the robot is located.
- class pycram.robot_plans.ArmState#
Bases:
JointStateRepresents a named joint state of a robot. For example, the park position of the arms.
- arm: pycram.datastructures.enums.Arms = None#
- class pycram.robot_plans.JointStateManager#
Manages joint states for different robot arms and their configurations.
- joint_states: Dict[Type[semantic_digital_twin.robots.abstract_robot.AbstractRobot], List[JointState]]#
A list of joint states that can be applied to the robot.
- get_arm_state(arm: pycram.datastructures.enums.Arms, state_type: pycram.datastructures.enums.StaticJointState, robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot) ArmState | None#
Retrieves the joint state for a specific arm and state type.
- Parameters:
arm – The arm for which the state is requested.
state_type – The type of state (e.g., Park).
robot_view – The robot view to which the arm belongs.
- Returns:
The corresponding ArmState or None if not found.
- get_gripper_state(gripper: pycram.datastructures.enums.Arms, state_type: pycram.datastructures.enums.StaticJointState, robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot) GripperState | None#
Retrieves the joint state for a specific gripper and state type.
- Parameters:
gripper – The gripper for which the state is requested.
state_type – The type of state (e.g., Open, Close).
robot_view – The robot view to which the gripper belongs.
- Returns:
The corresponding GripperState or None if not found.
- get_joint_state(state: enum.Enum, robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot) List[JointState]#
Retrieves all joint states of a specific type for a given robot.
- Parameters:
state – The type of joint state to retrieve (e.g., Park, Open).
robot_view – The robot class for which the joint states are requested.
- Returns:
A list of JointState objects matching the specified type.
- add_joint_states(robot: Type[semantic_digital_twin.robots.abstract_robot.AbstractRobot], joint_states: List[JointState])#
Adds joint states for a specific robot type.
- Parameters:
robot – The robot class for which the joint states are added.
joint_states – A list of joint states to be added.
- pycram.robot_plans.right_park#
- pycram.robot_plans.left_park#
- pycram.robot_plans.both_park#
- pycram.robot_plans.left_gripper_open#
- pycram.robot_plans.left_gripper_close#
- pycram.robot_plans.right_gripper_open#
- pycram.robot_plans.right_gripper_close#
- pycram.robot_plans.torso_low#
- pycram.robot_plans.torso_mid#
- pycram.robot_plans.torso_high#
- class pycram.robot_plans.BaseMotion#
Bases:
abc.ABCHelper class that provides a standard way to create an ABC using inheritance.
- plan_node: pycram.plan.PlanNode = None#
- property plan: pycram.plan.Plan#
- property world: semantic_digital_twin.world.World#
- property robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot#
- abstract perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- __post_init__()#
Checks if types are missing or wrong
- class pycram.robot_plans.Arms#
Bases:
enum.IntEnumEnum for Arms.
- LEFT = 0#
- RIGHT = 1#
- BOTH = 2#
- __str__()#
Return str(self).
- __repr__()#
Return repr(self).
- class pycram.robot_plans.ProcessModuleManager#
Bases:
abc.ABCBase class for managing process modules, any new process modules have to implement this class to register the Process Modules
- execution_type: pycram.datastructures.enums.ExecutionType = None#
Whether the robot for which the process module is intended for is real or a simulated one
- available_pms: typing_extensions.List[ManagerBase] = []#
List of all available Process Module Managers
- _instance: ProcessModuleManager = None#
Singelton instance of this Process Module Manager
- _initialized: bool = False#
- register_manager(manager: ManagerBase)#
Register a new Process Module Manager for the given robot name.
- Parameters:
manager – The Process Module Manager to register
- get_manager(robot: semantic_digital_twin.robots.abstract_robot.AbstractRobot) ManagerBase#
Returns the Process Module manager for the currently loaded robot or None if there is no Manager.
- Returns:
ProcessModuleManager instance of the current robot
- static register_all_process_modules()#
- class pycram.robot_plans.OpeningMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionDesignator for opening container
- object_part: semantic_digital_twin.world_description.world_entity.Body#
Object designator for the drawer handle
- arm: pycram.datastructures.enums.Arms#
Arm that should be used
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.ClosingMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionDesignator for closing a container
- object_part: semantic_digital_twin.world_description.world_entity.Body#
Object designator for the drawer handle
- arm: pycram.datastructures.enums.Arms#
Arm that should be used
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.GripperState#
Bases:
enum.EnumEnum for the different motions of the gripper.
- OPEN#
- CLOSE#
- MEDIUM#
- __str__()#
- __repr__()#
- class pycram.robot_plans.MovementType#
Bases:
enum.EnumEnum for the different movement types of the robot.
- STRAIGHT_TRANSLATION#
- STRAIGHT_CARTESIAN#
- TRANSLATION#
- CARTESIAN#
- class pycram.robot_plans.WaypointsMovementType#
Bases:
enum.EnumEnum for the different movement types of the robot.
- ENFORCE_ORIENTATION_STRICT#
- ENFORCE_ORIENTATION_FINAL_POINT#
- class pycram.robot_plans.GraspDescription#
Bases:
pycram.has_parameters.HasParametersRepresents a grasp description with a side grasp, top face, and orientation alignment.
- approach_direction: pycram.datastructures.enums.ApproachDirection#
The primary approach direction.
- vertical_alignment: pycram.datastructures.enums.VerticalAlignment#
The vertical alignment when grasping the pose
- rotate_gripper: bool = False#
Indicates if the gripper should be rotated by 90°. Must be a boolean.
- __hash__()#
- as_list() typing_extensions.List[typing_extensions.Union[pycram.datastructures.enums.Grasp, typing_extensions.Optional[pycram.datastructures.enums.Grasp], bool]]#
- Returns:
A list representation of the grasp description.
- get_grasp_pose(end_effector: semantic_digital_twin.robots.abstract_robot.Manipulator, body: semantic_digital_twin.world_description.world_entity.Body, translate_rim_offset: bool = False) pycram.datastructures.pose.PoseStamped#
Translates the grasp pose of the object using the desired grasp description and object knowledge. Leaves the orientation untouched. Returns the translated grasp pose.
- Parameters:
end_effector – The end effector that will be used to grasp the object.
body – The body of the object to be grasped.
translate_rim_offset – If True, the grasp pose will be translated along the rim offset.
- Returns:
The grasp pose of the object.
- calculate_grasp_orientation(front_orientation: numpy.ndarray) typing_extensions.List[float]#
Calculates the grasp orientation based on the approach axis and the grasp description.
- Parameters:
front_orientation – The front-facing orientation of the end effector as a numpy array.
- Returns:
The calculated orientation as a quaternion.
- static calculate_grasp_descriptions(robot: semantic_digital_twin.robots.abstract_robot.AbstractRobot, pose: pycram.datastructures.pose.PoseStamped, grasp_alignment: typing_extensions.Optional[PreferredGraspAlignment] = None) typing_extensions.List[GraspDescription]#
This method determines the possible grasp configurations (approach axis and vertical alignment) of the body, taking into account the bodies orientation, position, and whether the gripper should be rotated by 90°.
- Parameters:
robot – The robot for which the grasp configurations are being calculated.
grasp_alignment – An optional PreferredGraspAlignment object that specifies preferred grasp axis,
pose – The pose of the object to be grasped.
- Returns:
A sorted list of GraspDescription instances representing all grasp permutations.
- static calculate_closest_faces(pose_to_robot_vector: pycram.datastructures.pose.Vector3, specified_grasp_axis: pycram.datastructures.enums.AxisIdentifier = AxisIdentifier.Undefined) typing_extensions.Union[Tuple[pycram.datastructures.enums.ApproachDirection, pycram.datastructures.enums.ApproachDirection], Tuple[pycram.datastructures.enums.VerticalAlignment, pycram.datastructures.enums.VerticalAlignment]]#
Determines the faces of the object based on the input vector.
If specified_grasp_axis is None, it calculates the primary and secondary faces based on the vector’s magnitude determining which sides of the object are most aligned with the robot. This will either be the x, y plane for side faces or the z axis for top/bottom faces. If specified_grasp_axis is provided, it only considers the specified axis and calculates the faces aligned with that axis.
- Parameters:
pose_to_robot_vector – A 3D vector representing one of the robot’s axes in the pose’s frame, with irrelevant components set to np.nan.
specified_grasp_axis – Specifies a specific axis (e.g., X, Y, Z) to focus on.
- Returns:
A tuple of two Grasp enums representing the primary and secondary faces.
- class pycram.robot_plans.PoseStamped#
Bases:
pycram.has_parameters.HasParametersA pose in 3D space with a timestamp.
- property position#
- property orientation#
- property frame_id#
- __repr__()#
- ros_message()#
Convert the pose to a ROS message of type PoseStamped.
- Returns:
The ROS message.
- classmethod from_ros_message(message: ROSPoseStamped) typing_extensions.Self#
Create a PoseStamped from a ROS message.
- Parameters:
message – The PoseStamped ROS message.
- Returns:
A new PoseStamped object created from the ROS message.
- classmethod from_list(position: typing_extensions.Optional[typing_extensions.List[float]] = None, orientation: typing_extensions.Optional[typing_extensions.List[float]] = None, frame: typing_extensions.Optional[semantic_digital_twin.world_description.world_entity.Body] = None) typing_extensions.Self#
Factory to create a PoseStamped from a list of position and orientation.
- Parameters:
position – Position as a list of [x, y, z].
orientation – Orientation as a list of [x, y, z, w].
frame – Frame in which the pose is defined.
- Returns:
A new PoseStamped object.
- classmethod from_matrix(matrix: numpy.ndarray, frame: semantic_digital_twin.world_description.world_entity.Body) typing_extensions.Self#
Create a PoseStamped from a 4x4 transformation matrix and a frame.
- Parameters:
matrix – A 4x4 transformation matrix as numpy array.
frame – The frame in which the pose is defined.
- Returns:
A PoseStamped object created from the matrix and frame.
- classmethod from_spatial_type(spatial_type: semantic_digital_twin.spatial_types.spatial_types.TransformationMatrix) typing_extensions.Self#
Create a PoseStamped from a SpatialTransformationMatrix and a frame.
- Parameters:
spatial_type – A SpatialTransformationMatrix object.
- Returns:
A PoseStamped object created from the spatial type and frame.
- to_transform_stamped(child_link_id: semantic_digital_twin.world_description.world_entity.Body) TransformStamped#
Converts the PoseStamped to a TransformStamped given a frame to which the transform is pointing.
- Parameters:
child_link_id – Frame to which the transform is pointing.
- Returns:
A TransformStamped object.
- to_spatial_type() semantic_digital_twin.spatial_types.spatial_types.TransformationMatrix#
Converts the PoseStamped to a SpatialTransformationMatrix.
- Returns:
A SpatialTransformationMatrix object representing the pose in 3D space.
- round(decimals: int = 4)#
Rounds the components of the pose (position and orientation) to the specified number of decimal places.
- Parameters:
decimals – Number of decimal places to round to.
- to_list()#
Convert the pose to a list of [position, orientation, frame_id].
- Returns:
A list of [pose, frame_id].
- almost_equal(other: PoseStamped, position_tolerance: float = 1e-06, orientation_tolerance: float = 1e-05) bool#
Check if two PoseStamped objects are almost equal within given tolerances for position and orientation and if the frame_id is the same.
- Parameters:
other – The other PoseStamped object to compare to.
position_tolerance – Tolerance for position comparison as number of decimal places.
orientation_tolerance – Tolerance for orientation comparison as number of decimal places.
- Returns:
True if the PoseStamped objects are almost equal, False otherwise.
- rotate_by_quaternion(quaternion: typing_extensions.List[float])#
Rotates the orientation of the pose by a given quaternion.
- Parameters:
quaternion – A list representing the quaternion [x, y, z, w].
- is_facing_2d_axis(pose_b: PoseStamped, axis: typing_extensions.Optional[pycram.datastructures.enums.AxisIdentifier] = AxisIdentifier.X, threshold_deg=82) typing_extensions.Tuple[bool, float]#
Check if this pose is facing another pose along a specific axis (X or Y) within a given angular threshold.
- Parameters:
pose_b – The target pose to compare against.
axis – The axis to check alignment with (‘x’ or ‘y’). Defaults to ‘x’.
threshold_deg – The maximum angular difference in degrees to consider as ‘facing’. Defaults to 82 degrees.
- Returns:
Tuple of (True/False if facing, signed angular difference in radians).
- is_facing_x_or_y(pose_b: PoseStamped) bool#
Check if this pose is facing another pose along either the X or Y axis within a default angular threshold.
- Parameters:
pose_b – The target pose to compare against.
- Returns:
True if this pose is facing the target along either X or Y axis, False otherwise.
- pycram.robot_plans.try_motion(motion: pycram.process_module.ProcessModule, motion_designator_instance: pycram.robot_plans.BaseMotion, failure_type: typing_extensions.Type[Exception], max_tries: int = 3)#
A generic function to retry a motion a certain number of times before giving up, with a specific exception.
- Parameters:
motion – The motion to be executed.
motion_designator_instance – The instance of the motion designator that has the description of the motion.
failure_type – The type of exception to catch.
max_tries – The maximum number of attempts to retry the motion.
- exception pycram.robot_plans.ToolPoseNotReachedError(current_pose: pycram.datastructures.pose.PoseStamped, goal_pose: pycram.datastructures.pose.PoseStamped, *args, **kwargs)#
Bases:
PlanFailureThrown when the tool pose is not reached.
- current_pose: pycram.datastructures.pose.PoseStamped#
The current pose of the tool.
- goal_pose: pycram.datastructures.pose.PoseStamped#
The goal pose of the tool.
- class pycram.robot_plans.ViewManager#
- static get_end_effector_view(arm: pycram.datastructures.enums.Arms, robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot) typing_extensions.Optional[semantic_digital_twin.robots.abstract_robot.Manipulator]#
- static get_arm_view(arm: pycram.datastructures.enums.Arms, robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot) typing_extensions.Optional[semantic_digital_twin.robots.abstract_robot.KinematicChain]#
Get the arm view for a given arm and robot view.
- Parameters:
arm – The arm to get the view for.
robot_view – The robot view to search in.
- Returns:
The Manipulator object representing the arm.
- static get_neck_view(robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot) typing_extensions.Optional[semantic_digital_twin.robots.abstract_robot.Neck]#
Get the neck view for a given robot view.
- Parameters:
robot_view – The robot view to search in.
- Returns:
The Neck object representing the neck.
- pycram.robot_plans.translate_pose_along_local_axis(pose: pycram.datastructures.pose.PoseStamped, axis: typing_extensions.List | numpy.ndarray, distance: float) pycram.datastructures.pose.PoseStamped#
Translate a pose along a given 3d vector (axis) by a given distance. The axis is given in the local coordinate frame of the pose. The axis is normalized and then scaled by the distance.
- Parameters:
pose – The pose that should be translated
axis – The local axis along which the translation should be performed
distance – The distance by which the pose should be translated
- Returns:
The translated pose
- class pycram.robot_plans.ReachMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotion- object_designator: semantic_digital_twin.world_description.world_entity.Body#
Object designator_description describing the object that should be picked up
- arm: pycram.datastructures.enums.Arms#
The arm that should be used for pick up
- grasp_description: pycram.datastructures.grasp.GraspDescription#
The grasp description that should be used for picking up the object
- movement_type: pycram.datastructures.enums.MovementType#
The type of movement that should be performed.
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.MoveArmJointsMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionMoves the joints of each arm into the given position
- left_arm_poses: Dict[str, float] | None = None#
Target positions for the left arm joints
- right_arm_poses: Dict[str, float] | None = None#
Target positions for the right arm joints
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.MoveGripperMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionOpens or closes the gripper
- motion: pycram.datastructures.enums.GripperState#
Motion that should be performed, either ‘open’ or ‘close’
- gripper: pycram.datastructures.enums.Arms#
Name of the gripper that should be moved
- allow_gripper_collision: bool | None = None#
If the gripper is allowed to collide with something
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.MoveTCPMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionMoves the Tool center point (TCP) of the robot
- target: pycram.datastructures.pose.PoseStamped#
Target pose to which the TCP should be moved
- arm: pycram.datastructures.enums.Arms#
Arm with the TCP that should be moved to the target
- allow_gripper_collision: bool | None = None#
If the gripper can collide with something
- movement_type: pycram.datastructures.enums.MovementType | None#
The type of movement that should be performed.
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.MoveTCPWaypointsMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionMoves the Tool center point (TCP) of the robot
- waypoints: List[pycram.datastructures.pose.PoseStamped]#
Waypoints the TCP should move along
- arm: pycram.datastructures.enums.Arms#
Arm with the TCP that should be moved to the target
- allow_gripper_collision: bool | None = None#
If the gripper can collide with something
- movement_type: pycram.datastructures.enums.WaypointsMovementType#
The type of movement that should be performed.
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.PerceptionQuery#
- semantic_annotation: typing_extensions.Type[semantic_digital_twin.world_description.world_entity.SemanticAnnotation]#
The semantic annotation for which to perceive
- region: semantic_digital_twin.world_description.geometry.BoundingBox#
The region in which the object should be detected
- robot: semantic_digital_twin.robots.abstract_robot.AbstractRobot#
‘ Robot annotation of the robot that should perceive the object.
- world: semantic_digital_twin.world.World#
The world in which the object should be detected.
- from_world() typing_extensions.List[semantic_digital_twin.world_description.world_entity.Body]#
- from_robokudo()#
- class pycram.robot_plans.DetectingMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionTries to detect an object in the FOV of the robot
returns: ObjectDesignatorDescription.Object or Error: PerceptionObjectNotFound
- query: pycram.perception.PerceptionQuery#
Query for the perception system that should be answered
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.MoveMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionMoves the robot to a designated location
- target: pycram.datastructures.pose.PoseStamped#
Location to which the robot should be moved
- keep_joint_states: bool = False#
Keep the joint states of the robot during/at the end of the motion
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.LookingMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionLets the robot look at a point
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.Vector3Stamped#
Bases:
Vector3A Vector3 with an attached ROS Header (timestamp and frame). Inherits all vector operations and adds frame/time metadata.
- property frame_id#
- __repr__()#
- ros_message()#
Convert to a ROS Vector3Stamped message.
- Returns:
The ROS message.
- classmethod from_ros_message(message)#
Create a Vector3Stamped from a ROS message.
- Parameters:
message – The Vector3Stamped ROS message.
- Returns:
A new Vector3Stamped object.
- to_spatial_type() semantic_digital_twin.spatial_types.spatial_types.Vector3#
- class pycram.robot_plans.MoveJointsMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionMoves any joint on the robot
- names: list#
List of joint names that should be moved
- positions: list#
Target positions of joints, should correspond to the list of names
- align: bool | None = False#
If True, aligns the end-effector with a specified axis (optional).
- tip_link: str | None = None#
Name of the tip link to align with, e.g the object (optional).
- tip_normal: pycram.datastructures.pose.Vector3Stamped | None = None#
Normalized vector representing the current orientation axis of the end-effector (optional).
- root_link: str | None = None#
Base link of the robot; typically set to the torso (optional).
- root_normal: pycram.datastructures.pose.Vector3Stamped | None = None#
Normalized vector representing the desired orientation axis to align with (optional).
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.