upkie 6.1.0
Open-source wheeled biped robots
Loading...
Searching...
No Matches
upkie::cpp::observers::ObserverPipeline Class Reference

Observer pipeline. More...

#include <ObserverPipeline.h>

Public Member Functions

void reset (const Dictionary &config)
 Reset observers. More...
 
void connect_sensor (std::shared_ptr< Sensor > sensor)
 Add a sensor at the beginning of the pipeline. More...
 
void append_observer (std::shared_ptr< Observer > observer)
 Append an observer at the end of the pipeline. More...
 
std::vector< std::shared_ptr< Sensor > > & sensors ()
 Sensors of the pipeline.
 
size_t nb_sensors ()
 Number of sensors in the pipeline.
 
std::vector< std::shared_ptr< Observer > > & observers ()
 Observers of the pipeline. Order matters.
 
size_t nb_observers ()
 Number of observers in the pipeline.
 
void run (Dictionary &observation)
 Run observer pipeline on an observation dictionary. More...
 

Detailed Description

Observer pipeline.

An observer pipeline is a list of sensors and observers, to be executed in that order. Observers further down the pipeline may depend on the results of those that precede them, which are written to the observation dictionary. The pipeline is thus assumed to be topologically sorted.

Member Function Documentation

◆ append_observer()

void upkie::cpp::observers::ObserverPipeline::append_observer ( std::shared_ptr< Observer observer)
inline

Append an observer at the end of the pipeline.

Parameters
observerObserver to append.

◆ connect_sensor()

void upkie::cpp::observers::ObserverPipeline::connect_sensor ( std::shared_ptr< Sensor sensor)
inline

Add a sensor at the beginning of the pipeline.

Parameters
[in]sensorSensor to append.
Note
Contrary to observers, the order in which sensors are executed is not guaranteed. If a sensor needs to run after another, consider splitting it into one sensor and one observer.

◆ reset()

void upkie::cpp::observers::ObserverPipeline::reset ( const Dictionary &  config)

Reset observers.

Parameters
[in]configOverall configuration dictionary.

◆ run()

void upkie::cpp::observers::ObserverPipeline::run ( Dictionary &  observation)

Run observer pipeline on an observation dictionary.

Parameters
[in,out]observationObservation dictionary.

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