ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I have seen
rospy.Service
fails if the handler returns None
None
!= empty response. None
indicates an error on the server side.
See the documentation (wiki/rospy/Overview/Services - Providing services):
Create a new ROS Service with the specified name, service type (the auto-generated service class), and handler. The handler will be invoked with the service request message and should return the appropriate service response message. If the handler returns None or raises an exception, an error will be passed to the client.
2 | No.2 Revision |
I have seen
rospy.Service
fails if the handler returnsNoneNone, so I guess ROS services without any response are not supported.
None
!= empty response. None
indicates an error on the server side.
See the documentation (wiki/rospy/Overview/Services - Providing services):, emphasis mine):
Create a new ROS Service with the specified name, service type (the auto-generated service class), and handler. The handler will be invoked with the service request message and should return the appropriate service response message. If the handler returns None or raises an exception, an error will be passed to the client.
Furthermore:
Otherwise, what should the handler return?
Every service definition always consists of a request and a response part (top and bottom of the .srv
definition respectively). Services that have "nothing" on the response side still have a Response
class generated, but it will just not contain any fields.
Service handlers that should return an empty response should therefor still instantiate a Response
object and return that.
See again wiki/rospy/Overview/Services - Providing services on the wiki.
3 | No.3 Revision |
I have seen
rospy.Service
fails if the handler returns None, so I guess ROS services without any response are not supported.
None
!= empty response. None
indicates an error on the server side.
See the documentation (wiki/rospy/Overview/Services - Providing services, emphasis mine):
Create a new ROS Service with the specified name, service type (the auto-generated service class), and handler. The handler will be invoked with the service request message and should return the appropriate service response message. If the handler returns None or raises an exception, an error will be passed to the client.
Furthermore:
Otherwise, what should the handler return?
Every service definition always consists of a request and a response part (top and bottom of the .srv
definition respectively). Services that have "nothing" on the response side still have a Response
class generated, but it will just not contain any fields.
Service handlers that should return an empty response should therefor still instantiate a Response
object and return that.
See again wiki/rospy/Overview/Services - Providing services on the wiki.
I see services with empty request can be called with no problem, but it would be nice to see this documented
I think the rospy
overview page on services documents this quite well.
4 | No.4 Revision |
I have seen
rospy.Service
fails if the handler returns None, so I guess ROS services without any response are not supported.
None
!= empty response. None
indicates an error on the server side.
See the documentation (wiki/rospy/Overview/Services - Providing services, emphasis mine):
Create a new ROS Service with the specified name, service type (the auto-generated service class), and handler. The handler will be invoked with the service request message and should return the appropriate service response message. If the handler returns None or raises an exception, an error will be passed to the client.
Furthermore:
Otherwise, what should the handler return?
Every service definition always consists of a request and a response part (top and bottom of the .srv
definition respectively). Services that have "nothing" on the response side still have a Response
class generated, but it will just not contain any fields.
Service handlers that should return an empty response should therefor therefore still instantiate a Response
object and return that.
See again wiki/rospy/Overview/Services - Providing services on the wiki.
I see services with empty request can be called with no problem, but it would be nice to see this documented
I think the rospy
overview page on services documents this quite well.