myoconverter.xml.joints.CustomJoint
Contains the CustomJoint parser.
@author: Aleksi Ikkala
Module Contents
Classes
This class parses and converts the OpenSim CustomJoint XML element to MuJoCo. |
- class myoconverter.xml.joints.CustomJoint.CustomJoint[source]
Bases:
myoconverter.xml.joints.Joint.JointThis class parses and converts the OpenSim CustomJoint XML element to MuJoCo.
A CustomJoint in OpenSim can represent any type of a joint through 3 translational and 3 rotational degrees of freedom.
- _parse(xml, socket_parent_frame, socket_child_frame, pointer)[source]
This function handles the actual parsing and converting.
The given CustomJoint is parsed into a set of MuJoCo joints (1-6 depending on how many non-zero non-constant joints there are).
- Parameters:
xml – OpenSim CustomJoint XML element
socket_parent_frame – Parent frame socket
socket_child_frame – Child frame socket
pointer – A pointer to the MuJoCo XML file where this joint will be added
- Returns:
A list of MuJoCo XML joints, a list of joint parameters
- Raises:
IndexError: If joint components are parsed in incorrect order
- Raises:
TypeError: If a joint component type is not recognized
- Raises:
RuntimeError: If spline definition cannot be found in the XML element
- Raises:
NotImplementedError: If a joint component depends on two or more Coordinates
- Raises:
NotImplementedError: If two Coordinates have a non-linear mapping
- Raises:
RuntimeError: If a joint component has a non-identity linear mapping to a Coordinate
- Raises:
RuntimeError: If a joint transformation type has not been implemented
- _designate_dof(t, params, coordinate)[source]
Designate an OpenSim Coordinate as a MuJoCo DoF.
Designate a Coordinate as a MuJoCo DoF (if applicable). This means that one of the MuJoCo joints (DoF) will correspond to an OpenSim Coordinate, although in OpenSim one coordinate can parameterize multiple DoFs. We only allow identity or linear mappings for designated DoFs.
- Parameters:
t – OpenSim sub-joint XML element
params – Joint parameters
coordinate – Copy of an OpenSim Coordinate
- Returns:
Boolean indicating whether a Coordinate has been designated.
- Raises:
NotImplementedError if t is not a SimmSpline or LinearFunction, or if the mapping between Coordinate and designated DoF is not linear.
- Raises:
RunTimeWarning if LinearFunction has non-identity coefficients