ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

facing error in robot_state_publisher

asked 2019-06-17 06:30:44 -0500

charvi gravatar image

updated 2019-06-17 06:48:15 -0500

gvdhoorn gravatar image

I am following the tutorials of urdf with robot state publisher:

but after catkin_make ,I am facing the following error:

CMakeFiles/state_publisher.dir/src/state_publisher.cpp.o: In function `main':
state_publisher.cpp:(.text+0x492): undefined reference to `tf::TransformBroadcaster::TransformBroadcaster()'
state_publisher.cpp:(.text+0x7af): undefined reference to `tf::TransformBroadcaster::sendTransform(geometry_msgs::TransformStamped_<std::allocator<void> > const&)'
collect2: error: ld returned 1 exit status
r2d2/CMakeFiles/state_publisher.dir/build.make:113: recipe for target '/home/charvi/ROS_PRACTISE/devel/lib/r2d2/state_publisher' failed
make[2]: *** [/home/charvi/ROS_PRACTISE/devel/lib/r2d2/state_publisher] Error 1
CMakeFiles/Makefile2:1190: recipe for target 'r2d2/CMakeFiles/state_publisher.dir/all' failed
make[1]: *** [r2d2/CMakeFiles/state_publisher.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed

I also did the same changes in CMakeLists.txt as mentioned in the tutorials.

find_package(catkin REQUIRED COMPONENTS

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

  INCLUDE_DIRS include
  CATKIN_DEPENDS roscpp rospy sensor_msgs std_msgs tf
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-06-17 09:27:24 -0500

ChuiV gravatar image

Just taking a stab here.

According to The catkin_package() must be defined before any add_executable() or add_library()

That might be the source of your problem, if it's not, it will be a problem at some point.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2019-06-17 06:30:44 -0500

Seen: 287 times

Last updated: Jun 17 '19