ME 305
|
Handles the user UI of our encoder system. More...
Functions | |
def | task_user.taskUser (taskname, period, zFlag, pFlag, vFlag, position, T, Velo, mode, opmode, cFlag, calwrite, cal_byte, calread, bFlag, duty_1, duty_2, Tscreen, calFlag, readTouch, fFlag, ADCData) |
A generator to implement the UI task as an Finite State Machine. More... | |
Variables | |
task_user.S4_VELOCITY = micropython.const(4) | |
State 4 - Find Velocity. More... | |
task_user.S8_Kp = micropython.const(8) | |
State 8 - Set proportional gain. | |
task_user.S9_Kd = micropython.const(9) | |
State 9 - Define set point. | |
task_user.S11_CAL = micropython.const(11) | |
State 11 - For IMU calibration. | |
task_user.S12_CALTouch = micropython.const(12) | |
State 12 - Determines whether touch calibration file loaded. | |
task_user.S13_TCAL = micropython.const(13) | |
State 13 - Checks if touch calibration file present and correct. | |
task_user.S14_BallBal = micropython.const(14) | |
State 14 - Ball balancing state. | |
task_user.S15_I = micropython.const(15) | |
State 15 - Set integral gain. | |
task_user.S16_HELP = micropython.const(16) | |
State 16 - Displays possible program commands. | |
task_user.S17_DATA = micropython.const(17) | |
State 17 - Data Collection. More... | |
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.
See Term Project for state transition diagrams, task diagrams, plots and video demonstrating the balancing of the ball on the platform along with how the UI was implemented.
def task_user.taskUser | ( | taskname, | |
period, | |||
zFlag, | |||
pFlag, | |||
vFlag, | |||
position, | |||
T, | |||
Velo, | |||
mode, | |||
opmode, | |||
cFlag, | |||
calwrite, | |||
cal_byte, | |||
calread, | |||
bFlag, | |||
duty_1, | |||
duty_2, | |||
Tscreen, | |||
calFlag, | |||
readTouch, | |||
fFlag, | |||
ADCData | |||
) |
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 to change IMU mode |
pFlag | Holds True or False value to know when position command was called by the user to know the current position of the encoder. |
vFlag | Holds True or False value to know when to collect velocity data |
position | Stores current position of IMU to be read from task_IMU.py |
T | Stores time readig of task_touch.py for data collection |
Velo | Stores angular velocity of platform |
mode | Contains string to know whether in open or closed loop |
opmode | Stores user selected operating mode of IMU |
cFlag | Holds True or False to begin platform calibration |
calwrite | Holds True or False to begin writing calibration data to IMU |
cal_byte | Stores byte data of the calibration status of IMU |
calread | Holds True or False to begin reading IMU calibration data to later write to a text file |
bFlag | Holds True or False to begin recording platform position and velocity data |
task_user.S17_DATA = micropython.const(17) |
State 17 - Data Collection.
State that collects 10 seconds of data and outputs it to the user
task_user.S4_VELOCITY = micropython.const(4) |
State 4 - Find Velocity.
Calculates the velocity of motor 1