pinocchio  3.6.0
A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
MjcfGraph Struct Reference

The graph which contains all information taken from the mjcf file. More...

#include <pinocchio/parsers/mjcf/mjcf-graph.hpp>

Collaboration diagram for MjcfGraph:

Public Types

typedef std::unordered_map< std::string, MjcfBodyBodyMap_t
 
typedef std::unordered_map< std::string, MjcfClassClassMap_t
 
typedef std::unordered_map< std::string, Eigen::VectorXd > ConfigMap_t
 
typedef std::map< std::string, MjcfEqualityEqualityMap_t
 
typedef std::unordered_map< std::string, MjcfMaterialMaterialMap_t
 
typedef std::unordered_map< std::string, MjcfMeshMeshMap_t
 
typedef boost::property_tree::ptree ptree
 
typedef std::unordered_map< std::string, MjcfTextureTextureMap_t
 
typedef std::vector< std::string > VectorOfStrings
 

Public Member Functions

 MjcfGraph (UrdfVisitor &urdfVisitor, const std::string &modelPath)
 graph constructor More...
 
void addKeyFrame (const Eigen::VectorXd &keyframe, const std::string &keyName)
 Add a keyframe to the model (ie reference configuration) More...
 
void addSoloJoint (const MjcfJoint &jointInfo, const MjcfBody &currentBody, SE3 &bodyInJoint)
 Add a joint to the model. only needed when a body has a solo joint child. More...
 
Inertia convertInertiaFromMjcf (const ptree &el) const
 Convert Inertia of an mjcf element into Inertia model of pinocchio. More...
 
SE3 convertPosition (const ptree &el) const
 Convert pose of an mjcf element into SE3. More...
 
template<typename TypeX , typename TypeY , typename TypeZ , typename TypeUnaligned >
JointModel createJoint (const Eigen::Vector3d &axis)
 Create a joint to add to the joint composite if needed. More...
 
void fillModel (const std::string &nameOfBody)
 Use all the infos that were parsed from the xml file to add a body and joint to the model. More...
 
void fillReferenceConfig (const MjcfBody &currentBody)
 Fill reference configuration for a body and all it's associated dof. More...
 
void parseAsset (const ptree &el)
 Parse all the info from the meta tag asset (mesh, material, texture) More...
 
void parseCompiler (const ptree &el)
 Parse all the info from the compile node into compilerInfo. More...
 
void parseContactInformation (const Model &model, PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR(RigidConstraintModel) &contact_models)
 Parse the equality constraints and add them to the model. More...
 
void parseDefault (ptree &el, const ptree &parent, const std::string &parentTag)
 Go through the default part of the file and get all the class name. Fill the mapOfDefault for later use. More...
 
void parseEquality (const ptree &el)
 Parse all the info from the equality tag. More...
 
void parseGeomTree (const GeometryType &type, GeometryModel &geomModel, ::hpp::fcl::MeshLoaderPtr &meshLoader)
 Fill geometry model with all the info taken from the mjcf model file. More...
 
void parseGraph ()
 parse the mjcf file into a graph
 
void parseGraphFromXML (const std::string &xmlStr)
 parse the mjcf file into a graph More...
 
void parseJointAndBody (const ptree &el, const boost::optional< std::string > &childClass, const std::string &parentName="")
 Go through the main body of the mjcf file "worldbody" to get all the info ready to create the model. More...
 
void parseKeyFrame (const ptree &el)
 Parse all the info from the meta tag keyframe. More...
 
void parseMaterial (const ptree &el)
 Parse all the info from a material node. More...
 
void parseMesh (const ptree &el)
 Parse all the info from a mesh node. More...
 
void parseRootTree ()
 Fill the pinocchio model with all the infos from the graph.
 
void parseTexture (const ptree &el)
 Parse all the info from a texture node. More...
 

Public Attributes

VectorOfStrings bodiesList
 
MjcfCompiler compilerInfo
 
BodyMap_t mapOfBodies
 
ClassMap_t mapOfClasses
 
ConfigMap_t mapOfConfigs
 
EqualityMap_t mapOfEqualities
 
MaterialMap_t mapOfMaterials
 
MeshMap_t mapOfMeshes
 
TextureMap_t mapOfTextures
 
std::string modelName
 
std::string modelPath
 
ptree pt
 
Eigen::VectorXd referenceConfig
 

Detailed Description

The graph which contains all information taken from the mjcf file.

Definition at line 381 of file mjcf-graph.hpp.

Constructor & Destructor Documentation

◆ MjcfGraph()

MjcfGraph ( UrdfVisitor &  urdfVisitor,
const std::string &  modelPath 
)
inline

graph constructor

Parameters
urdfVisitor

Definition at line 432 of file mjcf-graph.hpp.

Member Function Documentation

◆ addKeyFrame()

void addKeyFrame ( const Eigen::VectorXd &  keyframe,
const std::string &  keyName 
)

Add a keyframe to the model (ie reference configuration)

Parameters
keyframeKeyframe to add
keyNameName of the keyframe

◆ addSoloJoint()

void addSoloJoint ( const MjcfJoint jointInfo,
const MjcfBody currentBody,
SE3 &  bodyInJoint 
)

Add a joint to the model. only needed when a body has a solo joint child.

Parameters
jointInfoThe joint to add to the tree
currentBodyThe body associated with the joint
bodyInJointPosition of the body wrt to its joint

◆ convertInertiaFromMjcf()

Inertia convertInertiaFromMjcf ( const ptree &  el) const

Convert Inertia of an mjcf element into Inertia model of pinocchio.

Parameters
elptree element with all the inertial information
Returns
Inertia element in pinocchio

◆ convertPosition()

SE3 convertPosition ( const ptree &  el) const

Convert pose of an mjcf element into SE3.

Parameters
elptree element with all the pose element
Returns
pose in SE3

◆ createJoint()

JointModel createJoint ( const Eigen::Vector3d &  axis)

Create a joint to add to the joint composite if needed.

Template Parameters
TypeXjoint with axis X
TypeYjoint with axis Y
TypeZjoint with axis Z
TypeUnalignedjoint with axis unaligned
Parameters
axisaxis of the joint
Returns
one of the joint with the right axis

◆ fillModel()

void fillModel ( const std::string &  nameOfBody)

Use all the infos that were parsed from the xml file to add a body and joint to the model.

Parameters
nameOfBodyName of the body to add

◆ fillReferenceConfig()

void fillReferenceConfig ( const MjcfBody currentBody)

Fill reference configuration for a body and all it's associated dof.

Parameters
currentBodybody to check

◆ parseAsset()

void parseAsset ( const ptree &  el)

Parse all the info from the meta tag asset (mesh, material, texture)

Parameters
elptree texture node

◆ parseCompiler()

void parseCompiler ( const ptree &  el)

Parse all the info from the compile node into compilerInfo.

Parameters
elptree compile node

◆ parseContactInformation()

void parseContactInformation ( const Model model,
PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR(RigidConstraintModel) &  contact_models 
)

Parse the equality constraints and add them to the model.

Parameters
modelModel to add the constraints to
contact_modelsVector of contact models to add the constraints to

◆ parseDefault()

void parseDefault ( ptree &  el,
const ptree &  parent,
const std::string &  parentTag 
)

Go through the default part of the file and get all the class name. Fill the mapOfDefault for later use.

Parameters
elptree element. Root of the default

◆ parseEquality()

void parseEquality ( const ptree &  el)

Parse all the info from the equality tag.

Parameters
elptree equality node

◆ parseGeomTree()

void parseGeomTree ( const GeometryType &  type,
GeometryModel geomModel,
::hpp::fcl::MeshLoaderPtr &  meshLoader 
)

Fill geometry model with all the info taken from the mjcf model file.

Parameters
typeType of geometry to parse (COLLISION or VISUAL)
geomModelgeometry model to fill
meshLoadermesh loader from hpp::fcl

◆ parseGraphFromXML()

void parseGraphFromXML ( const std::string &  xmlStr)

parse the mjcf file into a graph

Parameters
xmlStrxml file name

◆ parseJointAndBody()

void parseJointAndBody ( const ptree &  el,
const boost::optional< std::string > &  childClass,
const std::string &  parentName = "" 
)

Go through the main body of the mjcf file "worldbody" to get all the info ready to create the model.

Parameters
elroot of the tree
parentNamename of the parentBody in the robot tree

◆ parseKeyFrame()

void parseKeyFrame ( const ptree &  el)

Parse all the info from the meta tag keyframe.

Parameters
elptree keyframe node

◆ parseMaterial()

void parseMaterial ( const ptree &  el)

Parse all the info from a material node.

Parameters
elptree material node

◆ parseMesh()

void parseMesh ( const ptree &  el)

Parse all the info from a mesh node.

Parameters
elptree mesh node

◆ parseTexture()

void parseTexture ( const ptree &  el)

Parse all the info from a texture node.

Parameters
elptree texture node

The documentation for this struct was generated from the following file: