drcpattison / DPEng_ICM20948_AK09916

DPEng's Arduino library for the ICM-20948 breakout board with magnetometer calibration and AHRS examples
MIT License
25 stars 8 forks source link

Gyro orientation... #3

Open hellooutthere2 opened 3 years ago

hellooutthere2 commented 3 years ago

Using your fusion example, and after applying calibration values, I noticed that my adafruit ICM20948 heading wouldn't settle very quickly. In addition the heading would jump in the opposite direction upon rotation. I changed the sign for gy, gz in the call to the filter and it performed well. I'm not sure what is correct here. Any advice?

borland1 commented 3 years ago

I think the 3D orientation standard was drawn on the side of a bridge in the UK by William Hamilton in 1883, but someone thought it was graffiti and erased it, leaving the standard lost in perpetuity.

Just define your own orientation frame of reference. However, if you look at Wikipedia for conversion between Euler and Quaternions, you'll see reference to JPL Quaternion reference being used there; and also for Euler angles, they use Tate-Bryan angle convention commonly used for aviation flight dynamics (yaw, pitch, roll).

The ICM20948 datasheet shows the orientation of the coordinate axis relative to the pin 1 chip marker. Note that the magnetometer orientation is inverted from that of the gyro/accel. I guess that is because the earths magnetic field actually dips down at ground level relative to the horizon.

sf116 commented 3 years ago

Hello,Have you noticed that roll and yaw drift when pitch>80 or <-80?

hellooutthere2 commented 3 years ago

I was really interested in a “plug and play” tilt compensated compass for a sailboat autopilot project. I spent a great deal of time trying several devices. 6050, 9250, 20948, bno055. My project needs no more than 15 degrees of pitch and roll so I didn’t really test beyond that. I was never happy with the 20948. I noticed yaw drift when performing tilt compensation at low angles of pitch and roll, but can only speculate on the root causes. My guess I wasn’t running the algorithm properly to accommodate gyro compensation. The 9250 was OK.

In the end I settled on the BNO055. It’s dirt simple, accurate, holds its heading forever, and doesn’t require much of a driver. Acceleration calibration is somewhat challenging but once calibrated it seems pretty good at start up and improves with time/motion. I’m not flying a drone here, so it works well!

My hat off to folks like you providing drivers for these devices like these!!! They are an amazing amount of work. When I’m done with my project I’m hoping to drop it into github for others to use.

Win

From: sf116 Sent: Friday, February 5, 2021 2:41 AM To: drcpattison/DPEng_ICM20948_AK09916 Cc: hellooutthere2 ; Author Subject: Re: [drcpattison/DPEng_ICM20948_AK09916] Gyro orientation... (#3)

Hello,Have you noticed that roll and yaw drift when pitch>80 or <-80?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

sf116 commented 3 years ago

Thank you for your sharing.I have tested LSM6DSL+LIS2MDL, MPU9250, ICM20948. Except for pitch>80 or <-80, roll and Yaw drift have no other problems.It should be noted that all MAG needs to be calibrated, and the effect of spherical fitting method is good at present.

drcpattison commented 3 years ago

Hi all, please try using this library: https://github.com/isouriadakis/Arduino_ICM20948_DMP_Full-Function

It utilises the ICM-20948's onboard DMP to provide the sensor fusion data. In addition, the DMP automatically calibrates the magnetometer on start-up so no manual calibration is required.