Closed shomedas closed 5 years ago
I got my answer in another of your codes https://github.com/kriswiner/MPU9250/blob/master/MPU9250_MS5637_AHRS_t3.ino which says
So if we want te quaternions properly aligned we need to feed into the Madgwick function Ax, -Ay, -Az, Gx, -Gy, -Gz, My, -Mx, and Mz. But because gravity is by convention positive down, we need to invert the accel data, so we pass -Ax, Ay, Az, Gx, -Gy, -Gz, My, -Mx, and Mz into the Madgwick function to get North along the accel +x-axis, East along the accel -y-axis, and Down along the accel -z-axis.
I am trying to use MPU9255 with the code at https://github.com/kriswiner/ESP32/blob/master/MPU9250_MS5637/MPU9250_MS5637_AHRS.ino which uses the NED convention. The magnetometer and the accelerometer has been well calibrated using least squares. There is no drift and error is within 2degree on each axes. The quaternion value is 1,0,0,0 when the x axis of the accelerometer points north. The relative rotation(axis & angle found from the quaternion) between two orientations of the IMU are also correct. So far so good.
My question is wrt the madgwick order. As per your post in https://github.com/kriswiner/MPU9250/issues/345 & https://github.com/kriswiner/MPU9250/issues/341 the order for madgwick should be as follows(NWU convention in your post)
So If i use NED convention to mpu9250 it should be (AN, AE, AD, GN,GE,GD, MN, ME,MD) If I align the MPU9255 with the x axis of the accelerometer pointing to north, the it should be (ax, -ay, az, gx, -gy, gz, my, -mx, mz). In your code why is it -ax, ay, az, gx, -gy, -gz, my, -mx, mz;
Please refer to the MPU9255 accelerometer and magnetometer image below:
The board I am using is