The Thrifty Nova provides both position and velocity control using an onboard control loop, running on the motor controller at 1kHz. A PID must be configured in order to use position and velocity control functionality. The PID controller has an additional feed-forward term.
There are two separate builtin PID configurations. These can be individually configured, and then the active PID configuration can be selected by #selecting-active-pid-configuration.
Below is how to set individual PID settings on the controller's first PID slot. Note that these can be chained together just like standard configuration functions.
Setting the configuration for the second PID slot is as simple as changing pid0
to pid1
.
To select the first PID configuration, pid0
, as active, use the following code.
And to select the second PID configuration, pid1
, as active, use the following code
Set the PID slot to use for feedback control.
Parameters:
encoderType
The PID slot to use.
Functionality for configuring the Integral Zone is currently in progress on the Thrifty Nova firmware.
Set the PID controller terms from a PIDController object.
Parameters:
pid
The PIDController object.
Sets the proportional term for the PID controller.
Parameters:
p
The proportional term.
Sets the integral term for the PID controller.
Parameters:
i
The integral term.
Sets the derivative term for the PID controller.
Parameters:
d
The derivative term.
Sets the feed forward term for the PID controller.
Parameters:
ff
The feed forward term.