Implements desired functions of a pi-controller.
More...
|
def | __init__ (self, initKp, initKi) |
| Controller constructor. More...
|
|
def | run (self, omegaDes, omegaAct, positionDes, positionAct) |
| Runs the PI-Controller. More...
|
|
def | set_Kp (self, incomingKp) |
| Sets the KpPrime gain value to a new Kp sent by the user. More...
|
|
def | set_Ki (self, incomingKi) |
| Sets the KiPrime gain value to a new Ki sent by the user. More...
|
|
def | get_Kp (self) |
| Returns the current KpPrime.
|
|
def | get_Ki (self) |
| Returns the current KiPrime.
|
|
def | get_duty (self) |
| Returns the most recent duty, L.
|
|
|
| KpPrime |
| KpPrime for your controller.
|
|
| KiPrime |
| KiPrime for your controller.
|
|
| L |
| Duty sent to motor via PWM.
|
|
Implements desired functions of a pi-controller.
◆ __init__()
def controllerDriverW4.controller.__init__ |
( |
|
self, |
|
|
|
initKp, |
|
|
|
initKi |
|
) |
| |
Controller constructor.
To initialize a pi-controller, all that is required is to input an initKp and initKi which should be float values.
- Parameters
-
initKp | The KpPrime desired for the pi-controller. |
initKi | The KiPrime desired for the pi-controller. |
◆ run()
def controllerDriverW4.controller.run |
( |
|
self, |
|
|
|
omegaDes, |
|
|
|
omegaAct, |
|
|
|
positionDes, |
|
|
|
positionAct |
|
) |
| |
Runs the PI-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]. |
positinoDes | Desired position value [degree]. |
positinoAct | Actual position value [degree]. |
- Returns
- L Duty that is sent via PWM to the motor.
◆ set_Ki()
def controllerDriverW4.controller.set_Ki |
( |
|
self, |
|
|
|
incomingKi |
|
) |
| |
Sets the KiPrime gain value to a new Ki sent by the user.
- Parameters
-
incomingKi | A float value for the new KiPrime. |
◆ set_Kp()
def controllerDriverW4.controller.set_Kp |
( |
|
self, |
|
|
|
incomingKp |
|
) |
| |
Sets the KpPrime gain 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: