Karlsruhe Institute of Technology (KIT) Logo

Master Motor Map

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

Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends
MMM::Motion Class Reference

Stores a recorded motion with a corresponding virtual model and real measurements. More...

#include <Motion.h>

Inheritance diagram for MMM::Motion:
[legend]

Public Member Functions

virtual void addSensor (SensorPtr sensor, float delta=0.0f, bool checkModel=true)
 
void appendMotion (simox::xml::RapidXMLWrapperNodePtr root, const std::filesystem::path &path=std::string())
 
void attach (MotionObserver *obs)
 
MotionPtr clone (bool cloneSensors=true, const std::string &newName=std::string()) const
 
simox::xml::RapidXMLWrapperNodePtr createMotionRoot ()
 
void detach (MotionObserver *obs)
 
bool eraseSensorIfEqual (Sensor &sensor)
 
int eraseSensors (const std::string &type)
 
void extendKinematic ()
 Extend kinematic and model pose sensors containing only a single measurement.
 
std::vector< std::string > getActuatedJointNames ()
 
std::map< std::string, std::vector< std::string > > getActuatedJointNamesBySensorName ()
 
std::map< std::string, SensorMeasurementPtr > getAllMeasurementsForTimeStep (float timestep) const
 Returns a map of the motion's sensor names pointing to their sensor measurement at the given timestep (if present).
 
float getCommonMaxTimestep (const std::set< std::string > &ignoreSensorNames=std::set< std::string >()) const
 Returns the common maximum timestep of all sensors' measurements. If no timesteps are found, returns 0.0f.
 
float getCommonMinTimestep (const std::set< std::string > &ignoreSensorNames=std::set< std::string >()) const
 Returns the common minimum timestep of all sensors' measurements. If no timesteps are found, returns 0.0f.
 
std::map< std::string, float > getJointAngleMap (float timestep)
 
Eigen::VectorXf getJointAngles (float timestep)
 
std::map< std::string, Eigen::VectorXf > getJointAnglesBySensorName (float timestep)
 
float getMaxTimestep () const
 Returns the maximum timestep of all sensors' measurements. If no timesteps are found, returns 0.0f.
 
float getMinTimestep () const
 Returns the minimum timestep of all sensors' measurements. If no timesteps are found, returns 0.0f.
 
ModelPtr getModel (bool processed=true) const
 
ModelPtr getModelCloneWithVisualization (bool processed=true) const
 
ModelPtr getModelCloneWithVisualizationThrow (bool processed=true) const
 
std::string getModelFileName () const
 
std::filesystem::path getModelFilePath () const
 
std::string getModelName () const
 
ModelProcessorPtr getModelProcessor () const
 
ModelPtr getModelThrow (bool processed=true) const
 
MotionType getMotionType () const
 
std::string getName ()
 
std::filesystem::path getOriginFilePath () const
 
std::vector< SensorPtr > getPrioritySortedSensorData () const
 Get Sensors sorted after their xml priority (descending order).
 
bool getReferencePose (Eigen::Matrix4f &referencePose, int &referenceAxis)
 
Eigen::Matrix4f getRootPose (float timestep, bool extend=false)
 
MotionPtr getSegmentMotion (float startTimestep, float endTimestep, bool changeTimestep=false) const
 get a segmented motion with name 'MOTIONNAME_segmented_STARTTIMESTEPf-ENDTIMESTEPf' according to timesteps.
 
MotionPtr getSegmentMotion (float startTimestep, float endTimestep, std::string segmentMotionName, bool changeTimestep=false) const
 get a segmented motion with the given name according to timesteps.
 
SensorPtr getSensor (SensorPtr sensor) const
 Returns a sensor in the motion having the same configuration.
 
SensorPtr getSensorByName (const std::string &name) const
 Returns the sensor with the given name in the sensor data map.
 
template<typename S , typename std::enable_if< std::is_base_of< Sensor, S >::value >::type * = nullptr>
std::shared_ptr< S > getSensorByType () const
 Returns the first sensor with the given sensor type (or nullptr) and cast it to a specific subclass sensor.
 
SensorPtr getSensorByType (const std::string &type) const
 Returns the first sensor with the given sensor type or nullptr.
 
std::map< std::string, SensorPtr > getSensorData () const
 Returns the sensor data as map.
 
SensorgetSensorIfEqual (Sensor &sensor)
 
template<typename S , typename std::enable_if< std::is_base_of< Sensor, S >::value >::type * = nullptr>
std::vector< std::shared_ptr< S > > getSensorsByType () const
 Returns all sensor with the given sensor type and cast them to the specific subclass sensor. Removes nullptr after cast.
 
SensorList getSensorsByType (const std::string &type) const
 Returns all sensor with the given sensor type.
 
std::set< std::string > getSensorTypes () const
 Returns all sensor types contained the motion.
 
std::vector< float > getTimesteps ()
 Returns model pose or motion capture marker timesteps if available.
 
simox::xml::RapidXMLWrapperNodePtr getXML (const std::filesystem::path &path=std::string())
 
bool hasModelProcessor () const
 Returns wether the motion contains a model processor.
 
bool hasSameMaxTimestep () const
 Returns if the sensors in the motion have the same maximum timestep.
 
bool hasSameMinTimestep () const
 Returns if the sensors in the motion have the same minimum timestep.
 
bool hasSensor () const
 Returns true if the motion contains any sensor.
 
bool hasSensor (const std::string &type) const
 Returns true if the motion contains at least one sensor with the given type.
 
void initializeModel (ModelPtr model, float timestep, bool extend=false, bool update=true)
 
void initializeModel (ModelPtr model, float timestep, float delta, bool extend=false, bool update=true)
 
bool isMirrorSupported ()
 
bool isReferenceModelMotion () const
 Returns if the motion is based on the mmm reference model decided by the file name (mmm.xml)
 
bool isSubject () const
 
bool isSynchronized () const
 Returns if the motion is synchronized.
 
bool mirrorMotion (const Eigen::Matrix4f &referencePose, int referenceAxis, bool ignoreNotSupported=false)
 
 Motion (const std::string &name, ModelPtr originalModel, ModelProcessorPtr modelProcessor=nullptr, const std::filesystem::path &originFilePath=std::string(), const std::filesystem::path &modelFilePath=std::string(), MotionType motionType=MotionType::UNKNOWN)
 
 Motion (const std::string &name, ModelPtr originalModel, ModelPtr processedModel, ModelProcessorPtr modelProcessor, const std::filesystem::path &originFilePath=std::string(), const std::filesystem::path &modelFilePath=std::string(), MotionType motionType=MotionType::UNKNOWN)
 
 Motion (const std::string &name, ProcessedModelWrapperPtr model=ProcessedModelWrapperPtr(new ProcessedModelWrapper()), const std::filesystem::path &originFilePath=std::string(), MotionType motionType=MotionType::UNKNOWN)
 
 Motion (MotionPtr motion)
 
bool operator< (MotionPtr m) const
 
bool processModel (ModelProcessorPtr modelProcessor, ModelPtr optionalModel=nullptr)
 
bool replaceSensorIfEqual (SensorPtr sensor)
 
void saveXML (const std::filesystem::path &path, bool indent=true)
 
bool scaleMotion (float targetHeight, bool shiftMotion, ModelPtr optionalModel=nullptr)
 
void setMotionType (const std::string &type)
 
void setMotionType (MotionType type)
 
void setMotionTypeFromModel ()
 
void setMotionTypeFromModelIfUnknown ()
 
void setName (const std::string &name)
 
void shiftMeasurements (float delta)
 
void shiftMotion (const Eigen::Vector3f &positionDelta)
 
void synchronizeSensorMeasurements (float timeFrequency)
 Synchronizes all possible sensormeasurements on a specific time frequency via linear interpolation. Removes all sensors, that are not linear interpolatable.
 
void synchronizeSensorMeasurements (float timeFrequency, float startTimestep, float endTimestep)
 Synchronizes all possible sensormeasurements on a specific time frequency via linear interpolation. Removes all sensors, that are not linear interpolatable.
 
std::string toXML (const std::filesystem::path &path=std::string(), bool indent=true)
 

Static Public Member Functions

static MotionPtr join (MotionPtr motion1, MotionPtr motion2, std::string name=std::string())
 Joins two motions by joining their sensors and returning a corresponding joined Motion.
 

Protected Member Functions

bool addSensor (std::string name, SensorPtr sensor, float delta)
 
std::string createSegmentName (float startTimestep, float endTimestep) const
 
MotionType getMotionTypeFromModel () const
 
bool setProcessedModel (ModelPtr model)
 
virtual void setProcessedModelWrapper (ProcessedModelWrapperPtr modelContainer)
 

Protected Attributes

ProcessedModelWrapperPtr model
 
MotionType motionType
 
std::string name
 
std::filesystem::path originFilePath
 
std::map< std::string, SensorPtr > sensorData
 

Friends

class MotionReaderXML
 

Detailed Description

Stores a recorded motion with a corresponding virtual model and real measurements.

Member Function Documentation

◆ addSensor()

void MMM::Motion::addSensor ( SensorPtr  sensor,
float  delta = 0.0f,
bool  checkModel = true 
)
virtual

Adds a new sensor to the motion. If present the name of the sensor in the motion matches the unique name of the sensor, else the sensor type is set as name. Ascending numbers starting with 2 are added if the motion already contains a sensor matching the sensor type.

Parameters
sensorThe sensor.
deltaTimeshift of the sensor compared to the sensors of the motion.
Exceptions
MMMExceptionif a sensor with the same configuration is already contained or the sensor not matching the model.
Here is the call graph for this function:

◆ clone()

MotionPtr MMM::Motion::clone ( bool  cloneSensors = true,
const std::string &  newName = std::string() 
) const

Adds all information of this class to the given motion object

Here is the caller graph for this function:

◆ getModel()

ModelPtr MMM::Motion::getModel ( bool  processed = true) const

Return the model. If required loads the model from original model file path

Parameters
processedIndicates weather the processed or the original model should be returned (If no modelProcessor is specified, the originalModel is always returned).
Returns
The robot model if no model is specified.
Here is the caller graph for this function:

◆ getModelProcessor()

ModelProcessorPtr MMM::Motion::getModelProcessor ( ) const

Return the ModelProcessor (if specified).

Here is the caller graph for this function:

◆ getOriginFilePath()

std::filesystem::path MMM::Motion::getOriginFilePath ( ) const

Returns origin path when loaded from file.

◆ operator<()

bool MMM::Motion::operator< ( MotionPtr  m) const

Compare motion after MotionType, e.g. subjects before objects

◆ setMotionTypeFromModel()

void MMM::Motion::setMotionTypeFromModel ( )

method to get motion type from model name if not yet specified

◆ shiftMeasurements()

void MMM::Motion::shiftMeasurements ( float  delta)

Only shifts the measurements of this motion. Does not notify other members of MotionRecording about shift.


The documentation for this class was generated from the following files:
KoroiBot Logo WALK-MAN Logo Xperience Logo SecondHands Logo TimeStorm Logo I-SUPPORT Logo
PACO-PLUS Logo SFB-588 Logo SPP1527 Logo