![]() |
Pen Plotter Project
|
Interface with closed loop controller. More...
Public Member Functions | |
| def | __init__ (self, PID, satLim, setPoint) |
| Constructs a closed loop controller. More... | |
| def | update (self, Read, startTime) |
| Updates the controller for timing and error between a read value and the setpoint. More... | |
| def | get_Times (self) |
| Returns time array for a step response. More... | |
| def | getPositions (self) |
| Returns motor positions array for a step response. More... | |
| def | get_PID (self) |
| Gets PID object. More... | |
| def | set_PID (self, PID) |
| Sets PID gains. More... | |
| def | set_setPoint (self, setPoint) |
| Sets or resets setpoint to a certain value. | |
| def | sat (self, sat_duty) |
| Saturation functionallity. More... | |
Public Attributes | |
| firstTime | |
| Instantiates PID controller with gains. More... | |
| i | |
| PID | |
| satLim | |
| Instantiates duty saturation upper and lower bounds. | |
| setPoint | |
| esum | |
| Sum of error over a difference in time. | |
| laste | |
| Previous error. | |
| times | |
| motorPositions | |
Interface with closed loop controller.
Contains all methods that will be used in task_hardware to set the duty cycle based on closed loop control.
| def control.ClosedLoop.__init__ | ( | self, | |
| PID, | |||
| satLim, | |||
| setPoint | |||
| ) |
Constructs a closed loop controller.
Creates variables necessary to instantiate a controller such as timing, PID gains, saturation limit, setpoint value, error, and arrays used in recording a step response
| PID | is a list containing the three gain values for Kp/Ki/Kd |
| satLim | is a list containing the upper and lower bounds of saturation |
| def control.ClosedLoop.get_PID | ( | self | ) |
Gets PID object.
Quick method to determine what controller is using for PID gains.
| def control.ClosedLoop.get_Times | ( | self | ) |
Returns time array for a step response.
| def control.ClosedLoop.getPositions | ( | self | ) |
Returns motor positions array for a step response.
| def control.ClosedLoop.sat | ( | self, | |
| sat_duty | |||
| ) |
Saturation functionallity.
Controls if a duty is too large from what is calculated in update method.
| sat_duty | is the value sent by what is calculated in update method. |
| def control.ClosedLoop.set_PID | ( | self, | |
| PID | |||
| ) |
Sets PID gains.
Sets PID gains to some new list of values for Kp/Ki/Kd
| PID | is a list containing the three gain values for Kp/Ki/Kd |
| def control.ClosedLoop.update | ( | self, | |
| Read, | |||
| startTime | |||
| ) |
Updates the controller for timing and error between a read value and the setpoint.
| Read | is the value returned by the sensor detecting the current state of the system (encoder position) |
| startTime | is the initial time for a step response. |
| control.ClosedLoop.firstTime |
Instantiates PID controller with gains.
Error signal which is the difference between a reference and input (current) value.