5 from geometry_msgs.msg
import PoseStamped
9 stamp = rospy.Time.now()
11 listener.waitForTransform(src_frame, dst_frame, stamp,
12 timeout=rospy.Duration(1))
17 dst_pose = listener.lookupTransform(src_frame, dst_frame, stamp)
19 pose_msg = PoseStamped()
20 pose_msg.header.frame_id = src_frame
21 pose_msg.header.stamp = stamp
22 pose_msg.pose.position.x = dst_pose[0][0]
23 pose_msg.pose.position.y = dst_pose[0][1]
24 pose_msg.pose.position.z = dst_pose[0][2]
25 pose_msg.pose.orientation.x = dst_pose[1][0]
26 pose_msg.pose.orientation.y = dst_pose[1][1]
27 pose_msg.pose.orientation.z = dst_pose[1][2]
28 pose_msg.pose.orientation.w = dst_pose[1][3]
33 if __name__ ==
'__main__':
34 rospy.init_node(
'tf_to_pose')
35 pub = rospy.Publisher(
'~output', PoseStamped, queue_size=1)
36 src_frame = rospy.get_param(
'~src_frame')
37 dst_frame = rospy.get_param(
'~dst_frame')
38 rate = rospy.get_param(
'~rate', 1.)
39 timer = rospy.Timer(rospy.Duration(1.0 / rate), cb)