robopal.commons.xml_splice module

class robopal.commons.xml_splice.XMLSplicer(name: str = 'robot', scene: str = 'default', mount: str | List[str] = None, manipulator: str | List[str] = None, gripper: str | List[str] = None, **kwargs)[源代码]

基类:object

add_body(node: str, **kwargs)[源代码]
add_component_from_xml(xml: str, goal_body: tuple) None[源代码]

For each input xml file, we extract the component we need, and append it into global tree.

参数:
  • xml -- xml file path

  • goal_body -- goal body, a tuple consist of id and name

add_geom(node: str, **kwargs)[源代码]
add_joint(node: str, **kwargs)[源代码]
add_material(name: str, texture: str, texrepeat: str, texuniform: str)[源代码]
add_mesh(name: str, file: str, **kwargs)[源代码]
add_node_from_str(father_node: str, xml_text: str)[源代码]
add_node_from_xml(xml_path: str = None)[源代码]

Add node from xml file. The attached node is the parent node of the new node. :param node: the parent node of the new node :param xml_path: the path of the xml file

add_texture(name: str, type: str, file: str)[源代码]
save_and_load_xml(output_path='/home/docs/checkouts/readthedocs.org/user_builds/robopal/envs/stable/lib/python3.11/site-packages/robopal/commons/../assets')[源代码]

Save xml file and get its path

save_xml(output_path='../assets')[源代码]

Save xml file with identity path

set_node_attrib(node: str, name: str, attrib: dict)[源代码]

Set node attribute. e.g. >>> self.set_node_attrib('body', 'green_block', {'pos': '0.5 0.0 0.46'}) :param node: node name :param attrib: attribute dict

splice_robot(scene=None, mount=None, manipulator=None, gripper=None, **kwargs)[源代码]

Splice the robot with the given scene, mount, manipulator and gripper.

参数:
  • scene -- scene name

  • mount -- mount name

  • manipulator -- manipulator name

  • gripper -- gripper name

  • kwargs

tag_rename(id, node: Element)[源代码]