|
YAMS
Yet Another Mechanism System
|
#include <SmartMotorControllerTelemetry.hpp>
Public Member Functions | |
| void | SetupTelemetry (motorcontrollers::SmartMotorController &smc, std::shared_ptr< wpi::nt::NetworkTable > publishTable, std::shared_ptr< wpi::nt::NetworkTable > tuningTable, std::unordered_map< DoubleTelemetryField, DoubleTelemetry< DoubleTelemetryField > > &doubleFields, std::unordered_map< BooleanTelemetryField, BooleanTelemetry< BooleanTelemetryField > > &boolFields, bool nt4Enabled, std::optional< std::string > dataLogName) |
| void | Publish (motorcontrollers::SmartMotorController &smc) |
| void | ApplyTuningValues (motorcontrollers::SmartMotorController &smc) |
| void | StopTuning (motorcontrollers::SmartMotorController &smc) |
| bool | TuningEnabled () const |
| void | Close () |
Telemetry coordinator for a SmartMotorController.
Owns all DoubleTelemetry and BooleanTelemetry pub/sub handles. Call SetupTelemetry() once during initialization, then Publish() and ApplyTuningValues() each loop.
| void yams::telemetry::SmartMotorControllerTelemetry::ApplyTuningValues | ( | motorcontrollers::SmartMotorController & | smc | ) |
Read tunable fields from NetworkTables and apply changed values to smc.
| smc | Motor controller to tune. |
| void yams::telemetry::SmartMotorControllerTelemetry::Close | ( | ) |
Release all NT4 pub/sub handles.
| void yams::telemetry::SmartMotorControllerTelemetry::Publish | ( | motorcontrollers::SmartMotorController & | smc | ) |
Publish current motor controller state to NetworkTables / DataLog.
| smc | Motor controller to read from. |
| void yams::telemetry::SmartMotorControllerTelemetry::SetupTelemetry | ( | motorcontrollers::SmartMotorController & | smc, |
| std::shared_ptr< wpi::nt::NetworkTable > | publishTable, | ||
| std::shared_ptr< wpi::nt::NetworkTable > | tuningTable, | ||
| std::unordered_map< DoubleTelemetryField, DoubleTelemetry< DoubleTelemetryField > > & | doubleFields, | ||
| std::unordered_map< BooleanTelemetryField, BooleanTelemetry< BooleanTelemetryField > > & | boolFields, | ||
| bool | nt4Enabled, | ||
| std::optional< std::string > | dataLogName | ||
| ) |
Initialize telemetry pub/sub using the supplied tables and config.
| smc | Motor controller whose fields drive which entries are enabled. |
| publishTable | NT4 table for read-only sensor data. |
| tuningTable | NT4 table for live-tunable gains. |
| doubleFields | Configured DoubleTelemetry map from SmartMotorControllerTelemetryConfig. |
| boolFields | Configured BooleanTelemetry map from SmartMotorControllerTelemetryConfig. |
| nt4Enabled | Whether to publish to NT4. |
| dataLogName | Optional DataLog prefix. |
| void yams::telemetry::SmartMotorControllerTelemetry::StopTuning | ( | motorcontrollers::SmartMotorController & | smc | ) |
Stop live tuning, as when the "Live Tuning" command ends. A tuning voltage stops and the closed-loop controller holds the setpoint again. The voltage is turned off in the Tuning table too, so it is not applied again as soon as live tuning starts again.
| smc | SmartMotorController being tuned. |
| bool yams::telemetry::SmartMotorControllerTelemetry::TuningEnabled | ( | ) | const |
True if any live-setpoint tuning fields are enabled.