Study/외부장치

NGIMU 그냥 해본 것...

BlueBright 2019. 9. 23. 15:43

 

해당 IMU는 축의 반시계 방향으로 각도가 증가 한다. (보통 기본적인  IMU가 그러한 듯?)

축의 반시계 방향을 정의 하는 방법은

먼저 축의 (+) 방향에 오른손 엄지손가락을 위치시키고, 나머지 손가락으로 축을 감싼다. 

축을 감싼 나머지 손가락의 방향이 반시계 방향이되며, 이 방향으로 각도가 (+)가 된다.

 

※ 물론 각도에 대한 값이니까 일부 구간에서 (-)이다. 

 

하단의 사이트에서 힌트를 얻어 회전 행렬을 유도 한다.

 

https://o-tantk.github.io/posts/derive-rotation-matrix/

 

tantk land

 

o-tantk.github.io

http://planning.cs.uiuc.edu/node102.html

 

Yaw, pitch, and roll rotations

A 3D body can be rotated about three orthogonal axes, as shown in Figure 3.8. Borrowing aviation terminology, these rotations will be referred to as yaw, pitch, and roll: A yaw is a counterclockwise rotation of about the -axis. The rotation matrix is given

planning.cs.uiuc.edu

 

http://www.chrobotics.com/library/understanding-euler-angles

 

Understanding Euler Angles | CH Robotics

 

www.chrobotics.com

 

$R_z(yaw) 
= \begin{pmatrix}
\cos(yaw) & - \sin(yaw) & 0\\ 
\sin(yaw) & cos(yaw) & 0\\ 
0& 0 & 1
\end{pmatrix}$
$R_y(pitch) 
= \begin{pmatrix}
\cos(pitch) & 0 & \sin(pitch) \\ 
0 & 1 & 0 \\ 
-\sin(pitch)& 0 & \cos(pitch)
\end{pmatrix}$
$R_x(roll) 
= \begin{pmatrix}
1 & 0 & 0 \\
0 & \cos(roll) & -\sin(roll) \\ 
0 & \sin(roll) & \cos(roll)
\end{pmatrix}$

 

유도한 회전 행렬을 이용하면,  Yaw, pitch, roll에 대한 방향 벡터 행렬 (식)을 구할 수 있다.

※ 행렬은 기준이 되는 축의 특성에 따라서 변화할 수 있다. (예를 들면 시계 방향으로 (+) 라던지...)

방향 벡터의 길이는 단위 벡터 이므로 1이 나온다.

 

$R(yaw,pitch,roll) 
= R_z(yaw)R_y(pitch)R_x(roll)\\
= \begin{pmatrix}
\cos(yaw)\cos(pitch) 
& \cos(yaw)\sin(pitch)\sin(roll)-\sin(yaw)\cos(roll) 
& \cos(yaw)\sin(pitch)\cos(roll)+\sin(yaw)\sin(roll)\\ 
\sin(yaw)\cos(pitch) 
& \sin(yaw)\sin(pitch)\sin(roll)+\cos(yaw)\cos(roll) 
& \sin(yaw)\sin(pitch)\cos(roll)-\cos(yaw)\sin(roll)\\ 
-\sin(pitch) 
& \cos(pitch)\sin(roll) 
& \cos(pitch)\cos(roll)
\end{pmatrix}$

 

x축 기준

기본 위치 벡터

(1,0,0)

$\begin{pmatrix} 
x\\  
y\\  

\end{pmatrix} = \begin{pmatrix} 
\cos(yaw)\cos(pitch)\\ 
\sin(yaw)\cos(pitch)\\  
-\sin(pitch) 
\end{pmatrix}$

y축 기준

기본 위치 벡터

(0,1,0)

$\begin{pmatrix} 
x\\  
y\\  

\end{pmatrix}  

\begin{pmatrix} 
\cos(yaw)\sin(pitch)\sin(roll)-\sin(yaw)\cos(roll)\\ 
\sin(yaw)\sin(pitch)\sin(roll)+\cos(yaw)\cos(roll)\\  
\cos(pitch)\sin(roll) 
\end{pmatrix}$

z축 기준

기본 위치 벡터

(0,0,1)

$\begin{pmatrix} 
x\\  
y\\  

\end{pmatrix}  

\begin{pmatrix} 
\cos(yaw)\sin(pitch)\cos(roll)+\sin(yaw)\sin(roll)\\ 
\sin(yaw)\sin(pitch)\cos(roll)-\cos(yaw)\sin(roll)\\  
\cos(pitch)\cos(roll) 
\end{pmatrix}$

 


기준 :  IMU를 북쪽으로 위치시키고 (IMU를 똑바로 두고 X축이 북쪽을 향하도록)

Roll, Pitch, Yaw가 거의 0인 상태에서 시작하면 쉽다. 

(이상적인 값은 x축 기준일 때, (1,0,0) y축 기준일 때, (0,1,0)

 

저 상태가 거의 0 값이었다
구해보자

roll, pitch, yaw의 측정 값은 기기에서 자동으로 측정을 한다.

측정한 값과 유도한 행렬식을 이용하여, 방향 벡터를 구하면 된다.

 

방향 벡터의 대략적인 위치를 추론할 수 있다.

x,y,z의 좌표 축은 IMU의 기본 위치 일 때로 맞추어 놓는다.

그리고 얼마나 Rotation이 되었는지 확인하면 된다. (기기에 x,y,z가 적혀 있으니까...)

 

3D 계산은 해당 사이트를 이용함

https://www.monroecc.edu/faculty/paulseeburger/calcnsf/CalcPlot3D/

 

 

주황 : 회전한 x 방향 벡터 / 보라 : 회전한 y 방향 벡터 / 녹색 : 회전한 z 방향 벡터

 

 

 

 

 

솔직히 말해서 다 접어치우고, AHRS (attitude and heading reference system) 알고리즘 적용하는 것이 좋을지도???

 

벡터 다 까먹어서 이 계산식하고 결과가 맞는 것인지 잘 모르겠음... 그리고 애초에 IMU 만으로는 센서 좌표를 측정하는 것이 매우 힘들고, INS정도는 되어야 센서 좌표 측정이 보다 쉽다고 함.

 

 

 

기타 센서 관련해서 참고한 사이트 (+칼만필터)

 

IMU Attitude Estimation : http://philsal.co.uk/projects/imu-attitude-estimation

칼만필터 쉽게 이해 : https://codingcoding.tistory.com/439

GPS and Accelerometer Sensor Fusion with a Kalman Filter, a Practical Walkthrough (Golang)

Motion Sensors Explainer : https://www.w3.org/TR/motion-sensors/#accelerometer-sensor

How a Kalman filter works, in pictures : https://www.bzarg.com/p/how-a-kalman-filter-works-in-pictures/

Greg Czerniak's Website : http://greg.czerniak.info/guides/kalman1/

[SLAM] Kalman filter and EKF(Extended Kalman Filter)

칼만필터 C++ 오픈소스 (근데 사용법을 잘 모르겠음) : http://kalman.sourceforge.net/doc.php

IMU와 INS란? : http://blog.naver.com/zzbksk/221008192107

A Guide to using IMU : http://www.starlino.com/imu_guide.html

The Scalar Kalman Filter : https://roboticslab.tistory.com/11

칼만필터 (다른 블로그 글) : blog.tkjelectronics.dk/2012/09/a-practical-approach-to-kalman-filter-and-how-to-implement-it/

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

'Study > 외부장치' 카테고리의 다른 글

Leica BLK360  (0) 2019.10.10