Go to the documentation of this file.00001
00002
00003 import numpy as np
00004 import sys
00005
00006 import roslib
00007 roslib.load_manifest('hrl_pr2_arms')
00008
00009 import rospy
00010 import tf
00011 import tf.transformations as tf_trans
00012 from std_srvs.srv import Empty, EmptyResponse
00013
00014 from hrl_generic_arms.ep_trajectory_controller import EPArmController
00015 from hrl_pr2_arms.pr2_arm import create_pr2_arm, PR2ArmJointTrajectory
00016 from hrl_pr2_arms.pr2_controller_switcher import ControllerSwitcher
00017
00018 joint_ctrl = '%s_arm_controller'
00019
00020 def setup_servoing_arms(msg):
00021 ctrl_switcher = ControllerSwitcher()
00022 ctrl_switcher.carefree_switch('r', joint_ctrl, reset=False)
00023 ctrl_switcher.carefree_switch('l', joint_ctrl, reset=False)
00024 r_arm = create_pr2_arm('r', PR2ArmJointTrajectory, controller_name=joint_ctrl)
00025 l_arm = create_pr2_arm('l', PR2ArmJointTrajectory, controller_name=joint_ctrl)
00026
00027 r_ep_arm_ctrl = EPArmController(r_arm)
00028 l_ep_arm_ctrl = EPArmController(l_arm)
00029 r_ep_arm_ctrl.execute_interpolated_ep([-1.91, 1.25, -1.93, -1.53, 0.33, -0.03, 0.0],
00030 15, blocking=False)
00031 l_ep_arm_ctrl.execute_interpolated_ep([1.91, 1.25, 1.93, -1.53, -0.33, -0.03, -3.09],
00032 15, blocking=True)
00033 return EmptyResponse()
00034
00035 def main():
00036 rospy.init_node("servo_prepare")
00037 if len(sys.argv) < 2:
00038 print "-s for server, -p for play"
00039 if sys.argv[1] == "-s":
00040 rospy.Service("/pr2_ar_servo/arms_setup", Empty, setup_servoing_arms)
00041 if sys.argv[1] == "-p":
00042 setup_servoing_arms(None)
00043 rospy.spin()
00044
00045 if __name__ == "__main__":
00046 main()