|
YAMS
Yet Another Mechanism System
|
#include <StructTelemetry.hpp>
Public Member Functions | |
| StructTelemetry (std::string key, T defaultVal, F field, bool tunable) | |
| void | SetDefaultValue (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 (const T &value) |
| T | Get () const |
| bool | IsTunable () |
| void | Enable () |
| void | Disable () |
| void | Display (bool state) |
| F | GetField () const |
| bool | IsEnabled () const |
| void | Close () |
NT4 pub/sub wrapper for a single struct-encoded telemetry field.
Mirrors DoubleTelemetry/BooleanTelemetry, but is generic over both the published value type T (must satisfy wpi::StructSerializable) and the enum type F identifying which field this entry represents, so the same wrapper can be reused across unrelated telemetry coordinators (e.g. SwerveDriveTelemetry, SwerveModuleTelemetry) each with their own field enum.
| T | Struct-serializable value type being published. |
| F | Enum type identifying which field this telemetry entry represents. |
|
inline |
Construct a StructTelemetry entry.
| key | NT4 table key for this field. |
| defaultVal | Default value published on startup. |
| field | Field identifier. |
| tunable | true if the field should be placed in the tuning table with a subscriber. |
|
inline |
Release all NT4 publishers/subscribers and DataLog entries.
|
inline |
Disable this field so publishing and reading are skipped.
|
inline |
Enable or disable this field.
| state | true to enable. |
|
inline |
Enable this field so it is published / read each loop.
|
inline |
Read the current value from the subscriber (tunable) or return the default.
|
inline |
|
inline |
|
inline |
Return true if a tunable subscriber is active and the value has changed since the last call.
|
inline |
Publish a value; returns false if the field is disabled or a tunable subscriber disagrees.
| value | Value to publish. |
|
inline |
Override the default published value.
| value | New default value. |
|
inline |
Create a DataLog entry under the given prefix path.
| prefix | DataLog path prefix (a trailing "/" is added if missing). |
|
inline |
Create a read-only NT4 publisher under the data table (no tuning table).
| dataTable | NT4 table for sensor data. |
|
inline |
Create the NT4 publisher (and subscriber if tunable) under the given tables.
| dataTable | NT4 table for read-only sensor data. |
| tuningTable | NT4 table for live-tunable fields. |