pycram.object_descriptors.generic#
Classes#
A link description of an object. |
|
A class that represents the description of a joint. |
|
A generic description of an object in the environment. This description can be applied to any object. |
Module Contents#
- class pycram.object_descriptors.generic.NamedBoxVisualShape(name: str, color: pycram.datastructures.dataclasses.Color, visual_frame_position: typing_extensions.List[float], half_extents: typing_extensions.List[float])#
Bases:
pycram.datastructures.dataclasses.BoxVisualShape- _name: str#
- property name: str#
- class pycram.object_descriptors.generic.LinkDescription(name: str, visual_frame_position: typing_extensions.List[float], half_extents: typing_extensions.List[float], color: pycram.datastructures.dataclasses.Color = Color())#
Bases:
pycram.description.LinkDescriptionA link description of an object.
- property geometry: typing_extensions.Union[pycram.datastructures.dataclasses.VisualShape, None]#
The geometry type of the collision element of this link.
- property origin: pycram.datastructures.pose.PoseStamped#
- Returns:
the origin of this entity.
- property name: str#
- Returns:
the name of this entity.
- property color: pycram.datastructures.dataclasses.Color#
- class pycram.object_descriptors.generic.JointDescription(parsed_joint_description: typing_extensions.Optional[typing_extensions.Any] = None, is_virtual: bool = False)#
Bases:
pycram.description.JointDescriptionA class that represents the description of a joint.
- property parent: str#
- Abstractmethod:
- Returns:
The name of the parent link of this joint.
- property child: str#
- Abstractmethod:
- Returns:
The name of the child link of this joint.
- property type: pycram.datastructures.enums.JointType#
- Returns:
The type of this joint.
- property axis: pycram.datastructures.pose.Point#
- Returns:
The axis of this joint, for example the rotation axis for a revolute joint.
- property has_limits: bool#
- Returns:
True if the joint has limits, False otherwise.
- property lower_limit: typing_extensions.Union[float, None]#
- Returns:
The lower limit of this joint, or None if the joint has no limits.
- property upper_limit: typing_extensions.Union[float, None]#
- Returns:
The upper limit of this joint, or None if the joint has no limits.
- property parent_link_name: str#
- Abstractmethod:
- property child_link_name: str#
- Abstractmethod:
- property origin: pycram.datastructures.pose.PoseStamped#
- Abstractmethod:
- Returns:
the origin of this entity.
- property name: str#
- Abstractmethod:
- Returns:
the name of this entity.
- class pycram.object_descriptors.generic.ObjectDescription(*args, **kwargs)#
Bases:
pycram.description.ObjectDescriptionA generic description of an object in the environment. This description can be applied to any object. The current use case involves perceiving objects using RoboKudo and spawning them with specified size and color.
- class Link(_id: int, link_description: LinkDescription, obj: pycram.world_concepts.world_object.Object, concept: typing_extensions.Type[pycrap.ontologies.Base] = pycrap.ontologies.Link, parse_name: bool = True)#
Bases:
pycram.description.ObjectDescription.Link,LinkDescriptionA link of an Object in the World.
- class RootLink(obj: pycram.world_concepts.world_object.Object)#
Bases:
pycram.description.ObjectDescription.RootLink,LinkThe root link of an Object in the World. This differs from the normal AbstractLink class in that the pose and 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, is_virtual: typing_extensions.Optional[bool] = False, concept: typing_extensions.Type[pycrap.ontologies.Base] = pycrap.ontologies.Joint)#
Bases:
pycram.description.ObjectDescription.Joint,JointDescriptionRepresent a joint of an Object in the World.
- _links#
- merge_description(other: ObjectDescription, parent_link: str | None = None, child_link: str | None = None, joint_type: pycram.datastructures.enums.JointType = JointType.FIXED, axis: pycram.datastructures.pose.Point | None = None, lower_limit: float | None = None, upper_limit: float | None = None, child_pose_wrt_parent: pycram.datastructures.pose.PoseStamped | None = None, in_place: bool = False, new_description_file: str | None = None) typing_extensions.Union[ObjectDescription, typing_extensions.Self]#
Merge the description of this object with the description of the other object.
- Parameters:
other – The object description to merge with this one.
parent_link – The name of the parent link of the joint connecting the two objects.
child_link – The name of the child link of the joint connecting the two objects.
joint_type – The type of the joint connecting the two objects.
axis – The axis of the joint connecting the two objects.
lower_limit – The lower limit of the joint connecting the two objects.
upper_limit – The upper limit of the joint connecting the two objects.
child_pose_wrt_parent – The pose of the child link with respect to the parent link.
in_place – True if the merge should be done in place, False otherwise.
new_description_file – If given, the new description will be saved to this file, otherwise the new description will be saved in place of the original file.
- Returns:
The merged object description, could be a new object description if in_place is False else self.
- merge_using_bounding_boxes(other: ObjectDescription, child_pose_wrt_parent: pycram.datastructures.pose.PoseStamped | None = None, new_description_file: str | None = None) typing_extensions.Union[ObjectDescription, typing_extensions.Self]#
Merge the current object description with another object description by merging their bounding boxes and creating a URDF description with the new merged bounding box/ mesh.
- Parameters:
other – The other object description to merge with.
child_pose_wrt_parent – The pose of the child object wrt the parent object.
new_description_file – The path to save the new description file.
- Returns:
The new object description.
- merge_using_urdf(other: ObjectDescription, child_pose_wrt_parent: pycram.datastructures.pose.PoseStamped | None = None, new_description_file: str | None = None) typing_extensions.Union[ObjectDescription, typing_extensions.Self]#
Merge the current object description with another object description by creating a URDF description for both objects and merging them.
- Parameters:
other – The other object description to merge with.
child_pose_wrt_parent – The pose of the child object wrt the parent object.
new_description_file – The path to save the new description file.
- Returns:
The new object description.
- create_urdf_from_mesh(mesh: trimesh.Trimesh | None = None, mesh_file_path: str | None = None, path: str | None = None) pycram.object_descriptors.urdf.ObjectDescription#
Create a URDF description from the mesh and the current object description.
- Parameters:
mesh – The mesh to create the URDF description from.
mesh_file_path – The path to the mesh file.
path – The path to save the URDF description.
- Returns:
The URDF object description.
- get_mesh() trimesh.Trimesh#
Get the mesh of the object.
- load_description(path: str) typing_extensions.Any#
Load 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.
- classmethod generate_from_mesh_file(path: str, name: str, save_path: str, color: pycram.datastructures.dataclasses.Color) str#
- Abstractmethod:
Generate a description file from one of the mesh types defined in the mesh_extensions and return the path of the generated file. The generated file will be saved at the given save_path.
- Parameters:
path – The path to the .obj file.
name – The name of the object.
save_path – The path to save the generated description file.
color – The color of the object.
- classmethod generate_from_description_file(path: str, save_path: str, make_mesh_paths_absolute: bool = True) str#
- Abstractmethod:
Preprocess the given file and return the preprocessed description string. The preprocessed description will be saved at the given save_path.
- Parameters:
path – The path of the file to preprocess.
save_path – The path to save the preprocessed description file.
make_mesh_paths_absolute – Whether to make the mesh paths absolute.
- classmethod generate_from_parameter_server(name: str, save_path: str) str#
- Abstractmethod:
Preprocess the description from the ROS parameter server and return the preprocessed description string. The preprocessed description will be saved at the given save_path.
- Parameters:
name – The name of the description on the parameter server.
save_path – The path to save the preprocessed description file.
- property parent_map: typing_extensions.Dict[str, Tuple[str, str]]#
- Returns:
A dictionary mapping the name of a link to its parent joint and link as a tuple.
- property link_map: typing_extensions.Dict[str, LinkDescription]#
- Returns:
A dictionary mapping the name of a link to its description.
- property joint_map: typing_extensions.Dict[str, JointDescription]#
- Returns:
A dictionary mapping the name of a joint to its description.
- property child_map: typing_extensions.Dict[str, typing_extensions.List[Tuple[str, str]]]#
- Returns:
A dictionary mapping the name of a link to its children which are represented as a tuple of the child joint name and the link name.
- add_joint(name: str, child: str, joint_type: pycram.datastructures.enums.JointType, axis: pycram.datastructures.pose.Point, parent: str | None = None, origin: pycram.datastructures.pose.PoseStamped | None = None, lower_limit: float | None = None, upper_limit: float | None = None, is_virtual: bool | None = False) None#
Add a joint to this object.
- Parameters:
name – The name of the joint.
child – The name of the child link.
joint_type – The type of the joint.
axis – The axis of the joint.
parent – The name of the parent link.
origin – The origin of the joint.
lower_limit – The lower limit of the joint.
upper_limit – The upper limit of the joint.
is_virtual – True if the joint is virtual, False otherwise.
- property shape_data: typing_extensions.List[float]#
- property color: pycram.datastructures.dataclasses.Color#
- property links: typing_extensions.List[LinkDescription]#
- Returns:
A list of links descriptions of this object.
- get_link_by_name(link_name: str) LinkDescription#
- Returns:
The link description with the given name.
- property joints: typing_extensions.List[JointDescription]#
- Returns:
A list of joints descriptions of this object.
- 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.
- abstract get_chain(start_link_name: str, end_link_name: str, joints: bool | None = True, links: bool | None = True, fixed: bool | None = True) typing_extensions.List[str]#
- Returns:
the chain of links from ‘start_link_name’ to ‘end_link_name’.
- static get_file_extension() str#
- Abstractmethod:
- Returns:
The file extension of the description file.
- property origin: pycram.datastructures.pose.PoseStamped#
- Returns:
the origin of this entity.
- property name: str#
- Returns:
the name of this entity.