emptyService.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import sys
00003 
00004 import rospy
00005 from std_srvs.srv import Empty, EmptyResponse
00006 
00007 
00008 def handle_msg(rq):
00009     print("Empty Node got request")
00010     # TODO: assert rq is Empty Request (needed or done by rospy already ?)
00011     return EmptyResponse()
00012 
00013 
00014 def empty_server():
00015 
00016     args = rospy.myargv(argv=sys.argv)
00017     node_name = args[1] if len(args) > 1 else 'empty_node'
00018 
00019     rospy.init_node(node_name)
00020 
00021     # TODO : seems not possible with ROS ?
00022     #   File "/usr/lib/python2.7/xmlrpclib.py", line 659, in dump_nil
00023     # raise TypeError, "cannot marshal None unless allow_none is enabled"
00024     # TypeError: cannot marshal None unless allow_none is enabled
00025     #rospy.set_param('~empty_param', None)
00026 
00027     srv = rospy.Service('/test/empsrv', Empty, handle_msg)
00028     rospy.spin()
00029     if rospy.has_param('empty_param'):
00030         rospy.delete_param('~empty_param')
00031 
00032 if __name__ == '__main__':
00033     empty_server()


pyros_test
Author(s): AlexV
autogenerated on Sat Jun 8 2019 20:51:06