# Can someone explain this yaw angle calculation equation?

Nowdays, I am trying to understand PX4 Autopilot(Drone Flight Control Open Source) attitude control code. But I can’t understand formula below which is in attitude control code description. Can anyone explain how that formula is induced?

/*
The axis angle can change the yaw as well (noticeable at higher tilt angles).
This is the formula by how much the yaw changes:|
let a := tilt angle, b := atan(y/x) (direction of maximum tilt)|

**yaw = atan(-2 * sin(b) * cos(b) * sin^2(a/2) / (1 - 2 * cos^2(b) * sin^2(a/2))).**
*/

• Welcome to Robotics, PX4Traveler. I've seen some equations similar to this before, especially in some IMU application notes. I'm not sure about this form or your terminology specifically here, though. What are x and y? Angle a is the tilt angle and b is the "direction of maximum tilt?" What does that mean? Can you link the source code for context? Jul 29 at 23:30
• Thanks to your attention chuck!! This is the link of the code(related line is 167 to 170) * github.com/PX4/PX4-Autopilot/blob/master/src/modules/… * And I am not sure but I think x,y are setpoint pitch and roll of drone for moving to horizontal setpoint position.(or they can be raw horizontal setpoint which is transmitted by rc controller) Jul 30 at 14:30