pycram.object_descriptors.urdf

Module Contents

Classes

LinkDescription

A class that represents a link description of an object.

JointDescription

A class that represents the description of a joint.

ObjectDescription

A class that represents an object description of an object.

class pycram.object_descriptors.urdf.LinkDescription(urdf_description: urdf_parser_py.urdf.Link)

Bases: pycram.description.LinkDescription

A class that represents a link description of an object.

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

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

property origin: typing_extensions.Union[pycram.datastructures.pose.Pose, None]

Returns the origin of this entity.

property name: str

Returns the name of this entity.

property collision: urdf_parser_py.urdf.Collision
static _get_visual_shape(urdf_geometry) typing_extensions.Union[pycram.datastructures.dataclasses.VisualShape, None]

Returns the VisualShape of the given URDF geometry.

class pycram.object_descriptors.urdf.JointDescription(urdf_description: urdf_parser_py.urdf.Joint)

Bases: pycram.description.JointDescription

A class that represents the description of a joint.

property origin: pycram.datastructures.pose.Pose

Returns the origin of this entity.

property name: str

Returns the name of this entity.

property has_limits: bool

Checks if this joint has limits.

Returns:

True if the joint has limits, False otherwise.

property type: pycram.datastructures.enums.JointType

The type of this joint.

Type:

return

property axis: geometry_msgs.msg.Point

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

Type:

return

property lower_limit: typing_extensions.Union[float, None]

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

Type:

return

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

property damping: float

The damping of this joint.

Type:

return

property friction: float

The friction of this joint.

Type:

return

urdf_type_map
class pycram.object_descriptors.urdf.ObjectDescription(path: typing_extensions.Optional[str] = None)

Bases: pycram.description.ObjectDescription

A class that represents an object description of an object.

Parameters:

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

Bases: pycram.description.ObjectDescription.Link, LinkDescription

Represents a link of an Object in the World.

Bases: pycram.description.ObjectDescription.RootLink, Link

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: pycram.description.ObjectDescription.Joint, JointDescription

Represents a joint of an Object in the World.

A list of links descriptions of this object.

Type:

return

property joints: typing_extensions.List[JointDescription]

A list of joints descriptions of this object.

Type:

return

property origin: pycram.datastructures.pose.Pose

Returns the origin of this entity.

property name: str

Returns the name of this entity.

load_description(path) urdf_parser_py.urdf.URDF

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_from_mesh_file(path: str, name: str, color: typing_extensions.Optional[pycram.datastructures.dataclasses.Color] = Color()) str

Generates an URDf file with the given .obj or .stl file as mesh. In addition, the given rgba_color will be used to create a material tag in the URDF.

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

  • name – The name of the object.

  • color – The color of the object.

Returns:

The absolute path of the created file

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.

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.

get_joint_by_name(joint_name: str) JointDescription
Returns:

The joint description with the given name.

get_root() str
Returns:

the name of the root link of this object.

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

correct_urdf_string(urdf_string: str) str

Changes paths for files in the URDF from ROS paths to paths in the file system. Since World (PyBullet legacy) can’t deal with ROS package paths.

Parameters:

urdf_string – The name of the URDf on the parameter server

Returns:

The URDF string with paths in the filesystem instead of ROS packages

static fix_missing_inertial(urdf_string: str) str

Insert inertial tags for every URDF link that has no inertia. This is used to prevent Legacy(PyBullet) from dumping warnings in the terminal

Parameters:

urdf_string – The URDF description as string

Returns:

The new, corrected URDF description as string.

static remove_error_tags(urdf_string: str) str

Removes all tags in the removing_tags list from the URDF since these tags are known to cause errors with the URDF_parser

Parameters:

urdf_string – String of the URDF from which the tags should be removed

Returns:

The URDF string with the tags removed

Removes the attribute ‘type’ from links since this is not parsable by the URDF parser.

Parameters:

urdf_string – The string of the URDF from which the attributes should be removed

Returns:

The URDF string with the attributes removed

static get_file_extension() str
Returns:

The file extension of the URDF file.