服务(services)是节点之间通讯的另一种方式。服务允许节点发送请求(request) 并获得一个响应(response)
rosservice list,列出当前的服务
rosservice type clear 查看clear服务的类型。
clear类型是std_srvs/Empty,这种表示clear不需要发送参数,也没有接收的响应。
rosservice call clear 调用clear命令,清除画板 如果正在运动过程中清除,会报一个异常
root@ben-virtual-machine:~# rosservice call clear
Unhandled exception in thread started by <bound method Thread.__bootstrap of <Thread(Thread-4, stopped daemon 140226454353664)>>
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 774, in __bootstrap
self.__bootstrap_inner()
File "/usr/lib/python2.7/threading.py", line 814, in __bootstrap_inner
(self.name, _format_exc()))
File "/usr/lib/python2.7/traceback.py", line 241, in format_exc
etype, valu