Mechatronics Portfolio
Logan Williamson's Mechatronics Portfolio and Documentation Repository
Functions | Variables
Lab0x02_taskEncoder.py File Reference

A method for instantiating, updating the position, and zeroing a quadrature encoder object. More...

Functions

def Lab0x02_taskEncoder.taskEncoderFcn (taskName, period, zFlag, timDATA, posDATA, delDATA, speedDATA, DATA)
 A generator to implement the Encoder task as an FSM. More...
 

Variables

 Lab0x02_taskEncoder.S0_INIT = micropython.const(0)
 creates object S0_INIT connected to constant 0 More...
 
 Lab0x02_taskEncoder.S1_Update = micropython.const(1)
 creates object S1_Update connected to constant 1 More...
 
 Lab0x02_taskEncoder.S2_Zero = micropython.const(2)
 creates object S2_Zero connected to constant 2 More...
 

Detailed Description

A method for instantiating, updating the position, and zeroing a quadrature encoder object.

This file calls the encoder.py class to generate an encoder object. It is then called from an external file to perform updates to the position of that encoder object, and to zero/reset the absolute position of that encoder object. The external file utilizes other tasks in addition; therefore, this file is set up to work within a cooperative multitasking context. In particular, this file works with taskUser.py.

Author
Logan Williamson
Brianna Roberts
Date
01/23/2022

Function Documentation

◆ taskEncoderFcn()

def Lab0x02_taskEncoder.taskEncoderFcn (   taskName,
  period,
  zFlag,
  timDATA,
  posDATA,
  delDATA,
  speedDATA,
  DATA 
)

A generator to implement the Encoder task as an FSM.

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

Parameters
taskNameThe name of the task as a string.
periodThe task interval or period specified as an integer number of microseconds.
zFlagShared flag variable which causes FSM to enter zeroing state.
timDATAShared data for the time during a data recording session. This is not currently utilized by taskUser.py (instead, it is immediately fed into DATA); however, this is shared to taskUser for debugging purposes.
posDATAShared data for printing the position of the encoder upon 'p' or 'P' press.
delDATAShared data for printing the delta value of the encoder upon 'd' or 'D' press.
DATAShared data for data recording upon 'g' or 'G' press.

Variable Documentation

◆ S0_INIT

Lab0x02_taskEncoder.S0_INIT = micropython.const(0)

creates object S0_INIT connected to constant 0

S0_INIT is used to initialize the FSM. Simply transitions from S0 to S1.

◆ S1_Update

Lab0x02_taskEncoder.S1_Update = micropython.const(1)

creates object S1_Update connected to constant 1

S1_Update is used to update the encoder object.

◆ S2_Zero

Lab0x02_taskEncoder.S2_Zero = micropython.const(2)

creates object S2_Zero connected to constant 2

S2_Zero is used to reset the current position and velocity values of the encoder object