3 from geometry_msgs.msg
import Twist
13 a_dist = a_x * a_x_t**2 / 2
18 a_rad = a_z * a_z_t**2 / 2
24 t = (dist - a_dist) / v_x + a_x_t
29 t = (rad - a_rad) / v_z + a_z_t
34 rospy.loginfo(
"publish cmd:\n" + str(twist))
35 end_time = rospy.rostime.get_rostime() + rospy.Duration(t)
36 rate = rospy.Rate(100)
40 rem_time = end_time - rospy.rostime.get_rostime()
41 if rem_time < rate.sleep_dur:
42 if rem_time.to_sec() > 0:
51 rospy.loginfo(
"move " + str(dist) +
" m for " + str(t) +
" sec")
59 rospy.loginfo(
"rotate " + str(rad) +
" rad for " + str(t) +
" sec")
66 rospy.loginfo(
"stop");
70 if __name__ ==
'__main__':
72 pub = rospy.Publisher(
'cmd_vel', Twist, queue_size = 1)
73 rospy.init_node(
'spiral_cmd', anonymous=
True)
76 for i
in range(1, spiral_diam):
90 except rospy.ROSInterruptException:
def publish_cmd_vel(twist, t)