Runs the UI backend to collect user data and communicate with share.py. More...
Public Member Functions | |
def | __init__ (self, collectionDuration=15, frequency=200) |
Constructor of UITask. More... | |
def | run (self) |
Runs the finite state machine of the UITask. More... | |
Public Attributes | |
collectionDuration | |
Total number of data points to be collected if uninterrupted. | |
n | |
Counting variable. | |
state | |
State tracking variable. More... | |
iteration | |
Iteration variable for prompting. More... | |
newKp | |
Inputted Kp value from user. | |
position1 | |
Array of data points which are absolute position [degrees]. | |
omega1 | |
Array of data points which are omega values [RPM]. | |
times1 | |
Array of data points which are timestamps when the encoder updates [s]. | |
Static Public Attributes | |
myuart = UART(2) | |
UART port object. | |
Runs the UI backend to collect user data and communicate with share.py.
def UITaskW3.UITask.__init__ | ( | self, | |
collectionDuration = 15 , |
|||
frequency = 200 |
|||
) |
Constructor of UITask.
This construction takes two attributes called collectionDuration and frequency. collectionDuration is the amount of time in seconds the user wishes to collect data. The frequency is data collection cycles per second in [Hz]. It is important to align this number with the rate at which the controller task is running.
collectionDuration | Time for how long the task runs [s]. |
frequency | Frequency at which the controllerTask.py is collecting data [Hz]. |
def UITaskW3.UITask.run | ( | self | ) |
Runs the finite state machine of the UITask.
This finite state machine has approximately 4 states. The first state waits for a 'g' keystroke from the user to start data collection or an 'a' keystroke to update the Kp. The second state waits for other commands from the user like 'p', 's', 'd', 'k', 'f', 'o', and 'z'. Once done collecting data, the third state send the data collected, which is waiting in a queue in share.py, via the UART port to the front end.
UITaskW3.UITask.iteration |
Iteration variable for prompting.
Character read in from serial port.
UITaskW3.UITask.state |
State tracking variable.
String text of time and values formatted as '{:}, {:}\r
' to be sent to user.