How to compute Euler angles for a 3-axis gimbal with a stuck axis?

37 Views Asked by At

The problem

I have a 2-axis gimbal that orients a laser beam. This gimbal is located at point G.

In order to drive the gimbal, I need to feed it with 2 intrinsic Tait-Bryan angles (sometimes improperly called Euler angles), which rotate the laser in that order:
X(roll) -> Z'(yaw) -> Y''(pitch)

The motor driving the X axis is stuck at a fixed angle fixedRoll.

I want my laser to hit a target point P in world coordinates. How do I compute yaw and pitch?

(notice that even though fixedRoll cannot be changed, for a same target point P in world coordinates, a different fixedRoll will lead to different values for yaw and pitch).


What I did so far

  1. I computed a "Look At" rotation matrix L like this:
    • Column vector L1 contains a normalized version of GP in world coordinates
    • Column vector L2 is a normalized version of Up x L1 (cross product), where Up is the column vector (0, 0, 1)
    • Column vector L3 is L1 x L2
  2. I computed the rotation matrix Xf corresponding to fixedRoll
  3. I computed the full rotation matrix R = L.Xf
  4. I used the XZY formula from this page to compute the intrinsic Euler angles from R. The results doesn't look good to me, as the computed roll is not equal to fixedRoll. Am I right to think that it should be?
  5. To investigate further, I used the YZX formula to compute the extrinsic Euler angles. Same thing: I expected the computed roll to be equal to fixedRoll as well, but it's not the case.

Maybe I did something wrong in my calculations but, as a starting point, would you say that my approach to the problem is correct?


EDIT: second approach

I tried another approach: instead of computing the full rotation matrix with R = L.Xf, I computed it directly like this:

  • Column vector L1 contains a normalized version of GP in world coordinates
  • Column vector L2 is a normalized version of Up x L1, where Up is the column vector (0, sin(-fixedRoll), cos(-fixedRoll))
  • Column vector L3 is L1 x L2

My feeling is that my 2 approaches should be equivalent, but obviously they are not. Why?

1

There are 1 best solutions below

0
On

I'm assuming (you didn't answer this part of my question) that $X_f$ rotates the vector indicated in your second approach to "Up", aka, the positive $z$ axis. This is why you feel your second approach should be the same as the first.

But what it doesn't rotate is $GP$. So when you construct $L$ in the second attempt, you are constructing it from one vector that is unchanged between the two, and one that has been rotated. The result is a different $L$ than the first attempt - and one that is not different by just a rotation about the $x$-axis. But in the first attempt when you compose with $X_f$, you are rotating the action of $L$ - effectively the same as rotating both $GP$ and "Up".

The "Look At" construction gives a rotation that brings the positive $x$-axis to point towards $P$, while also keeping the positive $z$-axis in the same plane as $GP$ and "Up". By rotating the Up vector first, you changed that to keep the roll constant. But in your first attempt, $L$ doesn't hold roll constant. So after you set the starting roll with $X_f$, it proceeded to change the roll. And that is why the total rotation had the wrong roll.