CarbonAeronautics / Part-XV-1DKalmanFilter

39 stars 3 forks source link

Can't set it up for vertical alignment. #1

Open rootcstar opened 1 year ago

rootcstar commented 1 year ago

First of all thank you for good tutorial. I already coded my MPU and i made it perfect with your help. i want to put my mpu6050 in a rocket. So i need to put the MPU6050 as vertical. But i couldn't make it work. I thought i'll alright if i change the X and Z axis but it didnt work. Can you please help me on that ?

Now it is like this working perfect thumbnail_IMG_5408

But i want it like this thumbnail_IMG_5409

CarbonAeronautics commented 1 year ago

Good question, the roll and pitch angles that I derived in this project are for a level quadcopter, hence it is possible to use the arctangent function. However, when you approach 90°, these equations will give you problems because this means that two out of the three accelerometer axis values will be close to zero, and arctangent (1/0) does not exist.

Therefore, you should derive another set of equations with only sine and cosine values (= using Euler angles).