Closed Loop Control System. More...
Public Member Functions | |
| def | __init__ (self, Kp, Ki, Kd, ref) |
| takes in gain value and setpoint More... | |
| def | run (self, pos, ref) |
| runs the proportional control loop More... | |
| def | set_ref (self, ref) |
| sets reference point More... | |
| def | set_Kp (self, Kp) |
| sets proportional gain value More... | |
| def | add_data (self) |
| makes list of position and time More... | |
Public Attributes | |
| Kp | |
| Ki | |
| Kd | |
| ref | |
| listpos | |
| time | |
| start_time | |
| enc1 | |
| old_pos | |
| old_time | |
| error | |
| i | |
| integral | |
| deriv | |
| pos | |
| new_time | |
| new_pos | |
| time_diff | |
| current_time | |
Closed Loop Control System.
This class contains useful functions we need for the controller to be effective at getting to the motor setpoint.
| def controlloop.ClosedLoop.__init__ | ( | self, | |
| Kp, | |||
| Ki, | |||
| Kd, | |||
| ref | |||
| ) |
takes in gain value and setpoint
This instantiates necessary objects to capture controller's values.
| Kp | gain value |
| ref | reference point |
| def controlloop.ClosedLoop.add_data | ( | self | ) |
makes list of position and time
Time is gathered as column 1 while column 2 is encoder position. Plotting these two together gives a nice step response.
| def controlloop.ClosedLoop.run | ( | self, | |
| pos, | |||
| ref | |||
| ) |
runs the proportional control loop
Only acting as a P-controller, this function multiplies our gain by the difference between the reference point and the current position.
| pos | current position |
| def controlloop.ClosedLoop.set_Kp | ( | self, | |
| Kp | |||
| ) |
sets proportional gain value
| Kp | gain value |
| def controlloop.ClosedLoop.set_ref | ( | self, | |
| ref | |||
| ) |
sets reference point
| ref | set point |