Featured
- Get link
- X
- Other Apps
What is Direction Cosine Matrix 1
항공우주 쪽에서 기초적으로 많이 사용되는 좌표계로 지구-중심 관성 (ECI : Earth Centered Inertial), 지구-중심 지구-고정 (ECEF : Earth Centered Earth Fixed), 지면 좌표계 (NED : North East Down), 동체 (Body) 좌표계 등 다양한 좌표계 시스템을 사용한다. 이 말고도 더 다양한 좌표계들이 존재하며 이는 따로 다루도록 할 것이다.
방향 코사인 행렬(DCM : Direction Cosine Matrix)은 한 참조 좌표계를 다른 참조 좌표계로 변환하는 변환 행렬을 의미한다. 아주 간단한 예를 들어 ECI 좌표계에서의 인공위성의 위치를 ECEF 좌표계 기준으로 어떤 위치에 있는지 변환 행렬을 통해 알아낼 수 있다.
이 포스팅에서는 2차원에서 변환행렬을 어떻게 얻을 수 있는지 정리한다.
먼저 다음 그림과 임의의 좌표계 시스템에서 2개의 Vector가 주어졌을 때 두 벡터 사이의 회전 각도를 계산해보고 Vector1에서 Vector2사이의 회전각도를 계산해 보자
두 벡터 사이의 각도를 계산하는 식은 다음과 같다.
$$\large acos\frac{vector2(1,1)}{\parallel vector2\parallel}$$
clear all; %저장된 모든 변수들 삭제
close all; %띄워져 있는 모든 plot 삭제
clc;%보이는 프롬프트 삭제
rad2deg = 180/pi;
vec1 = [1 0 0]';
vec2 = [sqrt(3)/2 1/2 0]';
vec1_ = vec1/norm(vec1);% normalization
vec2_ = vec2/norm(vec2);% normalization
figure;
quiver3(0,0,0,2,0,0,'k'); hold on; grid on;
quiver3(0,0,0,0,2,0,'k');
quiver3(0,0,0,0,0,2,'k');
xlabel('X-axis');ylabel('Y-axis');zlabel('Z-axis');
axis equal;
axis([-2 2 -2 2 -2 2]);
quiver3(0,0,0,vec1_(1,1),vec1_(2,1),vec1_(3,1),'b-','LineWidth',2.5);
quiver3(0,0,0,vec2_(1,1),vec2_(2,1),vec2_(3,1),'r-','LineWidth',2.5);
legend('X-axis','Y-axis','Z-axis','Normalized Vector 1','Normalized Vector 2');
view(0,90);
angle_ = acos(vec2_(1,1)/norm(vec2_));
%angle_ = asin(vec2_(2,1)/norm(vec2_));
str = sprintf('The angle between the two vectors is %g degrees.',angle_*rad2deg);
title(str);
다음으로 2차원에서 어떠한 관성 기준 좌표계인 Frame1에서 Frame2사이의 회전행렬을 구해보도록 한다.
여기서 Frame2의 기저 x, y는 Frame1기준으로 보았을 때 다음과 같이 표현할 수 있다.
이를 행렬로 간단히 표현하면 다음과 같다.
$$\begin{bmatrix}F_{2x} \\F_{2y} \end{bmatrix}=\begin{bmatrix}cos\theta & -sin\theta \\ sin\theta & cos\theta \end{bmatrix}\begin{bmatrix}F_{1x} \\F_{1y} \end{bmatrix}$$
그렇다면 다음으로 Frame2상의 한 점( [1 0]' )이 Frame1에서 어떻게 표현되는지 확인해보자 여기서 Frame2는 Frame1을 +z 방향으로 45도 회전한 것과 같다.
clear all; %저장된 모든 변수들 삭제
close all; %띄워져 있는 모든 plot 삭제
clc;%보이는 프롬프트 삭제
rad2deg = 180/pi;
Frame1_xbasis = [1 0]';
Frame1_ybasis = [0 1]';
Frame2_xbasis = [-sqrt(2)/2 sqrt(2)/2]';%with respect to Frame1
Frame2_ybasis = [ sqrt(2)/2 sqrt(2)/2]';%with respect to Frame1
figure;
quiver(0,0,Frame1_xbasis(1,1),Frame1_xbasis(2,1),'r'); hold on; grid on;
quiver(0,0,Frame1_ybasis(1,1),Frame1_ybasis(2,1),'r');
quiver(0,0,Frame2_xbasis(1,1),Frame2_xbasis(2,1),'b');
quiver(0,0,Frame2_ybasis(1,1),Frame2_ybasis(2,1),'b');
xlabel('F_1 X-axis');ylabel('F_1 Y-axis');zlabel('F_1 Z-axis');
axis equal;
axis([-1.1 1.1 -1.1 1.1 -1.1 1.1]);
arb_pt_F2 = [1 0]';
dcm_ = [cos(pi/4) -sin(pi/4); sin(pi/4) cos(pi/4)];
arb_pt_F1 = dcm_*arb_pt_F2;
plot(arb_pt_F1(1,1), arb_pt_F1(2,1), 'k.', 'MarkerSize',10);
str = sprintf('Arb-pt-F1:[%g, %g]\nArb-pt-F2:[%g, %g]',arb_pt_F1(1,1), arb_pt_F1(2,1),arb_pt_F2(1,1), arb_pt_F2(2,1));
title(str);
legend('F_1 X-basis','F_1 Y-basis','F_2 X-basis','F_2 Y-basis','Arb-pt-F1');
결과에 대한 식은 다음과 같다.
$$Arb\_point\_F1=\begin{bmatrix}cos\frac{\pi}{4} & -sin\frac{\pi}{4} \\sin\frac{\pi}{4} & cos\frac{\pi}{4} \end{bmatrix}Ar
b\_point\_F2\\\begin{bmatrix}cos\frac{\pi}{4} & -sin\frac{\pi}{4} \\sin\frac{\pi}{4} & cos\frac{\pi}{4} \end{bmatrix}\begin{bmatrix}1 \\0 \end{bmatrix}=\begin{bmatrix}\sqrt{2}/2 \\\sqrt{2}/2 \end{bmatrix}$$
그러므로 주어진 임의의 점은 Frame2(Blue)기준으로 [1 0]'일 때 Frame1(Red)의 기준으로 봤을 때 [$\sqrt(2)/2$,$\sqrt(2)/2$]'임을 알 수 있으며 여기서 구해진 다음 행렬 R을 2차원상에서의 Rotation Matrix 또는 Direction Cosine Matrix라고 할 수 있다.
$$R=\begin{bmatrix}cos\theta & -sin\theta \\sin\theta & cos\theta \end{bmatrix}$$
Reference -
[1] http://motion.cs.illinois.edu/RoboticSystems/CoordinateTransformations.html
[2] https://gammabeta.tistory.com/m/913
Popular Posts
Simple MATLAB simulation using Euler rigid body equation and Quaternion kinematics
- Get link
- X
- Other Apps
YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors review
- Get link
- X
- Other Apps
Comments
Post a Comment