slowService.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import sys
00003 import rospy
00004 from std_srvs.srv import Empty, EmptyResponse
00005 
00006 delay = 30
00007 
00008 
00009 def handle_msg(rq):
00010     print("Slow Node got request")
00011     rospy.rostime.wallsleep(delay)
00012     return EmptyResponse()
00013 
00014 
00015 def empty_server():
00016     args = rospy.myargv(argv=sys.argv)
00017     node_name = args[1] if len(args) > 1 else 'slow_node'
00018 
00019     rospy.init_node(node_name)
00020     rospy.set_param('~slow_param', delay)
00021     srv = rospy.Service('/test/slowsrv', Empty, handle_msg)
00022     rospy.spin()
00023     if rospy.has_param('slow_param'):
00024         rospy.delete_param('~slow_param')
00025 
00026 if __name__ == '__main__':
00027     empty_server()


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