pycram.datastructures.dataclasses#
Classes#
A dataclass for storing the context of a plan |
|
A dataclass for storing the information of an execution that is used for creating a robot description for that |
|
A dataclass for storing the information of a manipulator that is used for creating a robot description for that |
|
Dataclass for storing rgba_color as an RGBA value. |
|
Enum for easy access to some common colors. |
|
Dataclass for storing the collision callbacks which are callables that get called when there is a collision |
|
Dataclass for storing the information of the lateral friction. |
|
Dataclass for storing text annotations that can be displayed in the simulation. |
|
A virtual (not real) joint that is most likely used for simulation purposes. |
|
A dictionary that defines standard quaternions for different grasps and orientations. This is mainly used |
|
Dataclass for storing the names, types and axes of the virtual mobile base joints of a mobile robot. |
|
Meta data for the Multiverse Client, the simulation_name should be non-empty and unique for each simulation |
Functions#
|
Return the point as a list. |
Module Contents#
- class pycram.datastructures.dataclasses.Context#
A dataclass for storing the context of a plan
- world: semantic_digital_twin.world.World#
The world in which the plan is executed
- robot: semantic_digital_twin.robots.abstract_robot.AbstractRobot#
The semantic robot annotation which should execute the plan
- super_plan: typing_extensions.Optional[pycram.plan.Plan] = None#
The plan of which this plan/designator is a part of
- classmethod from_world(world: semantic_digital_twin.world.World, super_plan: typing_extensions.Optional[pycram.plan.Plan] = None)#
Create a context from a world by getting the first robot in the world. There is no super plan in this case.
- Parameters:
world – The world for which to create the context
super_plan – An optional super plan
- Returns:
A context with the first robot in the world and no super plan
- classmethod from_plan(plan: pycram.plan.Plan)#
Create a context from a plan by getting the context information from the plan and setting the super plan to the given plan.
- Parameters:
plan – Plan from which to create the context
- Returns:
A new context with the world and robot from the plan and the super plan set to the given plan
- class pycram.datastructures.dataclasses.ExecutionData#
A dataclass for storing the information of an execution that is used for creating a robot description for that execution. An execution is a Robot with a virtual mobile base that can be used to move the robot in the environment.
- execution_start_pose: pycram.datastructures.pose.PoseStamped#
Start of the robot at the start of execution of an action designator
- execution_start_world_state: numpy.ndarray#
The world state at the start of execution of an action designator
- execution_end_pose: typing_extensions.Optional[pycram.datastructures.pose.PoseStamped] = None#
The pose of the robot at the end of executing an action designator
- execution_end_world_state: typing_extensions.Optional[numpy.ndarray] = None#
The world state at the end of executing an action designator
- added_world_modifications: typing_extensions.List[semantic_digital_twin.world_description.world_modification.WorldModelModificationBlock] = []#
A list of World modification blocks that were added during the execution of the action designator
- manipulated_body_pose_start: typing_extensions.Optional[pycram.datastructures.pose.PoseStamped] = None#
Start pose of the manipulated Body if there was one
- manipulated_body_pose_end: typing_extensions.Optional[pycram.datastructures.pose.PoseStamped] = None#
End pose of the manipulated Body if there was one
- manipulated_body: typing_extensions.Optional[semantic_digital_twin.world_description.world_entity.Body] = None#
Reference to the manipulated body
- manipulated_body_name: typing_extensions.Optional[str] = None#
Name of the manipulated body
- class pycram.datastructures.dataclasses.ManipulatorData#
A dataclass for storing the information of a manipulator that is used for creating a robot description for that manipulator. A manipulator is an Arm with an end-effector that can be used to interact with the environment.
- name: str#
Name of the Manipulator.
- base_link: str#
Manipulator’s base link.
- arm_end_link: str#
Manipulator’s arm end link.
- joint_names: typing_extensions.List[str]#
List of joint names.
- home_joint_values: typing_extensions.List[float]#
List of joint values for the home position. (default position)
- gripper_name: str#
Name of the gripper at the end of the arm.
- gripper_tool_frame: str#
Name of the frame of the gripper tool.
- gripper_joint_names: typing_extensions.List[str]#
List of gripper joint names.
- closed_joint_values: typing_extensions.List[float]#
List of joint values for the gripper in the closed position.
- open_joint_values: typing_extensions.List[float]#
List of joint values for the gripper in the open position.
- opening_distance: float#
The opening distance of the gripper.
- fingers_link_names: typing_extensions.Optional[typing_extensions.List[str]] = None#
List of link names for the fingers of the gripper.
- relative_dir: str = ''#
Relative directory of the manipulator description file in the resources directory.
- gripper_cmd_topic: typing_extensions.Optional[str] = None#
Gripper command topic in ROS if it has one.
- gripper_open_cmd_value: typing_extensions.Optional[float] = None#
Grip open command value.
- gripper_close_cmd_value: typing_extensions.Optional[float] = None#
Grip close command value.
- gripper_relative_dir: typing_extensions.Optional[str] = None#
- Relative directory of the gripper description file in the resources directory if it has one and is not part of the
manipulator description file.
- pycram.datastructures.dataclasses.get_point_as_list(point: pycram.datastructures.pose.Point) typing_extensions.List[float]#
Return the point as a list.
- Parameters:
point – The point.
- Returns:
The point as a list
- class pycram.datastructures.dataclasses.Color#
Dataclass for storing rgba_color as an RGBA value. The values are stored as floats between 0 and 1. The default rgba_color is white. ‘A’ stands for the opacity.
- R: float = 1#
- G: float = 1#
- B: float = 1#
- A: float = 1#
- classmethod from_list(color: typing_extensions.List[float])#
Set the rgba_color from a list of RGBA values.
- Parameters:
color – The list of RGBA values
- classmethod from_rgb(rgb: typing_extensions.List[float])#
Set the rgba_color from a list of RGB values.
- Parameters:
rgb – The list of RGB values
- classmethod from_rgba(rgba: typing_extensions.List[float])#
Set the rgba_color from a list of RGBA values.
- Parameters:
rgba – The list of RGBA values
- get_rgba() typing_extensions.List[float]#
Return the rgba_color as a list of RGBA values.
- Returns:
The rgba_color as a list of RGBA values
- get_rgb() typing_extensions.List[float]#
Return the rgba_color as a list of RGB values.
- Returns:
The rgba_color as a list of RGB values
- class pycram.datastructures.dataclasses.Colors#
Bases:
Color,enum.EnumEnum for easy access to some common colors.
- PINK = (1, 0, 1, 1)#
- BLACK = (0, 0, 0, 1)#
- WHITE = (1, 1, 1, 1)#
- RED = (1, 0, 0, 1)#
- GREEN = (0, 1, 0, 1)#
- BLUE = (0, 0, 1, 1)#
- YELLOW = (1, 1, 0, 1)#
- CYAN = (0, 1, 1, 1)#
- MAGENTA = (1, 0, 1, 1)#
- GREY = (0.5, 0.5, 0.5, 1)#
- class pycram.datastructures.dataclasses.CollisionCallbacks#
Dataclass for storing the collision callbacks which are callables that get called when there is a collision or when a collision is no longer there.
- on_collision_cb: typing_extensions.Callable#
- no_collision_cb: typing_extensions.Optional[typing_extensions.Callable] = None#
- class pycram.datastructures.dataclasses.LateralFriction#
Dataclass for storing the information of the lateral friction.
- lateral_friction: float#
- lateral_friction_direction: typing_extensions.List[float]#
- class pycram.datastructures.dataclasses.TextAnnotation#
Dataclass for storing text annotations that can be displayed in the simulation.
- text: str#
- position: typing_extensions.List[float]#
- id: int#
- size: float = 0.1#
- class pycram.datastructures.dataclasses.VirtualJoint#
A virtual (not real) joint that is most likely used for simulation purposes.
- name: str#
- axes: typing_extensions.Optional[pycram.datastructures.pose.Point] = None#
- property type#
- property is_virtual#
- __hash__()#
- class pycram.datastructures.dataclasses.Rotations#
Bases:
typing_extensions.Dict[typing_extensions.Optional[typing_extensions.Union[pycram.datastructures.enums.Grasp,bool]],typing_extensions.List[float]]A dictionary that defines standard quaternions for different grasps and orientations. This is mainly used to automatically calculate all grasp descriptions of a robot gripper for the robot description.
SIDE_ROTATIONS: The quaternions for the different approach directions (front, back, left, right) VERTICAL_ROTATIONS: The quaternions for the different vertical alignments, in case the object requires for example a top grasp HORIZONTAL_ROTATIONS: The quaternions for the different horizontal alignments, in case the gripper needs to roll 90°
- SIDE_ROTATIONS#
- VERTICAL_ROTATIONS#
- HORIZONTAL_ROTATIONS#
- class pycram.datastructures.dataclasses.VirtualMobileBaseJoints#
Dataclass for storing the names, types and axes of the virtual mobile base joints of a mobile robot.
- translation_x: typing_extensions.Optional[VirtualJoint]#
- translation_y: typing_extensions.Optional[VirtualJoint]#
- angular_z: typing_extensions.Optional[VirtualJoint]#
- property names: typing_extensions.List[str]#
Return the names of the virtual mobile base joints.
- get_types() typing_extensions.Dict[str, pycram.datastructures.enums.JointType]#
Return the joint types of the virtual mobile base joints.
- get_axes() typing_extensions.Dict[str, pycram.datastructures.pose.Point]#
Return the axes (i.e. The axis on which the joint moves) of the virtual mobile base joints.
- class pycram.datastructures.dataclasses.MultiverseMetaData#
Meta data for the Multiverse Client, the simulation_name should be non-empty and unique for each simulation
- world_name: str = 'world'#
- simulation_name: str = 'cram'#
- length_unit: str = 'm'#
- angle_unit: str = 'rad'#
- mass_unit: str = 'kg'#
- time_unit: str = 's'#
- handedness: str = 'rhs'#