myoconverter.xml.converter
This module contains the OpenSim-to-MuJoCo model (XML file) convertion main access points.
You can convert an OpenSim XML model file to MuJoCo by calling the convert() function, or by running this
module.
Example:
in a command shell:
python converter.py /path/to/opensim/model.xml /output/directory/for/mujoco/model/or, in a Python file:
from myoconverter.xml.converter import convert convert(xml_file, output_folder, **kwargs)
Module Contents
Functions
|
Convert an OpenSim XML model file to MuJoCo XMl model file. |
Parse OpenSim BodySet and JointSet. |
|
|
Add OpenSim Body and related `Joint`s to MuJoCo model in a recurrent fashion. |
Parse OpenSim Ground. |
|
Parse OpenSim ConstraintSet. |
|
Parse OpenSim ForceSet. |
|
Parse OpenSim MarkerSet. |
|
Create a keyframe for the MuJoCo model. |
|
Copy credits from the OpenSim model. |
Attributes
ArgumentParser: Parse arguments when running module as a Python script. |
- myoconverter.xml.converter.convert(xml_file, output_folder, **kwargs)[source]
Convert an OpenSim XML model file to MuJoCo XMl model file.
- Parameters:
xml_file – Path to the OpenSim XML model file
output_folder – Path to folder where converted model is saved
kwargs – geometry_folder (str), add_ground_geom (bool), treat_as_normal_path_point (bool)
- Returns:
Path to the MuJoCo XML file
- myoconverter.xml.converter._parse_bodies_and_joints()[source]
Parse OpenSim BodySet and JointSet.
- Returns:
None
- myoconverter.xml.converter._add_bodies_and_joints(parent_name, current_body, root_body=False)[source]
Add OpenSim Body and related `Joint`s to MuJoCo model in a recurrent fashion.
- Parameters:
parent_name – Name of parent Body
current_body – Pointer to current body (XML element) in the MuJoCo XML file
root_body – Boolean to indicate whether current body is the root of the kinematic chain or not
- Returns:
None
- myoconverter.xml.converter._set_keyframe()[source]
Create a keyframe for the MuJoCo model.
The keyframe defines a default pose, where all dependent joints have been properly initialised.
- Returns:
None