Ball Balancer Project
|
Contains all of the functions that are responsible for closed-loop PID control. More...
Public Member Functions | |
def | __init__ (self) |
A function that initializes the controller driver. More... | |
def | update_inner (self, eul_ang, dt, ang_vel, ref) |
Updates the duty cycle under closed-loop control. More... | |
def | update_outer (self, eul_ang, dt, ang_vel, ref, contact) |
Updates the duty cycle under closed-loop control. More... | |
def | set_gain_inner (self, Kp, KI, Kd) |
Sets the gain and velocity reference values. More... | |
def | set_gain_outer (self, Kp, KI, Kd) |
Sets the gain and velocity reference values. More... | |
Contains all of the functions that are responsible for closed-loop PID control.
This class is used to calculate a value based on a closed loop PID controller architecture. This calculated value can be anything, as long as the correct inputs are given, making this driver very reusable. Separate functions were used for the inner and outer control loops to easily differentiate the variables from each other.
def ClosedLoop.ClosedLoop.__init__ | ( | self | ) |
A function that initializes the controller driver.
This fucntion sets the limits for closed-loop duty cycles.
def ClosedLoop.ClosedLoop.set_gain_inner | ( | self, | |
Kp, | |||
KI, | |||
Kd | |||
) |
Sets the gain and velocity reference values.
This function passed the user-selected values for gain and Vref and passes them to the update() function.
Kp | is the share of the user-requested proportional gain. |
Ki | is the share of the user-requested integral gain. |
omega_ref | is the velocity requested by the user in taskUser. |
def ClosedLoop.ClosedLoop.set_gain_outer | ( | self, | |
Kp, | |||
KI, | |||
Kd | |||
) |
Sets the gain and velocity reference values.
This function passed the user-selected values for gain and Vref and passes them to the update() function.
Kp | is the share of the user-requested proportional gain. |
Ki | is the share of the user-requested integral gain. |
omega_ref | is the velocity requested by the user in taskUser. |
def ClosedLoop.ClosedLoop.update_inner | ( | self, | |
eul_ang, | |||
dt, | |||
ang_vel, | |||
ref | |||
) |
Updates the duty cycle under closed-loop control.
This function is in charge of actually using the gains to assign a duty cycle to a motor to minimize error.
omega_meas | is the current velocity of the motor. |
def ClosedLoop.ClosedLoop.update_outer | ( | self, | |
eul_ang, | |||
dt, | |||
ang_vel, | |||
ref, | |||
contact | |||
) |
Updates the duty cycle under closed-loop control.
This function is in charge of actually using the gains to assign a duty cycle to a motor to minimize error.
omega_meas | is the current velocity of the motor. |