21 from geometry_msgs.msg
import Twist
25 rospy.init_node(
"test_publisher_twist", anonymous=
True)
27 pub_vel = rospy.Publisher(
"command", Twist, queue_size=1)
35 while not rospy.is_shutdown():
36 time = rospy.Time.now()
38 vel = random.uniform(-1.5, 1.5)
39 while since_start < random.uniform(2.0, 5.0):
40 since_start = (rospy.Time.now() - time).to_sec()
42 vel_msg.angular.z = vel
43 pub_vel.publish(vel_msg)
46 if __name__ ==
'__main__':
49 except rospy.ROSInterruptException:
pass