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

Problem with tf tutorial

asked 2019-03-25 11:30:47 -0500

calvintanct gravatar image

updated 2019-03-26 14:44:46 -0500

jayess gravatar image

I followed the tutorial http://wiki.ros.org/tf/Tutorials/Writ...

I encountered this error while doing catkin_make

CMakeFiles/turtle_tf_broadcaster.dir/src/turtle_tf_broadcaster.cpp.o: In function `poseCallback(boost::shared_ptr<turtlesim::Pose_<std::allocator<void> > const> const&)':
turtle_tf_broadcaster.cpp:(.text+0x57): undefined reference to `tf::TransformBroadcaster::TransformBroadcaster()'
turtle_tf_broadcaster.cpp:(.text+0x211): undefined reference to `tf::TransformBroadcaster::sendTransform(tf::StampedTransform const&)'
collect2: error: ld returned 1 exit status
learning_tf/CMakeFiles/turtle_tf_broadcaster.dir/build.make:113: recipe for target '/home/calvin/catkin_ws/devel/lib/learning_tf/turtle_tf_broadcaster' failed
make[2]: *** [/home/calvin/catkin_ws/devel/lib/learning_tf/turtle_tf_broadcaster] Error 1
CMakeFiles/Makefile2:1482: recipe for target 'learning_tf/CMakeFiles/turtle_tf_broadcaster.dir/all' failed
make[1]: *** [learning_tf/CMakeFiles/turtle_tf_broadcaster.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed

I don't think I have problem with the CMakeLists but to just make sure

I put

find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  tf
  turtlesim
)

and

add_executable(turtle_tf_broadcaster src/turtle_tf_broadcaster.cpp)
target_link_libraries(turtle_tf_broadcaster ${catkin_LIBRARIES})

and my package.xml looks has this inside

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>rospy</build_depend>
  <build_depend>tf</build_depend>
  <build_depend>turtlesim</build_depend>
  <build_export_depend>roscpp</build_export_depend>
  <build_export_depend>rospy</build_export_depend>
  <build_export_depend>tf</build_export_depend>
  <build_export_depend>turtlesim</build_export_depend>
  <exec_depend>roscpp</exec_depend>
  <exec_depend>rospy</exec_depend>
  <exec_depend>tf</exec_depend>
  <exec_depend>turtlesim</exec_depend>

Please tell me what is the error with this?

Complete CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(learning_tf)

find_package(catkin REQUIRED COMPONENTS
    roscpp
    rospy
    tf
    turtlesim
)

catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES learning_tf
#  CATKIN_DEPENDS roscpp rospy tf turtlesim
#  DEPENDS system_lib
)

include_directories(
# include
    ${catkin_INCLUDE_DIRS}
)

add_executable(turtle_tf_broadcaster src/turtle_tf_broadcaster.cpp)
target_link_libraries(turtle_tf_broadcaster ${catkin_LIBRARIES})
edit retag flag offensive close merge delete

Comments

1

Please include your full CMakelists file. Its definitely a problem with your CMakeLists. I would suspect you didnt add the packages to the catkin_package() macro

stevemacenski gravatar image stevemacenski  ( 2019-03-25 14:43:13 -0500 )edit

hello, I have included my CMakeLists inside my posts here. There is a lot of comments generated from auto catkin_create_pkg learning_tf tf roscpp rospy turtlesim

calvintanct gravatar image calvintanct  ( 2019-03-26 06:48:42 -0500 )edit

@calvintanct I've removed the majority of the comments from your CMakeLists.txt file as they're not necessary

jayess gravatar image jayess  ( 2019-03-26 14:45:59 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2019-03-26 14:21:06 -0500

Now that you have the full Cmakelists, I'd put $1 that your issue is here

catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES learning_tf
#  CATKIN_DEPENDS roscpp rospy tf turtlesim
#  DEPENDS system_lib
)

You should read that snippet above here and try to understand what this is doing. To get you going, you need to uncomment the CATKIN_DEPENDS and probably the INCLUDE_DIRS lines.

edit flag offensive delete link more

Comments

Since he is using catkin to build his project, CATKIN_DEPENDS should be uncommented, and all additional ros packages should be listed there as well

Dyson sphere gravatar image Dyson sphere  ( 2019-03-26 19:58:19 -0500 )edit

I believe that is what i said above.

stevemacenski gravatar image stevemacenski  ( 2019-03-26 20:05:22 -0500 )edit

Hello, thank you for the answer, I will update again if it is working or not. I used the same ros package with same package.xml and CMakeLists.txt in different installation Ubuntu 16 and Ros Kinetic, and it is working. However it cannot work in my setup Ubuntu 18 Ros Melodic. It seems a bit weird to me

calvintanct gravatar image calvintanct  ( 2019-03-26 22:07:42 -0500 )edit

Is your error solved @calvintanct .Even after uncomment as mentioned in answer ,I am facing the same error.

charvi gravatar image charvi  ( 2019-06-27 02:05:19 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-03-25 11:30:47 -0500

Seen: 872 times

Last updated: Mar 26 '19