This class implements a proportional controller for an ME 405 kit.
More...
|
def | __init__ (self, gain, setpoint) |
| Creates a proportional controller with a gain and setpoint.
|
|
def | run (self, output) |
| Evaluates the difference between motor position and setpoint, and returns a pwm percentage.
|
|
def | set_setpoint (self, setpoint) |
| Sets the setpoint of the controller.
|
|
def | set_kp (self, gain) |
| Sets the gain of the controller.
|
|
def | get_pos_data (self) |
| Returns the list of time and data (all in one list to make UART transmission easier)
|
|
|
| gain |
| Kp of the system.
|
|
| setpoint |
| Desired position (in encoder ticks)
|
|
| pos_data |
| Single list for both position and data (alternating positions)
|
|
| prev_time |
| Reference time to calculate time elapsed between encoder readings.
|
|
| time |
| Time elapsed since beginning of step response test.
|
|
This class implements a proportional controller for an ME 405 kit.
◆ __init__()
def closedloopcontrol.cl_loop.__init__ |
( |
|
self, |
|
|
|
gain, |
|
|
|
setpoint |
|
) |
| |
Creates a proportional controller with a gain and setpoint.
- Parameters
-
gain | Float variable representing the gain coefficient of the proportional control (Kp) |
setpoint | Integer representing the desired motor position in encoder ticks |
◆ get_pos_data()
def closedloopcontrol.cl_loop.get_pos_data |
( |
|
self | ) |
|
Returns the list of time and data (all in one list to make UART transmission easier)
◆ run()
def closedloopcontrol.cl_loop.run |
( |
|
self, |
|
|
|
output |
|
) |
| |
Evaluates the difference between motor position and setpoint, and returns a pwm percentage.
- Parameters
-
output | Integer representing current motor position in encoder ticks |
◆ set_kp()
def closedloopcontrol.cl_loop.set_kp |
( |
|
self, |
|
|
|
gain |
|
) |
| |
Sets the gain of the controller.
- Parameters
-
gain | Float representing the gain of the controller |
◆ set_setpoint()
def closedloopcontrol.cl_loop.set_setpoint |
( |
|
self, |
|
|
|
setpoint |
|
) |
| |
Sets the setpoint of the controller.
- Parameters
-
setpoint | Integer representing desired final motor position in encoder ticks |
The documentation for this class was generated from the following file: