Skip to content

Commit ee729d6

Browse files
vltanhAtsushiSakai
andauthored
Modify notations (AtsushiSakai#548)
* Modify notations I modified some of the notations so that it will be less confusing: - It is better to specify of which the Jacobian matrix is, here it is the transition and measurement function `f` and `g` (writing it as `J_F` and `J_H` is misleading) - It is better to use `Delta` so as not to confuse people with the `d` commonly used in derivative - It is more correct to use `\partial` instead of `d` since it is more multivariate than it is not * Update docs/modules/extended_kalman_filter_localization.rst * Update docs/modules/extended_kalman_filter_localization.rst Co-authored-by: Atsushi Sakai <[email protected]>
1 parent acc3604 commit ee729d6

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

docs/modules/extended_kalman_filter_localization.rst

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,32 +77,36 @@ Motion Model
7777

7878
The robot model is
7979

80-
.. math:: \dot{x} = vcos(\phi)
80+
.. math:: \dot{x} = v \cos(\phi)
8181

82-
.. math:: \dot{y} = vsin((\phi)
82+
.. math:: \dot{y} = v \sin(\phi)
8383

8484
.. math:: \dot{\phi} = \omega
8585

8686
So, the motion model is
8787

88-
.. math:: \textbf{x}_{t+1} = F\textbf{x}_t+B\textbf{u}_t
88+
.. math:: \textbf{x}_{t+1} = f(\textbf{x}_t, \textbf{u}_t) = F\textbf{x}_t+B\textbf{u}_t
8989

9090
where
9191

9292
:math:`\begin{equation*} F= \begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 \\ \end{bmatrix} \end{equation*}`
9393

94-
:math:`\begin{equation*} B= \begin{bmatrix} cos(\phi)dt & 0\\ sin(\phi)dt & 0\\ 0 & dt\\ 1 & 0\\ \end{bmatrix} \end{equation*}`
94+
:math:`\begin{equation*} B= \begin{bmatrix} cos(\phi) \Delta t & 0\\ sin(\phi) \Delta t & 0\\ 0 & \Delta t\\ 1 & 0\\ \end{bmatrix} \end{equation*}`
9595

96-
:math:`dt` is a time interval.
96+
:math:`\Delta t` is a time interval.
9797

9898
This is implemented at
9999
`code <https://github.com/AtsushiSakai/PythonRobotics/blob/916b4382de090de29f54538b356cef1c811aacce/Localization/extended_kalman_filter/extended_kalman_filter.py#L53-L67>`__
100100

101+
The motion function is that
102+
103+
:math:`\begin{equation*} \begin{bmatrix} x' \\ y' \\ w' \\ v' \end{bmatrix} = f(\textbf{x}, \textbf{u}) = \begin{bmatrix} x + v\cos(\phi)\Delta t \\ y + v\sin(\phi) \\ \phi + \omega \Delta t \\ v \end{bmatrix} \end{equation*}`
104+
101105
Its Jacobian matrix is
102106

103-
:math:`\begin{equation*} J_F= \begin{bmatrix} \frac{dx}{dx}& \frac{dx}{dy} & \frac{dx}{d\phi} & \frac{dx}{dv}\\ \frac{dy}{dx}& \frac{dy}{dy} & \frac{dy}{d\phi} & \frac{dy}{dv}\\ \frac{d\phi}{dx}& \frac{d\phi}{dy} & \frac{d\phi}{d\phi} & \frac{d\phi}{dv}\\ \frac{dv}{dx}& \frac{dv}{dy} & \frac{dv}{d\phi} & \frac{dv}{dv}\\ \end{bmatrix} \end{equation*}`
107+
:math:`\begin{equation*} J_f = \begin{bmatrix} \frac{\partial x'}{\partial x}& \frac{\partial x'}{\partial y} & \frac{\partial x'}{\partial \phi} & \frac{\partial x'}{\partial v}\\ \frac{\partial y'}{\partial x}& \frac{\partial y'}{\partial y} & \frac{\partial y'}{\partial \phi} & \frac{\partial y'}{\partial v}\\ \frac{\partial \phi'}{\partial x}& \frac{\partial \phi'}{\partial y} & \frac{\partial \phi'}{\partial \phi} & \frac{\partial \phi'}{\partial v}\\ \frac{\partial v'}{\partial x}& \frac{\partial v'}{\partial y} & \frac{\partial v'}{\partial \phi} & \frac{\partial v'}{\partial v} \end{bmatrix} \end{equation*}`
104108

105-
:math:`\begin{equation*}  = \begin{bmatrix} 1& 0 & -v sin(\phi)dt & cos(\phi)dt\\ 0 & 1 & v cos(\phi)dt & sin(\phi) dt\\ 0 & 0 & 1 & 0\\ 0 & 0 & 0 & 1\\ \end{bmatrix} \end{equation*}`
109+
:math:`\begin{equation*}  = \begin{bmatrix} 1& 0 & -v \sin(\phi) \Delta t & \cos(\phi) \Delta t\\ 0 & 1 & v \cos(\phi) \Delta t & \sin(\phi) \Delta t\\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \end{equation*}`
106110

107111
Observation Model
108112
~~~~~~~~~~~~~~~~~
@@ -111,15 +115,19 @@ The robot can get x-y position infomation from GPS.
111115

112116
So GPS Observation model is
113117

114-
.. math:: \textbf{z}_{t} = H\textbf{x}_t
118+
.. math:: \textbf{z}_{t} = g(\textbf{x}_t) = H \textbf{x}_t
115119

116120
where
117121

118-
:math:`\begin{equation*} B= \begin{bmatrix} 1 & 0 & 0& 0\\ 0 & 1 & 0& 0\\ \end{bmatrix} \end{equation*}`
122+
:math:`\begin{equation*} H = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ \end{bmatrix} \end{equation*}`
123+
124+
The observation function states that
125+
126+
:math:`\begin{equation*} \begin{bmatrix} x' \\ y' \end{bmatrix} = g(\textbf{x}) = \begin{bmatrix} x \\ y \end{bmatrix} \end{equation*}`
119127

120128
Its Jacobian matrix is
121129

122-
:math:`\begin{equation*} J_H= \begin{bmatrix} \frac{dx}{dx}& \frac{dx}{dy} & \frac{dx}{d\phi} & \frac{dx}{dv}\\ \frac{dy}{dx}& \frac{dy}{dy} & \frac{dy}{d\phi} & \frac{dy}{dv}\\ \end{bmatrix} \end{equation*}`
130+
:math:`\begin{equation*} J_g = \begin{bmatrix} \frac{\partial x'}{\partial x} & \frac{\partial x'}{\partial y} & \frac{\partial x'}{\partial \phi} & \frac{\partial x'}{\partial v}\\ \frac{\partial y'}{\partial x}& \frac{\partial y'}{\partial y} & \frac{\partial y'}{\partial \phi} & \frac{\partial y'}{ \partialv}\\ \end{bmatrix} \end{equation*}`
123131

124132
:math:`\begin{equation*}  = \begin{bmatrix} 1& 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ \end{bmatrix} \end{equation*}`
125133

@@ -132,21 +140,21 @@ Localization process using Extendted Kalman Filter:EKF is
132140

133141
:math:`x_{Pred} = Fx_t+Bu_t`
134142

135-
:math:`P_{Pred} = J_FP_t J_F^T + Q`
143+
:math:`P_{Pred} = J_f P_t J_f^T + Q`
136144

137145
=== Update ===
138146

139147
:math:`z_{Pred} = Hx_{Pred}`
140148

141149
:math:`y = z - z_{Pred}`
142150

143-
:math:`S = J_H P_{Pred}.J_H^T + R`
151+
:math:`S = J_g P_{Pred}.J_g^T + R`
144152

145-
:math:`K = P_{Pred}.J_H^T S^{-1}`
153+
:math:`K = P_{Pred}.J_g^T S^{-1}`
146154

147155
:math:`x_{t+1} = x_{Pred} + Ky`
148156

149-
:math:`P_{t+1} = ( I - K J_H) P_{Pred}`
157+
:math:`P_{t+1} = ( I - K J_g) P_{Pred}`
150158

151159
Ref:
152160
~~~~

0 commit comments

Comments
 (0)