Robotics Lab Labs / Sensors / LiDAR obstacle detection

This lab works on phones, but writing code is much easier on a laptop.

Sensors · Point clouds · Lab 03 · Beginner to intermediate

Build a LiDAR obstacle detection pipeline

Your robot is about to drive forward. Is the way clear?

The LiDAR sees the floor, a few obstacles and some noise, as one big list of points. Turn that list into a decision: find the ground, group the rest into obstacles, measure how far away they are, and decide STOP or GO.

Your task

    Raw LiDAR frame
    Colour

    Tap or click a point to inspect it.

    prepare.py Loading Python…
    Ctrl+Enter runs
    What Python can I use?

    Plain Python, math, and a browser-sized subset of NumPy: indexing like points[:, 0], masks and & | ~; + − * / ** @; .min() .max() .sum() .mean() .all() .any() .argmin() (with axis=); np.isfinite, np.isnan, np.sqrt, np.abs, np.floor, np.sin, np.cos, np.eye, np.zeros, np.full, np.linalg.norm, item assignment like labels[i] = k. Code written here also runs with real NumPy.

    Hints

    How robots find obstacles in a point cloud

    A LiDAR doesn't say "there is a box 2 m ahead". It returns thousands of points, most of them on the floor. A classic obstacle detection pipeline turns them into objects in a few steps: preprocess (clean, crop, move into the robot frame), remove the ground, cluster the remaining points by distance, then measure each cluster. Self-driving cars, warehouse robots and lawn mowers all run a version of this pipeline, often before any machine learning is involved.

    What you will be able to do

    The point-cloud sequence

    1. Lab 01: Understand & visualize a point cloud
    2. Lab 02: Process & transform a point cloud
    3. Lab 03: Build a LiDAR obstacle detection pipeline: this lab.

    Get the next lab

    Get notified when new robotics labs are released. One email per new lab, nothing else.