facing error in robot_state_publisher
I am following the tutorials of urdf with robot state publisher:
https://wiki.ros.org/urdf/Tutorials/Using%20urdf%20with%20robot_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
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
)
Asked by charvi on 2019-06-17 06:30:44 UTC
Answers
Just taking a stab here.
According to https://wiki.ros.org/catkin/CMakeLists.txt 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.
Asked by ChuiV on 2019-06-17 09:27:24 UTC
Comments