I was wondering if it would be possible to solve the kidnapped robot problem (localization after a random replacement) using our particle filter implementation. Well, it's much easier than I initially expected. Actually, it took only 4 lines of additional code to solve the problem :)
Here's what I did: Each turn there's a 10% chance that the robot is replaced. Using the 'normal' solution for homework assignment 3.6 the algorithm is then (in most cases) unable to localize the robot again:
So, in order to solve the problem all I had to do was to randomly seed some particles in the world for each iteration, which will result in something like this:
And that's it! After a replacement the algorithm will converge to the correct position after 1-3 iterations.
Of course, this is not a new idea by any means, but I was still surprised how easy it was to implement this. Maybe some of you will find it interesting as well :)
I'll upload my code tomorrow, in the meantime you can see the algorithm working here:
I made some changes to the visualization, so that for each iteration the robot movement and the motion prediction is visualized as well.
Have fun :)
edit: Here's the code: Github
Add random particles:
I always had the intuition that it would be a good idea to add those random particles in each iteration, and this proves it useful.
answered 13 Mar '12, 21:06