Mechatronics Portfolio
Logan Williamson's Mechatronics Portfolio and Documentation Repository
Public Member Functions | Public Attributes | List of all members
closedLoop.ClosedLoop Class Reference

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ __init__()

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.

Parameters
K_pThe closed-loop controller proportional gain
K_dThe closed-loop controller derivative gain
setpointThe desired/reference value for the controller. Same units as position
positionparameter representing the system measurement/feedback for the controller. Same units as setpoint.
velocityparameter representing the first time derivative of the position measurement.
compensationvariable 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.

Member Function Documentation

◆ run()

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.

Parameters
K_pThe closed-loop controller proportional gain
K_dThe closed-loop controller derivative gain
setpointThe desired/reference value for the controller. Same units as position
positionparameter representing the system measurement/feedback for the controller. Same units as setpoint.
velocityparameter representing the first time derivative of the position measurement.
compensationvariable 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.

Member Data Documentation

◆ comp

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.

◆ K_d

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

◆ K_p

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

◆ L

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.

◆ pos

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.

◆ pos_ref

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.

◆ v_ref

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.

◆ vel

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.


The documentation for this class was generated from the following file: