|
YAMS
Yet Another Mechanism System
|
#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 |
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.
|
strong |
|
strong |
|
strong |
| void yams::motorcontrollers::SmartMotorControllerConfig::ClearFollowers | ( | ) |
Clear the tightly coupled hardware followers so they are not reapplied.
| 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).
| 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.
| mechanismJerk | Mechanism jerk to convert. |
| 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.
| mechanismPosition | Mechanism position in turns to convert. |
| 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.
| mechanismAcceleration | Mechanism acceleration to convert. |
| 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.
| mechanismVelocity | Mechanism velocity in turns/s to convert. |
| 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).
| motor | DC motor model of the mechanism. |
| feedforwardForce | Feedforward force applied to the mechanism. |
| 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.
| jerk | Linear jerk to convert. |
| 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.
| distance | Linear distance to convert. |
| 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.
| acceleration | Linear acceleration to convert. |
| 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.
| velocity | Linear velocity to convert. |
| 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.
| motor | DC motor model of the mechanism. |
| feedforwardForce | Feedforward force applied to the mechanism. |
| std::optional< wpi::math::ArmFeedforward > yams::motorcontrollers::SmartMotorControllerConfig::GetArmFeedforward | ( | ClosedLoopControllerSlot | slot | ) | const |
Get the optional arm feedforward for the specified slot.
| slot | Gain slot to query. |
| std::optional< wpi::units::volt_t > yams::motorcontrollers::SmartMotorControllerConfig::GetClosedLoopControllerMaximumVoltage | ( | ) | const |
| std::optional< wpi::units::second_t > yams::motorcontrollers::SmartMotorControllerConfig::GetClosedLoopControlPeriod | ( | ) | const |
| std::optional< wpi::units::second_t > yams::motorcontrollers::SmartMotorControllerConfig::GetClosedLoopRampRate | ( | ) | const |
| std::optional< wpi::units::turn_t > yams::motorcontrollers::SmartMotorControllerConfig::GetClosedLoopTolerance | ( | ) | const |
| std::optional< wpi::units::turn_t > yams::motorcontrollers::SmartMotorControllerConfig::GetContinuousWrapping | ( | ) | const |
| std::optional< wpi::units::turn_t > yams::motorcontrollers::SmartMotorControllerConfig::GetContinuousWrappingMin | ( | ) | const |
| 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.
| setpoint | Mechanism angle to go to. |
| current | Current mechanism angle. |
current, or setpoint unchanged when continuous wrapping is not configured. | std::optional< wpi::math::ElevatorFeedforward > yams::motorcontrollers::SmartMotorControllerConfig::GetElevatorFeedforward | ( | ClosedLoopControllerSlot | slot | ) | const |
Get the optional elevator feedforward for the specified slot.
| slot | Gain slot to query. |
| std::optional< bool > yams::motorcontrollers::SmartMotorControllerConfig::GetEncoderInverted | ( | ) | const |
| std::optional< wpi::math::ExponentialProfile< wpi::units::turns, wpi::units::volts > > yams::motorcontrollers::SmartMotorControllerConfig::GetExponentialProfile | ( | ) | const |
| std::optional< double > yams::motorcontrollers::SmartMotorControllerConfig::GetExponentialProfileKA | ( | ) | const |
| std::optional< double > yams::motorcontrollers::SmartMotorControllerConfig::GetExponentialProfileKV | ( | ) | const |
| std::optional< wpi::units::volt_t > yams::motorcontrollers::SmartMotorControllerConfig::GetExponentialProfileMaxInput | ( | ) | const |
| std::optional< std::any > yams::motorcontrollers::SmartMotorControllerConfig::GetExternalEncoder | ( | ) | const |
| std::optional< double > yams::motorcontrollers::SmartMotorControllerConfig::GetExternalEncoderConversionFactor | ( | ) | const |
| std::optional< wpi::units::turn_t > yams::motorcontrollers::SmartMotorControllerConfig::GetExternalEncoderDiscontinuityPoint | ( | ) | const |
| const std::optional< gearing::MechanismGearing > & yams::motorcontrollers::SmartMotorControllerConfig::GetExternalEncoderGearing | ( | ) | const |
| std::optional< bool > yams::motorcontrollers::SmartMotorControllerConfig::GetExternalEncoderInverted | ( | ) | const |
| std::optional< wpi::units::turn_t > yams::motorcontrollers::SmartMotorControllerConfig::GetExternalEncoderZeroOffset | ( | ) | const |
| std::optional< wpi::units::turn_t > yams::motorcontrollers::SmartMotorControllerConfig::GetFeedbackSynchronizationThreshold | ( | ) | const |
| const std::vector< std::pair< std::any, bool > > & yams::motorcontrollers::SmartMotorControllerConfig::GetFollowers | ( | ) | const |
Get the list of tightly coupled hardware followers.
| double yams::motorcontrollers::SmartMotorControllerConfig::GetKd | ( | ClosedLoopControllerSlot | slot = ClosedLoopControllerSlot::SLOT_0 | ) | const |
Get the derivative gain for the specified slot.
| slot | Gain slot to query (default SLOT_0). |
| double yams::motorcontrollers::SmartMotorControllerConfig::GetKi | ( | ClosedLoopControllerSlot | slot = ClosedLoopControllerSlot::SLOT_0 | ) | const |
Get the integral gain for the specified slot.
| slot | Gain slot to query (default SLOT_0). |
| double yams::motorcontrollers::SmartMotorControllerConfig::GetKp | ( | ClosedLoopControllerSlot | slot = ClosedLoopControllerSlot::SLOT_0 | ) | const |
Get the proportional gain for the specified slot.
| slot | Gain slot to query (default SLOT_0). |
| bool yams::motorcontrollers::SmartMotorControllerConfig::GetLinearClosedLoopControllerUse | ( | ) | const |
Return true if the config targets a linear (distance-based) closed-loop controller.
| std::optional< wpi::math::ExponentialProfile< wpi::units::meters, wpi::units::volts > > yams::motorcontrollers::SmartMotorControllerConfig::GetLinearExponentialProfile | ( | ) | const |
| std::optional< wpi::math::TrapezoidProfile< wpi::units::meters > > yams::motorcontrollers::SmartMotorControllerConfig::GetLinearTrapezoidProfile | ( | ) | const |
| const std::vector< SmartMotorController * > & yams::motorcontrollers::SmartMotorControllerConfig::GetLooselyCoupledFollowers | ( | ) | const |
Get the list of loosely coupled SmartMotorController followers.
| std::optional< math::LQRConfig > yams::motorcontrollers::SmartMotorControllerConfig::GetLQR | ( | ClosedLoopControllerSlot | slot | ) | const |
Get the optional LQR configuration for the specified slot.
| slot | Gain slot to query. |
| std::optional< wpi::units::meter_t > yams::motorcontrollers::SmartMotorControllerConfig::GetMeasurementLowerLimit | ( | ) | const |
| std::optional< wpi::units::meter_t > yams::motorcontrollers::SmartMotorControllerConfig::GetMeasurementUpperLimit | ( | ) | const |
| std::optional< wpi::units::meter_t > yams::motorcontrollers::SmartMotorControllerConfig::GetMechanismCircumference | ( | ) | const |
| std::optional< wpi::units::turn_t > yams::motorcontrollers::SmartMotorControllerConfig::GetMechanismLowerLimit | ( | ) | const |
| std::optional< wpi::units::turn_t > yams::motorcontrollers::SmartMotorControllerConfig::GetMechanismUpperLimit | ( | ) | const |
| wpi::units::kilogram_square_meter_t yams::motorcontrollers::SmartMotorControllerConfig::GetMOI | ( | ) | const |
| ControlMode yams::motorcontrollers::SmartMotorControllerConfig::GetMotorControllerMode | ( | ) | const |
| const std::optional< gearing::MechanismGearing > & yams::motorcontrollers::SmartMotorControllerConfig::GetMotorGearing | ( | ) | const |
| std::optional< bool > yams::motorcontrollers::SmartMotorControllerConfig::GetMotorInverted | ( | ) | const |
| std::optional< wpi::units::second_t > yams::motorcontrollers::SmartMotorControllerConfig::GetOpenLoopRampRate | ( | ) | const |
| bool yams::motorcontrollers::SmartMotorControllerConfig::GetResetPreviousConfig | ( | ) | const |
| std::optional< wpi::math::DCMotor > yams::motorcontrollers::SmartMotorControllerConfig::GetSimMotor | ( | ) | const |
| 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.
| slot | Gain slot to query. |
| wpi::units::second_t yams::motorcontrollers::SmartMotorControllerConfig::GetSimulationPeriod | ( | ) | const |
| 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.
| slot | Gain slot to query. |
| std::shared_ptr< telemetry::SmartMotorControllerTelemetryConfig > yams::motorcontrollers::SmartMotorControllerConfig::GetSmartControllerTelemetryConfig | ( | ) | const |
| std::optional< wpi::units::turn_t > yams::motorcontrollers::SmartMotorControllerConfig::GetStartingPosition | ( | ) | const |
| std::optional< wpi::units::ampere_t > yams::motorcontrollers::SmartMotorControllerConfig::GetStatorCurrentLimit | ( | ) | const |
| std::optional< int > yams::motorcontrollers::SmartMotorControllerConfig::GetStatorStallCurrentLimit | ( | ) | const |
| wpi::cmd::SubsystemBase * yams::motorcontrollers::SmartMotorControllerConfig::GetSubsystem | ( | ) | const |
| std::optional< wpi::units::ampere_t > yams::motorcontrollers::SmartMotorControllerConfig::GetSupplyCurrentLimit | ( | ) | const |
| std::optional< int > yams::motorcontrollers::SmartMotorControllerConfig::GetSupplyStallCurrentLimit | ( | ) | const |
| std::optional< std::string > yams::motorcontrollers::SmartMotorControllerConfig::GetTelemetryName | ( | ) | const |
| std::optional< wpi::units::celsius_t > yams::motorcontrollers::SmartMotorControllerConfig::GetTemperatureCutoff | ( | ) | const |
| std::optional< wpi::math::TrapezoidProfile< wpi::units::turns > > yams::motorcontrollers::SmartMotorControllerConfig::GetTrapezoidProfile | ( | ) | const |
| std::optional< wpi::units::meters_per_second_squared_t > yams::motorcontrollers::SmartMotorControllerConfig::GetTrapMaxAccelLinear | ( | ) | const |
| std::optional< wpi::units::turns_per_second_squared_t > yams::motorcontrollers::SmartMotorControllerConfig::GetTrapMaxAccelTurns | ( | ) | const |
| std::optional< wpi::units::meters_per_second_t > yams::motorcontrollers::SmartMotorControllerConfig::GetTrapMaxVelocityLinear | ( | ) | const |
| std::optional< wpi::units::turns_per_second_t > yams::motorcontrollers::SmartMotorControllerConfig::GetTrapMaxVelocityTurns | ( | ) | const |
| bool yams::motorcontrollers::SmartMotorControllerConfig::GetUseExternalFeedback | ( | ) | const |
| bool yams::motorcontrollers::SmartMotorControllerConfig::GetVelocityTrapezoidalProfileInUse | ( | ) | const |
| std::optional< std::any > yams::motorcontrollers::SmartMotorControllerConfig::GetVendorConfig | ( | ) | const |
| std::optional< std::any > yams::motorcontrollers::SmartMotorControllerConfig::GetVendorControlRequest | ( | ) | const |
| std::optional< TelemetryVerbosity > yams::motorcontrollers::SmartMotorControllerConfig::GetVerbosity | ( | ) | const |
| std::optional< wpi::units::volt_t > yams::motorcontrollers::SmartMotorControllerConfig::GetVoltageCompensation | ( | ) | const |
| std::optional< MotorMode > yams::motorcontrollers::SmartMotorControllerConfig::GetZeroPower | ( | ) | const |
| bool yams::motorcontrollers::SmartMotorControllerConfig::HasExponentialProfile | ( | ) | const |
| bool yams::motorcontrollers::SmartMotorControllerConfig::HasLinearExponentialProfile | ( | ) | const |
| bool yams::motorcontrollers::SmartMotorControllerConfig::HasSubsystem | ( | ) | const |
| bool yams::motorcontrollers::SmartMotorControllerConfig::HasTrapezoidProfile | ( | ) | const |
| 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.
| 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.
| 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.
| 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.
| stages | Number of cascading stages. |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithClosedLoopControlPeriod | ( | wpi::units::second_t | period | ) |
Override the closed-loop control thread period.
| period | Desired loop period. |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithClosedLoopMaxVoltage | ( | wpi::units::volt_t | maxVoltage | ) |
Set the maximum voltage the closed-loop controller may output.
| maxVoltage | Maximum closed-loop output voltage. |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithClosedLoopMode | ( | ) |
Switch to closed-loop control mode.
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithClosedLoopRampRate | ( | wpi::units::second_t | rampRate | ) |
Set the closed-loop output ramp rate.
| rampRate | Time to ramp from 0 to full output. |
| 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.
| tolerance | Distance tolerance. |
| 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.
| tolerance | Position tolerance. |
| 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.
| min | Bottom of the wrapping range (turns). |
| max | Top of the wrapping range (turns). |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithEncoderInverted | ( | bool | inverted | ) |
Set the encoder count direction.
| inverted | true to invert the encoder. |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithExponentialProfile | ( | double | kV, |
| double | kA, | ||
| wpi::units::volt_t | maxInput | ||
| ) |
Enable an exponential motion profile for position control.
| kV | Velocity constant. |
| kA | Acceleration constant. |
| maxInput | Maximum voltage input. |
| 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.
| constraints | Pre-built ExponentialProfile Constraints. |
| 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).
| maxVolts | Maximum input voltage. |
| motor | DC motor model. |
| moi | Moment of inertia of the mechanism. |
| 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.
| maxVolts | Maximum input voltage. |
| motor | DC motor model. |
| mass | Mass of the elevator carriage. |
| drumRadius | Radius of the elevator drum. |
| 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.
| maxVolts | Maximum input voltage. |
| maxVelocity | Maximum angular velocity. |
| maxAcceleration | Maximum angular acceleration. |
| 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*).
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.| encoder | External encoder hardware object pointer. |
| 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.
| factor | Conversion factor (raw encoder units → mechanism turns). |
| 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.
| discontinuityPoint | Wrap-around point (0.5 or 1 turns). |
| 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.
| gearing | MechanismGearing describing the external encoder drive train. |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithExternalEncoderGearing | ( | double | reductionRatio | ) |
Set the external encoder gearing from a scalar reduction ratio.
| reductionRatio | Reduction ratio (e.g. 3.0 for a 3:1 reduction). |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithExternalEncoderInverted | ( | bool | inverted | ) |
Invert the external encoder independently of the motor output direction.
| inverted | true to invert the external encoder reading. |
| 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.
| zeroOffset | Hardware zero offset as a linear distance. |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithExternalEncoderZeroOffset | ( | wpi::units::turn_t | zeroOffset | ) |
Set the external encoder zero-point offset stored in the encoder hardware.
| zeroOffset | Hardware zero offset (turns). |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithFeedback | ( | double | kP, |
| double | kI, | ||
| double | kD, | ||
| ClosedLoopControllerSlot | slot = ClosedLoopControllerSlot::SLOT_0 |
||
| ) |
Set PID feedback gains for the specified slot.
| kP | Proportional gain. |
| kI | Integral gain. |
| kD | Derivative gain. |
| slot | Gain slot to write (default SLOT_0). |
| 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.
| threshold | Synchronization threshold. |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithFeedforward | ( | const wpi::math::ArmFeedforward & | ff, |
| ClosedLoopControllerSlot | slot = ClosedLoopControllerSlot::SLOT_0 |
||
| ) |
Configure an arm feedforward model for the specified slot.
| ff | ArmFeedforward (kS, kG, kV, kA) to use. |
| slot | Gain slot to write (default SLOT_0). |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithFeedforward | ( | const wpi::math::ElevatorFeedforward & | ff, |
| ClosedLoopControllerSlot | slot = ClosedLoopControllerSlot::SLOT_0 |
||
| ) |
Configure an elevator feedforward model for the specified slot.
| ff | ElevatorFeedforward (kS, kG, kV, kA) to use. |
| slot | Gain slot to write (default SLOT_0). |
| 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.
| ff | SimpleMotorFeedforward (kS, kV, kA) to use. |
| slot | Gain slot to write (default SLOT_0). |
| 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.
| followers | Vector of (hardware object pointer, opposeMasterDirection) pairs. Hardware pointers are stored via std::any. |
| 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.
| linear | true for meters-based closed-loop control, false for rotations. |
| 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.
| kV | Velocity constant in volts per meter per second. |
| kA | Acceleration constant in volts per meter per second squared. |
| maxInput | Maximum voltage input. |
| 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.
| maxVelocity | Maximum linear velocity constraint. |
| maxAcceleration | Maximum linear acceleration constraint. |
| 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.
| followers | SmartMotorController instances to mirror setpoints. |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithLQR | ( | const math::LQRConfig & | lqrConfig, |
| ClosedLoopControllerSlot | slot = ClosedLoopControllerSlot::SLOT_0 |
||
| ) |
Attach an LQR configuration to the specified gain slot.
| lqrConfig | LQRConfig to use. |
| slot | Gain slot to write (default SLOT_0). |
| 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.
| lower | Lower distance limit. |
| upper | Upper distance limit. |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithMechanismCircumference | ( | wpi::units::meter_t | circumference | ) |
Set the mechanism circumference for linear distance conversion.
| circumference | Wheel or drum circumference in meters. |
| 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.
| gearPitch | Distance between teeth (e.g. 0.25_in for #25 chain). |
| teeth | Number of teeth on the sprocket or gear. |
| 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.
| diameter | Wheel or drum diameter. |
| 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.
| lower | Lower angle limit (in turns; accepts any angular unit via implicit conversion). |
| upper | Upper angle limit (in turns; accepts any angular unit via implicit conversion). |
| 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.
| radius | Wheel or drum radius. |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithMOI | ( | wpi::units::kilogram_square_meter_t | moi | ) |
Set the moment of inertia of the mechanism for simulation.
| moi | Moment of inertia in kg·m². |
| 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²).
| length | Arm length. |
| mass | Arm mass. |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithMotorGearing | ( | const gearing::MechanismGearing & | gearing | ) |
Set the mechanism gearing (rotor-to-mechanism ratio).
| gearing | MechanismGearing describing the drive train. |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithMotorGearing | ( | double | reductionRatio | ) |
Set the mechanism gearing from a scalar reduction ratio.
| reductionRatio | Reduction ratio (e.g. 3.0 for a 3:1 reduction, 0.5 for 1:2). |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithMotorInverted | ( | bool | inverted | ) |
Set the motor output direction.
| inverted | true to invert the motor direction. |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithOpenLoopMode | ( | ) |
Switch to open-loop control mode.
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithOpenLoopRampRate | ( | wpi::units::second_t | rampRate | ) |
Set the open-loop output ramp rate.
| rampRate | Time to ramp from 0 to full output. |
| 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).
| reset | Reset the previous configuration. |
| 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.
| lqrConfig | LQRConfig to use in simulation. |
| slot | Gain slot to override (default SLOT_0). |
| 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.
| kP | Proportional gain override. |
| kI | Integral gain override. |
| kD | Derivative gain override. |
| slot | Gain slot to override (default SLOT_0). |
| 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.
| constraints | ExponentialProfile constraints for simulation. |
| 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.
| ff | ArmFeedforward to use in simulation. |
| slot | Gain slot to override (default SLOT_0). |
| 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.
| ff | ElevatorFeedforward to use in simulation. |
| slot | Gain slot to override (default SLOT_0). |
| 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.
| ff | SimpleMotorFeedforward to use in simulation. |
| slot | Gain slot to override (default SLOT_0). |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithSimMotor | ( | wpi::math::DCMotor | motor | ) |
Set the DC motor model used for simulation.
| motor | wpi::math::DCMotor model describing the motor physics. |
| 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().
| startingAngle | Starting angle override for simulation. |
| 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.
| startingDistance | Starting linear distance override for simulation. |
| 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.
| maxVelocity | Maximum linear velocity for simulation. |
| maxAcceleration | Maximum linear acceleration for simulation. |
| 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.
| maxVelocity | Maximum angular velocity for simulation. |
| maxAcceleration | Maximum angular acceleration for simulation. |
| 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.
| period | Simulation loop period. |
| 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.
| startingAngle | Starting mechanism angle in degrees. |
| 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.
| startingDistance | Starting linear distance (e.g. starting height for an elevator). |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithStatorCurrentLimit | ( | wpi::units::ampere_t | limit | ) |
Set the stator (output) current limit.
| limit | Maximum stator current. |
| 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.
| subsystem | Pointer to the owning subsystem (must outlive this config). |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithSupplyCurrentLimit | ( | wpi::units::ampere_t | limit | ) |
Set the supply (input) current limit.
| limit | Maximum supply current. |
| 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.
| name | Table key for this motor's telemetry. |
| telemetryConfig | Telemetry configuration specifying the published fields. |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithTelemetry | ( | const std::string & | name, |
| TelemetryVerbosity | verbosity = TelemetryVerbosity::HIGH |
||
| ) |
Enable NetworkTables telemetry for this motor controller.
| name | Table key for this motor's telemetry. |
| verbosity | Amount of data to publish (default HIGH). |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithTelemetry | ( | TelemetryVerbosity | verbosity | ) |
Enable NetworkTables telemetry for this motor controller under the name "motor".
| verbosity | Amount of data to publish. |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithTemperatureCutoff | ( | wpi::units::celsius_t | temperature | ) |
Set the temperature above which the motor controller disables output.
| temperature | Cutoff temperature. |
| 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.
| maxVelocity | Maximum angular velocity constraint. |
| maxAcceleration | Maximum angular acceleration constraint. |
| 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).
| use | true to route external encoder to the PID feedback input. |
| 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.
| maxAcceleration | Maximum linear acceleration. |
| maxJerk | Maximum linear jerk. |
| 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.
| maxAcceleration | Maximum mechanism angular acceleration. |
| maxJerk | Maximum mechanism angular jerk. |
| 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:
Passing the wrong type for the wrapper will throw std::invalid_argument at construction time.
| cfg | Vendor configuration object (stored via std::any). |
| 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.
| req | Control request object (copied into std::any storage). |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithVoltageCompensation | ( | wpi::units::volt_t | voltage | ) |
Set the nominal voltage the motor controller compensates its output for.
| voltage | Ideal (compensated) voltage. |
| SmartMotorControllerConfig & yams::motorcontrollers::SmartMotorControllerConfig::WithZeroPower | ( | MotorMode | mode | ) |
Set the idle (neutral) mode of the motor.
| mode | COAST or BRAKE. |