Runs the encoder tasks. More...
Public Member Functions | |
def | __init__ (self, frequency) |
Constructor for encoderTask. More... | |
def | run (self) |
Runs finite state machine for encoder task. More... | |
Public Attributes | |
enc_1 | |
Object for encoder 1. | |
state | |
State tracking variable. | |
frequency | |
Times per second data is collected from the encoder. | |
nextTime | |
Timer to determine when in the future data can be collected. | |
thisTime | |
Timer to track current time and compare to nextTime, which is in the future. | |
Runs the encoder tasks.
Works along side the UITask and uses the share file for inter-task communication. This will eventually get ran inside the main file while loop.
def encoderTaskW2.encoderTask.__init__ | ( | self, | |
frequency | |||
) |
Constructor for encoderTask.
This class constructor takes 1 attribute being the frequency. The frequency is the Hz at which you wish you encoder to collect data. For example frequency = 10 [Hz] means 10 samples from the encoder will be taken every second. This frequency must match the frequency in the UITask for consistency.
frequency | The number of samples per second desired from the encoder. |
def encoderTaskW2.encoderTask.run | ( | self | ) |
Runs finite state machine for encoder task.
This task has 4 states. The init state waits until the user types a 'g'. Then, the encoder starts reading data until otherwise told. If a 'z' is read the encoder should zero the position at its current position. If a 's' is read the encoder should terminate its encoder data collection. The data that the encoder can collect and send to the share file is update() which is a queue of all the positions collected from the encoder, get_position() which is the current position reading of the encoder, and get_delta() which is the most recent delta value of the encoder.