# Bayes Filter

A Bayes filter is a recursive algorithm that uses Bayes Rule to perform State Estimation.

This was encountered when learning about F1TENTH. Then learned more about this through CS287. Really useful for example to do Localization.

Given:

- Stream of observations $z$ and action data $u$
- Sensor model $P(zโฃx)$
- Action model $P(x_{โฒ}โฃu,x)$
- Prior probability of the system state $P(x)$

We want an estimate of the state $X$ of a dynamical system, essentially $P(xโฃz)$, so we use Bayes Rule

We do doing using by updating the posterior of the state, which we call **belief**:

$Bel(x_{t})=P(xโฃu_{1},z_{1},โฆ,u_{t},z_{t})$

Bayes Filter allow us to recursively update our belief state using the equation $Bel(x_{t})=nP(z_{t}โฃx_{t})โซP(x_{t}โฃu_{t},x_{tโ1})Bel(x_{tโ1})dx_{tโ1}$ where

- $n$ is the normalization constant, to make sure everything adds up to 1
- $p(z_{t}โฃx_{t})$ is the observation Likelihood sensor model
- Transition model, motion model (simulate noisy dynamics of particles based on control input)

Important

Bayes rule make use of the Markov Assumption.

Derivation from CS287

We can then come up with an algorithm to do this: