c4dynamics.rotmat.rotmat.dcm321#
- c4dynamics.rotmat.rotmat.dcm321(phi=0.0, theta=0.0, psi=0.0)[source]#
Generate a 3x3 Direction Cosine Matrix (DCM) for a sequence of positive rotations around the axes in the following order: \(z\), then \(y\), then \(x\).
The final form of the matrix is given by:
\[\begin{split}R = \begin{bmatrix} c\theta \cdot c\psi & c\theta \cdot s\psi & -s\theta \\ s\varphi \cdot s\theta \cdot c\psi - c\varphi \cdot s\psi & s\varphi \cdot s\theta \cdot s\psi + c\varphi \cdot c\psi & s\varphi \cdot c\theta \\ c\varphi \cdot s\theta \cdot c\psi + s\varphi \cdot s\psi & c\varphi \cdot s\theta \cdot s\psi - s\varphi \cdot c\psi & c\varphi \cdot c\theta \end{bmatrix}\end{split}\]where
\(c\varphi \equiv cos(\varphi)\)
\(s\varphi \equiv sin(\varphi)\)
\(c\theta \equiv cos(\theta)\)
\(s\theta \equiv sin(\theta)\)
\(c\psi \equiv cos(\psi)\)
\(s\psi \equiv sin(\psi)\)
- Parameters:
phi (float or int) – The angle in radian of rotation about x, default \(\phi = 0\).
theta (float or int) – The angle in radian of rotation about y, default \(\theta = 0\).
psi (float or int) – The angle in radian of rotation about z, default \(\psi = 0\).
- Returns:
out (numpy.array) – 3x3 Direction Cosine Matrix representing the combined rotation.
Examples
The inertial velocity vector of an aircraft expressed in an inertial earth frame is given by:
>>> v = [150, 0, 0]
The attitude of the aircraft with respect to the inertial earth frame is given by the 3 Euler angles:
\[ \begin{align}\begin{aligned}\phi = 0\\\theta = 30 \cdot {\pi \over 180}\\\psi = 0\end{aligned}\end{align} \]The velcoty expressed in body frame:
>>> dcm321(phi = 0, theta = 30 * c4d.d2r, psi = 0) @ v [129.9 0 75]