gramods
Loading...
Searching...
No Matches
gramods::gmTrack::TimeSampleTracker< TYPE > Class Template Reference

This tracker reports states as specified in the samples of the node. More...

#include <TimeSampleTracker.hh>

Inheritance diagram for gramods::gmTrack::TimeSampleTracker< TYPE >:
Collaboration diagram for gramods::gmTrack::TimeSampleTracker< TYPE >:

Classes

struct  Impl

Public Member Functions

void addTime (double seconds)
 Adds a time sample in seconds, from the start of the program.
void addKey (std::string key)
 Adds an key string for a sample.
void addValue (TYPE state)
 Adds the value for a sample.
void addKeyValue (std::string key, TYPE value)
std::optional< typename TrackerBase< TYPE >::State > get () override
Public Member Functions inherited from gramods::gmTrack::TrackerBase< TYPE >
std::string getDefaultKey () override
 Returns the default key, in Configuration, for the Object, i.e.
Public Member Functions inherited from gramods::gmCore::Object
 Object ()
 Initializes internal data.
virtual ~Object ()
 Cleaning up internal data.
virtual void initialize ()
 Called to initialize the Object.
virtual void accept (Visitor *visitor)
 Calls the visitors apply method with this as argument.
virtual void traverse (Visitor *visitor)
 Calls the child Object's accept method, if such exist.
bool isInitialized ()
 Returns true if the Object is initialized.

Protected Attributes

std::unique_ptr< Impl > _impl

Additional Inherited Members

Public Types inherited from gramods::gmTrack::TrackerBase< TYPE >
typedef std::chrono::steady_clock clock
typedef std::unordered_map< std::string, Sample > State
 Type of the tracker state.
Static Public Member Functions inherited from gramods::gmTrack::TrackerBase< TYPE >
static void merge (std::optional< State > &A, std::optional< State > B)
 Merges the two specified states.

Detailed Description

template<class TYPE>
class gramods::gmTrack::TimeSampleTracker< TYPE >

This tracker reports states as specified in the samples of the node.

The samples can be either timed or time-less. For time-less samples no time can be specified and the key and states are either specified in pairs (key1, state1, key2, state2, ...) or one key for all states (key, state1, state2, ...). For timed samples, either specify one key and then one state for each time (key, state1, time1, state2, time2, ...) or one key for each sample (keyA, sampleA1, keyB, sampleB1, time1, keyA, sampleA2, keyB, sampleB2, ...).

Interpolatable samples (e.g. float) are interpolated between a sample and the next, while boolean states are left constant until the next sample.

Member Function Documentation

◆ addKey()

template<class TYPE>
void gramods::gmTrack::TimeSampleTracker< TYPE >::addKey ( std::string key)

Adds an key string for a sample.

This is a string associated with an input, e.g. "main_button". Use addTime ("time" in XML) to set a time and add the sample.

XML-attribute: <BinaryTimeSampleTracker key
XML-attribute: <FloatTimeSampleTracker key
XML-attribute: <Float2TimeSampleTracker key
XML-attribute: <PoseTimeSampleTracker key

◆ addTime()

template<class TYPE>
void gramods::gmTrack::TimeSampleTracker< TYPE >::addTime ( double seconds)

Adds a time sample in seconds, from the start of the program.

First add keys and states and then specify the time for the sample containing those key states.

XML-attribute: <BinaryTimeSampleTracker time
XML-attribute: <FloatTimeSampleTracker time
XML-attribute: <Float2TimeSampleTracker time
XML-attribute: <PoseTimeSampleTracker time

◆ addValue()

template<class TYPE>
void gramods::gmTrack::TimeSampleTracker< TYPE >::addValue ( TYPE state)

Adds the value for a sample.

Use addTime ("time" in XML) to set a time and add the sample.

XML-attribute: <BinaryTimeSampleTracker value
XML-attribute: <FloatTimeSampleTracker value
XML-attribute: <Float2TimeSampleTracker value
XML-attribute: <PoseTimeSampleTracker value

◆ get()

template<class TYPE>
std::optional< typename TrackerBase< TYPE >::State > gramods::gmTrack::TimeSampleTracker< TYPE >::get ( )
overridevirtual

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