YAMS
Yet Another Mechanism System
Loading...
Searching...
No Matches
Public Member Functions | List of all members
yams::telemetry::SmartMotorControllerTelemetry Class Reference

#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 ()
 

Detailed Description

Telemetry coordinator for a SmartMotorController.

Owns all DoubleTelemetry and BooleanTelemetry pub/sub handles. Call SetupTelemetry() once during initialization, then Publish() and ApplyTuningValues() each loop.

Member Function Documentation

◆ ApplyTuningValues()

void yams::telemetry::SmartMotorControllerTelemetry::ApplyTuningValues ( motorcontrollers::SmartMotorController &  smc)

Read tunable fields from NetworkTables and apply changed values to smc.

Parameters
smcMotor controller to tune.

◆ Close()

void yams::telemetry::SmartMotorControllerTelemetry::Close ( )

Release all NT4 pub/sub handles.

◆ Publish()

void yams::telemetry::SmartMotorControllerTelemetry::Publish ( motorcontrollers::SmartMotorController &  smc)

Publish current motor controller state to NetworkTables / DataLog.

Parameters
smcMotor controller to read from.

◆ SetupTelemetry()

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.

Parameters
smcMotor controller whose fields drive which entries are enabled.
publishTableNT4 table for read-only sensor data.
tuningTableNT4 table for live-tunable gains.
doubleFieldsConfigured DoubleTelemetry map from SmartMotorControllerTelemetryConfig.
boolFieldsConfigured BooleanTelemetry map from SmartMotorControllerTelemetryConfig.
nt4EnabledWhether to publish to NT4.
dataLogNameOptional DataLog prefix.

◆ StopTuning()

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.

Parameters
smcSmartMotorController being tuned.

◆ TuningEnabled()

bool yams::telemetry::SmartMotorControllerTelemetry::TuningEnabled ( ) const

True if any live-setpoint tuning fields are enabled.


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