ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

kdl_parser and catkin

asked 2013-12-01 23:11:02 -0500

tuuzdu gravatar image

In catkin workspace I create package:

catkin_create_pkg leg_kinematics std_msgs rospy roscpp kdl_parser

In leg_kinematics/src/leg_kinematics.cpp:

#include "ros/ros.h"
#include <kdl_parser/kdl_parser.hpp>

int main(int argc, char **argv)
{
    KDL::Tree my_tree;
    ros::NodeHandle node;
    return 0;
}

In CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3)
project(leg_kinematics)

find_package(catkin REQUIRED COMPONENTS
  kdl_parser
  roscpp
  rospy
  std_msgs
)

catkin_package()

include_directories( include ${catkin_INCLUDE_DIRS})
add_executable(leg_kinematics src/leg_kinematics.cpp)
target_link_libraries(leg_kinematics ${catkin_LIBRARIES})

After catkin_make I got error:

CMakeFiles/leg_kinematics.dir/src/leg_kinematics.cpp.o: In function `main':
leg_kinematics.cpp:(.text+0x58): undefined reference to `KDL::Tree::Tree(std::string const&)'
CMakeFiles/leg_kinematics.dir/src/leg_kinematics.cpp.o: In function `KDL::TreeElement::~TreeElement()':
leg_kinematics.cpp:(.text._ZN3KDL11TreeElementD2Ev[_ZN3KDL11TreeElementD5Ev]+0x27): undefined reference to `KDL::Segment::~Segment()'
leg_kinematics.cpp:(.text._ZN3KDL11TreeElementD2Ev[_ZN3KDL11TreeElementD5Ev]+0x38): undefined reference to `KDL::Segment::~Segment()'

Why?)

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2013-12-02 09:23:20 -0500

William gravatar image

Looking at kdl_parser's CMakeLists.txt, it doesn't export its dependency on orocos_kdl, which is where your missing symbol is:

https://github.com/ros/robot_model/blob/hydro-devel/kdl_parser/CMakeLists.txt#L20

On one hand, kdl_parser might should export this as a dependency, but on the other hand, you are using orocos_kdl symbols directly. Therefore you should probably also directly depend on it in your package.xml, find_package it in your CMakeLists.txt, and include the appropriate header in your c++ file, and not rely on the #include <kdl_parser/kdl_parser.hpp> line to bring in the orocos_kdl symbols you need.

If you think this is a bug in kdl_parser, I would open a ticket against it in the robot_model repository:

https://github.com/ros/robot_model/issues

edit flag offensive delete link more
0

answered 2013-12-03 04:42:20 -0500

tuuzdu gravatar image

Hi, William! Yes, I had idea about orocos_kdl. In source file:

#include "ros/ros.h"
#include <kdl/tree.hpp>

int main(int argc, char **argv)
{
    KDL::Tree my_tree;
    ros::NodeHandle node;
        return 0;
}

In CMakeLists.txt of my project:

find_package(catkin REQUIRED COMPONENTS
  orocos_kdl
  roscpp
  rospy
  std_msgs
)

And in log I get:

/usr/bin/ld: cannot find -lorocos-kdl

I check:

rospack list | grep orocos_kdl
orocos_kdl /opt/ros/hydro/share/orocos_kdl

And:

ls /opt/ros/hydro/lib/ | grep orocos
liborocos-kdl.so
liborocos-kdl.so.1.1
liborocos-kdl.so.1.1.99

I don't understand why this is happening...

edit flag offensive delete link more

Comments

1

There was an issue with the previous version of Orocos KDL's CMake config file/pkgconfig file . This is resolved in the latest release (1.2.0) which is waiting in the buildfarm to be made available through packages.ros.org

Ruben Smits gravatar image Ruben Smits  ( 2013-12-03 19:45:09 -0500 )edit

Thanks for help! And how long to wait?)

tuuzdu gravatar image tuuzdu  ( 2013-12-04 04:13:36 -0500 )edit

You can track the version of all packages in the different package repositories (building/shadow fixed/public) on this page: http://www.ros.org/debbuild/hydro.html?q=orocos_kdl There is a similar page for groovy.

William gravatar image William  ( 2013-12-04 06:38:49 -0500 )edit

Thank you Ruben and William!

tuuzdu gravatar image tuuzdu  ( 2013-12-04 07:35:06 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2013-12-01 23:11:02 -0500

Seen: 1,500 times

Last updated: Dec 03 '13