I have the quadcopter in the photo below. It has rotate theta degrees about the -y axis. I want to get the x and z components in the local frame for the weight W which always points along the vertical downward.

enter image description here

We simply have:

Wx = W sin(theta); Wz = W cos(theta);

Suppose that W = 4N and theta = 30 deg, then:

Wx = -4 * sin(-30) = 2N;   Wz = -4 * cos(-30) = -3.464N

The negative sign in the angle was put because the rotation is about the -y axis (counterclockwise).

Wz seems correct as it is pointing towards the negative local z axis but Wx is 2 which seems wrong because according to the diagram it is supposed to be -2 indicating that it point towards the negative local x axis.

What's wrong with my simple calculation?


Using rotation matrices, we have the following rotation matrix when pitching (rotating about y axis):

Rotation Matrix

This matrix is used to transform vectors from inertial frame Xn,Yn,Zn to local frame Xb,Yb,Zb. To find the components of the weight W, we can multiply this matrix by W. Doing so, we get the same result:

Wx = W sin(theta); Wz = W cos(theta);

1 Answer 1


You've written your equations as if the weight vector you drew was positive, but then used a negative weight vector in your calculation. If you flipped $W$ around in your drawing you'd get $$ \begin{align} W_x &= -W \sin(\theta) \\ W_z &= W \cos(\theta) \end{align} $$

** edit **

To expand, a more consistent approach is use to proper vector math. In this case you need apply a rotation to your weight vector (edited to correctly go from global to local frame) $$ \begin{align} W_L &= [0~0~-mg]^T \\ R_{LG} &= \begin{bmatrix} \cos(-\theta) & 0 & -\sin(\theta) \\ 0 & 1 & 0 \\ \sin(-\theta) & 0 & \cos(\theta) \end{bmatrix} \\ W_L = R_{LG} W_G &= \begin{bmatrix} mg\sin(\theta) \\ 0 \\ mg \cos(\theta) \end{bmatrix} \end{align} $$

  • $\begingroup$ Why am I to flip the weight? The weight always points downward which is the '-z' in my case. In vector form 'W = i + j - 4k'. Why did you consider the negative sign in 'Wx' and not in 'Wz' too? $\endgroup$ Dec 24, 2014 at 8:16
  • $\begingroup$ When using a pure trig approach you run the risk of sign errors so it's often help to draw things as "positive" and then apply your sign. You are correct that Wz should also be negative. A more consistent approach, which is needed as systems get complicated, is to stick to proper vector math and use rotation matrices. $\endgroup$
    – ryan0270
    Dec 24, 2014 at 18:38
  • $\begingroup$ Yes, the equations your wrote are correct and they are exactly the ones that I use. The thing is with the sign of 'theta' itself! If I just want to take it always as positive then, the result weight components in the mathematical model will always be the same regardless of the rotation direction! $\endgroup$ Dec 25, 2014 at 6:15
  • $\begingroup$ I'm confused, why do you want to have theta always positive? The math doesn't work that way. $\endgroup$
    – ryan0270
    Dec 25, 2014 at 16:01
  • $\begingroup$ Actually, the very first answer you posted gives the correct equations but I really don't know why we should place the negative sign in 'Wx' equation. The correct equations, as you posted first, are: 'Wx = -W sin(theta)' ; 'Wz = W cos(theta)'. The rotation matrix you put in your last edit gives the transformation matrix from local frame to reference frame and this is wrong. What I want to transform is vectors like W from reference frame to local frame. To do so, you should inverse the matrix (transpose it as it is orthogonal) then multiply it by the weight vector. $\endgroup$ Dec 26, 2014 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.