I have a lot of topics that I want to store in a buffer, but the individual topics shouldn't be recorded for more than 10 seconds each. For a couple of topics this line functions fine, but if I want to subscribe to all topics it starts lagging behind. I need to use something more effective than re-writing a new list, I need to pop all the elements that are older than 10s.
`buffer[topic] = [ msg for msg in buffer[topic] if timestamp - msg[0] < rospy.Duration(10.0) ]`
Each topics has a timestamp, if this timestamp is larger than 10s we want to remove those elements. Hoping you guys can help.
↧