Implements desired functions of a p-controller.
More...
|
def | __init__ (self, initKp) |
| Controller constructor. More...
|
|
def | run (self, omegaDes, omegaAct) |
| Runs the p-controller. More...
|
|
def | set_Kp (self, incomingKp) |
| Sets the KpPrime value to a new Kp sent by the user. More...
|
|
def | get_Kp (self) |
| Returns the current KpPrime.
|
|
def | get_duty (self) |
| Returns the most recent duty, L.
|
|
|
| KpPrime |
| KpPrime for your controller.
|
|
| L |
| Duty sent to motor via PWM.
|
|
Implements desired functions of a p-controller.
◆ __init__()
def controllerDriverW3.controller.__init__ |
( |
|
self, |
|
|
|
initKp |
|
) |
| |
Controller constructor.
To initialize a p-controller, all that is required is to input a initKp which should be a flaot value.
- Parameters
-
initKp | The KpPrime desired for the p-controller. |
◆ run()
def controllerDriverW3.controller.run |
( |
|
self, |
|
|
|
omegaDes, |
|
|
|
omegaAct |
|
) |
| |
Runs the p-controller.
This function corrects the error in omega by mulitplying by the gain to determine the duty required to get the motor closer to the desired omega. It also prevents the duty from setting outside of -100% < L < 100% because the motors we use don't like to go above this range.
- Parameters
-
omegaDes | Desired omega value [RPM]. |
omegaAct | Actual omega value [RPM]. |
◆ set_Kp()
def controllerDriverW3.controller.set_Kp |
( |
|
self, |
|
|
|
incomingKp |
|
) |
| |
Sets the KpPrime value to a new Kp sent by the user.
- Parameters
-
incomingKp | A float value for the new KpPrime. |
The documentation for this class was generated from the following file: