Smart motor controllers
A SmartMotorController is how YAMS drives one motor. You describe the motor once in a SmartMotorControllerConfig (its gearing, gains, limits and encoders), and a wrapper such as TalonFXWrapper, SparkWrapper, NovaWrapper or A301Wrapper applies it to the vendor's motor controller. The same config works on every supported motor controller.
New to YAMS? Read How YAMS drives a motor first. It explains the three layers (motor controller, mechanism, subsystem), the words rotor, mechanism and measurement, open and closed loop, and the units your gains are in.
Where to go next
Look up what an option does
SmartMotorControllerConfig, one page per group of options
Check whether your motor controller supports an option
Set up followers, external encoders or a vendor config
Keep settings already saved on the motor controller
Use different gains in simulation
Stop brownouts
Choose between a trapezoidal and an exponential profile
Replace PID with a model based controller
Find your gains
Reach the vendor objects yourself
YAMS does not have an option for every vendor setting. For a setting it does not have, start from your own vendor config with withVendorConfig. To call the vendor's API directly, fetch the vendor objects from the SmartMotorController. Both methods return Object, so cast to the class your wrapper holds:
// A SparkWrapper around a SPARK Flex
SparkFlex sparkFlex = (SparkFlex) smartMotorController.getMotorController();
SparkFlexConfig sparkFlexConfig = (SparkFlexConfig) smartMotorController.getMotorControllerConfig();Motor options stay on the motor config
A mechanism config such as ArmConfig never changes the SmartMotorControllerConfig. Soft limits, the starting position, gearing and gains are always set on the motor config. Mechanism configs lists what each mechanism config sets.
Simulation without a mechanism
A mechanism class simulates its motor for you. A SmartMotorController used on its own needs simIterate() and updateTelemetry() called every loop: see Running the simulation.
Learn more about motors
The presentation from the video series continues onto PID, feedforward and motion profiles.
The WPILib docs explain PID and feedforward with interactive simulations: see tuning a turret position controller.
Last updated
Was this helpful?
