I am a bit confused about the difference between direction cosine matrix(DCM) and rotation matrix. I have searched through the literature but found no explicit explanation if they are different or same and when should each of them be used. For DCM I have referred to this documents ([DCM][1]) and what I understood is that the DCM and rotation matrix for a Yaw,Pitch,Roll sequence can be calculated as shown in the code snippet below:
import math
import numpy as np
yaw = np.deg2rad(90);
pitch = np.deg2rad(0);
roll = np.deg2rad(0);
yawMatrix = np.matrix([[math.cos(yaw), -math.sin(yaw), 0],
[math.sin(yaw), math.cos(yaw), 0],
[0, 0, 1]
])
pitchMatrix = np.matrix([[math.cos(pitch), 0, math.sin(pitch)],
[0, 1, 0],
[-math.sin(pitch), 0, math.cos(pitch)]
])
rollMatrix = np.matrix([[1, 0, 0],
[0, math.cos(roll), -math.sin(roll)],
[0, math.sin(roll), math.cos(roll)]
])
R = yawMatrix * pitchMatrix * rollMatrix
dcm_yaw = np.matrix([[math.cos(yaw), math.sin(yaw), 0],
[-math.sin(yaw), math.cos(yaw), 0],
[0, 0, 1]
])
dcm_pitch = np.matrix([[math.cos(pitch), 0, -math.sin(pitch)],
[0, 1, 0],
[math.sin(pitch), 0, math.cos(pitch)]
])
dcm_roll = np.matrix([[1, 0, 0],
[0, math.cos(roll), math.sin(roll)],
[0, -math.sin(roll), math.cos(roll)]
])
DCM = dcm_yaw * dcm_pitch * dcm_roll
print(R)
print(DCM)
Is this intepretation of DCM and rotation matrices correct? [1]: https://www.scribd.com/document/439833165/Directional-Cosine-Matrices
Yes DCM is a rotation matrix.
You can check it is defined as rotation matrix in this paper of the "MEMS inertial navigation systems for aircraft" https://www.sciencedirect.com/topics/engineering/direction-cosine-matrix
And in several other papers is regarded as member of SO(3) group, which means it is a rotation. Also, you can check the matrix is orthogonal and its determinant is equal to one, which is the dedinition of a rotation matrix.