|
YAMS
Yet Another Mechanism System
|
#include <SmartMotorControllerTelemetry.hpp>
Public Member Functions | |
| DoubleTelemetry (std::string key, double defaultVal, F field, bool tunable, std::string unit) | |
| void | SetDefaultValue (double 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) |
| void | TransformUnit (const motorcontrollers::SmartMotorControllerConfig &cfg) |
| void | ForceSet (double value) |
| bool | Set (double value) |
| double | 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 double-valued telemetry field.
Tunable fields use a subscriber so that values changed in NetworkTables are reflected back into the motor controller via ApplyTuningValues. Read-only fields only publish.
Generic over the enum type F identifying which field this entry represents, so the same wrapper can be reused across unrelated telemetry coordinators (e.g. SmartMotorControllerTelemetry uses DoubleTelemetry<DoubleTelemetryField>, while SwerveDriveTelemetry uses its own field enum).
| F | Enum type identifying which field this telemetry entry represents. |
|
inline |
Construct a DoubleTelemetry entry.
| key | NT4 table key for this field. |
| defaultVal | Default numeric value published on startup. |
| field | Field identifier. |
| tunable | true if the field should be placed in the tuning table with a subscriber. |
| unit | Unit string embedded in the NT4 topic metadata (e.g. "amps", "volts"). |
|
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 |
Forcibly overwrite the tunable value in NetworkTables, bypassing the subscriber-must-match guard in Set(double). The next IsTunable() reports the change, as if it was made on the dashboard.
| value | Value to force. |
|
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 (e.g. to seed a limit from the config).
| 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 gains. |
|
inline |
Resolve the "tunable_*" / "position" / "velocity" unit placeholders to concrete unit strings based on whether the config uses linear (meter) or angular (degree/rotation) control.
| cfg | SmartMotorControllerConfig used to determine the active measurement space. |