Karlsruhe Institute of Technology (KIT) Logo

Master Motor Map

Whole-body human reference model and tools for unifying representations of whole-body human motion

MMM Motion Tools

Overview of important available methods in the MMMCore for motion manipulation.

Read motions

The MMM::MotionReaderXML is used to read motions in the MMM dataformat. If the xml is not matching the MMM dataformat a corresponding exception is thrown.

Here is an example of reading multiple motions from a file:

std::string filePath = ... // path to <i>motion.xml</i>
std::vector<std::string> sensorPluginPaths = ... // additional sensor plugin folders ("MMMCore/build/sensorPluginLibs" is already included!)
MMM::MotionReaderXMLPtr motionReader(new MMM::MotionReaderXML(sensorPluginPaths));
MMM::MotionList motions;
try {
motions = motionReader->loadAllMotions(filePath);
catch (MMM::Exception::MMMCoreException &e) {
std::cout << e.what << std::endl; // error reading xml

Write motions

The MMM::MotionWriterXML is used to write motions in the MMM dataformat.

Here is an example of writing multiple motions:

std::string filePath = ... // filePath for saving the motion, e.g. motion.xml
MMM::MotionList motions = ... // vector of motion pointers
MMM::MotionWriterXMLPtr motionWriter(new MMM::MotionWriterXML());
motionWriter->writeMotion(motions, filePath);

Segment motions

The method MMM::Motion::getSegmentMotion can be used to create a new motion in a specific time intervall from an already existing motion.

Join motions

The method MMM::Motion::join can be used to join a motion with another motion's sensors. In this process sensors with the same configurations are also joined (see MMM::Sensor::join), others are just attached. Joining sensors with different measurements at the same specific timestep will result into an error returning a nullptr instead of a joined motion.

Synchronize sensor data

Adding new sensors to a motion can be difficult, because the recorded sensor data does not need to be synchronised. If the time difference of a motions' sensors is known the method MMM::Motion::addSensor has the possibility to synchronize the exisiting sensors in the motion and the newly added sensor by shifting their timesteps accordingly, see method MMM::Sensor::shiftMeasurements.

Synchronize sensor

Having multiple different sensors and sensor types in a motion, these existing sensors do not need to specifiy their measurements on the same timestep or even a specific intervall. For example an IMU sensor can have measurements at timestep 0.0, 0.02, 0.06 and 0.1, while an kinematic sensor has his timesteps at 0.0, 0.05 and 0.1. Using the method MMM::Motion::synchronizeSensorMeasurements all these timesteps are interpolated (if possible) on a specific given time intervall. Given the intervall of 0.05 seconds the IMU sensor measurement will be interpolated, that the IMU sensor itself will contain measurements at timestep 0.0, 0.05 and 0.1. This is needed to import a motion into the robot editor.

Access not available sensor data

Sensors contain seansor measurement data at specific timesteps. Therefore two different approaches getting not available sensor measurement data are implemented, see methods MMM::Sensor::getMeasurement:

KoroiBot Logo WALK-MAN Logo Xperience Logo SecondHands Logo TimeStorm Logo I-SUPPORT Logo
PACO-PLUS Logo SFB-588 Logo SPP1527 Logo