36 from moveit_commander
import MoveItCommanderException
37 from geometry_msgs.msg
import Pose, PoseStamped, Transform
42 buf = StringIO.StringIO()
51 pose.append(pose_msg.position.x)
52 pose.append(pose_msg.position.y)
53 pose.append(pose_msg.position.z)
54 pose.append(pose_msg.orientation.x)
55 pose.append(pose_msg.orientation.y)
56 pose.append(pose_msg.orientation.z)
57 pose.append(pose_msg.orientation.w)
62 if len(pose_list) == 7:
63 pose_msg.position.x = pose_list[0]
64 pose_msg.position.y = pose_list[1]
65 pose_msg.position.z = pose_list[2]
66 pose_msg.orientation.x = pose_list[3]
67 pose_msg.orientation.y = pose_list[4]
68 pose_msg.orientation.z = pose_list[5]
69 pose_msg.orientation.w = pose_list[6]
70 elif len(pose_list) == 6:
71 pose_msg.position.x = pose_list[0]
72 pose_msg.position.y = pose_list[1]
73 pose_msg.position.z = pose_list[2]
74 q = tf.transformations.quaternion_from_euler(pose_list[3], pose_list[4], pose_list[5])
75 pose_msg.orientation.x = q[0]
76 pose_msg.orientation.y = q[1]
77 pose_msg.orientation.z = q[2]
78 pose_msg.orientation.w = q[3]
80 raise MoveItCommanderException(
"Expected either 6 or 7 elements in list: (x,y,z,r,p,y) or (x,y,z,qx,qy,qz,qw)")
84 pose_msg = PoseStamped()
86 pose_msg.header.frame_id = target_frame
87 pose_msg.header.stamp = rospy.Time.now()
92 trf.append(trf_msg.translation.x)
93 trf.append(trf_msg.translation.y)
94 trf.append(trf_msg.translation.z)
95 trf.append(trf_msg.rotation.x)
96 trf.append(trf_msg.rotation.y)
97 trf.append(trf_msg.rotation.z)
98 trf.append(trf_msg.rotation.w)
102 trf_msg = Transform()
103 trf_msg.translation.x = trf_list[0]
104 trf_msg.translation.y = trf_list[1]
105 trf_msg.translation.z = trf_list[2]
106 trf_msg.rotation.x = trf_list[3]
107 trf_msg.rotation.y = trf_list[4]
108 trf_msg.rotation.z = trf_list[5]
109 trf_msg.rotation.w = trf_list[6]
def pose_to_list(pose_msg)
def list_to_transform(trf_list)
def list_to_pose_stamped(pose_list, target_frame)
def transform_to_list(trf_msg)
def list_to_pose(pose_list)
def msg_from_string(msg, data)