|
Sylib
A C++ Library For V5
|
D Controller. More...
#include <math.hpp>
Public Member Functions | |
| DerivativeController (double kD, std::shared_ptr< double > error, double motorGearing=200) | |
| Creates a D controller for a V5 motor. More... | |
| double | update () |
| Calculates controller output based on the current error value. More... | |
| double | getkD () const |
| Gets the kD constant. More... | |
| double | getOutput () const |
| Gets the current stored output value without calculating a new value. More... | |
| double | getCurrentTime () const |
| Gets the current time the controller is using. More... | |
| uint32_t | getdT () const |
| Gets the most recent time difference between updates. More... | |
| void | setkD (double gain) |
| Sets the kD constant. More... | |
| double | operator* () |
| Operator overload for getting the current filter ouput. More... | |
D Controller.
| sylib::DerivativeController::DerivativeController | ( | double | kD, |
| std::shared_ptr< double > | error, | ||
| double | motorGearing = 200 |
||
| ) |
Creates a D controller for a V5 motor.
| kD | Derivative gain |
| error | A pointer to a double containing the error value to use for calculations |
| motorGearing | The output speed of the motor, in RPM, if the motor internally is spinning at 3600 RPM. 200 is default for a green motor cartridge |
| double sylib::DerivativeController::getCurrentTime | ( | ) | const |
Gets the current time the controller is using.
| uint32_t sylib::DerivativeController::getdT | ( | ) | const |
Gets the most recent time difference between updates.
| double sylib::DerivativeController::getkD | ( | ) | const |
Gets the kD constant.
| double sylib::DerivativeController::getOutput | ( | ) | const |
Gets the current stored output value without calculating a new value.
| double sylib::DerivativeController::operator* | ( | ) |
Operator overload for getting the current filter ouput.
| void sylib::DerivativeController::setkD | ( | double | gain | ) |
Sets the kD constant.
| gain | Derivative gain |
| double sylib::DerivativeController::update | ( | ) |
Calculates controller output based on the current error value.