How to save the velocity values from turtlebot3 waffle?

asked 2019-12-12 09:43:48 -0600

huryou gravatar image

Hello,

i want to save last 40 values of speeds in order to feedback the speeds to predicting next speed.

so what i guessed is that the cmd_vel will be not only publisher but also subscriber.

The codes is like:

    self.speed_sub = rospy.Subscriber('/cmd_vel', Twist,
                                      self.update_speed)
    self.pub = rospy.Publisher('/cmd_vel',
                       Twist, queue_size=1)

def update_speed(self, spd):
    s=map(ord, spd.data)

Do you have an Idea how i can save the last 40 values of speed on the buffer?

edit retag flag offensive close merge delete