11612232 黄旭
![1558148027374](./Homework 10.assets/1558148027374.png)
Since the location of the landmark is known, the EKF SLAM problem can be transfer to EKF location problem
State vector is $$ \mu = \begin{bmatrix} x & y \end{bmatrix}^T $$ State transfer matrix is $$ A = \begin{bmatrix} 1 & 0 \ 0 & 1 \end{bmatrix} $$ Control vector is $$ u = \begin{bmatrix} S_x & S_y \end{bmatrix}^T $$ Control transfer matrix is $$ B = \begin{bmatrix} 1 & 0 \ 0 & 1 \end{bmatrix} $$ So, the prediction part of EKF location is: $$ \begin{align} \bar\mu_t &= A\mu_{t-1} + Bu_t \ \bar\Sigma_t &= A\Sigma_{t-1}A^T + Q \end{align} $$ where $$ Q = \begin{bmatrix} \sigma_{vx} & 0 \ 0 & \sigma_{vy} \end{bmatrix} $$
For the observation, the observation matrix is
For SLAM problem, the corresponding state vector is: $$ \mu = \begin{bmatrix} x & y & x_0 & y_0 & a\end{bmatrix}^T $$ State transfer matrix is $$ A = \begin{bmatrix} 1 & 0 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 & 0 \ 0 & 0 & 1 & 0 & 0 \ 0 & 0 & 0 & 1 & 0 \ 0 & 0 & 0 & 0 & 1 \ \end{bmatrix} $$ Control vector is $$ u = \begin{bmatrix} S_x & S_y \end{bmatrix}^T $$ Control transfer matrix is $$ B = \begin{bmatrix} 1 & 0 \ 0 & 1 \ 0 & 0 \ 0 & 0 \ 0 & 0 \ \end{bmatrix} $$ So, the prediction part of EKF location is: $$ \begin{align} \bar\mu_t &= A\mu_{t-1} + Bu_t \ \bar\Sigma_t &= A\Sigma_{t-1}A^T + Q \end{align} $$ where $$ Q = \begin{bmatrix} \sigma_{vx} & 0 \ 0 & \sigma_{vy} \end{bmatrix} $$ For the observation, the observation matrix is
![1558160433264](./Homework 10.assets/1558160433264.png)
Since the location of the landmark is known, the EKF SLAM problem can be transfer to EKF location problem
State vector is $$ \mu = \begin{bmatrix} x & y & \theta \end{bmatrix}^T $$ Control vector is $$ u = \begin{bmatrix} \delta_{tran} & \delta_{rot1} & \delta_{rot2} \end{bmatrix}^T $$ The Jacobian matrix is $$ G_t = \begin{bmatrix} 1 & 0 & -\delta_{tran}\sin(\theta + \delta_{rot1}) \ 0 & 1 & \delta_{tran}\cos(\theta + \delta_{rot1}) \ 0 & 0 & 1 \ \end{bmatrix} $$
So, the prediction part of EKF location is: $$ \begin{align} \bar\mu_t &= \mu_{t-1} + \begin{bmatrix} \delta_{tran}\cos(\theta + \delta_{rot1}) \ \delta_{tran}\sin(\theta + \delta_{rot1}) \ \theta + \delta_{rot1} + \delta_{rot2} \ \end{bmatrix} \ \bar\Sigma_t &= G_t\Sigma_{t-1}G_t^T + Q \end{align} $$ where $$ \begin{bmatrix} \sigma_x & 0 & 0 \ 0 & \sigma_y & 0 \ 0 & 0 & \sigma_{\theta} \ \end{bmatrix} $$
For the observation, the observation matrix is
Thus, the Jacobian matrix is $$ H = \begin{bmatrix} \frac{\partial h_1(\bar\mu)}{\partial x} & \frac{\partial h_1(\bar\mu)}{\partial y} & \frac{\partial h_1(\bar\mu)}{\partial \theta} \ \frac{\partial h_2(\bar\mu)}{\partial x} & \frac{\partial h_2(\bar\mu)}{\partial y} & \frac{\partial h_2(\bar\mu)}{\partial \theta} \ \frac{\partial h_3(\bar\mu)}{\partial x} & \frac{\partial h_3(\bar\mu)}{\partial y} & \frac{\partial h_3(\bar\mu)}{\partial \theta} \ \frac{\partial h_4(\bar\mu)}{\partial x} & \frac{\partial h_4(\bar\mu)}{\partial y} & \frac{\partial h_4(\bar\mu)}{\partial \theta} \ \end{bmatrix} = \begin{bmatrix} \frac{\bar x - x_1}{\sqrt{q_1}} & \frac{\bar y - y_1}{\sqrt{q_1}} & 0 \ -\frac{\bar y - y_1}{q_1} & \frac{\bar x - x_1}{q_1} & 0 \ \frac{\bar x - x_2}{\sqrt{q_2}} & \frac{\bar y - y_2}{\sqrt{q_2}} & 0 \ -\frac{\bar y - y_2}{q_2} & \frac{\bar x - x_2}{q_2} & 0 \ \frac{\bar x - x_3}{\sqrt{q_3}} & \frac{\bar y - y_3}{\sqrt{q_3}} & 0 \ -\frac{\bar y - y_3}{q_3} & \frac{\bar x - x_3}{q_3} & 0 \ \frac{\bar x - x_4}{\sqrt{q_4}} & \frac{\bar y - y_4}{\sqrt{q_4}} & 0 \ -\frac{\bar y - y_4}{q_4} & \frac{\bar x - x_4}{q_4} & 0 \ \end{bmatrix} $$ So, the correction part of EKF location is: $$ \begin{align} K_t &= \bar\Sigma_tH^T(H\bar\Sigma_tH^T + R)^{-1} \ \mu_t &= \bar\mu_t + K_t(z - h(\bar\mu_t)) \ \Sigma_t &= (I - K_tH)\bar\Sigma_t \end{align} $$ where $$ R = \begin{bmatrix} \sigma_{d1} & 0 & 0 & 0 \ 0 & \sigma_{d2} & 0 & 0 \ 0 & 0 & \sigma_{d3} & 0 \ 0 & 0 & 0 & \sigma_{d4} \ \end{bmatrix} $$
State vector is
$$
\mu = \begin{bmatrix}x & y & \theta & x_1 & y_1 & x_2 & y_2 & x_3 & y_3 & x_4 & y_4 \end{bmatrix}^T
$$
The Jacobian matrix is
$$
G_t = I + F_x^T
\begin{bmatrix}
0 & 0 & - \delta_{tran}\sin(\theta + \delta_{rot1}) \
0 & 0 & \delta_{tran}\cos(\theta + \delta_{rot1}) \
0 & 0 & 0 \
\end{bmatrix}
F_x
$$
where
$$
F_x =
\begin{bmatrix}
1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \
0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \
0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \
\end{bmatrix}
$$
The prediction part of EKF is
$$
\begin{align}
\bar\mu_t &= \mu_{t-1} + F_x^T
\begin{bmatrix}
0 & 0 & \delta_{tran}\cos(\theta + \delta_{rot1}) \
0 & 0 & \delta_{tran}\sin(\theta + \delta_{rot1}) \
0 & 0 & 0 \
\end{bmatrix} \
\bar\Sigma_t &= G_t\Sigma_{t-1}G_t^T + F_x^TQF_x
\end{align}
$$
where
$$
Q =
\begin{bmatrix}
\sigma_x & 0 & 0 \
0 & \sigma_y & 0 \
0 & 0 & \sigma_{\theta} \
\end{bmatrix}
$$
For the observation, the observation matrix is
$$
z = \begin{bmatrix} r_1 & \theta_1 & r_2 & \theta_2 & r_3 & \theta_3 & r_4 & \theta_4 \end{bmatrix}^T
$$
the observation state transfer function is
$$
h(\mu) =
\begin{bmatrix}
\sqrt {q_1} \
atan2((\bar y - y_1), (\bar x - x_1) \
\sqrt {q_2} \
atan2((\bar y - y_2), (\bar x - x_2) \
\sqrt {q_3} \
atan2((\bar y - y_3), (\bar x - x_3) \
\sqrt {q_4} \
atan2((\bar y - y_4), (\bar x - x_4) \
\end{bmatrix}
$$
where
$$
q_1 = (\bar x - x_1)^2 + (\bar y - y_1)^2 \
q_2 = (\bar x - x_2)^2 + (\bar y - y_2)^2 \
q_3 = (\bar x - x_3)^2 + (\bar y - y_3)^2 \
q_4 = (\bar x - x_4)^2 + (\bar y - y_4)^2 \
$$
where
for each observation $$ F_{x, j}=\begin{bmatrix} \begin{array}{ccccccccc}{1} & {0} & {0} & {0 \cdots 0} & {0} & {0} & {0} & {0 \cdots 0} \ {0} & {1} & {0} & {0 \cdots 0} & {0} & {0} & {0} & {0 \cdots 0} \ {0} & {0} & {1} & {0 \cdots 0} & {0} & {0} & {0} & {0 \cdots 0} \ {0} & {0} & {0} & {0 \cdots 0} & {1} & {0} & {0} & {0 \cdots 0} \ {0} & {0} & {0} & {0 \cdots 0} & {0} & {1} & {0} & {0 \cdots 0} \ {0} & {0} & {0} & {\underbrace{0 \cdots 0}{3 j-3}} & {0} & {0} & {1} & {\underbrace{0 \cdots 0}{N-3 j}}\end{array} \end{bmatrix} $$
So, the correction part of EKF location is: $$ \begin{align} K_t &= \bar\Sigma_tH^T(H\bar\Sigma_tH^T + R)^{-1} \ \mu_t &= \bar\mu_t + K_t(z - h(\bar\mu_t)) \ \Sigma_t &= (I - K_tH)\bar\Sigma_t \end{align} $$ where $$ R = \begin{bmatrix} \sigma_{d1} & 0 & 0 & 0 \ 0 & \sigma_{d2} & 0 & 0 \ 0 & 0 & \sigma_{d3} & 0 \ 0 & 0 & 0 & \sigma_{d4} \ \end{bmatrix} $$