pycram.description

Module Contents

Classes

EntityDescription

A class that represents a description of an entity. This can be a link, joint or object description.

LinkDescription

A class that represents a link description of an object.

JointDescription

A class that represents the description of a joint.

ObjectEntity

An abstract base class that represents a physical part/entity of an Object.

Link

Represents a link of an Object in the World.

RootLink

Represents the root link of an Object in the World.

Joint

Represents a joint of an Object in the World.

ObjectDescription

A class that represents the description of an object.

class pycram.description.EntityDescription

Bases: abc.ABC

A class that represents a description of an entity. This can be a link, joint or object description.

abstract property origin: pycram.datastructures.pose.Pose

Returns the origin of this entity.

abstract property name: str

Returns the name of this entity.

class pycram.description.LinkDescription(parsed_link_description: typing_extensions.Any)

Bases: EntityDescription

A class that represents a link description of an object.

abstract property geometry: typing_extensions.Union[pycram.datastructures.dataclasses.VisualShape, None]

Returns the geometry type of the collision element of this link.

class pycram.description.JointDescription(parsed_joint_description: typing_extensions.Any)

Bases: EntityDescription

A class that represents the description of a joint.

abstract property type: pycram.datastructures.enums.JointType

The type of this joint.

Type:

return

abstract property axis: geometry_msgs.msg.Point

The axis of this joint, for example the rotation axis for a revolute joint.

Type:

return

abstract property has_limits: bool

Checks if this joint has limits.

Returns:

True if the joint has limits, False otherwise.

property limits: typing_extensions.Tuple[float, float]

The lower and upper limits of this joint.

Type:

return

abstract property lower_limit: typing_extensions.Union[float, None]

The lower limit of this joint, or None if the joint has no limits.

Type:

return

abstract property upper_limit: typing_extensions.Union[float, None]

The upper limit of this joint, or None if the joint has no limits.

Type:

return

The name of the parent link of this joint.

Type:

return

The name of the child link of this joint.

Type:

return

abstract property damping: float

The damping of this joint.

Type:

return

abstract property friction: float

The friction of this joint.

Type:

return

class pycram.description.ObjectEntity(_id: int, obj: pycram.world_concepts.world_object.Object)

Bases: pycram.world.WorldEntity

An abstract base class that represents a physical part/entity of an Object. This can be a link or a joint of an Object.

abstract property pose: pycram.datastructures.pose.Pose

The pose of this entity relative to the world frame.

Type:

return

property transform: pycram.datastructures.pose.Transform

Returns the transform of this entity.

Returns:

The transform of this entity.

abstract property tf_frame: str

Returns the tf frame of this entity.

Returns:

The tf frame of this entity.

property object_id: int

the id of the object to which this entity belongs.

Type:

return

Bases: ObjectEntity, LinkDescription, abc.ABC

Represents a link of an Object in the World.

property current_state: pycram.datastructures.dataclasses.LinkState
property is_root: bool

Returns whether this link is the root link of the object.

Returns:

True if this link is the root link, False otherwise.

property position: geometry_msgs.msg.Point

The getter for the position of the link relative to the world frame.

Returns:

A Point object containing the position of the link relative to the world frame.

property position_as_list: typing_extensions.List[float]

The getter for the position of the link relative to the world frame as a list.

Returns:

A list containing the position of the link relative to the world frame.

property orientation: geometry_msgs.msg.Quaternion

The getter for the orientation of the link relative to the world frame.

Returns:

A Quaternion object containing the orientation of the link relative to the world frame.

property orientation_as_list: typing_extensions.List[float]

The getter for the orientation of the link relative to the world frame as a list.

Returns:

A list containing the orientation of the link relative to the world frame.

property pose: pycram.datastructures.pose.Pose

The pose of the link relative to the world frame.

Returns:

A Pose object containing the pose of the link relative to the world frame.

property pose_as_list: typing_extensions.List[typing_extensions.List[float]]

The pose of the link relative to the world frame as a list.

Returns:

A list containing the position and orientation of the link relative to the world frame.

property color: pycram.datastructures.dataclasses.Color

The getter for the rgba_color of this link.

Returns:

A Color object containing the rgba_color of this link.

property origin_transform: pycram.datastructures.pose.Transform

The transform from world to origin of entity.

Type:

return

property tf_frame: str

The name of the tf frame of this link.

Adds a fixed constraint between this link and the given link, used to create attachments for example.

Parameters:

child_link – The child link to which a fixed constraint should be added.

Returns:

The unique id of the constraint.

Removes the constraint between this link and the given link.

Parameters:

child_link – The child link of the constraint that should be removed.

update_transform(transform_time: typing_extensions.Optional[rospy.Time] = None) None

Updates the transformation of this link at the given time.

Parameters:

transform_time – The time at which the transformation should be updated.

Returns the transformation from this link to the given link.

Parameters:

link – The link to which the transformation should be returned.

Returns:

A Transform object with the transformation from this link to the given link.

Returns the transformation from the given link to this link.

Parameters:

link – The link from which the transformation should be returned.

Returns:

A Transform object with the transformation from the given link to this link.

Returns the pose of this link with respect to the given link.

Parameters:

link – The link with respect to which the pose should be returned.

Returns:

A Pose object with the pose of this link with respect to the given link.

get_axis_aligned_bounding_box() pycram.datastructures.dataclasses.AxisAlignedBoundingBox

Returns the axis aligned bounding box of this link.

Returns:

An AxisAlignedBoundingBox object with the axis aligned bounding box of this link.

_update_pose() None

Updates the current pose of this link from the world.

get_origin_transform() pycram.datastructures.pose.Transform

Returns the transformation between the link frame and the origin frame of this link.

__eq__(other)

Return self==value.

__copy__()
__hash__()

Return hash(self).

Bases: Link, abc.ABC

Represents the root link of an Object in the World. It differs from the normal AbstractLink class in that the pose ande the tf_frame is the same as that of the object.

property tf_frame: str

Returns the tf frame of the root link, which is the same as the tf frame of the object.

_update_pose() None

Updates the current pose of this link from the world.

__copy__()
class pycram.description.Joint(_id: int, joint_description: JointDescription, obj: pycram.world_concepts.world_object.Object)

Bases: ObjectEntity, JointDescription, abc.ABC

Represents a joint of an Object in the World.

property tf_frame: str

The tf frame of a joint is the tf frame of the child link.

property pose: pycram.datastructures.pose.Pose

Returns the pose of this joint. The pose is the pose of the child link of this joint.

Returns:

The pose of this joint.

Returns the parent link of this joint.

Returns:

The parent link as a AbstractLink object.

Returns the child link of this joint.

Returns:

The child link as a AbstractLink object.

property position: float
property current_state: pycram.datastructures.dataclasses.JointState
_update_position() None

Updates the current position of the joint from the physics simulator.

reset_position(position: float) None
get_object_id() int

Returns the id of the object to which this joint belongs.

Returns:

The integer id of the object to which this joint belongs.

enable_force_torque_sensor() None
disable_force_torque_sensor() None
get_reaction_force_torque() typing_extensions.List[float]
get_applied_motor_torque() float
__copy__()
__eq__(other)

Return self==value.

__hash__()

Return hash(self).

class pycram.description.ObjectDescription(path: typing_extensions.Optional[str] = None)

Bases: EntityDescription

A class that represents the description of an object.

Parameters:

path – The path of the file to update the description data from.

Bases: Link, abc.ABC

Represents a link of an Object in the World.

Bases: RootLink, abc.ABC

Represents the root link of an Object in the World. It differs from the normal AbstractLink class in that the pose ande the tf_frame is the same as that of the object.

class Joint(_id: int, joint_description: JointDescription, obj: pycram.world_concepts.world_object.Object)

Bases: Joint, abc.ABC

Represents a joint of an Object in the World.

property parsed_description: typing_extensions.Any

Return the object parsed from the description file.

A list of links descriptions of this object.

Type:

return

abstract property joints: typing_extensions.List[JointDescription]

A list of joints descriptions of this object.

Type:

return

mesh_extensions: typing_extensions.Tuple[str] = ('.obj', '.stl', '.dae')

The file extensions of the mesh files that can be used to generate a description file.

update_description_from_file(path: str) None

Updates the description of this object from the file at the given path.

Parameters:

path – The path of the file to update from.

abstract load_description(path: str) typing_extensions.Any

Loads the description from the file at the given path.

Parameters:

path – The path to the source file, if only a filename is provided then the resources directories will be searched.

generate_description_from_file(path: str, name: str, extension: str) str

Generates and preprocesses the description from the file at the given path and returns the preprocessed description as a string.

Parameters:
  • path – The path of the file to preprocess.

  • name – The name of the object.

  • extension – The file extension of the file to preprocess.

Returns:

The processed description string.

get_file_name(path_object: pathlib.Path, extension: str, object_name: str) str

Returns the file name of the description file.

Parameters:
  • path_object – The path object of the description file or the mesh file.

  • extension – The file extension of the description file or the mesh file.

  • object_name – The name of the object.

Returns:

The file name of the description file.

abstract classmethod generate_from_mesh_file(path: str, name: str) str

Generates a description file from one of the mesh types defined in the mesh_extensions and returns the path of the generated file.

Parameters:
  • path – The path to the .obj file.

  • name – The name of the object.

Returns:

The path of the generated description file.

abstract classmethod generate_from_description_file(path: str) str

Preprocesses the given file and returns the preprocessed description string.

Parameters:

path – The path of the file to preprocess.

Returns:

The preprocessed description string.

abstract classmethod generate_from_parameter_server(name: str) str

Preprocesses the description from the ROS parameter server and returns the preprocessed description string.

Parameters:

name – The name of the description on the parameter server.

Returns:

The preprocessed description string.

Returns:

The link description with the given name.

abstract get_joint_by_name(joint_name: str) JointDescription
Returns:

The joint description with the given name.

abstract get_root() str
Returns:

the name of the root link of this object.

abstract get_chain(start_link_name: str, end_link_name: str) typing_extensions.List[str]
Returns:

the chain of links from ‘start_link_name’ to ‘end_link_name’.

abstract static get_file_extension() str
Returns:

The file extension of the description file.