Help with getting orientation from MPU 6050 under acceleration

Hello,
Im pretty much a beginner in arduino, I started learning to work with it because I want to build a self-stabilized model rocket. For that i need its orientation for a very short time window.

From what I understand, that can be done in two ways: from angle in relation to gravity, measured by accelerometer, or by integrating the change of rate of rotation from the gyro. Thats where I start to have problems.

I would assume that I cant use the accelerometer, because from the moment the rocket leaves ground, it doesnt measure gravitational force, but acceleration from its engine. Because that is always perpendicular to the senzor, i would assume it would always think its heading upwards.

That leaves the gyro. I have searched the internet and found few people who wanted to build an IMU with MPU 6050, only to be told that the results would drift after a few seconds. But i only really need a few seconds, so I tried some examples from libraries and found weird results. When moving in one axes, even shaking rapidly, it doesnt drift noticably. But when shaking in two axes, it drifts immediately. Is that an error in math?

I know that the senzor has built in microcontroller, and I can "ask" it the orientation. But after testing I believe that it includes data from the accelerometer, and doesnt work at all under acceleration.

After looking in peoples codes for selfstabilization of both rockets and drones, i found that majority of them uses the DMP's orientation.

Im now really confused. I know that I have lot of questions, and if someone answers any of them, I would be very grateful.

Try the "gyro only" Mahony filter.

The gyro must be accurately calibrated and the offsets subtracted. See https://github.com/jremington/MPU-6050-Fusion/blob/main/MPU6050_Mahony_calgyro.ino

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.