Ask Your Question
0

cpp message generation failure?

asked 2013-02-27 08:02:20 -0500

Dereck gravatar image

updated 2014-01-28 17:15:27 -0500

ngrennan gravatar image

I'm trying to finish setting up my p2os_driver package that I've converted to groovy & catkin and have hit another speedbump.

cd catkin_ws/src
wstool set p2os_driver --git https://github.com/dawonn/ros-p2os-driver
wstool update
cd catkin_ws
catkin_make

This process works fine on my ubuntu 12.04 machine but not on my raspberry pi. On my rpi I get:

In file included from /home/dereck/cws/src/p2os_driver/src/p2osnode.cc:31:0:
/home/dereck/cws/src/p2os_driver/include/p2os.h:40:26: fatal error: BatteryState.h: No such file or directory

and there are no messages in the catkin_ws/devel/include/p2os_driver directory on the rasPi, but they are there on the ubuntu machine.

In other words, What could cause CPP message headers not to be generated?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2013-03-01 15:01:53 -0500

Dirk Thomas gravatar image

updated 2013-03-01 15:02:14 -0500

catkin_make will automatically build all your CMake target in parallel. In your case you have to tell CMake that it must generate C++ code for the messages (BatteryState.h) before compiling p2osnode.cpp.

You do that by adding a dependency form the executable you are building to the gencpp target which generates the messages headers. Adding something like the following line to your CMakeLists.txt:

add_dependencies(<target_name_of_your_executable_or_library> <msg_pkg_name_containing_the_battery_state>_genpp)

See https://github.com/ros/ros_comm/blob/groovy-devel/clients/roscpp/CMakeLists.txt#L118 for an example

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

Stats

Asked: 2013-02-27 08:02:20 -0500

Seen: 290 times

Last updated: Mar 01 '13