Concept - soup1997/Study-Alone GitHub Wiki

Motion model: $p(x_t|x_{t-1},u_t)$

control input($u_t$)이 이전 state($x_{t-1}$)을 ν˜„μž¬ state($x_t$)둜 λ³€ν™”μ‹œν‚¬ 사후확λ₯ (posterior probability), μŠ€ν…Œμ΄νŠΈ 전이 ν™•λ₯ μ„ μ˜λ―Έν•œλ‹€.

Odometry based model

μžλ™μ°¨μ˜ 바퀴에 μž₯착된 wheel encoder의 μ„Όμ„œ 데이터λ₯Ό μ΄μš©ν•œ λͺ¨λΈ, λͺ¨μ…˜ λͺ…령을 μ‹€ν–‰ν•œ ν›„μ—λ§Œ μ„Όμ„œ 값을 얻을 수 있기 λ•Œλ¬Έμ— 좔정을 μœ„ν•΄ μ μš©ν•œλ‹€.

  • $u=<\delta_{rot1}, \delta_{rot2}, \delta{trans}>$
    image image

Velocity based model

μžλ™μ°¨μ˜ λ¬΄κ²Œμ€‘μ‹¬ λ˜λŠ” ν›„λ₯œμ€‘앙에 λΆ€μ°©λœ imu와 같은 κ΄€μ„± μ„Όμ„œλ₯Ό μ΄μš©ν•œ λͺ¨λΈ

  • $u=(v, w)^T$, where $v$ is translation velocity and $w$ is rotational velocity image image

Observation Model: $p(z_t|x_t)$

ν˜„μž¬ stateμ—μ„œμ˜ μ„Όμ„œ λ°μ΄ν„°μ˜ ν™•λ₯ μ„ μ˜λ―Έν•˜λ©° Model for laser scanners의 경우 λ‹€μŒκ³Ό κ°™λ‹€.

  • $z_t=(z_t^1, \dots, z_t^k)$: Scan $z$ consists of $K$ measurements.
  • $p(z_t|x_t)=\Pi_{i=1}^kp(z_{t}^i|x_t)$: Individual measurements are independent given the robot position

The Rotation Group SO(3)

3차원 κ³΅κ°„μ—μ„œ SO(3) ꡰ은 원점을 μ€‘μ‹¬μœΌλ‘œ νšŒμ „ν•˜λŠ” 연산에 λŒ€ν•œ ꡰ을 λ§ν•œλ‹€. μ΄λŠ” λ‘œλ³΄ν‹±μŠ€μ—μ„œ 강체(rigid body)의 μ›€μ§μž„ 쀑 νšŒμ „μ„ ν‘œν˜„ν•˜λŠ”λ° 주둜 μ‚¬μš©λœλ‹€. rigid body motionμ΄λž€ 물체의 ν˜•νƒœκ°€ λ³€ν™”ν•˜μ§€ μ•Šμ•„μ„œ 각도, μƒλŒ€μ μΈ νšŒμ „λŸ‰, 거리 등이 λ³΄μ‘΄λ˜λŠ” μ›€μ§μž„μ„ μ˜λ―Έν•œλ‹€.

  • SO(3)ꡰ은 일반적으둜 νšŒμ „ν–‰λ ¬(rotation matrix)λ₯Ό μ‚¬μš©ν•˜μ—¬ ν‘œκΈ°ν•œλ‹€.
  • Quaternion을 μ‚¬μš©ν•˜μ—¬ SO(3)λ₯Ό ν‘œκΈ°ν•˜λŠ” 방법 λ˜ν•œ 널리 μ‚¬μš©λœλ‹€.

SO(3) group properties

  • νšŒμ „ν–‰λ ¬μ˜ 직ꡐ μ„±μ§ˆ: $R^TR=I=RR^T$
  • νšŒμ „ν–‰λ ¬μ˜ 역행렬은 전지행렬과 동일: $R^{-1}=R^T$
  • κ°•μ²΄μ˜ μ›€μ§μž„: $det(R)=1$
  • 합성은 ν–‰λ ¬μ˜ κ³±μ…ˆ μ—°μ‚°: $R_1\cdot R_2=R_3\in SO(3)$

3D Rotation Matrix

3D rotation matrices can be obtainded from these three using matrix multiplication.
Generally, ZYX rotation is used. yaw, pitch, and roll angles are $\alpha, \beta$ and $\gamma$ respectively.

  1. κΈ°μ€€ μ’Œν‘œκ³„(Global Coordinate)을 XμΆ•(Roll)을 κΈ°μ€€μœΌλ‘œ $\gamma$ 만큼 νšŒμ „
  2. κΈ°μ€€ μ’Œν‘œκ³„(Global Coordinate)을 YμΆ•(Pitch)을 κΈ°μ€€μœΌλ‘œ $\beta$ 만큼 νšŒμ „
  3. κΈ°μ€€ μ’Œν‘œκ³„(Global Coordinate)을 ZμΆ•(Yaw)을 κΈ°μ€€μœΌλ‘œ $\alpha$ 만큼 νšŒμ „

image

  • Rotation matrix has has inverse matrix and transposed matrix which indicates roration in the opposite direction.
  • Sets that satisfy the properties of rotation matrix belongs to SO(3) (Special Orthogonal Group).
  • SO(3) groups can only express rotations. The 4X4 matrix must be considered to represent Translation, It should be extended to homogeneous coordinate.
  • In this 4X4 matrix, the determinant = +1 of R(rotation), and the group that forms the affine rigid motion is called SE(3).

Quaternion Kinematics

image

$$q=\begin{bmatrix}q_w&q_x&q_y&q_z\end{bmatrix}^T$$

$Q = q_w+q_xi+q_yj+q_zk \Leftrightarrow Q=q_w+\boldsymbol{q_v}$

where $\boldsymbol{q_v}$ is vector $(x, y, z)$. Therefore, a quaternion can be posed as a sum scalar($q_w$) + vector($\boldsymbol{q_v}$).

Quaternion Product

image

The Rotation group and the rotation matrix

image

  • $q^{*}=q_w-\boldsymbol{q_v}$
  • For unit quaternions, $||q||=1$, and therefore $q^{-1}(inverse) = q^{*}(conjugate)$.

Euler angles to Quaternion

image

  • If the axis of rotation is the x-axis

$q_w = cos(\alpha/2)$, $q_x = sin(\alpha/2) * 1$, $q_y = sin(\alpha/2) * 0$, $q_z = sin(\alpha/2) * 0$

  • If the axis of rotation is the y-axis

$q_w = cos(\alpha/2)$, $q_x = sin(\alpha/2) * 0$, $q_y = sin(\alpha/2) * 1$, $q_z = sin(\alpha/2) * 0$

  • If the axis of rotation is the z-axis

$q_w = cos(\alpha/2)$, $q_x = sin(\alpha/2) * 0$, $q_y = sin(\alpha/2) * 0$, $q_z = sin(\alpha/2) * 1$

where $\alpha$ is rotation angle.

Quaternion to Euler angles

image

#define _USE_MATH_DEFINES
#include <cmath>

struct Quaternion {
    double w, x, y, z;
};

struct EulerAngles {
    double roll, pitch, yaw;
};

// this implementation assumes normalized quaternion
// converts to Euler angles in 3-2-1 sequence
EulerAngles ToEulerAngles(Quaternion q) {
    EulerAngles angles;

    // roll (x-axis rotation)
    double sinr_cosp = 2 * (q.w * q.x + q.y * q.z);
    double cosr_cosp = 1 - 2 * (q.x * q.x + q.y * q.y);
    angles.roll = std::atan2(sinr_cosp, cosr_cosp);

    // pitch (y-axis rotation)
    double sinp = std::sqrt(1 + 2 * (q.w * q.y - q.x * q.z));
    double cosp = std::sqrt(1 - 2 * (q.w * q.y - q.x * q.z));
    angles.pitch = 2 * std::atan2(sinp, cosp) - M_PI / 2;

    // yaw (z-axis rotation)
    double siny_cosp = 2 * (q.w * q.z + q.x * q.y);
    double cosy_cosp = 1 - 2 * (q.y * q.y + q.z * q.z);
    angles.yaw = std::atan2(siny_cosp, cosy_cosp);

    return angles;
}

Homogeneous Coordinate (동차 μ’Œν‘œκ³„)

  • nμ°¨μ›μ˜ μ’Œν‘œλ₯Ό n+1개의 μ’Œν‘œλ‘œ λ‚˜νƒ€λ‚΄λŠ” 것
  • μ’ŒμΈ‘μ€ Homogeneous coordinate μš°μΈ‘μ€ Cartesian(Euclidean) coordinate을 μ˜λ―Έν•œλ‹€.

$$X= \begin{bmatrix} u\\ v\\ w \end{bmatrix} = w\begin{bmatrix} x\\ y\\ 1 \end{bmatrix} = \begin{bmatrix} x\\ y\\ 1 \end{bmatrix} \Leftrightarrow X = \begin{bmatrix} x\\ y \end{bmatrix}$$

  • 3μ°¨μ›μ—μ„œμ˜ νšŒμ „ν–‰λ ¬(Rotation matrix)와 평행 이동행렬(translation matrix) λ‹€μŒκ³Ό 같이 μ •μ˜λœλ‹€.

$$R^{3D}(w, \phi, \kappa)=R_z^{3D}(\kappa)R_y^{3D}(\phi)R_x^{3D}(w)$$

$$t= \begin{bmatrix} t_x\\ t_y\\ t_z\end{bmatrix}$$

  • λ”°λΌμ„œ 3μ°¨μ›μ—μ„œμ˜ μ΅œμ’…μ μœΌλ‘œ 물체의 νšŒμ „κ³Ό 이동을 ν•œλ²ˆμ— ν‘œν˜„ν•˜λŠ” homogeneous transformation matrixλŠ” λ‹€μŒκ³Ό κ°™λ‹€.

$$M= \lambda \begin{bmatrix} R & t\\ 0^T & 1 \end{bmatrix}$$

⚠️ **GitHub.com Fallback** ⚠️