Skip to content

Repository files navigation

Winner Badge

Autonomous Maze Navigation

A vision-based autonomous robot navigation system
πŸ₯‡ Winner β€” IEEE Robotrix 2025-26 Final Hackathon

Challenge β€’ Demo β€’ Solution β€’ Quick Start


The Challenge

Navigate a blind rover through a maze using only drone vision β€” no GPS, no coordinates, no cheating.

πŸ€– The Setup

Actor Role
The Mole Ground rover (blind, no sensors)
The Hawk Drone with downward camera
The Maze 15m Γ— 15m, red walls

🚫 The Rules

Constraint What it means
No getPosition() Can't ask simulator for location
No globals No cheating with shared state
512Γ—512 FOV Can only see small section
Real-time Must run live, no pre-planning

Demo

Watch Demo

πŸ“Ή Final Cleared.mp4 β€” Complete maze navigation in real-time


Technical Solution

Our solution implements a Multi-State Visual Wall Follower using computer vision and control theory β€” a completely vision-based approach that doesn't rely on any position data.

Key Innovation: Virtual Guide Rail + 5-Sensor Array

Instead of tracking absolute position, we generate a virtual guide rail from camera images and follow it using a simulated IR sensor array.

flowchart TD
    A[Camera Frame] --> B[Detect Mole]
    B --> C[Drone PID Tracking]
    C --> D[🚁 Hawk Velocity]
    
    B --> E[Detect Walls]
    E --> F[Generate Guide Rail]
    F --> G["5-Sensor Array<br/>[LL][L][C][R][RR]"]
    G --> H[PID Steering]
    H --> I[πŸ€– Mole Velocity]
    
    style A fill:#e1f5fe
    style D fill:#c8e6c9
    style I fill:#c8e6c9
Loading

Core Components

Component Purpose Technique
Mole Detection Track rover position in frame HSV thresholding (yellow marker) + contour detection
Drone Tracking Keep mole centered Dual-axis PID with anti-windup
Wall Detection Segment maze walls Dual HSV ranges (red hue wraparound)
Guide Rail Generate followable path Closest-point wall selection + morphological fillet
5-Sensor Array Line following Virtual IR sensors in reverse-U layout
Heading Estimation Track orientation Hybrid odometry + visual sensor fusion (98%/2%)
State Machine Handle edge cases WALL_FOLLOW ↔ LOOP_ESCAPE

Key Design Decisions

1. Closest-Point vs Centroid Wall Selection

Problem: Centroid-based selection jumps between walls at corners.

Solution: Sample a point to the rover's RIGHT and find the nearest wall contour.

# Sample point 100px to the right of mole
sample_x = int(cx + right_x * 100)
sample_y = int(cy + right_y * 100)

# Find wall contour closest to this point
for contour in wall_contours:
    dist = abs(cv2.pointPolygonTest(contour, (sample_x, sample_y), True))
    if dist < best_distance:
        best_contour = contour

2. Morphological Fillet (Smooth Corners)

# Dilate + erode creates naturally rounded corners
dilate_kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (offset*2, offset*2))
dilated = cv2.dilate(wall_mask, dilate_kernel)

erode_kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (radius*2, radius*2))
filleted = cv2.erode(dilated, erode_kernel)

3. Hybrid Heading Estimation

# Complementary Filter: 98% Odometry, 2% Vision
alpha = 0.98
new_heading = alpha * odometry_heading + (1.0 - alpha) * visual_heading

High odometry weight = smooth motion | Low vision weight = eliminates drift

4. Weighted 5-Sensor Array

SENSOR_ARRAY = [
    {'name': 'FAR_L',  'weight':  2.3},  # Strong left turn
    {'name': 'LEFT',   'weight':  1.2},  # Mild left turn
    {'name': 'CENTER', 'weight':  0.0},  # No correction
    {'name': 'RIGHT',  'weight': -1.2},  # Mild right turn
    {'name': 'FAR_R',  'weight': -2.3},  # Strong right turn
]

Repository Structure

Robotrix-26/
β”œβ”€β”€ task_submission.py                    # βœ… Winning solution
β”œβ”€β”€ approach_explanation.md               # Technical writeup
β”œβ”€β”€ blog.md                               # Competition blog post
β”œβ”€β”€ Final Cleared.mp4                     # Competition submission video
β”œβ”€β”€ Robotrix 2026 Problem Statement.pdf   # Official problem statement
β”œβ”€β”€ World.ttt                             # CoppeliaSim scene file
β”‚
└── Approach 1 - wall follow logic/       # Alternative approach (didn't work)
    β”œβ”€β”€ explanation.md             
    β”œβ”€β”€ World.ttt                         
    β”œβ”€β”€ task14_final.py            
    └── all code files-iterations/        # 18 iterations of development

Quick Start

Prerequisites

  • CoppeliaSim (with ZeroMQ Remote API)
  • Python 3.8+

Installation

git clone https://github.com/ADRSH99/Robotrix-26.git
cd Robotrix-26
pip install numpy opencv-python coppeliasim-zmqremoteapi-client

Running

# 1. Open CoppeliaSim with the maze scene
# 2. Run the solution
python task_submission.py

Performance

Metric Value
Result πŸ† 1st Place
Maze Size 15m Γ— 15m
Processing Real-time
Key Feature Fully vision-based, no position data

Approach Evolution

Approach 1: Discrete Turn Wall Following ❌

Traditional wall-following with discrete 90Β° turns and reference frame transformations.

  • Issue: Reference frame confusion between drone (global XY) and rover (local frame)
  • 18 iterations documented in Approach 1 - wall follow logic/

Final Approach: Continuous Guide Rail Following βœ…

Vision-based line following with virtual sensors.

  • Key insight: Generate a followable "rail" from wall detection, treat it like a line-following problem
  • Result: Smooth, continuous navigation without reference frame issues

The final winning solution was developed independently after pivoting from the initial approach.


Tech Stack

  • Python β€” Core implementation
  • OpenCV β€” Computer vision (HSV thresholding, morphology, contour detection)
  • NumPy β€” Numerical operations
  • CoppeliaSim β€” Robot simulation environment
  • ZeroMQ β€” Remote API communication

Learnings

  • Sensor Fusion: Combining wheel odometry with visual heading estimation
  • PID Tuning: Anti-windup is crucial for real-world performance
  • Computer Vision: HSV color spaces, morphological operations, contour analysis
  • State Machines: Handling edge cases (stuck detection, loop escape)
  • Reference Frames: The importance of coordinate system consistency

Acknowledgments

  • IEEE NITK Student Branch for organizing Robotrix 2025-26
  • CoppeliaSim for the simulation platform

Built during IEEE Robotrix 2025-26

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages