Main Page
Namespaces
Classes
Files
File List
nodes
emptyService.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
import
sys
3
4
import
rospy
5
from
std_srvs.srv
import
Empty, EmptyResponse
6
7
8
def
handle_msg
(rq):
9
print(
"Empty Node got request"
)
10
# TODO: assert rq is Empty Request (needed or done by rospy already ?)
11
return
EmptyResponse()
12
13
14
def
empty_server
():
15
16
args = rospy.myargv(argv=sys.argv)
17
node_name = args[1]
if
len(args) > 1
else
'empty_node'
18
19
rospy.init_node(node_name)
20
21
# TODO : seems not possible with ROS ?
22
# File "/usr/lib/python2.7/xmlrpclib.py", line 659, in dump_nil
23
# raise TypeError, "cannot marshal None unless allow_none is enabled"
24
# TypeError: cannot marshal None unless allow_none is enabled
25
#rospy.set_param('~empty_param', None)
26
27
srv = rospy.Service(
'/test/empsrv'
, Empty, handle_msg)
28
rospy.spin()
29
if
rospy.has_param(
'empty_param'
):
30
rospy.delete_param(
'~empty_param'
)
31
32
if
__name__ ==
'__main__'
:
33
empty_server
()
emptyService.handle_msg
def handle_msg(rq)
Definition:
emptyService.py:8
emptyService.empty_server
def empty_server()
Definition:
emptyService.py:14
pyros_test
Author(s): AlexV
autogenerated on Mon Jun 10 2019 14:20:23