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

I have a problem in kdl_parser

asked 2018-02-28 06:45:00 -0500

epiphanyan gravatar image

updated 2018-02-28 06:47:29 -0500

gvdhoorn gravatar image

http://wiki.ros.org/kdl_parser/Tutori...

I use Ubuntu 16.04, ROS(kinetic version). I want do do that tutorial. but I think it is not newly-released version. So I have to change some part of those

 <build_depend package="kdl_parser" />   -====> <build_depend>kdl_parser</build_depend>
    ...
  <run_depend package="kdl_parser" />    ====> <exec_depend>kdl_parser</exec_depend>

And I try to do the first one.

  KDL::Tree my_tree;
   if (!kdl_parser::treeFromFile("filename", my_tree)){
      ROS_ERROR("Failed to construct kdl tree");
      return false;
   }

I tried to change the filename, and I tried to do another things(from 2.2 From the parameter server to 2.4From a URDF model ) But, I failed to do catkin_make. Following is the error message.

CMakeFiles/parser.dir/src/parser.cpp.o: In function `main':
parser.cpp:(.text+0x67): undefined reference to `KDL::Tree::Tree(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
parser.cpp:(.text+0xc8): undefined reference to `kdl_parser::treeFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, KDL::Tree&)'
CMakeFiles/parser.dir/src/parser.cpp.o: In function `KDL::TreeElement::~TreeElement()':
parser.cpp:(.text._ZN3KDL11TreeElementD2Ev[_ZN3KDL11TreeElementD5Ev]+0x27): undefined reference to `KDL::Segment::~Segment()'
parser.cpp:(.text._ZN3KDL11TreeElementD2Ev[_ZN3KDL11TreeElementD5Ev]+0x38): undefined reference to `KDL::Segment::~Segment()'
collect2: error: ld returned 1 exit status
testbot_description/CMakeFiles/parser.dir/build.make:120: recipe for target '/home/jeong/catkin_ws/devel/lib/testbot_description/parser' failed
make[2]: *** [/home/jeong/catkin_ws/devel/lib/testbot_description/parser] Error 1
CMakeFiles/Makefile2:13351: recipe for target 'testbot_description/CMakeFiles/parser.dir/all' failed
make[1]: *** [testbot_description/CMakeFiles/parser.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed
edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
2

answered 2019-09-08 16:42:30 -0500

Dharmin B. gravatar image

I was following the same tutorial and had the same problem. Adding std=c++11 did not solve the error for me. The thing that solved my problem was adding kdl_parser to find_package list.

So the CMakeLists.txt should have the following

find_package(catkin REQUIRED COMPONENTS
    roscpp
    kdl_parser
)
edit flag offensive delete link more
0

answered 2018-07-16 20:34:37 -0500

It looks like a linker error specific to c++11, and since ROS Kinetic the kdl_parser has enabled -std=c++11 flags for compilation. Try adding this line to the CMakeLists.txt file in the package you're trying to build your file from:

add_compile_options(-std=c++11)
edit flag offensive delete link more
0

answered 2018-10-30 19:55:51 -0500

KARIM gravatar image

Hi there, I had same problem, later ppl told me, I have cloned and built kdl_parser 'melodic' where as I am using kinetic. So check if you too had similar issue.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2018-02-28 06:45:00 -0500

Seen: 1,118 times

Last updated: Oct 30 '18