bolderflight / invensense-imu

Arduino and CMake library for communicating with the InvenSense MPU-6500, MPU-9250 and MPU-9255 nine-axis IMUs.
MIT License
502 stars 211 forks source link

Right order of axis for AHRS #24

Closed CoWayger closed 6 years ago

CoWayger commented 6 years ago

Hello, anyone here tried to use this library coordinate system to get working quaternion with madwick? I have seen this implementation, but it seems that it uses NED reference frame. How can i convert your reference system to NED?

mFilterMadwick.update( elapsed, acceleration.x, acceleration.y, acceleration.z, gyroCalibrated.x, gyroCalibrated.y, gyroCalibrated.z, mCompassCalibrated.x, mCompassCalibrated.y, mCompassCalibrated.z );

flybrianfly commented 6 years ago

The MPU-9250 reference frame is a standard body fixed frame. In fact, you can't directly transform to an inertial frame, like NED, without some kind of estimation technique, which is what Madgwick, Mahony, and Kalman filtering is used for. Unfortunately, the script you're pointing to is using the raw MPU-9250 output and keeping the misalignment between the IMU and magnetometer. There's a good discussion here about reference frames and getting Madgwick to work with a standard body fixed frame: https://forum.pjrc.com/threads/48450-uNav-AHRS?p=167092&viewfull=1#post167092