I'm not really sure how to use the calibrateBerryIMU.py code from github. I run the code and get the magxmin magxmax magymin magymax magzmin and magzmax values. But in the BerryIMU.py in the python-BerryIMU-gryo-accel-compass-filters folder, I don't know where to input these values or how to go about it. There are guide for C code but I'm having trouble deciphering how to apply it in python.
Use the code in this folder first as it is easier to understand
Run the same calibration program (or use the values you already have)
and paste them into this file berryIMU-simple.py in the section below.. put you value is where the '0' values are
################# Compass Calibration values ############
# Use calibrateBerryIMU.py to get calibration values
# Calibrating the compass isnt mandatory, however a calibrated
# compass will result in a more accurate heading values.
magXmin = 0
magYmin = 0
magZmin = 0
magXmax = 0
magYmax = 0
magZmax = 0
Here is an example:
magXmin = -1748
magYmin = -1025
magZmin = -1876
magXmax = 959
magYmax = 1651
magZmax = 708
Dont use the above values, these are just an example.
We are using LSM9DS1 IMU with Raspberry pi and would like to calibrate it so that when the unit is leveled the x and y angles(Kalmanx and kalmany) should read zero for physically leveled unit.
How can we calibrate the unit as each unit has the IMU built in slightly differently (just tolerances and human assembly tiny errors), so we need to have a function to level the unit, then add an offset to x and y to set them zero.
To calibrate the accelerometer and gyro, you would need specific scientific equipment that exerts known forces and can be absolute level. And even when this is done, there is little improvement as the sensors are accurate.
The should be no need to calibrate these two sensors, once you mount the IMU... you just need to add or subtract an offset to get the range of values you want.