Go to the documentation of this file.00001
00002
00003 import roslib
00004 roslib.load_manifest('srs_assisted_detection')
00005
00006
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 from srs_msgs.msg import *
00013
00014 import rospy
00015
00016 def moveBBSrv(req):
00017
00018 try:
00019 rospy.wait_for_service('scan_base_pose',10)
00020 except rospy.ROSException, e:
00021 print "Service not available: %s"%e
00022 outcome_detectObjectSrv = 'failed'
00023
00024 try:
00025 base_pose_service = rospy.ServiceProxy('scan_base_pose', ScanBasePose)
00026 req_scan = ScanBasePoseRequest()
00027 srs_info=SRSSpatialInfo()
00028 srs_info.l=req.l
00029 srs_info.w=req.w
00030 srs_info.h=req.h
00031 srs_info.pose=req.pose
00032 req_scan.parent_obj_geometry=srs_info
00033 res = base_pose_service(req_scan)
00034 print res.scan_base_pose_list[0]
00035 moveBB=BBMoveResponse()
00036 moveBB.message.data='moving to better position'
00037 return moveBB
00038 outcome_user_intervention = 'succeeded'
00039 except rospy.ServiceException, e:
00040 print "Service call failed: %s"%e
00041
00042 def asisted_BBmove_server():
00043 rospy.init_node('asisted_BBmove_server')
00044 s = rospy.Service('assisted_BBmove', BBMove, moveBBSrv)
00045
00046
00047 rospy.loginfo("Assisted BBmove ready.")
00048 rospy.spin()
00049
00050
00051 if __name__ == "__main__":
00052 asisted_BBmove_server()