The Legacy MMM data format is an obsolete XML-based format for storing model-based motions.
The format has been revised to provide easier extendability by using a plug-in-structure for motion sensor data (see MMM Data Format). It can still be used and also converted to the new format via MMMLegacyMotionConverter*.
Legacy MMM Motion Data Format
The main tag which encapsulates the MMM related motion data is <MMM> ... </MMM>. Within these tags a motion is addressed via the <Motion name='my name'> ... </Motion> XML structure. Inside a motion, several top level XML tags are available by default which can be extended in order to meet custom demands (see [Legacy] MMM Data Format Extension). The top level motion tags cover <Comments>, <JointOrder>, <Model> and <ModelProcessorConfig> tags.
The <Comments> tag
Custom text can be stored within the comments tag. Therefore the text must be encapsulated by <text> </text> tags.
Here is an example:
<Motion name = 'test'>
<Comments>
<text>First line of text</text>
<text>Second line of text</text>
</Comments>
</Motion>
The <Model> tag
The motion can be optionally linked to an MMM Model. Therefore the filename of the MMM Model can be specified here.
Here is an example:
<Motion name = 'test'>
<Model>
<File>/home/dev/models/Winter.xml</File>
</Model>
</Motion>
The <ModelProcessorConfig> tag
The model can be processed in order to change its parameters (see MMM Model Processor). This tag specifies a model processor and serves configuration paramters for it. The type attribute specifies which model processor has to be used. By using the factory layout, the corresponding model processor is automatically selected while loading the motion. Internally the motion loader uses this processor for processing the input model according to the given paramteres. Note that this tag is optional, i.e. without it the original model will be used for further processing.
Here is an example:
<Motion name = 'test'>
<ModelProcessorConfig type='Winter'>
<Height>1.7</Height>
<Mass>75</Mass>
</ModelProcessorConfig>
</Motion>
The <JointOrder> tag
The joint order is specified with the <JointOrder> tag. The joint order is later used to identify which joints are addressed by the MotionData information.
Here is an example:
<Motion name = 'test'>
<JointOrder>
<joint name='BTx_joint'/>
<joint name='BTy_joint'/>
<joint name='BTz_joint'/>
...
</JointOrder>
</Motion>
The <MotionFrames> tag
The motion of an MMM model is defined with the <MotionFrames> tag by specifying <MotionFrame> tags for discrete timesteps. A basic MotionFrame entry is filled with the following information:
- timestep: The time stamp (given in ms)
- RootPosition: The position of the model's root coordinate system at the given timestep (millimeters).
- RootPositionVelocity: The velocity of the model's root coordinate system at the given timestep (optional).
- RootPositionAcceleration: The acceleration of the model's root coordinate system at the given timestep (optional).
- RootRotation: The orientation of the model's root coordinate system at the given timestep (Roll Pitch Yaw angles).
- RootRotationVelocity: The orientation velocity of the model's root coordinate system at the given timestep (optional).
- RootRotationAcceleration: The orientation acceleration of the model's root coordinate system at the given timestep (optional).
- JointPosition: The joint values for the joint set as defined by the <JointOrder> header (radian).
- JointVelocity: The joint velocities for the joint set as defined by the <JointOrder> header.
- JointAcceleration: The joint accelerations for the joint set as defined by the <JointOrder> header.
Here is an example:
<Motion>
<JointOrder>
...
</JointOrder>
<MotionFrames>
<MotionFrame>
<Timestep>0</Timestep>
<RootPosition>61.6203 -582.555 855.711</RootPosition>
<RootRotation>-0.120688 0.0474702 -0.0781915</RootRotation>
<JointPosition>-0.217267 0.267692 -0.85853 0.718723 -0.795766 0.517872 -0.148897 0 0</JointPosition>
<JointVelocity>0 0 0 0 0 0 0 0 0</JointVelocity>
<JointAcceleration>0 0 0 0 0 0 0 0 0</JointAcceleration>
</MotionFrame>
<MotionFrame>
...
</MotionFrame>
...
</MotionFrames>
</Motion>
Accessing the Legacy MMM Motion Data
The MMMCore library offers several convenient methods to load motion data files. They can be loaded by using the MMM::LegacyMotionReaderXML utility class.
std::vector<std::string> motions = motionReader->getMotionNames("motion.xml");
if (motions.size()>0)
{
MMM::ModelPtr mmmModel = motion->getModel();
std::vector<std::string> jointNames = motion->getJointNames();
MMM::MotionFramePtr motionFrame = motion->getMotionFrame(0);
Eigen::Matrix4f rootPose = motionFrame->getRootPose();
}