iDynTree::ModelLoader class

Helper class to load a model from a generic format.

Unless the methods for loading a model with an explicit serialization are used, the default joint serialization of the model loaded will be a "normalized" joint serialization based on the default base link, see the iDynTree::createModelWithNormalizedJointNumbering function for more details.

Constructor/Destructor

ModelLoader()
Constructor.
~ModelLoader()

Model loading and definition methods

This methods are used to load the structure of your model.

auto parsingOptions() const -> const ModelParserOptions&
void setParsingOptions(const ModelParserOptions& options)
auto loadModelFromString(const std::string& modelString, const std::string& filetype = "urdf", const std::vector<std::string>& packageDirs = {}) -> bool
Load the model of the robot from a string.
auto loadModelFromFile(const std::string& filename, const std::string& filetype = "urdf", const std::vector<std::string>& packageDirs = {}) -> bool
Load the model of the robot from an external file.
auto loadReducedModelFromFullModel(const Model& fullModel, const std::vector<std::string>& consideredJoints, const std::string filetype = "") -> bool
Load reduced model from another model, specifyng only the desired joints in the model.
auto loadReducedModelFromString(const std::string modelString, const std::vector<std::string>& consideredJoints, const std::string filetype = "", const std::vector<std::string>& packageDirs = {}) -> bool
Load reduced model from string, specifyng only the desired joints in the model.
auto loadReducedModelFromFile(const std::string filename, const std::vector<std::string>& consideredJoints, const std::string filetype = "", const std::vector<std::string>& packageDirs = {}) -> bool
Load reduced model from file, specifyng only the desired joints in the model.
auto loadReducedModelFromFullModel(const Model& fullModel, const std::vector<std::string>& consideredJoints, const std::unordered_map<std::string, double>& removedJointPositions, const std::string filetype = "") -> bool
Load reduced model from another model, specifyng only the desired joints in the model.
auto loadReducedModelFromString(const std::string modelString, const std::vector<std::string>& consideredJoints, const std::unordered_map<std::string, double>& removedJointPositions, const std::string filetype = "", const std::vector<std::string>& packageDirs = {}) -> bool
Load reduced model from string, specifyng only the desired joints in the model.
auto loadReducedModelFromFile(const std::string filename, const std::vector<std::string>& consideredJoints, const std::unordered_map<std::string, double>& removedJointPositions, const std::string filetype = "", const std::vector<std::string>& packageDirs = {}) -> bool
Load reduced model from file, specifyng only the desired joints in the model.
auto model() -> const Model&
Get the loaded model.
auto sensors() -> const SensorsList&
Get the loaded sensors.
auto isValid() -> bool
Return true if the model have been correctly true.

Function documentation

bool iDynTree::ModelLoader::loadModelFromString(const std::string& modelString, const std::string& filetype = "urdf", const std::vector<std::string>& packageDirs = {})

Load the model of the robot from a string.

Parameters
modelString string containg the model of the robot.
filetype type of the file to load, currently supporting only urdf type
packageDirs a vector containing the different directories where to search for model meshes

bool iDynTree::ModelLoader::loadModelFromFile(const std::string& filename, const std::string& filetype = "urdf", const std::vector<std::string>& packageDirs = {})

Load the model of the robot from an external file.

Parameters
filename path to the file to load
filetype type of the file to load, currently supporting only urdf type.
packageDirs a vector containing the different directories where to search for model meshes

bool iDynTree::ModelLoader::loadReducedModelFromFullModel(const Model& fullModel, const std::vector<std::string>& consideredJoints, const std::string filetype = "")

Load reduced model from another model, specifyng only the desired joints in the model.

Parameters
fullModel
consideredJoints in list of joints to consider in the model.
filetype in (optional) explicit definition of the type of the loaded file. Only "urdf" is supported at the moment.
Returns true if all went well (files were correctly loaded and consistent), false otherwise.

All other joints will be considered to be fixed to their default position, and their child links will be lumped together.

bool iDynTree::ModelLoader::loadReducedModelFromString(const std::string modelString, const std::vector<std::string>& consideredJoints, const std::string filetype = "", const std::vector<std::string>& packageDirs = {})

Load reduced model from string, specifyng only the desired joints in the model.

Parameters
modelString in string containg the model of the robot.
consideredJoints in list of joints to consider in the model.
filetype in (optional) explicit definiton of the filetype to load. Only "urdf" is supported at the moment.
packageDirs in (optional) a vector containing the different directories where to search for model meshes
Returns true if all went well (files were correctly loaded and consistent), false otherwise.

All other joints will be considered to be fixed to their default position, and their child links will be lumped together.

bool iDynTree::ModelLoader::loadReducedModelFromFile(const std::string filename, const std::vector<std::string>& consideredJoints, const std::string filetype = "", const std::vector<std::string>& packageDirs = {})

Load reduced model from file, specifyng only the desired joints in the model.

Parameters
filename in path to the file to load.
consideredJoints in list of joints to consider in the model.
filetype in (optional) explicit definiton of the filetype to load. Only "urdf" is supported at the moment.
packageDirs in (optional) a vector containing the different directories where to search for model meshes
Returns true if all went well (files were correctly loaded and consistent), false otherwise.

All other joints will be considered to be fixed to their default position, and their child links will be lumped together.

bool iDynTree::ModelLoader::loadReducedModelFromFullModel(const Model& fullModel, const std::vector<std::string>& consideredJoints, const std::unordered_map<std::string, double>& removedJointPositions, const std::string filetype = "")

Load reduced model from another model, specifyng only the desired joints in the model.

Parameters
fullModel
consideredJoints in list of joints to consider in the model.
removedJointPositions in map between the dof name of the dof no in consideredJoints and their (fixed) position in the reduced model
filetype in (optional) explicit definition of the type of the loaded file. Only "urdf" is supported at the moment.
Returns true if all went well (files were correctly loaded and consistent), false otherwise.

All other joints will be considered to be fixed to their default position, and their child links will be lumped together.

bool iDynTree::ModelLoader::loadReducedModelFromString(const std::string modelString, const std::vector<std::string>& consideredJoints, const std::unordered_map<std::string, double>& removedJointPositions, const std::string filetype = "", const std::vector<std::string>& packageDirs = {})

Load reduced model from string, specifyng only the desired joints in the model.

Parameters
modelString in string containg the model of the robot.
consideredJoints in list of joints to consider in the model.
removedJointPositions in map between the dof name of the dof no in consideredJoints and their (fixed) position in the reduced model
filetype in (optional) explicit definiton of the filetype to load. Only "urdf" is supported at the moment.
packageDirs in (optional) a vector containing the different directories where to search for model meshes
Returns true if all went well (files were correctly loaded and consistent), false otherwise.

All other joints will be considered to be fixed to their default position, and their child links will be lumped together.

bool iDynTree::ModelLoader::loadReducedModelFromFile(const std::string filename, const std::vector<std::string>& consideredJoints, const std::unordered_map<std::string, double>& removedJointPositions, const std::string filetype = "", const std::vector<std::string>& packageDirs = {})

Load reduced model from file, specifyng only the desired joints in the model.

Parameters
filename in path to the file to load.
consideredJoints in list of joints to consider in the model.
removedJointPositions in map between the dof name of the dof no in consideredJoints and their (fixed) position in the reduced model
filetype in (optional) explicit definiton of the filetype to load. Only "urdf" is supported at the moment.
packageDirs in (optional) a vector containing the different directories where to search for model meshes
Returns true if all went well (files were correctly loaded and consistent), false otherwise.

All other joints will be considered to be fixed to their default position, and their child links will be lumped together.

bool iDynTree::ModelLoader::isValid()

Return true if the model have been correctly true.

Returns True if the model was loaded correctly.