Sylib
A C++ Library For V5
|
Feedforward Controller. More...
#include <math.hpp>
Public Member Functions | |
VoltageEstimation (kv_fn_t kV, double motorGearing=200) | |
Creates a simple feedforward controller for a V5 motor. More... | |
double | estimate (double rpm) |
Outputs an estimated voltage value for acheiving the desired RPM based on the kV function supplied in the constructor. More... | |
kv_fn_t | getKv () const |
Gets the current kV function. More... | |
double | getMotorGearing () const |
Gets the set motor gearing for the estimator. More... | |
void | setkV (kv_fn_t value) |
Sets the kV function. More... | |
double | getOutput () const |
Gets the current stored output value without adding any new input. More... | |
Feedforward Controller.
sylib::VoltageEstimation::VoltageEstimation | ( | kv_fn_t | kV, |
double | motorGearing = 200 |
||
) |
Creates a simple feedforward controller for a V5 motor.
kV | A lambda function that takes double as an input for target RPM and returns a voltage constant to use for the estimation |
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::VoltageEstimation::estimate | ( | double | rpm | ) |
Outputs an estimated voltage value for acheiving the desired RPM based on the kV function supplied in the constructor.
rpm | The target velocity of the motor, in RPM |
kv_fn_t sylib::VoltageEstimation::getKv | ( | ) | const |
Gets the current kV function.
double sylib::VoltageEstimation::getMotorGearing | ( | ) | const |
Gets the set motor gearing for the estimator.
double sylib::VoltageEstimation::getOutput | ( | ) | const |
Gets the current stored output value without adding any new input.
void sylib::VoltageEstimation::setkV | ( | kv_fn_t | value | ) |
Sets the kV function.
value | A lambda function that takes double as an input for target RPM and returns a voltage constant to use for the estimation |