YAMS
Yet Another Mechanism System
Loading...
Searching...
No Matches
yams::motorcontrollers::SmartMotorController Class Referenceabstract

#include <SmartMotorController.hpp>

Inheritance diagram for yams::motorcontrollers::SmartMotorController:
Collaboration diagram for yams::motorcontrollers::SmartMotorController:

Public Types

using ClosedLoopControllerSlot = SmartMotorControllerConfig::ClosedLoopControllerSlot
using MotorMode = SmartMotorControllerConfig::MotorMode
using ControlMode = SmartMotorControllerConfig::ControlMode

Public Member Functions

virtual ~SmartMotorController ()
virtual bool ApplyConfig (const SmartMotorControllerConfig &config)=0
virtual void SetupSimulation ()=0
virtual void SimIterate ()
virtual void SetSimSupplier (std::shared_ptr< SimSupplier > supplier)
SimSupplier * GetSimSupplier () const
virtual void SeedRelativeEncoder ()=0
virtual void SynchronizeRelativeEncoder ()=0
virtual void SetDutyCycle (double dutyCycle)=0
virtual double GetDutyCycle ()=0
virtual void SetVoltage (wpi::units::volt_t voltage)=0
virtual wpi::units::volt_t GetVoltage ()=0
virtual void SetPosition (wpi::units::turn_t angle)=0
virtual void SetPosition (wpi::units::meter_t distance)=0
virtual void SetVelocity (wpi::units::turns_per_second_t velocity)=0
virtual void SetVelocity (wpi::units::meters_per_second_t velocity)=0
virtual void SetVelocity (wpi::units::turns_per_second_t velocity, wpi::units::newton_t feedforwardForce)
void SetVelocity (wpi::units::meters_per_second_t velocity, wpi::units::newton_t feedforwardForce)
virtual void SetEncoderPosition (wpi::units::turn_t angle)=0
virtual void SetEncoderPosition (wpi::units::meter_t distance)=0
virtual void SetEncoderVelocity (wpi::units::turns_per_second_t velocity)=0
virtual void SetEncoderVelocity (wpi::units::meters_per_second_t velocity)=0
virtual wpi::units::turn_t GetMechanismPosition ()=0
virtual wpi::units::turns_per_second_t GetMechanismVelocity ()=0
virtual wpi::units::turn_t GetRelativeMechanismPosition ()=0
virtual wpi::units::turns_per_second_t GetRelativeMechanismVelocity ()=0
virtual wpi::units::turns_per_second_squared_t GetMechanismAcceleration ()=0
virtual wpi::units::turn_t GetRotorPosition ()=0
virtual wpi::units::turns_per_second_t GetRotorVelocity ()=0
virtual wpi::units::meter_t GetMeasurementPosition ()=0
virtual wpi::units::meters_per_second_t GetMeasurementVelocity ()=0
virtual wpi::units::meters_per_second_squared_t GetMeasurementAcceleration ()=0
virtual std::optional< wpi::units::turn_t > GetExternalEncoderMechanismPosition ()=0
virtual std::optional< wpi::units::turns_per_second_t > GetExternalEncoderMechanismVelocity ()=0
virtual std::optional< wpi::units::ampere_t > GetSupplyCurrent ()=0
virtual wpi::units::ampere_t GetStatorCurrent ()=0
virtual wpi::units::celsius_t GetTemperature ()=0
virtual wpi::math::DCMotor GetDCMotor ()=0
wpi::math::DCMotor GetMechanismDCMotor ()
void SetMechanismSimSupplier (std::shared_ptr< SimSupplier > supplier)
double GetMechanismDutyCycle (double dutyCycle)
virtual void SetZeroPower (MotorMode mode)=0
virtual void SetMotorInverted (bool inverted)=0
virtual void SetEncoderInverted (bool inverted)=0
virtual void SetKp (double kP)=0
virtual void SetKi (double kI)=0
virtual void SetKd (double kD)=0
virtual void SetFeedback (double kP, double kI, double kD)=0
virtual void SetKs (double kS)=0
virtual void SetKv (double kV)=0
virtual void SetKa (double kA)=0
virtual void SetKg (double kG)=0
virtual void SetFeedforward (double kS, double kV, double kA, double kG)=0
virtual void SetStatorCurrentLimit (wpi::units::ampere_t currentLimit)=0
virtual void SetSupplyCurrentLimit (wpi::units::ampere_t currentLimit)=0
virtual void SetClosedLoopRampRate (wpi::units::second_t rampRate)=0
virtual void SetOpenLoopRampRate (wpi::units::second_t rampRate)=0
virtual void SetMechanismUpperLimit (wpi::units::turn_t upperLimit)=0
virtual void SetMechanismLowerLimit (wpi::units::turn_t lowerLimit)=0
virtual void SetMechanismLimits (wpi::units::turn_t lower, wpi::units::turn_t upper)=0
virtual void SetMechanismLimitsEnabled (bool enabled)=0
virtual void SetMeasurementUpperLimit (wpi::units::meter_t upperLimit)=0
virtual void SetMeasurementLowerLimit (wpi::units::meter_t lowerLimit)=0
virtual void SetMotionProfileMaxVelocity (wpi::units::turns_per_second_t maxVelocity)=0
virtual void SetMotionProfileMaxVelocity (wpi::units::meters_per_second_t maxVelocity)=0
virtual void SetMotionProfileMaxAcceleration (wpi::units::turns_per_second_squared_t maxAcc)=0
virtual void SetMotionProfileMaxAcceleration (wpi::units::meters_per_second_squared_t maxAcc)=0
virtual void SetMotionProfileMaxJerk (wpi::units::angular_jerk::turns_per_second_cubed_t maxJerk)=0
virtual void SetExponentialProfile (std::optional< double > kV, std::optional< double > kA, std::optional< wpi::units::volt_t > maxInput)=0
virtual void SetClosedLoopSlot (ClosedLoopControllerSlot slot)=0
virtual void SetMechanismGearing (const gearing::MechanismGearing &gearing)
virtual void SetMechanismCircumference (wpi::units::meter_t circumference)
wpi::units::second_t GetClosedLoopControllerPeriod () const
virtual std::optional< wpi::units::second_t > GetVelocityMeasurementDelay () const
void StartClosedLoopController ()
void StopClosedLoopController ()
bool IsClosedLoopControllerStopped () const
math::LQRController * GetLQRController ()
math::ADRCController * GetADRCController ()
void IterateClosedLoopController ()
void SetupTelemetry (std::shared_ptr< wpi::nt::NetworkTable > dataTable, std::shared_ptr< wpi::nt::NetworkTable > tuningTable)
void SetupTelemetry ()
void SetupLiveTuning ()
void UpdateTelemetry ()
bool TuningEnabled () const
void ApplyTuningValues ()
void StopLiveTuning ()
const std::vector< SmartMotorController * > & GetLooselyCoupledFollowers () const
void AddCloseHook (std::function< void()> hook)
SmartMotorController & WithTelemetry (telemetry::SmartMotorControllerTelemetryConfig config)
virtual telemetry::UnsupportedTelemetryFields GetUnsupportedTelemetryFields ()
ClosedLoopControllerSlot GetClosedLoopControllerSlot () const
std::optional< wpi::units::turn_t > GetMechanismPositionSetpoint () const
std::optional< wpi::units::turns_per_second_t > GetMechanismSetpointVelocity () const
std::optional< wpi::units::meter_t > GetMeasurementPositionSetpoint () const
std::optional< wpi::units::meters_per_second_t > GetMeasurementSetpointVelocity () const
std::optional< wpi::units::newton_t > GetSetpointFeedforwardForce () const
virtual SmartMotorControllerConfig & GetConfig ()=0
virtual void * GetMotorController ()=0
virtual void * GetMotorControllerConfig ()=0
std::string GetName () const
bool IsMotor (const wpi::math::DCMotor &a, const wpi::math::DCMotor &b) const
void CheckConfigSafety ()
void Close ()

Protected Member Functions

 SmartMotorController ()
void LoadLooselyCoupledFollowers ()
void Follow (SmartMotorController &leader, bool inverted)
double CalculateSimDutyCycle (double dutyCycle)
void ConfigureSoftwarePID (const SmartMotorControllerConfig &config)
void ForwardPositionToFollowers (wpi::units::turn_t pos)
void ForwardPositionToFollowers (wpi::units::meter_t dist)
void ForwardVelocityToFollowers (wpi::units::turns_per_second_t vel)
void ForwardVelocityToFollowers (wpi::units::meters_per_second_t vel)
bool UsesSystemCoreController () const
void ApplyADRCConfig (const SmartMotorControllerConfig &config)
const void * BatterySimKey () const

Protected Attributes

SmartMotorControllerConfig * m_config {nullptr}
ClosedLoopControllerSlot m_slot {ClosedLoopControllerSlot::SLOT_0}
std::shared_ptr< SimSupplier > m_simSupplier
std::vector< SmartMotorController * > m_looseFollowers
bool m_iteratedByLeader {false}
bool m_simulatesMechanism {false}
std::optional< wpi::math::PIDController > m_pid
std::optional< math::LQRController > m_lqr
std::optional< math::ADRCController > m_adrc
std::optional< wpi::math::TrapezoidProfile< wpi::units::turns >::State > m_trapState
std::optional< wpi::math::ExponentialProfile< wpi::units::turns, wpi::units::volts >::State > m_expoState
std::optional< wpi::math::TrapezoidProfile< wpi::units::meters >::State > m_linearTrapState
std::optional< wpi::math::ExponentialProfile< wpi::units::meters, wpi::units::volts >::State > m_linearExpoState
std::optional< wpi::units::turn_t > m_lastClosedLoopMechanismPosition
std::optional< double > m_lastClosedLoopVoltage
std::optional< wpi::units::turn_t > m_setpointPosition
std::optional< wpi::units::turns_per_second_t > m_setpointVelocity
std::optional< wpi::units::newton_t > m_setpointFeedforwardForce
std::vector< std::function< void()> > m_closeHooks
std::unique_ptr< wpi::Notifier > m_closedLoopControllerThread
bool m_closedLoopControllerRunning {false}
std::shared_ptr< wpi::nt::NetworkTable > m_parentTable
std::shared_ptr< wpi::nt::NetworkTable > m_telemetryTable
std::shared_ptr< wpi::nt::NetworkTable > m_tuningTable
telemetry::SmartMotorControllerTelemetry m_telemetry
telemetry::SmartMotorControllerTelemetryConfig m_telemetryConfig
bool m_telemetryConfigExplicit {false}
std::shared_ptr< telemetry::SmartMotorControllerTelemetryConfig > m_specifiedTelemetryConfig
bool m_liveTuningRegistered {false}
bool m_closed {false}

Static Protected Attributes

static constexpr double kClosedLoopRampFullScaleVolts = 12.0

Detailed Description

Abstract base class for all YAMS motor controller wrappers.

Provides a hardware-agnostic interface for open-loop control, closed-loop setpoints, encoder reads/writes, simulation, telemetry, and SysId characterization. Concrete implementations wrap CTRE TalonFX/TalonFXS and REV SPARK Max/Flex.

Member Typedef Documentation

◆ ClosedLoopControllerSlot

◆ ControlMode

◆ MotorMode

Constructor & Destructor Documentation

◆ ~SmartMotorController()

virtual yams::motorcontrollers::SmartMotorController::~SmartMotorController ( )
virtual

Calls Close() so telemetry, battery-sim state and close hooks are always released.

◆ SmartMotorController()

yams::motorcontrollers::SmartMotorController::SmartMotorController ( )
protected

Shows Rivet on the Driver Station display the first time any YAMS motor controller is built.

Member Function Documentation

◆ AddCloseHook()

void yams::motorcontrollers::SmartMotorController::AddCloseHook ( std::function< void()> hook)

Register a hook to run when Close() is called, so helpers (e.g. live tuning) can clean up resources they registered elsewhere.

Parameters
hookCallable run once on Close().

◆ ApplyADRCConfig()

void yams::motorcontrollers::SmartMotorController::ApplyADRCConfig ( const SmartMotorControllerConfig & config)
protected

Build the ADRC for this motor's slot from the config, replacing any previous one, or clear it. The control period is the closed loop control period, the one IterateClosedLoopController runs at, so the controller's discrete model cannot drift from the loop that steps it. Each wrapper calls this when a config is applied.

Parameters
configConfig being applied.
Exceptions
exceptions::SmartMotorControllerConfigurationExceptionif the ADRC config cannot build a controller.

◆ ApplyConfig()

virtual bool yams::motorcontrollers::SmartMotorController::ApplyConfig ( const SmartMotorControllerConfig & config)
pure virtual

Apply a SmartMotorControllerConfig to the underlying hardware.

Parameters
configConfiguration to apply.
Returns
true if the configuration was applied successfully.

Implemented in yams::motorcontrollers::local::A301Wrapper, yams::motorcontrollers::local::NovaWrapper, yams::motorcontrollers::local::SparkWrapper, yams::motorcontrollers::remote::TalonFXSWrapper, and yams::motorcontrollers::remote::TalonFXWrapper.

◆ ApplyTuningValues()

void yams::motorcontrollers::SmartMotorController::ApplyTuningValues ( )

Apply the live-tuned values from the Tuning NetworkTable to this motor controller.

Throws SmartMotorControllerConfigurationException if the control mode is not CLOSED_LOOP.

◆ BatterySimKey()

const void * yams::motorcontrollers::SmartMotorController::BatterySimKey ( ) const
inlineprotected

Key this controller's current draw is tracked under in simulation::BatterySim. Sim suppliers built from this controller use the same key.

Returns
Battery simulation key.

◆ CalculateSimDutyCycle()

double yams::motorcontrollers::SmartMotorController::CalculateSimDutyCycle ( double dutyCycle)
protected

Weigh a duty cycle this motor controller applies with its loosely coupled followers' own.

◆ CheckConfigSafety()

void yams::motorcontrollers::SmartMotorController::CheckConfigSafety ( )

Validate the current configuration and throw if safety constraints are violated.

◆ Close()

void yams::motorcontrollers::SmartMotorController::Close ( )

Release resources held by this controller: stops the closed-loop thread, closes telemetry, removes this controller's current from BatterySim, and runs the close hooks. Safe to call more than once.

◆ ConfigureSoftwarePID()

void yams::motorcontrollers::SmartMotorController::ConfigureSoftwarePID ( const SmartMotorControllerConfig & config)
protected

Configure the software PID controller (m_pid) from config: continuous input over the continuous wrapping range and the closed-loop tolerance. Call in ApplyConfig() right after m_pid is (re)created; consumes the ClosedLoopTolerance and ContinuousWrapping options.

Parameters
configConfig being applied.

◆ Follow()

void yams::motorcontrollers::SmartMotorController::Follow ( SmartMotorController & leader,
bool inverted )
protected

Read the simulation of a leader whose motor model has this motor, instead of simulating it. Its current is in the leader's, so BatterySim does not count it again. Its own loosely coupled followers read the leader's simulation too.

Parameters
leaderMotor controller whose simulation has this motor. Must outlive this one's use of it.
invertedWhether this motor is inverted from the leader.

◆ ForwardPositionToFollowers() [1/2]

void yams::motorcontrollers::SmartMotorController::ForwardPositionToFollowers ( wpi::units::meter_t dist)
protected

Forward a linear position setpoint to all loosely coupled followers. Call at the end of SetPosition(meter_t) in each concrete wrapper.

◆ ForwardPositionToFollowers() [2/2]

void yams::motorcontrollers::SmartMotorController::ForwardPositionToFollowers ( wpi::units::turn_t pos)
protected

Forward a position setpoint to all loosely coupled followers. Call at the end of SetPosition(turn_t) in each concrete wrapper.

◆ ForwardVelocityToFollowers() [1/2]

void yams::motorcontrollers::SmartMotorController::ForwardVelocityToFollowers ( wpi::units::meters_per_second_t vel)
protected

Forward a linear velocity setpoint to all loosely coupled followers. Call at the end of SetVelocity(meters_per_second_t) in each concrete wrapper.

◆ ForwardVelocityToFollowers() [2/2]

void yams::motorcontrollers::SmartMotorController::ForwardVelocityToFollowers ( wpi::units::turns_per_second_t vel)
protected

Forward a velocity setpoint to all loosely coupled followers. Call at the end of SetVelocity(turns_per_second_t) in each concrete wrapper.

◆ GetADRCController()

math::ADRCController * yams::motorcontrollers::SmartMotorController::GetADRCController ( )

The ADRC running the closed loop, if the config selected one. Use it to read the estimated disturbance or states. The ADRC was written by FRC Team 8331.

Returns
The ADRC, or nullptr if the closed loop does not use one.

◆ GetClosedLoopControllerPeriod()

wpi::units::second_t yams::motorcontrollers::SmartMotorController::GetClosedLoopControllerPeriod ( ) const

Get the period the closed-loop controller runs at. A closed-loop controller run on the SystemCore, such as an LQR or an exponential profile, runs at SmartMotorControllerConfig::WithClosedLoopControlPeriod(), 20 ms by default. One run on the motor controller runs at 1 kHz.

Returns
The closed-loop controller's period.

◆ GetClosedLoopControllerSlot()

ClosedLoopControllerSlot yams::motorcontrollers::SmartMotorController::GetClosedLoopControllerSlot ( ) const

Get the active closed-loop gain slot.

Returns
Current ClosedLoopControllerSlot.

◆ GetConfig()

virtual SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorController::GetConfig ( )
pure virtual

◆ GetDCMotor()

virtual wpi::math::DCMotor yams::motorcontrollers::SmartMotorController::GetDCMotor ( )
pure virtual

◆ GetDutyCycle()

virtual double yams::motorcontrollers::SmartMotorController::GetDutyCycle ( )
pure virtual

◆ GetExternalEncoderMechanismPosition()

virtual std::optional< wpi::units::turn_t > yams::motorcontrollers::SmartMotorController::GetExternalEncoderMechanismPosition ( )
pure virtual

Get the mechanism position from the external (absolute) encoder (applies the external encoder gearing). Available whether or not the external encoder is used for feedback.

Returns
Mechanism position in turns from the external encoder, or empty if none is attached.

Implemented in yams::motorcontrollers::local::A301Wrapper, yams::motorcontrollers::local::NovaWrapper, yams::motorcontrollers::local::SparkWrapper, yams::motorcontrollers::remote::TalonFXSWrapper, and yams::motorcontrollers::remote::TalonFXWrapper.

◆ GetExternalEncoderMechanismVelocity()

virtual std::optional< wpi::units::turns_per_second_t > yams::motorcontrollers::SmartMotorController::GetExternalEncoderMechanismVelocity ( )
pure virtual

Get the mechanism velocity from the external (absolute) encoder (applies the external encoder gearing). Available whether or not the external encoder is used for feedback.

Returns
Mechanism velocity in turns per second from the external encoder, or empty if none is attached.

Implemented in yams::motorcontrollers::local::A301Wrapper, yams::motorcontrollers::local::NovaWrapper, yams::motorcontrollers::local::SparkWrapper, yams::motorcontrollers::remote::TalonFXSWrapper, and yams::motorcontrollers::remote::TalonFXWrapper.

◆ GetLooselyCoupledFollowers()

const std::vector< SmartMotorController * > & yams::motorcontrollers::SmartMotorController::GetLooselyCoupledFollowers ( ) const
inline

Get the loosely coupled followers, which are sent the leader's setpoints and run their own closed-loop controllers.

Returns
The loosely coupled followers, empty if there are none.

◆ GetLQRController()

math::LQRController * yams::motorcontrollers::SmartMotorController::GetLQRController ( )

The LQR this motor controller runs, which live tuning retunes.

Returns
The LQR controller, or nullptr if it isn't configured with one.

◆ GetMeasurementAcceleration()

virtual wpi::units::meters_per_second_squared_t yams::motorcontrollers::SmartMotorController::GetMeasurementAcceleration ( )
pure virtual

◆ GetMeasurementPosition()

virtual wpi::units::meter_t yams::motorcontrollers::SmartMotorController::GetMeasurementPosition ( )
pure virtual

◆ GetMeasurementPositionSetpoint()

std::optional< wpi::units::meter_t > yams::motorcontrollers::SmartMotorController::GetMeasurementPositionSetpoint ( ) const

Get the last commanded linear measurement position setpoint. Converts the internal mechanism-angle setpoint using the configured circumference.

Returns
Optional linear position setpoint, or empty if no setpoint has been commanded or no circumference is configured.

◆ GetMeasurementSetpointVelocity()

std::optional< wpi::units::meters_per_second_t > yams::motorcontrollers::SmartMotorController::GetMeasurementSetpointVelocity ( ) const

Get the last commanded linear measurement velocity setpoint. Converts the internal mechanism-velocity setpoint using the configured circumference.

Returns
Optional linear velocity setpoint, or empty if no setpoint has been commanded or no circumference is configured.

◆ GetMeasurementVelocity()

virtual wpi::units::meters_per_second_t yams::motorcontrollers::SmartMotorController::GetMeasurementVelocity ( )
pure virtual

Get the linear measurement velocity (applies circumference conversion).

Returns
Linear velocity in meters per second.

Implemented in yams::motorcontrollers::local::A301Wrapper, yams::motorcontrollers::local::NovaWrapper, yams::motorcontrollers::local::SparkWrapper, yams::motorcontrollers::remote::TalonFXSWrapper, and yams::motorcontrollers::remote::TalonFXWrapper.

◆ GetMechanismAcceleration()

virtual wpi::units::turns_per_second_squared_t yams::motorcontrollers::SmartMotorController::GetMechanismAcceleration ( )
pure virtual

◆ GetMechanismDCMotor()

wpi::math::DCMotor yams::motorcontrollers::SmartMotorController::GetMechanismDCMotor ( )

Get the motors of the mechanism this motor controller drives: its own GetDCMotor() and its loosely coupled followers', except those already given a mechanism of their own. A mechanism simulates every motor with it. A follower's torque is given at this motor's rotor, from the gearing of each, and the free speed is this motor's.

Returns
DCMotor of every motor on the mechanism.

◆ GetMechanismDutyCycle()

double yams::motorcontrollers::SmartMotorController::GetMechanismDutyCycle ( double dutyCycle)

Get the duty cycle the motors of this motor controller's simulation apply. A mechanism's simulation has its loosely coupled followers' motors too, and each motor controller applies its own output, as its vendor simulation limits it, so this is each one's duty cycle weighted by its share of GetMechanismDCMotor()'s torque. Otherwise it is the given duty cycle.

Parameters
dutyCycleDuty cycle this motor controller applies.
Returns
Duty cycle of every motor in its simulation.

◆ GetMechanismPosition()

virtual wpi::units::turn_t yams::motorcontrollers::SmartMotorController::GetMechanismPosition ( )
pure virtual

Get the mechanism position (applies gearing). Uses the external (absolute) encoder when one is configured with SmartMotorControllerConfig::WithUseExternalFeedbackEncoder(), otherwise the relative encoder. Use GetRelativeMechanismPosition() to only read the relative encoder.

Returns
Mechanism position in turns.

Implemented in yams::motorcontrollers::local::A301Wrapper, yams::motorcontrollers::local::NovaWrapper, yams::motorcontrollers::local::SparkWrapper, yams::motorcontrollers::remote::TalonFXSWrapper, and yams::motorcontrollers::remote::TalonFXWrapper.

◆ GetMechanismPositionSetpoint()

std::optional< wpi::units::turn_t > yams::motorcontrollers::SmartMotorController::GetMechanismPositionSetpoint ( ) const

Get the last commanded mechanism position setpoint.

Returns
Optional mechanism angle setpoint.

◆ GetMechanismSetpointVelocity()

std::optional< wpi::units::turns_per_second_t > yams::motorcontrollers::SmartMotorController::GetMechanismSetpointVelocity ( ) const

Get the last commanded mechanism velocity setpoint.

Returns
Optional mechanism angular velocity setpoint.

◆ GetMechanismVelocity()

virtual wpi::units::turns_per_second_t yams::motorcontrollers::SmartMotorController::GetMechanismVelocity ( )
pure virtual

Get the mechanism velocity (applies gearing). Uses the external (absolute) encoder when one is configured with SmartMotorControllerConfig::WithUseExternalFeedbackEncoder(), otherwise the relative encoder. Use GetRelativeMechanismVelocity() to only read the relative encoder.

Returns
Mechanism velocity in turns per second.

Implemented in yams::motorcontrollers::local::A301Wrapper, yams::motorcontrollers::local::NovaWrapper, yams::motorcontrollers::local::SparkWrapper, yams::motorcontrollers::remote::TalonFXSWrapper, and yams::motorcontrollers::remote::TalonFXWrapper.

◆ GetMotorController()

virtual void * yams::motorcontrollers::SmartMotorController::GetMotorController ( )
pure virtual

Get a type-erased pointer to the underlying hardware motor controller object.

Returns
void* that can be cast to the concrete motor controller type.

Implemented in yams::motorcontrollers::local::A301Wrapper, yams::motorcontrollers::local::NovaWrapper, yams::motorcontrollers::local::SparkWrapper, yams::motorcontrollers::remote::TalonFXSWrapper, and yams::motorcontrollers::remote::TalonFXWrapper.

◆ GetMotorControllerConfig()

virtual void * yams::motorcontrollers::SmartMotorController::GetMotorControllerConfig ( )
pure virtual

Get a type-erased pointer to the underlying hardware configuration object.

Returns
void* that can be cast to the concrete motor controller config type.

Implemented in yams::motorcontrollers::local::A301Wrapper, yams::motorcontrollers::local::NovaWrapper, yams::motorcontrollers::local::SparkWrapper, yams::motorcontrollers::remote::TalonFXSWrapper, and yams::motorcontrollers::remote::TalonFXWrapper.

◆ GetName()

std::string yams::motorcontrollers::SmartMotorController::GetName ( ) const

Get the telemetry name of this motor controller.

Returns
Name string from the configuration.

◆ GetRelativeMechanismPosition()

virtual wpi::units::turn_t yams::motorcontrollers::SmartMotorController::GetRelativeMechanismPosition ( )
pure virtual

Get the mechanism position from the relative encoder in the motor (applies gearing). Never uses the external (absolute) encoder.

Returns
Mechanism position in turns from the relative encoder.

Implemented in yams::motorcontrollers::local::A301Wrapper, yams::motorcontrollers::local::NovaWrapper, yams::motorcontrollers::local::SparkWrapper, yams::motorcontrollers::remote::TalonFXSWrapper, and yams::motorcontrollers::remote::TalonFXWrapper.

◆ GetRelativeMechanismVelocity()

virtual wpi::units::turns_per_second_t yams::motorcontrollers::SmartMotorController::GetRelativeMechanismVelocity ( )
pure virtual

Get the mechanism velocity from the relative encoder in the motor (applies gearing). Never uses the external (absolute) encoder.

Returns
Mechanism velocity in turns per second from the relative encoder.

Implemented in yams::motorcontrollers::local::A301Wrapper, yams::motorcontrollers::local::NovaWrapper, yams::motorcontrollers::local::SparkWrapper, yams::motorcontrollers::remote::TalonFXSWrapper, and yams::motorcontrollers::remote::TalonFXWrapper.

◆ GetRotorPosition()

virtual wpi::units::turn_t yams::motorcontrollers::SmartMotorController::GetRotorPosition ( )
pure virtual

◆ GetRotorVelocity()

virtual wpi::units::turns_per_second_t yams::motorcontrollers::SmartMotorController::GetRotorVelocity ( )
pure virtual

◆ GetSetpointFeedforwardForce()

std::optional< wpi::units::newton_t > yams::motorcontrollers::SmartMotorController::GetSetpointFeedforwardForce ( ) const

Get the feedforward force last supplied to SetVelocity(velocity, force).

Returns
Optional feedforward force.

◆ GetSimSupplier()

SimSupplier * yams::motorcontrollers::SmartMotorController::GetSimSupplier ( ) const

Get the attached SimSupplier, or nullptr if none is set.

Returns
Raw pointer to the SimSupplier (valid as long as the shared_ptr is held).

◆ GetStatorCurrent()

virtual wpi::units::ampere_t yams::motorcontrollers::SmartMotorController::GetStatorCurrent ( )
pure virtual

◆ GetSupplyCurrent()

virtual std::optional< wpi::units::ampere_t > yams::motorcontrollers::SmartMotorController::GetSupplyCurrent ( )
pure virtual

◆ GetTemperature()

virtual wpi::units::celsius_t yams::motorcontrollers::SmartMotorController::GetTemperature ( )
pure virtual

◆ GetUnsupportedTelemetryFields()

virtual telemetry::UnsupportedTelemetryFields yams::motorcontrollers::SmartMotorController::GetUnsupportedTelemetryFields ( )
virtual

Return telemetry fields not supported by this motor controller implementation.

Subclasses override this to disable fields for hardware that lacks certain signals (e.g. SPARK controllers do not expose supply current).

Returns
Struct with optional lists of unsupported boolean and double fields.

Reimplemented in yams::motorcontrollers::local::A301Wrapper, yams::motorcontrollers::local::SparkWrapper, yams::motorcontrollers::remote::TalonFXSWrapper, and yams::motorcontrollers::remote::TalonFXWrapper.

◆ GetVelocityMeasurementDelay()

virtual std::optional< wpi::units::second_t > yams::motorcontrollers::SmartMotorController::GetVelocityMeasurementDelay ( ) const
virtual

Get how far behind the mechanism the measured velocity is, from how the motor controller filters it, as WPILib's SysId works it out for its presets. Feedback gains worked out for the closed loop depend on it. In simulation, the simulation period, since the simulated sensor is updated once a period.

Returns
The delay, or nullopt if it is not known for this motor controller.

Reimplemented in yams::motorcontrollers::local::SparkWrapper, yams::motorcontrollers::remote::TalonFXSWrapper, and yams::motorcontrollers::remote::TalonFXWrapper.

◆ GetVoltage()

virtual wpi::units::volt_t yams::motorcontrollers::SmartMotorController::GetVoltage ( )
pure virtual

◆ IsClosedLoopControllerStopped()

bool yams::motorcontrollers::SmartMotorController::IsClosedLoopControllerStopped ( ) const

Whether a closed-loop controller run on the SystemCore, such as an LQR or an exponential profile, has been stopped, as a duty cycle or voltage command does. False when the closed-loop controller runs on the motor controller.

Returns
true if the SystemCore closed-loop controller is stopped.

◆ IsMotor()

bool yams::motorcontrollers::SmartMotorController::IsMotor ( const wpi::math::DCMotor & a,
const wpi::math::DCMotor & b ) const

Check whether two DCMotor models describe the same motor type.

Parameters
aFirst motor model.
bSecond motor model.
Returns
true if the models have matching electrical constants.

◆ IterateClosedLoopController()

void yams::motorcontrollers::SmartMotorController::IterateClosedLoopController ( )

Run one iteration of the closed-loop controller on the calling thread.

◆ LoadLooselyCoupledFollowers()

void yams::motorcontrollers::SmartMotorController::LoadLooselyCoupledFollowers ( )
protected

Populate m_looseFollowers from the current m_config. Call this at the end of each concrete ApplyConfig() implementation.

◆ SeedRelativeEncoder()

virtual void yams::motorcontrollers::SmartMotorController::SeedRelativeEncoder ( )
pure virtual

◆ SetClosedLoopRampRate()

virtual void yams::motorcontrollers::SmartMotorController::SetClosedLoopRampRate ( wpi::units::second_t rampRate)
pure virtual

◆ SetClosedLoopSlot()

virtual void yams::motorcontrollers::SmartMotorController::SetClosedLoopSlot ( ClosedLoopControllerSlot slot)
pure virtual

◆ SetDutyCycle()

virtual void yams::motorcontrollers::SmartMotorController::SetDutyCycle ( double dutyCycle)
pure virtual

◆ SetEncoderInverted()

virtual void yams::motorcontrollers::SmartMotorController::SetEncoderInverted ( bool inverted)
pure virtual

◆ SetEncoderPosition() [1/2]

virtual void yams::motorcontrollers::SmartMotorController::SetEncoderPosition ( wpi::units::meter_t distance)
pure virtual

◆ SetEncoderPosition() [2/2]

virtual void yams::motorcontrollers::SmartMotorController::SetEncoderPosition ( wpi::units::turn_t angle)
pure virtual

◆ SetEncoderVelocity() [1/2]

virtual void yams::motorcontrollers::SmartMotorController::SetEncoderVelocity ( wpi::units::meters_per_second_t velocity)
pure virtual

◆ SetEncoderVelocity() [2/2]

virtual void yams::motorcontrollers::SmartMotorController::SetEncoderVelocity ( wpi::units::turns_per_second_t velocity)
pure virtual

◆ SetExponentialProfile()

virtual void yams::motorcontrollers::SmartMotorController::SetExponentialProfile ( std::optional< double > kV,
std::optional< double > kA,
std::optional< wpi::units::volt_t > maxInput )
pure virtual

Configure or update the exponential motion profile parameters.

Parameters
kVOptional velocity constant (empty keeps the current value).
kAOptional acceleration constant (empty keeps the current value).
maxInputOptional maximum voltage input (empty keeps the current value).

Implemented in yams::motorcontrollers::local::A301Wrapper, yams::motorcontrollers::local::NovaWrapper, yams::motorcontrollers::local::SparkWrapper, yams::motorcontrollers::remote::TalonFXSWrapper, and yams::motorcontrollers::remote::TalonFXWrapper.

◆ SetFeedback()

virtual void yams::motorcontrollers::SmartMotorController::SetFeedback ( double kP,
double kI,
double kD )
pure virtual

Set all three PID feedback gains at once (live update).

Parameters
kPProportional gain.
kIIntegral gain.
kDDerivative gain.

Implemented in yams::motorcontrollers::local::A301Wrapper, yams::motorcontrollers::local::NovaWrapper, yams::motorcontrollers::local::SparkWrapper, yams::motorcontrollers::remote::TalonFXSWrapper, and yams::motorcontrollers::remote::TalonFXWrapper.

◆ SetFeedforward()

virtual void yams::motorcontrollers::SmartMotorController::SetFeedforward ( double kS,
double kV,
double kA,
double kG )
pure virtual

Set all four feedforward gains at once (live update).

Parameters
kSStatic friction voltage.
kVVelocity feedforward coefficient.
kAAcceleration feedforward coefficient.
kGGravity feedforward coefficient.

Implemented in yams::motorcontrollers::local::A301Wrapper, yams::motorcontrollers::local::NovaWrapper, yams::motorcontrollers::local::SparkWrapper, yams::motorcontrollers::remote::TalonFXSWrapper, and yams::motorcontrollers::remote::TalonFXWrapper.

◆ SetKa()

virtual void yams::motorcontrollers::SmartMotorController::SetKa ( double kA)
pure virtual

◆ SetKd()

virtual void yams::motorcontrollers::SmartMotorController::SetKd ( double kD)
pure virtual

◆ SetKg()

virtual void yams::motorcontrollers::SmartMotorController::SetKg ( double kG)
pure virtual

◆ SetKi()

virtual void yams::motorcontrollers::SmartMotorController::SetKi ( double kI)
pure virtual

◆ SetKp()

virtual void yams::motorcontrollers::SmartMotorController::SetKp ( double kP)
pure virtual

◆ SetKs()

virtual void yams::motorcontrollers::SmartMotorController::SetKs ( double kS)
pure virtual

◆ SetKv()

virtual void yams::motorcontrollers::SmartMotorController::SetKv ( double kV)
pure virtual

◆ SetMeasurementLowerLimit()

virtual void yams::motorcontrollers::SmartMotorController::SetMeasurementLowerLimit ( wpi::units::meter_t lowerLimit)
pure virtual

◆ SetMeasurementUpperLimit()

virtual void yams::motorcontrollers::SmartMotorController::SetMeasurementUpperLimit ( wpi::units::meter_t upperLimit)
pure virtual

◆ SetMechanismCircumference()

virtual void yams::motorcontrollers::SmartMotorController::SetMechanismCircumference ( wpi::units::meter_t circumference)
virtual

Update the mechanism circumference used for linear position/velocity conversions.

The base implementation updates the config; wrappers override it to also reconfigure the hardware.

Parameters
circumferenceNew mechanism circumference.

Reimplemented in yams::motorcontrollers::local::A301Wrapper, yams::motorcontrollers::local::NovaWrapper, yams::motorcontrollers::local::SparkWrapper, yams::motorcontrollers::remote::TalonFXSWrapper, and yams::motorcontrollers::remote::TalonFXWrapper.

◆ SetMechanismGearing()

virtual void yams::motorcontrollers::SmartMotorController::SetMechanismGearing ( const gearing::MechanismGearing & gearing)
virtual

Update the mechanism gearing used for position/velocity conversions.

The base implementation updates the config and forwards the gearing to loosely coupled followers; wrappers override it to also reconfigure the hardware.

Parameters
gearingNew mechanism gearing.

Reimplemented in yams::motorcontrollers::local::A301Wrapper, yams::motorcontrollers::local::NovaWrapper, yams::motorcontrollers::local::SparkWrapper, yams::motorcontrollers::remote::TalonFXSWrapper, and yams::motorcontrollers::remote::TalonFXWrapper.

◆ SetMechanismLimits()

virtual void yams::motorcontrollers::SmartMotorController::SetMechanismLimits ( wpi::units::turn_t lower,
wpi::units::turn_t upper )
pure virtual

◆ SetMechanismLimitsEnabled()

virtual void yams::motorcontrollers::SmartMotorController::SetMechanismLimitsEnabled ( bool enabled)
pure virtual

◆ SetMechanismLowerLimit()

virtual void yams::motorcontrollers::SmartMotorController::SetMechanismLowerLimit ( wpi::units::turn_t lowerLimit)
pure virtual

◆ SetMechanismSimSupplier()

void yams::motorcontrollers::SmartMotorController::SetMechanismSimSupplier ( std::shared_ptr< SimSupplier > supplier)

Set the simulation of the mechanism this motor controller drives, made with GetMechanismDCMotor(). Each loosely coupled follower reads it, so its encoder follows the mechanism, and its current is not counted again by BatterySim. A follower that drives a mechanism of its own must be given it first, so it is left out of this one.

Parameters
supplierSimulation of the mechanism.

◆ SetMechanismUpperLimit()

virtual void yams::motorcontrollers::SmartMotorController::SetMechanismUpperLimit ( wpi::units::turn_t upperLimit)
pure virtual

◆ SetMotionProfileMaxAcceleration() [1/2]

virtual void yams::motorcontrollers::SmartMotorController::SetMotionProfileMaxAcceleration ( wpi::units::meters_per_second_squared_t maxAcc)
pure virtual

◆ SetMotionProfileMaxAcceleration() [2/2]

virtual void yams::motorcontrollers::SmartMotorController::SetMotionProfileMaxAcceleration ( wpi::units::turns_per_second_squared_t maxAcc)
pure virtual

Set the maximum angular acceleration for the motion profile.

Parameters
maxAccMaximum mechanism angular acceleration.

Implemented in yams::motorcontrollers::local::A301Wrapper, yams::motorcontrollers::local::NovaWrapper, yams::motorcontrollers::local::SparkWrapper, yams::motorcontrollers::remote::TalonFXSWrapper, and yams::motorcontrollers::remote::TalonFXWrapper.

◆ SetMotionProfileMaxJerk()

virtual void yams::motorcontrollers::SmartMotorController::SetMotionProfileMaxJerk ( wpi::units::angular_jerk::turns_per_second_cubed_t maxJerk)
pure virtual

◆ SetMotionProfileMaxVelocity() [1/2]

virtual void yams::motorcontrollers::SmartMotorController::SetMotionProfileMaxVelocity ( wpi::units::meters_per_second_t maxVelocity)
pure virtual

◆ SetMotionProfileMaxVelocity() [2/2]

virtual void yams::motorcontrollers::SmartMotorController::SetMotionProfileMaxVelocity ( wpi::units::turns_per_second_t maxVelocity)
pure virtual

◆ SetMotorInverted()

virtual void yams::motorcontrollers::SmartMotorController::SetMotorInverted ( bool inverted)
pure virtual

◆ SetOpenLoopRampRate()

virtual void yams::motorcontrollers::SmartMotorController::SetOpenLoopRampRate ( wpi::units::second_t rampRate)
pure virtual

◆ SetPosition() [1/2]

virtual void yams::motorcontrollers::SmartMotorController::SetPosition ( wpi::units::meter_t distance)
pure virtual

◆ SetPosition() [2/2]

virtual void yams::motorcontrollers::SmartMotorController::SetPosition ( wpi::units::turn_t angle)
pure virtual

◆ SetSimSupplier()

virtual void yams::motorcontrollers::SmartMotorController::SetSimSupplier ( std::shared_ptr< SimSupplier > supplier)
virtual

Attach a SimSupplier that provides physics-model position and velocity for simulation. When set, mechanism SimIterate() calls will use this supplier instead of the internal DCMotorSim.

Parameters
supplierShared SimSupplier instance, or nullptr to detach.

Reimplemented in yams::motorcontrollers::local::NovaWrapper.

◆ SetStatorCurrentLimit()

virtual void yams::motorcontrollers::SmartMotorController::SetStatorCurrentLimit ( wpi::units::ampere_t currentLimit)
pure virtual

◆ SetSupplyCurrentLimit()

virtual void yams::motorcontrollers::SmartMotorController::SetSupplyCurrentLimit ( wpi::units::ampere_t currentLimit)
pure virtual

◆ SetupLiveTuning()

void yams::motorcontrollers::SmartMotorController::SetupLiveTuning ( )

Set up live tuning for this motor controller when its telemetry verbosity is HIGH, so the values under the Tuning table are applied while the "Live Tuning" command runs. Only sets it up once, however many times it is called.

◆ SetupSimulation()

virtual void yams::motorcontrollers::SmartMotorController::SetupSimulation ( )
pure virtual

◆ SetupTelemetry() [1/2]

void yams::motorcontrollers::SmartMotorController::SetupTelemetry ( )

Set up NetworkTables telemetry using the name configured in the SmartMotorControllerConfig.

◆ SetupTelemetry() [2/2]

void yams::motorcontrollers::SmartMotorController::SetupTelemetry ( std::shared_ptr< wpi::nt::NetworkTable > dataTable,
std::shared_ptr< wpi::nt::NetworkTable > tuningTable )

Set up NetworkTables telemetry using explicit table references.

Parameters
dataTableTable for sensor and state data.
tuningTableTable for live gain tuning entries.

◆ SetVelocity() [1/4]

virtual void yams::motorcontrollers::SmartMotorController::SetVelocity ( wpi::units::meters_per_second_t velocity)
pure virtual

◆ SetVelocity() [2/4]

void yams::motorcontrollers::SmartMotorController::SetVelocity ( wpi::units::meters_per_second_t velocity,
wpi::units::newton_t feedforwardForce )

Command a linear velocity setpoint with an additional feedforward force applied on top.

Throws SmartMotorControllerConfigurationException if the mechanism circumference is not configured.

Parameters
velocityTarget linear velocity.
feedforwardForceAdditional feedforward force at the mechanism.

◆ SetVelocity() [3/4]

virtual void yams::motorcontrollers::SmartMotorController::SetVelocity ( wpi::units::turns_per_second_t velocity)
pure virtual

◆ SetVelocity() [4/4]

virtual void yams::motorcontrollers::SmartMotorController::SetVelocity ( wpi::units::turns_per_second_t velocity,
wpi::units::newton_t feedforwardForce )
virtual

Command a mechanism angular velocity setpoint with an additional feedforward force applied on top, e.g. from a path-following set-point generator.

The force is converted to a voltage with SmartMotorControllerConfig::ConvertToVoltage and added by the RoboRIO closed-loop controller, so the mechanism circumference must be set.

Parameters
velocityTarget mechanism angular velocity.
feedforwardForceAdditional feedforward force at the mechanism.

Reimplemented in yams::motorcontrollers::local::A301Wrapper, yams::motorcontrollers::local::NovaWrapper, yams::motorcontrollers::local::SparkWrapper, yams::motorcontrollers::remote::TalonFXSWrapper, and yams::motorcontrollers::remote::TalonFXWrapper.

◆ SetVoltage()

virtual void yams::motorcontrollers::SmartMotorController::SetVoltage ( wpi::units::volt_t voltage)
pure virtual

◆ SetZeroPower()

virtual void yams::motorcontrollers::SmartMotorController::SetZeroPower ( MotorMode mode)
pure virtual

◆ SimIterate()

virtual void yams::motorcontrollers::SmartMotorController::SimIterate ( )
virtual

Advance the motor simulation by one loop iteration. Each motor controller's SimIterate() calls this last, with SmartMotorController::SimIterate(): it iterates the loosely coupled followers reading this motor controller's mechanism's simulation, which a mechanism steps right before. Each follower's iterates its own.

Reimplemented in yams::motorcontrollers::local::A301Wrapper, yams::motorcontrollers::local::NovaWrapper, yams::motorcontrollers::local::SparkWrapper, yams::motorcontrollers::remote::TalonFXSWrapper, and yams::motorcontrollers::remote::TalonFXWrapper.

◆ StartClosedLoopController()

void yams::motorcontrollers::SmartMotorController::StartClosedLoopController ( )

Start the background closed-loop controller thread, and the loosely coupled followers'. Only a stopped one is started, from where the mechanism is now: one that is already running carries on as it is, so setting a setpoint every loop doesn't reset it.

◆ StopClosedLoopController()

void yams::motorcontrollers::SmartMotorController::StopClosedLoopController ( )

Stop the background closed-loop controller thread, and the loosely coupled followers'. The followers are stopped too, as they are not sent the duty cycle or voltage the leader is driven at.

◆ StopLiveTuning()

void yams::motorcontrollers::SmartMotorController::StopLiveTuning ( )

Stop live tuning, as when the "Live Tuning" command ends. A tuning voltage stops, it is turned off in the Tuning table, and the closed-loop controller holds the setpoint again.

◆ SynchronizeRelativeEncoder()

virtual void yams::motorcontrollers::SmartMotorController::SynchronizeRelativeEncoder ( )
pure virtual

◆ TuningEnabled()

bool yams::motorcontrollers::SmartMotorController::TuningEnabled ( ) const

Whether live tuning is enabled, i.e. whether tunable setpoints are published.

Returns
true if live tuning is enabled.

◆ UpdateTelemetry()

void yams::motorcontrollers::SmartMotorController::UpdateTelemetry ( )

Publish the current sensor readings and setpoints to NetworkTables.

Does nothing unless a telemetry verbosity is configured; sets telemetry up on first use. Live-tuned values are not applied here, only by the "Live Tuning" command (or ApplyTuningValues()).

◆ UsesSystemCoreController()

bool yams::motorcontrollers::SmartMotorController::UsesSystemCoreController ( ) const
protected

Whether the closed loop controller runs on the SystemCore instead of the motor controller. An LQR and an ADRC both need the measured state every loop, so they run here. Wrappers use this to leave their onboard closed loop alone and send a plain voltage.

Returns
true when an LQR or an ADRC owns the closed loop.

◆ WithTelemetry()

SmartMotorController & yams::motorcontrollers::SmartMotorController::WithTelemetry ( telemetry::SmartMotorControllerTelemetryConfig config)

Override the telemetry configuration used when publishing data to NetworkTables.

Call before SetupTelemetry() or UpdateTelemetry() to apply fine-grained control over which fields are published.

Parameters
configSmartMotorControllerTelemetryConfig to apply.
Returns
*this for chaining.

Member Data Documentation

◆ kClosedLoopRampFullScaleVolts

double yams::motorcontrollers::SmartMotorController::kClosedLoopRampFullScaleVolts = 12.0
staticconstexprprotected

Full scale of SmartMotorControllerConfig::WithClosedLoopRampRate: the ramp rate is the time the output takes to change by this much, as on a Talon.

◆ m_adrc

std::optional<math::ADRCController> yams::motorcontrollers::SmartMotorController::m_adrc
protected

ADRC running the closed loop, when the config selects one. Written by FRC Team 8331.

◆ m_closed

bool yams::motorcontrollers::SmartMotorController::m_closed {false}
protected

◆ m_closedLoopControllerRunning

bool yams::motorcontrollers::SmartMotorController::m_closedLoopControllerRunning {false}
protected

◆ m_closedLoopControllerThread

std::unique_ptr<wpi::Notifier> yams::motorcontrollers::SmartMotorController::m_closedLoopControllerThread
protected

◆ m_closeHooks

std::vector<std::function<void()> > yams::motorcontrollers::SmartMotorController::m_closeHooks
protected

Hooks run once by Close().

◆ m_config

SmartMotorControllerConfig* yams::motorcontrollers::SmartMotorController::m_config {nullptr}
protected

Config used by this controller (owned by the caller; set by the wrapper constructor before anything else uses it).

◆ m_expoState

std::optional<wpi::math::ExponentialProfile<wpi::units::turns, wpi::units::volts>::State> yams::motorcontrollers::SmartMotorController::m_expoState
protected

◆ m_iteratedByLeader

bool yams::motorcontrollers::SmartMotorController::m_iteratedByLeader {false}
protected

Whether this motor controller reads a leader's simulation, such as a mechanism's, which the leader iterates right after it steps. Its own SimIterate() then does nothing, so it is not iterated twice in a loop.

◆ m_lastClosedLoopMechanismPosition

std::optional<wpi::units::turn_t> yams::motorcontrollers::SmartMotorController::m_lastClosedLoopMechanismPosition
protected

Mechanism position the closed-loop controller last used, unwrapped across the continuous wrapping point.

◆ m_lastClosedLoopVoltage

std::optional<double> yams::motorcontrollers::SmartMotorController::m_lastClosedLoopVoltage
protected

The voltage the closed loop sent last, which the closed loop ramp starts from; empty until it runs, and again whenever it starts over.

◆ m_linearExpoState

std::optional<wpi::math::ExponentialProfile<wpi::units::meters, wpi::units::volts>::State> yams::motorcontrollers::SmartMotorController::m_linearExpoState
protected

◆ m_linearTrapState

std::optional<wpi::math::TrapezoidProfile<wpi::units::meters>::State> yams::motorcontrollers::SmartMotorController::m_linearTrapState
protected

◆ m_liveTuningRegistered

bool yams::motorcontrollers::SmartMotorController::m_liveTuningRegistered {false}
protected

◆ m_looseFollowers

std::vector<SmartMotorController*> yams::motorcontrollers::SmartMotorController::m_looseFollowers
protected

Loosely coupled followers populated by LoadLooselyCoupledFollowers().

◆ m_lqr

std::optional<math::LQRController> yams::motorcontrollers::SmartMotorController::m_lqr
protected

◆ m_parentTable

std::shared_ptr<wpi::nt::NetworkTable> yams::motorcontrollers::SmartMotorController::m_parentTable
protected

◆ m_pid

std::optional<wpi::math::PIDController> yams::motorcontrollers::SmartMotorController::m_pid
protected

◆ m_setpointFeedforwardForce

std::optional<wpi::units::newton_t> yams::motorcontrollers::SmartMotorController::m_setpointFeedforwardForce
protected

Feedforward force applied on top of the velocity setpoint (see SetVelocity(vel, force)).

◆ m_setpointPosition

std::optional<wpi::units::turn_t> yams::motorcontrollers::SmartMotorController::m_setpointPosition
protected

◆ m_setpointVelocity

std::optional<wpi::units::turns_per_second_t> yams::motorcontrollers::SmartMotorController::m_setpointVelocity
protected

◆ m_simSupplier

std::shared_ptr<SimSupplier> yams::motorcontrollers::SmartMotorController::m_simSupplier
protected

◆ m_simulatesMechanism

bool yams::motorcontrollers::SmartMotorController::m_simulatesMechanism {false}
protected

Whether this motor controller's simulation is its mechanism's, set with SetMechanismSimSupplier, which has its loosely coupled followers' motors.

◆ m_slot

ClosedLoopControllerSlot yams::motorcontrollers::SmartMotorController::m_slot {ClosedLoopControllerSlot::SLOT_0}
protected

◆ m_specifiedTelemetryConfig

std::shared_ptr<telemetry::SmartMotorControllerTelemetryConfig> yams::motorcontrollers::SmartMotorController::m_specifiedTelemetryConfig
protected

Telemetry config given to SmartMotorControllerConfig::WithTelemetry(name, config), if any.

◆ m_telemetry

telemetry::SmartMotorControllerTelemetry yams::motorcontrollers::SmartMotorController::m_telemetry
protected

◆ m_telemetryConfig

telemetry::SmartMotorControllerTelemetryConfig yams::motorcontrollers::SmartMotorController::m_telemetryConfig
protected

◆ m_telemetryConfigExplicit

bool yams::motorcontrollers::SmartMotorController::m_telemetryConfigExplicit {false}
protected

◆ m_telemetryTable

std::shared_ptr<wpi::nt::NetworkTable> yams::motorcontrollers::SmartMotorController::m_telemetryTable
protected

◆ m_trapState

std::optional<wpi::math::TrapezoidProfile<wpi::units::turns>::State> yams::motorcontrollers::SmartMotorController::m_trapState
protected

◆ m_tuningTable

std::shared_ptr<wpi::nt::NetworkTable> yams::motorcontrollers::SmartMotorController::m_tuningTable
protected

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