Ask Your Question

Revision history [back]

The problem is that you try to return the full Empty Service object. You need to only return the response.

return std_srvs.srv.EmptyResponse()

See also the tutorial.

The problem is that you try to return

  1. the full Empty Service object. You need to only return the response.

  2. you try to return the wrong type of Service. The Service Server is declared using your my_msgs.srv.Test, thus the Response and the Request have to be of the types TestRequest and TestResponse, respectively. You don't have to explicitly set the request type. But you have to make sure you return the correct Response type. i.e.

return std_srvs.srv.EmptyResponse() my_msgs.srv.TestResponse()

See also the tutorial.