YAMS
Yet Another Mechanism System
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
yams::motorcontrollers::SmartMotorControllerConfig Class Reference

#include <SmartMotorControllerConfig.hpp>

Classes

struct  PIDGains
 

Public Types

enum class  ControlMode { CLOSED_LOOP , OPEN_LOOP }
 
enum class  MotorMode { COAST , BRAKE }
 
enum class  TelemetryVerbosity { NONE , LOW , MEDIUM , HIGH }
 
enum class  ClosedLoopControllerSlot { SLOT_0 , SLOT_1 , SLOT_2 , SLOT_3 }
 

Public Member Functions

SmartMotorControllerConfig & WithFeedback (double kP, double kI, double kD, ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0)
 
SmartMotorControllerConfig & WithFeedforward (const wpi::math::ArmFeedforward &ff, ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0)
 
SmartMotorControllerConfig & WithFeedforward (const wpi::math::ElevatorFeedforward &ff, ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0)
 
SmartMotorControllerConfig & WithFeedforward (const wpi::math::SimpleMotorFeedforward< wpi::units::turns > &ff, ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0)
 
SmartMotorControllerConfig & WithTrapezoidProfile (wpi::units::turns_per_second_t maxVelocity, wpi::units::turns_per_second_squared_t maxAcceleration)
 
SmartMotorControllerConfig & WithLinearTrapezoidProfile (wpi::units::meters_per_second_t maxVelocity, wpi::units::meters_per_second_squared_t maxAcceleration)
 
SmartMotorControllerConfig & WithVelocityTrapezoidProfile (wpi::units::turns_per_second_squared_t maxAcceleration, wpi::units::angular_jerk::turns_per_second_cubed_t maxJerk)
 
SmartMotorControllerConfig & WithVelocityTrapezoidProfile (wpi::units::meters_per_second_squared_t maxAcceleration, meters_per_second_cubed_t maxJerk)
 
SmartMotorControllerConfig & WithExponentialProfile (double kV, double kA, wpi::units::volt_t maxInput)
 
SmartMotorControllerConfig & WithExponentialProfile (wpi::units::volt_t maxVolts, wpi::math::DCMotor motor, wpi::units::kilogram_square_meter_t moi)
 
SmartMotorControllerConfig & WithExponentialProfile (wpi::units::volt_t maxVolts, wpi::math::DCMotor motor, wpi::units::kilogram_t mass, wpi::units::meter_t drumRadius)
 
SmartMotorControllerConfig & WithExponentialProfile (wpi::units::volt_t maxVolts, wpi::units::turns_per_second_t maxVelocity, wpi::units::turns_per_second_squared_t maxAcceleration)
 
SmartMotorControllerConfig & WithExponentialProfile (wpi::math::ExponentialProfile< wpi::units::turns, wpi::units::volts >::Constraints constraints)
 
SmartMotorControllerConfig & WithLinearExponentialProfile (double kV, double kA, wpi::units::volt_t maxInput)
 
SmartMotorControllerConfig & WithLQR (const math::LQRConfig &lqrConfig, ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0)
 
SmartMotorControllerConfig & WithLinearClosedLoopController (bool linear)
 
SmartMotorControllerConfig & WithClosedLoopTolerance (wpi::units::turn_t tolerance)
 
SmartMotorControllerConfig & WithClosedLoopTolerance (wpi::units::meter_t tolerance)
 
SmartMotorControllerConfig & WithMotorGearing (const gearing::MechanismGearing &gearing)
 
SmartMotorControllerConfig & WithMotorGearing (double reductionRatio)
 
SmartMotorControllerConfig & WithCascadingElevatorStages (int stages)
 
SmartMotorControllerConfig & WithMechanismCircumference (wpi::units::meter_t circumference)
 
SmartMotorControllerConfig & WithMechanismCircumference (wpi::units::meter_t gearPitch, int teeth)
 
SmartMotorControllerConfig & WithMechanismDiameter (wpi::units::meter_t diameter)
 
SmartMotorControllerConfig & WithMechanismRadius (wpi::units::meter_t radius)
 
SmartMotorControllerConfig & WithMechanismLimits (wpi::units::turn_t lower, wpi::units::turn_t upper)
 
SmartMotorControllerConfig & WithMeasurementLimits (wpi::units::meter_t lower, wpi::units::meter_t upper)
 
SmartMotorControllerConfig & WithStatorCurrentLimit (wpi::units::ampere_t limit)
 
SmartMotorControllerConfig & WithSupplyCurrentLimit (wpi::units::ampere_t limit)
 
SmartMotorControllerConfig & WithTemperatureCutoff (wpi::units::celsius_t temperature)
 
SmartMotorControllerConfig & WithClosedLoopMaxVoltage (wpi::units::volt_t maxVoltage)
 
SmartMotorControllerConfig & WithVoltageCompensation (wpi::units::volt_t voltage)
 
SmartMotorControllerConfig & WithFeedbackSynchronizationThreshold (wpi::units::turn_t threshold)
 
SmartMotorControllerConfig & WithZeroPower (MotorMode mode)
 
SmartMotorControllerConfig & WithClosedLoopMode ()
 
SmartMotorControllerConfig & WithOpenLoopMode ()
 
SmartMotorControllerConfig & WithClosedLoopControlPeriod (wpi::units::second_t period)
 
SmartMotorControllerConfig & WithResetPreviousConfig (bool reset)
 
SmartMotorControllerConfig & WithOpenLoopRampRate (wpi::units::second_t rampRate)
 
SmartMotorControllerConfig & WithClosedLoopRampRate (wpi::units::second_t rampRate)
 
SmartMotorControllerConfig & WithMotorInverted (bool inverted)
 
SmartMotorControllerConfig & WithEncoderInverted (bool inverted)
 
SmartMotorControllerConfig & WithExternalEncoder (std::any encoder)
 
SmartMotorControllerConfig & WithUseExternalFeedbackEncoder (bool use)
 
SmartMotorControllerConfig & WithExternalEncoderInverted (bool inverted)
 
SmartMotorControllerConfig & WithExternalEncoderConversionFactor (double factor)
 
SmartMotorControllerConfig & WithExternalEncoderZeroOffset (wpi::units::turn_t zeroOffset)
 
SmartMotorControllerConfig & WithExternalEncoderZeroOffset (wpi::units::meter_t zeroOffset)
 
SmartMotorControllerConfig & WithExternalEncoderGearing (const gearing::MechanismGearing &gearing)
 
SmartMotorControllerConfig & WithExternalEncoderGearing (double reductionRatio)
 
SmartMotorControllerConfig & WithExternalEncoderDiscontinuityPoint (wpi::units::turn_t discontinuityPoint)
 
SmartMotorControllerConfig & WithContinuousWrapping (wpi::units::turn_t min, wpi::units::turn_t max)
 
SmartMotorControllerConfig & WithTelemetry (const std::string &name, TelemetryVerbosity verbosity=TelemetryVerbosity::HIGH)
 
SmartMotorControllerConfig & WithTelemetry (TelemetryVerbosity verbosity)
 
SmartMotorControllerConfig & WithTelemetry (const std::string &name, telemetry::SmartMotorControllerTelemetryConfig telemetryConfig)
 
SmartMotorControllerConfig & WithSubsystem (wpi::cmd::SubsystemBase *subsystem)
 
SmartMotorControllerConfig & WithSimMotor (wpi::math::DCMotor motor)
 
SmartMotorControllerConfig & WithSimulationPeriod (wpi::units::second_t period)
 
SmartMotorControllerConfig & WithSimStartingPosition (wpi::units::degree_t startingAngle)
 
SmartMotorControllerConfig & WithSimStartingPosition (wpi::units::meter_t startingDistance)
 
SmartMotorControllerConfig & WithSimFeedforward (const wpi::math::ArmFeedforward &ff, ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0)
 
SmartMotorControllerConfig & WithSimFeedforward (const wpi::math::ElevatorFeedforward &ff, ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0)
 
SmartMotorControllerConfig & WithSimFeedforward (const wpi::math::SimpleMotorFeedforward< wpi::units::turns > &ff, ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0)
 
SmartMotorControllerConfig & WithSimClosedLoopController (double kP, double kI, double kD, ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0)
 
SmartMotorControllerConfig & WithSimClosedLoopController (const math::LQRConfig &lqrConfig, ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0)
 
SmartMotorControllerConfig & WithSimTrapezoidProfile (wpi::units::turns_per_second_t maxVelocity, wpi::units::turns_per_second_squared_t maxAcceleration)
 
SmartMotorControllerConfig & WithSimTrapezoidProfile (wpi::units::meters_per_second_t maxVelocity, wpi::units::meters_per_second_squared_t maxAcceleration)
 
SmartMotorControllerConfig & WithSimExponentialProfile (wpi::math::ExponentialProfile< wpi::units::turns, wpi::units::volts >::Constraints constraints)
 
SmartMotorControllerConfig & WithMOI (wpi::units::kilogram_square_meter_t moi)
 
SmartMotorControllerConfig & WithMOI (wpi::units::meter_t length, wpi::units::kilogram_t mass)
 
SmartMotorControllerConfig & WithStartingPosition (wpi::units::degree_t startingAngle)
 
SmartMotorControllerConfig & WithStartingPosition (wpi::units::meter_t startingDistance)
 
SmartMotorControllerConfig & WithVendorConfig (std::any cfg)
 
SmartMotorControllerConfig & WithFollowers (std::vector< std::pair< std::any, bool > > followers)
 
SmartMotorControllerConfig & WithLooselyCoupledFollowers (std::vector< SmartMotorController * > followers)
 
void ClearFollowers ()
 
const std::vector< std::pair< std::any, bool > > & GetFollowers () const
 
const std::vector< SmartMotorController * > & GetLooselyCoupledFollowers () const
 
SmartMotorControllerConfig Clone () const
 
void ResetValidationCheck () const
 
void ValidateBasicOptions () const
 
void ValidateExternalEncoderOptions () const
 
SmartMotorControllerConfig & WithVendorControlRequest (std::any req)
 
PIDGains GetSlotGains (ClosedLoopControllerSlot slot) const
 
std::optional< wpi::math::ArmFeedforward > GetArmFeedforward (ClosedLoopControllerSlot slot) const
 
std::optional< wpi::math::ElevatorFeedforward > GetElevatorFeedforward (ClosedLoopControllerSlot slot) const
 
std::optional< wpi::math::SimpleMotorFeedforward< wpi::units::turns > > GetSimpleFeedforward (ClosedLoopControllerSlot slot) const
 
std::optional< math::LQRConfig > GetLQR (ClosedLoopControllerSlot slot) const
 
double GetKp (ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0) const
 
double GetKi (ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0) const
 
double GetKd (ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0) const
 
bool GetLinearClosedLoopControllerUse () const
 
std::optional< wpi::units::turn_t > GetMechanismLowerLimit () const
 
std::optional< wpi::units::turn_t > GetMechanismUpperLimit () const
 
std::optional< wpi::units::meter_t > GetMeasurementLowerLimit () const
 
std::optional< wpi::units::meter_t > GetMeasurementUpperLimit () const
 
std::optional< wpi::units::turn_t > GetContinuousWrapping () const
 
std::optional< wpi::units::turn_t > GetContinuousWrappingMin () const
 
wpi::units::turn_t GetContinuousWrappingSetpoint (wpi::units::turn_t setpoint, wpi::units::turn_t current) const
 
std::optional< wpi::units::ampere_t > GetStatorCurrentLimit () const
 
std::optional< int > GetStatorStallCurrentLimit () const
 
std::optional< int > GetSupplyStallCurrentLimit () const
 
std::optional< wpi::units::ampere_t > GetSupplyCurrentLimit () const
 
std::optional< wpi::units::celsius_t > GetTemperatureCutoff () const
 
std::optional< wpi::units::volt_t > GetClosedLoopControllerMaximumVoltage () const
 
std::optional< wpi::units::volt_t > GetVoltageCompensation () const
 
std::optional< wpi::units::turn_t > GetFeedbackSynchronizationThreshold () const
 
std::optional< wpi::units::turn_t > GetClosedLoopTolerance () const
 
bool GetResetPreviousConfig () const
 
ControlMode GetMotorControllerMode () const
 
std::optional< MotorMode > GetZeroPower () const
 
std::optional< wpi::units::second_t > GetClosedLoopControlPeriod () const
 
std::optional< wpi::units::second_t > GetOpenLoopRampRate () const
 
std::optional< wpi::units::second_t > GetClosedLoopRampRate () const
 
std::optional< bool > GetMotorInverted () const
 
std::optional< bool > GetEncoderInverted () const
 
bool GetVelocityTrapezoidalProfileInUse () const
 
std::optional< std::string > GetTelemetryName () const
 
std::optional< TelemetryVerbosity > GetVerbosity () const
 
wpi::cmd::SubsystemBase * GetSubsystem () const
 
bool HasSubsystem () const
 
std::shared_ptr< telemetry::SmartMotorControllerTelemetryConfig > GetSmartControllerTelemetryConfig () const
 
std::optional< wpi::math::DCMotor > GetSimMotor () const
 
wpi::units::second_t GetSimulationPeriod () const
 
wpi::units::kilogram_square_meter_t GetMOI () const
 
std::optional< wpi::units::turn_t > GetStartingPosition () const
 
std::optional< std::any > GetVendorConfig () const
 
std::optional< std::any > GetVendorControlRequest () const
 
const std::optional< gearing::MechanismGearing > & GetMotorGearing () const
 
std::optional< wpi::units::meter_t > GetMechanismCircumference () const
 
std::optional< std::any > GetExternalEncoder () const
 
bool GetUseExternalFeedback () const
 
std::optional< bool > GetExternalEncoderInverted () const
 
std::optional< double > GetExternalEncoderConversionFactor () const
 
std::optional< wpi::units::turn_t > GetExternalEncoderZeroOffset () const
 
const std::optional< gearing::MechanismGearing > & GetExternalEncoderGearing () const
 
std::optional< wpi::units::turn_t > GetExternalEncoderDiscontinuityPoint () const
 
bool HasTrapezoidProfile () const
 
bool HasExponentialProfile () const
 
bool HasLinearExponentialProfile () const
 
std::optional< wpi::math::TrapezoidProfile< wpi::units::turns > > GetTrapezoidProfile () const
 
std::optional< wpi::math::TrapezoidProfile< wpi::units::meters > > GetLinearTrapezoidProfile () const
 
std::optional< wpi::math::ExponentialProfile< wpi::units::turns, wpi::units::volts > > GetExponentialProfile () const
 
std::optional< wpi::math::ExponentialProfile< wpi::units::meters, wpi::units::volts > > GetLinearExponentialProfile () const
 
std::optional< wpi::units::turns_per_second_t > GetTrapMaxVelocityTurns () const
 
std::optional< wpi::units::turns_per_second_squared_t > GetTrapMaxAccelTurns () const
 
std::optional< wpi::units::meters_per_second_t > GetTrapMaxVelocityLinear () const
 
std::optional< wpi::units::meters_per_second_squared_t > GetTrapMaxAccelLinear () const
 
std::optional< double > GetExponentialProfileKV () const
 
std::optional< double > GetExponentialProfileKA () const
 
std::optional< wpi::units::volt_t > GetExponentialProfileMaxInput () const
 
wpi::units::meter_t ConvertFromMechanism (wpi::units::turn_t mechanismPosition) const
 
wpi::units::meters_per_second_t ConvertFromMechanism (wpi::units::turns_per_second_t mechanismVelocity) const
 
wpi::units::meters_per_second_squared_t ConvertFromMechanism (wpi::units::turns_per_second_squared_t mechanismAcceleration) const
 
meters_per_second_cubed_t ConvertFromMechanism (wpi::units::angular_jerk::turns_per_second_cubed_t mechanismJerk) const
 
wpi::units::turn_t ConvertToMechanism (wpi::units::meter_t distance) const
 
wpi::units::turns_per_second_t ConvertToMechanism (wpi::units::meters_per_second_t velocity) const
 
wpi::units::turns_per_second_squared_t ConvertToMechanism (wpi::units::meters_per_second_squared_t acceleration) const
 
wpi::units::angular_jerk::turns_per_second_cubed_t ConvertToMechanism (meters_per_second_cubed_t jerk) const
 
wpi::units::volt_t ConvertToVoltage (const wpi::math::DCMotor &motor, wpi::units::newton_t feedforwardForce) const
 
wpi::units::ampere_t ConvertToCurrent (const wpi::math::DCMotor &motor, wpi::units::newton_t feedforwardForce) const
 

Detailed Description

Unified configuration for a SmartMotorController.

Stores PID/feedforward gains (up to 4 slots), motion-profile parameters, soft limits, current limits, gearing, telemetry settings, and simulation motor model. Uses a fluent builder pattern; all With* methods return *this for chaining.

Member Enumeration Documentation

◆ ClosedLoopControllerSlot

Which PID/feedforward gain slot to use (hardware-level slot selection).

Enumerator
SLOT_0 
SLOT_1 
SLOT_2 
SLOT_3 

◆ ControlMode

Closed-loop vs open-loop output mode.

Enumerator
CLOSED_LOOP 
OPEN_LOOP 

◆ MotorMode

Motor idle (neutral) behaviour.

Enumerator
COAST 
BRAKE 

◆ TelemetryVerbosity

Amount of data published to NetworkTables.

Enumerator
NONE 
LOW 
MEDIUM 
HIGH 

Member Function Documentation

◆ ClearFollowers()

void yams::motorcontrollers::SmartMotorControllerConfig::ClearFollowers ( )

Clear the tightly coupled hardware followers so they are not reapplied.

◆ Clone()

SmartMotorControllerConfig yams::motorcontrollers::SmartMotorControllerConfig::Clone ( ) const

Return a deep copy of this configuration.

Useful when multiple motor controllers share the same base config but need independent modifications (e.g. different inversion settings).

Returns
Copy of this SmartMotorControllerConfig.

◆ ConvertFromMechanism() [1/4]

meters_per_second_cubed_t yams::motorcontrollers::SmartMotorControllerConfig::ConvertFromMechanism ( wpi::units::angular_jerk::turns_per_second_cubed_t  mechanismJerk) const

Convert a mechanism jerk to a linear jerk using the configured circumference.

Parameters
mechanismJerkMechanism jerk to convert.
Returns
Equivalent linear jerk.

◆ ConvertFromMechanism() [2/4]

wpi::units::meter_t yams::motorcontrollers::SmartMotorControllerConfig::ConvertFromMechanism ( wpi::units::turn_t  mechanismPosition) const

Convert a mechanism position (turns) to a linear distance using the configured circumference.

All ConvertFromMechanism/ConvertToMechanism/ConvertToVoltage/ConvertToCurrent overloads throw SmartMotorControllerConfigurationException if the mechanism circumference is not configured.

Parameters
mechanismPositionMechanism position in turns to convert.
Returns
Equivalent linear distance.

◆ ConvertFromMechanism() [3/4]

wpi::units::meters_per_second_squared_t yams::motorcontrollers::SmartMotorControllerConfig::ConvertFromMechanism ( wpi::units::turns_per_second_squared_t  mechanismAcceleration) const

Convert a mechanism acceleration to a linear acceleration using the configured circumference.

Parameters
mechanismAccelerationMechanism acceleration to convert.
Returns
Equivalent linear acceleration.

◆ ConvertFromMechanism() [4/4]

wpi::units::meters_per_second_t yams::motorcontrollers::SmartMotorControllerConfig::ConvertFromMechanism ( wpi::units::turns_per_second_t  mechanismVelocity) const

Convert a mechanism velocity (turns/s) to a linear velocity using the configured circumference.

Parameters
mechanismVelocityMechanism velocity in turns/s to convert.
Returns
Equivalent linear velocity.

◆ ConvertToCurrent()

wpi::units::ampere_t yams::motorcontrollers::SmartMotorControllerConfig::ConvertToCurrent ( const wpi::math::DCMotor &  motor,
wpi::units::newton_t  feedforwardForce 
) const

Convert a feedforward force applied at the mechanism into the equivalent motor current, using the gearing and mechanism circumference (e.g. for torque-current closed-loop control).

Parameters
motorDC motor model of the mechanism.
feedforwardForceFeedforward force applied to the mechanism.
Returns
Equivalent feedforward current at the motor.

◆ ConvertToMechanism() [1/4]

wpi::units::angular_jerk::turns_per_second_cubed_t yams::motorcontrollers::SmartMotorControllerConfig::ConvertToMechanism ( meters_per_second_cubed_t  jerk) const

Convert a linear jerk to a mechanism jerk using the configured circumference.

Parameters
jerkLinear jerk to convert.
Returns
Equivalent mechanism jerk.

◆ ConvertToMechanism() [2/4]

wpi::units::turn_t yams::motorcontrollers::SmartMotorControllerConfig::ConvertToMechanism ( wpi::units::meter_t  distance) const

Convert a linear distance to a mechanism position using the configured circumference.

Parameters
distanceLinear distance to convert.
Returns
Equivalent mechanism position.

◆ ConvertToMechanism() [3/4]

wpi::units::turns_per_second_squared_t yams::motorcontrollers::SmartMotorControllerConfig::ConvertToMechanism ( wpi::units::meters_per_second_squared_t  acceleration) const

Convert a linear acceleration to a mechanism acceleration using the configured circumference.

Parameters
accelerationLinear acceleration to convert.
Returns
Equivalent mechanism acceleration.

◆ ConvertToMechanism() [4/4]

wpi::units::turns_per_second_t yams::motorcontrollers::SmartMotorControllerConfig::ConvertToMechanism ( wpi::units::meters_per_second_t  velocity) const

Convert a linear velocity to a mechanism velocity using the configured circumference.

Parameters
velocityLinear velocity to convert.
Returns
Equivalent mechanism velocity.

◆ ConvertToVoltage()

wpi::units::volt_t yams::motorcontrollers::SmartMotorControllerConfig::ConvertToVoltage ( const wpi::math::DCMotor &  motor,
wpi::units::newton_t  feedforwardForce 
) const

Convert a feedforward force applied at the mechanism into the equivalent motor voltage, using the gearing and mechanism circumference. Only the voltage producing the force (the resistive drop of the matching current) is returned, not the back-EMF of the commanded speed.

Parameters
motorDC motor model of the mechanism.
feedforwardForceFeedforward force applied to the mechanism.
Returns
Equivalent feedforward voltage at the motor.

◆ GetArmFeedforward()

std::optional< wpi::math::ArmFeedforward > yams::motorcontrollers::SmartMotorControllerConfig::GetArmFeedforward ( ClosedLoopControllerSlot  slot) const

Get the optional arm feedforward for the specified slot.

Parameters
slotGain slot to query.
Returns
ArmFeedforward if configured, otherwise empty.

◆ GetClosedLoopControllerMaximumVoltage()

std::optional< wpi::units::volt_t > yams::motorcontrollers::SmartMotorControllerConfig::GetClosedLoopControllerMaximumVoltage ( ) const
Returns
Optional maximum closed-loop output voltage.

◆ GetClosedLoopControlPeriod()

std::optional< wpi::units::second_t > yams::motorcontrollers::SmartMotorControllerConfig::GetClosedLoopControlPeriod ( ) const
Returns
Optional closed-loop control thread period.

◆ GetClosedLoopRampRate()

std::optional< wpi::units::second_t > yams::motorcontrollers::SmartMotorControllerConfig::GetClosedLoopRampRate ( ) const
Returns
Optional closed-loop ramp rate.

◆ GetClosedLoopTolerance()

std::optional< wpi::units::turn_t > yams::motorcontrollers::SmartMotorControllerConfig::GetClosedLoopTolerance ( ) const
Returns
Optional closed-loop tolerance in mechanism rotations.

◆ GetContinuousWrapping()

std::optional< wpi::units::turn_t > yams::motorcontrollers::SmartMotorControllerConfig::GetContinuousWrapping ( ) const
Returns
Optional upper continuous wrapping bound (turns). Erases ContinuousWrapping tracking.

◆ GetContinuousWrappingMin()

std::optional< wpi::units::turn_t > yams::motorcontrollers::SmartMotorControllerConfig::GetContinuousWrappingMin ( ) const
Returns
Optional lower continuous wrapping bound (turns).

◆ GetContinuousWrappingSetpoint()

wpi::units::turn_t yams::motorcontrollers::SmartMotorControllerConfig::GetContinuousWrappingSetpoint ( wpi::units::turn_t  setpoint,
wpi::units::turn_t  current 
) const

Get the position setpoint to command with continuous wrapping: the angle equivalent to setpoint, a whole number of wrapping ranges away, that is nearest current.

Parameters
setpointMechanism angle to go to.
currentCurrent mechanism angle.
Returns
The equivalent setpoint nearest current, or setpoint unchanged when continuous wrapping is not configured.

◆ GetElevatorFeedforward()

std::optional< wpi::math::ElevatorFeedforward > yams::motorcontrollers::SmartMotorControllerConfig::GetElevatorFeedforward ( ClosedLoopControllerSlot  slot) const

Get the optional elevator feedforward for the specified slot.

Parameters
slotGain slot to query.
Returns
ElevatorFeedforward if configured, otherwise empty.

◆ GetEncoderInverted()

std::optional< bool > yams::motorcontrollers::SmartMotorControllerConfig::GetEncoderInverted ( ) const
Returns
Encoder inverted state if explicitly configured, otherwise empty.

◆ GetExponentialProfile()

std::optional< wpi::math::ExponentialProfile< wpi::units::turns, wpi::units::volts > > yams::motorcontrollers::SmartMotorControllerConfig::GetExponentialProfile ( ) const
Returns
Optional angular exponential profile.

◆ GetExponentialProfileKA()

std::optional< double > yams::motorcontrollers::SmartMotorControllerConfig::GetExponentialProfileKA ( ) const
Returns
Optional kA for CTRE MotionMagicExpo (V*s²/turn = V/(turn/s²)).

◆ GetExponentialProfileKV()

std::optional< double > yams::motorcontrollers::SmartMotorControllerConfig::GetExponentialProfileKV ( ) const
Returns
Optional kV for CTRE MotionMagicExpo (V*s/turn = V/(turn/s)).

◆ GetExponentialProfileMaxInput()

std::optional< wpi::units::volt_t > yams::motorcontrollers::SmartMotorControllerConfig::GetExponentialProfileMaxInput ( ) const
Returns
Optional maximum input voltage for the exponential profile.

◆ GetExternalEncoder()

std::optional< std::any > yams::motorcontrollers::SmartMotorControllerConfig::GetExternalEncoder ( ) const
Returns
Optional external encoder hardware object (type-erased).

◆ GetExternalEncoderConversionFactor()

std::optional< double > yams::motorcontrollers::SmartMotorControllerConfig::GetExternalEncoderConversionFactor ( ) const
Returns
Optional external encoder direct conversion factor override.

◆ GetExternalEncoderDiscontinuityPoint()

std::optional< wpi::units::turn_t > yams::motorcontrollers::SmartMotorControllerConfig::GetExternalEncoderDiscontinuityPoint ( ) const
Returns
Optional external encoder discontinuity point (turns).

◆ GetExternalEncoderGearing()

const std::optional< gearing::MechanismGearing > & yams::motorcontrollers::SmartMotorControllerConfig::GetExternalEncoderGearing ( ) const
Returns
Optional external encoder gearing.

◆ GetExternalEncoderInverted()

std::optional< bool > yams::motorcontrollers::SmartMotorControllerConfig::GetExternalEncoderInverted ( ) const
Returns
Optional external encoder inversion override. Always false in simulation when configured, since simulated sensors are not inverted.

◆ GetExternalEncoderZeroOffset()

std::optional< wpi::units::turn_t > yams::motorcontrollers::SmartMotorControllerConfig::GetExternalEncoderZeroOffset ( ) const
Returns
Optional external encoder zero offset (turns).

◆ GetFeedbackSynchronizationThreshold()

std::optional< wpi::units::turn_t > yams::motorcontrollers::SmartMotorControllerConfig::GetFeedbackSynchronizationThreshold ( ) const
Returns
Optional relative-to-absolute encoder synchronization threshold.

◆ GetFollowers()

const std::vector< std::pair< std::any, bool > > & yams::motorcontrollers::SmartMotorControllerConfig::GetFollowers ( ) const

Get the list of tightly coupled hardware followers.

◆ GetKd()

double yams::motorcontrollers::SmartMotorControllerConfig::GetKd ( ClosedLoopControllerSlot  slot = ClosedLoopControllerSlot::SLOT_0) const

Get the derivative gain for the specified slot.

Parameters
slotGain slot to query (default SLOT_0).
Returns
kD value.

◆ GetKi()

double yams::motorcontrollers::SmartMotorControllerConfig::GetKi ( ClosedLoopControllerSlot  slot = ClosedLoopControllerSlot::SLOT_0) const

Get the integral gain for the specified slot.

Parameters
slotGain slot to query (default SLOT_0).
Returns
kI value.

◆ GetKp()

double yams::motorcontrollers::SmartMotorControllerConfig::GetKp ( ClosedLoopControllerSlot  slot = ClosedLoopControllerSlot::SLOT_0) const

Get the proportional gain for the specified slot.

Parameters
slotGain slot to query (default SLOT_0).
Returns
kP value.

◆ GetLinearClosedLoopControllerUse()

bool yams::motorcontrollers::SmartMotorControllerConfig::GetLinearClosedLoopControllerUse ( ) const

Return true if the config targets a linear (distance-based) closed-loop controller.

Returns
true when linear closed-loop control is enabled and a mechanism circumference is set.

◆ GetLinearExponentialProfile()

std::optional< wpi::math::ExponentialProfile< wpi::units::meters, wpi::units::volts > > yams::motorcontrollers::SmartMotorControllerConfig::GetLinearExponentialProfile ( ) const
Returns
Optional linear (meters-based) exponential profile.

◆ GetLinearTrapezoidProfile()

std::optional< wpi::math::TrapezoidProfile< wpi::units::meters > > yams::motorcontrollers::SmartMotorControllerConfig::GetLinearTrapezoidProfile ( ) const
Returns
Optional linear trapezoidal profile.

◆ GetLooselyCoupledFollowers()

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

Get the list of loosely coupled SmartMotorController followers.

◆ GetLQR()

std::optional< math::LQRConfig > yams::motorcontrollers::SmartMotorControllerConfig::GetLQR ( ClosedLoopControllerSlot  slot) const

Get the optional LQR configuration for the specified slot.

Parameters
slotGain slot to query.
Returns
LQRConfig if configured, otherwise empty.

◆ GetMeasurementLowerLimit()

std::optional< wpi::units::meter_t > yams::motorcontrollers::SmartMotorControllerConfig::GetMeasurementLowerLimit ( ) const
Returns
Optional lower linear soft limit.

◆ GetMeasurementUpperLimit()

std::optional< wpi::units::meter_t > yams::motorcontrollers::SmartMotorControllerConfig::GetMeasurementUpperLimit ( ) const
Returns
Optional upper linear soft limit.

◆ GetMechanismCircumference()

std::optional< wpi::units::meter_t > yams::motorcontrollers::SmartMotorControllerConfig::GetMechanismCircumference ( ) const
Returns
Optional mechanism circumference for linear conversion.

◆ GetMechanismLowerLimit()

std::optional< wpi::units::turn_t > yams::motorcontrollers::SmartMotorControllerConfig::GetMechanismLowerLimit ( ) const
Returns
Optional lower angular soft limit (in turns).

◆ GetMechanismUpperLimit()

std::optional< wpi::units::turn_t > yams::motorcontrollers::SmartMotorControllerConfig::GetMechanismUpperLimit ( ) const
Returns
Optional upper angular soft limit (in turns).

◆ GetMOI()

wpi::units::kilogram_square_meter_t yams::motorcontrollers::SmartMotorControllerConfig::GetMOI ( ) const
Returns
Moment of inertia for simulation (kg·m²).

◆ GetMotorControllerMode()

ControlMode yams::motorcontrollers::SmartMotorControllerConfig::GetMotorControllerMode ( ) const
Returns
Current control mode (CLOSED_LOOP or OPEN_LOOP).

◆ GetMotorGearing()

const std::optional< gearing::MechanismGearing > & yams::motorcontrollers::SmartMotorControllerConfig::GetMotorGearing ( ) const
Returns
Optional mechanism gearing.

◆ GetMotorInverted()

std::optional< bool > yams::motorcontrollers::SmartMotorControllerConfig::GetMotorInverted ( ) const
Returns
Inverted state if explicitly configured, otherwise empty. Always false in simulation when configured, since simulated physics are not inverted.

◆ GetOpenLoopRampRate()

std::optional< wpi::units::second_t > yams::motorcontrollers::SmartMotorControllerConfig::GetOpenLoopRampRate ( ) const
Returns
Optional open-loop ramp rate.

◆ GetResetPreviousConfig()

bool yams::motorcontrollers::SmartMotorControllerConfig::GetResetPreviousConfig ( ) const
Returns
true if the previous motor controller configuration should be reset.

◆ GetSimMotor()

std::optional< wpi::math::DCMotor > yams::motorcontrollers::SmartMotorControllerConfig::GetSimMotor ( ) const
Returns
Optional DC motor model for simulation.

◆ GetSimpleFeedforward()

std::optional< wpi::math::SimpleMotorFeedforward< wpi::units::turns > > yams::motorcontrollers::SmartMotorControllerConfig::GetSimpleFeedforward ( ClosedLoopControllerSlot  slot) const

Get the optional simple motor feedforward for the specified slot.

Parameters
slotGain slot to query.
Returns
SimpleMotorFeedforward if configured, otherwise empty.

◆ GetSimulationPeriod()

wpi::units::second_t yams::motorcontrollers::SmartMotorControllerConfig::GetSimulationPeriod ( ) const
Returns
Simulation loop period (default 20 ms).

◆ GetSlotGains()

PIDGains yams::motorcontrollers::SmartMotorControllerConfig::GetSlotGains ( ClosedLoopControllerSlot  slot) const

Get all gains for the specified closed-loop slot.

In simulation, any overrides set via WithSimClosedLoopController or WithSimFeedforward are merged into the returned copy.

Parameters
slotGain slot to query.
Returns
PIDGains for that slot (simulation overrides applied when in sim).

◆ GetSmartControllerTelemetryConfig()

std::shared_ptr< telemetry::SmartMotorControllerTelemetryConfig > yams::motorcontrollers::SmartMotorControllerConfig::GetSmartControllerTelemetryConfig ( ) const
Returns
Telemetry configuration set via WithTelemetry(name, telemetryConfig), or nullptr if none was given.

◆ GetStartingPosition()

std::optional< wpi::units::turn_t > yams::motorcontrollers::SmartMotorControllerConfig::GetStartingPosition ( ) const
Returns
Optional starting mechanism position (turns).

◆ GetStatorCurrentLimit()

std::optional< wpi::units::ampere_t > yams::motorcontrollers::SmartMotorControllerConfig::GetStatorCurrentLimit ( ) const
Returns
Optional stator current limit.

◆ GetStatorStallCurrentLimit()

std::optional< int > yams::motorcontrollers::SmartMotorControllerConfig::GetStatorStallCurrentLimit ( ) const
Returns
Optional stator stall current limit (integer amps).

◆ GetSubsystem()

wpi::cmd::SubsystemBase * yams::motorcontrollers::SmartMotorControllerConfig::GetSubsystem ( ) const
Returns
Owning subsystem pointer. Throws SmartMotorControllerConfigurationException if no subsystem has been set.

◆ GetSupplyCurrentLimit()

std::optional< wpi::units::ampere_t > yams::motorcontrollers::SmartMotorControllerConfig::GetSupplyCurrentLimit ( ) const
Returns
Optional supply current limit.

◆ GetSupplyStallCurrentLimit()

std::optional< int > yams::motorcontrollers::SmartMotorControllerConfig::GetSupplyStallCurrentLimit ( ) const
Returns
Optional supply stall current limit (integer amps).

◆ GetTelemetryName()

std::optional< std::string > yams::motorcontrollers::SmartMotorControllerConfig::GetTelemetryName ( ) const
Returns
Optional NetworkTables telemetry name.

◆ GetTemperatureCutoff()

std::optional< wpi::units::celsius_t > yams::motorcontrollers::SmartMotorControllerConfig::GetTemperatureCutoff ( ) const
Returns
Optional temperature cutoff.

◆ GetTrapezoidProfile()

std::optional< wpi::math::TrapezoidProfile< wpi::units::turns > > yams::motorcontrollers::SmartMotorControllerConfig::GetTrapezoidProfile ( ) const
Returns
Optional angular trapezoidal profile.

◆ GetTrapMaxAccelLinear()

std::optional< wpi::units::meters_per_second_squared_t > yams::motorcontrollers::SmartMotorControllerConfig::GetTrapMaxAccelLinear ( ) const
Returns
Optional max linear acceleration constraint for hardware configuration.

◆ GetTrapMaxAccelTurns()

std::optional< wpi::units::turns_per_second_squared_t > yams::motorcontrollers::SmartMotorControllerConfig::GetTrapMaxAccelTurns ( ) const
Returns
Optional max angular acceleration constraint for hardware configuration.

◆ GetTrapMaxVelocityLinear()

std::optional< wpi::units::meters_per_second_t > yams::motorcontrollers::SmartMotorControllerConfig::GetTrapMaxVelocityLinear ( ) const
Returns
Optional max linear velocity constraint for hardware configuration.

◆ GetTrapMaxVelocityTurns()

std::optional< wpi::units::turns_per_second_t > yams::motorcontrollers::SmartMotorControllerConfig::GetTrapMaxVelocityTurns ( ) const
Returns
Optional max angular velocity constraint for hardware configuration.

◆ GetUseExternalFeedback()

bool yams::motorcontrollers::SmartMotorControllerConfig::GetUseExternalFeedback ( ) const
Returns
true if the external encoder should be the PID feedback source.

◆ GetVelocityTrapezoidalProfileInUse()

bool yams::motorcontrollers::SmartMotorControllerConfig::GetVelocityTrapezoidalProfileInUse ( ) const
Returns
true if a velocity trapezoidal profile is configured.

◆ GetVendorConfig()

std::optional< std::any > yams::motorcontrollers::SmartMotorControllerConfig::GetVendorConfig ( ) const
Returns
Optional vendor-specific hardware config (set via WithVendorConfig).

◆ GetVendorControlRequest()

std::optional< std::any > yams::motorcontrollers::SmartMotorControllerConfig::GetVendorControlRequest ( ) const
Returns
Optional vendor-specific control request (set via WithVendorControlRequest).

◆ GetVerbosity()

std::optional< TelemetryVerbosity > yams::motorcontrollers::SmartMotorControllerConfig::GetVerbosity ( ) const
Returns
Optional telemetry verbosity level.

◆ GetVoltageCompensation()

std::optional< wpi::units::volt_t > yams::motorcontrollers::SmartMotorControllerConfig::GetVoltageCompensation ( ) const
Returns
Optional voltage compensation (nominal) voltage.

◆ GetZeroPower()

std::optional< MotorMode > yams::motorcontrollers::SmartMotorControllerConfig::GetZeroPower ( ) const
Returns
Zero power mode (COAST or BRAKE) if configured, otherwise empty.

◆ HasExponentialProfile()

bool yams::motorcontrollers::SmartMotorControllerConfig::HasExponentialProfile ( ) const
Returns
true if an angular exponential motion profile is configured.

◆ HasLinearExponentialProfile()

bool yams::motorcontrollers::SmartMotorControllerConfig::HasLinearExponentialProfile ( ) const
Returns
true if a linear (meters-based) exponential motion profile is configured.

◆ HasSubsystem()

bool yams::motorcontrollers::SmartMotorControllerConfig::HasSubsystem ( ) const
Returns
true if a subsystem has been set via WithSubsystem.

◆ HasTrapezoidProfile()

bool yams::motorcontrollers::SmartMotorControllerConfig::HasTrapezoidProfile ( ) const
Returns
true if a trapezoidal motion profile is configured.

◆ ResetValidationCheck()

void yams::motorcontrollers::SmartMotorControllerConfig::ResetValidationCheck ( ) const

Reset the validation tracking sets so that a fresh ApplyConfig pass can be verified.

Call this at the very start of ApplyConfig in every SmartMotorController wrapper.

◆ ValidateBasicOptions()

void yams::motorcontrollers::SmartMotorControllerConfig::ValidateBasicOptions ( ) const

Assert that every tracked basic config option was accessed during ApplyConfig.

Throws SmartMotorControllerConfigurationException if any option was never fetched, indicating that the wrapper's ApplyConfig implementation is incomplete.

◆ ValidateExternalEncoderOptions()

void yams::motorcontrollers::SmartMotorControllerConfig::ValidateExternalEncoderOptions ( ) const

Assert that every tracked external-encoder config option was accessed during ApplyConfig.

Throws SmartMotorControllerConfigurationException if any option was never fetched.

◆ WithCascadingElevatorStages()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithCascadingElevatorStages ( int  stages)

Divide the configured gearing by the number of cascading elevator stages.

Throws SmartMotorControllerConfigurationException if no gearing is configured.

Parameters
stagesNumber of cascading stages.
Returns
*this for chaining.

◆ WithClosedLoopControlPeriod()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithClosedLoopControlPeriod ( wpi::units::second_t  period)

Override the closed-loop control thread period.

Parameters
periodDesired loop period.
Returns
*this for chaining.

◆ WithClosedLoopMaxVoltage()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithClosedLoopMaxVoltage ( wpi::units::volt_t  maxVoltage)

Set the maximum voltage the closed-loop controller may output.

Parameters
maxVoltageMaximum closed-loop output voltage.
Returns
*this for chaining.

◆ WithClosedLoopMode()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithClosedLoopMode ( )

Switch to closed-loop control mode.

Returns
*this for chaining.

◆ WithClosedLoopRampRate()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithClosedLoopRampRate ( wpi::units::second_t  rampRate)

Set the closed-loop output ramp rate.

Parameters
rampRateTime to ramp from 0 to full output.
Returns
*this for chaining.

◆ WithClosedLoopTolerance() [1/2]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithClosedLoopTolerance ( wpi::units::meter_t  tolerance)

Set the closed-loop tolerance of the software PID controller as a distance.

Throws SmartMotorControllerConfigurationException if the linear closed-loop controller is not in use, the mechanism circumference is not configured, or no PID gains are configured.

Parameters
toleranceDistance tolerance.
Returns
*this for chaining.

◆ WithClosedLoopTolerance() [2/2]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithClosedLoopTolerance ( wpi::units::turn_t  tolerance)

Set the closed-loop tolerance of the software PID controller in mechanism rotations.

Throws SmartMotorControllerConfigurationException if no PID gains are configured.

Parameters
tolerancePosition tolerance.
Returns
*this for chaining.

◆ WithContinuousWrapping()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithContinuousWrapping ( wpi::units::turn_t  min,
wpi::units::turn_t  max 
)

Enable continuous position wrapping for the closed-loop controller.

Throws SmartMotorControllerConfigurationException if soft limits or a linear closed-loop controller are already configured, or if no PID or LQR controller is configured.

Parameters
minBottom of the wrapping range (turns).
maxTop of the wrapping range (turns).
Returns
*this for chaining.

◆ WithEncoderInverted()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithEncoderInverted ( bool  inverted)

Set the encoder count direction.

Parameters
invertedtrue to invert the encoder.
Returns
*this for chaining.

◆ WithExponentialProfile() [1/5]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithExponentialProfile ( double  kV,
double  kA,
wpi::units::volt_t  maxInput 
)

Enable an exponential motion profile for position control.

Parameters
kVVelocity constant.
kAAcceleration constant.
maxInputMaximum voltage input.
Returns
*this for chaining.

◆ WithExponentialProfile() [2/5]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithExponentialProfile ( wpi::math::ExponentialProfile< wpi::units::turns, wpi::units::volts >::Constraints  constraints)

Set the exponential motion profile directly from a Constraints object.

Parameters
constraintsPre-built ExponentialProfile Constraints.
Returns
*this for chaining.

◆ WithExponentialProfile() [3/5]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithExponentialProfile ( wpi::units::volt_t  maxVolts,
wpi::math::DCMotor  motor,
wpi::units::kilogram_square_meter_t  moi 
)

Derive an exponential motion profile from arm/flywheel system characteristics.

Computes kV and kA from the motor model and moment of inertia via the flywheel velocity state-space model. Uses the gearing configured via WithMotorGearing (defaults to 1:1 if not set).

Parameters
maxVoltsMaximum input voltage.
motorDC motor model.
moiMoment of inertia of the mechanism.
Returns
*this for chaining.

◆ WithExponentialProfile() [4/5]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithExponentialProfile ( wpi::units::volt_t  maxVolts,
wpi::math::DCMotor  motor,
wpi::units::kilogram_t  mass,
wpi::units::meter_t  drumRadius 
)

Derive a linear exponential motion profile from elevator system characteristics.

Computes kV and kA from the motor model, carriage mass, and drum radius via the elevator velocity state-space model. Also sets the mechanism circumference and activates linear closed-loop mode.

Parameters
maxVoltsMaximum input voltage.
motorDC motor model.
massMass of the elevator carriage.
drumRadiusRadius of the elevator drum.
Returns
*this for chaining.

◆ WithExponentialProfile() [5/5]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithExponentialProfile ( wpi::units::volt_t  maxVolts,
wpi::units::turns_per_second_t  maxVelocity,
wpi::units::turns_per_second_squared_t  maxAcceleration 
)

Build an exponential motion profile from max velocity and acceleration constraints.

Parameters
maxVoltsMaximum input voltage.
maxVelocityMaximum angular velocity.
maxAccelerationMaximum angular acceleration.
Returns
*this for chaining.

◆ WithExternalEncoder()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithExternalEncoder ( std::any  encoder)

Attach an external (absolute) encoder hardware object to this configuration.

The encoder object is stored as std::any and unpacked inside the motor-controller wrapper (e.g. SparkWrapper expects a rev::spark::SparkAbsoluteEncoder*; TalonFXWrapper / TalonFXSWrapper accept a ctre::phoenix6::hardware::CANcoder* or ctre::phoenix6::hardware::CANdi*).

Note
When passing a CANdi, the TalonFX(S) configuration must also have Feedback.FeedbackSensorSource (TalonFX) or ExternalFeedback.ExternalFeedbackSensorSource (TalonFXS) pre-set to one of SyncCANdiPWM1, RemoteCANdiPWM1, SyncCANdiPWM2, or RemoteCANdiPWM2 via a vendor config so that ApplyConfig() knows which PWM channel to configure. Without this, offset, inversion, and discontinuity-point settings will not be applied to either channel.
Parameters
encoderExternal encoder hardware object pointer.
Returns
*this for chaining.

◆ WithExternalEncoderConversionFactor()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithExternalEncoderConversionFactor ( double  factor)

Override the external encoder position/velocity conversion factor directly.

When set this takes priority over the gearing-derived conversion factor from WithExternalEncoderGearing. Prefer WithExternalEncoderGearing for type safety.

Parameters
factorConversion factor (raw encoder units → mechanism turns).
Returns
*this for chaining.

◆ WithExternalEncoderDiscontinuityPoint()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithExternalEncoderDiscontinuityPoint ( wpi::units::turn_t  discontinuityPoint)

Set the discontinuity point for absolute encoder wrapping.

Must be exactly 0.5_tr (encoder reads [−0.5, 0.5]) or 1_tr (reads [0, 1]). Throws SmartMotorControllerConfigurationException otherwise.

Parameters
discontinuityPointWrap-around point (0.5 or 1 turns).
Returns
*this for chaining.

◆ WithExternalEncoderGearing() [1/2]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithExternalEncoderGearing ( const gearing::MechanismGearing &  gearing)

Set the external encoder gearing (encoder to mechanism).

Emits a driver station warning if the rotor-to-mechanism ratio exceeds 1, since the encoder may alias and report duplicate angles.

Parameters
gearingMechanismGearing describing the external encoder drive train.
Returns
*this for chaining.

◆ WithExternalEncoderGearing() [2/2]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithExternalEncoderGearing ( double  reductionRatio)

Set the external encoder gearing from a scalar reduction ratio.

Parameters
reductionRatioReduction ratio (e.g. 3.0 for a 3:1 reduction).
Returns
*this for chaining.

◆ WithExternalEncoderInverted()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithExternalEncoderInverted ( bool  inverted)

Invert the external encoder independently of the motor output direction.

Parameters
invertedtrue to invert the external encoder reading.
Returns
*this for chaining.

◆ WithExternalEncoderZeroOffset() [1/2]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithExternalEncoderZeroOffset ( wpi::units::meter_t  zeroOffset)

Set the external encoder zero-point offset as a distance.

Throws SmartMotorControllerConfigurationException if the mechanism circumference is not configured.

Parameters
zeroOffsetHardware zero offset as a linear distance.
Returns
*this for chaining.

◆ WithExternalEncoderZeroOffset() [2/2]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithExternalEncoderZeroOffset ( wpi::units::turn_t  zeroOffset)

Set the external encoder zero-point offset stored in the encoder hardware.

Parameters
zeroOffsetHardware zero offset (turns).
Returns
*this for chaining.

◆ WithFeedback()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithFeedback ( double  kP,
double  kI,
double  kD,
ClosedLoopControllerSlot  slot = ClosedLoopControllerSlot::SLOT_0 
)

Set PID feedback gains for the specified slot.

Parameters
kPProportional gain.
kIIntegral gain.
kDDerivative gain.
slotGain slot to write (default SLOT_0).
Returns
*this for chaining.

◆ WithFeedbackSynchronizationThreshold()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithFeedbackSynchronizationThreshold ( wpi::units::turn_t  threshold)

Set the angle error beyond which the relative encoder is resynchronized to the absolute encoder.

Throws SmartMotorControllerConfigurationException if a mechanism circumference is configured, since auto-synchronization is unavailable for distance based mechanisms.

Parameters
thresholdSynchronization threshold.
Returns
*this for chaining.

◆ WithFeedforward() [1/3]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithFeedforward ( const wpi::math::ArmFeedforward &  ff,
ClosedLoopControllerSlot  slot = ClosedLoopControllerSlot::SLOT_0 
)

Configure an arm feedforward model for the specified slot.

Parameters
ffArmFeedforward (kS, kG, kV, kA) to use.
slotGain slot to write (default SLOT_0).
Returns
*this for chaining.

◆ WithFeedforward() [2/3]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithFeedforward ( const wpi::math::ElevatorFeedforward &  ff,
ClosedLoopControllerSlot  slot = ClosedLoopControllerSlot::SLOT_0 
)

Configure an elevator feedforward model for the specified slot.

Parameters
ffElevatorFeedforward (kS, kG, kV, kA) to use.
slotGain slot to write (default SLOT_0).
Returns
*this for chaining.

◆ WithFeedforward() [3/3]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithFeedforward ( const wpi::math::SimpleMotorFeedforward< wpi::units::turns > &  ff,
ClosedLoopControllerSlot  slot = ClosedLoopControllerSlot::SLOT_0 
)

Configure a simple motor feedforward model for the specified slot.

Parameters
ffSimpleMotorFeedforward (kS, kV, kA) to use.
slotGain slot to write (default SLOT_0).
Returns
*this for chaining.

◆ WithFollowers()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithFollowers ( std::vector< std::pair< std::any, bool > >  followers)

Configure tightly coupled hardware followers for this motor controller.

Followers must be the same vendor as the master (CTRE or REV). TalonFX and TalonFXS are cross-compatible as Phoenix 6 followers. Type checking is performed inside the wrapper's ApplyConfig; passing an incompatible type emits a driver-station warning and is ignored.

Parameters
followersVector of (hardware object pointer, opposeMasterDirection) pairs. Hardware pointers are stored via std::any.
Returns
*this for chaining.

◆ WithLinearClosedLoopController()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithLinearClosedLoopController ( bool  linear)

Set whether the closed-loop controller runs in linear (distance based) units.

Linear mode only takes effect when a mechanism circumference is also configured. It is enabled automatically by elevator feedforwards, linear trapezoidal profiles, and the elevator exponential profile.

Parameters
lineartrue for meters-based closed-loop control, false for rotations.
Returns
*this for chaining.

◆ WithLinearExponentialProfile()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithLinearExponentialProfile ( double  kV,
double  kA,
wpi::units::volt_t  maxInput 
)

Set a linear (meters based) exponential motion profile directly from its gains.

Requires a mechanism circumference (throws SmartMotorControllerConfigurationException otherwise) and switches the closed-loop controller to linear units.

Parameters
kVVelocity constant in volts per meter per second.
kAAcceleration constant in volts per meter per second squared.
maxInputMaximum voltage input.
Returns
*this for chaining.

◆ WithLinearTrapezoidProfile()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithLinearTrapezoidProfile ( wpi::units::meters_per_second_t  maxVelocity,
wpi::units::meters_per_second_squared_t  maxAcceleration 
)

Enable a trapezoidal motion profile for linear position control.

Parameters
maxVelocityMaximum linear velocity constraint.
maxAccelerationMaximum linear acceleration constraint.
Returns
*this for chaining.

◆ WithLooselyCoupledFollowers()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithLooselyCoupledFollowers ( std::vector< SmartMotorController * >  followers)

Configure loosely coupled SmartMotorController followers.

Only position and velocity setpoint requests are forwarded to these followers; configurations are not transferred. Typically used when follower motors have independent gains (e.g. inverted orientation) or a different controller brand.

Parameters
followersSmartMotorController instances to mirror setpoints.
Returns
*this for chaining.

◆ WithLQR()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithLQR ( const math::LQRConfig &  lqrConfig,
ClosedLoopControllerSlot  slot = ClosedLoopControllerSlot::SLOT_0 
)

Attach an LQR configuration to the specified gain slot.

Parameters
lqrConfigLQRConfig to use.
slotGain slot to write (default SLOT_0).
Returns
*this for chaining.

◆ WithMeasurementLimits()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithMeasurementLimits ( wpi::units::meter_t  lower,
wpi::units::meter_t  upper 
)

Set linear soft limits for the mechanism.

The limits are converted into mechanism angle limits with the mechanism circumference, so WithMechanismCircumference must be called first. Throws SmartMotorControllerConfigurationException if the circumference is not configured or if lower is not below upper.

Parameters
lowerLower distance limit.
upperUpper distance limit.
Returns
*this for chaining.

◆ WithMechanismCircumference() [1/2]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithMechanismCircumference ( wpi::units::meter_t  circumference)

Set the mechanism circumference for linear distance conversion.

Parameters
circumferenceWheel or drum circumference in meters.
Returns
*this for chaining.

◆ WithMechanismCircumference() [2/2]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithMechanismCircumference ( wpi::units::meter_t  gearPitch,
int  teeth 
)

Set the mechanism circumference from a sprocket or gear pitch and tooth count.

Circumference is computed as gearPitch × teeth.

Parameters
gearPitchDistance between teeth (e.g. 0.25_in for #25 chain).
teethNumber of teeth on the sprocket or gear.
Returns
*this for chaining.

◆ WithMechanismDiameter()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithMechanismDiameter ( wpi::units::meter_t  diameter)

Set the mechanism circumference from a wheel or drum diameter.

Circumference is computed as π × diameter.

Parameters
diameterWheel or drum diameter.
Returns
*this for chaining.

◆ WithMechanismLimits()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithMechanismLimits ( wpi::units::turn_t  lower,
wpi::units::turn_t  upper 
)

Set angular soft limits for the mechanism.

Throws SmartMotorControllerConfigurationException if lower is not below upper.

Parameters
lowerLower angle limit (in turns; accepts any angular unit via implicit conversion).
upperUpper angle limit (in turns; accepts any angular unit via implicit conversion).
Returns
*this for chaining.

◆ WithMechanismRadius()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithMechanismRadius ( wpi::units::meter_t  radius)

Set the mechanism circumference from a wheel or drum radius.

Circumference is computed as 2π × radius.

Parameters
radiusWheel or drum radius.
Returns
*this for chaining.

◆ WithMOI() [1/2]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithMOI ( wpi::units::kilogram_square_meter_t  moi)

Set the moment of inertia of the mechanism for simulation.

Parameters
moiMoment of inertia in kg·m².
Returns
*this for chaining.

◆ WithMOI() [2/2]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithMOI ( wpi::units::meter_t  length,
wpi::units::kilogram_t  mass 
)

Estimate and set the moment of inertia for simulation from arm length and mass.

Uses SingleJointedArmSim::EstimateMOI (1/3 * mass * length²).

Parameters
lengthArm length.
massArm mass.
Returns
*this for chaining.

◆ WithMotorGearing() [1/2]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithMotorGearing ( const gearing::MechanismGearing &  gearing)

Set the mechanism gearing (rotor-to-mechanism ratio).

Parameters
gearingMechanismGearing describing the drive train.
Returns
*this for chaining.

◆ WithMotorGearing() [2/2]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithMotorGearing ( double  reductionRatio)

Set the mechanism gearing from a scalar reduction ratio.

Parameters
reductionRatioReduction ratio (e.g. 3.0 for a 3:1 reduction, 0.5 for 1:2).
Returns
*this for chaining.

◆ WithMotorInverted()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithMotorInverted ( bool  inverted)

Set the motor output direction.

Parameters
invertedtrue to invert the motor direction.
Returns
*this for chaining.

◆ WithOpenLoopMode()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithOpenLoopMode ( )

Switch to open-loop control mode.

Returns
*this for chaining.

◆ WithOpenLoopRampRate()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithOpenLoopRampRate ( wpi::units::second_t  rampRate)

Set the open-loop output ramp rate.

Parameters
rampRateTime to ramp from 0 to full output.
Returns
*this for chaining.

◆ WithResetPreviousConfig()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithResetPreviousConfig ( bool  reset)

Set whether the motor controller resets its previous configuration and only applies what is given to this config (default true).

Parameters
resetReset the previous configuration.
Returns
*this for chaining.

◆ WithSimClosedLoopController() [1/2]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithSimClosedLoopController ( const math::LQRConfig &  lqrConfig,
ClosedLoopControllerSlot  slot = ClosedLoopControllerSlot::SLOT_0 
)

Override the closed-loop controller for the specified slot with an LQR in simulation.

Clears any simulation PID override for that slot.

Parameters
lqrConfigLQRConfig to use in simulation.
slotGain slot to override (default SLOT_0).
Returns
*this for chaining.

◆ WithSimClosedLoopController() [2/2]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithSimClosedLoopController ( double  kP,
double  kI,
double  kD,
ClosedLoopControllerSlot  slot = ClosedLoopControllerSlot::SLOT_0 
)

Override the PID gains for the specified slot in simulation.

Parameters
kPProportional gain override.
kIIntegral gain override.
kDDerivative gain override.
slotGain slot to override (default SLOT_0).
Returns
*this for chaining.

◆ WithSimExponentialProfile()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithSimExponentialProfile ( wpi::math::ExponentialProfile< wpi::units::turns, wpi::units::volts >::Constraints  constraints)

Override the angular exponential motion profile used in simulation.

Parameters
constraintsExponentialProfile constraints for simulation.
Returns
*this for chaining.

◆ WithSimFeedforward() [1/3]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithSimFeedforward ( const wpi::math::ArmFeedforward &  ff,
ClosedLoopControllerSlot  slot = ClosedLoopControllerSlot::SLOT_0 
)

Override the arm feedforward for the specified slot in simulation.

Parameters
ffArmFeedforward to use in simulation.
slotGain slot to override (default SLOT_0).
Returns
*this for chaining.

◆ WithSimFeedforward() [2/3]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithSimFeedforward ( const wpi::math::ElevatorFeedforward &  ff,
ClosedLoopControllerSlot  slot = ClosedLoopControllerSlot::SLOT_0 
)

Override the elevator feedforward for the specified slot in simulation.

Parameters
ffElevatorFeedforward to use in simulation.
slotGain slot to override (default SLOT_0).
Returns
*this for chaining.

◆ WithSimFeedforward() [3/3]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithSimFeedforward ( const wpi::math::SimpleMotorFeedforward< wpi::units::turns > &  ff,
ClosedLoopControllerSlot  slot = ClosedLoopControllerSlot::SLOT_0 
)

Override the simple motor feedforward for the specified slot in simulation.

Parameters
ffSimpleMotorFeedforward to use in simulation.
slotGain slot to override (default SLOT_0).
Returns
*this for chaining.

◆ WithSimMotor()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithSimMotor ( wpi::math::DCMotor  motor)

Set the DC motor model used for simulation.

Parameters
motorwpi::math::DCMotor model describing the motor physics.
Returns
*this for chaining.

◆ WithSimStartingPosition() [1/2]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithSimStartingPosition ( wpi::units::degree_t  startingAngle)

Override the starting mechanism position used in simulation.

When running in simulation, GetStartingPosition() returns this value instead of the value set by WithStartingPosition().

Parameters
startingAngleStarting angle override for simulation.
Returns
*this for chaining.

◆ WithSimStartingPosition() [2/2]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithSimStartingPosition ( wpi::units::meter_t  startingDistance)

Override the starting mechanism position (linear) used in simulation.

WithMechanismCircumference must be set before calling this overload.

Parameters
startingDistanceStarting linear distance override for simulation.
Returns
*this for chaining.

◆ WithSimTrapezoidProfile() [1/2]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithSimTrapezoidProfile ( wpi::units::meters_per_second_t  maxVelocity,
wpi::units::meters_per_second_squared_t  maxAcceleration 
)

Override the linear trapezoidal motion profile used in simulation.

Parameters
maxVelocityMaximum linear velocity for simulation.
maxAccelerationMaximum linear acceleration for simulation.
Returns
*this for chaining.

◆ WithSimTrapezoidProfile() [2/2]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithSimTrapezoidProfile ( wpi::units::turns_per_second_t  maxVelocity,
wpi::units::turns_per_second_squared_t  maxAcceleration 
)

Override the angular trapezoidal motion profile used in simulation.

Parameters
maxVelocityMaximum angular velocity for simulation.
maxAccelerationMaximum angular acceleration for simulation.
Returns
*this for chaining.

◆ WithSimulationPeriod()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithSimulationPeriod ( wpi::units::second_t  period)

Set the simulation period, the rate at which SimIterate() steps the simulated physics.

Independent of the closed-loop control period. Defaults to 20 ms.

Parameters
periodSimulation loop period.
Returns
*this for chaining.

◆ WithStartingPosition() [1/2]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithStartingPosition ( wpi::units::degree_t  startingAngle)

Set the starting mechanism position (seeds the encoder and sim objects on init).

Throws std::invalid_argument if WithStartingPosition(meter_t) was already called.

Parameters
startingAngleStarting mechanism angle in degrees.
Returns
*this for chaining.

◆ WithStartingPosition() [2/2]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithStartingPosition ( wpi::units::meter_t  startingDistance)

Set the starting mechanism position from a linear distance.

WithMechanismCircumference must be called before this overload. The distance is converted to an angle internally. Throws std::invalid_argument if WithMechanismCircumference has not been set, or if WithStartingPosition(degree_t) was already called.

Parameters
startingDistanceStarting linear distance (e.g. starting height for an elevator).
Returns
*this for chaining.

◆ WithStatorCurrentLimit()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithStatorCurrentLimit ( wpi::units::ampere_t  limit)

Set the stator (output) current limit.

Parameters
limitMaximum stator current.
Returns
*this for chaining.

◆ WithSubsystem()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithSubsystem ( wpi::cmd::SubsystemBase *  subsystem)

Associate a command subsystem with this motor controller.

Throws SmartMotorControllerConfigurationException if a subsystem has already been set. Passing nullptr leaves the subsystem unset.

Parameters
subsystemPointer to the owning subsystem (must outlive this config).
Returns
*this for chaining.

◆ WithSupplyCurrentLimit()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithSupplyCurrentLimit ( wpi::units::ampere_t  limit)

Set the supply (input) current limit.

Parameters
limitMaximum supply current.
Returns
*this for chaining.

◆ WithTelemetry() [1/3]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithTelemetry ( const std::string &  name,
telemetry::SmartMotorControllerTelemetryConfig  telemetryConfig 
)

Enable NetworkTables telemetry with a field-level telemetry configuration.

The verbosity is set to HIGH so that live tuning is available. The telemetry configuration is used by the first motor controller that sets up telemetry with this config (copies made with Clone() share it), so give each motor controller its own.

Parameters
nameTable key for this motor's telemetry.
telemetryConfigTelemetry configuration specifying the published fields.
Returns
*this for chaining.

◆ WithTelemetry() [2/3]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithTelemetry ( const std::string &  name,
TelemetryVerbosity  verbosity = TelemetryVerbosity::HIGH 
)

Enable NetworkTables telemetry for this motor controller.

Parameters
nameTable key for this motor's telemetry.
verbosityAmount of data to publish (default HIGH).
Returns
*this for chaining.

◆ WithTelemetry() [3/3]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithTelemetry ( TelemetryVerbosity  verbosity)

Enable NetworkTables telemetry for this motor controller under the name "motor".

Parameters
verbosityAmount of data to publish.
Returns
*this for chaining.

◆ WithTemperatureCutoff()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithTemperatureCutoff ( wpi::units::celsius_t  temperature)

Set the temperature above which the motor controller disables output.

Parameters
temperatureCutoff temperature.
Returns
*this for chaining.

◆ WithTrapezoidProfile()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithTrapezoidProfile ( wpi::units::turns_per_second_t  maxVelocity,
wpi::units::turns_per_second_squared_t  maxAcceleration 
)

Enable a trapezoidal motion profile for angular position control.

Parameters
maxVelocityMaximum angular velocity constraint.
maxAccelerationMaximum angular acceleration constraint.
Returns
*this for chaining.

◆ WithUseExternalFeedbackEncoder()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithUseExternalFeedbackEncoder ( bool  use)

Set whether the external encoder's position is used as the primary feedback source for the closed-loop controller (default: true when an encoder is attached).

Parameters
usetrue to route external encoder to the PID feedback input.
Returns
*this for chaining.

◆ WithVelocityTrapezoidProfile() [1/2]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithVelocityTrapezoidProfile ( wpi::units::meters_per_second_squared_t  maxAcceleration,
meters_per_second_cubed_t  maxJerk 
)

Enable a trapezoidal motion profile for linear velocity control.

Also switches the closed-loop controller to linear (distance based) units.

Parameters
maxAccelerationMaximum linear acceleration.
maxJerkMaximum linear jerk.
Returns
*this for chaining.

◆ WithVelocityTrapezoidProfile() [2/2]

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithVelocityTrapezoidProfile ( wpi::units::turns_per_second_squared_t  maxAcceleration,
wpi::units::angular_jerk::turns_per_second_cubed_t  maxJerk 
)

Enable a trapezoidal motion profile for angular velocity control.

The velocity setpoint is profiled: its rate of change is limited by maxAcceleration and the rate of change of that by maxJerk.

Parameters
maxAccelerationMaximum mechanism angular acceleration.
maxJerkMaximum mechanism angular jerk.
Returns
*this for chaining.

◆ WithVendorConfig()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithVendorConfig ( std::any  cfg)

Set a vendor-specific hardware configuration to use as the base for this motor controller.

The provided object is used as the starting point before SmartMotorControllerConfig options are applied on top. SmartMotorControllerConfig options always take precedence.

Accepted types per wrapper:

  • TalonFXWrapper: ctre::phoenix6::configs::TalonFXConfiguration
  • TalonFXSWrapper: ctre::phoenix6::configs::TalonFXSConfiguration
  • SparkWrapper (Max): rev::spark::SparkMaxConfig
  • SparkWrapper (Flex): rev::spark::SparkFlexConfig

Passing the wrong type for the wrapper will throw std::invalid_argument at construction time.

Parameters
cfgVendor configuration object (stored via std::any).
Returns
*this for chaining.

◆ WithVendorControlRequest()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithVendorControlRequest ( std::any  req)

Set a vendor-specific control request to use for position or velocity control.

For TalonFX/TalonFXS: accepts any Phoenix 6 position or velocity ControlRequest (e.g. PositionDutyCycle, MotionMagicTorqueCurrentFOC, VelocityDutyCycle). The slot baked into the request object is honoured, overriding SetClosedLoopSlot.

Parameters
reqControl request object (copied into std::any storage).
Returns
*this for chaining.

◆ WithVoltageCompensation()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithVoltageCompensation ( wpi::units::volt_t  voltage)

Set the nominal voltage the motor controller compensates its output for.

Parameters
voltageIdeal (compensated) voltage.
Returns
*this for chaining.

◆ WithZeroPower()

SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithZeroPower ( MotorMode  mode)

Set the idle (neutral) mode of the motor.

Parameters
modeCOAST or BRAKE.
Returns
*this for chaining.

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