Comments (3)
If I understand correctly, the mag calibration routine must also return: magScaleFactor
and magXcal magYcal magZcal
so that I can mimic the below logic?
self.mx = self.mx * self.magScaleFactor * self.magXcal - self.magXbias
self.my = self.my * self.magScaleFactor * self.magYcal - self.magYbias
self.mz = self.mz * self.magScaleFactor * self.magZcal - self.magZbias
self.mx *= self.magXscale
self.my *= self.magYscale
self.mz *= self.magZscale
As the current implementation in magCalSlider.py
and magCalVisualizer.py
is limited to:
self.mx -= self.magXbias
self.my -= self.magYbias
self.mz -= self.magZbias
self.mx *= self.magXscale
self.my *= self.magYscale
self.mz *= self.magZscale
from mpu-6050-9250-i2c-compfilter.
The current calibration routine calculates the bias and scale as follows:
self.magXbias = ((magMax[0] + magMin[0])/2) * self.magScaleFactor * self.magXcal
self.magYbias = ((magMax[1] + magMin[1])/2) * self.magScaleFactor * self.magYcal
self.magZbias = ((magMax[2] + magMin[2])/2) * self.magScaleFactor * self.magZcal
# Get soft iron correction estimate
magXchord = (magMax[0] - magMin[0])/2
magYchord = (magMax[1] - magMin[1])/2
magZchord = (magMax[2] - magMin[2])/2
avgChord = (magXchord + magYchord + magZchord)/3
self.magXscale = avgChord/magXchord
self.magYscale = avgChord/magYchord
self.magZscale = avgChord/magZchord
so this bias is already scaled for the sensor range and corrected with the factory stored calibration values. It can be directly used in the program
self.mx = self.mx * self.magScaleFactor * self.magXcal - self.magXbias
self.my = self.my * self.magScaleFactor * self.magYcal - self.magYbias
self.mz = self.mz * self.magScaleFactor * self.magZcal - self.magZbias
However, it cannot be used in the current for of magCalSlider or magCalVisualizer since in those programs it is used as
self.mx -= self.magXbias
self.my -= self.magYbias
self.mz -= self.magZbias
So a scaled and calibrated bias is subtracted from a raw (unscaled and uncalibrated) measurement. In making this calculation and displaying the result, you will see that the circles/blobs are never centered around (0,0,0) and always require further manual adjustment because the bias is just too large.
In the visulation program you can
- first convert raw values by multiplication with scale factor and factory calibration and only thereafter subtract the bias and make the display
- or make sure that the calibration routine also outputs the raw bias (next to the scaled bias) and use that raw bias in the current visulation routines, so neither the raw value nor the bias is scaled during visualisation. If you choose this option, then after finalisation of these visualisation routines, you still need to make sure that the final bias output is scaled and directly usable in the main program.
from mpu-6050-9250-i2c-compfilter.
Sorry I have been very busy; if you still require this fix I recommend you make a PR.
from mpu-6050-9250-i2c-compfilter.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mpu-6050-9250-i2c-compfilter.