The class initializes a proportional gain constant, Kp, and a desired setpoint for a system.
More...
|
| | __init__ (self, Kp, setPoint) |
| | This function initializes the proportional gain constant and desired setpoint.
|
| |
| | run (self, actualVal) |
| | This function handles proportional control by comparing the current system value to the desired set point, and then computing the error.
|
| |
| | set_setpoint (self, setPt) |
| | This function sets the desired setpoint.
|
| |
| | set_Kp (self, Kp) |
| | This function sets the user input gain.
|
| |
The class initializes a proportional gain constant, Kp, and a desired setpoint for a system.
When feedback is applied through the run() method, the error in the system is calculated, and the proportional gain is applied. Rapidly and repeatedly calling run() enables one to create a closed loop proportional controller.
◆ __init__()
| src.controller.PController.__init__ |
( |
| self, |
|
|
| Kp, |
|
|
| setPoint ) |
This function initializes the proportional gain constant and desired setpoint.
- Parameters
-
| Kp | User specified proportional gain constant. |
| setPoint | Desired setpoint for the system to be driven to. |
◆ run()
| src.controller.PController.run |
( |
| self, |
|
|
| actualVal ) |
This function handles proportional control by comparing the current system value to the desired set point, and then computing the error.
The error is then multiplied by the gain Kp to obtain proportional control.
- Parameters
-
| actualVal | The measured current value of the system. |
- Returns
- The output to be sent to the system driver as a float. (For a motor system, this is the PWM duty cycle percentage to be sent to the motor)
◆ set_Kp()
| src.controller.PController.set_Kp |
( |
| self, |
|
|
| Kp ) |
This function sets the user input gain.
- Parameters
-
| Kp | The new proportional gain value. |
◆ set_setpoint()
| src.controller.PController.set_setpoint |
( |
| self, |
|
|
| setPt ) |
This function sets the desired setpoint.
- Parameters
-
| setPt | The new desired setpoint of the system. |
The documentation for this class was generated from the following file: