2
$\begingroup$

I am currently trying to construct a vector in space given yaw, pitch, and roll with the assumption that my ray originates from (0,0,0).

I started by breaking up the problem into 3 sets of triangles by slicing space in 3 ways:

  • In the X-Y plane, I concluded that x = sin(yaw) and y = cos(yaw)
  • In the Y-Z plane, I determined that y = cos(pitch) and z = sin(pitch)
  • In the X-Z plane, I found that x = cos(pitch) and z = sin(pitch)

From this, I arrived at enter image description here

However, this doesn't seem to satisfy basic tests, such as <1,1,1>, where the Yaw = Pi/4 and the Pitch should be Pi/4, but the formula yields 0.5, 0.5, 0.7, which has a direction vector different than <1,1,1>. Can anyone spot where I messed up? I've been banging my head at this for a while, and I can't seem to resolve where I made an error.

$\endgroup$
1
$\begingroup$

There are three reasons why combining the three results you got in the way you do does not solve the problem you're trying to solve.

The most obvious reason is that you only have pitch and yaw in your formula. I suppose the $x,z$ plane was supposed to be roll, not pitch.

The second reason is you applied your rotations to two different vectors: in the first two cases you yawed or pitched the vector $(0,1),$ but in the third case you turned the vector $(1,0).$

But the third, most subtle and fatal reason is that rotations in three dimensions do not combine linearly. They are not even commutative (rotation A followed by rotation B is not always the same as B followed by A).

For a more complete answer, with formulas that actually work, look under Find unit vector given Roll, Pitch and Yaw.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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