ros_robotics_projects icon indicating copy to clipboard operation
ros_robotics_projects copied to clipboard

Issue in Chapter 2

Open eraserpencil opened this issue 6 years ago • 10 comments

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.

eraserpencil avatar Oct 20 '17 15:10 eraserpencil

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 avatar Oct 20 '17 15:10 qboticslabs

@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 avatar Oct 20 '17 15:10 eraserpencil

@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 avatar Oct 20 '17 15:10 qboticslabs

@qboticslabs

Apologies, that was the error from an amateurish attempt at fixing the header file.

Please refer to updated error. Much thanks

eraserpencil avatar Oct 20 '17 15:10 eraserpencil

I got same problem too. Is there any way to fix it?

kungfrank avatar Nov 15 '17 10:11 kungfrank

@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

qboticslabs avatar Nov 15 '17 13:11 qboticslabs

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 avatar Nov 16 '17 09:11 kungfrank

@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

qboticslabs avatar Nov 17 '17 06:11 qboticslabs

Problem solve! Thanks for your help.

kungfrank avatar Nov 17 '17 09:11 kungfrank

@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."

d9807302 avatar Jan 02 '18 05:01 d9807302