mpu6050
mpu6050 copied to clipboard
Soft calibration
Performs a software calibration of the 6050 to zero it out. Could possibly be extended to write the calibrations to the 6050 registers with a bit of rework.
Wow this looks really neat. Thanks! Before I merge this I want to take a closer look at the code, which I'll do in a few days.
Feel free to change or make suggestions. The progress 'print' is for python 3. Could be eliminated or made more flexible to accommodate 2.7 (line 280).
Did you test it with python3? As far as I know the python-smbus is not compatible with any python version higher than 2.7.x.
I actually only used it on Python 3.5. Didn't test on 2.7. One potential issue is that my print statement for the 'progress' on line 280 is python 3 specific.
Your package is being used on donkey car which is python 3 / raspberry pi oriented.
I'll take a look at smbus specifically this weekend
Oh that's pretty interesting. I haven't used my module for a while, but last time I did the smbus
module was not available in Python 3. I'm going to test that asap.
Hey, I currently don't have any working MPU-6050s on hand (I fried my last working one) to test it, so I'm afraid it will have to wait for some time.
Performs a software calibration of the 6050 to zero it out. Could possibly be extended to write the calibrations to the 6050 registers with a bit of rework.
If I understand your code correctly, you calculate the mean of ~200 readings for each sensor axis, to then subtract the value from a scaled reading in get_accel/get_gyro, correct? This simply removes any bias/drift we observe in a still environment?
I wrote similar version to calibrate. It works fine while rotate around same axis. But after active rotation around all axis it stops be precise after some time. I have feeling it should be calibrated in 6 rotations first. And next 6 result offsets should be interpolated at runtime depending on which rotation is closer. Similar to Beta Flight or INAV software.