Skip to main content
This guide demonstrates how to create a robot that can safely navigate its environment using depth perception. The example works with both simulated (AirGenCar) and real robots (JetBot).

Overview

The safe navigation example combines:
  • Depth perception using MIDAS model
  • Grid-based environment analysis
  • Obstacle avoidance
  • Velocity-based navigation

Core Components

Depth Processing

We use the MIDAS model for depth estimation:

Grid Analysis

The system divides the depth image into a grid for analysis:

Safety Assessment

These functions evaluate the safety of different navigation paths:

Movement Control

Steering Calculation

Converts patch selection to movement commands:

Main Control Loop

The main loop continuously:
  1. Captures RGB images
  2. Generates depth maps
  3. Analyzes environment safety
  4. Controls robot movement

Robot Setup

Simulated Robot (AirGenCar)

For simulation environments:

Real Robot (JetBot)

For physical robot deployment:

Running the Example

  1. First, ensure you have GRID installed and set up properly.
  2. Choose your robot type:
  1. Run the navigation loop:
The robot will start navigating while avoiding obstacles using depth perception.
Make sure to monitor the robot during initial testing and be ready to stop it if needed. The safety thresholds may need adjustment based on your specific environment.

Full Source Code

Here is the complete source code for the safe navigation example: