Enforce correct temporal order. More...
#include <sequencer.h>
Public Member Functions | |
void | flush () |
Flush the message queue. More... | |
void | reset () noexcept override |
Reset filter state. More... | |
Sequencer (const ros::Duration &max_delay=ros::Duration(1, 0)) noexcept | |
Constructor. More... | |
void | set_max_delay (const ros::Duration &max_delay) noexcept |
Modify maximum delay. More... | |
Protected Member Functions | |
void | receive (const Inputs &... in) override |
Process incoming data. More... | |
Private Types | |
using | Queue = std::multimap< ros::Time, QueueElement > |
using | QueueElement = std::tuple< Inputs... > |
Private Attributes | |
ros::Time | cutoff_ |
ros::Duration | max_delay_ |
std::mutex | mutex_ |
Queue | queue_ |
Additional Inherited Members |
Enforce correct temporal order.
This filter sorts incoming messages according to their header timestamp, and forwards them in order. It needs the expected maximum delay by which messages might arrive out of order, and forwarded messages will be out of date by at least this delay. However, all forwarded messages will be guaranteed to be in temporal order, and no message will be dropped unless it arrives with a larger delay, compared to the most recently received message.
If the filter input is not unary, only the first argument is examined, which must have an accessible ROS header as determined by the ros::message_traits
template.
Definition at line 43 of file sequencer.h.
|
private |
Definition at line 77 of file sequencer.h.
|
private |
Definition at line 76 of file sequencer.h.
|
explicitnoexcept |
Constructor.
max_delay
the maximum delay of any messageDefinition at line 34 of file sequencer_impl.h.
void fkie_message_filters::Sequencer< Inputs >::flush | ( | ) |
Flush the message queue.
This will forward all messages in the queue, regardless of their age. Afterwards, new messages which are older than the most recently forwarded one will be dropped, even if their delay is smaller than the configured threshold. In other words, a call to this method will never violate the temporal order constraint.
Definition at line 71 of file sequencer_impl.h.
|
overrideprotectedvirtual |
Process incoming data.
Derived classes need to override this method to handle all data that is to be consumed by the sink.
Implements fkie_message_filters::Sink< Inputs... >.
Definition at line 47 of file sequencer_impl.h.
|
overridevirtualnoexcept |
Reset filter state.
For stateful filters, this method resets the internal state as if the filter had just been created. Existing connections to sources and sinks are unaffected.
The default implementation does nothing.
Reimplemented from fkie_message_filters::FilterBase.
Definition at line 90 of file sequencer_impl.h.
|
noexcept |
Modify maximum delay.
New messages older than the most recently forwarded one will continue to be dropped, even if their delay is smaller than max_delay. In other words, a call to this method will never violate the temporal order constraint.
max_delay
the maximum delay of any messageDefinition at line 40 of file sequencer_impl.h.
|
private |
Definition at line 80 of file sequencer.h.
|
private |
Definition at line 79 of file sequencer.h.
|
private |
Definition at line 78 of file sequencer.h.
|
private |
Definition at line 81 of file sequencer.h.