remove old messages from topic
Hi all, I am using ROS kinetic on Ubuntu 16.04. I have a topic that I publish movement instructions to. At some point in my code I want to make a long rospy.sleep but sometimes I will publish to the topic right before I will go to sleep, and thus when I continue after the sleep the first message in the queue of the topic is going to be the old message, which is irrelevant by now. I want to remove all messages from my topics queue right before sleeping or right after continuing after the sleep, but I couldn't figure out how I flush all messages from the topic.
I am sorry if this question is trivial, but I can't find an answer to it in the forums or docs.
I saw this post:
https://answers.ros.org/question/3714...
but my queue size is already set to 1, my problem is I don't even want that 1 thing in the queue, I want to totally empty it out manually.
Thanks in advance for any help available.
Do the messages you publish have a timestamp? (Which message type do you use?)
i am sending geometry_msgs/Twist messages. I am using the /cmd_vel topic provided by ardrone_autonomy package. I do not know of a timestamp. I think my problem also happens to the std_msgs/Empty message I send to the takeoff topic.