# Relationship between earth frame attitude and acceleration for a quadcopter

For a quadcopter, what is the relationship between roll, pitch, and yaw in the earth frame and acceleration in the x, y, and z dimensions in the earth frame? To be more concrete, suppose roll ($\theta$) is a rotation about the earth frame x-axis, pitch ($\phi$) is a rotation about the earth frame y-axis, and yaw ($\psi$) is a rotation about the z-axis. Furthermore, suppose $a$ gives the acceleration produced by all four rotors, i.e. acceleration normal to the plane of the quadcopter. Then what are $f, g, h$ in

$$a_x = f(a,\theta,\phi,\psi)$$ $$a_y = g(a,\theta,\phi,\psi)$$ $$a_z = h(a,\theta,\phi,\psi)$$

where $a_x$, $a_y$, and $a_z$ are accelerations in the $x$, $y$, and $z$ dimensions.

I've seen a number of papers/articles giving the relationship between x,y,z accelerations and attitude, but it's never clear to me whether these attitude angles are rotations in the earth frame or the body frame.

The orientation angles will be provided in the Earth frame (global or world frame is more appropriate). It is pretty much impossible to provide a frame orientation with angles with respect to that same frame.

Then, given some acceleration $a_b$ in the body frame, you can find the acceleration in the world frame $a_w$ by pre-multiplication with the rotation matrix $R$.

$a_w = R a_b$

If you assume a typical roll-pitch-yaw sequence, then this will look like:

$\begin{bmatrix} a_{w,x} \\ a_{w,y} \\ a_{w,z} \end{bmatrix} = \begin{bmatrix} c_\psi c_\theta & -s_\psi c_\phi + c_\psi s_\theta s_\phi & s_\psi s_\phi + c_\psi s_\theta c_\phi \\ s_\psi c_\theta & c_\psi c_\phi + s_\theta s_\psi s_\phi & -c_\psi s_\phi + s_\theta s_\psi c_\phi \\ -s_\theta & c_\theta s_\phi & c_\theta c_\phi \end{bmatrix} \begin{bmatrix} a_{b,x} \\ a_{b,y} \\ a_{b,z} \end{bmatrix}$

Where $c_x = \cos x$ and $s_x = \sin x$.

Of course, you can expand this to specify the x-y-z components of the world frame acceleration as individual equations as you mentioned:

$a_{w,x} = f(a_b, \phi, \theta, \psi)$

$a_{w,y} = g(a_b, \phi, \theta, \psi)$

$a_{w,z} = h(a_b, \phi, \theta, \psi)$

Note that I am using the convention where $\phi$ is roll (about x-axis), $\theta$ is pitch (about y-axis), and $\psi$ is yaw (about z-axis).

When the rotation sequence roll, pitch, yaw is applied, each rotation occurs with respect to a world frame axis. We could get the same final result by applying a yaw, pitch, roll sequence but about each new axis. This latter method is more intuitive when visualizing roll-pitch-yaw (or rather Euler angle) rotations.

Here is a figure to clarify the rotation sequence in case it helps. The world frame is shown in black, the body frame in red-green-blue, and intermediary frames during the "intuitive" rotation sequence are included in grey.

• That's a great explanation. You state that "roll-pitch-yaw rotations occur sequentially about new axes step-by-step as you apply them". Is this because it is not possible to specify roll-pitch-yaw rotations that are with respect to a fixed set of axes? Is there a nice explanation for why that would be impossible? Nov 11, 2015 at 3:53
• There are a lot of different ways you can specify rotation. I was trying to find a decent diagram or even better an animation, but couldn't find one yet. I will add something to my answer to better explain that. When you intuitively think about roll-pitch-yaw, it makes the most sense to imagine yawing about the z-axis, then pitching about the new y-axis, then rolling about the new x-axis. But mathematically, you are actually rolling about the x-axis first (which coincides with the world frame x-axis), then pitching about the world frame y-axis, then yawing about the world frame z-axis. Nov 11, 2015 at 4:01
• Hence, why I say it is "misleading" but not incorrect. Nov 11, 2015 at 4:01
• Here is an animation of the "intuitive" rotations about the body axes, whereas here is an animation of the actual rotation sequence about the world frame axes. Notice how the intuitive rotations appear as you'd expect, whereas the actual rotations don't seem to really be rolling and pitching about the right body axes. Also note that the two videos use different conventions for the axes directions. Nov 11, 2015 at 4:06
• I'm a bit confused now. My previous comment was incorrect. The videos clarified that. Each rotation is about the original x,y, and z axes, not about the axes that rotate with each subsequent rotation. However, this webpage (planning.cs.uiuc.edu/node102.html) says that the rotation matrix you gave ($R$) is from world frame to body frame, not from body frame to world frame. If that webpage is correct, then the equation would be $a_w = R^{-1}a_b$, not $a_w = Ra_b$. Is that right? Nov 11, 2015 at 7:11