41 import geometry_msgs.msg
47 t = geometry_msgs.msg.TransformStamped()
49 t.header.stamp = rospy.Time.now()
50 t.header.frame_id =
"world" 51 t.child_frame_id = turtlename
52 t.transform.translation.x = msg.x
53 t.transform.translation.y = msg.y
54 t.transform.translation.z = 0.0
55 q = tf.transformations.quaternion_from_euler(0, 0, msg.theta)
56 t.transform.rotation.x = q[0]
57 t.transform.rotation.y = q[1]
58 t.transform.rotation.z = q[2]
59 t.transform.rotation.w = q[3]
63 if __name__ ==
'__main__':
64 rospy.init_node(
'turtle_tf2_broadcaster')
65 turtlename = rospy.get_param(
'~turtle')
66 rospy.Subscriber(
'/%s/pose' % turtlename,
def handle_turtle_pose(msg, turtlename)