Lucas Murray ME 305 Portfolio
Functions | Variables
taskUser.py File Reference

Runs a user interface for someone to run the encoder. More...

Functions

def taskUser.taskUserFcn (taskName, period, zFlag, mFlag, MFlag, cFlag, wFlag, data, delta, duty, controlParameters, cLoopFeedback)
 A generator to implement the UI task as an FSM. More...
 
def taskUser.printUI ()
 Prints the command screen for the user interface.
 

Variables

 taskUser.S0_INIT = micropython.const(0)
 Defines the State 0 Initiate variable as the constant 0.
 
 taskUser.S1_CMD = micropython.const(1)
 Defines the State 1 Command variable as the constant 1.
 
 taskUser.S2_ZERO = micropython.const(2)
 Defines the State 2 Zero variable as the constant 2.
 
 taskUser.S3_PRINT = micropython.const(3)
 Defines the State 3 Print variable as the constant 3.
 
 taskUser.S4_DELTA = micropython.const(4)
 Defines the State 4 Delta variable as the constant 4.
 
 taskUser.S5_COLLECT = micropython.const(5)
 Defines the State 5 Collect variable as the constant 5.
 
 taskUser.S6_VELOCITY = micropython.const(6)
 Defines the State 6 Velocity variable as the constant 6.
 
 taskUser.S7_GETDUTY = micropython.const(7)
 Defines the State 7 Duty Cycle variable as the constant 7.
 
 taskUser.S8_TEST = micropython.const(8)
 Defines the State 8 Test variable as the constant 8.
 
 taskUser.S9_FAULT = micropython.const(9)
 Defines the State 9 Fault variable as the constant 9.
 
 taskUser.S10_REF = micropython.const(10)
 Defines the State 10 Reference Velocity variable as the constant 10.
 
 taskUser.S11_SETGAIN = micropython.const(11)
 Defines the State 11 Set Gain variable as the constant 11.
 
 taskUser.S12_CLOOP = micropython.const(12)
 Defines the State 12 Closed Loop Control variable as the constant 12.
 
 taskUser.S14_STEP = micropython.const(14)
 Defines the State 14 Step Response Test variable as the constant 14.
 
 taskUser.S20_END = micropython.const(20)
 Defines the State 20 End variable as the constant 20.
 

Detailed Description

Runs a user interface for someone to run the encoder.

Uses a function to accept user input and run the desired method. Uses the shared variables to read data written by the encoder and motor tasks and to send flags that will tell either of the functions to perform a certain action.


The State Transition Diagram for taskUser can be seen here.


Source Code: https://bitbucket.org/lmurray03/me305_lucas_murray/src/master/Lab%200x02/taskUser.py

Author
Lucas Murray
Max Cassady
Date
February 24, 2022

Function Documentation

◆ taskUserFcn()

def taskUser.taskUserFcn (   taskName,
  period,
  zFlag,
  mFlag,
  MFlag,
  cFlag,
  wFlag,
  data,
  delta,
  duty,
  controlParameters,
  cLoopFeedback 
)

A generator to implement the UI task as an FSM.

The task runs as a generator function and requires a task name, interval and zFlag status to be specified.

Parameters
taskNameThe name of the task as a string.
periodThe task interval or period specified as an integer number of microseconds.
zFlagBoolean variable shared between taskUser and taskEncoder for the zero command
mFlagBoolean variable shared between taskUser and taskMotor for the motor1 duty cycle command
MFlagBoolean variable shared between taskUser and taskMotor for the motor2 duty cycle command
cFlagBoolean variable shared between taskUser and taskMotor for the reset fault command
wFlagBoolean variable shared between taskUser and taskMotor for the closed loop control toggle command
dataTuple data shared between taskUser and taskEncoder for data collection
deltaTuple shared between taskUser and taskEncoder that stores delta data
dutyTuple shared between taskUser and taskMotor that stores the input duty value
controlParametersTuple shared between taskUser and taskMotor that stores the input reference velocity and proportional gain
cLoopFeedbackTuple shared between taskUser and taskMotor that stores the closed loop error feedback from each update