
ContentsHow Each Sensor Works
Once you move past basic ultrasonic-sensor obstacle avoidance, the two main options for giving a robot spatial awareness are LiDAR and depth cameras. Both let a robot understand distances and build maps, but they work very differently — and the right choice depends heavily on your environment, budget, and processing power.
How Each Sensor Works
LiDAR (Light Detection and Ranging) emits laser pulses and measures how long they take to bounce back. 2D LiDAR units spin a laser around a horizontal plane, producing a ring of distance measurements — essentially a "slice" of the world around the robot. 3D LiDAR adds vertical scanning for full point clouds but is significantly more expensive.
Depth cameras use stereo vision (two cameras comparing images, like the OAK-D) or structured light/time-of-flight to estimate depth at every pixel in a 2D image. The result is a depth map where each pixel's value represents distance rather than color.
Strengths of LiDAR
- Highly accurate distance measurements, often to within a few centimeters, regardless of lighting conditions.
- Works in complete darkness — generates its own light source, so ambient light doesn't matter.
- Long range: many 2D units detect obstacles several meters away.
- Mature SLAM ecosystem: 2D LiDAR is the standard sensor for ROS 2's Nav2 stack and most established SLAM algorithms.
Weaknesses of LiDAR
- Cost: even budget 2D LiDAR units are pricier than entry-level depth cameras; 3D LiDAR is dramatically more expensive.
- No semantic information: LiDAR tells you where things are, not what they are.
- 2D LiDAR misses obstacles outside its scan plane — a coffee table with a low overhang might be invisible if the LiDAR is mounted at the wrong height.
Strengths of Depth Cameras
- Rich data: color images and depth simultaneously, enabling object detection and depth-aware navigation in one sensor.
- Full vertical field of view: see obstacles at multiple heights, not just a single horizontal plane.
- Often cheaper at entry level than dedicated LiDAR units.
- On-board processing: cameras like the OAK-D include a dedicated vision chip, offloading work from your main computer.
Weaknesses of Depth Cameras
- Performance degrades in low light and on reflective or featureless surfaces (blank walls, glass).
- Shorter effective range for reliable depth estimation compared to LiDAR.
- More processing-intensive for SLAM compared to well-optimized 2D LiDAR algorithms.
Many serious robots use both — 2D LiDAR for reliable, lighting-independent localization and mapping, paired with a depth or RGB camera for object recognition. For a deeper look at how these sensors feed into mapping algorithms, see our SLAM Explained guide.


