def get_body_xml_node()

in mujoco_worldgen/util/obj_util.py [0:0]


def get_body_xml_node(name, use_joints=False):
    '''
    Build a body XML dict for use in object models.
        name - name for the body (should be unique in the model, e.g. "geom4")
        joints - if True, add 6 degrees of freedom joints (slide, hinge)
    Returns named XML body node.
    '''
    body = OrderedDict()
    body['@name'] = name
    body['@pos'] = np.zeros(3)

    if use_joints:
        joints = []
        for axis_type in ('slide', 'hinge'):
            for i, axis in enumerate(np.eye(3)):
                joint = OrderedDict()
                joint['@name'] = "%s:%s%d" % (name, axis_type, i)
                joint['@axis'] = axis
                joint['@type'] = axis_type
                joint['@damping'] = 0.01
                joint['@pos'] = np.zeros(3)
                joints.append(joint)
        body['joint'] = joints
    return body