nerf-turret 1
Infrared targeting nerf turret
Loading...
Searching...
No Matches
closedloopcontrol.cl_loop Class Reference

This class implements a proportional controller for an ME 405 kit. More...

Public Member Functions

def __init__ (self, gain, setpoint)
 Creates a proportional controller with a gain and setpoint.
 
def run (self, output)
 Evaluates the difference between motor position and setpoint, and returns a pwm percentage.
 
def set_setpoint (self, setpoint)
 Sets the setpoint of the controller.
 
def set_kp (self, gain)
 Sets the gain of the controller.
 
def get_pos_data (self)
 Returns the list of time and data (all in one list to make UART transmission easier)
 

Public Attributes

 gain
 Kp of the system.
 
 setpoint
 Desired position (in encoder ticks)
 
 pos_data
 Single list for both position and data (alternating positions)
 
 prev_time
 Reference time to calculate time elapsed between encoder readings.
 
 time
 Time elapsed since beginning of step response test.
 

Detailed Description

This class implements a proportional controller for an ME 405 kit.

Constructor & Destructor Documentation

◆ __init__()

def closedloopcontrol.cl_loop.__init__ (   self,
  gain,
  setpoint 
)

Creates a proportional controller with a gain and setpoint.

Parameters
gainFloat variable representing the gain coefficient of the proportional control (Kp)
setpointInteger representing the desired motor position in encoder ticks

Member Function Documentation

◆ get_pos_data()

def closedloopcontrol.cl_loop.get_pos_data (   self)

Returns the list of time and data (all in one list to make UART transmission easier)

◆ run()

def closedloopcontrol.cl_loop.run (   self,
  output 
)

Evaluates the difference between motor position and setpoint, and returns a pwm percentage.

Parameters
outputInteger representing current motor position in encoder ticks

◆ set_kp()

def closedloopcontrol.cl_loop.set_kp (   self,
  gain 
)

Sets the gain of the controller.

Parameters
gainFloat representing the gain of the controller

◆ set_setpoint()

def closedloopcontrol.cl_loop.set_setpoint (   self,
  setpoint 
)

Sets the setpoint of the controller.

Parameters
setpointInteger representing desired final motor position in encoder ticks

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