SCARA Robot Term Project
controlloop.ClosedLoop Class Reference

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
 

Detailed Description

Closed Loop Control System.

This class contains useful functions we need for the controller to be effective at getting to the motor setpoint.

Constructor & Destructor Documentation

◆ __init__()

def controlloop.ClosedLoop.__init__ (   self,
  Kp,
  Ki,
  Kd,
  ref 
)

takes in gain value and setpoint

This instantiates necessary objects to capture controller's values.

Parameters
Kpgain value
refreference point

Member Function Documentation

◆ add_data()

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.

◆ run()

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.

Parameters
poscurrent position

◆ set_Kp()

def controlloop.ClosedLoop.set_Kp (   self,
  Kp 
)

sets proportional gain value

Parameters
Kpgain value

◆ set_ref()

def controlloop.ClosedLoop.set_ref (   self,
  ref 
)

sets reference point

Parameters
refset point

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