Skip to content

Akank0706/AI-Autonomous-Navigation-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI-Based Autonomous Navigation System

Python Pygame Algorithm License Status

An AI-powered autonomous navigation system built in Python — featuring A* path planning, obstacle detection, and a real-time 2D simulation. No hardware or GPU required.


Demo

Navigation Demo

Agent (blue circle) navigating from start (green) to goal (red), avoiding obstacles (black), following the A* planned path (yellow).


Problem Statement

How can a robot or self-driving vehicle navigate from point A to point B in an unknown environment, avoiding obstacles — without human intervention?

This project solves exactly that. It implements the core AI pipeline used in real autonomous systems: perceive → plan → navigate → visualize.


Industry Relevance

Domain Company Application
Self-driving cars Tesla, Waymo, Cruise Lane keeping, collision avoidance
Warehouse robots Amazon Robotics, Fetch Autonomous goods transport
Delivery robots Starship, Nuro Last-mile autonomous delivery
Drones DJI, Zipline Obstacle-free flight paths
Industrial robots ABB, KUKA, Fanuc Safe arm navigation

Tech Stack

Tool Purpose
Python 3.10+ Core programming language
Pygame 2.5 2D simulation and real-time visualization
NumPy Grid matrix operations
A* Algorithm Optimal shortest-path planning
Matplotlib Path analysis plots (optional)

System Architecture

INPUT
  └─ 2D Grid Map (rows × cols)
     ├─ Start position (S)
     ├─ Goal position  (G)
     └─ Obstacle positions (1 = blocked)

PERCEPTION MODULE          (src/perception.py)
  └─ Scans grid → identifies obstacle cells

PATH PLANNING MODULE       (src/path_planning.py)
  └─ A* algorithm with Manhattan heuristic
  └─ Returns optimal waypoint list

NAVIGATION MODULE          (src/navigation.py)
  └─ Agent follows waypoints step by step
  └─ Reports progress and goal status

VISUALIZATION MODULE       (src/visualization.py)
  └─ Pygame renders grid, agent, path
  └─ Auto-saves screenshots for proof

OUTPUT
  └─ Animated navigation window
  └─ Terminal logs
  └─ Screenshot proof in outputs/

Folder Structure

AI-Autonomous-Navigation-System/
│
├── src/
│   ├── perception.py       # reads grid, identifies obstacles
│   ├── path_planning.py    # A* and Dijkstra algorithms
│   ├── navigation.py       # agent movement logic
│   └── visualization.py    # Pygame renderer + screenshot
│
├── simulation/
│   ├── environments.py     # open / maze / dense map generators
│   └── grid_maps/          # saved .npy map files
│
├── outputs/
│   └── screenshots/        # auto-saved proof images
│
├── notebooks/
│   └── demo.ipynb          # Jupyter walkthrough
│
├── docs/
│   └── images/             # README assets
│
├── main.py                 # ← run this to start
├── config.py               # grid size, colors, FPS
├── requirements.txt
├── .gitignore
└── README.md

Installation

1. Clone the repository

git clone https://github.com/YOUR_USERNAME/AI-Autonomous-Navigation-System.git
cd AI-Autonomous-Navigation-System

2. Create virtual environment

# Windows
python -m venv venv
venv\Scripts\activate

# Mac / Linux
python3 -m venv venv
source venv/bin/activate

3. Install dependencies

pip install -r requirements.txt

4. Verify installation

python -c "import pygame; import numpy; print('All dependencies OK')"

How to Run

python main.py

Change the map type in main.py line 52:

MAP_TYPE = "maze"    # "open" | "maze" | "dense"

Expected output

==================================================
  AI Autonomous Navigation System
  Map type : maze
==================================================

[Perception] Environment scan complete
  Total cells  : 400
  Obstacles    : 87
  Free cells   : 313
  Density      : 21.8%

[PathPlanning] Running A* algorithm...
[PathPlanning] Path found!
  Steps        : 34
  Path cost    : 33
  Cells visited: 156

[Navigation] Path loaded — 34 waypoints
[Navigation] Goal reached!
[Simulation] Navigation complete!

Screenshots are auto-saved to outputs/screenshots/.


Simulation Workflow

  1. Environment loads — 20×20 grid with obstacles appears
  2. Perception scans — obstacle positions logged to terminal
  3. A* plans path — yellow cells show the optimal route
  4. Agent navigates — blue circle follows path step by step
  5. Goal reached — final screenshot saved, window stays open 2 seconds
  6. Check proofoutputs/screenshots/ has 3 timestamped images

Results

Map Type Path Length Cells Explored Time
Open ~28 steps ~90 cells < 1s
Maze ~34 steps ~156 cells < 1s
Dense ~48 steps ~220 cells < 1s

Screenshots

Start Midway Goal Reached
start mid end

Learning Outcomes

  • Implemented A* search algorithm from scratch in Python
  • Designed a modular perception → planning → navigation pipeline
  • Built real-time 2D simulation with Pygame
  • Understood how autonomous systems perceive and react to environments
  • Practiced industry-style project structure and GitHub documentation

Future Improvements

  • Real camera input with OpenCV lane detection
  • YOLO object detection overlay
  • CARLA 3D simulator integration
  • Reinforcement learning agent (replace A*)
  • ROS2 integration for real robot control
  • SLAM — simultaneous localization and mapping
  • Multi-agent simulation
  • Web dashboard with Flask

About

Built an AI system that enables a virtual robot to navigate autonomously from start to goal — detecting obstacles and finding the optimal path using A*. Industry-relevant concepts from Tesla, Waymo, and Amazon Robotics, implemented in pure Python.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages