upkie 6.1.0
Open-source wheeled biped robots
Loading...
Searching...
No Matches
upkie::cpp::observers::HistoryObserver< T > Class Template Reference

Report high-frequency history vectors to lower-frequency agents. More...

#include <HistoryObserver.h>

Public Member Functions

 HistoryObserver (const std::vector< std::string > &keys, size_t size, const T &default_value)
 Initialize observer. More...
 
std::string prefix () const noexcept final
 Prefix of outputs in the observation dictionary. More...
 
void reset (const Dictionary &config) final
 Reset observer. More...
 
void read (const Dictionary &observation) final
 Read inputs from other observations. More...
 
void write (Dictionary &observation) final
 Write outputs, called if reading was successful. More...
 
- Public Member Functions inherited from upkie::cpp::observers::Observer
virtual ~Observer ()
 Destructor is virtual to deallocate lists of observers properly.
 
virtual std::string prefix () const noexcept
 Prefix of outputs in the observation dictionary. More...
 
virtual void reset (const Dictionary &config)
 Reset observer. More...
 
virtual void read (const Dictionary &observation)
 Read inputs from other observations. More...
 
virtual void write (Dictionary &observation)
 Write outputs, called if reading was successful. More...
 

Detailed Description

template<typename T>
class upkie::cpp::observers::HistoryObserver< T >

Report high-frequency history vectors to lower-frequency agents.

This observer allows processing higher-frequency signals from the spine as vectors of observations reported to lower-frequency agents.

Constructor & Destructor Documentation

◆ HistoryObserver()

template<typename T >
upkie::cpp::observers::HistoryObserver< T >::HistoryObserver ( const std::vector< std::string > &  keys,
size_t  size,
const T &  default_value 
)
inline

Initialize observer.

Parameters
[in]keysList of keys to read values from in input observations.
[in]sizeSize of the history vector.
[in]default_valueValue to initialize history vectors.

Member Function Documentation

◆ prefix()

template<typename T >
std::string upkie::cpp::observers::HistoryObserver< T >::prefix ( ) const
inlinefinalvirtualnoexcept

Prefix of outputs in the observation dictionary.

Reimplemented from upkie::cpp::observers::Observer.

◆ read()

template<typename T >
void upkie::cpp::observers::HistoryObserver< T >::read ( const Dictionary &  observation)
inlinefinalvirtual

Read inputs from other observations.

Parameters
[in]observationDictionary to read other observations from.

Reimplemented from upkie::cpp::observers::Observer.

◆ reset()

template<typename T >
void upkie::cpp::observers::HistoryObserver< T >::reset ( const Dictionary &  config)
inlinefinalvirtual

Reset observer.

Parameters
[in]configConfiguration dictionary.

Reimplemented from upkie::cpp::observers::Observer.

◆ write()

template<typename T >
void upkie::cpp::observers::HistoryObserver< T >::write ( Dictionary &  observation)
inlinefinalvirtual

Write outputs, called if reading was successful.

Parameters
[out]observationDictionary to write observations to.

Reimplemented from upkie::cpp::observers::Observer.


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