def main(): # Create the tasks. If trace is enabled for any task, memory will be # allocated for state transition tracing, and the application will run out # of memory after a while and quit. Therefore, use tracing only for # debugging and set trace to False when it's not needed motor_task = cotask.Task(task_motor, name='motor_task', priority=1, period=1, profile=True, trace=False) # front_sensor_task = cotask.Task (task_front_sensor, name = 'front_sensor_task', priority = 2, # period = 25, profile = True, trace = False) #back_sensor_task = cotask.Task (task_back_sensor, name = 'back_sensor_task', priority = 3, # period = 25, profile = True, trace = False) #right_sensor_task = cotask.Task (task_right_sensor, name = 'right_sensor_task', priority = 4, # period = 25, profile = True, trace = False) #left_sensor_task = cotask.Task (task_left_sensor, name = 'left_sensor_task', priority = 5, # period = 25, profile = True, trace = False) #bluetooth_task = cotask.Task (task_bluetooth, name = 'bluetooth_task', priority = 6, # period = 25, profile = True, trace = False) cotask.task_list.append(motor_task) # cotask.task_list.append (front_sensor_task) #cotask.task_list.append (back_sensor_task) #cotask.task_list.append (right_sensor_task) #cotask.task_list.append (left_sensor_task) #cotask.task_list.append (bluetooth_task) # A task which prints characters from a queue has automatically been # created in print_task.py; it is accessed by print_task.put_bytes() # Run the memory garbage collector to ensure memory is as defragmented as # possible before the real-time scheduler is started gc.collect() # Run the scheduler with the chosen scheduling algorithm. Quit if any # character is sent through the serial por vcp = pyb.USB_VCP() while not vcp.any(): cotask.task_list.pri_sched() # Empty the comm port buffer of the character(s) just pressed vcp.read() # Print a table of task data and a table of shared information data print('\n' + str(cotask.task_list) + '\n') print(task_share.show_all()) # print (control_task.get_trace ()) print('\r\n') ''' aye = pyb.I2C(1, pyb.I2C.MASTER)
#cotask.task_list.append (task1) #cotask.task_list.append (task2) cotask.task_list.append(span_motor_task) cotask.task_list.append(tilt_motor_task) cotask.task_list.append(interface_task) #cotask.task_list.append (dart_motor_task) cotask.task_list.append(trigger_task) cotask.task_list.append(imu_task) cotask.task_list.append(calculator_task) # A task which prints characters from a queue has automatically been # created in print_task.py; it is accessed by print_task.put_bytes() # Run the memory garbage collector to ensure memory is as defragmented as # possible before the real-time scheduler is started gc.collect() # Run the scheduler with the chosen scheduling algorithm. run_RTOS.put(1) while run_RTOS.get(): cotask.task_list.pri_sched() vcp.read() # Print a table of task data and a table of shared information data print('\n' + str(cotask.task_list) + '\n') print(task_share.show_all()) print(task1.get_trace()) print(imu_task.get_trace()) print('\r\n')
def print_diagnostics(): # Print a table of task data and a table of shared information data print('\n' + str(cotask.task_list) + '\n') print(task_share.show_all()) print(task1.get_trace()) print('\r\n')