The most convenient way to build a robot model consists in parsing a description file.
Two format are supported.
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);
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);