$search
00001 #!/usr/bin/python 00002 00003 import roslib 00004 roslib.load_manifest('srs_assisted_detection') 00005 00006 #from srs_grasping.srv import * 00007 from geometry_msgs.msg import * 00008 from srs_assisted_detection.srv import * 00009 00010 from srs_symbolic_grounding.srv import * 00011 from srs_symbolic_grounding.msg import * 00012 00013 import rospy 00014 00015 def moveBBSrv(req): 00016 00017 try: 00018 rospy.wait_for_service('scan_base_pose',10) 00019 except rospy.ROSException, e: 00020 print "Service not available: %s"%e 00021 outcome_detectObjectSrv = 'failed' 00022 00023 try: 00024 base_pose_service = rospy.ServiceProxy('scan_base_pose', ScanBasePose) 00025 req_scan = ScanBasePoseRequest() 00026 srs_info=SRSSpatialInfo() 00027 srs_info.l=req.l 00028 srs_info.w=req.w 00029 srs_info.h=req.h 00030 srs_info.pose=req.pose 00031 req_scan.parent_obj_geometry=srs_info 00032 res = base_pose_service(req_scan) 00033 print res.scan_base_pose_list[0] 00034 moveBB=BBMoveResponse() 00035 moveBB.message.data='moving to better position' 00036 return moveBB 00037 outcome_user_intervention = 'succeeded' 00038 except rospy.ServiceException, e: 00039 print "Service call failed: %s"%e 00040 00041 def asisted_BBmove_server(): 00042 rospy.init_node('asisted_BBmove_server') 00043 s = rospy.Service('assisted_BBmove', BBMove, moveBBSrv) 00044 00045 00046 rospy.loginfo("Assisted BBmove ready.") 00047 rospy.spin() 00048 00049 00050 if __name__ == "__main__": 00051 asisted_BBmove_server()