Go to the documentation of this file.00001
00002
00003 import roslib
00004 roslib.load_manifest('door_manipulation_tools')
00005 from std_srvs.srv import Empty
00006 import rospy
00007 import sys
00008
00009 from pr2_python import base
00010 from geometry_msgs.msg import PoseStamped
00011
00012 def callback(data):
00013 rospy.loginfo(rospy.get_name()+"Going to the handle")
00014 thebase = base.Base()
00015 success = thebase.move_manipulable_pose(data.pose.position.x,
00016 data.pose.position.y,
00017 data.pose.position.z)
00018 if success:
00019 rospy.loginfo("Reached Door, Trying to manipulate")
00020 try:
00021 rospy.wait_for_service('/door_manipulation/unlatch_door')
00022 unlatch_service = rospy.ServiceProxy('/door_manipulation/unlatch_door', Empty)
00023 unlatch_service()
00024
00025 rospy.wait_for_service('/door_manipulation/swing_door')
00026 swing_service = rospy.ServiceProxy('/door_manipulation/swing_door', Empty)
00027 swing_service()
00028 except rospy.ServiceException, e:
00029 print "Service call failed: %s"%e
00030
00031 rospy.signal_shutdown("Assuming work is done. Bye")
00032 sys.exit()
00033
00034
00035 def setup():
00036 rospy.Subscriber("/door_manipulation/handle", PoseStamped, callback)
00037
00038 rospy.spin()
00039
00040 if __name__ == '__main__':
00041 rospy.init_node('move_base_to_handle')
00042 setup()
00043