Loading a model

Introduction

The most convenient way to build a robot model consists in parsing a description file.

Supported formats

Two format are supported.

Format urdf

To load an urdf file in C++ code, copy the following lines:

#include <pinocchio/multibody/model.hpp>
#include <pinocchio/multibody/parser/urdf.hpp>
#include <pinocchio/multibody/parser/utils.hpp>
#include <pinocchio/multibody/joint.hpp>

bool verbose = false;
const std::string filename = "path/to/file/model.urdf";
se3::JointModelFreeflyer rootJoint;
se3::Model model = se3::urdf::buildModel (filename, rootJoint, verbose);
se3::Data data (model);

Format lua

To load an lua file in C++ code, copy the following lines:

#include <pinocchio/multibody/model.hpp>
#include <pinocchio/multibody/parser/lua.hpp>
#include <pinocchio/multibody/parser/utils.hpp>
#include <pinocchio/multibody/joint.hpp>

bool freeflyer = true;
const std::string filename = "path/to/file/model.lua";
se3::Model model = se3::lua::buildModel (filename, freeflyer);
se3::Data data (model);