Home › Forums › Forums › Technical Support for BerryIMU › Calibration for Berry IMU using Python Code
- This topic has 3 replies, 4 voices, and was last updated 3 years, 8 months ago by PeterP.
- August 1, 2019 at 3:01 pm #9018stevenmb1995Participant
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.
Thanks,August 1, 2019 at 9:40 pm #9025Mark WilliamsKeymaster
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. '''
Mark --OzzMaker.com --September 20, 2019 at 3:52 am #10449igpetersParticipant
Following on to the calibration question –
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.
Please can you assist?
IanSeptember 20, 2019 at 4:05 pm #10468PeterPParticipant
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.
Peter --OzzMaker.com --
- You must be logged in to reply to this topic.