How to link Pinocchio using GCC/G++
Pinocchio, which you can install using OpenRobots robotpkg
(sudo apt -y install robotpkg-pinocchio
once you have installed the repository), is split into a few different libraries:
pinocchio_default
, the core library: Link using-lpinocchio
pinocchio_parsers
, for URDF parsing etc.: Link using-lpinocchio_parsers
pinocchio_collision
, for collision detection: Link using-lpinocchio_collision
pinocchio_casadi
, for Casadi nonlinear optimization etc: Link using-lpinocchio_casadi
Often, you will need multiple of those libraries
Additionally, since the OpenRobots libraries are located in /opt/openrobots/lib
, you need to add this path to the linker search path using -L/opt/openrobots/lib
.
Full example command:
g++ -o test test.cpp -lfranka -I/opt/openrobots/include -lpinocchio_default -lpinocchio_parsers -L/opt/openrobots/lib
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow