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

Define service or action using adapted c++ message

asked 2014-10-21 13:05:58 -0500

Matias gravatar image

updated 2014-10-21 13:06:15 -0500

I've took a class of my existing code and adapted it using this: http://wiki.ros.org/roscpp/Overview/M... It all works correctly. However, I would like to be able to define services and actions having this message as part of their definitions. If I simply write the .srv or .action files and use the name of the adapted type, it is not able to find it.

Is it possible to make the service/action generators to assume that the C++ version of a message already exist and not require a corresponding .msg file?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-10-22 08:45:50 -0500

Matias gravatar image

I wanted to add another way of solving this problem which I found out, by defining services using adapted types, as it is done for adapting types for messages, which avoids requiring the message generator. A brief explanation is here: http://docs.ros.org/hydro/api/roscpp_...

edit flag offensive delete link more
1

answered 2014-10-21 13:53:13 -0500

ahendrix gravatar image

No; you cannot use a custom serialized type within the ROS message/service/action language.

The reason that this is not possible is that the code generator has to be able to generate code for multiple languages including C++ , Python, Lisp, and others.

What you can do is to have a series of matching msg/srv/action files and C++ classes that serialize to the same format.

The example you link to serializes the same as a geometry_msgs/Vector3, for example, and this preserves its interoperability with Python and the other languages that are supported by ROS.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-10-21 13:05:58 -0500

Seen: 265 times

Last updated: Oct 22 '14