![]() |
Mechatronics Portfolio
Logan Williamson's Mechatronics Portfolio and Documentation Repository
|
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... | |
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.
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.
taskName | The name of the task as a string. |
period | The task interval or period specified as an integer number of microseconds. |
zFlag | Shared flag variable which causes FSM to enter zeroing state. |
timDATA | Shared 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. |
posDATA | Shared data for printing the position of the encoder upon 'p' or 'P' press. |
delDATA | Shared data for printing the delta value of the encoder upon 'd' or 'D' press. |
DATA | Shared data for data recording upon 'g' or 'G' press. |
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.
Lab0x02_taskEncoder.S1_Update = micropython.const(1) |
creates object S1_Update connected to constant 1
S1_Update is used to update the encoder object.
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