Template Class Sequencer
Defined in File sequencer.hpp
Inheritance Relationships
Base Type
public fkie_message_filters::Filter< IO< Inputs... >, IO< Inputs... > >(Template Class Filter)
Class Documentation
-
template<class ...Inputs>
class Sequencer : public fkie_message_filters::Filter<IO<Inputs...>, IO<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.
Public Types
-
using Input = IO<Inputs...>
Grouped input types.
This type can be used to define sources with matching types.
-
using Input = IO<Inputs...>
Grouped input types.
This type can be used to define sources with matching types.
-
using Output = IO<Outputs...>
Grouped output types.
This type can be used to define sinks with matching types.
-
using Output = IO<Outputs...>
Grouped output types.
This type can be used to define sinks with matching types.
Public Functions
-
explicit Sequencer(const rclcpp::Duration &max_delay = rclcpp::Duration(1, 0)) noexcept
Constructor.
max_delaythe maximum delay of any message
Does not throw any exceptions.
-
Connection connect_to_sink(Sink<Outputs...> &dst) noexcept
Connect this source to a sink.
Can be called multiple times to connect multiple sinks; in that case, the sinks receive data in the same order as they have been connected. This function does basically the same thing as Sink::connect_to_source(), only from the opposite point of view.
dstthe sink that is to be connected
Does not throw any exceptions.
- Returns:
a connection object that can be used to monitor or sever the created connection
-
Connection connect_to_sink(Sink<Outputs...> &dst) noexcept
Connect this source to a sink.
Can be called multiple times to connect multiple sinks; in that case, the sinks receive data in the same order as they have been connected. This function does basically the same thing as Sink::connect_to_source(), only from the opposite point of view.
dstthe sink that is to be connected
Does not throw any exceptions.
- Returns:
a connection object that can be used to monitor or sever the created connection
-
Connection connect_to_source(Source<Inputs...> &src) noexcept
Connect this sink to a source.
Can be called multiple times to connect multiple sources; in that case, the sink receives data from all connected sources. This function does basically the same thing as Source::connect_to_sink(), only from the opposite point of view.
srcthe source that is to be connected
Does not throw any exceptions.
- Returns:
a connection object that can be used to monitor or sever the created connection
-
Connection connect_to_source(Source<Inputs...> &src) noexcept
Connect this sink to a source.
Can be called multiple times to connect multiple sources; in that case, the sink receives data from all connected sources. This function does basically the same thing as Source::connect_to_sink(), only from the opposite point of view.
srcthe source that is to be connected
Does not throw any exceptions.
- Returns:
a connection object that can be used to monitor or sever the created connection
-
virtual void disconnect() noexcept override
Disconnect from all connected sources and sinks.
Convenience function that calls disconnect_from_all_sources() and disonnect_from_all_sinks().
Does not throw any exceptions.
-
void disconnect_from_all_sinks() noexcept
Disconnect from all connected sinks.
Severs the connection to all sinks, turning the send() method into a no-op.
Does not throw any exceptions.
-
void disconnect_from_all_sinks() noexcept
Disconnect from all connected sinks.
Severs the connection to all sinks, turning the send() method into a no-op.
Does not throw any exceptions.
-
void disconnect_from_all_sources() noexcept
Disconnect from all connected sources.
Severs the connection to all sources. The receive() method will not be called any more.
Does not throw any exceptions.
-
void disconnect_from_all_sources() noexcept
Disconnect from all connected sources.
Severs the connection to all sources. The receive() method will not be called any more.
Does not throw any exceptions.
-
void 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.
Does not throw any exceptions, but will propagate uncaught exceptions from filter callbacks.
-
virtual void reset() noexcept override
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.
Does not throw any exceptions.
-
void set_max_delay(const rclcpp::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_delaythe maximum delay of any message
Does not throw any exceptions.
Public Static Attributes
-
static std::size_t NUM_INPUTS
Number of input arguments.
-
static std::size_t NUM_INPUTS
Number of input arguments.
-
static std::size_t NUM_OUTPUTS
Number of output arguments.
-
static std::size_t NUM_OUTPUTS
Number of output arguments.
Protected Functions
-
virtual void receive(helpers::argument_t<Inputs>... in) override
Process incoming data.
Derived classes need to override this method to handle all data that is to be consumed by the sink.
Depends on the implementation.
-
void send(helpers::argument_t<Outputs>... out)
Pass data to all connected sinks.
outdata
Does not throw any exceptions, but will propagate uncaught exceptions from filter callbacks.
-
void send(helpers::argument_t<Outputs>... out)
Pass data to all connected sinks.
outdata
Does not throw any exceptions, but will propagate uncaught exceptions from filter callbacks.
-
using Input = IO<Inputs...>