<s>
Monte	B-Algorithm
Carlo	I-Algorithm
localization	I-Algorithm
(	O
MCL	O
)	O
,	O
also	O
known	O
as	O
particle	B-Algorithm
filter	I-Algorithm
localization	O
,	O
is	O
an	O
algorithm	O
for	O
robots	O
to	O
localize	B-General_Concept
using	O
a	O
particle	B-Algorithm
filter	I-Algorithm
.	O
</s>
<s>
Given	O
a	O
map	O
of	O
the	O
environment	O
,	O
the	O
algorithm	O
estimates	O
the	O
position	B-Architecture
and	I-Architecture
orientation	I-Architecture
of	O
a	O
robot	O
as	O
it	O
moves	O
and	O
senses	O
the	O
environment	O
.	O
</s>
<s>
The	O
algorithm	O
uses	O
a	O
particle	B-Algorithm
filter	I-Algorithm
to	O
represent	O
the	O
distribution	O
of	O
likely	O
states	O
,	O
with	O
each	O
particle	O
representing	O
a	O
possible	O
state	O
,	O
i.e.	O
,	O
a	O
hypothesis	O
of	O
where	O
the	O
robot	O
is	O
.	O
</s>
<s>
The	O
algorithm	O
typically	O
starts	O
with	O
a	O
uniform	O
random	O
distribution	O
of	O
particles	B-Algorithm
over	O
the	O
configuration	O
space	O
,	O
meaning	O
the	O
robot	O
has	O
no	O
information	O
about	O
where	O
it	O
is	O
and	O
assumes	O
it	O
is	O
equally	O
likely	O
to	O
be	O
at	O
any	O
point	O
in	O
space	O
.	O
</s>
<s>
Whenever	O
the	O
robot	O
moves	O
,	O
it	O
shifts	O
the	O
particles	B-Algorithm
to	O
predict	O
its	O
new	O
state	O
after	O
the	O
movement	O
.	O
</s>
<s>
Whenever	O
the	O
robot	O
senses	O
something	O
,	O
the	O
particles	B-Algorithm
are	O
resampled	O
based	O
on	O
recursive	O
Bayesian	O
estimation	O
,	O
i.e.	O
,	O
how	O
well	O
the	O
actual	O
sensed	O
data	O
correlate	O
with	O
the	O
predicted	O
state	O
.	O
</s>
<s>
Ultimately	O
,	O
the	O
particles	B-Algorithm
should	O
converge	O
towards	O
the	O
actual	O
position	O
of	O
the	O
robot	O
.	O
</s>
<s>
Determining	O
its	O
location	O
and	O
rotation	O
(	O
more	O
generally	O
,	O
the	O
pose	B-Architecture
)	O
by	O
using	O
its	O
sensor	O
observations	O
is	O
known	O
as	O
robot	B-General_Concept
localization	I-General_Concept
.	O
</s>
<s>
These	O
guesses	O
are	O
known	O
as	O
particles	B-Algorithm
.	O
</s>
<s>
When	O
the	O
robot	O
observes	O
the	O
environment	O
,	O
it	O
discards	O
particles	B-Algorithm
inconsistent	O
with	O
this	O
observation	O
,	O
and	O
generates	O
more	O
particles	B-Algorithm
close	O
to	O
those	O
that	O
appear	O
consistent	O
.	O
</s>
<s>
In	O
the	O
end	O
,	O
hopefully	O
most	O
particles	B-Algorithm
converge	O
to	O
where	O
the	O
robot	O
actually	O
is	O
.	O
</s>
<s>
In	O
the	O
MCL	O
algorithm	O
,	O
the	O
belief	O
at	O
a	O
time	O
is	O
represented	O
by	O
a	O
set	O
of	O
particles	B-Algorithm
.	O
</s>
<s>
Regions	O
in	O
the	O
state	O
space	O
with	O
many	O
particles	B-Algorithm
correspond	O
to	O
a	O
greater	O
probability	O
that	O
the	O
robot	O
will	O
be	O
there	O
—	O
and	O
regions	O
with	O
few	O
particles	B-Algorithm
are	O
unlikely	O
to	O
be	O
where	O
the	O
robot	O
is	O
.	O
</s>
<s>
This	O
only	O
works	O
if	O
the	O
environment	O
is	O
static	O
and	O
does	B-Algorithm
not	I-Algorithm
change	I-Algorithm
with	I-Algorithm
time	I-Algorithm
.	O
</s>
<s>
Typically	O
,	O
on	O
start	O
up	O
,	O
the	O
robot	O
has	O
no	O
information	O
on	O
its	O
current	O
pose	B-Architecture
so	O
the	O
particles	B-Algorithm
are	O
uniformly	O
distributed	O
over	O
the	O
configuration	O
space	O
.	O
</s>
<s>
Given	O
a	O
map	O
of	O
the	O
environment	O
,	O
the	O
goal	O
of	O
the	O
algorithm	O
is	O
for	O
the	O
robot	O
to	O
determine	O
its	O
pose	B-Architecture
within	O
the	O
environment	O
.	O
</s>
<s>
Consider	O
a	O
robot	O
in	O
a	O
one-dimensional	O
circular	B-Algorithm
corridor	O
with	O
three	O
identical	O
doors	O
,	O
using	O
a	O
sensor	O
that	O
returns	O
either	O
true	O
or	O
false	O
depending	O
on	O
whether	O
there	O
is	O
a	O
door	O
.	O
</s>
<s>
thumb|320px|center|The	O
algorithm	O
initializes	O
with	O
a	O
uniform	O
distribution	O
of	O
particles	B-Algorithm
.	O
</s>
<s>
It	O
assigns	O
a	O
weight	O
to	O
each	O
of	O
the	O
particles	B-Algorithm
.	O
</s>
<s>
The	O
particles	B-Algorithm
which	O
are	O
likely	O
to	O
give	O
this	O
sensor	O
reading	O
receive	O
a	O
higher	O
weight.thumb	O
|320px|center|Resampling	O
:	O
the	O
robot	O
generates	O
a	O
set	O
of	O
new	O
particles	B-Algorithm
,	O
with	O
most	O
of	O
them	O
generated	O
around	O
the	O
previous	O
particles	B-Algorithm
with	O
more	O
weight	O
.	O
</s>
<s>
All	O
particles	B-Algorithm
also	O
move	O
right	O
,	O
and	O
some	O
noise	O
is	O
applied	O
.	O
</s>
<s>
It	O
assigns	O
a	O
weight	O
to	O
each	O
of	O
the	O
particles	B-Algorithm
.	O
</s>
<s>
The	O
particles	B-Algorithm
likely	O
to	O
give	O
this	O
sensor	O
reading	O
receive	O
a	O
higher	O
weight.thumb	O
|320px|center|Resampling	O
:	O
the	O
robot	O
generates	O
a	O
set	O
of	O
new	O
particles	B-Algorithm
,	O
with	O
most	O
of	O
them	O
generated	O
around	O
the	O
previous	O
particles	B-Algorithm
with	O
more	O
weight	O
.	O
</s>
<s>
All	O
particles	B-Algorithm
also	O
move	O
left	O
,	O
and	O
some	O
noise	O
is	O
applied	O
.	O
</s>
<s>
It	O
assigns	O
a	O
weight	O
to	O
each	O
of	O
the	O
particles	B-Algorithm
.	O
</s>
<s>
The	O
particles	B-Algorithm
likely	O
to	O
give	O
this	O
sensor	O
reading	O
receive	O
a	O
higher	O
weight.thumb	O
|320px|center|Resampling	O
:	O
the	O
robot	O
generates	O
a	O
set	O
of	O
new	O
particles	B-Algorithm
,	O
with	O
most	O
of	O
them	O
generated	O
around	O
the	O
previous	O
particles	B-Algorithm
with	O
more	O
weight	O
.	O
</s>
<s>
At	O
the	O
end	O
of	O
the	O
three	O
iterations	O
,	O
most	O
of	O
the	O
particles	B-Algorithm
are	O
converged	O
on	O
the	O
actual	O
position	O
of	O
the	O
robot	O
as	O
desired	O
.	O
</s>
<s>
During	O
the	O
motion	O
update	O
,	O
the	O
robot	O
predicts	O
its	O
new	O
location	O
based	O
on	O
the	O
actuation	O
command	O
given	O
,	O
by	O
applying	O
the	O
simulated	O
motion	O
to	O
each	O
of	O
the	O
particles	B-Algorithm
.	O
</s>
<s>
For	O
example	O
,	O
if	O
a	O
robot	O
moves	O
forward	O
,	O
all	O
particles	B-Algorithm
move	O
forward	O
in	O
their	O
own	O
directions	O
no	O
matter	O
which	O
way	O
they	O
point	O
.	O
</s>
<s>
If	O
a	O
robot	O
rotates	O
90	O
degrees	O
clockwise	O
,	O
all	O
particles	B-Algorithm
rotate	O
90	O
degrees	O
clockwise	O
,	O
regardless	O
of	O
where	O
they	O
are	O
.	O
</s>
<s>
Inevitably	O
,	O
the	O
particles	B-Algorithm
diverge	O
during	O
the	O
motion	O
update	O
as	O
a	O
consequence	O
.	O
</s>
<s>
When	O
the	O
robot	O
senses	O
its	O
environment	O
,	O
it	O
updates	O
its	O
particles	B-Algorithm
to	O
more	O
accurately	O
reflect	O
where	O
it	O
is	O
.	O
</s>
<s>
Then	O
,	O
it	O
randomly	O
draws	O
new	O
particles	B-Algorithm
from	O
the	O
previous	O
belief	O
,	O
with	O
probability	O
proportional	O
to	O
.	O
</s>
<s>
Particles	B-Algorithm
consistent	O
with	O
sensor	O
readings	O
are	O
more	O
likely	O
to	O
be	O
chosen	O
(	O
possibly	O
more	O
than	O
once	O
)	O
and	O
particles	B-Algorithm
inconsistent	O
with	O
sensor	O
readings	O
are	O
rarely	O
picked	O
.	O
</s>
<s>
As	O
such	O
,	O
particles	B-Algorithm
converge	O
towards	O
a	O
better	O
estimate	O
of	O
the	O
robot	O
's	O
state	O
.	O
</s>
<s>
The	O
particle	B-Algorithm
filter	I-Algorithm
central	O
to	O
MCL	O
can	O
approximate	O
multiple	O
different	O
kinds	O
of	O
probability	O
distributions	O
,	O
since	O
it	O
is	O
a	O
non-parametric	B-General_Concept
representation	I-General_Concept
.	O
</s>
<s>
In	O
such	O
situations	O
,	O
the	O
particle	B-Algorithm
filter	I-Algorithm
can	O
give	O
better	O
performance	O
than	O
parametric	O
filters	O
.	O
</s>
<s>
Another	O
non-parametric	B-General_Concept
approach	O
to	O
Markov	O
localization	O
is	O
the	O
grid-based	O
localization	O
,	O
which	O
uses	O
a	O
histogram	B-Algorithm
to	O
represent	O
the	O
belief	O
distribution	O
.	O
</s>
<s>
Compared	O
with	O
the	O
grid-based	O
approach	O
,	O
the	O
Monte	B-Algorithm
Carlo	I-Algorithm
localization	I-Algorithm
is	O
more	O
accurate	O
because	O
the	O
state	O
represented	O
in	O
samples	O
is	O
not	O
discretized	O
.	O
</s>
<s>
The	O
particle	B-Algorithm
filter	I-Algorithm
's	O
time	O
complexity	O
is	O
linear	O
with	O
respect	O
to	O
the	O
number	O
of	O
particles	B-Algorithm
.	O
</s>
<s>
Naturally	O
,	O
the	O
more	O
particles	B-Algorithm
,	O
the	O
better	O
the	O
accuracy	O
,	O
so	O
there	O
is	O
a	O
compromise	O
between	O
speed	O
and	O
accuracy	O
and	O
it	O
is	O
desired	O
to	O
find	O
an	O
optimal	O
value	O
of	O
.	O
</s>
<s>
One	O
strategy	O
to	O
select	O
is	O
to	O
continuously	O
generate	O
additional	O
particles	B-Algorithm
until	O
the	O
next	O
pair	O
of	O
command	O
and	O
sensor	O
reading	O
has	O
arrived	O
.	O
</s>
<s>
This	O
way	O
,	O
the	O
greatest	O
possible	O
number	O
of	O
particles	B-Algorithm
is	O
obtained	O
while	O
not	O
impeding	O
the	O
function	O
of	O
the	O
rest	O
of	O
the	O
robot	O
.	O
</s>
<s>
As	O
such	O
,	O
the	O
implementation	O
is	O
adaptive	O
to	O
available	O
computational	O
resources	O
:	O
the	O
faster	O
the	O
processor	O
,	O
the	O
more	O
particles	B-Algorithm
can	O
be	O
generated	O
and	O
therefore	O
the	O
more	O
accurate	O
the	O
algorithm	O
is	O
.	O
</s>
<s>
Compared	O
to	O
grid-based	O
Markov	O
localization	O
,	O
Monte	B-Algorithm
Carlo	I-Algorithm
localization	I-Algorithm
has	O
reduced	O
memory	O
usage	O
since	O
memory	O
usage	O
only	O
depends	O
on	O
number	O
of	O
particles	B-Algorithm
and	O
does	O
not	O
scale	O
with	O
size	O
of	O
the	O
map	O
,	O
and	O
can	O
integrate	O
measurements	O
at	O
a	O
much	O
higher	O
frequency	O
.	O
</s>
<s>
The	O
algorithm	O
can	O
be	O
improved	O
using	O
KLD	O
sampling	O
,	O
as	O
described	O
below	O
,	O
which	O
adapts	O
the	O
number	O
of	O
particles	B-Algorithm
to	O
use	O
based	O
on	O
how	O
sure	O
the	O
robot	O
is	O
of	O
its	O
position	O
.	O
</s>
<s>
A	O
drawback	O
of	O
the	O
naive	O
implementation	O
of	O
Monte	B-Algorithm
Carlo	I-Algorithm
localization	I-Algorithm
occurs	O
in	O
a	O
scenario	O
where	O
a	O
robot	O
sits	O
at	O
one	O
spot	O
and	O
repeatedly	O
senses	O
the	O
environment	O
without	O
moving	O
.	O
</s>
<s>
Suppose	O
that	O
the	O
particles	B-Algorithm
all	O
converge	O
towards	O
an	O
erroneous	O
state	O
,	O
or	O
if	O
an	O
occult	O
hand	O
picks	O
up	O
the	O
robot	O
and	O
moves	O
it	O
to	O
a	O
new	O
location	O
after	O
particles	B-Algorithm
have	O
already	O
converged	O
.	O
</s>
<s>
As	O
particles	B-Algorithm
far	O
away	O
from	O
the	O
converged	O
state	O
are	O
rarely	O
selected	O
for	O
the	O
next	O
iteration	O
,	O
they	O
become	O
scarcer	O
on	O
each	O
iteration	O
until	O
they	O
disappear	O
altogether	O
.	O
</s>
<s>
This	O
problem	O
is	O
more	O
likely	O
to	O
occur	O
for	O
small	O
number	O
of	O
particles	B-Algorithm
,	O
e.g.	O
,	O
,	O
and	O
when	O
the	O
particles	B-Algorithm
are	O
spread	O
over	O
a	O
large	O
state	O
space	O
.	O
</s>
<s>
In	O
fact	O
,	O
any	O
particle	B-Algorithm
filter	I-Algorithm
algorithm	O
may	O
accidentally	O
discard	O
all	O
particles	B-Algorithm
near	O
the	O
correct	O
state	O
during	O
the	O
resampling	O
step	O
.	O
</s>
<s>
One	O
way	O
to	O
mitigate	O
this	O
issue	O
is	O
to	O
randomly	O
add	O
extra	O
particles	B-Algorithm
on	O
every	O
iteration	O
.	O
</s>
<s>
By	O
guaranteeing	O
that	O
no	O
area	O
in	O
the	O
map	O
is	O
totally	O
deprived	O
of	O
particles	B-Algorithm
,	O
the	O
algorithm	O
is	O
now	O
robust	O
against	O
particle	O
deprivation	O
.	O
</s>
<s>
The	O
original	O
Monte	B-Algorithm
Carlo	I-Algorithm
localization	I-Algorithm
algorithm	O
is	O
fairly	O
simple	O
.	O
</s>
<s>
Monte	B-Algorithm
Carlo	I-Algorithm
localization	I-Algorithm
may	O
be	O
improved	O
by	O
sampling	O
the	O
particles	B-Algorithm
in	O
an	O
adaptive	O
manner	O
based	O
on	O
an	O
error	O
estimate	O
using	O
the	O
Kullback	O
–	O
Leibler	O
divergence	O
(	O
KLD	O
)	O
.	O
</s>
<s>
Initially	O
,	O
it	O
is	O
necessary	O
to	O
use	O
a	O
large	O
due	O
to	O
the	O
need	O
to	O
cover	O
the	O
entire	O
map	O
with	O
a	O
uniformly	O
random	O
distribution	O
of	O
particles	B-Algorithm
.	O
</s>
<s>
However	O
,	O
when	O
the	O
particles	B-Algorithm
have	O
converged	O
around	O
the	O
same	O
location	O
,	O
maintaining	O
such	O
a	O
large	O
sample	O
size	O
is	O
computationally	O
wasteful	O
.	O
</s>
<s>
KLD	O
–	O
sampling	O
is	O
a	O
variant	O
of	O
Monte	B-Algorithm
Carlo	I-Algorithm
Localization	I-Algorithm
where	O
at	O
each	O
iteration	O
,	O
a	O
sample	O
size	O
is	O
calculated	O
.	O
</s>
<s>
The	O
main	O
idea	O
is	O
to	O
create	O
a	O
grid	O
(	O
a	O
histogram	B-Algorithm
)	O
overlaid	O
on	O
the	O
state	O
space	O
.	O
</s>
<s>
Each	O
bin	O
in	O
the	O
histogram	B-Algorithm
is	O
initially	O
empty	O
.	O
</s>
<s>
Instead	O
of	O
the	O
resampling	O
done	O
in	O
classic	O
MCL	O
,	O
the	O
KLD	O
–	O
sampling	O
algorithm	O
draws	O
particles	B-Algorithm
from	O
the	O
previous	O
,	O
weighted	O
,	O
particle	O
set	O
and	O
applies	O
the	O
motion	O
and	O
sensor	O
updates	O
before	O
placing	O
the	O
particle	O
into	O
its	O
bin	O
.	O
</s>
<s>
It	O
is	O
easy	O
to	O
see	O
KLD	O
–	O
sampling	O
culls	O
redundant	O
particles	B-Algorithm
from	O
the	O
particle	O
set	O
,	O
by	O
only	O
increasing	O
when	O
a	O
new	O
location	O
(	O
bin	O
)	O
has	O
been	O
filled	O
.	O
</s>
