|
Sylib
A C++ Library For V5
|
Custom Velocity Controller. More...
#include <math.hpp>
Public Member Functions | |
| SpeedControllerInfo (kv_fn_t kV=[](double rpm) { return 0;}, double kP=0, double kI=0, double kD=0, double kH=0, bool antiWindupEnabled=false, double antiWindupRange=0, bool pRangeEnabled=false, double pRange=0, double kP2=0, double maxVoltageRange=0, bool coastDownEnabled=false, double coastDownRange=0, double coastDownModifier=1) | |
Public Attributes | |
| kv_fn_t | kV = [](double rpm) { return 0; } |
| Lambda function to use for feedforward kV calculation. More... | |
| double | kP = 0 |
| P controller gain. More... | |
| double | kI = 0 |
| I controller gain. More... | |
| double | kD = 0 |
| D controller gain. More... | |
| double | kH = 0 |
| TBH controller gain. More... | |
| bool | antiWindupEnabled = false |
| Whether or not to enable anti-windup on the I controller. More... | |
| double | antiWindupRange = 0 |
| Range to use for the anti-windup on the I controller, if enabled. More... | |
| bool | pRangeEnabled = false |
| Whether or not to change the P controller gain within a certain target range. More... | |
| double | pRange = 0 |
| Range to use for changing P controller gain, if enabled. More... | |
| double | kP2 = 0 |
| Secondary kP value that the P controller uses when inside the target range, if enabled. More... | |
| double | maxVoltageRange = 0 |
| Positive range from target above which the motor applies max voltage outside of. More... | |
| bool | coastDownEnabled = false |
| Whether or not to enable coast-down to more quickly move to a lower velocity. More... | |
| double | coastDownRange = 0 |
| Negative range from target below which the applied voltage is multiplied by the coast-down modifier. More... | |
| double | coastDownModifier = 1 |
| Constant to multiple the applied voltage by if error is below the coast-down range. More... | |
Custom Velocity Controller.
To disable a particular controller, set its gain to 0.
|
inline |
| bool sylib::SpeedControllerInfo::antiWindupEnabled = false |
Whether or not to enable anti-windup on the I controller.
| double sylib::SpeedControllerInfo::antiWindupRange = 0 |
Range to use for the anti-windup on the I controller, if enabled.
| bool sylib::SpeedControllerInfo::coastDownEnabled = false |
Whether or not to enable coast-down to more quickly move to a lower velocity.
| double sylib::SpeedControllerInfo::coastDownModifier = 1 |
Constant to multiple the applied voltage by if error is below the coast-down range.
| double sylib::SpeedControllerInfo::coastDownRange = 0 |
Negative range from target below which the applied voltage is multiplied by the coast-down modifier.
| double sylib::SpeedControllerInfo::kD = 0 |
D controller gain.
| double sylib::SpeedControllerInfo::kH = 0 |
TBH controller gain.
| double sylib::SpeedControllerInfo::kI = 0 |
I controller gain.
| double sylib::SpeedControllerInfo::kP = 0 |
P controller gain.
| double sylib::SpeedControllerInfo::kP2 = 0 |
Secondary kP value that the P controller uses when inside the target range, if enabled.
| kv_fn_t sylib::SpeedControllerInfo::kV = [](double rpm) { return 0; } |
Lambda function to use for feedforward kV calculation.
| double sylib::SpeedControllerInfo::maxVoltageRange = 0 |
Positive range from target above which the motor applies max voltage outside of.
| double sylib::SpeedControllerInfo::pRange = 0 |
Range to use for changing P controller gain, if enabled.
| bool sylib::SpeedControllerInfo::pRangeEnabled = false |
Whether or not to change the P controller gain within a certain target range.