ME 305 Website by Cole Sheedy
controllerTaskW3.controllerTask Class Reference

Runs the UI backend for the encoder reading and UI file. More...

Public Member Functions

def __init__ (self, period=5000)
 Constructor of controllerTask. More...
 
def run (self)
 Runs the finite state machine of the controllerTask. More...
 

Public Attributes

 myuart
 UART port object.
 
 n
 Counting variable.
 
 state
 State tracking variable. More...
 
 iteration
 Iteration variable for prompting.
 
 period
 Time between data point collections in microseconds.
 
 KpPrime
 Initializing to the default Kp stored in the shares file.
 
 mot_1
 Motor object.
 
 enc_1
 Encoder object.
 
 cont_1
 Controller object.
 
 omegaDes
 Desired omega in RPM.
 
 nextTime
 Timer to determine when in the future data can be collected.
 
 startTime
 Start time for when controllerTask.py begins to run.
 
 thisTime
 Timer to track current time and compare to nextTime, which is in the future.
 
 duty
 Duty determined by the controller.
 

Detailed Description

Runs the UI backend for the encoder reading and UI file.

Constructor & Destructor Documentation

◆ __init__()

def controllerTaskW3.controllerTask.__init__ (   self,
  period = 5000 
)

Constructor of controllerTask.

This constructor takes one attribute called period. The period how many microseconds desired in between collecting data points. Example: 20000us = .02s. It is important to run this task simulataneously in frequency to the UITask as they overlap.

Parameters
periodTime between data point collection in microseconds. Could be interpretted as the period in microseconds.s

Member Function Documentation

◆ run()

def controllerTaskW3.controllerTask.run (   self)

Runs the finite state machine of the controllerTask.

This finite state machine has approximately 4 states. The first state waits for a 'g' keystroke from the user to start data collection and an 'a' keystroke in case of the need to update to a new KpPrime value for the controller. The second state waits for other commands from the user like 'p', 's', 'd', 'f', 'o', 'k' and 'z'. Once done collecting data, the third state send the data collected, which is waiting in a queue in share.py, via the UART port to the front end.

Member Data Documentation

◆ state

controllerTaskW3.controllerTask.state

State tracking variable.

Character that was most recently updated in the share.py file.


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