13 from geometry_msgs.msg
import Twist
14 from std_msgs.msg
import String
21 implements a rotating motion. 25 def __init__(self,cmd_vel_topic,log_topic, freq, accl, max_speed):
26 threading.Thread.__init__(self)
27 self.
pub_cmd = rospy.Publisher(cmd_vel_topic,Twist)
28 self.
pub_log = rospy.Publisher(log_topic,String)
51 start = rospy.get_rostime()
55 self.
rate = rospy.Rate(freq)
59 msg =
"Time : " + str(rospy.get_rostime().secs) +
" Vel : " +str(twist.linear.x)
61 while not rospy.is_shutdown()
and not self.
_stop:
63 twist.linear.x = twist.linear.x + ( 1.0 / freq ) * a
64 if twist.linear.x > max_speed:
67 msg =
"Time : " + str(rospy.get_rostime().secs) +
" Vel : " +str(twist.angular.z)
69 self.pub_cmd.publish(twist)
72 self.pub_cmd.publish(twist)
77 self.pub_log.publish(t)
def __init__(self, cmd_vel_topic, log_topic, freq, accl, max_speed)