# How to compute the angular velocity from the angles of a rotation matrix?

I'm struggling to understand the relation between the angles used to compose a rotation matrix and the angular velocity vector of the body expressed in the body frame.

Assume there is no translation between the body frame and the world frame. If I have a 3D vector specified in the body coordinate system, $v_b$, and I want to express it in the world coordinate system, $v_w$, I use a rotation matrix like this: $$v_w=R\cdot v_b$$

where $R$ is formed by multiplying simpler rotation matrices, like this: $$R = R_x(\theta_r).R_y(\theta_p).R_z(\theta_y)$$

where $R_i(\theta)$ is the rotation matrix that rotates a vector around the coordinate $i$, by $\theta$ radians.

Now, I would like to calculate the angular velocity vector (i.e. the vector, $\omega$, specified in the body coordinate system, which is aligned with the axis of rotation and has the magnitude equal to the angular speed which the frame is rotating). At first I thought this should simply be:

$$\omega = [\dot{\theta}_r, \dot{\theta}_p, \dot{\theta}_y]^T$$

but now I'm really starting to doubt that. Can someone provide some insight into how I can compute this vector?

To get the angular velocity from a time-dependent rotation matrix $R(t)\in \mathrm{SO}(3)$, all you need to do is differentiate.
More specifically, since you know that $R(t)^TR(t)\equiv \mathbb 1$, differentiating with respect to time you get $R(t)^TR'(t)+R'(t)^TR(t) = 0$, and w.l.o.g. taking $t=0$ and therefore $R(t)=\mathbb 1$, you get $R'(t) = -R'(t)^T$, i.e. that the derivative of the rotation matrix is skew symmetric. This means that you can write it as $$\frac{\mathrm dR}{\mathrm dt} = \begin{pmatrix}0 & -\omega_z & \omega_y \\ \omega_z & 0 & -\omega_x \\ -\omega_y & \omega_x & 0\end{pmatrix}$$ for some triplet of numbers $\omega_x,\omega_y,\omega_z$. These turn out to be the components of the angular velocity, at least at those times when $R(t)=\mathbb 1$. In general you need to do some playing around with frames of reference, which are duly explained in Wikipedia, but the idea remains unchanged.