Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
LiDAR SLAM from Scratch: Scan Matching to Loop Closure
New
8 students

LiDAR SLAM from Scratch: Scan Matching to Loop Closure

Build a 2D SLAM stack in Python and ROS 2, from ICP to pose-graph optimisation, measuring every claim as you go
Last updated 11/2026
English
English

What you'll learn

  • Implement ICP from scratch: correspondences, the SE(2) best-fit transform, convergence thresholds and what the residual really tells you
  • Write point-to-line ICP and surface normal estimation, and measure exactly when it beats point-to-point and when it does not
  • Build correlative scan matching with a coarse-to-fine search, and see why a search step finer than the grid is a lie
  • Construct an occupancy grid with log-odds updates and Bresenham ray tracing, and publish it as a real nav_msgs/OccupancyGrid
  • Detect loop closures end to end: scan descriptors, candidate retrieval, spatial filtering, geometric verification and false-positive rejection
  • Derive and code an SE(2) pose-graph optimiser with analytic Jacobians, gauge anchoring and robust weighting for bad loops
  • Diagnose a SLAM frontend: odometry prediction, scan correction, keyframe selection and where drift actually comes from
  • Measure your own system honestly with ATE, RPE and drift metrics, and compare it against an established ROS 2 SLAM package
  • Recognise when a benchmark is measuring your own bug rather than the algorithm, which happened repeatedly while building this course

Course content

10 sections • 77 lectures • 8h 0m total length
  • 1.1 What We Are Building6:03
  • 1.2 LiDAR SLAM System Architecture6:47
  • 1.3 Course Roadmap and Required Knowledge6:24
  • 1.4 Why 2D LiDAR SLAM Is Still the Right Place to Start6:04
  • 1.5 Development Environment and Repository Tour6:08
  • 1.6 Course Handoff: Complete Code, Assets and Setup6:19

Requirements

  • Comfortable Python: functions, classes, numpy arrays, reading a traceback
  • Basic linear algebra: vectors, matrices, and what a rotation matrix does. The SE(2) maths is derived from scratch
  • Helpful but not required: some ROS 2 exposure. The nodes are built step by step and the frames are explained
  • No LiDAR hardware needed. Everything runs in Gazebo, and the full simulated environment is provided
  • A Linux machine with ROS 2 Jazzy. Setup is covered in Section 1

Description

This course contains the use of artificial intelligence.

Most SLAM courses show you a map that closes beautifully and move on. This one builds the whole stack from an empty file and then tries to break every part of it, because the interesting engineering is in the failures.

You will write point-to-point ICP, point-to-line ICP, correlative scan matching, an occupancy grid, a loop-closure detector and an SE(2) pose-graph optimiser with analytic Jacobians. Everything runs against a simulated Clearpath Husky with a SICK LMS1xx in a Gazebo warehouse, so every number in the course came from a run you can reproduce.

What makes this different is that the measurements are allowed to disagree with the textbook. A few of the results you will derive:

  • Point-to-line ICP does not rescue a degenerate wall. Its advantage is geometry-dependent, not universal.

  • "Log odds avoids numerical underflow" is false. The real reasons to use it are better than the one everyone repeats.

  • Submaps lose on a six metre path, and understanding the regime where they lose is the actual lesson.

  • Subsampling a scan to 4 cm is more accurate than keeping every point.

  • A standard outlier filter made matching 1.9x worse by deleting the far wall.

  • Residual and inlier fraction do not separate a true loop closure from a false one. The quantity that does is the one the aligner never saw.

Several of those started as bugs in my own harness. The course shows the broken version, the number that looked impressive, and how the mistake was caught, because recognising a measurement that is lying to you is the skill that transfers.

You finish with a working SLAM system, a test suite, and the habit of asking what a number actually measured.

Who this course is for:

  • Robotics engineers who can run an existing SLAM package but could not write one, or debug it when the map folds
  • ML and software engineers moving into robotics who want the geometry and estimation rather than another library tour
  • Students and researchers who need to implement scan matching or pose-graph optimisation and want the derivations alongside working code
  • Anyone who has watched a SLAM demo close a loop perfectly and wondered what happens when it does not