Docsity

Localization and Map Learning using a Graphical Models Approach | CMPS 290, Exams of Computer Graphics

Toggle sidebar
bg1
Localization and Map Learning using a Graphical Models
Approach
Final Report
Shuang Wu
Figure 1: Sample 2D localization experiments (Java Program).
Introduction
Robot localization and Map learning, the process of estimating the robot's location and
simultaneously building the map of the environment, has been an active research topic in
recent years. This is a chicken-and-egg problem: To determine the map of the
environment, the robot need to know where it is; to determine where it is, the robot needs
to know the map of the environment. However, in reality, both of these are to be learned.
Thrun[3] uses a probabilistic approach to build large-scale geometric maps of indoor
environments with mobile robots. In his work, the map-building problem is posed as a
constrained, probabilistic maximum-likelihood estimation problem. It then devises a
practical algorithm for generating the most likely path taken by the robots. This is called
the Particle Filter Method.
However, to get the optimal Bayesian solution for our problem we need to maintain a
belief state over both the location of the robot, and the label of each grid cell. This large
sampling space results in expensive sampling overhead at each step.
A standard technique to increase the efficiency of sampling technique is to reduce the
size of state space by marginalizing out some of the variables using the Graphical Models
approach; this is called Rao-Blackwellised[1]. A combination of these two techniques is
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Partial preview of the text

Download Localization and Map Learning using a Graphical Models Approach | CMPS 290 and more Exams Computer Graphics in PDF only on Docsity!

Localization and Map Learning using a Graphical Models

Approach

Final Report

Shuang Wu

Figure 1: Sample 2D localization experiments (Java Program).

Introduction

Robot localization and Map learning, the process of estimating the robot's location and

simultaneously building the map of the environment, has been an active research topic in

recent years. This is a chicken-and-egg problem: To determine the map of the

environment, the robot need to know where it is; to determine where it is, the robot needs

to know the map of the environment. However, in reality, both of these are to be learned.

Thrun[3] uses a probabilistic approach to build large-scale geometric maps of indoor

environments with mobile robots. In his work, the map-building problem is posed as a

constrained, probabilistic maximum-likelihood estimation problem. It then devises a

practical algorithm for generating the most likely path taken by the robots. This is called

the Particle Filter Method.

However, to get the optimal Bayesian solution for our problem we need to maintain a

belief state over both the location of the robot, and the label of each grid cell. This large

sampling space results in expensive sampling overhead at each step.

A standard technique to increase the efficiency of sampling technique is to reduce the

size of state space by marginalizing out some of the variables using the Graphical Models

approach; this is called Rao-Blackwellised[1]. A combination of these two techniques is

called Rao-Blackwellised particle filtering, which can be applied in the problem of map

learning for a mobile robot[2].

1D Example Model

The map is defined to be a grid, where each cell is with some label on it. So formally, the

map at time t is a vector of discrete random variables, Mt(i) in {1, … , N 0 } , where

0<i<NL+1. The sensor of the robot is not perfect, that is, they may misclassify the color

with probability po. Robots may cast rays using their sensor for detection. The motors

are not perfect either (they may fail to move in the desired direction with probability pa ).

The location of the robot is denoted by L t

in {1,…,N L

}. The observation of the robot is:

Yt in {1,…,NO}. which is observed label of cell at its current location. And the robot also

knows its action chosen before time t , At in {1,…,NA}. We start by considering the very

simple one-dimensional grid shown where there are just two actions, move down and

move up, and only two labels, 0 and 1. We assume that the prior of robot's location is a

Dirac delta function at the uppermost cell, and the transition matrix for its location is:

where pa is the probability of a successful action, i.e., 1-pa is the probability of a

movement failure. There is an analogous equation for At = bottom (down arrow). Note

that it is impossible to pass through the bottom cell, this information will help the robot to

localize itself. We assume that cells of the map are independent variables, so that the

prior of the map is product of each cell's prior. Because of this independency, the

transition matrix for the map is product of each cell's transition. We define the transition

of one cell from one label to another label as pc , and hence the probability that the

Label remains the same is 1-pc. Finally, the observation model is:

where po is the probability of a successful observation.

Hence, we can use RBPF here by sampling from Pr(Lt|y1:t) , keeping a parametric

representation of Pr(Mt|Lt,yt). (The parametric representation may be a mean

vector and a covariance matrix for Gaussian, or a transition matrix for multinomial).

As in standard particle filtering, the Pr(Lt|y1:t) is updated by sampling. Then the

Pr(Mt|Lt,yt) distribution is updated by exact filter, conditional on Lt , when applying RBPF

in map learning, in each step, we sample the location of each particle from transition

priors Pr(Lt|Lt-1). Then for each particle, evaluate the importance weights, which is the

likelihood Pr(yt|y1:t-1;Lt). After that, resample the particles with these important weights

and compute the distribution of map Pr(Mj|Lt,yt) using exact filtering.

Firstly, we consider the simplest example of a one-dimensional grid. Suppose the robot

moves in the map from cell 1 to cell 10, then back to cell 1 again. We assume that there is

no observation failure but one slippage at t = 4. So the actual path and observation

sequence of the robot is:

We can see that at t = 4, the robot slips but it doesn't know. So the estimation of the map

and location is wrong. But when it returns back, its fault judgment on location and map is

changed by the new observation. From the viewpoint of probability, at each step the robot

steps into unknown territory, its uncertainty becomes larger and larger. However, as the

robot steps into where it has been, it can better localize itself by enhancing some

particles, which estimate location accurately, and eliminating particles with wrong

estimations. In this 1D example, 50 particles will get good estimation of the map and

location. However, as mentioned in [2], it's hard to determine how many particles to use

for any map. Too few particles may result in wrong estimation.

When the particle number increase, the error and variance decrease. However, the

computation is also increasing. Both the noise parameters and environment parameters

influence the number of particles to use. In the simple 1D example, when the robot is at

cell 8 or cell 1, it can localize itself very well because most hypotheses are eliminated.

1:

1

1: 1 1 1 1: 1 1: 1

t

t

i i i

t t t t t t t t

X

P Y zP YY P Y z

    

In the update step we have,

1 : 1 : 1 : 1 1 :

i

t t t t

X

t

i

t t t

P X z  P z X P X z 

1: 1: 1: 1 1:

i Y i

t t t t t t t t

P Y z  P z Y P Y z 

The distribution is now,

1: 1: 1 1: 1 1: 1

i i

t t t t t t

qz P   Pz   

and the weights can be computed as follows,

t t t t

Y

Y

t t t t t

X

X

t t t t t t t

w P z z Pz P z X P X z P z Y PY z

t t

Implementation Summary:

1 • Used Rao-Blackwellised particle filtering to solve localization problem.

2 • Able to localize within about 4cm (using a 20 x 20 x 10 resolution grid).

3 • Implementation is written in Java.

4 • Takes 16 seconds on my 2.4 GHz 512MB Windows XP machine for data set 1 (not

counting loading data and ray tracing pre-computations).

5 • Ray tracing takes 8 seconds, plus 14 seconds for pre-computing grid ranges.

Implementation overview:

The implementation starts out with a rough grid (80cm x 80cm x 10°). As the problem

size shrinks, it switches to a finer grid (20cm x 20cm x 10°). This hastens computations,

but still gives the same accuracy in the end. Step size is of utmost importance with grids,

because of grid error. It is important for the robot to travel a distance several times (e.g.

  1. grid size. The implementation picks optimal times to sample the data based on distance

traveled and total angle turned. Another technique I used for increasing accuracy is to let

the robot walk forward and backward along its route twice. In most cases the first pass is

sufficient, but sometimes the extra pass are required (as is the case for data set 3, where

robot makes a lot of turns and does not travel to look around corners). Extra pass helps

because in the beginning the grid size is rather large and it paints over important features

of the map (e.g. narrow passages into rooms turn into wide hallways, and many walls

disappear altogether). Also, once smaller grid size is achieved, smaller steps can be taken

that do not allow the robot to travel through walls and other obstacles. For scan

matching, it is important to account for angular grid error and compare a range of scanner

readings to each ray trace. I pre-compute ray trace ranges over each grid square (after all

the robot could be anywhere in that square). If the range over grid and range over

applicable scanner readings intersect, it is considered a match. Non-matching readings

are given a low probability of 0.01. This way if only a few readings are off, it is still

acceptable. If a large number of readings are off, the grid posture will be rejected during

truncation step. The formulas for computing P(Z|X) are given a P(Z|X) = Πray Pray(Z|X),

where P ray

= 1, if ranges intersect P ray

= 0.01, otherwise

In other words P (^) ray is a very crude and discontinuous representation of a Gaussian

distribution.

Main computation step optimizations:

1 • It proved useful to build up new probability distribution (p(X (^) t)) over time, rather

than focus on computing probability at each location one at a time. Instead I cycle

through possible previous locations (X (^) t-1) and compute where it could have

moved. This allows pre-computing the distance traveled, the angle traveled at and

maximum acceptable error. These values are then used to filter out any X (^) t that are

outside of maximum error from destination. Thus the computation is optimized.

1 • Reduced ray tracing operation to 1 trigonometry computation and 1 comparison

per step.

2 • I used only 8 rays for scan matching purposes. It proved sufficient in the

environment given and sped things up.

3 • Ranges over grid are not pre-computed for fine resolution grids and small problem

sizes. By this time robot is rather well localized and computing over entire grid is

a waste of time and space.

4 • Only laser reading from data file were used. The difference between odometer

readings and interpolated laser coordinates is too great and introduces

unnecessary error.

5 • To narrow the problem down quickly I used truncation to zero out extremely low

probabilities (i.e. < 10

  • ).

6 • The fact that laser is offset forward, makes grid ranges dependent on robot facing

and slows down computation. Trigonometry computations are very expensive. I

pre-compute possible laser offsets and corresponding angle ranges. It turns out

that there are only 20 possible integer offsets for map resolution of 10 and laser

offset of 25. This optimization speeds up grid ranges computations by a factor of

1 • Robot movement error (the “banana”) could be taken into account. I have it

partially implemented, but not enough to factor it in. Grid error provisions seem

to do a good enough job.

1 • R-trees used to help reduce space requirements when used instead of 3-D arrays

for sufficiently small problem sizes.

Instructions for running the code:

1 • Was tested on Windows XP with Java 1.4.2, but should work on other platforms.

2 • Need to allocate sufficient memory space, i.e. run

java –Xmx256m Robot

  • Runs faster with GUI turned off
  • robot.properties file has properties that could be set including paths to data files and

GUI on/off options.

  • On the GUI, green color represents out of bounds areas (e.g. walls), yellow shows

where P(X) is 0, shades of gray show non-zero probabilities. The darker the color

the higher the probability. The map displayed shows grid probability distribution

rather than actual map (so you may not see all map features depending on grid

size). Probability displayed at each point is the highest probability for all poses at

that xy-location.

Measurement and Ray Tracing:

The following observations used in my implementation apply to generic grid based

filters:

1 - The most straightforward implementation of computing ray trace for a given grid

posture is to just compute it from the center of the grid and add grid error.

However, ray traces could vary greatly within the same grid square. For example

if a wall passes through the grid square, readings on one side of the wall will be

drastically different from the other side. Given that the robot could be anywhere

in the grid square, it is useful to compute a range of ray traces over all map

positions in the grid. The min/max of these ray traces for each grid square should

be pre-computed for low resolution grids. For fine resolution grids it is not

necessary to pre-compute min/max ranges, and it is best to trade it off for saving

space. Instead, min/max ranges could be computed on the spot during

measurement step. Another variation on simple min/max ranges is to use valid

ranges of ray trace values for each grid square. However it is more costly both

computationally and space wise.

2 - When comparing robot scan data to ray traces, it is important to remember that

actual robot’s facing could be off by up to angular grid size.

3 - Use discrete approximation of p(Z|X). Discrete functions work well with histogram

filters and are very easy to compute.

4 - Trigonometry computations are expensive. My ray tracing algorithm uses only 1

trigonometry computation per xy-displacement.

5 - Pre-compute laser offset – there are only a small set of possible integer offsets and

they do not change with changes in grid size. The only two

1 parameters laser offsets depend on are map resolution and forward laser offset.

Computing laser offset during measurement step (or during pre-computation of

trace min/max over grid) implies a trigonometry operation at each step.

2 - When computing ray traces, one should keep in mind the map resolution error. The

values computed could be off by as much as 2sqrt(2)resolution, because actual

starting robot position and actual obstacle position could be anywhere within

respective map squares

[1] Casella, G. & Robert, C.P., (1993) Rao-Blackwellisation of sampling schemes,

Biometrika, 83(1): pp 81-94.

[2] Kevin Murphy & Stuart Russel, (2001) Rao-Blackwellised Particle Filtering for

Dynamic Bayesian Networks Sequential Monte Carlo Methods in Practice. A. Doucet, N.

de Freitas and N.J. Gordon (eds), Springer-Verlag, 2001

[3] Sebastian Thrun, Wolfram Burgard & Dieter Fox, A Probabilistic Approach to

Concurrent Mapping and Localization for Mobile Robots. Machine Learning and

Autonomous Robots 31/5, 1-25, 1998.

Localization: Multiple Passes