Lucas Murray ME 305 Portfolio
Public Member Functions | Public Attributes | List of all members
I2C.BNO055 Class Reference

A BNO055 IMU object that communicates with a microcontroller through an I2C. More...

Public Member Functions

def __init__ (self)
 Initializes an I2C object from the pyb library.
 
def opMode (self, fusionMode)
 Changes the operating mode of the I2C to a given fusion mode. More...
 
def getCalStatus (self)
 Reads and returns the current calibration status of the IMU.
 
def getCalCoefficients (self, cFlag, Cast)
 Sets the calibration coefficients of the IMU from a file or from manual calibration. More...
 
def setCalCoefficients (self)
 Writes the newly obtained calibration coefficients of the IMU to a new file. More...
 
def getEulerAngles (self)
 Updates the data read from the IMU and converts it to Euler Angles (Pitch, Roll, Yaw) More...
 
def getVelocity (self)
 Updates the data read from the IMU and converts it to Angular Velocities. More...
 

Public Attributes

 i2c
 
 IMU
 
 COMPASS
 
 M4G
 
 NDOF_FMC_OFF
 
 NDOF
 
 CONFIG_MODE
 
 coefficients
 

Detailed Description

A BNO055 IMU object that communicates with a microcontroller through an I2C.

Objects of this class can be calibrated and are able to update their euler angle and angular velocity outputs. They can also read and write to files, skipping the calibration process if the calibration file already exists and writing a new one if it doesn't.

Member Function Documentation

◆ getCalCoefficients()

def I2C.BNO055.getCalCoefficients (   self,
  cFlag,
  Cast 
)

Sets the calibration coefficients of the IMU from a file or from manual calibration.

If the calibration file already exists, it will read it and set the calibration coefficients of the IMU from the read data, and if the file doesn't exist, it runs the calibration process and sends the new IMU coefficients over to setCalCoefficients().

Parameters
cFlagA shared variable that tells the UI when the calibration is finished
CastA currently unused shared variable that would allow an automated calibration to work

◆ getEulerAngles()

def I2C.BNO055.getEulerAngles (   self)

Updates the data read from the IMU and converts it to Euler Angles (Pitch, Roll, Yaw)

Reads the angle data from the relevant registers, then bitshifts half of them because the IMU outputs the data in an LSB and MSB form which needs to be combined to be read. It then converts the data into a readable degree format.

◆ getVelocity()

def I2C.BNO055.getVelocity (   self)

Updates the data read from the IMU and converts it to Angular Velocities.

Reads the anglular velocity data from the relevant registers, then bitshifts half of them because the IMU outputs the data in an LSB and MSB form which needs to be combined to be read. It then converts the data into a readable degree/second format.

◆ opMode()

def I2C.BNO055.opMode (   self,
  fusionMode 
)

Changes the operating mode of the I2C to a given fusion mode.

Parameters
fusionModeThe fusion mode that the user wants to switch the I2C to

◆ setCalCoefficients()

def I2C.BNO055.setCalCoefficients (   self)

Writes the newly obtained calibration coefficients of the IMU to a new file.

Only accessed when getCalCoefficients() doesn't find a calibration file, it will read the new coefficients from the relevant IMU registers and write them to a new file with the required name.


The documentation for this class was generated from the following file: