Class Synchronizer

Nested Relationships

Nested Types

Class Documentation

class Synchronizer

A sliding window buffer to collect synchronized observations. Observations are of types derived from mrpt::obs::CObservation, and must have correctly defined sensorLabel and timestamp. Different sensors must have different sensorLabel.

Observations are added to the synchronizer with add(), which inserts the observation into the sliding window buffer. Entries older than parameters.window_length are deleted.

Whenever the user wants to check if a group of synchronized observations is ready to be retrieved, the method getObservationGroup() must be called. This method takes the oldest synchronized group, returns it, and removes it from the buffer.

The user can select two policies to determine when a group of observations is complete:

  • Minimum number of observations. This is the default behavior. See parameters.minimum_observation_count.

  • A specific list of sensor labels, that is, named observations. To enable this behavior, fill in parameters.expected_observation_labels.

Public Types

using NamedObservationSet = std::map<std::string, std::shared_ptr<mrpt::obs::CObservation>>

Public Functions

Synchronizer() = default
void add(const std::shared_ptr<mrpt::obs::CObservation> &obs)

Inserts the observation into the sliding window buffer. Read Synchronizer

std::optional<NamedObservationSet> getObservationGroup()

Retrieves (and removes from the buffer) the oldest set of synchronized observations. If none is ready, std::nullopt is returned.

void clear()

Reset the buffer to an empty state

Public Members

Parameters parameters
struct Parameters

Public Functions

Parameters() = default

Public Members

double window_length = 2.0

Oldest age of observations to keep [seconds].

double synchronization_tolerance = 0.05

Max time between obs to be considered a group [s].

std::size_t minimum_observation_count = 2

read Synchronizer

std::set<std::string> expected_observation_labels

read Synchronizer