Mechatronics Portfolio
Logan Williamson's Mechatronics Portfolio and Documentation Repository
|
A motor driver class for the BNO055 from TI. More...
Public Member Functions | |
def | __init__ (self) |
Initializes and returns a BNO055 object. More... | |
def | set_mode (self, MODE) |
Sets the mode for the BNO055 board. More... | |
def | get_calStatus (self) |
Gets the calibration status of the board. More... | |
def | get_calConstants (self) |
Gets the calibration constants for the board. More... | |
def | write_calConstants (self, calDATA) |
Gets the calibration constants for the board. More... | |
def | update (self) |
Updates the values of omega x, y, and z and theta x, y, and z. More... | |
def | get_data (self) |
Gets the velocity and positional data for the platform. More... | |
Public Attributes | |
bus_addr | |
bus_addr is the adress for bus More... | |
cal_coeff_addr | |
cal_coeff_addr is the initial adress for calibration coefficients More... | |
vel_pos_data_addr | |
vel_pos_data_addr is the initial adress for velocity and position data More... | |
i2c | |
object i2c gets set to controller mode More... | |
MODE | |
MODE is the variable corresponding to the FUSION operating mode of the IMU. More... | |
buf | |
buf creates a byte array of length 12 More... | |
bufcal | |
bufcal creates a byte array of length 22 More... | |
theta_x | |
theta_x object created for x position values. More... | |
theta_y | |
theta_y object created for y position values. More... | |
theta_z | |
theta_z object created for z position values. More... | |
omega_x | |
omega_x object created for x velocity values. More... | |
omega_y | |
omega_y object created for y velocity values. More... | |
omega_z | |
omega_z object created for z velocity values. More... | |
cal_byte | |
cal_byte creates an object that will be used to store calibration coefficients More... | |
mag_stat | |
mag_stat creates an object for the calibration coefficients related to the magnetometer More... | |
acc_stat | |
acc_stat creates an object for the calibration coefficients related to the accelerometer More... | |
gyr_stat | |
gyr_stat creates an object for the calibration coefficients related to the gyroscope More... | |
sys_stat | |
sys_stat creates an object for the calibration coefficients related to the system More... | |
cal_coeffs | |
cal_coeffs creates an object that will be used to store calibration coefficients More... | |
A motor driver class for the BNO055 from TI.
Objects of this class can be used to configure the BNO055 motor driver and to create one or more objects of the Motor class which can be used to perform motor control. Refer to the BNO055 datasheet here: https://cdn-learn.adafruit.com/assets/assets/000/036/832/original/BST_BNO055_DS000_14.pdf
Device Calibration Information: https://learn.adafruit.com/adafruit-bno055-absolute-orientation-sensor/device-calibration
bno055 Reference CODE: https://github.com/micropython-IMU/micropython-bno055
def BNO055.BNO055.__init__ | ( | self | ) |
def BNO055.BNO055.get_calConstants | ( | self | ) |
Gets the calibration constants for the board.
once the calibration status has been recognized as calibrated, reads the coefficients into object cal_coeffs.
def BNO055.BNO055.get_calStatus | ( | self | ) |
Gets the calibration status of the board.
Reads the existing calibration coefficients into respective calibration coefficient byte arrays. These include the magnetometer, accelerometer, accelerometer, and the system coefficients. this method is instantiated in state 2 of taskIMU which is the calibration state
def BNO055.BNO055.get_data | ( | self | ) |
Gets the velocity and positional data for the platform.
This method is instantiated in state 1 of taskIMU which returns all the values that are collected and scaled in the update method.
def BNO055.BNO055.set_mode | ( | self, | |
MODE | |||
) |
Sets the mode for the BNO055 board.
If a value for mode is passed in, thie method will change the mode of the board. The modes that can be set are CONFIG mode: MODE = 0 IMU mode: MODE = 1 NDOF mode: MODE = 2
def BNO055.BNO055.update | ( | self | ) |
Updates the values of omega x, y, and z and theta x, y, and z.
This method is instantiated in state 1 and 2 of taskIMU which updates and scales the values of positions and motor speeds of the platform.
def BNO055.BNO055.write_calConstants | ( | self, | |
calDATA | |||
) |
Gets the calibration constants for the board.
This method is instantiated in state one of taskIMU which writes the calibration constants into object i2c
BNO055.BNO055.acc_stat |
acc_stat creates an object for the calibration coefficients related to the accelerometer
acc_stat reads through the existing calibration coefficients created in cal_byte and adopts the values related to the accelerometer.
BNO055.BNO055.buf |
buf creates a byte array of length 12
this byte array is used in iterating through the velocity and positional data of the addr. This is run within the update method
BNO055.BNO055.bufcal |
bufcal creates a byte array of length 22
this byte array is used in iterating through the calibration coefficients.
BNO055.BNO055.bus_addr |
bus_addr is the adress for bus
address on the BNO055 that is used in the configuration mode
BNO055.BNO055.cal_byte |
cal_byte creates an object that will be used to store calibration coefficients
this uses the mem_read which reads 1 byte from memory peripheral 40 starting at adress 0x35. Because this is used multiple times, the index is also used starting at [0].
BNO055.BNO055.cal_coeff_addr |
cal_coeff_addr is the initial adress for calibration coefficients
address for initial calibration location for the BNO055 having a byte array of a set size will correlate with how many coefficients will be run through. In this case we use 22.
BNO055.BNO055.cal_coeffs |
cal_coeffs creates an object that will be used to store calibration coefficients
this uses mem_read which reads bufcal bytes from memory peripheral bus_addr starting at adress cal_coeff_addr.
BNO055.BNO055.gyr_stat |
gyr_stat creates an object for the calibration coefficients related to the gyroscope
gyr_stat reads through the existing calibration coefficients created in cal_byte and adopts the values related to the gyroscope.
BNO055.BNO055.i2c |
object i2c gets set to controller mode
this initializes the i2c bus 1 object in controller mode.
BNO055.BNO055.mag_stat |
mag_stat creates an object for the calibration coefficients related to the magnetometer
mag_stat reads through the existing calibration coefficients created in cal_byte and adopts the values related to the magnetometer.
BNO055.BNO055.MODE |
MODE is the variable corresponding to the FUSION operating mode of the IMU.
Passing in a value for MODE to the set_mode method enables the user to select one of the three available FUSION modes for the BNO055 Inertial Measurement Unit. MODE value 0 corresponds to configuration mode, which the BNO055 object is instantiated in. MODE value 1 corresponds to IMU mode, 2 corresponds to NDOF mode, and 3 corresponds to M4G mode.
BNO055.BNO055.omega_x |
omega_x object created for x velocity values.
omega_x is initiated at 0 and will be repopulated with actual values in the update state.
BNO055.BNO055.omega_y |
omega_y object created for y velocity values.
omega_y is initiated at 0 and will be repopulated with actual values in the update state.
BNO055.BNO055.omega_z |
omega_z object created for z velocity values.
omega_z is initiated at 0 and will be repopulated with actual values in the update state.
BNO055.BNO055.sys_stat |
sys_stat creates an object for the calibration coefficients related to the system
sys_stat reads through the existing calibration coefficients created in cal_byte and adopts the values related to the system.
BNO055.BNO055.theta_x |
theta_x object created for x position values.
theta_x is initiated at 0 and will be repopulated with actual values in the update state.
BNO055.BNO055.theta_y |
theta_y object created for y position values.
theta_y is initiated at 0 and will be repopulated with actual values in the update state.
BNO055.BNO055.theta_z |
theta_z object created for z position values.
theta_z is initiated at 0 and will be repopulated with actual values in the update state.
BNO055.BNO055.vel_pos_data_addr |
vel_pos_data_addr is the initial adress for velocity and position data
address for location on the BNO055 for the gyroscope, accelerometer, and magnetometer.