ME 305 Group 6 Documentation
Functions | Variables
taskEncoder_04.py File Reference

Manages the states for the encoder task. More...

Functions

def taskEncoder_04.taskEncoderFcn_04 (str taskName, int period, int sample_period, shares_04.Share_04 zFlag, shares_04.Share_04 pFlag, shares_04.Share_04 dFlag, shares_04.Share_04 gFlag, shares_04.Share_04 sFlag, shares_04.Share_04 dataPrint, shares_04.Share_04 testData, shares_04.Share_04 vFlag, shares_04.Share_04 input_signal)
 Function to execute the state management functionality for the encoder tasks. More...
 

Variables

 taskEncoder_04.S0_INIT = micropython.const(0)
 Maps state 0 to a more readable const S0_INIT.
 
 taskEncoder_04.S1_UPDATE = micropython.const(1)
 Maps state 1 to a more readable const S1_UPDATE.
 
 taskEncoder_04.S2_ZERO = micropython.const(2)
 Maps state 2 to a more readable const S2_ZERO.
 

Detailed Description

Manages the states for the encoder task.

Manages the current state and executes state-related logic for all encoder related functionality. Cycles through state for initialization, updating encoder, and zeroing encoder position.

Author
Caleb Savard
Chris Linthacum
Date
February 2, 2022

Function Documentation

◆ taskEncoderFcn_04()

def taskEncoder_04.taskEncoderFcn_04 ( str  taskName,
int  period,
int  sample_period,
shares_04.Share_04  zFlag,
shares_04.Share_04  pFlag,
shares_04.Share_04  dFlag,
shares_04.Share_04  gFlag,
shares_04.Share_04  sFlag,
shares_04.Share_04  dataPrint,
shares_04.Share_04  testData,
shares_04.Share_04  vFlag,
shares_04.Share_04  input_signal 
)

Function to execute the state management functionality for the encoder tasks.

Function manages states for the management of encoder functions. Performs all encoder related tasks including position updates, checking and storing encoder data, recording encoder position data, and zeroing the encoder when requested.

Parameters
taskNameBrief string to describe the instance of the function. Useful for debug purposes.
periodPeriod with which to run the function and update/execute state logic.
sample_periodPeriod to record position data when recording position data vs. time.
zFlagShared data object to encapsulate the z key being pressed. Signals that encoder should be zeroed.
pFlagShared data object to encapsulate the p key being pressed. Signals to print the encoder position.
dFlagShared data object to encapsulate the d key being pressed. Signals to print the encoder delta.
gFlagShared data object to encapsulate the g key being pressed. Signals to begin data collection.
sFlagShared data object to encapsulate the s key being pressed. Signals to end data collection prematurely.
dataPrintShared data object to store the recorded encoder data. Stores both the position data and time values.
testDataShared data object to act as a flag to record avg velocity and to store the velocity data during testing.
vFlagShared data object to encapsulate the v key being pressed. Signals to print the encoder velocity.
input_signalShared data object to encapsulate the input signal for the controller, in this case the output velocity of the encoder. @yield state If task ran, yields state the function is now in. If task did not evaluate, returns None.