Ask Your Question
0

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:

https://wiki.ros.org/urdf/Tutorials/U...

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
  roscpp
  rospy
  sensor_msgs
  std_msgs
  tf
)

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

catkin_package(
  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
0

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

ChuiV gravatar image

Just taking a stab here.

According to https://wiki.ros.org/catkin/CMakeList... 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

2 followers

Stats

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

Seen: 23 times

Last updated: Jun 17