How LiDAR sees a room
Each laser ray measures the first surface it meets. Move the scanner to reveal hidden faces, then compare a floor map with 3D voxels.
Reveal the room
Scan once, then move around the crate to see behind it.
Or click open floor to reposition. Drag to orbit.
0 scans · 0 returns
Geometric sensor simulation with known positions. Nav2 and SLAM are covered in the follow-on lesson.
Opening the Python editor…
Requirements and learning goals
Before you start
- A browser with WebGL
- No robot or installation required
You will be able to
- Explain why a laser stops at the first visible surface
- Distinguish free, occupied, and unknown space
- Compare a planar scan with a 3D voxel view
A sensor measures distance along many directions. In a time-of-flight sensor, a light pulse travels to a surface and back. Its round-trip time gives a range. Combining each range with its beam direction locates the measured surface relative to the sensor.
Here, the browser intersects rays with the actual room geometry. The returns drive the visible map. This ideal sensor omits noise, reflectivity, glass, and timing effects. You can move it around the crate and observe what becomes visible.
Try it
- Press Scan room. The highlighted beam meets the near side of the crate. Its range is 1.60 m.
- Inspect the floor. Green cells have been traversed by a beam; amber cells contain a return. Dark cells have no observation yet.
- Press Move to the other side, then scan again. The opposite face of the crate becomes visible and the map gains observations.
- Select Try a 3D scanner. This starts a fresh scan with five elevation angles. Orbit the scene to inspect the occupied cubes.
- Move and scan again. Compare which heights are observed from the two positions.
You can also click open floor to reposition the scanner. This action relocates it for an experiment; it does not command a navigation controller. The table and crate remain solid constraints on placement.
Check the expected results
The initial sensor position is x = −2 m, y = 0.6 m, z = 0 m. The crate's near face is at x = −0.4 m. A beam pointing in positive x therefore measures 1.6 m. It cannot also see the wall behind that crate.
A planar scan contains 120 directions at one height. It sees a horizontal slice, not every surface in the room. A raised tabletop may be invisible to that slice. Changing to the 3D scanner emits 600 rays across five elevation angles. Cubes represent 20 cm cells containing actual returns, rather than filled-in furniture volumes.
The floor map uses 20 cm cells and samples beam traversal every 5 cm. It is a simple occupancy demonstration, without probabilistic updates or dynamic clearing. Missing observations stay unknown. A cell without a point is not automatically free. After enough scans, the display retains the latest 4,800 rays to keep the exercise responsive.
Where SLAM and Nav2 fit
This exercise knows every scanner position exactly. must estimate motion and map the surroundings together. In a workflow, a planar sensor commonly publishes LaserScan on /scan; SLAM Toolbox builds a map, while AMCL can against an existing map. Nav2 mapping and localization
combines map and sensor information in for planning and control. Its voxel layer maintains height information and projects it into a 2D costmap. A visible voxel model does not mean the robot plans arbitrary flying trajectories. Nav2 voxel layer
The following lesson runs Gazebo, SLAM Toolbox, and Nav2 on your computer. This browser exercise does not run those packages.
Troubleshooting
If placement is rejected, choose a floor point away from the crate, table, and walls. Moving alone does not add observations; press Scan room afterward. Changing scanner type clears the accumulated view so planar and multilevel observations are not mixed. Reset returns to the original 1.60 m example.
A sparse voxel view is expected. A ray measures a visible surface, not the solid interior or every hidden face. Scan from another position to reveal more.
Before you move on
Can you do each of these?
- Explain why a laser stops at the first visible surface
- Distinguish free, occupied, and unknown space
- Compare a planar scan with a 3D voxel view
0 of 2 checkpoints solved. Try checkpoint 1