Calculation of roll, pitch and yaw angles

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Calculation of roll, pitch and yaw angles

26,666件の閲覧回数
shrijan00
Contributor I

I have an IMU FXOS8700CQR1 which has an accelerometer and magnetometer. I'm trying to calculate roll, pitch from the accelerometer and yaw from the magnetometer.

roll = atan2(-accelerometer[1],accelerometer[2]);

pitch = atan2(accelerometer[0],sqrt(accelerometer[1]*accelerometer[1]+(accelerometer[2]*accelerometer[2])));

magx = magnetometer[0]*cos(pitch)+magnetometer[1]*sin(roll)*sin(pitch) + magnetometer[2]*sin(pitch)*cos(roll);

magy = -magnetometer[1]*cos(roll) + magnetometer[2]*sin(roll);

yaw =  atan2(-magy,magx)*180/M_PI; 

I'm getting incorrect yaw data but I'm not sure about the equations which I found on the internet. Does anybody have any idea in this regard?

Thanks!

ラベル(2)
タグ(2)
0 件の賞賛
返信
3 返答(返信)

24,462件の閲覧回数
reyes
NXP TechSupport
NXP TechSupport

Hi,

Equation 22 of the application note AN4248 may help you for this task: https://cache.freescale.com/files/sensors/doc/app_note/AN4248.pdf

 

However, if your system need the yaw, pitch and roll calculations, I would recommend you to use the FXAS21002 gyroscope sensor instead: https://www.nxp.com/docs/en/data-sheet/FXAS21002.pdf

Regards,

Jose

0 件の賞賛
返信

23,522件の閲覧回数
JimmyXelectroN
Contributor I

Um, how would you go about calculating the yaw angle with only a gyroscope. I have an MPU6050 6-axis accelerometer and gyroscope and I have been unsuccessfully trying to calculate yaw angle.

0 件の賞賛
返信

12,050件の閲覧回数
Hari123pass123
Contributor I
I have an mpu6050 which has an accelerometer and gyroscop . I'm trying to calculate roll, pitch from the accelerometer and yaw from the sensor I'm getting incorrect yaw data please help to me
0 件の賞賛
返信