开发者

Compile Orocos KDL C++ robotics kinematics on g++?

Im interesed on know orocos c++ library then I downloaded the source code from the original web site and compile the library successfully on my kubuntu OS. The files were installed on /usr/local/include as well as /usr/local/lib/ folders. The issues come when start doing the basic kinematic chain example from the web site https://www.orocos.org/kdl/examples.html

I been trying to compile to the most basic code, for example Eigen constructor works but when touch any kdl funcionality the compilation fails.

the last try was just instance a empty chain constructor and this is what the g++ return of compilation error...

/usr/bin/ld: /tmp/ccb58mLs.o: en la función `main':
edgarcpptest.cpp:(.text+0x11a): referencia a `KDL::Chain::Chain()' sin definir
/usr/bin/ld: edgarcpptest.cpp:(.text+0x126): referencia a `KDL::Chain::~Chain()' sin definir
collect2: error: ld returned 1 exit status

This a basic example with a 6 axis kinematic chain

#include <kdl/chain.hpp>
#include <kdl/chainfksolver.hpp>
#include <kdl/frames.hpp>
#include <kdl/frames_io.hpp>
#include <kdl/chainfksolverpos_recursive.hpp>
#include <iostream>
#include <Eigen/Dense>
#include <kdl/joint.hpp>
#include <kdl/segment.hpp>
int main(int argc, char *argv[])
{
    Eigen::MatrixXd a(4,4);
    a(0,0)=12;
    a(1,0)=13;
    a(0,1)=14;
    a(1,1)=15;
    std::cout << a << std::endl;
    Eigen::VectorXd v1(10);
    KDL::Chain chain;
    //chain.addSegment(KDL::Segment(KDL::Joint(KDL::Joint::RotZ),KDL::Frame(KDL::Vector(0.0,0.0,1.20))));
    /*chain.addSegment(KDL::Segment(KDL::Joint(KDL::Joint::RotX),KDL::Frame(KDL::Vector(0.0,0.0,0.480))));*/
    /*chain.addSegment(KDL::Segment(KDL::Joint(KDL::Joint::RotX),KDL::Frame(KDL::Vector(0.0,0.0,0.645))));*/
    /*chain.addSegment(KDL::Segment(KDL::Joint(KDL::Joint::RotZ)));*/
    /*chain.addSegment(KDL::Segment(KDL::Joint(KDL::Joint::RotX),KDL::Frame(KDL::Vector(0.0,0.0,0.5))));*/
    /*chain.addSegment(KDL::Segment(KDL::Joint(KDL::Joint::RotZ)));*/
    
    /*KDL::ChainFkSolverPos_recursive fksolver= KDL::ChainFkSolverPos_recursive(chain);*/
    /*unsigned int nj= chain.getNrOfJoints();*/
    /*std::cout << "Numero de articulaciones:%d" << nj << std::endl;*/
}

this is the command that I executed:

sudo g++ edgarcpptest.cpp -L /usr/local/lib/ -I /usr/local/include/ -I /usr/include/  -o edgartestcpp

and last this is the cmake manifest generate during orocos library installation

/usr/local/share/orocos_kdl/cmake/FindEigen3.cmake
/usr/local/share/orocos_kdl/cmake/orocos_kdl-config.cmake
/usr/local/share/orocos_kdl/cmake/orocos_kdl-config-version.cmake
/usr/local/share/orocos_kdl/cmake/OrocosKDLTargets.cmake
/usr/local/share/orocos_kdl/cmake/OrocosKDLTargets-release.cmake
/usr/local/lib/pkgconfig/orocos-kdl.pc
/usr/local/lib/pkgconfig/orocos_kdl.pc
/usr/local/share/doc/liborocos-kdl/kdl.tag
/usr/local/lib/liborocos-kdl.so.1.5.1
/usr/local/lib/liborocos-kdl.so.1.5
/usr/local/lib/liborocos-kdl.so
/usr/local/include/kdl/articulatedbodyinertia.hpp
/usr/local/include/kdl/chain.hpp
/usr/local/include/kdl/chaindynparam.hpp
/usr/local/include/kdl/chainexternalwrenchestimator.hpp
/usr/local/include/kdl/chainfdsolver.hpp
/usr/local/include/kdl/chainfdsolver_recursive_newton_euler.hpp
/usr/local/include/kdl/chainfksolver.hpp
/usr/local/include/kdl/chainfksolverpos_recursive.hpp
/usr/local/include/kdl/chainfksolvervel_recursive.hpp
/usr/local/include/kdl/chainhdsolver_vereshchagin.hpp
/usr/local/include/kdl/chainidsolver.hpp
/usr/local/include/kdl/chainidsolver_recursive_newton_euler.hpp
/usr/local/include/kdl/chainidsolver_vereshchagin.hpp
/usr/local/include/kdl/chainiksolver.hpp
/usr/local/include/kdl/chainiksolverpos_lma.hpp
/usr/local/include/kdl/chainiksolverpos_nr.hpp
/usr/local/include/kdl/chainiksolverpos_nr_jl.hpp
/usr/local/include/kdl/chainiksolvervel_pinv.hpp
/usr/local/include/kdl/chainiksolvervel_pinv_givens.hpp
/usr/local/include/kdl/chainiksolvervel_pinv_nso.hpp
/usr/local/include/kdl/chainiksolvervel_wdls.hpp
/usr/local/include/kdl/chainjnttojacdotsolver.hpp
/usr/local/include/kdl/chainjnttojacsolver.hpp
/usr/local/include/kdl/frameacc.hpp
/usr/local/include/kdl/frameacc.inl
/usr/local/include/kdl/frameacc_io.hpp
/usr/local/include/kdl/frames.hpp
/usr/local/include/kdl/frames.inl
/usr/local/include/kdl/frames_io.hpp
/usr/local/include/kdl/framevel.hpp
/usr/local/include/kdl/framevel.inl
/usr/local/include/kdl/framevel_io.hpp
/usr/local/include/kdl/jacobian.hpp
/usr/local/include/kdl/jntarray.hpp
/usr/local/include/kdl/jntarrayacc.hpp
/usr/local/include/kdl/jntarrayvel.hpp
/usr/local/include/kdl/jntspaceinertiamatrix.hpp
/usr/local/include/kdl/joint.hpp
/usr/local/include/kdl/kdl.hpp
/usr/local/include/kdl/kinfam.hpp
/usr/local/include/kdl/kinfam_io.hpp
/usr/local/include/kdl/motion.hpp
/usr/local/include/kdl/path.hpp
/usr/local/include/kdl/path_circle.hpp
/usr/local/include/kdl/path_composite.hpp
/usr/local/incl开发者_开发知识库ude/kdl/path_cyclic_closed.hpp
/usr/local/include/kdl/path_line.hpp
/usr/local/include/kdl/path_point.hpp
/usr/local/include/kdl/path_roundedcomposite.hpp
/usr/local/include/kdl/rigidbodyinertia.hpp
/usr/local/include/kdl/rotational_interpolation.hpp
/usr/local/include/kdl/rotational_interpolation_sa.hpp
/usr/local/include/kdl/rotationalinertia.hpp
/usr/local/include/kdl/segment.hpp
/usr/local/include/kdl/solveri.hpp
/usr/local/include/kdl/stiffness.hpp
/usr/local/include/kdl/trajectory.hpp
/usr/local/include/kdl/trajectory_composite.hpp
/usr/local/include/kdl/trajectory_segment.hpp
/usr/local/include/kdl/trajectory_stationary.hpp
/usr/local/include/kdl/tree.hpp
/usr/local/include/kdl/treefksolver.hpp
/usr/local/include/kdl/treefksolverpos_recursive.hpp
/usr/local/include/kdl/treeidsolver.hpp
/usr/local/include/kdl/treeidsolver_recursive_newton_euler.hpp
/usr/local/include/kdl/treeiksolver.hpp
/usr/local/include/kdl/treeiksolverpos_nr_jl.hpp
/usr/local/include/kdl/treeiksolverpos_online.hpp
/usr/local/include/kdl/treeiksolvervel_wdls.hpp
/usr/local/include/kdl/treejnttojacsolver.hpp
/usr/local/include/kdl/velocityprofile.hpp
/usr/local/include/kdl/velocityprofile_dirac.hpp
/usr/local/include/kdl/velocityprofile_rect.hpp
/usr/local/include/kdl/velocityprofile_spline.hpp
/usr/local/include/kdl/velocityprofile_trap.hpp
/usr/local/include/kdl/velocityprofile_traphalf.hpp
/usr/local/include/kdl/config.h
/usr/local/include/kdl/utilities/error.h
/usr/local/include/kdl/utilities/error_stack.h
/usr/local/include/kdl/utilities/hash_combine.h
/usr/local/include/kdl/utilities/kdl-config.h
/usr/local/include/kdl/utilities/ldl_solver_eigen.hpp
/usr/local/include/kdl/utilities/rall1d.h
/usr/local/include/kdl/utilities/rall1d_io.h
/usr/local/include/kdl/utilities/rall2d.h
/usr/local/include/kdl/utilities/rall2d_io.h
/usr/local/include/kdl/utilities/rallNd.h
/usr/local/include/kdl/utilities/scoped_ptr.hpp
/usr/local/include/kdl/utilities/svd_HH.hpp
/usr/local/include/kdl/utilities/svd_eigen_HH.hpp
/usr/local/include/kdl/utilities/svd_eigen_Macie.hpp
/usr/local/include/kdl/utilities/traits.h
/usr/local/include/kdl/utilities/utility.h
/usr/local/include/kdl/utilities/utility_io.h


I answer my shelf...

you must add -lorocos-kdl parameter into the g++ command ended as follow:

sudo g++ edgarcpptest.cpp -L /usr/local/lib/ -I /usr/local/include/ -I /usr/include/ -lorocos-kdl -o edgartestcpp
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜