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

What is the difference between message_generation and genmsg?

asked 2014-04-08 20:02:17 -0500

Luis Ruiz gravatar image


I was following the tutorials and I have a question about the message generation. Once you generate a service with messages you need to modify the package.xml file:


That part is cover, I have no problems there. Now, after that, you need to modify the CMakeLists file, you need to add:

find_package(catkin REQUIRED_COMPONENTS roscpp rospy std_msgs message_generation)
add_dependencies(<node_name> package_name_generate_messages_cpp)

But then, following the tutorials those two lines have different names for the message generation:

find_package(catkin REQUIRED_COMPONENTS roscpp rospy std_msgs genmsg)
add_dependencies(<node_name> package_name_gencpp)

What is the difference between message_generation and genmsg?

In the add_dependencies function, the second function declared is for the messages, but why one is package_name_gencpp and the other package_name_generate_messages_cpp??? I am confused here. So, the name for the message generation dependency can be whatever I want. But where is that defined, how does ROS know the second dependency is for messages???

Tutorial Publisher Subscriber

Tutorial Service Client


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-04-09 07:02:27 -0500

Dirk Thomas gravatar image

The later tutorials (from ) are not up-to-date. (You might fill a ticket for this in the GitHub repository for the maintainer to update the tutorials.) You should only use message_generation and the targets ending in _generate_messages_cpp.

For the target it does not make a difference since they are both identifical. The new one is much more intuitively names then the old abbreviated one (_gencpp).

But for the dependency in your package.xml file it does. genmsg only provides the CMake generator functions, message_generation will actually depend on all default supported generators and makes sure that they are actually present. Otherwise e.g. when building Debians on the farm for a package containing messages it might not have any language specific message generators installed.

edit flag offensive delete link more

Question Tools



Asked: 2014-04-08 20:02:17 -0500

Seen: 1,764 times

Last updated: Apr 09 '14