ME 305 Group 6 Documentation
|
Manages the states for the User Interface task. More...
Functions | |
def | taskUser.printLegend (PrintQueue print_queue) |
Prints the available user key commands to the console. More... | |
def | taskUser.printDevTools (PrintQueue print_queue) |
Prints the available dev tool key commands to the console. More... | |
def | taskUser.taskUserFcn (str task_name, int period, shares.Share roll_target_duty, shares.Share pitch_target_duty, shares.Share gFlag, shares.Share sFlag, shares.Share prop_gain_roll, shares.Share deriv_gain_roll, shares.Share cont_enable, shares.Share euler_angles, shares.Share angular_velocities, shares.Share roll_target_pos, shares.Share pitch_target_pos, shares.Share x_target_position, shares.Share y_target_position, PrintQueue print_queue, shares.Share ball_detected, shares.Share x_position_signal, shares.Share y_position_signal, shares.Share imu_calib_status, shares.Share touch_calib_status, shares.Share positionx_prop_gain, shares.Share int_gain_roll, shares.Share positionx_deriv_gain, shares.Share positionx_int_gain, shares.Share positiony_prop_gain, shares.Share positiony_deriv_gain, shares.Share positiony_int_gain, shares.Share controller_signalsx, shares.Share controller_signalsy, shares.Share prop_gain_pitch, shares.Share deriv_gain_pitch, shares.Share int_gain_pitch, shares.Share data_collect_flag) |
Main task function to control UI states. More... | |
Variables | |
taskUser.S0_INIT = micropython.const(0) | |
State 0. More... | |
taskUser.S1_CMD = micropython.const(1) | |
State 1. More... | |
taskUser.S2_IMUCAL = micropython.const(2) | |
State 2. More... | |
taskUser.S3_PRINT = micropython.const(3) | |
State 3. More... | |
taskUser.S4_INPUT = micropython.const(4) | |
State 4. More... | |
taskUser.S5_PANELCAL = micropython.const(5) | |
State 5. More... | |
taskUser.S6_SRESP = micropython.const(6) | |
State 6. More... | |
Manages the states for the User Interface task.
Manages the current state and executes state-related logic for all User Interface functionality. States available are:
A state diagram is shown below.
def taskUser.printDevTools | ( | PrintQueue | print_queue | ) |
Prints the available dev tool key commands to the console.
Prints a table of available user input commands oriented towards dev tools to the console to preview the available user key commands.
print_queue | A print queue object to add the legend print statements to |
def taskUser.printLegend | ( | PrintQueue | print_queue | ) |
Prints the available user key commands to the console.
Prints a table of available user input commands to the console to preview the available user key commands.
print_queue | A print queue object to add the legend print statements to |
def taskUser.taskUserFcn | ( | str | task_name, |
int | period, | ||
shares.Share | roll_target_duty, | ||
shares.Share | pitch_target_duty, | ||
shares.Share | gFlag, | ||
shares.Share | sFlag, | ||
shares.Share | prop_gain_roll, | ||
shares.Share | deriv_gain_roll, | ||
shares.Share | cont_enable, | ||
shares.Share | euler_angles, | ||
shares.Share | angular_velocities, | ||
shares.Share | roll_target_pos, | ||
shares.Share | pitch_target_pos, | ||
shares.Share | x_target_position, | ||
shares.Share | y_target_position, | ||
PrintQueue | print_queue, | ||
shares.Share | ball_detected, | ||
shares.Share | x_position_signal, | ||
shares.Share | y_position_signal, | ||
shares.Share | imu_calib_status, | ||
shares.Share | touch_calib_status, | ||
shares.Share | positionx_prop_gain, | ||
shares.Share | int_gain_roll, | ||
shares.Share | positionx_deriv_gain, | ||
shares.Share | positionx_int_gain, | ||
shares.Share | positiony_prop_gain, | ||
shares.Share | positiony_deriv_gain, | ||
shares.Share | positiony_int_gain, | ||
shares.Share | controller_signalsx, | ||
shares.Share | controller_signalsy, | ||
shares.Share | prop_gain_pitch, | ||
shares.Share | deriv_gain_pitch, | ||
shares.Share | int_gain_pitch, | ||
shares.Share | data_collect_flag | ||
) |
Main task function to control UI states.
Manage different User Input states, including Init, Read_Cmd, Zero_Encoder, and Print_Data. On function run, executes the logic of the current state and if appropriate shifts state for next run of function.
task_name | Task name for the function to help with debugging |
period | Period to run execute function at. Period defines frequency that states are executed and refreshed. |
roll_target_duty | Shared data object to store the duty cycle for motor 1. |
pitch_target_duty | Shared data object to store the duty cycle for motor 2. |
gFlag | Shared data object to encapsulate the g key being pressed. Signals to begin data collection. |
sFlag | Shared data object to encapsulate the s key being pressed. Signals to end data collection prematurely. |
prop_gain_roll | Shared data object for the roll controller proportional gain. |
deriv_gain_roll | Shared data object for the roll controller derivative gain. |
cont_enable | Shared data object to specificy whether closed-loop controller is enabled (True) or not |
euler_angles | Shared data object for the euler angles recorded by the IMU. |
angular_velocities | Shared data object for the angular velocities being recorded by the IMU. |
roll_target_pos | Shared data object for the roll target position output from the angle controller. |
pitch_target_pos | Shared data object for the pitch target position being output from the angle controller. |
x_target_position | Shared data object for the target x position being fed to the angle controller. |
y_target_position | Shared data object for the target y position being fed to the angle controller. |
print_queue | Print queue object for passing out print statements. |
ball_detected | Shared data object for if the ball is on the platform. |
x_position_signal | Shared data object for the current X position of the ball. |
y_position_signal | Shared data object for the current Y position of the ball. |
imu_calib_status | Shared data object for the IMU Calibration status. |
touch_calib_status | Shared data object for whether or not the touch panel is calibrated. |
positionx_prop_gain | Shared data object for the x position controller proportional gain. |
int_gain_roll | Shared data object for the roll angle controller integral gain. |
positionx_deriv_gain | Shared data object for the x position controller derivative gain. |
positionx_int_gain | Shared data object for the x position controller integral gain. |
positiony_prop_gain | Shared data object for the y position controller proportional gain. |
positiony_deriv_gain | Shared data object for the y position controller derivative gain. |
positiony_int_gain | Shared data object for the y position controller integral gain. |
controller_signalsx | Output signal from the x position controller. |
controller_signalsy | Output signal from the y position controller. |
prop_gain_pitch | Pitch angle controller proportional gain. |
deriv_gain_pitch | Pitch angle controller derivative gain. |
int_gain_pitch | Pitch angle controller integral gain. |
data_collect_flag | Shared variable to hold the data collection flag |
taskUser.S0_INIT = micropython.const(0) |
State 0.
Maps state 0 to a more readable name
taskUser.S1_CMD = micropython.const(1) |
State 1.
Maps state 1 to a more readable name
taskUser.S2_IMUCAL = micropython.const(2) |
State 2.
Maps state 2 to a more readable name
taskUser.S3_PRINT = micropython.const(3) |
State 3.
Maps state 3 to a more readable name
taskUser.S4_INPUT = micropython.const(4) |
State 4.
Maps state 4 to a more readable name
taskUser.S5_PANELCAL = micropython.const(5) |
State 5.
Maps state 5 to a more readable name
taskUser.S6_SRESP = micropython.const(6) |
State 6.
Maps state 6 to a more readable name