ME 305 Website by Cole Sheedy
controllerDriverW4.controller Class Reference

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

Public Member Functions

def __init__ (self, initKp, initKi)
 Controller constructor. More...
 
def run (self, omegaDes, omegaAct, positionDes, positionAct)
 Runs the PI-Controller. More...
 
def set_Kp (self, incomingKp)
 Sets the KpPrime gain value to a new Kp sent by the user. More...
 
def set_Ki (self, incomingKi)
 Sets the KiPrime gain value to a new Ki sent by the user. More...
 
def get_Kp (self)
 Returns the current KpPrime.
 
def get_Ki (self)
 Returns the current KiPrime.
 
def get_duty (self)
 Returns the most recent duty, L.
 

Public Attributes

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

Detailed Description

Implements desired functions of a pi-controller.

Constructor & Destructor Documentation

◆ __init__()

def controllerDriverW4.controller.__init__ (   self,
  initKp,
  initKi 
)

Controller constructor.

To initialize a pi-controller, all that is required is to input an initKp and initKi which should be float values.

Parameters
initKpThe KpPrime desired for the pi-controller.
initKiThe KiPrime desired for the pi-controller.

Member Function Documentation

◆ run()

def controllerDriverW4.controller.run (   self,
  omegaDes,
  omegaAct,
  positionDes,
  positionAct 
)

Runs the PI-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].
positinoDesDesired position value [degree].
positinoActActual position value [degree].
Returns
L Duty that is sent via PWM to the motor.

◆ set_Ki()

def controllerDriverW4.controller.set_Ki (   self,
  incomingKi 
)

Sets the KiPrime gain value to a new Ki sent by the user.

Parameters
incomingKiA float value for the new KiPrime.

◆ set_Kp()

def controllerDriverW4.controller.set_Kp (   self,
  incomingKp 
)

Sets the KpPrime gain 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: