ME 305
Functions | Variables
task_user.py File Reference

Handles the user UI of our encoder system. More...

Functions

def task_user.taskUser (taskname, period, zFlag, pFlag, dFlag, gFlag, mFlag, MFlag, position, delta, P, T, duty, Dtime, eFlag, mode, Kp, Y)
 A generator to implement the UI task as an Finite State Machine. More...
 

Variables

 task_user.S12_Kp = micropython.const(12)
 State 12 - Set proportional gain.
 
 task_user.S13_Y = micropython.const(13)
 State 13 - Define set point.
 
 task_user.S14_CL = micropython.const(14)
 State 14 - Enter closed loop.
 

Detailed Description

Handles the user UI of our encoder system.

This file interacts directly with user keyboard inputs to then send the request to the task_encoder.py file. It uses six states that correspond to different key in puts to send the program into its appropriate settings based on the user input.

Author
Ryan Dean
Zachary Hendrix
Date
2/1/2022

Function Documentation

◆ taskUser()

def task_user.taskUser (   taskname,
  period,
  zFlag,
  pFlag,
  dFlag,
  gFlag,
  mFlag,
  MFlag,
  position,
  delta,
  P,
  T,
  duty,
  Dtime,
  eFlag,
  mode,
  Kp,
  Y 
)

A generator to implement the UI task as an Finite State Machine.

The task runs as a generator function and requires a task name and interval to be specified. This task file receives flag values altered by the user. These flags are then shared with task_encoder.py where that task file can execute actions defined in encoder.py. Once the desired task is completed, the state is reset back to idle state (State 1).

Parameters
taskNameThe name of the task as a string.
periodSpecifies how long the task has to perform its function in microseconds. Specified as an integer.
zFlagHolds True or False value to know when zeroing command was called by the user to zero the current position of the encoder.
pFlagHolds True or False value to know when position command was called by the user to know the current position of the encoder.
dFlagHolds True or False value to know when delta command was called by the user to know the current delta (speed) of the encoder.
gFlagHolds True or False value to know when data collection command was called by the user to collect current time and position data.
positionStores current position of encoder to be read in task_user.py
deltaStores the delta (speed) of the encoder to be read in to task_user.py
PStores current position of encoder for data collection
TStores current time of encoder for data collection
dutyStores duty value to pass into motor
DtimeRepresents the change in time between updates
eFlagHolds True or False value to know when to enable motors
modeContains string to know whether in open or closed loop
KpContains proportional gain value
YContains set point value
Returns
yield None