setRunUsingEncoderController

open fun setRunUsingEncoderController(controller: SystemController, bufferFraction: Double, maxAchievableTicksPerSecond: Double)

Set a system controller to use for RUN_USING_ENCODER.

The coefficients of this controller can be gain scheduled through scheduleRunUsingEncoderGains. Otherwise, you can adjust the coefficients directly on the controller instance and they will be respected, unless a gain scheduler is set for this controller.

Note that when using a motor with this class, the PIDF coefficients attached to the motor itself will be used only if a controller is not specified, and will only take a snapshot at runtime of these values to populate a controller, making a fallback default VelocityFF controller to use. The SDK PIDF values are otherwise ignored. Falling back on a default controller will also push a robot global warning as it is highly dangerous to use the stock PIDF values in this context. Set your own controller using this method.

Parameters

controller

the controller to use, recommended to use a PIDFF controller.

bufferFraction

fractional value for velocity control, must be in (0, 1].

maxAchievableTicksPerSecond

your motor's spec for how many ticks/sec it can reach