pycram.robot_plans.actions.composite#
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. |
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. |
|
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. |
|
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 |
|
Creates a plan which executes its children in sequential order |
|
Base class for everything that contains potentially parameters for a plan. |
|
Searches for a target object around the given location. |
|
Moves the Tool center point (TCP) of the robot |
|
A pose in 3D space with a timestamp. |
|
A partial designator_description is somewhat between a DesignatorDescription and a specified designator_description. Basically it is a |
|
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, |
|
Base class for everything that contains potentially parameters for a plan. |
|
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. |
|
Enum for Arms. |
|
Base class for grasp enums. |
|
Enum for the vertical alignment of a gripper. |
|
Represents a grasp description with a side grasp, top face, and orientation alignment. |
|
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. |
|
Uses Costmaps to create locations for complex constrains. |
|
Description for Objects that are only believed in. |
|
Creates a plan which executes its children in sequential order |
|
Base class of a robot description. Contains all necessary information about a robot, like the URDF, the base link, |
|
Base class for everything that contains potentially parameters for a plan. |
|
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 |
Functions#
|
Insert parameters of a class post construction. |
|
Return quaternion from Euler angles and axis sequence. |
|
Insert parameters of a class post construction. |
|
Insert parameters of a class post construction. |
|
Insert parameters of a class post construction. |
Package Contents#
- pycram.robot_plans.actions.composite.LookAtActionDescription#
- class pycram.robot_plans.actions.composite.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.actions.composite.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.actions.composite.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.actions.composite.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.actions.composite.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.actions.composite.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.actions.composite.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.actions.composite.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.actions.composite.FaceAtActionDescription#
- pycram.robot_plans.actions.composite.DetectActionDescription#
- pycram.robot_plans.actions.composite.LookAtActionDescription#
- pycram.robot_plans.actions.composite.NavigateActionDescription#
- class pycram.robot_plans.actions.composite.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.actions.composite.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.actions.composite.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.
- class pycram.robot_plans.actions.composite.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.actions.composite.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.
- pycram.robot_plans.actions.composite.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.actions.composite.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.actions.composite.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.actions.composite.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#
- class pycram.robot_plans.actions.composite.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.actions.composite.SearchActionDescription#
- class pycram.robot_plans.actions.composite.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.actions.composite.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.actions.composite.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.actions.composite.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.actions.composite.Arms#
Bases:
enum.IntEnumEnum for Arms.
- LEFT = 0#
- RIGHT = 1#
- BOTH = 2#
- __str__()#
Return str(self).
- __repr__()#
Return repr(self).
- class pycram.robot_plans.actions.composite.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.actions.composite.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.actions.composite.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.actions.composite.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.actions.composite.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.actions.composite.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#
- class pycram.robot_plans.actions.composite.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.actions.composite.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.actions.composite.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.actions.composite.CuttingActionDescription#
- pycram.robot_plans.actions.composite.PouringActionDescription#
- pycram.robot_plans.actions.composite.MixingActionDescription#
- pycram.robot_plans.actions.composite.FaceAtActionDescription#
- pycram.robot_plans.actions.composite.ParkArmsActionDescription#
- pycram.robot_plans.actions.composite.NavigateActionDescription#
- pycram.robot_plans.actions.composite.PickUpActionDescription#
- pycram.robot_plans.actions.composite.PlaceActionDescription#
- pycram.robot_plans.actions.composite.OpenActionDescription#
- class pycram.robot_plans.actions.composite.ActionConfig#
- pick_up_prepose_distance = 0.03#
- grasping_prepose_distance = 0.03#
- navigate_keep_joint_states = True#
- 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.actions.composite.Arms#
Bases:
enum.IntEnumEnum for Arms.
- LEFT = 0#
- RIGHT = 1#
- BOTH = 2#
- __str__()#
Return str(self).
- __repr__()#
Return repr(self).
- class pycram.robot_plans.actions.composite.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.actions.composite.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.actions.composite.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.actions.composite.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.actions.composite.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.
- class pycram.robot_plans.actions.composite.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.actions.composite.BelieveObject#
Bases:
ObjectDesignatorDescriptionDescription for Objects that are only believed in.
- exception pycram.robot_plans.actions.composite.ObjectUnfetchable(*args, **kwargs)#
Bases:
HighLevelFailureThrown when no base positioning can assure a reachable pose to grasp the object from.
- exception pycram.robot_plans.actions.composite.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.
- pycram.robot_plans.actions.composite.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.actions.composite.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.actions.composite.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.actions.composite.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#
- class pycram.robot_plans.actions.composite.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.actions.composite.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.actions.composite.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.actions.composite.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.actions.composite.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.actions.composite.TransportActionDescription#
- pycram.robot_plans.actions.composite.PickAndPlaceActionDescription#
- pycram.robot_plans.actions.composite.MoveAndPlaceActionDescription#
- pycram.robot_plans.actions.composite.MoveAndPickUpActionDescription#
- pycram.robot_plans.actions.composite.EfficientTransportActionDescription#