YAMS
Yet Another Mechanism System
Loading...
Searching...
No Matches
yams::telemetry::StructArrayTelemetry< T, F > Class Template Reference

#include <StructArrayTelemetry.hpp>

Public Member Functions

 StructArrayTelemetry (std::string key, std::vector< T > defaultVal, F field, bool tunable)
void SetDefaultValue (std::vector< T > value)
void SetupNetworkTables (std::shared_ptr< wpi::nt::NetworkTable > dataTable, std::shared_ptr< wpi::nt::NetworkTable > tuningTable)
void SetupNetworkTable (std::shared_ptr< wpi::nt::NetworkTable > dataTable)
void SetupDataLog (const std::string &prefix)
bool Set (std::span< const T > value)
std::vector< T > Get () const
bool IsTunable ()
void Enable ()
void Disable ()
void Display (bool state)
F GetField () const
bool IsEnabled () const
void Close ()

Detailed Description

template<typename T, typename F>
class yams::telemetry::StructArrayTelemetry< T, F >

NT4 pub/sub wrapper for a struct-encoded array telemetry field.

Mirrors StructTelemetry, but publishes an array of struct-serializable values instead of a single value.

Template Parameters
TStruct-serializable array element type.
FEnum type identifying which field this telemetry entry represents.

Constructor & Destructor Documentation

◆ StructArrayTelemetry()

template<typename T, typename F>
yams::telemetry::StructArrayTelemetry< T, F >::StructArrayTelemetry ( std::string key,
std::vector< T > defaultVal,
F field,
bool tunable )
inline

Construct a StructArrayTelemetry entry.

Parameters
keyNT4 table key for this field.
defaultValDefault array value published on startup.
fieldField identifier.
tunabletrue if the field should be placed in the tuning table with a subscriber.

Member Function Documentation

◆ Close()

template<typename T, typename F>
void yams::telemetry::StructArrayTelemetry< T, F >::Close ( )
inline

Release all NT4 publishers/subscribers and DataLog entries.

◆ Disable()

template<typename T, typename F>
void yams::telemetry::StructArrayTelemetry< T, F >::Disable ( )
inline

Disable this field so publishing and reading are skipped.

◆ Display()

template<typename T, typename F>
void yams::telemetry::StructArrayTelemetry< T, F >::Display ( bool state)
inline

Enable or disable this field.

Parameters
statetrue to enable.

◆ Enable()

template<typename T, typename F>
void yams::telemetry::StructArrayTelemetry< T, F >::Enable ( )
inline

Enable this field so it is published / read each loop.

◆ Get()

template<typename T, typename F>
std::vector< T > yams::telemetry::StructArrayTelemetry< T, F >::Get ( ) const
inline

Read the current value from the subscriber (tunable) or return the default.

Returns
Current field value.

◆ GetField()

template<typename T, typename F>
F yams::telemetry::StructArrayTelemetry< T, F >::GetField ( ) const
inline
Returns
The field identifier for this entry.

◆ IsEnabled()

template<typename T, typename F>
bool yams::telemetry::StructArrayTelemetry< T, F >::IsEnabled ( ) const
inline
Returns
true if this field is currently enabled.

◆ IsTunable()

template<typename T, typename F>
bool yams::telemetry::StructArrayTelemetry< T, F >::IsTunable ( )
inline

Return true if a tunable subscriber is active and the value has changed since the last call.

Returns
true when the NT4 subscriber holds a value different from the cached value.

◆ Set()

template<typename T, typename F>
bool yams::telemetry::StructArrayTelemetry< T, F >::Set ( std::span< const T > value)
inline

Publish a value; returns false if the field is disabled or a tunable subscriber disagrees.

Parameters
valueValue to publish.
Returns
true if the value was accepted and published.

◆ SetDefaultValue()

template<typename T, typename F>
void yams::telemetry::StructArrayTelemetry< T, F >::SetDefaultValue ( std::vector< T > value)
inline

Override the default published value.

Parameters
valueNew default value.

◆ SetupDataLog()

template<typename T, typename F>
void yams::telemetry::StructArrayTelemetry< T, F >::SetupDataLog ( const std::string & prefix)
inline

Create a DataLog entry under the given prefix path.

Parameters
prefixDataLog path prefix (a trailing "/" is added if missing).

◆ SetupNetworkTable()

template<typename T, typename F>
void yams::telemetry::StructArrayTelemetry< T, F >::SetupNetworkTable ( std::shared_ptr< wpi::nt::NetworkTable > dataTable)
inline

Create a read-only NT4 publisher under the data table (no tuning table).

Parameters
dataTableNT4 table for sensor data.

◆ SetupNetworkTables()

template<typename T, typename F>
void yams::telemetry::StructArrayTelemetry< T, F >::SetupNetworkTables ( std::shared_ptr< wpi::nt::NetworkTable > dataTable,
std::shared_ptr< wpi::nt::NetworkTable > tuningTable )
inline

Create the NT4 publisher (and subscriber if tunable) under the given tables.

Parameters
dataTableNT4 table for read-only sensor data.
tuningTableNT4 table for live-tunable fields.

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