# 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()

[((7, 4, 7, 40), 'rospy.init_node', 'rospy.init_node', ({(7, 20, 7, 39): '"""py_tf_broadcaster"""'}, {}), "('py_tf_broadcaster')", False, 'import rospy\n'), ((8, 9, 8, 34), 'tf.TransformBroadcaster', 'tf.TransformBroadcaster', ({}, {}), '()', False, 'import tf\n'), ((16, 11, 16, 24), 'rospy.Rate', 'rospy.Rate', ({(16, 22, 16, 23): '1'}, {}), '(1)', False, 'import rospy\n'), ((17, 14, 17, 33), 'rospy.is_shutdown', 'rospy.is_shutdown', ({}, {}), '()', False, 'import rospy\n'), ((21, 25, 21, 83), 'tf.transformations.quaternion_from_euler', 'tf.transformations.quaternion_from_euler', ({(21, 66, 21, 70): 'roll', (21, 72, 21, 77): 'pitch', (21, 79, 21, 82): 'yaw'}, {}), '(roll, pitch, yaw)', False, 'import tf\n'), ((22, 25, 22, 41), 'rospy.Time.now', 'rospy.Time.now', ({}, {}), '()', False, 'import rospy\n')]