Configure Onboard PID
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.
Configuring the PID Object
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
.
Selecting Active PID Configuration
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
Use PID API Details
Set the PID slot to use for feedback control.
Parameters:
encoderType
The PID slot to use.
PID Configuration API Details
Functionality for configuring the Integral Zone is currently in progress on the Thrifty Nova firmware.
Set
Set the PID controller terms from a PIDController object.
Parameters:
pid
The PIDController object.
Set P Term
Sets the proportional term for the PID controller.
Parameters:
p
The proportional term.
Set I-Term
Sets the integral term for the PID controller.
Parameters:
i
The integral term.
Set D-Term
Sets the derivative term for the PID controller.
Parameters:
d
The derivative term.
Set FF-Term
Sets the feed forward term for the PID controller.
Parameters:
ff
The feed forward term.
Last updated