2018-12-14 11:49 AM
This is the equation i am trying to use. Please let me know if there is something wrong. I am able to verify pitch and roll variations correctly.
roll= atan(accData.fy/accData.fz);
pitch= atan(-accData.fx/accData.fz);
cosRoll = cos(roll);
sinRoll = sin(roll);
cosPitch = cos(pitch);
sinPitch = sin(pitch);
Xh = (magData.fx)*cosPitch + (magData.fy*sinPitch*sinRoll) + (magData.fz*sinPitch*cosRoll);
Yh = (magData.fz)*sinRoll - (magData.fy)*cosRoll;
magHeading = atan2(Yh, Xh);
We will have to mount this on a metal structure, How can i compensate for soft iron.
Please find the attachment for sensor orientation.
2018-12-17 06:17 AM
You can use eCompass (MotionEC) and magnetometer calibration library (MotionMC) available in X-CUBE-MEMS1 package.
2019-01-03 04:29 AM
Thank You Miroslav,
Our team tried to use this library. The library seems to have hardware dependency, and only works for STM 32 controller. We are using LPC5411 controller form NXP.
Can you point us to some other resource that we can use
Thank you,
Sujith Vasudevan.
2019-01-06 04:47 AM
Yes, the library is intended for STM32 only.
Here is some application note which may be usefull.