# rotate a coordinate frame's position and orientation together

say we have a coordinate frame defined by T_po, w.r.t. the world frame.

How can I rotate this coordinate frame using a rotation matrix such both position and orientation rotate together. So far I tried multiplying a rotation matrix, but this rotation matrix only rotates the frame locally with respect to it's own frame.

• I don't understand what you want, can you be clearer ? Jan 28, 2022 at 14:26
• @Lelouch simiar to the picture: we have a coordinate frame (in 3D), on right, and we rotate it using a rotation matrix. but how do we do so such that after rotation (the new frame on left), both position and orientation are modified accordingly Jan 28, 2022 at 14:45

If I understand your statements correctly, you have the homogeneous transformation $$T^O_A$$ relating coordinate frame $$A$$ to the global reference frame, and you wish to compute $$T^O_B$$, generated by rotating the frame $$A$$ by an angle $$\theta$$ about the origin.

Let us represent $$T^O_A$$ as: $$T^{O}_{A} = \begin{bmatrix}R^{O}_{A}& \begin{bmatrix}x_A\\y_A\end{bmatrix} \\\mathbf{0}&1\end{bmatrix}$$ Realize that $$R^{O}_{B} = R^{O}_{A}Rot(z,\theta)$$, where $$Rot(z,\theta) = \begin{bmatrix}cos(\theta)&-sin(\theta)\\sin(\theta)&cos(\theta)\end{bmatrix}$$ is the rotation matrix about the z axis. To describe the origin of the frame $$B$$, we need to rotate the vector $$\mathbf{r} = \begin{bmatrix}x_A\\y_A\end{bmatrix}$$ by $$Rot(z,\theta)$$: $$\begin{bmatrix}x_B\\y_B\end{bmatrix} = Rot(z,\theta)\begin{bmatrix}x_A\\y_A\end{bmatrix}$$ Now, you can formulate $$T^O_B$$ as: $$T^{O}_{B} = \begin{bmatrix}R^{O}_{B}& \begin{bmatrix}x_B\\y_B\end{bmatrix} \\\mathbf{0}&1 \end{bmatrix} = \begin{bmatrix}R^{O}_{A}Rot(z,\theta)& Rot(z,\theta)\begin{bmatrix}x_A\\y_A\end{bmatrix} \\\mathbf{0}&1 \end{bmatrix}$$

The original frame has its origin at $$d_A$$ and has its axes as columns of the rotation matrix $$R_A$$, then the global (world) coordinates are given by

$$p_W = d_A + R_A p_A$$

Now you want to rotate $$p_W$$ about the origin through an angle $$\theta$$, which generates the rotation matrix $$R$$

$$R = \begin{bmatrix} \cos( \theta) && - \sin (\theta) \\ \sin( \theta) && \cos(\theta) \end{bmatrix}$$

and the new coordinate vector after rotation is

$$p'_W = R p_W = R d_A + R R_A p_A = d'_A + R'_A p_A$$

with obvious correspondence between the variables.