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

Revision history [back]

Given your service definition,

string request
---
string response

you can access the data using request.request in your case.

I'd strongly encourage you to choose something else as the "request name" in your definition, as everything above the three dashes is actually the request, so if you add another field, this is also in the request, but is called something else. Ideally, it should be clear from the name what this is supposed to be. I'd change it to id in your case, then.

So :

string id
---
string whateveryourresponseactuallyis

and access using request.id.

In general, I'd try to avoid names in message/service/action definitions that appear often as the names in the callback signatures, such as msg, srv, request, response, data, etc., as this usually leads to quite some misunderstandings...