Minimu-9 yaw wacky

Using mimimu-9 with various example code, direct output, AHRS and others.
Roll and Pitch seems fine but Yaw is never close to correct.

I have IMU on pan tilt platform and Pitch (elevation) fine but
Yaw (azimuth) not even close and doesn’t even indicate close to 360 deg
(± 180)? I have calibrated the magnetometer as specified in instructions.
IMU mounted flat with components up.
Tried components down with no help.

Yaw always wacky?

Any suggestions?

How can I swap gyro orientation to use pitch and roll?
Mounting IMU differently and configure
int SENSOR_SIGN[9] = {1,-1,-1,-1,1,1,1,-1,-1}; //Correct directions x,y,z - gyro, accelerometer, magnetometer



What are your magnetometer calibration constants? Have you tried doing the calibration a few more times to see if you get consistent results, making sure to point the board in every possible orientation?

- Kevin

I have calibrated the magnetometer a number of times.
It is highly sensitive to close environment, servos, motor etc.

Is there a way to uncouple yaw and magnetic heading?

Perhaps initialize yaw — then let it measure 0-359 Azimuth?
use roll or pitch as yaw sensor by position of gyro and calibration?

All of the math is done in the MCU software. The sensor just gives you raw readings. Thus, you can do whatever you want with those numbers. The math isn’t particularly hard, although some knowledge of 3D linear algebra is probably needed to make sense of it.