← Back to Portfolio

A* Path Planning and Navigation for Mobile Robotics

Skills: A* Search Algorithm, Occupancy Grids, Path Planning, Differential Drive Control, Python, Robot Simulation, Heuristic Optimization

GitHub Repo Project Report

Project Overview

This project focuses on the implementation of the A* algorithm to generate optimal 2-D paths for a differential-drive robot. The robot navigates through a discretized environment represented by occupancy grids, avoiding obstacles while moving from start to goal locations.

Beyond static path planning, the project explores Online A*, where the robot plans without prior knowledge of all obstacles, and a low-level Bang-Bang Controller to drive the generated waypoints under simulated noise.

Robot configuration and heading error Robot configuration and heading error
Figure 1: Differential robot configuration and coordinate system used for navigation.

Environment: Occupancy Grids

To utilize discrete search algorithms in a continuous world, the environment is discretized into occupancy grids. Two resolutions were tested: a standard 1.0m grid and a high-resolution 0.1m grid.

Occupancy grid visualization Occupancy grid visualization
Grid discretization at 1m (left) and 0.1m (right) scales.

The A* Algorithm

The A* algorithm uses an evaluation function \(f(n) = g(n) + h(n)\) to find the cost-optimal path. I utilized Euclidean distance as an admissible heuristic, ensuring the algorithm never overestimates the cost to the goal.

\[ \begin{aligned} g(n) &= \text{cost to reach node } n \\ h(n) &= \sqrt{(x_{goal} - x_n)^2 + (y_{goal} - y_n)^2} \end{aligned} \]

Offline vs. Online: The offline version prunes unnecessary nodes after reaching the goal. The online version assumes the robot only senses adjacent obstacles, requiring real-time path adjustments as it moves through the environment.

Robot following A* path Robot following A* path
A* algorithm results on low resolution grid with offline (left) and online (right) comparison.

Motion Control

The low-level controller implements a state machine using bang-bang control for linear and rotational motion. The robot first rotates to minimize heading error before moving forward to the target waypoint.

\[ \text{heading error} = \operatorname{atan2}(y_{goal} - y, x_{goal} - x) - \theta \]

To simulate real-world conditions, random noise was applied to the robot's configuration [x, y, θ], forcing the controller to constantly compensate for drift and sensor uncertainty.

To avod obstacle collission, my offline A* implementation filters paths between cells such that they do not clip the edges of obstacles.

Robot following A* path Robot following A* path
Low-level controller following Online A* paths with obstacle avoidance with offline (left) and online (right) comparison.

Alternative: Potential Fields

As an alternative to discrete grids, I implemented Potential Fields to navigate in continuous space. The goal is modeled as a 3D Gaussian distribution with positive amplitude, while obstacles act as negative peaks, creating a "force" that guides the robot.

Potential field visualization Potential field visualization Potential field visualization Potential field visualization
Potential field generated by goal (attraction) and obstacles (repulsion).

Reflections

This project highlighted the critical trade-offs between grid resolution and computational cost. While high-resolution grids offer more precision, they require robust inflation layers and precise control to prevent the robot from colliding with obstacles during noisy execution.