Go to the documentation of this file.00001
00002
00003 import sys
00004 import numpy as np
00005
00006 import roslib; roslib.load_manifest("hrl_pr2_arms")
00007 import rospy
00008 import tf.transformations as tf_trans
00009
00010 from hrl_pr2_arms.pr2_arm import PR2Arm, create_pr2_arm
00011 from hrl_pr2_arms.pr2_arm import PR2ArmJointTrajectory, PR2ArmJTranspose
00012 from hrl_pr2_arms.pr2_arm import PR2ArmJInverse, PR2ArmJTransposeTask
00013
00014 from spheroid_space import SpheroidSpace
00015
00016 def main():
00017 rospy.init_node("pr2_arm_test")
00018 arm = sys.argv[1]
00019 jnt_arm = create_pr2_arm(arm, arm_type=PR2ArmJointTrajectory)
00020 kin = jnt_arm.kinematics
00021
00022 ellipse_rot = np.mat([[-1., 0., 0.], [0., -1., 0.], [0., 0., 1.]])
00023 sspace = SpheroidSpace(0.15, np.mat([0.78, -0.18, 0.1]).T, ellipse_rot)
00024
00025 uvp = np.array([1.0, np.pi/2, 0.0])
00026 uvp_delta = np.array([0.0, 0.6, 0.6])
00027 pos, rot = sspace.spheroidal_to_pose(uvp + uvp_delta)
00028 print pos, rot
00029
00030
00031 q_ik = kin.IK(pos, rot, jnt_arm.get_joint_angles())
00032
00033 if q_ik is not None:
00034 jnt_arm.set_ep(q_ik, 5)
00035 else:
00036 print "IK failure"
00037
00038 if __name__ == "__main__":
00039 main()