Public Member Functions | Protected Member Functions | Private Types | Private Attributes | List of all members
fkie_message_filters::Sequencer< Inputs > Class Template Reference

Enforce correct temporal order. More...

#include <sequencer.h>

Inheritance diagram for fkie_message_filters::Sequencer< Inputs >:
Inheritance graph
[legend]

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...
 
- Public Member Functions inherited from fkie_message_filters::Sink< Inputs... >
Connection connect_to_source (Source< Inputs... > &src) noexcept
 Connect this sink to a source. More...
 
void disconnect_from_all_sources () noexcept
 Disconnect from all connected sources. More...
 
virtual ~Sink ()
 
- Public Member Functions inherited from fkie_message_filters::FilterBase
virtual ~FilterBase ()
 
- Public Member Functions inherited from fkie_message_filters::Source< IO< Inputs... > >
Connection connect_to_sink (Sink< Outputs... > &dst) noexcept
 Connect this source to a sink. More...
 
void disconnect_from_all_sinks () noexcept
 Disconnect from all connected sinks. More...
 
virtual ~Source ()
 

Protected Member Functions

void receive (const Inputs &... in) override
 Process incoming data. More...
 
- Protected Member Functions inherited from fkie_message_filters::Source< IO< Inputs... > >
void send (const Outputs &... out)
 Pass data to all connected sinks. 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

- Public Types inherited from fkie_message_filters::Sink< Inputs... >
using Input = IO< Inputs... >
 Grouped input types. More...
 
- Public Types inherited from fkie_message_filters::Source< IO< Inputs... > >
using Output = IO< Outputs... >
 Grouped output types. More...
 
- Static Public Attributes inherited from fkie_message_filters::Sink< Inputs... >
static constexpr std::size_t NUM_INPUTS
 Number of input arguments. More...
 
- Static Public Attributes inherited from fkie_message_filters::Source< IO< Inputs... > >
static constexpr std::size_t NUM_OUTPUTS
 Number of output arguments. More...
 

Detailed Description

template<class... Inputs>
class fkie_message_filters::Sequencer< Inputs >

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.

Member Typedef Documentation

◆ Queue

template<class... Inputs>
using fkie_message_filters::Sequencer< Inputs >::Queue = std::multimap<ros::Time, QueueElement>
private

Definition at line 77 of file sequencer.h.

◆ QueueElement

template<class... Inputs>
using fkie_message_filters::Sequencer< Inputs >::QueueElement = std::tuple<Inputs...>
private

Definition at line 76 of file sequencer.h.

Constructor & Destructor Documentation

◆ Sequencer()

template<class... Inputs>
fkie_message_filters::Sequencer< Inputs >::Sequencer ( const ros::Duration max_delay = ros::Duration(1, 0))
explicitnoexcept

Constructor.

  • max_delay the maximum delay of any message

Definition at line 34 of file sequencer_impl.h.

Member Function Documentation

◆ flush()

template<class... Inputs>
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.

◆ receive()

template<class... Inputs>
void fkie_message_filters::Sequencer< Inputs >::receive ( const Inputs &...  in)
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.

◆ reset()

template<class... Inputs>
void fkie_message_filters::Sequencer< Inputs >::reset ( )
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.

◆ set_max_delay()

template<class... Inputs>
void fkie_message_filters::Sequencer< Inputs >::set_max_delay ( const ros::Duration max_delay)
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 message

Definition at line 40 of file sequencer_impl.h.

Member Data Documentation

◆ cutoff_

template<class... Inputs>
ros::Time fkie_message_filters::Sequencer< Inputs >::cutoff_
private

Definition at line 80 of file sequencer.h.

◆ max_delay_

template<class... Inputs>
ros::Duration fkie_message_filters::Sequencer< Inputs >::max_delay_
private

Definition at line 79 of file sequencer.h.

◆ mutex_

template<class... Inputs>
std::mutex fkie_message_filters::Sequencer< Inputs >::mutex_
private

Definition at line 78 of file sequencer.h.

◆ queue_

template<class... Inputs>
Queue fkie_message_filters::Sequencer< Inputs >::queue_
private

Definition at line 81 of file sequencer.h.


The documentation for this class was generated from the following files:


fkie_message_filters
Author(s): Timo Röhling
autogenerated on Mon Feb 28 2022 22:21:44