Ask Your Question
0

Service Header Files Missing Error

asked 2017-09-27 11:25:12 -0600

swordsgnat gravatar image

updated 2017-09-27 14:19:27 -0600

I'm a ROS beginner working on a custom controller for a UUV using Gazebo to simulate the environment and ROS to control everything. I'm using the uuv_simulator package, which does a lot of the heavy lifting for me. Currently, when certain conditions are met (i.e. the sonar reads a certain depth) I want the sub to stop moving. Fortunately, there's a service for that, /rexrov/hold_vehicle. Here's the results of a rosservice info request on it:

$ rosservice info /rexrov/hold_vehicle

Node:
/rexrov/plane_search_standard_controller

URI:
rosrpc://ncopeSub-VirtualBox:35331

Type: uuv_control_msgs/Hold 

Args:

I've read all the tutorials I can find, and I'm working heavily with the services chapter of Jason O'Kane's book, but even when everything's how I think it should be I keep getting this error when I run catkin_make:

/home/catkin_ws/src/plane_search_standard/plane_detect_anomaly.cpp:4:35:
fatal error: uuv_control_msgs/Hold.h:
No such file or directory 

compilation terminated.

plane_search_standard/CMakeFiles/subscribe_and_publish.dir/build.make:62:
recipe for target
'plane_search_standard/CMakeFiles/subscribe_and_publish.dir/plane_detect_anomaly.cpp.o'
failed make[2]: ***
[plane_search_standard/CMakeFiles/subscribe_and_publish.dir/plane_detect_anomaly.cpp.o]
Error 1 CMakeFiles/Makefile2:586:
recipe for target
'plane_search_standard/CMakeFiles/subscribe_and_publish.dir/all'
failed make[1]: ***
[plane_search_standard/CMakeFiles/subscribe_and_publish.dir/all]
Error 2 Makefile:138: recipe for
target 'all' failed make: *** [all]
Error 2 Invoking "make -j6 -l6" failed

Which seems to say that catkin_make doesn't know about the service header file for /rexrov/hold_vehicle. But by everything I've read, it should.

Here're my inclusions in the node file doing the service call:

#include <sstream>
#include <cmath>
#include <uuv_control_msgs/Hold.h>
#include "ros/ros.h"
#include "std_msgs/String.h"
#include "sensor_msgs/LaserScan.h"

Here's the line where I create the service client:

ros::ServiceClient stopSubCaller = n.serviceClient<uuv_control_msgs::Hold>("/rexrov/hold_vehicle");

Here're the lines where I actually call the service:

uuv_control_msgs::Hold::Request req;
uuv_control_msgs::Hold::Response resp;
bool success = stopSubCaller.call(req, resp);

And here's my messy CMakeLists.txt file:

 cmake_minimum_required(VERSION 2.8.3)
project(plane_search_standard)

## Find catkin and any catkin packages
find_package(catkin REQUIRED COMPONENTS rospy roscpp std_msgs sensor_msgs uuv_control_msgs)



catkin_package()

catkin_install_python(PROGRAMS scripts/plane_search_standard_controller.py DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

install(DIRECTORY launch
        DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
PATTERN "*~" EXCLUDE)


include_directories(include ${catkin_INCLUDE_DIRS})



add_executable(subscribe_and_publish plane_detect_anomaly.cpp)
target_link_libraries(subscribe_and_publish ${catkin_LIBRARIES})

add_dependencies(subscribe_and_publish ${catkin_EXPORTED_TARGETS})

Does anyone have an idea as to how I'm going wrong here? I'd really appreciate it - I'm about at my wit's end.


More info:

Running rossrv show uuv_control_msgs/Hold simply returns:

---
bool success

If I put uuv_control_msgs in the find_package command, catkin_make generates four errors like this, just with different endings where the _cpp is:

CMake Error at /home/ncope/catkin_ws/build/uuv_simulator/uuv_control/uuv_control_msgs/cmake/uuv_control_msgs-genmsg.cmake:321 (add_custom_target):
  add_custom_target cannot create target
  "uuv_control_msgs_generate_messages_cpp" because another target with the
  same name already exists.  The existing target is a custom target created
  in source directory "/home/ncope/catkin_ws/src/plane_search_standard".  See
  documentation for policy CMP0002 for more details.
Call Stack (most recent ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-09-27 12:54:04 -0600

jayess gravatar image

updated 2017-09-27 14:31:54 -0600

What happens if you run

rossrv show uuv_control_msgs/Hold

?

If you're getting a complaint that ROS can't find it or something along those lines then you may need to source your setup.bash.

Also, it looks like your CMakeLists.txt is missing uuv_control_msgs from the find_package command. Try adding it there and removing it from generate_messages and see what happens.


Edit:

As @gvdhoorn explained in the comments:

The missing uuv_control_msgs declaration (in the find_package(catkin ..)) is the problem. [...] uuv_control_msgs is only a DEPENDENCIES of your generate_messages(..) if you are actually building any msgs yourself (ie: in your own pkg). Afaict, you're not. You only depend on someone else's messages. In that case, you need to find that dependency when building, which is what the find_package(catkin REQUIRED COMPONENTS .. uuv_control_msgs ..) will do.


Edit 2:

Now, in your package.xml you need to add a dependency on uuv_control_msgs so add the following lines

<build_depend>uuv_control_msgs</build_depend>
<run_depend>uuv_control_msgs</run_depend>

Also, give the tutorials another go as a refresher for you. I still refer to them.

edit flag offensive delete link more

Comments

1

The missing uuv_control_msgs declaration (in the find_package(catkin ..) is the problem.

@swordsgnat: uuv_control_msgs is only a DEPENDENCIES of your generate_messages(..) if you are actually building any msgs yourself (ie: in your own pkg). Afaict, you're not. You only depend ..

gvdhoorn gravatar imagegvdhoorn ( 2017-09-27 13:10:37 -0600 )edit
1

.. on someone else's messages. In that case, you need to find that dependency when building, which is what the find_package(catkin REQUIRED COMPONENTS .. uuv_control_msgs ..) will do.

gvdhoorn gravatar imagegvdhoorn ( 2017-09-27 13:11:19 -0600 )edit

Thanks for the explanation @gvdhoorn. I should have included that.

jayess gravatar imagejayess ( 2017-09-27 13:14:32 -0600 )edit

Hi, thanks for the reply! There wasn't enough space in the comment here so I edited that additional information into the original question at the bottom there.

swordsgnat gravatar imageswordsgnat ( 2017-09-27 13:28:11 -0600 )edit

Just read @gvdhoorn's replies (and thank you for the reply): when I add uuv_control_msgs to the find_package(catkin REQUIRED COMPONENTS..) command, it spits out an error like the one I edited in, claiming that it already has those targets. This persists even when I remove the other packages.

swordsgnat gravatar imageswordsgnat ( 2017-09-27 13:38:18 -0600 )edit

@swordsgnat: Did you remove uuv_control_msgs from generate_messages() after adding it to find_package()? That last error is saying that there's already a package with the name uuv_control_messages . See https://github.com/ros/catkin/issues/477

jayess gravatar imagejayess ( 2017-09-27 13:45:09 -0600 )edit

Yes sir - and that error crops up even if I remove the whole generate_messages() line.

swordsgnat gravatar imageswordsgnat ( 2017-09-27 13:52:23 -0600 )edit
1

@swordsgnat: please update your original question with the contents of both package.xml and your edited CMakeLists.txt. Also: do an rm -rf /home/ncope/catkin_ws/build and rm -rf /home/ncope/catkin_ws/devel. Then try again.

gvdhoorn gravatar imagegvdhoorn ( 2017-09-27 13:55:32 -0600 )edit

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2017-09-27 11:25:12 -0600

Seen: 1,177 times

Last updated: Sep 27 '17