A C++ simulation program that demonstrates autonomous robotic navigation through obstacle-laden environments using heuristic-enhanced Depth-First Search (DFS) algorithms.
This program simulates a robot navigating from a starting position (0,0) to a goal position (4,4) on a 5×5 grid containing randomly generated obstacles. The robot employs intelligent pathfinding strategies to avoid obstacles and reach its destination.
- Heuristic-Enhanced DFS: Combines Depth-First Search with 4-Way Directional Vision (4DV) for improved pathfinding
- Obstacle Detection System: Active Robot Modern Scan (ARMS) pre-validates grid viability before navigation
- Adaptive Strategy Switching: Automatically attempts alternative paths when primary route fails
- Real-time Visualization: Color-coded terminal display with animated scanning and pathfinding
- Performance Analytics: Detailed statistics including moves, sensor usage, and path efficiency
-
Core Components
- Robot Class (robotObject.hpp): Encapsulates robot properties and identification
- Pathfinding Algorithm: Two-pass DFS with configurable movement priorities
- Obstacle Avoidance: Multi-directional sensor system (up, down, left, right)
- Path Validation: Pre-simulation scanning to eliminate unsolvable configurations
-
Navigation Strategies
- Primary Strategy: DOWN → RIGHT priority
- Secondary Strategy: RIGHT → DOWN priority
- 4DV Lookahead: Checks diagonal and adjacent cells for optimal routing
- C++11 or higher
- ANSI terminal support for colored output
- Standard libraries: iostream, vector, thread, chrono
Clone the Repository
git clone https://github.com/VigneshT24/CPP-Robotics-Pathfinding-Program.git
cd CPP-Robotics-Pathfinding-ProgramCompile & Run
g++ -std=c++11 main.cpp -o robot_sim
./robot_sim
# or click the run button if shownUser Input
| Parameter | Description | Options/Format |
|---|---|---|
| Robot Name | Single character identifier | Any character except 0 or O |
| Difficulty Level | Controls obstacle density | 5 - Fewer obstacles (super high success rate)3 - Moderate obstacles (good success rate)2 - More obstacles (slightly lower success rate) |
| Robot Type | Descriptive classification | Any string value |
Program Output
The program provides:
- Animated grid visualization with color-coded elements
- Real-time pathfinding progression
- Comprehensive statistics including:
- Total moves counter
- Sensor usage frequency
- Path efficiency metrics
- Visual robot footprint trace
This simulation is developed as a demonstration of algorithmic pathfinding and robotic simulation techniques.