myoconverter.xml.path_points.ConditionalPathPoint
Contains the ConditionalPathPoint parser.
@author: Aleksi Ikkala
Module Contents
Classes
This class parses and converts the OpenSim ConditionalPathPoint XML element to MuJoCo. |
- class myoconverter.xml.path_points.ConditionalPathPoint.ConditionalPathPoint[source]
Bases:
myoconverter.xml.parsers.IParserThis class parses and converts the OpenSim ConditionalPathPoint XML element to MuJoCo.
Parsing a ConditionalPathPoint is difficult. We need to ‘anchor’ the conditional path point to a normal path point, and treat it like a moving path point (move from ‘anchor’ to its actual position when the independent coordinate is inside valid range).
We approximate the above movement behaviour with either a step function or a rectangular function. In case of a step function the movement is further approximated with a linear function, and in case of a rectangular function the movement is approximated with a quadratic function.
- parse(xml, tendon, force_name, **kwargs)[source]
This function handles the actual parsing and converting.
- Parameters:
xml – OpenSim ConditionalPathPoint XML element
tendon – MuJoCo tendon/spatial XML element
force_name – Name of the actuator this path point belongs to
kwargs – Optional keyword arguments
- Returns:
None
- _find_previous(children, idx, socket_parent_frame)[source]
Find previous PathPoint.
- Parameters:
children – List of OpenSim path point XML elements
idx – Idx of current path point of interest
socket_parent_frame – Parent frame socket
- Returns:
-1 if no suitable path point is found, otherwise idx of a path point (in children)
- _find_next(children, idx, socket_parent_frame)[source]
Find next PathPoint.
- Parameters:
children – List of OpenSim path point XML elements
idx – Idx of current path point of interest
socket_parent_frame – Parent frame socket
- Returns:
-1 if no suitable path point is found, otherwise idx of a path point (in children)