2 import geometry_msgs.msg
6 if __name__ ==
'__main__':
8 Broadcast a transform from parent_frame to target_frame forever, 9 with changing translation. 12 rospy.init_node(
'dummy_transform_publisher', anonymous=
True)
14 current_transform = geometry_msgs.msg.TransformStamped()
15 current_transform.header.frame_id = rospy.get_param(
'~parent_frame')
16 current_transform.child_frame_id = rospy.get_param(
'~child_frame')
18 current_transform.transform.rotation.w = 1.0
20 osc_rate_hz = rospy.get_param(
'~osc_rate')
21 update_rate_hz = rospy.get_param(
'~update_rate')
24 step_size = (1.0 * osc_rate_hz) / update_rate_hz
25 update_rate = rospy.Rate(update_rate_hz)
28 while not rospy.is_shutdown():
29 current_transform.header.stamp = rospy.Time.now()
31 current_transform.transform.translation.x += step_size
32 if current_transform.transform.translation.x >= 1.0:
35 current_transform.transform.translation.x -= step_size
36 if current_transform.transform.translation.x <= 0.0:
38 br.sendTransform(current_transform)