#include <CANPIDController.h>
Inherited by rev::SparkMaxPIDController [private]
.
|
virtual | ~CANPIDController () |
|
virtual REVLibError | SetReference (double value, ControlType ctrl, int pidSlot=0, double arbFeedforward=0, ArbFFUnits arbFFUnits=ArbFFUnits::kVoltage)=0 |
|
virtual REVLibError | SetP (double gain, int slotID=0)=0 |
|
virtual REVLibError | SetI (double gain, int slotID=0)=0 |
|
virtual REVLibError | SetD (double gain, int slotID=0)=0 |
|
virtual REVLibError | SetDFilter (double gain, int slotID=0)=0 |
|
virtual REVLibError | SetFF (double gain, int slotID=0)=0 |
|
virtual REVLibError | SetIZone (double IZone, int slotID=0)=0 |
|
virtual REVLibError | SetOutputRange (double min, double max, int slotID=0)=0 |
|
virtual double | GetP (int slotID=0) const =0 |
|
virtual double | GetI (int slotID=0) const =0 |
|
virtual double | GetD (int slotID=0) const =0 |
|
virtual double | GetDFilter (int slotID=0) const =0 |
|
virtual double | GetFF (int slotID=0) const =0 |
|
virtual double | GetIZone (int slotID=0) const =0 |
|
virtual double | GetOutputMin (int slotID=0) const =0 |
|
virtual double | GetOutputMax (int slotID=0) const =0 |
|
virtual REVLibError | SetSmartMotionMaxVelocity (double maxVel, int slotID=0)=0 |
|
virtual REVLibError | SetSmartMotionMaxAccel (double maxAccel, int slotID=0)=0 |
|
virtual REVLibError | SetSmartMotionMinOutputVelocity (double minVel, int slotID=0)=0 |
|
virtual REVLibError | SetSmartMotionAllowedClosedLoopError (double allowedErr, int slotID=0)=0 |
|
virtual REVLibError | SetSmartMotionAccelStrategy (AccelStrategy accelStrategy, int slotID=0)=0 |
|
virtual double | GetSmartMotionMaxVelocity (int slotID=0) const =0 |
|
virtual double | GetSmartMotionMaxAccel (int slotID=0) const =0 |
|
virtual double | GetSmartMotionMinOutputVelocity (int slotID=0) const =0 |
|
virtual double | GetSmartMotionAllowedClosedLoopError (int slotID=0) const =0 |
|
virtual REVLibError | SetIMaxAccum (double iMaxAccum, int slotID=0)=0 |
|
virtual double | GetIMaxAccum (int slotID=0) const =0 |
|
virtual REVLibError | SetIAccum (double iAccum)=0 |
|
virtual double | GetIAccum () const =0 |
|
virtual REVLibError | SetFeedbackDevice (const CANSensor &sensor)=0 |
|
virtual REVLibError | SetPositionPIDWrappingEnabled (bool enable)=0 |
|
virtual REVLibError | SetPositionPIDWrappingMaxInput (double value)=0 |
|
virtual REVLibError | SetPositionPIDWrappingMinInput (double value)=0 |
|
virtual bool | GetPositionPIDWrappingEnabled () const =0 |
|
virtual double | GetPositionPIDWrappingMaxInput () const =0 |
|
virtual double | GetPositionPIDWrappingMinInput () const =0 |
|
◆ AccelStrategy
◆ ArbFFUnits
◆ ~CANPIDController()
virtual rev::CANPIDController::~CANPIDController |
( |
| ) |
|
|
inlinevirtual |
◆ SetReference()
Set the controller reference value based on the selected control mode.
- Parameters
-
value | The value to set depending on the control mode. For basic duty cycle control this should be a value between -1 and 1 Otherwise: Voltage Control: Voltage (volts) Velocity Control: Velocity (RPM) Position Control: Position (Rotations) Current Control: Current (Amps). The units can be changed for position and velocity by a scale factor using setPositionConversionFactor(). |
ctrl | Is the control type |
pidSlot | for this command |
arbFeedforward | A value from -32.0 to 32.0 which is a voltage applied to the motor after the result of the specified control mode. The units for the parameter is Volts. This value is set after the control mode, but before any current limits or ramp rates. |
- Returns
- REVLibError::kOk if successful
Implemented in rev::SparkMaxPIDController.
◆ SetP()
virtual REVLibError rev::CANPIDController::SetP |
( |
double |
gain, |
|
|
int |
slotID = 0 |
|
) |
| |
|
pure virtual |
Set the Proportional Gain constant of the PIDF controller on the SPARK MAX. This uses the Set Parameter API and should be used infrequently. The parameter does not presist unless burnFlash() is called. The recommended method to configure this parameter is use to SPARK MAX GUI to tune and save parameters.
- Parameters
-
gain | The proportional gain value, must be positive |
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- REVLibError::kOk if successful
Implemented in rev::SparkMaxPIDController.
◆ SetI()
virtual REVLibError rev::CANPIDController::SetI |
( |
double |
gain, |
|
|
int |
slotID = 0 |
|
) |
| |
|
pure virtual |
Set the Integral Gain constant of the PIDF controller on the SPARK MAX. This uses the Set Parameter API and should be used infrequently. The parameter does not presist unless burnFlash() is called. The recommended method to configure this parameter is use to SPARK MAX GUI to tune and save parameters.
- Parameters
-
gain | The integral gain value, must be positive |
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- REVLibError::kOk if successful
Implemented in rev::SparkMaxPIDController.
◆ SetD()
virtual REVLibError rev::CANPIDController::SetD |
( |
double |
gain, |
|
|
int |
slotID = 0 |
|
) |
| |
|
pure virtual |
Set the Derivative Gain constant of the PIDF controller on the SPARK MAX. This uses the Set Parameter API and should be used infrequently. The parameter does not presist unless burnFlash() is called. The recommended method to configure this parameter is use to SPARK MAX GUI to tune and save parameters.
- Parameters
-
gain | The derivative gain value, must be positive |
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- REVLibError::kOk if successful
Implemented in rev::SparkMaxPIDController.
◆ SetDFilter()
virtual REVLibError rev::CANPIDController::SetDFilter |
( |
double |
gain, |
|
|
int |
slotID = 0 |
|
) |
| |
|
pure virtual |
Set the Derivative Filter constant of the PIDF controller on the SPARK MAX. This uses the Set Parameter API and should be used infrequently. The parameter does not presist unless burnFlash() is called.
- Parameters
-
gain | The derivative filter value, must be a positive number between 0 and 1 |
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- REVLibError::kOk if successful
Implemented in rev::SparkMaxPIDController.
◆ SetFF()
virtual REVLibError rev::CANPIDController::SetFF |
( |
double |
gain, |
|
|
int |
slotID = 0 |
|
) |
| |
|
pure virtual |
Set the Feed-forward Gain constant of the PIDF controller on the SPARK MAX. This uses the Set Parameter API and should be used infrequently. The parameter does not presist unless burnFlash() is called. The recommended method to configure this parameter is use to SPARK MAX GUI to tune and save parameters.
- Parameters
-
gain | The feed-forward gain value |
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- REVLibError::kOk if successful
Implemented in rev::SparkMaxPIDController.
◆ SetIZone()
virtual REVLibError rev::CANPIDController::SetIZone |
( |
double |
IZone, |
|
|
int |
slotID = 0 |
|
) |
| |
|
pure virtual |
Set the IZone range of the PIDF controller on the SPARK MAX. This value specifies the range the |error| must be within for the integral constant to take effect.
This uses the Set Parameter API and should be used infrequently. The parameter does not presist unless burnFlash() is called. The recommended method to configure this parameter is to use the SPARK MAX GUI to tune and save parameters.
- Parameters
-
gain | The IZone value, must be positive. Set to 0 to disable |
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- REVLibError::kOk if successful
Implemented in rev::SparkMaxPIDController.
◆ SetOutputRange()
virtual REVLibError rev::CANPIDController::SetOutputRange |
( |
double |
min, |
|
|
double |
max, |
|
|
int |
slotID = 0 |
|
) |
| |
|
pure virtual |
Set the min amd max output for the closed loop mode.
This uses the Set Parameter API and should be used infrequently. The parameter does not presist unless burnFlash() is called. The recommended method to configure this parameter is to use the SPARK MAX GUI to tune and save parameters.
- Parameters
-
min | Reverse power minimum to allow the controller to output |
max | Forward power maximum to allow the controller to output |
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- REVLibError::kOk if successful
Implemented in rev::SparkMaxPIDController.
◆ GetP()
virtual double rev::CANPIDController::GetP |
( |
int |
slotID = 0 | ) |
const |
|
pure virtual |
Get the Proportional Gain constant of the PIDF controller on the SPARK MAX.
This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)
- Parameters
-
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- double P Gain value
Implemented in rev::SparkMaxPIDController.
◆ GetI()
virtual double rev::CANPIDController::GetI |
( |
int |
slotID = 0 | ) |
const |
|
pure virtual |
Get the Integral Gain constant of the PIDF controller on the SPARK MAX.
This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)
- Parameters
-
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- double I Gain value
Implemented in rev::SparkMaxPIDController.
◆ GetD()
virtual double rev::CANPIDController::GetD |
( |
int |
slotID = 0 | ) |
const |
|
pure virtual |
Get the Derivative Gain constant of the PIDF controller on the SPARK MAX.
This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)
- Parameters
-
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- double D Gain value
Implemented in rev::SparkMaxPIDController.
◆ GetDFilter()
virtual double rev::CANPIDController::GetDFilter |
( |
int |
slotID = 0 | ) |
const |
|
pure virtual |
Get the Derivative Filter constant of the PIDF controller on the SPARK MAX.
This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)
- Parameters
-
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- double D Filter value
Implemented in rev::SparkMaxPIDController.
◆ GetFF()
virtual double rev::CANPIDController::GetFF |
( |
int |
slotID = 0 | ) |
const |
|
pure virtual |
Get the Feed-forward Gain constant of the PIDF controller on the SPARK MAX.
This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)
- Parameters
-
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- double F Gain value
Implemented in rev::SparkMaxPIDController.
◆ GetIZone()
virtual double rev::CANPIDController::GetIZone |
( |
int |
slotID = 0 | ) |
const |
|
pure virtual |
Get the IZone constant of the PIDF controller on the SPARK MAX.
This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)
- Parameters
-
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- double IZone value
Implemented in rev::SparkMaxPIDController.
◆ GetOutputMin()
virtual double rev::CANPIDController::GetOutputMin |
( |
int |
slotID = 0 | ) |
const |
|
pure virtual |
Get the min output of the PIDF controller on the SPARK MAX.
This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)
- Parameters
-
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- double min value
Implemented in rev::SparkMaxPIDController.
◆ GetOutputMax()
virtual double rev::CANPIDController::GetOutputMax |
( |
int |
slotID = 0 | ) |
const |
|
pure virtual |
Get the max output of the PIDF controller on the SPARK MAX.
This uses the Get Parameter API and should be used infrequently. This function uses a non-blocking call and will return a cached value if the parameter is not returned by the timeout. The timeout can be changed by calling SetCANTimeout(int milliseconds)
- Parameters
-
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- double max value
Implemented in rev::SparkMaxPIDController.
◆ SetSmartMotionMaxVelocity()
virtual REVLibError rev::CANPIDController::SetSmartMotionMaxVelocity |
( |
double |
maxVel, |
|
|
int |
slotID = 0 |
|
) |
| |
|
pure virtual |
Configure the maximum velocity of the SmartMotion mode. This is the velocity that is reached in the middle of the profile and is what the motor should spend most of its time at
- Parameters
-
maxVel | The maxmimum cruise velocity for the motion profile in RPM |
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- REVLibError::kOk if successful
Implemented in rev::SparkMaxPIDController.
◆ SetSmartMotionMaxAccel()
virtual REVLibError rev::CANPIDController::SetSmartMotionMaxAccel |
( |
double |
maxAccel, |
|
|
int |
slotID = 0 |
|
) |
| |
|
pure virtual |
Configure the maximum acceleration of the SmartMotion mode. This is the accleration that the motor velocity will increase at until the max velocity is reached
- Parameters
-
maxAccel | The maxmimum acceleration for the motion profile in RPM per second |
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- REVLibError::kOk if successful
Implemented in rev::SparkMaxPIDController.
◆ SetSmartMotionMinOutputVelocity()
virtual REVLibError rev::CANPIDController::SetSmartMotionMinOutputVelocity |
( |
double |
minVel, |
|
|
int |
slotID = 0 |
|
) |
| |
|
pure virtual |
Configure the mimimum velocity of the SmartMotion mode. Any requested velocities below this value will be set to 0.
- Parameters
-
minVel | The minimum velocity for the motion profile in RPM |
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- REVLibError::kOk if successful
Implemented in rev::SparkMaxPIDController.
◆ SetSmartMotionAllowedClosedLoopError()
virtual REVLibError rev::CANPIDController::SetSmartMotionAllowedClosedLoopError |
( |
double |
allowedErr, |
|
|
int |
slotID = 0 |
|
) |
| |
|
pure virtual |
Configure the allowed closed loop error of SmartMotion mode. This value is how much deviation from your setpoint is tolerated and is useful in preventing oscillation around your setpoint.
- Parameters
-
allowedErr | The allowed deviation for your setpoint vs actual position in rotations |
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- REVLibError::kOk if successful
Implemented in rev::SparkMaxPIDController.
◆ SetSmartMotionAccelStrategy()
Coming soon. Configure the acceleration strategy used to control acceleration on the motor. The current strategy is trapezoidal motion profiling.
- Parameters
-
accelStrategy | The acceleration strategy to use for the automatically generated motion profile |
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- REVLibError::kOk if successful
Implemented in rev::SparkMaxPIDController.
◆ GetSmartMotionMaxVelocity()
virtual double rev::CANPIDController::GetSmartMotionMaxVelocity |
( |
int |
slotID = 0 | ) |
const |
|
pure virtual |
Get the maximum velocity of the SmartMotion mode. This is the velocity that is reached in the middle of the profile and is what the motor should spend most of its time at
- Parameters
-
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- The maxmimum cruise velocity for the motion profile in RPM
Implemented in rev::SparkMaxPIDController.
◆ GetSmartMotionMaxAccel()
virtual double rev::CANPIDController::GetSmartMotionMaxAccel |
( |
int |
slotID = 0 | ) |
const |
|
pure virtual |
Get the maximum acceleration of the SmartMotion mode. This is the accleration that the motor velocity will increase at until the max velocity is reached
- Parameters
-
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- The maxmimum acceleration for the motion profile in RPM per second
Implemented in rev::SparkMaxPIDController.
◆ GetSmartMotionMinOutputVelocity()
virtual double rev::CANPIDController::GetSmartMotionMinOutputVelocity |
( |
int |
slotID = 0 | ) |
const |
|
pure virtual |
Get the mimimum velocity of the SmartMotion mode. Any requested velocities below this value will be set to 0.
- Parameters
-
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- The minimum velocity for the motion profile in RPM
Implemented in rev::SparkMaxPIDController.
◆ GetSmartMotionAllowedClosedLoopError()
virtual double rev::CANPIDController::GetSmartMotionAllowedClosedLoopError |
( |
int |
slotID = 0 | ) |
const |
|
pure virtual |
Get the allowed closed loop error of SmartMotion mode. This value is how much deviation from your setpoint is tolerated and is useful in preventing oscillation around your setpoint.
- Parameters
-
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- The allowed deviation for your setpoint vs actual position in rotations
Implemented in rev::SparkMaxPIDController.
◆ SetIMaxAccum()
virtual REVLibError rev::CANPIDController::SetIMaxAccum |
( |
double |
iMaxAccum, |
|
|
int |
slotID = 0 |
|
) |
| |
|
pure virtual |
Configure the maximum I accumulator of the PID controller. This value is used to constrain the I accumulator to help manage integral wind-up
- Parameters
-
iMaxAccum | The max value to contrain the I accumulator to |
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- REVLibError::kOk if successful
Implemented in rev::SparkMaxPIDController.
◆ GetIMaxAccum()
virtual double rev::CANPIDController::GetIMaxAccum |
( |
int |
slotID = 0 | ) |
const |
|
pure virtual |
Get the maximum I accumulator of the PID controller. This value is used to constrain the I accumulator to help manage integral wind-up
- Parameters
-
slotID | Is the gain schedule slot, the value is a number between 0 and 3. Each slot has its own set of gain values and can be changed in each control frame using SetReference(). |
- Returns
- The max value to contrain the I accumulator to
Implemented in rev::SparkMaxPIDController.
◆ SetIAccum()
virtual REVLibError rev::CANPIDController::SetIAccum |
( |
double |
iAccum | ) |
|
|
pure virtual |
Set the I accumulator of the PID controller. This is useful when wishing to force a reset on the I accumulator of the PID controller. You can also preset values to see how it will respond to certain I characteristics
To use this function, the controller must be in a closed loop control mode by calling setReference()
- Parameters
-
iAccum | The value to set the I accumulator to |
- Returns
- REVLibError::kOk if successful
Implemented in rev::SparkMaxPIDController.
◆ GetIAccum()
virtual double rev::CANPIDController::GetIAccum |
( |
| ) |
const |
|
pure virtual |
Get the I accumulator of the PID controller. This is useful when wishing to see what the I accumulator value is to help with PID tuning
- Returns
- The value of the I accumulator
Implemented in rev::SparkMaxPIDController.
◆ SetFeedbackDevice()
Set the controller's feedback device.
The default feedback device is assumed to be the integrated encoder. This is used to changed to another feedback device for the controller, such as an analog sensor.
If there is a limited range on the feedback sensor that should be observed by the PIDController, it can be set by calling SetFeedbackSensorRange() on the sensor object.
- Parameters
-
sensor | The sensor to be used as a feedback device |
- Returns
- REVLibError::kOk if successful
Implemented in rev::SparkMaxPIDController.
◆ SetPositionPIDWrappingEnabled()
virtual REVLibError rev::CANPIDController::SetPositionPIDWrappingEnabled |
( |
bool |
enable | ) |
|
|
pure virtual |
◆ SetPositionPIDWrappingMaxInput()
virtual REVLibError rev::CANPIDController::SetPositionPIDWrappingMaxInput |
( |
double |
value | ) |
|
|
pure virtual |
◆ SetPositionPIDWrappingMinInput()
virtual REVLibError rev::CANPIDController::SetPositionPIDWrappingMinInput |
( |
double |
value | ) |
|
|
pure virtual |
◆ GetPositionPIDWrappingEnabled()
virtual bool rev::CANPIDController::GetPositionPIDWrappingEnabled |
( |
| ) |
const |
|
pure virtual |
Get whether or not PID Wrapping for position closed loop control is enabled
- Returns
- true if PID Wrapping is enabled
Implemented in rev::SparkMaxPIDController.
◆ GetPositionPIDWrappingMaxInput()
virtual double rev::CANPIDController::GetPositionPIDWrappingMaxInput |
( |
| ) |
const |
|
pure virtual |
Get the maximum input value for PID Wrapping with position closed loop control
- Returns
- the maximum input value
Implemented in rev::SparkMaxPIDController.
◆ GetPositionPIDWrappingMinInput()
virtual double rev::CANPIDController::GetPositionPIDWrappingMinInput |
( |
| ) |
const |
|
pure virtual |
Get the minimum input value for PID Wrapping with position closed loop control
- Returns
- the minimum input value
Implemented in rev::SparkMaxPIDController.
◆ SparkMaxPIDController
The documentation for this class was generated from the following file: