robopal.commons.xml_splice module

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

基类:object

XML Splicer class for splicing the robot with the given scene, mount, manipulator and gripper.

参数:
  • name -- robot name

  • scene -- scene name

  • mount -- mount name

  • manipulator -- manipulator name

  • gripper -- gripper name

  • kwargs -- other arguments

add_all_component_from_xml(xml: str, goal_body: tuple, is_rename_tag=True) 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_body(node: str, **kwargs)[源代码]
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, parent_body_name: str = None)[源代码]

Add node from xml file. The attached node is the parent node of the new node. :param xml_path: the path of the xml file. :param node: the name of the linked body. if set None, will add to the worldbody.

add_texture(name: str, type: str, file: str)[源代码]
get_xml_path()[源代码]

Load xml file

save_xml(xml_name='robot')[源代码]

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