Skip to main content

University course project · 2023

Autonomous Maze Navigator

An autonomous LEGO EV3 rover that explores mazes with depth-first search, routes with Dijkstra, and stays on track with PID control.

  • Python
  • LEGO EV3Dev
  • MQTT
  • Git
EV3 + ev3dev
Platform
Passed
Examination

A Python control stack for an EV3-based rover navigating dynamic maze environments. It combines real-time hardware interfaces, a PID controller for line following, a finite state machine for mode switching, and MQTT telemetry to a central server. Exploration runs on depth-first search; routing on Dijkstra.

Problem

The robot had to explore a randomly generated maze until a central server assigned it a destination coordinate, then navigate there efficiently, all under strict memory and timing constraints.

Approach

We built a modular Python codebase around a finite state machine. An MQTT communication layer negotiates with the server and parses target coordinates. Depth-first search drives exploration; once the target arrives, a shortest-path algorithm computes the route.

Outcome

The robot passed the final examination under time pressure: it received the server payload, mapped the maze, and navigated to the destination without errors or memory leaks.

Architecture

The software runs on the ev3dev Linux kernel. A main event loop polls the color, distance, and gyro sensors and feeds a central logic controller. An asynchronous MQTT client handles the negotiation with the server for target coordinates.

Highlights

Telemetry Exchange

Requests, parses, and validates target coordinates from the central server via MQTT.

PID Regulation Loop

Proportional-Integral-Derivative control for smooth line tracing and wall alignment.

State Machine

Robust switching between exploration and target navigation modes.

Graph Pathfinding

Maps the maze in memory and computes the shortest path to the assigned goal.

Timeline

  1. Hardware and Handshake

    Calibrated the sensors and established telemetry sessions via MQTT.

  2. Algorithms

    Built the state machine and depth-first exploration loops.

  3. Routing Tuning

    Refined the routing algorithms to compute paths quickly.

  4. Final Run

    The rover completed the formal evaluation under real-time constraints.