ME 305 Website by Cole Sheedy
controllerDriverW3.controller Class Reference

Implements desired functions of a p-controller. More...

Public Member Functions

def __init__ (self, initKp)
 Controller constructor. More...
 
def run (self, omegaDes, omegaAct)
 Runs the p-controller. More...
 
def set_Kp (self, incomingKp)
 Sets the KpPrime value to a new Kp sent by the user. More...
 
def get_Kp (self)
 Returns the current KpPrime.
 
def get_duty (self)
 Returns the most recent duty, L.
 

Public Attributes

 KpPrime
 KpPrime for your controller.
 
 L
 Duty sent to motor via PWM.
 

Detailed Description

Implements desired functions of a p-controller.

Constructor & Destructor Documentation

◆ __init__()

def controllerDriverW3.controller.__init__ (   self,
  initKp 
)

Controller constructor.

To initialize a p-controller, all that is required is to input a initKp which should be a flaot value.

Parameters
initKpThe KpPrime desired for the p-controller.

Member Function Documentation

◆ run()

def controllerDriverW3.controller.run (   self,
  omegaDes,
  omegaAct 
)

Runs the p-controller.

This function corrects the error in omega by mulitplying by the gain to determine the duty required to get the motor closer to the desired omega. It also prevents the duty from setting outside of -100% < L < 100% because the motors we use don't like to go above this range.

Parameters
omegaDesDesired omega value [RPM].
omegaActActual omega value [RPM].

◆ set_Kp()

def controllerDriverW3.controller.set_Kp (   self,
  incomingKp 
)

Sets the KpPrime value to a new Kp sent by the user.

Parameters
incomingKpA float value for the new KpPrime.

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