Template Class ExactTime

Inheritance Relationships

Base Type

Class Documentation

template<typename ...IOs>
class ExactTime : public fkie_message_filters::combiner_policies::PolicyBase<IOs...>

Exact time policy.

This is a policy for the Combiner class. It will associate data from the connected sources when their ROS header timestamp match exactly. If an input source is not unary, only the first argument of each input will be examined to determine the timestamp.

The policy will discard unmatched data which exceeds configurable age limit or overflows the maximum queue size. The resulting timestamps will be strictly increasing if at least one of the inputs receives messages in correct temporal order. Whenever matched data is emitted, all queued inputs with older timestamps will be discarded.

The filter will not output any data at all if the time lag between two inputs is larger than the maximum permissible age, or if the time lag requires more messages to be buffered than the maximum queue size permits. By default, the filter will buffer arbitrary many messages for at most one second.

Public Types

using EmitterCB = std::function<void(OutgoingTuple&)>

Callback for assembled outputs.

using IncomingTuples = std::tuple<helpers::io_tuple_t<IOs>...>

Tuple type of incoming data tuples.

using OutgoingTuple = helpers::io_tuple_t<helpers::io_concat_t<IOs...>>

Combined tuple type for data output.

Public Functions

ExactTime()

Constructor.

Does not throw any exceptions.

ExactTime(const ExactTime &other)

Copy constructor.

ExactTime &set_max_age(const rclcpp::Duration &max_age) noexcept

Set maximum age of any data in the queue.

This is equivalent to

set_max_queue_size(0, max_age);

  • max_age maximum age

Does not throw any exceptions.

ExactTime &set_max_queue_size(std::size_t queue_size, const std::optional<rclcpp::Duration> &max_age = std::nullopt) noexcept

Set maximum queue size.

  • queue_size maximum queue size per slot (zero means unlimited)

  • max_age the maximum age of any data in the queue

Does not throw any exceptions.

Protected Types

using MaybeOutgoingTuples = std::tuple<std::optional<helpers::io_tuple_t<IOs>>...>

Tuple of outgoing tuple candidates.

This is basically a tuple of optionals, so elements can remain empty until a suitable data element has been found by the policy.

Protected Functions

template<std::size_t N>
void add(std::unique_lock<std::mutex>&, std::tuple_element_t<N, IncomingTuples>&&)

Input function.

This function will be called by the Combiner class for incoming data.

void emit(OutgoingTuple &out)

Emit data.

This returns combined data back to the Combiner class.

virtual void reset() noexcept override

Reset internal state.

This function is called by the Combiner if the filter is reset.

void set_emitter_callback(const EmitterCB&) noexcept

Set output function.

This function is called by the policy whenever it has output ready to be passed on.

Friends

friend class fkie_message_filters::Combiner