Ball Balancer Project
|
The task that will run the user interface. More...
Functions | |
def | taskUser.printHelp () |
This function outputs the GUI of encoder. More... | |
def | taskUser.InputDutyFCN (char_In, DUTY_str, dFlag) |
This function reads numeric data. More... | |
def | taskUser.InputNumberFCN (char_In, Num_str, eFlag) |
This function reads numeric data. More... | |
def | taskUser.taskUserFcn (taskName, period, Data, Velocity, Duty1, Duty2, clFlag, Kp, Ki, Kd, Position, Contact) |
This function serves as the main user interface. More... | |
The task that will run the user interface.
This task takes in keyboard commands from the user to perform certain tasks. This allows for the user to interact with the Encoder and motor tasks to determine instanenous data or to collect data for a period of time. This is done by defining various states that perform different tasks.
@author Jake Lesher @author Daniel Xu @date 02/16/2022
def taskUser.InputDutyFCN | ( | char_In, | |
DUTY_str, | |||
dFlag | |||
) |
This function reads numeric data.
Based off of the inputs of the user, this function determines if the input is valid. It ignores all non-numerical inputs, except for the negative sign (-), the enter key (\r,
), the period key (.), and the backspace key (, '\x08', \x7F). It also limits the duty cycle to be between -100% and 100%.
char_In | is the user input from the user |
Duty_str | is the existing duty string that is constantly changing |
dFlag | is boolean to signal if enter has been pressed |
def taskUser.InputNumberFCN | ( | char_In, | |
Num_str, | |||
eFlag | |||
) |
This function reads numeric data.
Based off of the inputs of the user, this function determines if the input is valid. It ignores all non-numerical inputs, except for the negative sign (-), the enter key (\r,
), the period key (.), and the backspace key (, '\x08', \x7F). It also limits the duty cycle to be between -100% and 100%.
char_In | is the user input from the user |
Duty_str | is the existing duty string that is constantly changing |
dFlag | is boolean to signal if enter has been pressed |
def taskUser.printHelp | ( | ) |
This function outputs the GUI of encoder.
The different commands of the user interface is outputted here.
def taskUser.taskUserFcn | ( | taskName, | |
period, | |||
Data, | |||
Velocity, | |||
Duty1, | |||
Duty2, | |||
clFlag, | |||
Kp, | |||
Ki, | |||
Kd, | |||
Position, | |||
Contact | |||
) |
This function serves as the main user interface.
This functions allows for the user to communicate with the backend using shared data and queues. It allows for the user to input different commands to perform different actions like zeroing the position of the encoder, determing the instantaneous position of the encoder, the change of position from the most immediate last position to the current position, and collect data.
taskName | is the name associated the with the taskUser in main. |
period | is the frequency of which the taskUser is to be run. |
zFlag | is the shared variable that communicates the taskEncoder to determine whether the encoder should be zeroed or not. |
Data | is the share of positional data with taskEncoder.py. |
Delta | is the share of the delta value with taskEncoder.py. |
Velocity | is the share of the velocity value with taskEncoder.py |
Duty1 | is the shared queue containing the requested duty cycle percentage for motor 1. |
Duty2 | is the shared queue containing the requested duty cycle percentage for motor 2. |
cFlag | is a boolean to signal the clearing of fault conditions |