ros_robotics_projects
ros_robotics_projects copied to clipboard
Issue in Chapter 2
I couldn't find centroid.h in face_tracker_pkg and this snippet of code in face_tracker_node.cpp is causing an error. #include <face_tracker_pkg/centroid.h>
Update:
Error at
catkin_make after copying the packages over /home/bla/ros/src/face_tracker_pkg/src/face_tracker_node.cpp:43:39: fatal error: face_tracker_pkg/centroid.h: No such file or directory compilation terminated. face_tracker_pkg/CMakeFiles/face_tracker_node.dir/build.make:62: recipe for target 'face_tracker_pkg/CMakeFiles/face_tracker_node.dir/src/face_tracker_node.cpp.o' failed make[2]: *** [face_tracker_pkg/CMakeFiles/face_tracker_node.dir/src/face_tracker_node.cpp.o] Error 1 CMakeFiles/Makefile2:3020: recipe for target 'face_tracker_pkg/CMakeFiles/face_tracker_node.dir/all' failed make[1]: *** [face_tracker_pkg/CMakeFiles/face_tracker_node.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 1%] Built target dynamic_reconfigure_generate_messages_lisp Makefile:138: recipe for target 'all' failed make: *** [all] Error 2 Invoking "make -j2 -l2" failed Please advice/correct me corrective instructions. Also, it seems copying the packages from your repo makes everything work, instead of creating the packages. Please add a side note that copying is advised.
Hi @eraserpencil
The centroid.h is automatically generated when we do the catkin_make. But some readers are getting this issue. Is the copying of this same package is working? I think the problem will be inside the CMakeLists.txt of the new package, you can just compare two CMakeLists.txt. There is a line for message generation, that is making the problem.
@qboticslabs
Are you advising to remove the message generation line? What do you mean by 'new package'?
Because creating the package as suggested earlier in the chapter had no code, I deleted that package and did the copy.
@eraserpencil No, don't remove that line. Because centroid is a custom message, for generating a header from the custom message, we need that line.
Are you getting the above error for the package that you have copied?
@qboticslabs
Apologies, that was the error from an amateurish attempt at fixing the header file.
Please refer to updated error. Much thanks
I got same problem too. Is there any way to fix it?
@eraserpencil @kungfrank, Sorry for the delay.
I have done a fix in the CMakeLists.txt in the repo, you can check this change
https://github.com/qboticslabs/ros_robotics_projects/commit/86ea76f5bf0b30eac488c72ede49e3ca21980345
In the CMakeLists.txt catkin_package() must be called after add_message_files and generate_messages in project. But after i fixed it ,i got new error as below.
fatal error: face_tracker_pkg/centroid.h: No such file or directory
compilation terminated.
did i miss anything?
@kungfrank @eraserpencil Actually the centroid.h is an autogenerated header, it is working in ROS Kinetic perfectly, If you are not getting, I have included my centroid.h.
Please check the following link
https://github.com/qboticslabs/ros_robotics_projects/tree/master/chapter_2_codes
Problem solve! Thanks for your help.
@eraserpencil Excuse me, i want to know how you solve the problem of "In the CMakeLists.txt catkin_package() must be called after add_message_files and generate_messages in project. But after i fixed it ,i got new error as below."