[Math] Integrating body angular velocity

integrationrotations

I've been reading over some very comprehensive notes on attitude representation, which were compiled by James Diebel, a Stanford student: http://www.swarthmore.edu/NatSci/mzucker1/e27/diebel2006attitude.pdf

What is of particular interest to me is equation $266$, which states that the rotation vector representation of an attitude is the integral of the body angular velocities over the time frame of interest (assuming the body and inertial frames start out coincident)

I see no proof of this anywhere in the paper, can someone help me understand how this is possible?

Edit

To clarify, this is my issue. Say I want to represent that attitude of the difference between two coordinate systems (say inertial and body) using an angle/axis vector that rotates a vector in the inertial frame to one in the body frame:
$$v_{bi}(t)$$
I have measurements of body angular rate (from, lets say a gyroscope)
$$\omega_b(t)$$
I'm curious if the following is generally true:
$$\dot{v}_{bi}(t)=\omega_b(t)$$

Equation $266$ suggests that it is, equation $265$ seems to suggest otherwise.

Best Answer

TL;DR: Ignore what you read in that paper; use either Eq. (2) or (3) in this post if you want to "integrate" angular velocity.


There is a solution to your problem, in the sense that it is possible to "integrate" the angular-velocity vector $\omega$ to obtain the rotation taking the inertial "world" frame onto the rotating "body" frame. In fact, I've written a paper titled "The integration of angular velocity". It turns out that it's pretty simple to get the frame from the angular velocity, but it's not quite as simple as just integrating $\omega$ as a vector.

First, to clear up the confusion about that paper: Diebel uses some unfortunate notation. The equation (266) you point to says \begin{equation} \mathbf{v}_{\omega'} := \int_{t_0}^{t_1} \boldsymbol{\omega}' dt \tag{1} \end{equation} There are two important things to note here. First, $\boldsymbol{\omega}$ is primed, meaning (as you seem to understand) that this is measured with respect to the body. That is, the basis with respect to which it is defined is different at each instant. So this is not what we normally mean when we're talking about the angular-velocity vector. Second, the quantity on the left is most definitely not the rotation vector required to go from the inertial frame to the body frame. Instead, it is some kind of rotation-rate vector which, if you multiply it by some infinitesimal time, would generate that rotation that takes the body frame at this instant into the body frame at that infinitesimal time in the future. Basically, Diebel can define any vector he wants—and he did so in Eq. (1). But it's only any use if $t_1$ and $t_0$ are infinitesimally close. Of course, this is all he uses it for in the following paragraph, so it's okay for him. But in general, I suggest you ignore that equation entirely.

The reason that Eq. (1) is not useful in general is because, at different instants, $\boldsymbol{\omega}'$ is defined with respect to different frames. So it doesn't make a whole lot of sense to add vectors from different instants together, which is just what that integral tries to do, unless the rotation is about a fixed axis. However, it is possible to rotate that body-fixed vector into the inertial frame. (You also probably don't want to write it as an integral equation; it's better as a standard differential equation.) The best way to integrate angular velocity is to use quaternions. Of course, quaternions are basically always the right way to do anything with rotations anyway. I don't understand why Diebel insists on converting quaternions into matrices, so I'll just get away from him, and write things like any normal person would.

Let's suppose $R(t)$ is a unit quaternion function of time that takes your inertial frame onto the body frame. For example: \begin{equation} \mathbf{x}'(t) = R(t)\, \mathbf{x}\, \bar{R}(t), \end{equation} and similarly for $\mathbf{y}$ and $\mathbf{z}$. Using the usual definition of angular velocity as that thing which, when crossed with a vector in the body frame, gives the rate of change of that vector. In particular, we have: \begin{equation} \frac{d \mathbf{x}'} {dt}(t) = \boldsymbol{\omega}(t) \times \mathbf{x}', \end{equation} and similarly for $\mathbf{y}$ and $\mathbf{z}$. Now, we can combine these equations (and use the fact that they are generally true for any vectors, not just the basis vectors) to find a relation between the quaternion and the angular velocity: \begin{equation} \boldsymbol{\omega}(t) = 2\, \dot{R}(t)\, \bar{R}(t). \end{equation} I'm sure that this has been done elsewhere, but my favorite derivation is in Section 3 of my paper.

There are a few ways to go from here, but the most obvious is to just use this as the differential equation you were looking for. Just rearrange a little to find \begin{equation} \dot{R}(t) = \frac{1}{2}\, \boldsymbol{\omega}(t)\, R(t). \tag{2} \end{equation} The right-hand side is a valid quaternion product, so you can just integrate the four components that result to get your frame quaternion $R(t)$. You also need an initial condition to solve this, of course, but that's to be expected.

If, instead, you have $\boldsymbol{\omega}'$ (measured with respect to the body), you can simply rotate that back into the inertial frame as $\boldsymbol{\omega}(t) = R(t)\, \boldsymbol{\omega}'(t)\, \bar{R}(t)$, in which case you have \begin{equation} \dot{R}(t) = \frac{1}{2}\, R(t)\, \boldsymbol{\omega}'(t). \tag{3} \end{equation} This is the more relevant equation if, for example, you measure angular velocity using some gyroscope embedded in the body.

Finally, I'll point out that it's also possible to integrate to find the generator of the rotation, which I'll label $\boldsymbol{r}(t)$. This is precisely the angle/axis vector, where the axis is given by the direction of the generator and the angle is proportional to the length of the generator. It is related to the quaternion by $R(t) = \exp[\boldsymbol{r}(t)]$. In this case, the differential equation is a bit more complicated: \begin{equation} \dot{\boldsymbol{r}} = \frac{1}{2} \boldsymbol{\omega} \times \boldsymbol{r} + \boldsymbol{\omega} \frac{\lvert\boldsymbol{r}\rvert \cot \lvert\boldsymbol{r}\rvert} {2} + \boldsymbol{r} \frac{\boldsymbol{r} \cdot \boldsymbol{\omega}} {2 \lvert\boldsymbol{r}\rvert^2} \left(1 - \lvert\boldsymbol{r}\rvert \cot \lvert\boldsymbol{r}\rvert \right). \end{equation} Besides looking uglier, this equation also requires some careful handling, because $\boldsymbol{r}$ typically goes through some weird values that are precisely analogous to branch cuts of the complex logarithm, but which cause serious numerical problems. If you're careful about handling this behavior, you can make this system as good as (and occasionally even better than) the systems of Eq. (2) and (3), but it's probably not worth the effort. These issues are all discussed at length in my paper.

Related Question