2017-07-13 10:24 PM
The magnetometer on my device has different scale and offset on its axes.This is because of influence of hard iron on the board. So, it needs to be calibrated. I've read
https://my.st.com/resource/en/design_tip/dm00286302.pdf
and hadn't understood about rotated ellipsoid. Rotated about what?I made calculations according this manual with matlab. Offsets and gains are adequate, but rotation matrix is strange. When I fit the data with offsets and gains, the angles (yaw, pitch, roll) I computed are normal. When I fit with offsets, rotation matrix and gains, the angles are strange.
The second question. When I fit the data with normal calibration values all vectors have magnitude 1. How to convert it back to gauss?
The crosses are the original data, the rounds are transformed data.
Transformation ''offset-rotate-scale'' is on the left side.
Transformation ''offset-scale'' is on the right side.
#magnetometer2017-07-14 12:39 AM
In theory if the offset is zero, the scale is the same in all axis and there is no cross axis gain, the data would create perfect sphere with center at [0,0,0].
Offset (hard-iron error) causes that the sphere wont be centered at [0,0,0] coordinates, but is moved.Different scales in each axis (soft-iron error) causes that data not create a sphere but ellipsoid.
Cross axis gain causes the axis of ellipsoid are not aligned with X, Y, Z axis.
You can check
package which contains also MotionMC (Magnetometer Calibration) library for STM32 MCUs.This algorithm is able to calculate offset and scale factors and then compensate the hard-iron and soft-iron error.
2017-07-14 03:12 AM
Miroslav, I've seen this product. There is no source code, just static library. (Middlewares\ST\STM32_MotionMC_Library). Library can be used on STM32 only.
2017-07-14 03:21 AM
I know why do the hard-iron and soft-iron effect appear. I want to know why the transformation matrix obtained by matlab program outlined
/external-link.jspa?url=https%3A%2F%2Fmy.st.com%2Fresource%2Fen%2Fdesign_tip%2Fdm00286pdf
is wrong?