In this article, we shall see how the Particle Filter can be used to predict positions of some moving objects using a few sampled particles in 2D. This article is inspired by a programming assignment from the coursera course Robotics Learning by University of Pennsylvania. The same algorithm is often used for self-localization of a robot from the noisy sensor measurements.

The basic idea for the Particle Filter is described in the figure below, taken from this video by Bert Huang.

The next few figures, taken from the lectures of the Coursera Course Robotics Learning again describe the basics of particle filter.





The particle filter algorithm is described in the next figure, taken from a lecture video by udacity.

The next set of figures / animations show how the position of a moving bug is tracked using Particle Filter. First the noisy measurements of the positions of the bug are obtained at different time instants. Then M=100 particles are sampled and later they are propagated based upon some prior assumptions on position uncertainty.. Next the noisy measurement for the particle is computed (simulated by adding random noise to the true position). Measurement update step : For each particle, the probability of the particle is calculated to update the particle weights, assuming some measurement noise. Next the best particle is chosen to update the pose . Re-sampling step : if the effective number of particles is smaller than a threshold (e.g., 0.8), the particles are re-sampled. Next the particles along with the probability-weights are used to compute the estimated location (e.g., computing the weighted average of the particle positions). The next animation shows the steps, the probability cloud represents the density over the particles chosen at each step. The position of the bug as shown in the animation above is moving in the x and y direction randomly in a grid defined by the rectangle

[-100,100]x[-100,100]. The above figure also shows how at different iterations the Particle Filter predicts the position of the bug. The next animation shows the density of the particles for a different measurement uncertainty.

Filter.