test_service.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import roslib; roslib.load_manifest('wviz')
00003 import rospy
00004 import time
00005 
00006 from std_msgs.msg import String
00007 from pr2_pick_and_place_service.srv import *
00008 
00009 def listener():
00010         rospy.init_node('test_service', anonymous=True)
00011     
00012         rospy.wait_for_service('pick_and_place_detect_object')
00013         try:
00014                 detect_object = rospy.ServiceProxy('pick_and_place_detect_object', DetectObjects)
00015                 resp1 = detect_object('d')
00016                 print 'Service call succeeded'
00017                 print 'Received %d objects' % (len(resp1.objects),)
00018         except rospy.ServiceException, e:
00019                 print "Service call failed"
00020     
00021 if __name__ == '__main__':
00022     listener()


remote_lab_examples
Author(s): Halit Bener Suay
autogenerated on Sun Jan 5 2014 11:35:33