ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
8

{PKG_NAME}_generate_messages_cpp vs {PKG_NAME}_gencpp

asked 2013-04-17 18:38:54 -0500

dejanpan gravatar image

Hi there, using catkin in groovy I have seen two ways to specify dependencies to build msgs and srvs:

add_dependencies(my_bin {PKG_NAME}_generate_messages_cpp)

and

add_dependencies(my_bin {PKG_NAME}_gencpp)

Which one is correct? None of them though seem to build services that my_bin depends on.

D.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
7

answered 2013-04-18 09:28:30 -0500

William gravatar image

updated 2015-04-15 13:37:13 -0500

Both of those lines are correct for now, but the latter will be deprecated.

The _gencpp is the old style, the _generate_messages_cpp target is the new name (more descriptive).

These targets are created by the generate_messages(DEPENDENCIES ...) CMake macro call. Calling add_dependencies(my_bin ${PKG_NAME}_generate_messages_cpp) just tells CMake that the ${PKG_NAME}_generate_messages_cpp target should be built before the my_bin target. It does not instruct CMake to generate your messages. So, if you are expecting this line to cause your services to be built, then that's incorrect.

See the ROS tutorials about how to get services generated:

http://www.ros.org/wiki/ROS/Tutorials...

edit flag offensive delete link more

Comments

William, the services that needed to be build are in the pkg PKG_NAME I depend on with the above code. And if I understand you correctly then it should be all fine.

dejanpan gravatar image dejanpan  ( 2013-04-19 11:12:08 -0500 )edit

That should ensure that those services are generated before your code is built.

William gravatar image William  ( 2013-04-19 11:13:28 -0500 )edit

As an extra bit of detail for the answer by @William, see https://github.com/ros/catkin/issues/547#issuecomment-29740592 by Dirk Thomas.

gvdhoorn gravatar image gvdhoorn  ( 2013-12-03 20:11:13 -0500 )edit
1

What could be the problem if the only one which works to me is _gencpp? With _generate_message_cpp it does not generate message and action files which I have included correctly...

alextoind gravatar image alextoind  ( 2015-04-15 10:40:35 -0500 )edit
2

I think my post has a typo, it should be _generate_messages_cpp.

William gravatar image William  ( 2015-04-15 13:36:55 -0500 )edit

thanks! It's ok now. (I've copied the wrong one without noticing the typo)

alextoind gravatar image alextoind  ( 2015-04-15 16:01:44 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2013-04-17 18:38:54 -0500

Seen: 3,690 times

Last updated: Apr 15 '15