Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS...

53
Robotics: Science and Systems Zhibin (Alex) Li School of Informatics University of Edinburgh Localisation and Mapping

Transcript of Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS...

Page 1: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Robotics: Science and Systems

Zhibin (Alex) LiSchool of Informatics

University of Edinburgh

Localisation and Mapping

Page 2: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Outline❏ Introduction of mapping❏ Occupancy grid map

❏ Basic assumptions❏ Occupancy update rule❏ Log odds representation❏ Algorithm of occupancy grid mapping

❏ Simultaneous Localisation and Mapping (SLAM)❏ Application domains❏ Basic concepts❏ Data association problem❏ Three main SLAM paradigms

*Further reading2

Page 3: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Recap: What Tools Do We Need?

3

Mapping(What does the area look like?)

Page 4: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Localisation and MappingLocalisation: given the map, compute the poses of the robotMapping: given the poses, compute the map of the environment

Goal: an autonomous robot should be ableto construct a map or floor plan, and use it to localize itself in the constructed map.

4

Page 5: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Mapping with known poses

5

Page 6: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Why mapping?❏Learning/building maps is one of the fundamental problems in mobile robotics.❏Maps allow robots to efficiently carry out their tasks, allow localisation.❏Successful robot systems rely on maps for localisation, path planning, activity planning etc., especially towards autonomy.❏Mapping is one of the core competencies of truly autonomous robots.

6

Page 7: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

General problem of mapping

What does the environment look like?

7Nobili, Simona and Scona, Raluca and Caravagna, Marco and Fallon, Maurice, “Overlap-based ICP Tuning for Robust Localization of a Humanoid Robot”, IEEE Intl. Conf. on Robotics and Automation (ICRA), 2017

Page 8: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

A popular sensor is LiDAR (Light Detection and Ranging).For each laser beam, it detects the distance by

Each reflection represents an occupied point in space. By gathering all the points reflected by the objects and environment, 3D point clouds are formed.

Modern sensing techniques

8

Page 9: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

In addition, GPS provides absolute position of the sensor (LiDAR) and an Inertial Measurement Unit (IMU) provides the precise orientation of the sensor. With these two additional information, we can translate the detected point from LiDAR sensor into static points to build a map in the global coordinate, assuming environment is static.

Modern sensing techniques

9

Page 10: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

General problem of mapping

10Tartan Rescue from DARPA robotics challenge

Limited data transmission, representation of environment with lower resolution.

Page 11: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Mapping: basics❏Formally, mapping involves, given the sensor data ,

to calculate the map of maximum likelihood

actions

observations

11

Page 12: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Mapping: basics❏For mapping with known poses, is the odometry (true poses ), to are hence the sequence of motions; to are sequence of measurements

to calculate the map of maximum likelihood given all the data d

12

Page 13: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Learning map is a chicken and egg problem❏In previous lecture, we looked at an example of estimating the pose of the vehicle given the measurement data and the map.❏Mapping, however, involves simultaneously estimating the pose of the vehicle and the map. When the robot moves, it the error of odometry accumulates, which gradually makes the pose less certain.❏The general problem is therefore denoted as the simultaneous localisation and mapping problem (SLAM).❏Throughout this section we will describe how to calculate a map given we know the pose of the vehicle, which is relatively easy.

13

Page 14: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Why is mapping hard?❏Size: when environment is large compared to sensor range❏Noise: if robots’ sensors and actuators were noise free, there wouldn’t be that much of a problem❏Perceptual ambiguity and aliasing: when different places look alike, locally, the learning process needs to properly extract global correspondences❏Cycles: straight line paths, e.g., along a corridor are easier than cycles where errors accumulate by the time one returns to the same place

14

Page 15: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Problems in mapping❏Sensor interpretation

❏How do we extract relevant information from raw sensor data?

❏How do we represent and integrate this information over time?

❏Robot locations have to be estimated❏How can we identify that we are at a previously visited place?

❏This problem is the so-called data association problem.

15

Page 16: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Grid maps1. The world is discretized the into cells2. The grid structure is fixed3. Assume each cell is either occupied

or free4. It is a non-parametric model5. It requires significant memory

storage

16

Page 17: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Occupancy grid maps❏Introduced by Moravec and Elfes in 1985❏Represent environment by a grid.❏Estimate the probability that a location is occupied by an obstacle.❏Key assumptions: Occupancy of individual cells (m[xy]) is independent

Robot positions are known!

17

Page 18: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Updating occupancy grid maps❏Idea: Update each individual cell using a binary Bayes’ filter.

❏Additional assumption: Map is static.

18

Page 19: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Assumptions: occupancy state is binaryEach grid cell is either completely free or occupied, ie binary state.

19

Occupied

Free

Unknown (or a prior estimate, eg 0.2)

Page 20: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Assumptions: independencyEach grid cell is independent from each other.

20

No correlation with each neighbors

Page 21: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Occupancy grid maps❏ Each x-y coordinate is assigned with a binary occupancy value which

specifies whether or not a location is occupied by an object.

❏ Easy to find paths through the unoccupied space, ie collision-free.

21

Page 22: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Occupancy update ruleCompute the ratio of occupancy probabilities, we obtain:

22

=

=

Total probability

Unknown p(mi)=0.5 in a simple case

Only by using this ratio, the multiplication of probability growers higher and higher if the cell is occupied, and vice versa.

Page 23: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Log odds representation❏Use the log-odds representation, turning multiplication into summation.

❏Define log odds ratio as

❏Later, given log odds ratio, we can recalculate

Odds are a ratio of probabilities: ; the log odds of event A are = .

How to understand log odds ratio? Whiteboard exercise.

For example, results in , meaning the log-odds ratio is 1.105:(1+1.105); so the probability is 1.105/(1+1.105)=0.525.

23

Page 24: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Occupancy mapping expressed by log odds By substituting in the log-odds form as defined previously, we obtain the recursive equation (i=x,y in a 2D case)

or simply

where l0 is the prior of occupancy represented as a log-odds ratio.

Note: is called inverse sensor model because it uses sensor measurement to rule out back to its causes, ie what map causes this measurement. 24

Page 25: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Pseudo code of binary Bayes’ filter

25

Only sum operation is required, efficient computation in log-odds representation

Page 26: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Example: sonar range sensingSimilar principle, for each sonar beam: First, consider only the optical axis.

26

Page 27: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

z+d1 z+d2

z+d3z

z-d1

Occupancy value depending on measured distance

27

Measured distance, 2 meter is the borderline, p=0.5.

Prior

Linear along the optical axis

Page 28: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Key parameters of the modelAssume linear in yt , and Gaussian in .

28

Page 29: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Update by measured distance and deviation from the optical axisHow the density if influenced by the deviation away from the optical axis in a Gaussian-like manner.

29

Higher uncertainty, large variance (flattened Gaussian)

Lower uncertainty, lower variance (tall Gaussian)

Page 30: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Resulting model for occupancy grid mapsCombination of a linear function and a Gaussian (occupancy probability, given position and reading). Two measured distances:

30

Page 31: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Recursive update of occupancy grids

31

Adding measurement recursively by the update rule represented in log odds form.

Page 32: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Map constructed by ultrasound sensors

32

Page 33: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Occupancy and maximum likelihood map

The maximum likelihood map is obtained by clipping the occupancy grid map at a threshold of 0.5. Note, sonar sensor has less accuracy as indicated here.

33

Page 34: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Occupancy grids (laser scan)

34

Page 35: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Tech Museum, San Jose

CAD map Occupancy grid map35

Page 36: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Mapping from Valkyrie humanoid robot

36

Page 37: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

SLAM

37

Page 38: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

The SLAM problem❏ SLAM stands for simultaneous localisation and mapping❏ The task of building a map while estimating the pose of the robot

relative to this map

❏ Why is SLAM hard?Chicken and egg problem: ❏ a map is needed to localize the robot ❏ a pose estimate is needed to build a map

Previously, localisation is to infer the location given a known map. The mapping we present here builds a map given known locations. SLAM, however, builds a map and locates the the post of the robot simultaneously.

38

Page 39: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

The SLAM problemA robot moving through an unknown, static environment:❏Given:

❏The robot’s controls

❏Observations of nearby features

❏Estimate:❏Map of features

❏Path of the robot

39

Page 40: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

SLAM applicationsIndoors

Space

Undersea

Underground

40

Page 41: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Graphical model of full SLAM

41In SLAM, the robot seeks to recover the unobservable variables, estimate the posterior over the entire robot path together with map.

Page 42: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Graphical model of online SLAM

42

Only recover the present location rather than the whole path.

Page 43: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Robot path error correlates errors in the map

SLAM: robot path and map are both unknown!

43

Why is SLAM a hard problem?

Page 44: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Why is SLAM a hard problem?

❏In the real world, the mapping between observations and landmarks is unknown❏Picking wrong data associations can have catastrophic consequences❏Pose error correlates data associations

Robot poseuncertainty

44

Is that a new feature, or a previously observed feature?

Page 45: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Data association problem

❏A data association is an assignment of observations to landmarks❏In general there are more than n observations and m landmarks possible associations❏Also called “assignment problem”

45

Is that a new feature, or a previously observed feature?

Page 46: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Localisation vs SLAM❏ A particle filter can be used to solve both problems❏ Localisation: state space❏ SLAM: state space

❏ for landmark maps = ❏ for grid maps =

❏ Problem: The number of particles needed to represent a posterior grows exponentially with the dimension of state space!

46

Page 47: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Three main SLAM paradigms1. Extended Kalman Filters2. Particle Methods3. *Graph-Based Optimization Techniques

47

Page 48: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Extended Kalman FiltersThe EKF algorithm represents the robot estimate by a multivariate Gaussian

The high-dimensional vector contains the robot’s best estimate of its own current location and the location of the features in the environment.

As presented in previous lecture, it requires a motion function and a measurement function. EKF SLAM linearizes the motion and measurement functions using Taylor series expansion.

It is basically the application of the EKF for solving the online SLAM problem.

48

Page 49: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Particle methodsThe second principal SLAM approach is based on particle filters:

❏ Each particle is best guess to the true value of the state, by collecting a set of particles, the particle filter approximates the posterior distribution.

❏ Particle filter approaches the true posterior as the particle set size goes to infinity.

❏ It is a nonparametric representation and represents multimodal distributions.

❏ FastSLAM (fast simultaneous localisation and mapping) [Montemerlo, M.; Thrun, S.; Koller, D.; Wegbreit, B. (2002). "FastSLAM: A factored solution to the simultaneous localization and mapping problem" (PDF). Proceedings of the AAAI National Conference on Artificial Intelligence. pp. 593–598.] 49

Page 50: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Results – Victoria Park❏4 km traverse❏< 5 m RMS position error❏100 particles

Dataset courtesy of University of Sydney

Blue = GPSYellow = FastSLAM

50

Page 51: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Demo (using FastSLAM Algorithm)

51

Page 52: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Demo (using FastSLAM Algorithm) – Loop Closure

52

Page 53: Robotics: Science and Systemswcms.inf.ed.ac.uk/ipab/rss/lecture-notes-2018-2019/7 RSS Localisati… · Maps allow robots to efficiently carry out their tasks, allow localisation.

Extracurricular reading (not required)RI Seminar: John Leonard : Mapping, Localization, and Self-Driving Vehicles

53