Skip to content

Commit

Permalink
Minor Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
balzer82 committed Jul 2, 2014
1 parent ffc95d6 commit b581875
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 163 deletions.
136 changes: 63 additions & 73 deletions .ipynb_checkpoints/Kalman-Filter-CA-Ball-checkpoint.ipynb

Large diffs are not rendered by default.

Binary file modified Kalman-Filter-CA-Ball-StateEstimated.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Kalman-Filter-CA-Ball-Trajectory.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
136 changes: 63 additions & 73 deletions Kalman-Filter-CA-Ball.ipynb

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Kalman-Filter-CA-Ball.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@

fig = plt.figure(figsize=(16,9))
ax = fig.add_subplot(111, projection='3d')
ax.scatter(Xm, Ym, Zm)
ax.scatter(Xm, Ym, Zm, c='gray')
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
Expand Down Expand Up @@ -621,8 +621,8 @@

fig = plt.figure(figsize=(16,9))
ax = fig.add_subplot(111, projection='3d')
ax.scatter(xt, yt, zt, label='Estimate', c='k')
ax.plot(Xr, Yr, Zr, c='g', label='Real')
ax.plot(xt,yt,zt, label='Kalman Filter Estimate')
ax.plot(Xr, Yr, Zr, label='Real')
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
Expand All @@ -637,7 +637,7 @@
ax.set_xlim(mean_x - max_range, mean_x + max_range)
ax.set_ylim(mean_y - max_range, mean_y + max_range)
ax.set_zlim(mean_z - max_range, mean_z + max_range)
#plt.savefig('BallTrajectory-Computervision-Kalman.png', dpi=150, bbox_inches='tight')
plt.savefig('Kalman-Filter-CA-Ball-Trajectory.png', dpi=150, bbox_inches='tight')

# <headingcell level=1>

Expand Down
15 changes: 2 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ Some Python Implementations of the Kalman Filter

####See [Vimeo](https://vimeo.com/album/2754700/sort:preset/format:detail) for some Explanations.

![Kalman Filter Step](https://raw.github.com/balzer82/Kalman/master/Kalman-Filter-Step.png)
![Kalman Filter Step](Kalman-Filter-Step.png)

## Kalman Filter with Constant Velocity Model

![State Vector](http://www.texify.com/img/%5CLARGE%5C%21x%3D%20%5Cleft%5B%20%5Cmatrix%7B%20x%20%26%20y%20%26%20%5Cdot%20x%20%26%20%5Cdot%20y%7D%20%5Cright%5D%5ET.gif)

Situation covered: You drive with your car in a tunnel and the GPS signal is lost. Now the car has to determine, where it is in the tunnel. The only information it has, is the velocity in driving direction. The x and y component of the velocity (x˙ and y˙) can be calculated from the absolute velocity (revolutions of the wheels) and the heading of the vehicle (yaw rate sensor).

####[View IPython Notebook](http://nbviewer.ipython.org/github/balzer82/Kalman/blob/master/Kalman-Filter-CV.ipynb?create=1)
Expand All @@ -19,9 +17,7 @@ Situation covered: You drive with your car in a tunnel and the GPS signal is los

### 2D

![State Vector](http://www.texify.com/img/%5CLARGE%5C%21x%3D%20%5Cleft%5B%20%5Cmatrix%7B%20x%20%26%20y%20%26%20%5Cdot%20x%20%26%20%5Cdot%20y%20%26%20%5Cddot%20x%20%26%20%5Cddot%20y%7D%20%5Cright%5D%5ET.gif)

Situation covered: You have an acceleration sensor (in 2D: x¨ and y¨) and try to calculate velocity (x˙ and y˙) as well as position (x and y) of a person holding a smartphone in his/her hand.
Situation covered: You have an acceleration sensor (in 2D: $\ddot x¨ and y¨) and try to calculate velocity (x˙ and y˙) as well as position (x and y) of a person holding a smartphone in his/her hand.

####[View IPython Notebook](http://nbviewer.ipython.org/github/balzer82/Kalman/blob/master/Kalman-Filter-CA.ipynb?create=1)

Expand All @@ -34,8 +30,6 @@ Situation covered: You have an acceleration sensor (in 2D: x¨ and y¨) and a Po

Third example is in 3D space, so the state vector is 9D. This model is for ball tracking or something else in 3D space.

![State Vector](http://www.texify.com/img/%5CLARGE%5C%21x%3D%20%5Cleft%5B%20%5Cmatrix%7B%20x%20%26%20y%20%26%20z%20%26%20%5Cdot%20x%20%26%20%5Cdot%20y%20%26%20%5Cdot%20z%20%26%20%5Cddot%20x%20%26%20%5Cddot%20y%20%26%20%5Cddot%20z%7D%20%5Cright%5D%5ET.gif)

####[View IPython Notebook](http://nbviewer.ipython.org/github/balzer82/Kalman/blob/master/Kalman-Filter-CA-Ball.ipynb?create=1)

## Adaptive Kalman Filter with Constant Velocity Model
Expand All @@ -52,9 +46,6 @@ Here the Measurement Covariance Matrix R is calculated dynamically via the maxim

Situation covered: You have an velocity sensor which measures the vehicle speed (v) in heading direction (ψ) and a yaw rate sensor (ψ˙) which both have to fused with the position (x & y) from a GPS sensor.

![CTRV Model](https://raw.github.com/balzer82/Kalman/master/CTRV-Model.png)
![State Vector](http://www.texify.com/img/%5CLARGE%5C%21x_k%3D%20%5Cleft%5B%20%5Cmatrix%7B%20x%20%26%20y%20%26%20%5Cpsi%20%26%20v%20%26%20%5Cdot%5Cpsi%7D%20%5Cright%5D%20%5ET.gif)

####[View IPython Notebook](http://nbviewer.ipython.org/github/balzer82/Kalman/blob/master/Extended-Kalman-Filter-CTRV.ipynb?create=1)

## Adaptive Extended Kalman Filter with Constant Turn Rate and Velocity (CTRV) Model
Expand All @@ -63,8 +54,6 @@ Situation covered: You have an velocity sensor which measures the vehicle speed

Because of poor GPS signal quality, the position measurement is pretty inaccurate. Especially, when the car is standing still, the position error is high. Therefore, an Adaptive Extended Kalman Filter is used here. It calculates the measurement noise covariance `R` in every filterstep depending on the `speed` and `EPE` (Estimated Position Error from GPS).

![Adaptively calculated R](https://raw.github.com/balzer82/Kalman/master/Extended-Kalman-Filter-CTRV-Adaptive-R.png)

The trajectory is exportet to a [.kmz](https://github.com/balzer82/Kalman/blob/master/Extended-Kalman-Filter-CTRV-Adaptive.kmz?raw=true), which can best viewed with Google Earth.

####[View IPython Notebook](http://nbviewer.ipython.org/github/balzer82/Kalman/blob/master/Extended-Kalman-Filter-CTRV-Adaptive.ipynb?create=1)
Expand Down

0 comments on commit b581875

Please sign in to comment.