c4dynamics.states.lib.rigidbody.rigidbody.RB#
- property rigidbody.RB#
Returns a Reference-from-Body Direction Cosine Matrix (DCM).
Based on the current Euler angles, RB returns the transpose matrix of
BR
, whereBR
is the Body from Reference DCM in 3-2-1 order.The transpose matrix of the DCM generated by three Euler angles \(\varphi\) (rotation about x), \(\theta\) (about y), and \(\psi\) (about z) in 3-2-1 order, is given by:
\[\begin{split}R = \begin{bmatrix} c\theta \cdot c\psi & s\varphi \cdot s\theta \cdot c\psi - c\varphi \cdot s\psi & c\varphi \cdot s\theta \cdot c\psi + s\varphi \cdot s\psi \\ c\theta \cdot s\psi & s\varphi \cdot s\theta \cdot s\psi + c\varphi \cdot c\psi & c\varphi \cdot s\theta \cdot s\psi - s\varphi \cdot c\psi \\ -s\theta & s\varphi \cdot c\theta & 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)\)
For the background material regarding the rotational matrix operations, see
rotmat
.- Returns:
out (numpy.ndarray) – A 3x3 DCM matrix uses to rotate a vector from a body frame to a reference frame of coordinates.
Example
>>> v_body = [np.sqrt(3), 0, 1] >>> rb = c4d.rigidbody(theta = 30 * c4d.d2r) >>> v_inertial = rb.RB @ v_body >>> v_inertial [2.0 0.0 0.0]