# Exercise - Sensorfusion and Localization (1D-Kalman Filter)

[TODO]

## Requirements

### Knowledge

To complete this exercise notebook, you should possess knowledge about the following topics:

Kalman Filter 1D

• Notes by Christian Herta [HER18]

### Python Modules

import scipy.stats
import numpy as np
from matplotlib import pyplot as plt

%matplotlib inline

## Exercises

### Exercise - Sensorfusion

We have three sensor which measure a distance.

We get the following values from the measurements:

• Sensor 1: $50.1$ cm
• Sensor 2: $49.3$ cm
• Sensor 3: $49.7$ cm

From the calibration of the sensors we have the following estimate of the standard deviations for the sensors (in the range 30-90 cm):

• Standard deviation of sensor 1: $0.8$ cm
• Standard deviation of sensor 2: $1.2$ cm
• Standard deviation of sensor 3: $0.9$ cm

Assume that the sensors are prefectly calibrated such we have no systematic error (bias).

Remark: If you are interesed how to estimate the error of an sensor, then read for an easy explaination https://amloceanographic.com/blog/sensor-accuracy/

• What is the distance if we combine of all three measurements?

• Also give an error estimate of the result (the true value should be in at least 0.95 of the Gaussian area), e.g. as $88\pm 4$m (How is this related to the standard deviation?)

Solve the exercise

1. with pen & paper
2. implement it with numpy
3. plot the differnet Gaussians.

Note: Take care for the significant digits you use.

sigma123 * 2

### Exercise - 1D Kalman Filter

A robot moves with a velocity of about $3$ m/s. We assume that if the robot moves in a time $\Delta t=2$s we have an standard deviation of the moved distance of $0.8$m.

Each 2 seconds we measure the position with an standard deviation $\sigma$ of $1.2$ m.

We get the following measurements:

• $z(t=0$s$) = -2$m (inital $\sigma=0$)
• $z(t=2$s$) = 3.4$ m
• $z(t=4$s$)$ = no measurement
• $z(t=6$s$)= 16.3$ m

What is the predicted position before the measurement at $t=8$s.

In the state space we use just the position of the robot (1D). Solve the exercise

1. with pen & paper
2. implement it with numpy

## Literature

The following license applies to the complete notebook, including code cells. It does however not apply to any referenced external media (e.g., images).

Exercises - Sensorfusion and Localization (1D-Kalman Filter)
by Christian Herta
Based on a work at https://gitlab.com/deep.TEACHING.

The following license only applies to code cells of the notebook.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.