simple_writer¶
Submodules¶
Classes¶
- class brom_drake.file_manipulation.urdf.simple_writer.inertia_definition.InertiaDefinition(ixx: float = 1.0, ixy: float = 0.0, ixz: float = 0.0, iyy: float = 1.0, iyz: float = 0.0, izz: float = 1.0)[source]¶
Description
A dataclass that defines the inertia of a simple shape.
This is defined to match the URDF specifications for inertia.
Attributes
- ixx: float
The xx component of the inertia tensor.
- ixy: float
The xy component of the inertia tensor.
- ixz: float
The xz component of the inertia tensor.
- iyy: float
The yy component of the inertia tensor.
- iyz: float
The yz component of the inertia tensor.
- izz: float
The zz component of the inertia tensor.
- class brom_drake.file_manipulation.urdf.simple_writer.urdf_definition.SimpleShapeURDFDefinition(name: str, shape: ShapeDefinition, color: ndarray = None, create_collision: bool = True, mass: float = 1.0, inertia: InertiaDefinition = None, pose: RigidTransform = RigidTransform(R=RotationMatrix([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]), p=[0.0, 0.0, 0.0]), mu_static: float = 0.7, mu_dynamic: float = 0.4, is_hydroelastic: bool = True)[source]¶
Description
A simple shape along with the optional and required options to fully specifiy it in a URDF.
Attributes
- name: str
The name of the shape.
- shape: ShapeDefinition
The shape definition for the shape.
- color: np.ndarray, optional
The RGBA color of the shape.
- create_collision: bool, optional
Whether to create the collision elements of the urdf.
- mass: float, optional
The mass of the shape. Defaults to 1.0.
- inertia: InertiaDefinition, optional
The inertia of the shape. If not specified, a default inertia will be used.
- pose: RigidTransform, optional
The pose of the shape. Defaults to identity.
- mu_static: float, optional
The static friction coefficient of the shape. Defaults to 0.7.
- mu_dynamic: float, optional
The dynamic friction coefficient of the shape. Defaults to 0.4.
- is_hydroelastic: bool, optional
Whether to use hydroelastic collision for the shape. Defaults to True.
- add_collision_elements_to(link_elt: Element)[source]¶
Description
Add the collision elements to the link element.
Parameters
- link_elt: xml.etree.ElementTree.Element
The ET.Element object for the link.
Returns Nothing, but modifies the link_elt in place.
- add_inertial_elements_to(link_elt: Element)[source]¶
Description
Add the inertial elements to the link element.
Parameters
- link_elt: xml.etree.ElementTree.Element
The ET.Element object for the link.
Returns
Nothing, but modifies the link_elt in place.
- add_origin_element_to(target_element: Element)[source]¶
Description
Add the origin element to the target element.
Parameters
- target_element: xml.etree.ElementTree.Element
The ET.Element object to which the origin element will be added.
Returns Nothing, but modifies the target_element in place.
- add_proximity_properties_to(collision_elt: Element)[source]¶
Description
Add the proximity properties to the collision element.
Parameters
- collision_elt: xml.etree.ElementTree.Element
The ET.Element object for the collision object.
Returns
Nothing, but modifies the collision_elt in place.
- add_visual_elements_to(link_elt: Element)[source]¶
Description
Add the visual elements to the link element.
Parameters
- link_elt: xml.etree.ElementTree.Element
The ET.Element object for the link.
Returns
Nothing, but modifies the link_elt in place.
- as_urdf() Element[source]¶
Description
Create the URDF for the simple shape using python’s built-in xml library.
Returns
- xml.etree.ElementTree.Element
The root element of the desired URDF.
- property base_link_name: str¶
Description
The name of the base link.
Returns
- str
The name of the base link.
- class brom_drake.file_manipulation.urdf.simple_writer.urdf_element_creator.URDFElementCreator[source]¶
A class to create URDF elements quickly and easily.
- static create_collision_element(name: str, pose_ParentMesh: None | ndarray | RigidTransform = None, mesh_file_path: str | None = None, mesh_scale: ndarray = array([1., 1., 1.])) Element[source]¶
Create a collision element for the URDF.
Parameters¶
- name: str
The name of the collision element.
- pose_ParentMesh: Union[None, np.ndarray, RigidTransform], optional
The pose of the parent mesh in the collision element. If None, a default RigidTransform is used. If provided as a numpy array, it should be a 7-element array representing position and quaternion. (Specifically, the first 3 elements are the position, and the last 4 elements are the quaternion [x,y,z,w].)
Returns¶
- ET.Element
The created collision element.
- static create_geometry_element(mesh_file_path: str = None, definition: ShapeDefinition = None, mesh_scale: ndarray = array([1., 1., 1.])) Element[source]¶
Create a geometry element for the URDF.
Parameters¶
- mesh_file_path: Path, optional
The path to the mesh file. If provided, a mesh sub-element will be created.
- definition: ShapeDefinition, optional
The dimensions of the geometry. Required for box and cylinder types.
Returns¶
- ET.Element
The created geometry element.
Functions¶
(None found)
Variables¶
- brom_drake.file_manipulation.urdf.simple_writer.urdf_definition.DEFAULT_BROM_MODELS_DIR = './brom/models'¶
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.