ModelExporter class
#include <iDynTree/ModelExporter.h>
Helper class to export a model to the supported textual formats.
Currently the only format supported for export is the URDF format, as it is described in http:/
Only iDynTree::
Furthermore, currently the model exporter only exports a subset of the features supported in iDynTree::
- Sensors
- Joint limits, damping and static friction.
Format documentation
The following format are supported by the exporter.
| Format | Extendend Name | Website | String for filetype argument |
|---|---|---|---|
| URDF | Unified Robot Description Format | http:/ | urdf |
URDF
As the URDF format does not distinguish between frames and links (see https:/fixed joints to the corresponding real URDF links.
Furthermore, it is widespread use in URDF models to never use a real link (with mass) as the root link of a model, mainly due to workaround a bug in official KDL parser used in ROS (see https://github.com/ros/kdl_kdl_parser . This behaviour can be disabled by setting to false the exportFirstBaseLinkAdditionalFrameAsFakeURDFBase attribute of ModelExporterOptions.
Constructor/Destructor
- ModelExporter()
- Constructor.
- ~ModelExporter()
Model exporting and definition methods
This methods are used to export the structure of your model.
- auto exportingOptions() const -> const ModelExporterOptions&
- void setExportingOptions(const ModelExporterOptions& options)
- auto init(const Model& model, const ModelExporterOptions options = ModelExporterOptions()) -> bool
- Specifies the model of the robot to export.
- auto init(const Model& model, const SensorsList& sensors, const ModelExporterOptions options = ModelExporterOptions()) -> bool
- Specifies the model of the robot to export.
- auto model() -> const Model&
- Get the loaded model that will be exported.
- auto sensors() -> const SensorsList&
- Get the loaded sensors that will be exported.
- auto isValid() -> bool
- Return true if the model have been correctly loaded, and can be exported.
- auto exportModelToString(std::string& modelString, const std::string filetype = "urdf") -> bool
- Export the model of the robot to a string.
- auto exportModelToFile(const std::string& filename, const std::string filetype = "urdf") -> bool
- Export the model of the robot to an external file.
Function documentation
bool iDynTree::ModelExporter:: init(const Model& model,
const ModelExporterOptions options = ModelExporterOptions())
Specifies the model of the robot to export.
| Parameters | |
|---|---|
| model in | The used model. |
| options in | The used options. |
| Returns | true if all went well, false otherwise. |
bool iDynTree::ModelExporter:: init(const Model& model,
const SensorsList& sensors,
const ModelExporterOptions options = ModelExporterOptions())
Specifies the model of the robot to export.
| Parameters | |
|---|---|
| model in | The used model. |
| sensors in | The used sensors. |
| options in | The used options. |
| Returns | true if all went well, false otherwise. |
bool iDynTree::ModelExporter:: isValid()
Return true if the model have been correctly loaded, and can be exported.
| Returns | True if the model was loaded correctly. |
|---|
bool iDynTree::ModelExporter:: exportModelToString(std::string& modelString,
const std::string filetype = "urdf")
Export the model of the robot to a string.
| Parameters | |
|---|---|
| modelString | string containg the model of the robot. |
| filetype | type of the file to load, currently supporting only urdf type. |
bool iDynTree::ModelExporter:: exportModelToFile(const std::string& filename,
const std::string filetype = "urdf")
Export the model of the robot to an external file.
| Parameters | |
|---|---|
| filename | path to the file to export. It can be either a relative filename with respect to the current working directory, or an absolute filename. |
| filetype | type of the file to load, currently supporting only urdf type. |