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

Revision history [back]

click to hide/show revision 1
initial version

I'm not sure if sending an adapted type as a service is part of your problem or if you solved it, but I just did in my case. I managed to call/receive services using C++ types with a similar (undocumented) strategy as for messages. You should define a class for the service itself (eg. ExampleService) and the corresponding request/response classes (ExampleService::Response/Request). The Request/Response classes must have message_traits as per ROS's tutorial (note: use the same MD5SUM por both). Then, the final step is to provide the same traits (MD5Sum and DataType) but for the ExampleService class itself, but under the service_traits namespace. Finally, you need to provide serialization methods for the Request/Response classes.

With this, you can simply use the classes in services as per usual.