# To calculate roll,pitch and yaw

How do I calculate roll,pitch and yaw value from the position co ordinates of the drone, that is x,y and z from the gps sensor??? Using the x,y and z co ordinates I have to calculate roll,pitch and yaw. What is the equation for this??

The position coordinates x, y, z are inadequate information to compute the roll pitch and yaw.

x, y, and z are the position of the vehicle in space. roll, pitch, and yaw are the attitude or orientation. They can change independently. Aka you can change the orientation of the vehicle independently from the position of the vehicle.

• Perhaps you can briefly say why it is so, as this statement may be immediately evident to many of us but not to everyone. Sep 20, 2021 at 11:17
• x, y, and z are the position of the vehicle in space. roll, pitch, and yaw are the attitude or orientation. They can change independently. Aka you can change the orientation of the vehicle independently from the position of the vehicle. Sep 21, 2021 at 16:25
• That's a good answer! You'd better edit the post and include it there instead of leaving it as a comment. Sep 21, 2021 at 16:49

It is not possible to calculate your roll - pitch - yaw angles from linear position information. If you are using a simulated robot with sensors, you can use the gyroscope readings from the IMU sensor, that way you are going to have the angular velocities in three axes. You can then integrate this readings to get angular position. However, because of the integration, the error is going to increase rapidly; therefore you need to combine these readings with some additional sensors (magnetometer, accelerometer) to improve accuracy - you can check Complementary and Kalman Filter for that.