A scheduler to manage the tasks needed to balance the ball. More...
Namespaces | |
Lab0xFF | |
This package contains touchPanel.py, motor.py, encoder.py, main.py, controller.py. | |
Functions | |
def | main.encode_task () |
A task to update the angle of the motors. More... | |
def | main.motor_task () |
A task to run the motors at the correct duty cycle. More... | |
def | main.touch_task () |
A task to check the balls position on the touch screen. More... | |
def | main.ctrl_task () |
A task to determine the needed Duty cycle according to the sensor data. More... | |
def | main.data_task () |
A task responsible for collecting data and storing it in appropriate format. More... | |
def | main.UI_task () |
A task responsible for interaction between the user and the program. More... | |
Variables | |
list | main.x_vals = [] |
List containing the x-axis positions. | |
list | main.theta_x_vals = [] |
List containing the x-axis angles. | |
list | main.x_dot_vals = [] |
List containing the x-axis velocities. | |
list | main.theta_x_dot_vals = [] |
List containing the x-axis angular velocities. | |
list | main.y_vals = [] |
List containing the y-axis positions. | |
list | main.theta_y_vals = [] |
List containing the y-axis angles. | |
list | main.y_dot_vals = [] |
List containing the y-axis velocities. | |
list | main.theta_y_dot_vals = [] |
List containing the y-axis angular velocities. | |
main.queue_x | |
Initializes the Queues and Task to run the Scheduler. More... | |
main.queue_y | |
main.queue_ang | |
main.queue_vang | |
main.queue_motor1 | |
main.queue_motor2 | |
main.queue_end | |
main.task_enc | |
Instantiate each task. More... | |
main.task_mot | |
main.task_tp | |
main.task_ctrl | |
int | main.debug_count = 0 |
Create the task list. More... | |
A scheduler to manage the tasks needed to balance the ball.
def main.ctrl_task | ( | ) |
A task to determine the needed Duty cycle according to the sensor data.
Initializes the Controller objects. Using the previous and current x and y values from the Touch Panel, calculates the velocities and angular velocities. Uses those to calculate the Duty Cycles to input into the motors.
def main.data_task | ( | ) |
A task responsible for collecting data and storing it in appropriate format.
Creates a CSV file and writes into it line-by-line. The line can be formatted to display however many values, but the number of values displayed is directly proportional to memory consumption. So if more values are displayed per line, then the total number of test values will decrease.
def main.encode_task | ( | ) |
A task to update the angle of the motors.
Initializes the encoders in the Encoder Object. Updates the encoders and gets the positions of the encoders in a tuple. Uses those values to determine angles and angular velocities.
def main.motor_task | ( | ) |
A task to run the motors at the correct duty cycle.
Initializes both motors in the Motor object. Checks if any of the motors are in the task queue. If they are, then gets the duty cycle and sets the direction and power to abalnce the ball. If motor is disabled, then clears the fault.
def main.touch_task | ( | ) |
A task to check the balls position on the touch screen.
Initializes the Touch Panel. Gets the data from the touch panel, puts the data into the task queue to measure the positions and velocities.
def main.UI_task | ( | ) |
A task responsible for interaction between the user and the program.
Runs the schedular with the chosen scheduling algorithm as soon as a character is sent through the serial port. Quits if another character is sent.
int main.debug_count = 0 |
Create the task list.
Run the memory garbage collector to ensure memory is as defragmented as possible before the real-time scheduler is started
main.queue_ang |
main.queue_end |
main.queue_motor1 |
main.queue_motor2 |
main.queue_vang |
main.queue_x |
Initializes the Queues and Task to run the Scheduler.
Create Queues to share data between each task.
main.queue_y |
main.task_ctrl |
main.task_enc |
Instantiate each task.
main.task_mot |
main.task_tp |