ME 405 Documentation for Joshua Clemens, Cal Poly SLO 06/09/20
IMU_Controller.IMU Class Reference

The IMU class is responsible for using the 3 built in sensors of the IMU to generate the inertial/positional coordinates of the device. More...

Public Member Functions

def __init__ (self, BUS_ADDR, DEV_ADDR)
 Defins IMU class @Details Enables positional feedback through an IMU sensor. More...
 
def enable (self)
 This method enables the IMU by initializing the previously created object and setting it in master mode. More...
 
def disable (self)
 This method disables the IMU by deinitializing the previously created class object. More...
 
def calib_stat (self)
 This method simply runs an infinite loop that first provides the user with calibration instructions, and then keeps providing the user with feedback on calibration progress until it's complete. More...
 
def set_mode (self, mode)
 This method sets the mode of the IMU between different sensors or fusion modes that manipulate which sensors of the IMU are active. More...
 
def orientation (self)
 This method extracts, converts, and calculates the Euler angle values of the IMU. More...
 
def velocity (self)
 This method extracts, converts, and calculates the angular velocity values of the IMU. More...
 

Public Attributes

 cal_stat
 cal_stat stores the calibration values for the three sensors on board the IMU More...
 
 Eu_angles
 Eu_angles stores the extracted, converted and calculates values for the current IMU Euler angle positions. More...
 
 AV_velocity
 AV_velocity stores the redundantly named object that contains the extracted, converted, and caclulated values of angular velocity about each coordinate axis. More...
 

Detailed Description

The IMU class is responsible for using the 3 built in sensors of the IMU to generate the inertial/positional coordinates of the device.

The accelerometer provides angular velocity data while the magnetometer and gyroscope provide spatial coordinate data which dictates the position of the IMU. This class is responsible for enabling or disabling an IMU object that has been created. Once it has been calibrated, it will continuously return values for the angular position and angular velocity of the IMU every two seconds.

Constructor & Destructor Documentation

◆ __init__()

def IMU_Controller.IMU.__init__ (   self,
  BUS_ADDR,
  DEV_ADDR 
)

Defins IMU class @Details Enables positional feedback through an IMU sensor.

Initialization method which imports all required libraries, declares variables, and sets them equal to appropriate initial conditions. For readability of code, the I2C class of the pyb class is specifically imported. Also, the variables passed along as arguments are redeclared with underscores so they are not public attributes.

Parameters
BUS_ADDRThis argument passes along the bus address of the IMU being used
DEV_ADDRThis argument passes along the device address of the IM

Member Function Documentation

◆ calib_stat()

def IMU_Controller.IMU.calib_stat (   self)

This method simply runs an infinite loop that first provides the user with calibration instructions, and then keeps providing the user with feedback on calibration progress until it's complete.

The calibration vector contains the system, gyroscope, accelerometer, and magnetometer calibration values respectively.

Returns
Cal_stat This is the returned value of the current calibration status, stating which sensors are currently calibrated. When all 3 sensors are calibrated, the overall system becomes calibrated

◆ disable()

def IMU_Controller.IMU.disable (   self)

This method disables the IMU by deinitializing the previously created class object.

In order to reuse it, the object would have to be re-created instead of just re-enabling.

◆ enable()

def IMU_Controller.IMU.enable (   self)

This method enables the IMU by initializing the previously created object and setting it in master mode.

Then it sets the IMU mode to config to clear all existing writable memory addresses. The utime library is called so pauses can be incorporated after each text prompt to the user.

◆ orientation()

def IMU_Controller.IMU.orientation (   self)

This method extracts, converts, and calculates the Euler angle values of the IMU.

Returns
Euler_Angles The tuple containing the values of the euler angles with respect to the XYZ axes

◆ set_mode()

def IMU_Controller.IMU.set_mode (   self,
  mode 
)

This method sets the mode of the IMU between different sensors or fusion modes that manipulate which sensors of the IMU are active.

Most commonly and for purposes of this lab, the NDOF mode was used because it provided the most accurate data of the IMU's position and velocity.

Parameters
modeThis argument passes along the desired mode to set the IMU object to, as extracted from the bno055 data sheet

◆ velocity()

def IMU_Controller.IMU.velocity (   self)

This method extracts, converts, and calculates the angular velocity values of the IMU.

Returns
Euler_Velocities The tuple containing the values of the angular velocities with respect to the XYZ axes

Member Data Documentation

◆ AV_velocity

IMU_Controller.IMU.AV_velocity

AV_velocity stores the redundantly named object that contains the extracted, converted, and caclulated values of angular velocity about each coordinate axis.

AV_velocity is a 3-value tuple that contains angular velocity with respect to the XYZ axes in units of degrees/second This value is divided by the same gain as the Euler angles to achieve these units.

◆ cal_stat

IMU_Controller.IMU.cal_stat

cal_stat stores the calibration values for the three sensors on board the IMU

cal_stat specifically stores the status of system calibration, gryoscope calibration, accelerometer calibration, and magnetometer calibration as values between 0-3 in a row vector. It dictates whether each sensor, and the system overall is finished calibrating. A 0 indicates an uncalibrated element while a three indicates a fully calibrated element.

◆ Eu_angles

IMU_Controller.IMU.Eu_angles

Eu_angles stores the extracted, converted and calculates values for the current IMU Euler angle positions.

The Eu_angles object stores the result of dividing the euler values by the appropriate gain to achieve the desired unitset output. More specifically, this project uses units of degrees for angle measurements. This object is stored as a 3 value tuple.


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