Mechatronics Portfolio
Logan Williamson's Mechatronics Portfolio and Documentation Repository
|
A closed-loop control driver. More...
Public Member Functions | |
def | __init__ (self, K_p, K_d, setpoint, position, velocity, compensation) |
Initializes and returns a closedLoop object. More... | |
def | run (self, K_p, K_d, setpoint, position, velocity, compensation) |
Initializes and returns a closedLoop object. More... | |
Public Attributes | |
K_p | |
K_p is the proportional control gain for a closedLoop.ClosedLoop object. More... | |
K_d | |
K_d is the derivative control gain for a closedLoop.ClosedLoop object. More... | |
pos_ref | |
pos_ref is the position reference value used in the closed loop control algorithm. More... | |
pos | |
pos is the measured/actual position value read by the program for use in the controller More... | |
v_ref | |
v_ref is the setpoint velocity value read by the program for use in the controller More... | |
vel | |
vel is the measured/actual velocity value read by the program for use in the controller More... | |
comp | |
comp is an attribute that stores an adjustment or compensation to be added to PD controller output. More... | |
L | |
L is the calculated duty cycle output of the controller. More... | |
A closed-loop control driver.
Objects of this class can be used to take in input parameters representing the measured and reference values and return the actuation signal after computing the controller output.
def closedLoop.ClosedLoop.__init__ | ( | self, | |
K_p, | |||
K_d, | |||
setpoint, | |||
position, | |||
velocity, | |||
compensation | |||
) |
Initializes and returns a closedLoop object.
Upon initialization, sets and returns all base objects to 0 and or respective pins. Inputs expected are the proportional control gain, derivative control gain, setpoint, position and velocity. The position and velocity are initally set as 0 and then updated iteravely.
K_p | The closed-loop controller proportional gain |
K_d | The closed-loop controller derivative gain |
setpoint | The desired/reference value for the controller. Same units as position |
position | parameter representing the system measurement/feedback for the controller. Same units as setpoint. |
velocity | parameter representing the first time derivative of the position measurement. |
compensation | variable for direct adjustment of a single control loop output. This can be used for offsets in the event that the system equilibrium does not match program equilibrium. |
def closedLoop.ClosedLoop.run | ( | self, | |
K_p, | |||
K_d, | |||
setpoint, | |||
position, | |||
velocity, | |||
compensation | |||
) |
Initializes and returns a closedLoop object.
Upon initialization, sets and returns all base objects to 0 and or respective pins. Inputs expected are the proportional control gain, derivative control gain, setpoint, position and velocity. The position and velocity are initally set as 0 and then updated iteravely.
K_p | The closed-loop controller proportional gain |
K_d | The closed-loop controller derivative gain |
setpoint | The desired/reference value for the controller. Same units as position |
position | parameter representing the system measurement/feedback for the controller. Same units as setpoint. |
velocity | parameter representing the first time derivative of the position measurement. |
compensation | variable for direct adjustment of a single control loop output. This can be used for offsets in the event that the system equilibrium does not match program equilibrium. |
closedLoop.ClosedLoop.comp |
comp is an attribute that stores an adjustment or compensation to be added to PD controller output.
The value of comp can be used to store an angle offset or duty cycle compensation factor. Which of these values is stored in comp depends on the controller output, but should reflect the units of L.
closedLoop.ClosedLoop.K_d |
K_d is the derivative control gain for a closedLoop.ClosedLoop object.
K_d represents the derivative closed-loop controller gain associated with a closedLoop.ClosedLoop object
closedLoop.ClosedLoop.K_p |
K_p is the proportional control gain for a closedLoop.ClosedLoop object.
K_p represents the proportional closed-loop controller gain associated with a closedLoop.ClosedLoop object
closedLoop.ClosedLoop.L |
L is the calculated duty cycle output of the controller.
L represents the duty cycle computed by the closed loop control algorithm to be passed into the taskMotor.py task for manipulation of the motor speed when the program is in closed-loop control mode.
closedLoop.ClosedLoop.pos |
pos is the measured/actual position value read by the program for use in the controller
The value of pos represents measurements from physical peripherals that are passed into the closedLoop.ClosedLoop object for use in the controller.
closedLoop.ClosedLoop.pos_ref |
pos_ref is the position reference value used in the closed loop control algorithm.
The value of pos_ref is chosen and passed in by the user to produce the desired controller output after the controller processes this value with data collected from sensors and passed in via other parameters.
closedLoop.ClosedLoop.v_ref |
v_ref is the setpoint velocity value read by the program for use in the controller
The value of v_ref represents the chosen velocity that a closedLoop.ClosedLoop object should use when computing the controller output. It is assumed to be zero upon startup, but can be changed depending on the desired controller behavior.
closedLoop.ClosedLoop.vel |
vel is the measured/actual velocity value read by the program for use in the controller
The value of vel represents measurements from physical peripherals that are passed into the closedLoop.ClosedLoop object for use in the controller.