ME 405 Term Project: Thermal Imaging Nerf Turret 1.0
A library that contains software used to control and fire an automated Nerf turret. The turret uses a MLX90640 Thermal Imaging camera to determine opponent's position and fire.
src.controller.PController Class Reference

The class initializes a proportional gain constant, Kp, and a desired setpoint for a system. More...

Public Member Functions

 __init__ (self, Kp, setPoint)
 This function initializes the proportional gain constant and desired setpoint.
 
 run (self, actualVal)
 This function handles proportional control by comparing the current system value to the desired set point, and then computing the error.
 
 set_setpoint (self, setPt)
 This function sets the desired setpoint.
 
 set_Kp (self, Kp)
 This function sets the user input gain.
 

Public Attributes

 Kp
 
 setPoint
 

Detailed Description

The class initializes a proportional gain constant, Kp, and a desired setpoint for a system.

When feedback is applied through the run() method, the error in the system is calculated, and the proportional gain is applied. Rapidly and repeatedly calling run() enables one to create a closed loop proportional controller.

Constructor & Destructor Documentation

◆ __init__()

src.controller.PController.__init__ ( self,
Kp,
setPoint )

This function initializes the proportional gain constant and desired setpoint.

Parameters
KpUser specified proportional gain constant.
setPointDesired setpoint for the system to be driven to.

Member Function Documentation

◆ run()

src.controller.PController.run ( self,
actualVal )

This function handles proportional control by comparing the current system value to the desired set point, and then computing the error.

The error is then multiplied by the gain Kp to obtain proportional control.

Parameters
actualValThe measured current value of the system.
Returns
The output to be sent to the system driver as a float. (For a motor system, this is the PWM duty cycle percentage to be sent to the motor)

◆ set_Kp()

src.controller.PController.set_Kp ( self,
Kp )

This function sets the user input gain.

Parameters
KpThe new proportional gain value.

◆ set_setpoint()

src.controller.PController.set_setpoint ( self,
setPt )

This function sets the desired setpoint.

Parameters
setPtThe new desired setpoint of the system.

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