pycram.robot_description

Module Contents

Classes

ChainDescription

This class saves a kinematic chain by saving the links and the joints.

GripperDescription

This class represents a gripper of a robot. It allows to specify more parameters

InteractionDescription

This class allows to put on the end of an chain another link, which is saved

ManipulatorDescription

This class allows with the given interaction description to include a gripper

CameraDescription

This class represents a camera by saving the camera link from the URDF and other

GraspingDescription

This class represents all possible grasp a robot can perform and the grasps

RobotDescription

The RobotDescription as an abstract class which needs to be inherited from to implement

Attributes

logger

pycram.robot_description.logger
class pycram.robot_description.ChainDescription(name: str, joints: typing_extensions.List[str], links: typing_extensions.List[str], base_link: typing_extensions.Optional[str] = None, static_joint_states: typing_extensions.Optional[typing_extensions.Dict[str, typing_extensions.List[float]]] = None)

This class saves a kinematic chain by saving the links and the joints. Moreover, this class offers to set a base_link and specify static joint states (e. g. the “park” state of the right arm).

chain of links: link1 <-> joint1 <-> link2 <-> joint2 <-> … <-> link6

Parameters:
  • name – str

  • joints – list[str]

  • links – list[str]

  • static_joint_states – dict[str: list[float]]

add_static_joint_chains(static_joint_states: typing_extensions.Dict[str, typing_extensions.List[float]]) None

This function adds static joints chains, which are given in a dictionary.

Parameters:

static_joint_states (dict[str: list[float]]) – Static joint chains, where keys hold the configuration name and values hold a list of floats/joint configurations.

add_static_joint_chain(configuration: str, static_joint_states: typing_extensions.List[float]) typing_extensions.Union[None, bool]

This function adds one static joints chain with the given configuration name.

Parameters:
  • configuration (str) – Configuration name of the static joint configuration

  • static_joint_states (list[float]) – List of floats/joint configurations

get_static_joint_chain(configuration: str) typing_extensions.Union[None, typing_extensions.Dict[str, float]]

Gets a static joint chain as dictionary of its joint names and values.

Parameters:

configuration (str) – Name of the configuration

Returns:

dict[str: float]

class pycram.robot_description.GripperDescription(name: str, gripper_links: typing_extensions.Optional[typing_extensions.List[str]] = None, gripper_joints: typing_extensions.Optional[typing_extensions.List[str]] = None, static_gripper_joint_states: typing_extensions.Optional[typing_extensions.Dict[str, typing_extensions.List[float]]] = None, gripper_meter_to_jnt_multiplier: typing_extensions.Optional[float] = 1.0, gripper_minimal_position: typing_extensions.Optional[float] = 0.0, gripper_convergence_delta: typing_extensions.Optional[float] = 0.001)

Bases: ChainDescription

This class represents a gripper of a robot. It allows to specify more parameters for the robots gripper and set static gripper configurations (since it inherits from ChainDescription).

class pycram.robot_description.InteractionDescription(chain_description: ChainDescription, eef_link: str)

Bases: ChainDescription

This class allows to put on the end of an chain another link, which is saved as an end effector. Therefore, chains can be defined which specify the interaction frame for the robot. An example could be a storage place for grasped objects on the robot.

chain of links: chain_description <-> eef_link

Parameters:
  • name – str

  • joints – list[str]

  • links – list[str]

  • static_joint_states – dict[str: list[float]]

class pycram.robot_description.ManipulatorDescription(interaction_description: InteractionDescription, tool_frame: str = None, gripper_description: GripperDescription = None)

Bases: InteractionDescription

This class allows with the given interaction description to include a gripper description which is placed between the last link of the interaction description and the rest of it. Independently of that a tool frame can be saved, which allows to use objects to manipulate the environment:

                                                                   |--> (tool_frame)
chain of links: interaction_description <-> (gripper_description) -|
                                                                   |--> eef_link
Parameters:
  • name – str

  • joints – list[str]

  • links – list[str]

  • static_joint_states – dict[str: list[float]]

class pycram.robot_description.CameraDescription(frame: str, minimal_height=0.0, maximal_height=0.0, vertical_angle=0.0, horizontal_angle=0.0, other_params: typing_extensions.Optional[typing_extensions.Dict[str, float]] = None)

This class represents a camera by saving the camera link from the URDF and other parameters specifically for that camera.

class pycram.robot_description.GraspingDescription(grasp_dir: typing_extensions.Optional[typing_extensions.Dict] = None)

This class represents all possible grasp a robot can perform and the grasps the robot can perform for a specific object.

add_grasp(grasp: str, orientation: typing_extensions.List[float]) None

Adds a Grasping side like “top”, “left”, “front” and the corresponding orientation of the gripper to this description.

Parameters:
  • grasp – The type of grasp like “top” or “left”

  • orientation – The orientation the Gripper has to have in order to achive this grasp. In world coordinate frame

add_graspings_for_object(grasps: typing_extensions.List[str], object: world.Object) None

Adds all possible Grasps for the specified object. The used grasps have to be registered beforehand via the add_grasp method.

Parameters:
  • grasps – A list of all graps for this object.

  • object – The object for which the grasps should be specified

get_all_grasps() typing_extensions.List[str]
get_orientation_for_grasp(grasp: str) typing_extensions.List[float]
get_grasps_for_object(object: world.Object) typing_extensions.List[str]
class pycram.robot_description.RobotDescription(name: str, base_frame: str, base_link: str, torso_link: typing_extensions.Optional[str] = None, torso_joint: typing_extensions.Optional[str] = None, odom_frame: typing_extensions.Optional[str] = None, odom_joints: typing_extensions.Optional[typing_extensions.List[str]] = None)

The RobotDescription as an abstract class which needs to be inherited from to implement a robot description for specific object. It implements different functions to add and get chains of different objects types which inherit of the class ChainDescription. Moreover, it allows to model the robot with its odom_frame, base_frame, base_link and torso links and joints. Different cameras can be added and static transforms and poses can be added too.

Initialises the robot description with the given frames.

_safely_access_chains(chain_name: str, verbose: typing_extensions.Optional[bool] = True) typing_extensions.Union[None, ChainDescription]

This function returns the chain_description of the name chain_name or None, if there exists no chain description with the name chain_name.

_get_chain_description(chain_name: str, description_type: typing_extensions.Optional[typing_extensions.Type[ChainDescription]] = ChainDescription, is_same_description_type: typing_extensions.Optional[bool] = True) typing_extensions.Union[None, typing_extensions.Type[ChainDescription]]

This function checks if there is a chain saved in self.chains with the chain name chain_name. Moreover, if is_same_description_type is True it will be checked if the found chain is of the given object class description_type. If is_same_description_type is False, it will be just checked if the found chain is a subclass of description_type.

Returns:

subclass of ChainDescription or None

get_tool_frame(manipulator_name: str) typing_extensions.Union[None, str]

Returns the tool frame of the manipulator description with the name manipulator name.

Returns:

str

get_static_joint_chain(chain_name: str, configuration: str) typing_extensions.Union[None, typing_extensions.Dict[str, float]]

Returns the static joint chain given the chains name chain_name and the configurations name configuration.

Returns:

dict[str: float]

get_static_tf(base_link: str, target_link: str)
get_static_pose(frame: str)
add_chain(name: str, chain_description: ChainDescription) typing_extensions.Union[None, bool]

This functions adds the chain description chain_description with the name name and overwrites the existing chain description of name name, if it already exists in self.chains.

add_chains(chains_dict: typing_extensions.Dict[str, ChainDescription]) None

This function calls recursively the self.add_chain function and adds therefore the chain description saved in the values part of the dictionary chains_dict with the names saved in the key part of the dictionary chains_dict.

add_camera(name: str, camera_description: CameraDescription) typing_extensions.Union[None, bool]

This functions adds the camera description camera_description with the name name and overwrites the existing camera description of name name, if it already exists in self.cameras.

add_cameras(cameras_dict: typing_extensions.Dict[str, CameraDescription]) None

This function calls recursively the self.add_camera function and adds therefore the camera description saved in the values part of the dictionary cameras_dict with the names saved in the key part of the dictionary cameras_dict.

get_camera_frame(camera_name: str) typing_extensions.Union[None, str]

Returns the camera frame of the given camera with the name camera_name.

Returns:

str

add_static_joint_chain(chain_name: str, configuration: str, static_joint_states: typing_extensions.List[float]) typing_extensions.Union[None, bool]

This function calls the add_static_joint_chain function on the chain object with the name chain_name. For more information see the add_static_joint_chain in ChainDescription.

Parameters:
  • chain_name – The name of the new static joint chain

  • configuration – The name of the configuration of this joint chain

add_static_joint_chains(chain_name: str, static_joint_states: typing_extensions.Dict[str, typing_extensions.List[float]]) None

This function calls recursively the self.add_static_joint_chain function with the name chain_name and adds therefore the static joint values saved in the values part of the dictionary static_joint_states with the configuration names saved in the key part of the dictionary static_joint_states.

Parameters:

chain_name – The name for the new chain

add_static_gripper_chain(manipulator_name: str, configuration: str, static_joint_states: typing_extensions.Dict[str, typing_extensions.List[float]]) typing_extensions.Union[None, bool]

This function adds a static gripper chain to a gripper description if there exists a manipulator description with the name manipulator_name. The static gripper joint vales in static_joint_states are then saved with the configuration name configuration in the manipulator description object. For more information see the add_static_joint_chain in ChainDescription.

add_static_gripper_chains(manipulator_name: str, static_joint_states: typing_extensions.Dict[str, typing_extensions.List[float]]) None

This function calls recursively the self.add_static_gripper_chain function with the name manipulator_name and adds therefore the static joint values saved in the values part of the dictionary static_joint_states with the configuration names saved in the key part of the dictionary static_joint_states.

get_static_gripper_chain(manipulator_name: str, configuration: str) typing_extensions.Dict[str, float]

Returns the static gripper joint chain given the manipulator name manipulator_name and the configuration name configuration.

For more information see the function get_static_joint_chain in ChainDescription.

Returns:

dict[str: list[float]] or None

get_child(name)

Returns the child of a Joint or Link in the URDF. If ‘name’ is a Joint a Link will be returned and vice versa.

Parameters:

name – The name of the Joint/Link for which the child will be returned.

Returns:

The child Joint/Link

get_parent(name)

Returns the parent of a Joint or Link in the URDF. If ‘name’ is a Joint a Link will be returned and vice versa.

Parameters:

name – The name of the Joint/Link for which the parent will be returned.

Returns:

The parent Joint/Link