Why did we put service request?

Why do we put a “ExecTrajRequest” in the following?

from iri_wam_reproduce_trajectory.srv import ExecTraj, ExecTrajRequest

Because we need the request message type, for calling the action

How would we know that? Can you point me to a API please?

I am also having a similar question. If we navigate the directory to iri_wam_reproduce_trajectory/srv and look inside we can find the file ExecTraj.srv. There is no ExecTrajRequest, however and I am confused how we know to use ExecTrajRequest.

Similarly in Exercise 4.2 we are asked to make a service server and client for the BB8 robot. from std_srvs/srv we import Empty and either EmptyResponse or EmptyRequest depending on if we are making a server or a client. Is this a consistent thing where whenever we are making a server we require a response and when we require a client we require a request? Is there somewhere this is stated and this is something I’ve missed?

1 Like

A service message consists of a Request and a Response. The service client sends a Request to the server, which returns a Response. In the service file, everything above the line is the structure of your Request, everything below is the structure of the Response. Hope that answers the question :slight_smile:

@hilljtyler @battistini.jarrett @simon.steinmann91,

When you create a service message, say AnyService.srv, the classes AnyService, AnyServiceRequest and AnyServiceResponse are automatically available by convention and python magic after you build the message. And, no, you won’t find them within the source srv folder. They are “hidden” away somewhere in the devel/build folders (can you try to find them? :wink:).