| Algorithm 1 Monte Carlo localization. | |
| 1: | Initialize particles |
| 2: | for to M do |
| 3: | Update particles with the motion model: |
| 4: | Calculate the belief of each particle with the measurement model: |
| 5: | |
| 6: | end for |
| 7: | for to M do |
| 8: | draw from with probability ∝ |
| 9: | add to |
| 10: | end for |
| 11: | for to M do |
| 12: | if (a constant), re-initialize |
| 13: | end for |
| 14: | return |