// Project

Navigation Program for an Autonomous Robot

PythonPathfindingRoboticsWebSocketsREST APISimulation

About this project

A navigation system for an autonomous delivery robot. Plans optimized multi-stop routes using A* pathfinding, steers smoothly via Pure Pursuit control, and integrates with a WebSocket server and REST API to receive live orders, update delivery statuses, and log trajectory data — all visualized in a real-time animated simulation.

Key Features

A* Pathfinding

Finds the shortest route between each stop using the A* search algorithm with 8-directional movement, including diagonal paths for more natural navigation.

Pure Pursuit Steering

A real-time steering controller that picks a target point ahead on the path and smoothly drives toward it — the same approach used in real self-driving vehicles.

Multi-Stop Delivery Route

The robot autonomously completes a full delivery mission — Home to Restaurant, Drop-off, and back — handling multiple orders in sequence with automatic leg-by-leg replanning.

WebSocket Server

A real-time WebSocket server that accepts navigation commands, quick routes, and status requests — enabling a frontend or mobile app to control the robot remotely.

REST API Integration

Pulls live orders from a Base44 app API, updates order statuses (pending → in_transit → delivered) at each stop, and posts full trajectory data after each delivery.

GPS-to-Grid Projection

Converts real-world GPS coordinates (lat/lon) to grid cells using a local reference origin, enabling the simulator to work with actual delivery addresses.

Live Animated Simulation

A real-time Matplotlib visualization showing the planned path, robot trajectory, labeled restaurant and drop-off markers, a meter-scale overlay, progress bars, and a name tag following the robot.

Bluetooth Support

Optional serial Bluetooth link to send velocity and steering commands to physical hardware, bridging the simulation to a real robot.

Tech Stack

PythonNumPyMatplotlibWebSocketsRequestsA* AlgorithmPure Pursuit ControllerJSON APIasyncio

Development Roadmap

Grid World & Environment Setup
A* Pathfinding Engine
Path Densification & Smoothing
Pure Pursuit Steering Controller
Multi-Leg Route Planning
Stop Detection & Dwell Timer
Zone Enter/Leave Logging
Real-Time Matplotlib Animation
WebSocket Server for Remote Control
REST API Order Management
GPS-to-Grid Coordinate Projection
Bluetooth Hardware Bridge
Per-Order Trajectory Tracking & Upload

Challenges & Solutions

Smooth Steering at Stops

The robot would overshoot or oscillate around destination points instead of cleanly arriving and stopping.

Implemented a two-speed system — full speed while cruising and a slower approach speed within a close radius — combined with direct aiming at the exact stop coordinates instead of the path's lookahead point.

Natural-Looking Movement

Following raw A* grid paths produced sharp, robotic-looking turns at every cell boundary.

Added path densification that interpolates extra waypoints between grid cells, combined with the Pure Pursuit algorithm's curved steering, resulting in smooth and natural motion.

Real-World Coordinate Mapping

The simulation works in grid cells, but real delivery addresses come as GPS lat/lon coordinates.

Built a GeoProjector class that uses a local origin point and meters-per-degree calculations to convert GPS coordinates to grid cells, allowing the simulator to work with actual addresses.