pycram.robot_plans.actions.core#
Submodules#
Attributes#
Exceptions#
Thrown when container manipulation fails. |
|
Thrown when the look at goal is not reached. |
|
Thrown when the navigation goal is not reached. |
|
Thrown when the object was not placed at the target location. |
|
Thrown when the object is still in contact with the robot after placing. |
|
Thrown when the torso moved as a result of a torso action but the goal was not reached. |
|
Implementation of plan failures. |
Classes#
Designator for opening container |
|
Designator for closing a container |
|
Opens or closes the gripper |
|
Enum for Arms. |
|
Represents the state of a gripper, such as open or closed. |
|
Enum for the different types of container manipulation. |
|
A partial designator_description is somewhat between a DesignatorDescription and a specified designator_description. Basically it is a |
|
Creates a plan which executes its children in sequential order |
|
Base class for everything that contains potentially parameters for a plan. |
|
Opens a container like object |
|
Closes a container like object. |
|
Opens or closes the gripper |
|
Moves the Tool center point (TCP) of the robot |
|
Enum for Arms. |
|
Base class for grasp enums. |
|
Represents the state of a gripper, such as open or closed. |
|
Enum for the different movement types of the robot. |
|
Enum for the different methods to find a body in a region. |
|
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. |
|
Creates a plan which executes its children in sequential order |
|
Describes an end effector of robot. Contains all necessary information about the end effector, like the |
|
Base class of a robot description. Contains all necessary information about a robot, like the URDF, the base link, |
|
Represents a kinematic chain of a robot. A Kinematic chain is a chain of links and joints that are connected to each |
|
Base class for everything that contains potentially parameters for a plan. |
|
Let the robot reach a specific pose. |
|
Let the robot pick up an object. |
|
Grasps an object described by the given Object Designator description |
|
Enum for techniques for detection tasks. |
|
Enum for the state of the detection task. |
|
A partial designator_description is somewhat between a DesignatorDescription and a specified designator_description. Basically it is a |
|
Base class for everything that contains potentially parameters for a plan. |
|
Detects an object that fits the object description and returns an object designator_description describing the object. |
|
Base class for everything that contains potentially parameters for a plan. |
|
Moves the robot to a designated location |
|
Lets the robot look at a point |
|
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 |
|
An abstract class that resembles an error checker. It has two main methods, one for calculating the error between |
|
Navigates the Robot to a position. |
|
Lets the robot look at a position. |
|
Moves the Tool center point (TCP) of the robot |
|
Opens or closes the gripper |
|
Enum for Arms. |
|
Represents the state of a gripper, such as open or closed. |
|
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. |
|
An abstract class that resembles an error checker. It has two main methods, one for calculating the error between |
|
Places an Object at a position using an arm. |
|
Enum for translating the axis name to a vector along that axis. |
|
A partial designator_description is somewhat between a DesignatorDescription and a specified designator_description. Basically it is a |
|
A Vector3 with an attached ROS Header (timestamp and frame). |
|
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. |
|
Opens or closes the gripper |
|
Moves any joint on the robot |
|
Move the torso of the robot up and down. |
|
Set the gripper state of the robot. |
|
Park the arms of the robot. |
|
Parks the robot's arms. And align the arm with the given Axis of a frame. |
|
Generic enumeration. |
|
Enum for Arms. |
|
Enum for the different motions of the gripper. |
|
Enum for the different states of the torso. |
|
Represents a named joint state of a robot. For example, the park position of the arms. |
|
Represents a named joint state of a robot. For example, the park position of the arms. |
|
Represents the state of a gripper, such as open or closed. |
|
Manages joint states for different robot arms and their configurations. |
Functions#
|
Insert parameters of a class post construction. |
|
Validates if the container is opened or closed by checking the joint position of the container. |
|
|
|
|
|
Insert parameters of a class post construction. |
Translate a pose along a given 3d vector (axis) by a given distance. The axis is given in the local coordinate |
|
|
Insert parameters of a class post construction. |
|
Insert parameters of a class post construction. |
|
Insert parameters of a class post construction. |
Translate a pose along a given 3d vector (axis) by a given distance. The axis is given in the local coordinate |
|
|
Insert parameters of a class post construction. |
Validate the multiple joint goals, and wait until the goal is achieved. |
Package Contents#
- pycram.robot_plans.actions.core.GraspingActionDescription#
- class pycram.robot_plans.actions.core.OpeningMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionDesignator for opening container
- object_part: semantic_digital_twin.world_description.world_entity.Body#
Object designator for the drawer handle
- arm: pycram.datastructures.enums.Arms#
Arm that should be used
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.actions.core.ClosingMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionDesignator for closing a container
- object_part: semantic_digital_twin.world_description.world_entity.Body#
Object designator for the drawer handle
- arm: pycram.datastructures.enums.Arms#
Arm that should be used
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.actions.core.MoveGripperMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionOpens or closes the gripper
- motion: pycram.datastructures.enums.GripperState#
Motion that should be performed, either ‘open’ or ‘close’
- gripper: pycram.datastructures.enums.Arms#
Name of the gripper that should be moved
- allow_gripper_collision: bool | None = None#
If the gripper is allowed to collide with something
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.actions.core.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.core.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.core.GripperState#
Bases:
enum.EnumEnum for the different motions of the gripper.
- OPEN#
- CLOSE#
- MEDIUM#
- __str__()#
- __repr__()#
- class pycram.robot_plans.actions.core.ContainerManipulationType#
Bases:
enum.EnumEnum for the different types of container manipulation.
- Opening#
The Opening type is used to open a container.
- Closing#
The Closing type is used to close a container.
- class pycram.robot_plans.actions.core.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.
- exception pycram.robot_plans.actions.core.ContainerManipulationError(robot: Object, arms: typing_extensions.List[pycram.datastructures.enums.Arms], body: PhysicalBody, container_joint: Joint, manipulation_type: pycram.datastructures.enums.ContainerManipulationType, *args, **kwargs)#
Bases:
ManipulationLowLevelFailure,abc.ABCThrown when container manipulation fails.
- container_joint: Joint#
The joint of the container that should be manipulated.
- manipulation_type: pycram.datastructures.enums.ContainerManipulationType#
The type of manipulation that should be performed on the container.
- pycram.robot_plans.actions.core.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.core.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.core.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.core.OpenAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionOpens a container like object
- object_designator: semantic_digital_twin.world_description.world_entity.Body#
Object designator_description describing the object that should be opened
- arm: pycram.datastructures.enums.Arms#
Arm that should be used for opening the container
- grasping_prepose_distance: float#
The distance in meters the gripper should be at in the x-axis away from the handle.
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#
Check if the container is opened, this assumes that the container state can be read accurately from the real world.
- classmethod description(object_designator_description: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Body], semantic_digital_twin.world_description.world_entity.Body], arm: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.Arms], pycram.datastructures.enums.Arms] = None, grasping_prepose_distance: typing_extensions.Union[typing_extensions.Iterable[float], float] = ActionConfig.grasping_prepose_distance) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[OpenAction]]#
- class pycram.robot_plans.actions.core.CloseAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionCloses a container like object.
- object_designator: semantic_digital_twin.world_description.world_entity.Body#
Object designator_description describing the object that should be closed
- arm: pycram.datastructures.enums.Arms#
Arm that should be used for closing
- grasping_prepose_distance: float#
The distance in meters between the gripper and the handle before approaching to grasp.
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#
Check if the container is closed, this assumes that the container state can be read accurately from the real world.
- classmethod description(object_designator_description: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Body], semantic_digital_twin.world_description.world_entity.Body], arm: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.Arms], pycram.datastructures.enums.Arms] = None, grasping_prepose_distance: typing_extensions.Union[typing_extensions.Iterable[float], float] = ActionConfig.grasping_prepose_distance) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[CloseAction]]#
- pycram.robot_plans.actions.core.validate_close_open(object_designator: semantic_digital_twin.world_description.world_entity.Body, arm: pycram.datastructures.enums.Arms, action_type: typing_extensions.Union[typing_extensions.Type[OpenAction], typing_extensions.Type[CloseAction]])#
Validates if the container is opened or closed by checking the joint position of the container.
- Parameters:
object_designator – The object designator_description describing the object that should be opened or closed.
arm – The arm that should be used for opening or closing the container.
action_type – The type of the action that should be validated.
- pycram.robot_plans.actions.core.check_opened(joint_obj: semantic_digital_twin.world_description.world_entity.Connection, obj_part: semantic_digital_twin.world_description.world_entity.Body, arm: pycram.datastructures.enums.Arms, upper_limit: float)#
- pycram.robot_plans.actions.core.check_closed(joint_obj: semantic_digital_twin.world_description.world_entity.Connection, obj_part: semantic_digital_twin.world_description.world_entity.Body, arm: pycram.datastructures.enums.Arms, lower_limit: float)#
- pycram.robot_plans.actions.core.OpenActionDescription#
- pycram.robot_plans.actions.core.CloseActionDescription#
- class pycram.robot_plans.actions.core.MoveGripperMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionOpens or closes the gripper
- motion: pycram.datastructures.enums.GripperState#
Motion that should be performed, either ‘open’ or ‘close’
- gripper: pycram.datastructures.enums.Arms#
Name of the gripper that should be moved
- allow_gripper_collision: bool | None = None#
If the gripper is allowed to collide with something
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.actions.core.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.core.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.core.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.core.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.core.GripperState#
Bases:
enum.EnumEnum for the different motions of the gripper.
- OPEN#
- CLOSE#
- MEDIUM#
- __str__()#
- __repr__()#
- class pycram.robot_plans.actions.core.MovementType#
Bases:
enum.EnumEnum for the different movement types of the robot.
- STRAIGHT_TRANSLATION#
- STRAIGHT_CARTESIAN#
- TRANSLATION#
- CARTESIAN#
- class pycram.robot_plans.actions.core.FindBodyInRegionMethod#
Bases:
enum.EnumEnum for the different methods to find a body in a region.
- FingerToCentroid#
- The FingerToCentroid method is used to find the body in a region by casting a ray from each finger to the
centroid of the region.
- Centroid#
The Centroid method is used to find the body in a region by calculating the centroid of the region and casting two rays from opposite sides of the region to the centroid.
- MultiRay#
The MultiRay method is used to find the body in a region by casting multiple rays covering the region.
- class pycram.robot_plans.actions.core.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.core.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.core.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.
- exception pycram.robot_plans.actions.core.ObjectNotGraspedError(obj: Object, robot: Object, arm: pycram.datastructures.enums.Arms, grasp=None, *args, **kwargs)#
Bases:
Grasping
- exception pycram.robot_plans.actions.core.ObjectNotInGraspingArea(obj: Object, robot: Object, arm: pycram.datastructures.enums.Arms, grasp, *args, **kwargs)#
Bases:
ReachabilityFailure
- pycram.robot_plans.actions.core.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.core.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.core.EndEffectorDescription(name: str, start_link: str, tool_frame: str, urdf_object: urdf_parser_py.urdf.URDF, gripper_object_name: typing_extensions.Optional[str] = None, opening_distance: typing_extensions.Optional[float] = None, fingers_link_names: typing_extensions.Optional[typing_extensions.List[str]] = None)#
Describes an end effector of robot. Contains all necessary information about the end effector, like the base link, the tool frame, the URDF object and the static joint states.
- name: str#
Name of the end effector
- start_link: str#
Root link of the end effector, every link below this link in the URDF is part of the end effector
- tool_frame: str#
Name of the tool frame link in the URDf
- urdf_object: urdf_parser_py.urdf.URDF#
Parsed URDF of the robot
- link_names: typing_extensions.List[str]#
List of all links in the end effector
- joint_names: typing_extensions.List[str]#
List of all joints in the end effector
- static_joint_states: typing_extensions.Dict[pycram.datastructures.enums.GripperState, typing_extensions.Dict[str, float]]#
Dictionary of static joint states for the end effector
- end_effector_type: pycram.datastructures.enums.GripperType#
Type of the gripper
- opening_distance: float#
Distance the gripper can open, in cm
- gripper_object_name: typing_extensions.Optional[str] = None#
Name of the gripper of the robot if it has one, this is used when the gripper is a different Object with its own description file outside the robot description file.
- fingers_link_names: typing_extensions.Optional[typing_extensions.List[str]] = None#
List of all links of the fingers of the gripper
- grasps: typing_extensions.Dict[pycram.datastructures.grasp.GraspDescription, typing_extensions.List[float]]#
Dictionary of all grasp orientations of the end effector
- approach_axis: typing_extensions.List[float]#
Relative axis along which the end effector is approaching an object
- _init_links_joints()#
Traverses the URDF object to get all links and joints of the end effector below the start link.1
- add_static_joint_states(name: pycram.datastructures.enums.GripperState, states: dict)#
Adds static joint states to the end effector. These define a specific configuration of the end effector. Like open and close configurations of a gripper.
- Parameters:
name – Name of the static joint states
states – Dictionary of joint names and their values
- property links: typing_extensions.List[str]#
Property to get the links of the chain.
- Returns:
List of link names
- property joints: typing_extensions.List[str]#
Property to get the joints of the chain.
- Returns:
List of joint names
- update_all_grasp_orientations(front_orientation: typing_extensions.List[float])#
Generates all grasp quaternion orientations based on a given front-facing quaternion orientation in-place, covering combinations of side grasps (front, back, left, right), top/bottom grasps, and horizontal rotation options.
- Parameters:
front_orientation – A quaternion representing the front-facing orientation as [x, y, z, w] quaternion.
- get_grasp(approach_direction: pycram.datastructures.enums.ApproachDirection, vertical_alignment: pycram.datastructures.enums.VerticalAlignment = VerticalAlignment.NoAlignment, rotate_gripper: bool = False) typing_extensions.List[float]#
Retrieves the quaternion orientation of the end effector for a specific grasp.
- Parameters:
approach_direction – The approach direction of the end effector.
vertical_alignment – The vertical alignment of the end effector.
rotate_gripper – True, the gripper should be rotated 90°.
- Returns:
List of floats representing the quaternion orientation of the end effector
- set_approach_axis(axis: typing_extensions.List[float])#
Sets the approach axis for the robot’s palm.
- Parameters:
axis – A list representing the approach axis.
- get_approach_axis() typing_extensions.List[float]#
Retrieves the approach axis.
- Returns:
A list representing the approach axis.
- class pycram.robot_plans.actions.core.ViewManager#
- static get_end_effector_view(arm: pycram.datastructures.enums.Arms, robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot) typing_extensions.Optional[semantic_digital_twin.robots.abstract_robot.Manipulator]#
- static get_arm_view(arm: pycram.datastructures.enums.Arms, robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot) typing_extensions.Optional[semantic_digital_twin.robots.abstract_robot.KinematicChain]#
Get the arm view for a given arm and robot view.
- Parameters:
arm – The arm to get the view for.
robot_view – The robot view to search in.
- Returns:
The Manipulator object representing the arm.
- static get_neck_view(robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot) typing_extensions.Optional[semantic_digital_twin.robots.abstract_robot.Neck]#
Get the neck view for a given robot view.
- Parameters:
robot_view – The robot view to search in.
- Returns:
The Neck object representing the neck.
- class pycram.robot_plans.actions.core.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.core.KinematicChainDescription(name: str, start_link: str, end_link: str, urdf_object: urdf_parser_py.urdf.URDF, arm_type: pycram.datastructures.enums.Arms = None, include_fixed_joints=False)#
Represents a kinematic chain of a robot. A Kinematic chain is a chain of links and joints that are connected to each other and can be moved.
This class contains all necessary information about the chain, like the start and end link, the URDF object and the joints of the chain.
- name: str#
Name of the chain
- start_link: str#
First link of the chain
- end_link: str#
Last link of the chain
- urdf_object: urdf_parser_py.urdf.URDF#
Parsed URDF of the robot
- include_fixed_joints: bool#
If True, fixed joints are included in the chain
- link_names: typing_extensions.List[str]#
List of all links in the chain
- joint_names: typing_extensions.List[str]#
List of all joints in the chain
- end_effector: EndEffectorDescription#
End effector of the chain, if there is one
- arm_type: pycram.datastructures.enums.Arms#
Type of the arm, if the chain is an arm
- static_joint_states: typing_extensions.Dict[typing_extensions.Union[str, enum.Enum], typing_extensions.Dict[str, float]]#
Dictionary of static joint states for the chain
- _init_links()#
Initializes the links of the chain by getting the chain from the URDF object.
- _init_joints()#
Initializes the joints of the chain by getting the chain from the URDF object.
- create_end_effector(name: str, tool_frame, opened_joint_values: typing_extensions.Dict[str, float], closed_joint_values: typing_extensions.Dict[str, float], relative_dir: typing_extensions.Optional[str] = None, resources_dir: typing_extensions.Optional[str] = None, description_name: str = 'gripper', opening_distance: typing_extensions.Optional[float] = None) EndEffectorDescription#
Create a gripper end effector description.
- Parameters:
name – The name of the gripper.
tool_frame – The name of the tool frame.
opened_joint_values – The joint values when the gripper is open.
closed_joint_values – The joint values when the gripper is closed.
relative_dir – The relative directory of the gripper in the Multiverse resources/robots directory.
resources_dir – The path to the resources directory.
description_name – The name of the gripper description.
opening_distance – The openning distance of the gripper.
- Returns:
The gripper end effector description.
- get_joints() typing_extensions.List[str]#
Get a list of all joints of the chain.
- Returns:
List of joint names
- get_links() typing_extensions.List[str]#
- Returns:
A list of all links of the chain.
- property links: typing_extensions.List[str]#
Property to get the links of the chain.
- Returns:
List of link names
- property joints: typing_extensions.List[str]#
Property to get the joints of the chain.
- Returns:
List of joint names
- add_static_joint_states(name: typing_extensions.Union[str, enum.Enum], states: dict)#
Adds static joint states to the chain. These define a specific configuration of the chain.
- Parameters:
name – Name of the static joint states
states – Dictionary of joint names and their values
- get_static_joint_states(name: typing_extensions.Union[str, enum.Enum]) typing_extensions.Dict[str, float]#
Get the dictionary of static joint states for a given name of the static joint states.
- Parameters:
name – Name of the static joint states
- Returns:
Dictionary of joint names and their values
- get_tool_frame() str#
Get the name of the tool frame of the end effector of this chain, if it has an end effector.
- Returns:
The name of the link of the tool frame in the URDF.
- get_static_gripper_state(state: pycram.datastructures.enums.GripperState) typing_extensions.Dict[str, float]#
Get the static joint states for the gripper of the chain.
- Parameters:
state – Name of the static joint states
- Returns:
Dictionary of joint names and their values
- class pycram.robot_plans.actions.core.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.core.translate_pose_along_local_axis(pose: pycram.datastructures.pose.PoseStamped, axis: typing_extensions.List | numpy.ndarray, distance: float) pycram.datastructures.pose.PoseStamped#
Translate a pose along a given 3d vector (axis) by a given distance. The axis is given in the local coordinate frame of the pose. The axis is normalized and then scaled by the distance.
- Parameters:
pose – The pose that should be translated
axis – The local axis along which the translation should be performed
distance – The distance by which the pose should be translated
- Returns:
The translated pose
- pycram.robot_plans.actions.core.logger#
- class pycram.robot_plans.actions.core.ReachToPickUpAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionLet the robot reach a specific pose.
- object_designator: semantic_digital_twin.world_description.world_entity.Body#
Object designator_description describing the object that should be picked up
- arm: pycram.datastructures.enums.Arms#
The arm that should be used for pick up
- grasp_description: pycram.datastructures.grasp.GraspDescription#
The grasp description that should be used for picking up the object
- _pre_perform_callbacks = []#
List to save the callbacks which should be called before performing the action.
- __post_init__()#
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- move_gripper_to_pose(pose: pycram.datastructures.pose.PoseStamped, movement_type: pycram.datastructures.enums.MovementType = MovementType.CARTESIAN, add_vis_axis: bool = True)#
Move the gripper to a specific pose.
- Parameters:
pose – The pose to go to.
movement_type – The type of movement that should be performed.
add_vis_axis – If a visual axis should be added to the world.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#
Check if object is contained in the gripper such that it can be grasped and picked up.
- classmethod description(object_designator: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Body], semantic_digital_twin.world_description.world_entity.Body], arm: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.Arms], pycram.datastructures.enums.Arms] = None, grasp_description: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.grasp.GraspDescription], pycram.datastructures.grasp.GraspDescription] = None) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[ReachToPickUpAction]]#
- class pycram.robot_plans.actions.core.PickUpAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionLet the robot pick up an object.
- object_designator: semantic_digital_twin.world_description.world_entity.Body#
Object designator_description describing the object that should be picked up
- arm: pycram.datastructures.enums.Arms#
The arm that should be used for pick up
- grasp_description: pycram.datastructures.grasp.GraspDescription#
The GraspDescription that should be used for picking up the object
- _pre_perform_callbacks = []#
List to save the callbacks which should be called before performing the action.
- __post_init__()#
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#
Check if picked up object is in contact with the gripper.
- classmethod description(object_designator: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Body], semantic_digital_twin.world_description.world_entity.Body], arm: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.Arms], pycram.datastructures.enums.Arms] = None, grasp_description: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.grasp.GraspDescription], pycram.datastructures.grasp.GraspDescription] = None) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[PickUpAction]]#
- class pycram.robot_plans.actions.core.GraspingAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionGrasps an object described by the given Object Designator description
- object_designator: semantic_digital_twin.world_description.world_entity.Body#
Object Designator for the object that should be grasped
- arm: pycram.datastructures.enums.Arms#
The arm that should be used to grasp
- prepose_distance: float#
The distance in meters the gripper should be at before grasping the object
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#
- classmethod description(object_designator: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Body], semantic_digital_twin.world_description.world_entity.Body], arm: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.Arms], pycram.datastructures.enums.Arms] = None, prepose_distance: typing_extensions.Union[typing_extensions.Iterable[float], float] = ActionConfig.grasping_prepose_distance) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[GraspingAction]]#
- pycram.robot_plans.actions.core.ReachToPickUpActionDescription#
- pycram.robot_plans.actions.core.PickUpActionDescription#
- pycram.robot_plans.actions.core.GraspingActionDescription#
- class pycram.robot_plans.actions.core.PerceptionQuery#
- semantic_annotation: typing_extensions.Type[semantic_digital_twin.world_description.world_entity.SemanticAnnotation]#
The semantic annotation for which to perceive
- region: semantic_digital_twin.world_description.geometry.BoundingBox#
The region in which the object should be detected
- robot: semantic_digital_twin.robots.abstract_robot.AbstractRobot#
‘ Robot annotation of the robot that should perceive the object.
- world: semantic_digital_twin.world.World#
The world in which the object should be detected.
- from_world() typing_extensions.List[semantic_digital_twin.world_description.world_entity.Body]#
- from_robokudo()#
- class pycram.robot_plans.actions.core.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.core.DetectionState#
Bases:
int,enum.EnumEnum for the state of the detection task.
- START = 0#
- STOP = 1#
- PAUSE = 2#
- class pycram.robot_plans.actions.core.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.
- pycram.robot_plans.actions.core.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.core.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.core.DetectAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionDetects an object that fits the object description and returns an object designator_description describing the object.
If no object is found, an PerceptionObjectNotFound error is raised.
- technique: pycram.datastructures.enums.DetectionTechnique#
The technique that should be used for detection
- state: typing_extensions.Optional[pycram.datastructures.enums.DetectionState] = None#
The state of the detection, e.g Start Stop for continues perception
- object_sem_annotation: typing_extensions.Type[semantic_digital_twin.world_description.world_entity.SemanticAnnotation] = None#
The type of the object that should be detected, only considered if technique is equal to Type
- region: typing_extensions.Optional[semantic_digital_twin.world_description.world_entity.Region] = None#
The region in which the object should be detected
- __post_init__()#
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#
- classmethod description(technique: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.DetectionTechnique], pycram.datastructures.enums.DetectionTechnique], state: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.DetectionState], pycram.datastructures.enums.DetectionState] = None, object_sem_annotation: typing_extensions.Union[typing_extensions.Iterable[typing_extensions.Type[semantic_digital_twin.world_description.world_entity.SemanticAnnotation]], typing_extensions.Type[semantic_digital_twin.world_description.world_entity.SemanticAnnotation]] = None, region: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Region], semantic_digital_twin.world_description.world_entity.Region] = None) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[DetectAction]]#
- pycram.robot_plans.actions.core.DetectActionDescription#
- class pycram.robot_plans.actions.core.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.core.MoveMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionMoves the robot to a designated location
- target: pycram.datastructures.pose.PoseStamped#
Location to which the robot should be moved
- keep_joint_states: bool = False#
Keep the joint states of the robot during/at the end of the motion
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.actions.core.LookingMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionLets the robot look at a point
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.actions.core.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.core.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.core.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.
- exception pycram.robot_plans.actions.core.LookAtGoalNotReached(robot: Object, target: pycram.datastructures.pose.PoseStamped, *args, **kwargs)#
Bases:
LookingHighLevelFailureThrown when the look at goal is not reached.
Bases:
PlanFailureThrown when the navigation goal is not reached.
The current pose of the robot.
The goal pose of the robot.
- pycram.robot_plans.actions.core.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.core.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.core.PoseErrorChecker(acceptable_error: typing_extensions.Union[typing_extensions.Tuple[float], typing_extensions.Iterable[typing_extensions.Tuple[float]]] = (0.001, np.pi / 180), is_iterable: typing_extensions.Optional[bool] = False)#
Bases:
ErrorCheckerAn abstract class that resembles an error checker. It has two main methods, one for calculating the error between two values and another for checking if the error is acceptable.
- _calculate_error(value_1: typing_extensions.Any, value_2: typing_extensions.Any) typing_extensions.List[float]#
Calculate the error between two poses.
- Parameters:
value_1 – The first pose.
value_2 – The second pose.
Bases:
pycram.robot_plans.actions.base.ActionDescriptionNavigates the Robot to a position.
Location to which the robot should be navigated
Keep the joint states of the robot the same during the navigation.
Symbolic plan. Should only call motions or sub-actions.
- class pycram.robot_plans.actions.core.LookAtAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionLets the robot look at a position.
- target: pycram.datastructures.pose.PoseStamped#
Position at which the robot should look, given as 6D pose
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#
Check if the robot is looking at the target location by spawning a virtual object at the target location and creating a ray from the camera and checking if it intersects with the object.
- classmethod description(target: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.pose.PoseStamped], pycram.datastructures.pose.PoseStamped]) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[LookAtAction]]#
- pycram.robot_plans.actions.core.LookAtActionDescription#
- class pycram.robot_plans.actions.core.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.core.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.core.MoveGripperMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionOpens or closes the gripper
- motion: pycram.datastructures.enums.GripperState#
Motion that should be performed, either ‘open’ or ‘close’
- gripper: pycram.datastructures.enums.Arms#
Name of the gripper that should be moved
- allow_gripper_collision: bool | None = None#
If the gripper is allowed to collide with something
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.actions.core.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.core.GripperState#
Bases:
enum.EnumEnum for the different motions of the gripper.
- OPEN#
- CLOSE#
- MEDIUM#
- __str__()#
- __repr__()#
- class pycram.robot_plans.actions.core.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.core.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.
- exception pycram.robot_plans.actions.core.ObjectNotPlacedAtTargetLocation(obj: Object, placing_pose: pycram.datastructures.pose.PoseStamped, robot: Object, arm: pycram.datastructures.enums.Arms, *args, **kwargs)#
Bases:
ObjectPlacingErrorThrown when the object was not placed at the target location.
- exception pycram.robot_plans.actions.core.ObjectStillInContact(obj: Object, contact_links: typing_extensions.List[Link], placing_pose: pycram.datastructures.pose.PoseStamped, robot: Object, arm: pycram.datastructures.enums.Arms, *args, **kwargs)#
Bases:
ObjectPlacingErrorThrown when the object is still in contact with the robot after placing.
- contact_links: typing_extensions.List[Link]#
The links of the robot that are still in contact with the object.
- pycram.robot_plans.actions.core.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.core.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.core.ViewManager#
- static get_end_effector_view(arm: pycram.datastructures.enums.Arms, robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot) typing_extensions.Optional[semantic_digital_twin.robots.abstract_robot.Manipulator]#
- static get_arm_view(arm: pycram.datastructures.enums.Arms, robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot) typing_extensions.Optional[semantic_digital_twin.robots.abstract_robot.KinematicChain]#
Get the arm view for a given arm and robot view.
- Parameters:
arm – The arm to get the view for.
robot_view – The robot view to search in.
- Returns:
The Manipulator object representing the arm.
- static get_neck_view(robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot) typing_extensions.Optional[semantic_digital_twin.robots.abstract_robot.Neck]#
Get the neck view for a given robot view.
- Parameters:
robot_view – The robot view to search in.
- Returns:
The Neck object representing the neck.
- class pycram.robot_plans.actions.core.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.core.translate_pose_along_local_axis(pose: pycram.datastructures.pose.PoseStamped, axis: typing_extensions.List | numpy.ndarray, distance: float) pycram.datastructures.pose.PoseStamped#
Translate a pose along a given 3d vector (axis) by a given distance. The axis is given in the local coordinate frame of the pose. The axis is normalized and then scaled by the distance.
- Parameters:
pose – The pose that should be translated
axis – The local axis along which the translation should be performed
distance – The distance by which the pose should be translated
- Returns:
The translated pose
- class pycram.robot_plans.actions.core.PoseErrorChecker(acceptable_error: typing_extensions.Union[typing_extensions.Tuple[float], typing_extensions.Iterable[typing_extensions.Tuple[float]]] = (0.001, np.pi / 180), is_iterable: typing_extensions.Optional[bool] = False)#
Bases:
ErrorCheckerAn abstract class that resembles an error checker. It has two main methods, one for calculating the error between two values and another for checking if the error is acceptable.
- _calculate_error(value_1: typing_extensions.Any, value_2: typing_extensions.Any) typing_extensions.List[float]#
Calculate the error between two poses.
- Parameters:
value_1 – The first pose.
value_2 – The second pose.
- class pycram.robot_plans.actions.core.PlaceAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionPlaces an Object at a position using an arm.
- object_designator: semantic_digital_twin.world_description.world_entity.Body#
Object designator_description describing the object that should be place
- target_location: pycram.datastructures.pose.PoseStamped#
Pose in the world at which the object should be placed
- arm: pycram.datastructures.enums.Arms#
Arm that is currently holding the object
- _pre_perform_callbacks = []#
List to save the callbacks which should be called before performing the action.
- __post_init__()#
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: typing_extensions.Optional[datetime.timedelta] = None)#
Check if the object is placed at the target location.
- validate_loss_of_contact()#
Check if the object is still in contact with the robot after placing it.
- validate_placement_location()#
Check if the object is placed at the target location.
- classmethod description(object_designator: typing_extensions.Union[typing_extensions.Iterable[semantic_digital_twin.world_description.world_entity.Body], semantic_digital_twin.world_description.world_entity.Body], target_location: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.pose.PoseStamped], pycram.datastructures.pose.PoseStamped], arm: typing_extensions.Union[typing_extensions.Iterable[pycram.datastructures.enums.Arms], pycram.datastructures.enums.Arms]) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[PlaceAction]]#
- pycram.robot_plans.actions.core.PlaceActionDescription#
- class pycram.robot_plans.actions.core.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.core.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.core.Vector3Stamped#
Bases:
Vector3A Vector3 with an attached ROS Header (timestamp and frame). Inherits all vector operations and adds frame/time metadata.
- property frame_id#
- __repr__()#
- ros_message()#
Convert to a ROS Vector3Stamped message.
- Returns:
The ROS message.
- classmethod from_ros_message(message)#
Create a Vector3Stamped from a ROS message.
- Parameters:
message – The Vector3Stamped ROS message.
- Returns:
A new Vector3Stamped object.
- to_spatial_type() semantic_digital_twin.spatial_types.spatial_types.Vector3#
- exception pycram.robot_plans.actions.core.TorsoGoalNotReached(goal_validator: typing_extensions.Optional[pycram.validation.goal_validator.MultiJointPositionGoalValidator] = None, *args, **kwargs)#
Bases:
TorsoLowLevelFailureThrown when the torso moved as a result of a torso action but the goal was not reached.
- exception pycram.robot_plans.actions.core.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.core.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.core.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.core.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.core.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.core.MoveGripperMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionOpens or closes the gripper
- motion: pycram.datastructures.enums.GripperState#
Motion that should be performed, either ‘open’ or ‘close’
- gripper: pycram.datastructures.enums.Arms#
Name of the gripper that should be moved
- allow_gripper_collision: bool | None = None#
If the gripper is allowed to collide with something
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- class pycram.robot_plans.actions.core.MoveJointsMotion#
Bases:
pycram.robot_plans.motions.base.BaseMotionMoves any joint on the robot
- names: list#
List of joint names that should be moved
- positions: list#
Target positions of joints, should correspond to the list of names
- align: bool | None = False#
If True, aligns the end-effector with a specified axis (optional).
- tip_link: str | None = None#
Name of the tip link to align with, e.g the object (optional).
- tip_normal: pycram.datastructures.pose.Vector3Stamped | None = None#
Normalized vector representing the current orientation axis of the end-effector (optional).
- root_link: str | None = None#
Base link of the robot; typically set to the torso (optional).
- root_normal: pycram.datastructures.pose.Vector3Stamped | None = None#
Normalized vector representing the desired orientation axis to align with (optional).
- perform()#
Passes this designator to the process module for execution. Will be overwritten by each motion.
- pycram.robot_plans.actions.core.create_multiple_joint_goal_validator(robot: Object, joint_positions: typing_extensions.Union[typing_extensions.Dict[Joint, float], typing_extensions.Dict[str, float]]) MultiJointPositionGoalValidator#
Validate the multiple joint goals, and wait until the goal is achieved.
- Parameters:
robot – The robot object.
joint_positions – The joint positions to validate.
- class pycram.robot_plans.actions.core.MoveTorsoAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionMove the torso of the robot up and down.
- torso_state: pycram.robot_descriptions.pr2_states.TorsoState#
The state of the torso that should be set
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: datetime.timedelta = timedelta(seconds=2))#
Create a goal validator for the joint positions and wait until the goal is achieved or the timeout is reached.
- classmethod description(torso_state: typing_extensions.Union[typing_extensions.Iterable[pycram.robot_descriptions.pr2_states.TorsoState], pycram.robot_descriptions.pr2_states.TorsoState]) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[MoveTorsoAction]]#
- class pycram.robot_plans.actions.core.SetGripperAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionSet the gripper state of the robot.
- gripper: pycram.robot_descriptions.pr2_states.Arms#
The gripper that should be set
- motion: pycram.robot_descriptions.pr2_states.GripperStateEnum#
The motion that should be set on the gripper
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: datetime.timedelta = timedelta(seconds=2))#
Needs gripper state to be read or perceived.
- classmethod description(gripper: typing_extensions.Union[typing_extensions.Iterable[pycram.robot_descriptions.pr2_states.Arms], pycram.robot_descriptions.pr2_states.Arms], motion: typing_extensions.Union[typing_extensions.Iterable[pycram.robot_descriptions.pr2_states.GripperState], pycram.robot_descriptions.pr2_states.GripperState] = None) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[SetGripperAction]]#
- class pycram.robot_plans.actions.core.ParkArmsAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionPark the arms of the robot.
- arm: pycram.robot_descriptions.pr2_states.Arms#
Entry from the enum for which arm should be parked.
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- get_joint_poses() Tuple[List[str], List[float]]#
- Returns:
The joint positions that should be set for the arm to be in the park position.
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: datetime.timedelta = timedelta(seconds=2))#
Create a goal validator for the joint positions and wait until the goal is achieved or the timeout is reached.
- classmethod description(arm: typing_extensions.Union[typing_extensions.Iterable[pycram.robot_descriptions.pr2_states.Arms], pycram.robot_descriptions.pr2_states.Arms]) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[ParkArmsAction]]#
- class pycram.robot_plans.actions.core.CarryAction#
Bases:
pycram.robot_plans.actions.base.ActionDescriptionParks the robot’s arms. And align the arm with the given Axis of a frame.
- arm: pycram.robot_descriptions.pr2_states.Arms#
Entry from the enum for which arm should be parked.
- align: typing_extensions.Optional[bool] = False#
If True, aligns the end-effector with a specified axis.
- tip_link: typing_extensions.Optional[str] = None#
Name of the tip link to align with, e.g the object.
- tip_axis: typing_extensions.Optional[pycram.datastructures.enums.AxisIdentifier] = None#
Tip axis of the tip link, that should be aligned.
- root_link: typing_extensions.Optional[str] = None#
Base link of the robot; typically set to the torso.
- root_axis: typing_extensions.Optional[pycram.datastructures.enums.AxisIdentifier] = None#
Goal axis of the root link, that should be used to align with.
- plan() None#
Symbolic plan. Should only call motions or sub-actions.
- get_joint_poses() typing_extensions.Dict[str, float]#
- Returns:
The joint positions that should be set for the arm to be in the park position.
- axis_to_vector3_stamped(axis: pycram.datastructures.enums.AxisIdentifier, link: str = 'base_link') pycram.datastructures.pose.Vector3Stamped#
- validate(result: typing_extensions.Optional[typing_extensions.Any] = None, max_wait_time: datetime.timedelta = timedelta(seconds=2))#
Create a goal validator for the joint positions and wait until the goal is achieved or the timeout is reached.
- classmethod description(arm: typing_extensions.Union[typing_extensions.Iterable[pycram.robot_descriptions.pr2_states.Arms], pycram.robot_descriptions.pr2_states.Arms], align: typing_extensions.Optional[bool] = False, tip_link: typing_extensions.Optional[str] = None, tip_axis: typing_extensions.Optional[pycram.datastructures.enums.AxisIdentifier] = None, root_link: typing_extensions.Optional[str] = None, root_axis: typing_extensions.Optional[pycram.datastructures.enums.AxisIdentifier] = None) pycram.datastructures.partial_designator.PartialDesignator[typing_extensions.Type[CarryAction]]#
- pycram.robot_plans.actions.core.MoveTorsoActionDescription#
- pycram.robot_plans.actions.core.SetGripperActionDescription#
- pycram.robot_plans.actions.core.ParkArmsActionDescription#
- pycram.robot_plans.actions.core.CarryActionDescription#
- class pycram.robot_plans.actions.core.StaticJointState#
Bases:
enum.EnumGeneric enumeration.
Derive from this class to define new enumerations.
- Park = 'park'#
- class pycram.robot_plans.actions.core.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.core.GripperStateEnum#
Bases:
enum.EnumEnum for the different motions of the gripper.
- OPEN#
- CLOSE#
- MEDIUM#
- __str__()#
- __repr__()#
- class pycram.robot_plans.actions.core.TorsoState#
Bases:
enum.IntEnumEnum for the different states of the torso.
- HIGH#
- MID#
- LOW#
- class pycram.robot_plans.actions.core.JointState#
Represents a named joint state of a robot. For example, the park position of the arms.
- name: semantic_digital_twin.datastructures.prefixed_name.PrefixedName#
Name of the joint state
- joint_names: List[str]#
Names of the joints in this state
- joint_positions: List[float]#
position of the joints in this state, must correspond to the joint_names
- state_type: enum.Enum = None#
Enum type of the joints tate (e.g., Park, Open)
- apply_to_world(world: semantic_digital_twin.world.World)#
Applies the joint state to the robot in the given world. :param world: The world in which the robot is located.
- class pycram.robot_plans.actions.core.ArmState#
Bases:
JointStateRepresents a named joint state of a robot. For example, the park position of the arms.
- arm: pycram.datastructures.enums.Arms = None#
- class pycram.robot_plans.actions.core.GripperState#
Bases:
JointStateRepresents the state of a gripper, such as open or closed.
- gripper: pycram.datastructures.enums.Arms = None#
- class pycram.robot_plans.actions.core.JointStateManager#
Manages joint states for different robot arms and their configurations.
- joint_states: Dict[Type[semantic_digital_twin.robots.abstract_robot.AbstractRobot], List[JointState]]#
A list of joint states that can be applied to the robot.
- get_arm_state(arm: pycram.datastructures.enums.Arms, state_type: pycram.datastructures.enums.StaticJointState, robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot) ArmState | None#
Retrieves the joint state for a specific arm and state type.
- Parameters:
arm – The arm for which the state is requested.
state_type – The type of state (e.g., Park).
robot_view – The robot view to which the arm belongs.
- Returns:
The corresponding ArmState or None if not found.
- get_gripper_state(gripper: pycram.datastructures.enums.Arms, state_type: pycram.datastructures.enums.StaticJointState, robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot) GripperState | None#
Retrieves the joint state for a specific gripper and state type.
- Parameters:
gripper – The gripper for which the state is requested.
state_type – The type of state (e.g., Open, Close).
robot_view – The robot view to which the gripper belongs.
- Returns:
The corresponding GripperState or None if not found.
- get_joint_state(state: enum.Enum, robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot) List[JointState]#
Retrieves all joint states of a specific type for a given robot.
- Parameters:
state – The type of joint state to retrieve (e.g., Park, Open).
robot_view – The robot class for which the joint states are requested.
- Returns:
A list of JointState objects matching the specified type.
- add_joint_states(robot: Type[semantic_digital_twin.robots.abstract_robot.AbstractRobot], joint_states: List[JointState])#
Adds joint states for a specific robot type.
- Parameters:
robot – The robot class for which the joint states are added.
joint_states – A list of joint states to be added.
- pycram.robot_plans.actions.core.right_park#
- pycram.robot_plans.actions.core.left_park#
- pycram.robot_plans.actions.core.both_park#
- pycram.robot_plans.actions.core.left_gripper_open#
- pycram.robot_plans.actions.core.left_gripper_close#
- pycram.robot_plans.actions.core.right_gripper_open#
- pycram.robot_plans.actions.core.right_gripper_close#
- pycram.robot_plans.actions.core.torso_low#
- pycram.robot_plans.actions.core.torso_mid#
- pycram.robot_plans.actions.core.torso_high#