Robotics Lab Labs / Sensors / Process & transform a point cloud

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

Sensors · Point clouds · Lab 02 · Beginner

Process & transform a point cloud

Your robot's LiDAR works, but its data isn't ready to use.

The driver writes NaN and (0, 0, 0) when a beam gets no return, the mast shows up as hits right next to the sensor, and every point is measured from a LiDAR that sits on a mast, turned to one side. Clean the frame, crop it, move it into the robot's frame and thin it out.

Your task

    Raw LiDAR frame (sensor frame)
    Colour

    Tap or click a point to inspect it.

    clean.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

    Why preprocess a point cloud?

    A LiDAR driver hands you everything it measured, and some things it didn't: invalid returns, hits on the robot itself, sparse points far away, and coordinates in the sensor's own frame. Every perception pipeline starts by cleaning that up, and the order matters. Get it wrong and obstacle detection sees ghosts inside the robot, or misses the wall because it is 30° off.

    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: this lab.
    3. Lab 03: Build a LiDAR obstacle detection pipeline

    Get the next lab

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