pycram.robot_plans.motions

Contents

pycram.robot_plans.motions#

Submodules#

Exceptions#

ToolPoseNotReachedError

Thrown when the tool pose is not reached.

Classes#

BaseMotion

Helper class that provides a standard way to create an ABC using

Arms

Enum for Arms.

ProcessModuleManager

Base class for managing process modules, any new process modules have to implement this class to register the

OpeningMotion

Designator for opening container

ClosingMotion

Designator for closing a container

BaseMotion

Helper class that provides a standard way to create an ABC using

Arms

Enum for Arms.

GripperState

Enum for the different motions of the gripper.

MovementType

Enum for the different movement types of the robot.

WaypointsMovementType

Enum for the different movement types of the robot.

GraspDescription

Represents a grasp description with a side grasp, top face, and orientation alignment.

PoseStamped

A pose in 3D space with a timestamp.

ProcessModuleManager

Base class for managing process modules, any new process modules have to implement this class to register the

ViewManager

ReachMotion

MoveArmJointsMotion

Moves the joints of each arm into the given position

MoveGripperMotion

Opens or closes the gripper

MoveTCPMotion

Moves the Tool center point (TCP) of the robot

MoveTCPWaypointsMotion

Moves the Tool center point (TCP) of the robot

PerceptionQuery

BaseMotion

Helper class that provides a standard way to create an ABC using

ProcessModuleManager

Base class for managing process modules, any new process modules have to implement this class to register the

DetectingMotion

Tries to detect an object in the FOV of the robot

BaseMotion

Helper class that provides a standard way to create an ABC using

PoseStamped

A pose in 3D space with a timestamp.

ProcessModuleManager

Base class for managing process modules, any new process modules have to implement this class to register the

MoveMotion

Moves the robot to a designated location

LookingMotion

Lets the robot look at a point

BaseMotion

Helper class that provides a standard way to create an ABC using

Vector3Stamped

A Vector3 with an attached ROS Header (timestamp and frame).

ProcessModuleManager

Base class for managing process modules, any new process modules have to implement this class to register the

MoveJointsMotion

Moves any joint on the robot

Functions#

try_motion(motion, motion_designator_instance, ...[, ...])

A generic function to retry a motion a certain number of times before giving up, with a specific exception.

translate_pose_along_local_axis(...)

Translate a pose along a given 3d vector (axis) by a given distance. The axis is given in the local coordinate

Package Contents#

class pycram.robot_plans.motions.BaseMotion#

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

plan_node: pycram.plan.PlanNode = None#
property plan: pycram.plan.Plan#
property world: semantic_digital_twin.world.World#
property robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot#
abstract perform()#

Passes this designator to the process module for execution. Will be overwritten by each motion.

__post_init__()#

Checks if types are missing or wrong

class pycram.robot_plans.motions.Arms#

Bases: enum.IntEnum

Enum for Arms.

LEFT = 0#
RIGHT = 1#
BOTH = 2#
__str__()#

Return str(self).

__repr__()#

Return repr(self).

class pycram.robot_plans.motions.ProcessModuleManager#

Bases: abc.ABC

Base class for managing process modules, any new process modules have to implement this class to register the Process Modules

execution_type: pycram.datastructures.enums.ExecutionType = None#

Whether the robot for which the process module is intended for is real or a simulated one

available_pms: typing_extensions.List[ManagerBase] = []#

List of all available Process Module Managers

_instance: ProcessModuleManager = None#

Singelton instance of this Process Module Manager

_initialized: bool = False#
register_manager(manager: ManagerBase)#

Register a new Process Module Manager for the given robot name.

Parameters:

manager – The Process Module Manager to register

get_manager(robot: semantic_digital_twin.robots.abstract_robot.AbstractRobot) ManagerBase#

Returns the Process Module manager for the currently loaded robot or None if there is no Manager.

Returns:

ProcessModuleManager instance of the current robot

static register_all_process_modules()#
class pycram.robot_plans.motions.OpeningMotion#

Bases: pycram.robot_plans.motions.base.BaseMotion

Designator 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.motions.ClosingMotion#

Bases: pycram.robot_plans.motions.base.BaseMotion

Designator 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.motions.BaseMotion#

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

plan_node: pycram.plan.PlanNode = None#
property plan: pycram.plan.Plan#
property world: semantic_digital_twin.world.World#
property robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot#
abstract perform()#

Passes this designator to the process module for execution. Will be overwritten by each motion.

__post_init__()#

Checks if types are missing or wrong

class pycram.robot_plans.motions.Arms#

Bases: enum.IntEnum

Enum for Arms.

LEFT = 0#
RIGHT = 1#
BOTH = 2#
__str__()#

Return str(self).

__repr__()#

Return repr(self).

class pycram.robot_plans.motions.GripperState#

Bases: enum.Enum

Enum for the different motions of the gripper.

OPEN#
CLOSE#
MEDIUM#
__str__()#
__repr__()#
class pycram.robot_plans.motions.MovementType#

Bases: enum.Enum

Enum for the different movement types of the robot.

STRAIGHT_TRANSLATION#
STRAIGHT_CARTESIAN#
TRANSLATION#
CARTESIAN#
class pycram.robot_plans.motions.WaypointsMovementType#

Bases: enum.Enum

Enum for the different movement types of the robot.

ENFORCE_ORIENTATION_STRICT#
ENFORCE_ORIENTATION_FINAL_POINT#
class pycram.robot_plans.motions.GraspDescription#

Bases: pycram.has_parameters.HasParameters

Represents 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.motions.PoseStamped#

Bases: pycram.has_parameters.HasParameters

A pose in 3D space with a timestamp.

pose: Pose#
header: Header#
property position#
property orientation#
property frame_id#
__repr__()#
ros_message()#

Convert the pose to a ROS message of type PoseStamped.

Returns:

The ROS message.

classmethod from_ros_message(message: ROSPoseStamped) typing_extensions.Self#

Create a PoseStamped from a ROS message.

Parameters:

message – The PoseStamped ROS message.

Returns:

A new PoseStamped object created from the ROS message.

classmethod from_list(position: typing_extensions.Optional[typing_extensions.List[float]] = None, orientation: typing_extensions.Optional[typing_extensions.List[float]] = None, frame: typing_extensions.Optional[semantic_digital_twin.world_description.world_entity.Body] = None) typing_extensions.Self#

Factory to create a PoseStamped from a list of position and orientation.

Parameters:
  • position – Position as a list of [x, y, z].

  • orientation – Orientation as a list of [x, y, z, w].

  • frame – Frame in which the pose is defined.

Returns:

A new PoseStamped object.

classmethod from_matrix(matrix: numpy.ndarray, frame: semantic_digital_twin.world_description.world_entity.Body) typing_extensions.Self#

Create a PoseStamped from a 4x4 transformation matrix and a frame.

Parameters:
  • matrix – A 4x4 transformation matrix as numpy array.

  • frame – The frame in which the pose is defined.

Returns:

A PoseStamped object created from the matrix and frame.

classmethod from_spatial_type(spatial_type: semantic_digital_twin.spatial_types.spatial_types.TransformationMatrix) typing_extensions.Self#

Create a PoseStamped from a SpatialTransformationMatrix and a frame.

Parameters:

spatial_type – A SpatialTransformationMatrix object.

Returns:

A PoseStamped object created from the spatial type and frame.

to_transform_stamped(child_link_id: semantic_digital_twin.world_description.world_entity.Body) TransformStamped#

Converts the PoseStamped to a TransformStamped given a frame to which the transform is pointing.

Parameters:

child_link_id – Frame to which the transform is pointing.

Returns:

A TransformStamped object.

to_spatial_type() semantic_digital_twin.spatial_types.spatial_types.TransformationMatrix#

Converts the PoseStamped to a SpatialTransformationMatrix.

Returns:

A SpatialTransformationMatrix object representing the pose in 3D space.

round(decimals: int = 4)#

Rounds the components of the pose (position and orientation) to the specified number of decimal places.

Parameters:

decimals – Number of decimal places to round to.

to_list()#

Convert the pose to a list of [position, orientation, frame_id].

Returns:

A list of [pose, frame_id].

almost_equal(other: PoseStamped, position_tolerance: float = 1e-06, orientation_tolerance: float = 1e-05) bool#

Check if two PoseStamped objects are almost equal within given tolerances for position and orientation and if the frame_id is the same.

Parameters:
  • other – The other PoseStamped object to compare to.

  • position_tolerance – Tolerance for position comparison as number of decimal places.

  • orientation_tolerance – Tolerance for orientation comparison as number of decimal places.

Returns:

True if the PoseStamped objects are almost equal, False otherwise.

rotate_by_quaternion(quaternion: typing_extensions.List[float])#

Rotates the orientation of the pose by a given quaternion.

Parameters:

quaternion – A list representing the quaternion [x, y, z, w].

is_facing_2d_axis(pose_b: PoseStamped, axis: typing_extensions.Optional[pycram.datastructures.enums.AxisIdentifier] = AxisIdentifier.X, threshold_deg=82) typing_extensions.Tuple[bool, float]#

Check if this pose is facing another pose along a specific axis (X or Y) within a given angular threshold.

Parameters:
  • pose_b – The target pose to compare against.

  • axis – The axis to check alignment with (‘x’ or ‘y’). Defaults to ‘x’.

  • threshold_deg – The maximum angular difference in degrees to consider as ‘facing’. Defaults to 82 degrees.

Returns:

Tuple of (True/False if facing, signed angular difference in radians).

is_facing_x_or_y(pose_b: PoseStamped) bool#

Check if this pose is facing another pose along either the X or Y axis within a default angular threshold.

Parameters:

pose_b – The target pose to compare against.

Returns:

True if this pose is facing the target along either X or Y axis, False otherwise.

pycram.robot_plans.motions.try_motion(motion: pycram.process_module.ProcessModule, motion_designator_instance: pycram.robot_plans.BaseMotion, failure_type: typing_extensions.Type[Exception], max_tries: int = 3)#

A generic function to retry a motion a certain number of times before giving up, with a specific exception.

Parameters:
  • motion – The motion to be executed.

  • motion_designator_instance – The instance of the motion designator that has the description of the motion.

  • failure_type – The type of exception to catch.

  • max_tries – The maximum number of attempts to retry the motion.

exception pycram.robot_plans.motions.ToolPoseNotReachedError(current_pose: pycram.datastructures.pose.PoseStamped, goal_pose: pycram.datastructures.pose.PoseStamped, *args, **kwargs)#

Bases: PlanFailure

Thrown when the tool pose is not reached.

current_pose: pycram.datastructures.pose.PoseStamped#

The current pose of the tool.

goal_pose: pycram.datastructures.pose.PoseStamped#

The goal pose of the tool.

class pycram.robot_plans.motions.ProcessModuleManager#

Bases: abc.ABC

Base class for managing process modules, any new process modules have to implement this class to register the Process Modules

execution_type: pycram.datastructures.enums.ExecutionType = None#

Whether the robot for which the process module is intended for is real or a simulated one

available_pms: typing_extensions.List[ManagerBase] = []#

List of all available Process Module Managers

_instance: ProcessModuleManager = None#

Singelton instance of this Process Module Manager

_initialized: bool = False#
register_manager(manager: ManagerBase)#

Register a new Process Module Manager for the given robot name.

Parameters:

manager – The Process Module Manager to register

get_manager(robot: semantic_digital_twin.robots.abstract_robot.AbstractRobot) ManagerBase#

Returns the Process Module manager for the currently loaded robot or None if there is no Manager.

Returns:

ProcessModuleManager instance of the current robot

static register_all_process_modules()#
class pycram.robot_plans.motions.ViewManager#
static get_end_effector_view(arm: pycram.datastructures.enums.Arms, robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot) typing_extensions.Optional[semantic_digital_twin.robots.abstract_robot.Manipulator]#
static get_arm_view(arm: pycram.datastructures.enums.Arms, robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot) typing_extensions.Optional[semantic_digital_twin.robots.abstract_robot.KinematicChain]#

Get the arm view for a given arm and robot view.

Parameters:
  • arm – The arm to get the view for.

  • robot_view – The robot view to search in.

Returns:

The Manipulator object representing the arm.

static get_neck_view(robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot) typing_extensions.Optional[semantic_digital_twin.robots.abstract_robot.Neck]#

Get the neck view for a given robot view.

Parameters:

robot_view – The robot view to search in.

Returns:

The Neck object representing the neck.

pycram.robot_plans.motions.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.motions.ReachMotion#

Bases: pycram.robot_plans.motions.base.BaseMotion

object_designator: semantic_digital_twin.world_description.world_entity.Body#

Object designator_description describing the object that should be picked up

arm: pycram.datastructures.enums.Arms#

The arm that should be used for pick up

grasp_description: pycram.datastructures.grasp.GraspDescription#

The grasp description that should be used for picking up the object

movement_type: pycram.datastructures.enums.MovementType#

The type of movement that should be performed.

perform()#

Passes this designator to the process module for execution. Will be overwritten by each motion.

class pycram.robot_plans.motions.MoveArmJointsMotion#

Bases: pycram.robot_plans.motions.base.BaseMotion

Moves the joints of each arm into the given position

left_arm_poses: Dict[str, float] | None = None#

Target positions for the left arm joints

right_arm_poses: Dict[str, float] | None = None#

Target positions for the right arm joints

perform()#

Passes this designator to the process module for execution. Will be overwritten by each motion.

class pycram.robot_plans.motions.MoveGripperMotion#

Bases: pycram.robot_plans.motions.base.BaseMotion

Opens 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.motions.MoveTCPMotion#

Bases: pycram.robot_plans.motions.base.BaseMotion

Moves 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.motions.MoveTCPWaypointsMotion#

Bases: pycram.robot_plans.motions.base.BaseMotion

Moves the Tool center point (TCP) of the robot

waypoints: List[pycram.datastructures.pose.PoseStamped]#

Waypoints the TCP should move along

arm: pycram.datastructures.enums.Arms#

Arm with the TCP that should be moved to the target

allow_gripper_collision: bool | None = None#

If the gripper can collide with something

movement_type: pycram.datastructures.enums.WaypointsMovementType#

The type of movement that should be performed.

perform()#

Passes this designator to the process module for execution. Will be overwritten by each motion.

class pycram.robot_plans.motions.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.motions.BaseMotion#

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

plan_node: pycram.plan.PlanNode = None#
property plan: pycram.plan.Plan#
property world: semantic_digital_twin.world.World#
property robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot#
abstract perform()#

Passes this designator to the process module for execution. Will be overwritten by each motion.

__post_init__()#

Checks if types are missing or wrong

class pycram.robot_plans.motions.ProcessModuleManager#

Bases: abc.ABC

Base class for managing process modules, any new process modules have to implement this class to register the Process Modules

execution_type: pycram.datastructures.enums.ExecutionType = None#

Whether the robot for which the process module is intended for is real or a simulated one

available_pms: typing_extensions.List[ManagerBase] = []#

List of all available Process Module Managers

_instance: ProcessModuleManager = None#

Singelton instance of this Process Module Manager

_initialized: bool = False#
register_manager(manager: ManagerBase)#

Register a new Process Module Manager for the given robot name.

Parameters:

manager – The Process Module Manager to register

get_manager(robot: semantic_digital_twin.robots.abstract_robot.AbstractRobot) ManagerBase#

Returns the Process Module manager for the currently loaded robot or None if there is no Manager.

Returns:

ProcessModuleManager instance of the current robot

static register_all_process_modules()#
class pycram.robot_plans.motions.DetectingMotion#

Bases: pycram.robot_plans.motions.base.BaseMotion

Tries to detect an object in the FOV of the robot

returns: ObjectDesignatorDescription.Object or Error: PerceptionObjectNotFound

query: pycram.perception.PerceptionQuery#

Query for the perception system that should be answered

perform()#

Passes this designator to the process module for execution. Will be overwritten by each motion.

class pycram.robot_plans.motions.BaseMotion#

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

plan_node: pycram.plan.PlanNode = None#
property plan: pycram.plan.Plan#
property world: semantic_digital_twin.world.World#
property robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot#
abstract perform()#

Passes this designator to the process module for execution. Will be overwritten by each motion.

__post_init__()#

Checks if types are missing or wrong

class pycram.robot_plans.motions.PoseStamped#

Bases: pycram.has_parameters.HasParameters

A pose in 3D space with a timestamp.

pose: Pose#
header: Header#
property position#
property orientation#
property frame_id#
__repr__()#
ros_message()#

Convert the pose to a ROS message of type PoseStamped.

Returns:

The ROS message.

classmethod from_ros_message(message: ROSPoseStamped) typing_extensions.Self#

Create a PoseStamped from a ROS message.

Parameters:

message – The PoseStamped ROS message.

Returns:

A new PoseStamped object created from the ROS message.

classmethod from_list(position: typing_extensions.Optional[typing_extensions.List[float]] = None, orientation: typing_extensions.Optional[typing_extensions.List[float]] = None, frame: typing_extensions.Optional[semantic_digital_twin.world_description.world_entity.Body] = None) typing_extensions.Self#

Factory to create a PoseStamped from a list of position and orientation.

Parameters:
  • position – Position as a list of [x, y, z].

  • orientation – Orientation as a list of [x, y, z, w].

  • frame – Frame in which the pose is defined.

Returns:

A new PoseStamped object.

classmethod from_matrix(matrix: numpy.ndarray, frame: semantic_digital_twin.world_description.world_entity.Body) typing_extensions.Self#

Create a PoseStamped from a 4x4 transformation matrix and a frame.

Parameters:
  • matrix – A 4x4 transformation matrix as numpy array.

  • frame – The frame in which the pose is defined.

Returns:

A PoseStamped object created from the matrix and frame.

classmethod from_spatial_type(spatial_type: semantic_digital_twin.spatial_types.spatial_types.TransformationMatrix) typing_extensions.Self#

Create a PoseStamped from a SpatialTransformationMatrix and a frame.

Parameters:

spatial_type – A SpatialTransformationMatrix object.

Returns:

A PoseStamped object created from the spatial type and frame.

to_transform_stamped(child_link_id: semantic_digital_twin.world_description.world_entity.Body) TransformStamped#

Converts the PoseStamped to a TransformStamped given a frame to which the transform is pointing.

Parameters:

child_link_id – Frame to which the transform is pointing.

Returns:

A TransformStamped object.

to_spatial_type() semantic_digital_twin.spatial_types.spatial_types.TransformationMatrix#

Converts the PoseStamped to a SpatialTransformationMatrix.

Returns:

A SpatialTransformationMatrix object representing the pose in 3D space.

round(decimals: int = 4)#

Rounds the components of the pose (position and orientation) to the specified number of decimal places.

Parameters:

decimals – Number of decimal places to round to.

to_list()#

Convert the pose to a list of [position, orientation, frame_id].

Returns:

A list of [pose, frame_id].

almost_equal(other: PoseStamped, position_tolerance: float = 1e-06, orientation_tolerance: float = 1e-05) bool#

Check if two PoseStamped objects are almost equal within given tolerances for position and orientation and if the frame_id is the same.

Parameters:
  • other – The other PoseStamped object to compare to.

  • position_tolerance – Tolerance for position comparison as number of decimal places.

  • orientation_tolerance – Tolerance for orientation comparison as number of decimal places.

Returns:

True if the PoseStamped objects are almost equal, False otherwise.

rotate_by_quaternion(quaternion: typing_extensions.List[float])#

Rotates the orientation of the pose by a given quaternion.

Parameters:

quaternion – A list representing the quaternion [x, y, z, w].

is_facing_2d_axis(pose_b: PoseStamped, axis: typing_extensions.Optional[pycram.datastructures.enums.AxisIdentifier] = AxisIdentifier.X, threshold_deg=82) typing_extensions.Tuple[bool, float]#

Check if this pose is facing another pose along a specific axis (X or Y) within a given angular threshold.

Parameters:
  • pose_b – The target pose to compare against.

  • axis – The axis to check alignment with (‘x’ or ‘y’). Defaults to ‘x’.

  • threshold_deg – The maximum angular difference in degrees to consider as ‘facing’. Defaults to 82 degrees.

Returns:

Tuple of (True/False if facing, signed angular difference in radians).

is_facing_x_or_y(pose_b: PoseStamped) bool#

Check if this pose is facing another pose along either the X or Y axis within a default angular threshold.

Parameters:

pose_b – The target pose to compare against.

Returns:

True if this pose is facing the target along either X or Y axis, False otherwise.

class pycram.robot_plans.motions.ProcessModuleManager#

Bases: abc.ABC

Base class for managing process modules, any new process modules have to implement this class to register the Process Modules

execution_type: pycram.datastructures.enums.ExecutionType = None#

Whether the robot for which the process module is intended for is real or a simulated one

available_pms: typing_extensions.List[ManagerBase] = []#

List of all available Process Module Managers

_instance: ProcessModuleManager = None#

Singelton instance of this Process Module Manager

_initialized: bool = False#
register_manager(manager: ManagerBase)#

Register a new Process Module Manager for the given robot name.

Parameters:

manager – The Process Module Manager to register

get_manager(robot: semantic_digital_twin.robots.abstract_robot.AbstractRobot) ManagerBase#

Returns the Process Module manager for the currently loaded robot or None if there is no Manager.

Returns:

ProcessModuleManager instance of the current robot

static register_all_process_modules()#
class pycram.robot_plans.motions.MoveMotion#

Bases: pycram.robot_plans.motions.base.BaseMotion

Moves 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.motions.LookingMotion#

Bases: pycram.robot_plans.motions.base.BaseMotion

Lets the robot look at a point

target: pycram.datastructures.pose.PoseStamped#
perform()#

Passes this designator to the process module for execution. Will be overwritten by each motion.

class pycram.robot_plans.motions.BaseMotion#

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

plan_node: pycram.plan.PlanNode = None#
property plan: pycram.plan.Plan#
property world: semantic_digital_twin.world.World#
property robot_view: semantic_digital_twin.robots.abstract_robot.AbstractRobot#
abstract perform()#

Passes this designator to the process module for execution. Will be overwritten by each motion.

__post_init__()#

Checks if types are missing or wrong

class pycram.robot_plans.motions.Vector3Stamped#

Bases: Vector3

A Vector3 with an attached ROS Header (timestamp and frame). Inherits all vector operations and adds frame/time metadata.

header: Header#
property frame_id#
__repr__()#
ros_message()#

Convert to a ROS Vector3Stamped message.

Returns:

The ROS message.

classmethod from_ros_message(message)#

Create a Vector3Stamped from a ROS message.

Parameters:

message – The Vector3Stamped ROS message.

Returns:

A new Vector3Stamped object.

to_spatial_type() semantic_digital_twin.spatial_types.spatial_types.Vector3#
class pycram.robot_plans.motions.ProcessModuleManager#

Bases: abc.ABC

Base class for managing process modules, any new process modules have to implement this class to register the Process Modules

execution_type: pycram.datastructures.enums.ExecutionType = None#

Whether the robot for which the process module is intended for is real or a simulated one

available_pms: typing_extensions.List[ManagerBase] = []#

List of all available Process Module Managers

_instance: ProcessModuleManager = None#

Singelton instance of this Process Module Manager

_initialized: bool = False#
register_manager(manager: ManagerBase)#

Register a new Process Module Manager for the given robot name.

Parameters:

manager – The Process Module Manager to register

get_manager(robot: semantic_digital_twin.robots.abstract_robot.AbstractRobot) ManagerBase#

Returns the Process Module manager for the currently loaded robot or None if there is no Manager.

Returns:

ProcessModuleManager instance of the current robot

static register_all_process_modules()#
class pycram.robot_plans.motions.MoveJointsMotion#

Bases: pycram.robot_plans.motions.base.BaseMotion

Moves 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).

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).

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.