[Math] How to find angular velocity given a pair of 3×3 rotation matrices

matricesmatrix-calculusrotations

Let's say I have two 3×3 rotation matrices R1 and R2, each signifying rotation from the global frame to the local frame. I am also given the time difference t between these two matrices. How would I find the angular velocity vector [wx,wy,wz] from this information?

The relationship between rotation matrices and angular velocity is described here:

http://www.physicsforums.com/showthread.php?t=522190

where it seems like the angular velocity matrix is:

W(t) = dR(t)/dt * R(t)^-1

However, I am having trouble figuring out what dR/dt is, is it just:

dR(t)/dt = R(t) - R(t-1) / t

Using the above "relation" with actual data does not yield the correct angular velocity tensor, where the diagonal elements are 0's.

Alternatively, it may be easier to convert the rotation matrices to quarternions first. However, I am not clear on the relationship between quarternions, time, and angular velocity.

Best Answer

The problem is that you have the values $R_0 = R(t_0)$ and $R_1 = R(t_1)$ for discrete values $t_0$ and $t_1$; to use the angular velocity formula you've got, you'd need to know a formula for $R(t)$ for all $t$ so that you could take the derivative.

It's like saying "At noon I was in New York. At 4 PM I was in Boston. How fast was I driving?" One answer is "it's about 200 miles, so 50 mph on average." Another is "Who knows? Maybe you were speeding on the CT turnpike and moving slowly through Providence. It's impossible to tell." But there's no single authoritative answer. So we're going to need to make an assumption here. Perhaps an even better example would be "I started flying in Boston and stopped in Sydney, Australia." because now there are two quite different ways to get from one to the other (going E or W).

Let's assume that your object's rotational velocity is a constant $W$ between time $t_0$ and $t_1$. Then we can say that (in matrix form) $W$ is a $3 \times 3$ skew-symmetric matrix, and $$ R_1 = \exp( (t_1 - t_0) W ) R_0 $$ from which we get $$ R_1 R_0^{-1}= \exp( (t_1 - t_0) W ). $$

By the way, it's possible that in your formulation, this should be $$ R_1 = R_0 \exp( (t_1 - t_0) W ) $$ Working out left-versus-right multiply is something you have to do for yourself; it all depends on whether you apply transformations on the right or left, etc. Let me proceed down the road I'm already on.

So at this point, you might as well compute the matrix $A = R_1 R_0^{-1}= R_1 R_0^t$. It's a rotation, because $SO(3)$ is a group. So it has an axis, $v \in S^2$, and an angle, $0 < \theta < \pi$ (unless it's the identity, in which case $W = 0$). Fortunately, you can find these directly from the matrix. It turns out that $$ \theta = \cos^{-1} \left( \frac{tr(A) - 1}{2} \right) $$ and $$ A - A^t = 2 \sin (\theta) J_v $$ where $J_v$ is the matrix $$ \begin{bmatrix} 0 & -z & y \\ z &0 &-x \\ -y & x & 0 \end{bmatrix} $$ when $v$ is the unit vector $(x, y, z)$.

Now a constant-speed curve in $SO(3)$ that starts at $I$ at time $0$, and ends at $A$ at time $t_1 - t_0$ is

$$ \gamma(t) = Rotate(v, \theta t/(t_1 - t_0)) $$ where $Rotate(u, s)$ is a rotation about the unit vector $u$ by angle $s$, which is (Rodrigues' formula) just $$ Rot(u, s) = I + \sin(\theta) J_v + (1- \cos \theta) J_v^2 $$

What's the derivative of $\gamma$ with respect to $t$? \begin{align} \gamma'(t) &= \frac{d ~Rot}{ds} (v, \theta t/(t_1 - t_0)) \cdot \frac{d~ \theta t/(t_1 - t_0)}{d t} \\ &= \left(\cos(\theta t/(t_1 - t_0)) J_v + \sin(\theta t/(t_1 - t_0)) J_v^2 \right) \cdot \frac{\theta}{t_1 - t_0}. \end{align} We want to know this derivative at $t = 0$; that simplifies it to \begin{align} \gamma'(0) &= \left(\cos(\theta 0/(t_1 - t_0)) J_v + \sin(\theta 0/(t_1 - t_0)) J_v^2 \right) \cdot \frac{\theta}{t_1 - t_0} \\ &= \left(\cos(0) J_v + \sin(0) J_v^2 \right) \cdot \frac{\theta}{t_1 - t_0} \\ &= J_v \cdot \frac{\theta}{t_1 - t_0}. \end{align} That last expression can be simplified a little, using $$ A - A^t = 2 \sin (\theta) J_v $$ to give $$ W = J_v \cdot \frac{\theta}{t_1 - t_0} = \frac{1}{2(t_1 - t_0)} \frac{\theta}{\sin \theta} \left( A - A^t \right) $$ And that's your angular velocity -- a $3 \times 3$ skew-symmetric matrix. Kinda fun that the "sinc" function shows up in the middle there.

I apologize for rambling a bit, and not putting things in a terribly clear order. I guess you get what you pay for. :)

Related Question