rfetick / MPU6050_light

Lightweight, fast and simple library to communicate with the MPU6050
MIT License
126 stars 36 forks source link

Yaw angles are constantly drifting or increasing/decreasing rapidly #28

Open Jawad-RoboLearn opened 2 years ago

Jawad-RoboLearn commented 2 years ago

Hello, I am using your library and sending IMU data over ROSSerial to my ground station.

Everything is going ok but yaw angle are constantly increasing/decreasing their values. Sometimes there is a drift. For e.g., if I just put the IMU at some horizontal surface, yaw angle try to increase/decrease.

B) Do you have some calibration offsets function in your library so I will add the value of offset for my MPU6050? As I have already calculated the offsets.

motedon commented 2 years ago

I've had that problem too, have you tried resetting the board?

rfetick commented 2 years ago

Hello,

You might have a look at the documentation of the library, especially the section describing all the available methods. To answer your question, yes there is a method to define offsets, and it is highly recommanded to define offsets to avoid drifts. The yaw angle is obviously the less constrained since gravity cannot correct for this gyro drift. It is not an issue with the library, but a physical limitation that cannot be solved unless you have access to other data (e.g. magnetometer) to constrain this angle. A poor MPU6050 device or a wrong calibration will lead to strong drift on the yaw angle.

Cheers,

Romain