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

Base class for sensors. More...

#include <Sensor.h>

Public Member Functions

virtual ~Sensor ()
 Destructor is virtual to deallocate lists of observers properly.
 
virtual std::string prefix () const noexcept
 Prefix of output in the observation dictionary. More...
 
virtual void write (Dictionary &observation)
 Write output to a dictionary. More...
 

Detailed Description

Base class for sensors.

Sensors run before observers. They write their observations without reading other observations from the pipeline, although they may of course read data from other media (such as the file system).

Member Function Documentation

◆ prefix()

virtual std::string upkie::cpp::sensors::Sensor::prefix ( ) const
inlinevirtualnoexcept

Prefix of output in the observation dictionary.

This prefix is looked up by the spine to feed observation(prefix) to the write function.

Reimplemented in upkie::cpp::sensors::CpuTemperature, upkie::cpp::sensors::Joystick, and upkie::cpp::sensors::Keyboard.

◆ write()

virtual void upkie::cpp::sensors::Sensor::write ( Dictionary &  observation)
inlinevirtual

Write output to a dictionary.

Parameters
[out]observationDictionary to write observations to.
Note
The base class writes nothing. We put an empty function here rather than making the class abstract to be able to instantiate vectors of it.

Reimplemented in upkie::cpp::sensors::CpuTemperature, upkie::cpp::sensors::Joystick, and upkie::cpp::sensors::Keyboard.


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