sample_empty_service_caller.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import rospy
4 from std_srvs.srv import Empty
5 
6 
7 if __name__ == '__main__':
8  rospy.init_node('sample_empty_service_caller')
9  rospy.wait_for_service('~service')
10  r = rospy.Rate(rospy.get_param('~rate', 1.0))
11  while not rospy.is_shutdown():
12  try:
13  srv_caller = rospy.ServiceProxy('~service', Empty)
14  res = srv_caller()
15  except rospy.ServiceException as e:
16  rospy.logwarn('Service call failed:\n{}'.format(e))
17 
18  try:
19  r.sleep()
20  except rospy.ROSTimeMovedBackwardsException:
21  pass


jsk_pcl_ros
Author(s): Yohei Kakiuchi
autogenerated on Mon May 3 2021 03:03:47