|
ME 305
|
Handles the user UI of our encoder system. More...
Functions | |
| def | task_user.taskUser (taskname, period, zFlag, pFlag, vFlag, gFlag, mFlag, MFlag, position, delta, P, T, duty, Velo, Kp, Kd, mode, opmode, cFlag, calwrite, cal_byte, calread, bFlag, duty_1, duty_2) |
| A generator to implement the UI task as an Finite State Machine. More... | |
Variables | |
| task_user.S2_MODE = micropython.const(2) | |
| State 2 - Changes mode of IMU. More... | |
| task_user.S14_BAL = micropython.const(14) | |
| State 14 - Enter closed loop. | |
| task_user.S15_CAL = micropython.const(15) | |
| State 15 - Calibrate IMU. | |
Handles the user UI of our encoder system.
This file interacts directly with user keyboard inputs to then send the request to the task_encoder.py file. It uses six states that correspond to different key in puts to send the program into its appropriate settings based on the user input.
| def task_user.taskUser | ( | taskname, | |
| period, | |||
| zFlag, | |||
| pFlag, | |||
| vFlag, | |||
| gFlag, | |||
| mFlag, | |||
| MFlag, | |||
| position, | |||
| delta, | |||
| P, | |||
| T, | |||
| duty, | |||
| Velo, | |||
| Kp, | |||
| Kd, | |||
| mode, | |||
| opmode, | |||
| cFlag, | |||
| calwrite, | |||
| cal_byte, | |||
| calread, | |||
| bFlag, | |||
| duty_1, | |||
| duty_2 | |||
| ) |
A generator to implement the UI task as an Finite State Machine.
The task runs as a generator function and requires a task name and interval to be specified. This task file receives flag values altered by the user. These flags are then shared with task_encoder.py where that task file can execute actions defined in encoder.py. Once the desired task is completed, the state is reset back to idle state (State 1).
| taskName | The name of the task as a string. |
| period | Specifies how long the task has to perform its function in microseconds. Specified as an integer. |
| zFlag | Holds True or False value to know when zeroing command was called by the user to zero the current position of the encoder. |
| pFlag | Holds True or False value to know when position command was called by the user to know the current position of the encoder. |
| dFlag | Holds True or False value to know when delta command was called by the user to know the current delta (speed) of the encoder. |
| gFlag | Holds True or False value to know when data collection command was called by the user to collect current time and position data. |
| position | Stores current position of encoder to be read in task_user.py |
| delta | Stores the delta (speed) of the encoder to be read in to task_user.py |
| P | Stores current position of encoder for data collection |
| T | Stores current time of encoder for data collection |
| duty | Stores duty value to pass into motor |
| Dtime | Represents the change in time between updates |
| eFlag | Holds True or False value to know when to enable motors |
| mode | Contains string to know whether in open or closed loop |
| Kp | Contains proportional gain value |
| Y | Contains set point value |
| task_user.S2_MODE = micropython.const(2) |
State 2 - Changes mode of IMU.
State that changes the mode of the IMU