ME 305
Functions
task_encoder.py File Reference

Directly interfaces with encoder. More...

Functions

def task_encoder.taskEncoder (taskname, period, zFlag, pFlag, dFlag, gFlag, position, delta, P, T)
 Generator function to inteface with encoder. More...
 

Detailed Description

Directly interfaces with encoder.

Called at a frequency of 100Hz, this task file uses the class Encoder within the encoder.py drive file to interface with the encoder. Continually updating the position of the encoder, this task file uses flag values altered by the user in task_user.py to execute actions defined in encoder.py. Once the action is completed, these flags are reset.

The below image shows the state transition diagram employed for this task file:

Author
Ryan Dean
Zachary Hendrix
Date
2/1/2022

Function Documentation

◆ taskEncoder()

def task_encoder.taskEncoder (   taskname,
  period,
  zFlag,
  pFlag,
  dFlag,
  gFlag,
  position,
  delta,
  P,
  T 
)

Generator function to inteface with encoder.

Generator function receives values of certain flags that correspond to a desired action from the user. This then triggers the function to interact with the encoder.py drive file, performing the necessary action or storing the value for the user to then see with their interface.

Parameters
tasknameName of the task being performed.
periodSpecifies how long the task has to perform its function. received as 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 transferred to task_user.py
deltaStores the delta (speed) of the encoder to be transferred to task_user.py
PStores current position of encoder for data collection
TStores current time of encoder for data collection
Returns
yields None