# encoding=utf-8

import rospy
import tf

if __name__ == '__main__':
    rospy.init_node('py_tf_broadcaster')
    br = tf.TransformBroadcaster()

    x = 0.0
    y = 0.0
    z = 0.0
    roll = 0
    pitch = 0
    yaw = 1.57
    rate = rospy.Rate(1)
    while not rospy.is_shutdown():
        yaw = yaw + 0.1
        roll = roll + 0.1
        br.sendTransform((x, y, z),
                         tf.transformations.quaternion_from_euler(roll, pitch, yaw),
                         rospy.Time.now(),
                         "base_link",
                         "front_caster")  # 发布base_link到link1的平移和翻转
        rate.sleep()

[((73, 109), 'rospy.init_node', 'rospy.init_node', (['"""py_tf_broadcaster"""'], {}), "('py_tf_broadcaster')\n", (88, 109), False, 'import rospy\n'), ((119, 144), 'tf.TransformBroadcaster', 'tf.TransformBroadcaster', ([], {}), '()\n', (142, 144), False, 'import tf\n'), ((235, 248), 'rospy.Rate', 'rospy.Rate', (['(1)'], {}), '(1)\n', (245, 248), False, 'import rospy\n'), ((263, 282), 'rospy.is_shutdown', 'rospy.is_shutdown', ([], {}), '()\n', (280, 282), False, 'import rospy\n'), ((395, 453), 'tf.transformations.quaternion_from_euler', 'tf.transformations.quaternion_from_euler', (['roll', 'pitch', 'yaw'], {}), '(roll, pitch, yaw)\n', (435, 453), False, 'import tf\n'), ((480, 496), 'rospy.Time.now', 'rospy.Time.now', ([], {}), '()\n', (494, 496), False, 'import rospy\n')]