ME 305 Group 6 Documentation
Functions | Variables
taskIMU.py File Reference

Creates and operates the IMU. More...

Functions

def taskIMU.taskIMUFcn (str taskName, int period, shares.Share euler_angles, shares.Share angular_velocities, shares.Share imu_calib_status, PrintQueue print_queue)
 Task for operating the IMU. More...
 
def taskIMU.testPrint (int period, shares.Share euler_angles, shares.Share angular_velocities, shares.Share imu_calib_status)
 Simple printing task for the testing suite. More...
 

Variables

 taskIMU.S0_INIT = micropython.const(0)
 State 0. More...
 
 taskIMU.S1_CALIB = micropython.const(1)
 State 1. More...
 
 taskIMU.S2_RUN = micropython.const(2)
 State 2. More...
 
 taskIMU.euler_angles = shares.Share(None)
 Euler angles share for the testing suite.
 
 taskIMU.angular_velocities = shares.Share(None)
 Angular velocities share for the testing suite.
 
 taskIMU.imu_calib_status = shares.Share(False)
 Calibration status variable for the testing suite.
 
 taskIMU.print_queue = PrintQueue()
 Print queue for testing suite.
 
list taskIMU.task_list
 Initialization of tasks for test suite. More...
 

Detailed Description

Creates and operates the IMU.

Instantiates an I2C device for and IMU (BNO055 in particular). The pyBoard is set as the controller by default and the IMU is set to NDOF mode by default. A state diagram of the task can be seen below.

taskIMU State Diagram

Author
Caleb Savard
Chris Linthacum
Date
March 2, 2022

Function Documentation

◆ taskIMUFcn()

def taskIMU.taskIMUFcn ( str  taskName,
int  period,
shares.Share  euler_angles,
shares.Share  angular_velocities,
shares.Share  imu_calib_status,
PrintQueue  print_queue 
)

Task for operating the IMU.

Finite state machine that controls IMU creation, calibration, and operation.

Parameters
taskNameBrief string to describe the instance of the function. Useful for debug purposes.
periodPeriod with which to run the function and update/execute state logic.
euler_anglesShared variable to pass euler angles to other tasks
angular_velocitiesShared variable to pass angular velocities to other tasks
imu_calib_statusShared variable to pass IMU calibration status to other tasks
print_queueA print queue object to pass print jobs to the taskUser function to be printed

◆ testPrint()

def taskIMU.testPrint ( int  period,
shares.Share  euler_angles,
shares.Share  angular_velocities,
shares.Share  imu_calib_status 
)

Simple printing task for the testing suite.

Simple printing task for the testing suite. Emulates functionality found in taskUser

Parameters
periodRate to run the print function
euler_anglesShare variable to pass euler angles to emulate main program
angular_velocitiesShared variable to pass angular velocities to emulate main program
imu_calib_statusShared variable to pass imu calibration status to emulate main program

Variable Documentation

◆ S0_INIT

taskIMU.S0_INIT = micropython.const(0)

State 0.

Descriptive name for State 0, the initializing state.

◆ S1_CALIB

taskIMU.S1_CALIB = micropython.const(1)

State 1.

Descriptive name for State 1, the calibration state.

◆ S2_RUN

taskIMU.S2_RUN = micropython.const(2)

State 2.

Descriptive name for State 2, the run state.

◆ task_list

list taskIMU.task_list
Initial value:
1= [taskIMUFcn('TaskIMU', 10_000, euler_angles, angular_velocities, imu_calib_status, print_queue),
2 testPrint(1_000_000, euler_angles, angular_velocities, imu_calib_status)]

Initialization of tasks for test suite.