Loading...
Artificial Intelligence & CS

Evolution of an AI Pathfinder: Bridging Software and Robotics Navigation

The Origin: Understanding the Basics (2022) Every complex system starts with a fundamental question. In 2022, my question was: How does a computer know the shortest route from Point A to Point B? To answer this, I built my first pathfinding visualizer using Python and Pygame. The original iteration was extremely rigid—a simple binary grid where squares were either open paths or impassable walls. I implemented the A* algorithm using a standard heuristic approach, visualizing how the algorithm mathematically balanced the distance already traveled with the estimated distance to the goal. It was a functional proof-of-concept, but it lacked real-world application.

The original project running A star

og.png 10.93 KB

The Evolution: From Pixels to Physical Constraints (2023 - Present) As my interest deepened into mechatronics and artificial intelligence, I realized that real robots do not move in a frictionless binary world. After six major iterations over two years, I completely re-architected the codebase.

I transitioned the architecture from a monolithic script to a robust Object-Oriented design, utilizing a TerrainNode class to encapsulate state and a central PathfinderApp class to handle the simulation engine. This allowed me to introduce complex, real-world variables necessary for actual robotics:

  • Variable Terrain Costs: I implemented a weighted graph system. Instead of just "open" or "blocked," algorithms now calculate routes across grass (cost: 1), roads (cost: 0.5), water (cost: 3.0), and mountains (cost: 5.0).
  • Kinematic Constraints (Turn Penalties): In robotics, moving forward is energy-efficient, but braking, rotating the chassis, and accelerating drains battery and costs time. I modified the pathfinding algorithms to apply a mathematical penalty (+0.5 cost) every time the path forces a change in direction. The algorithm now favors smooth, continuous movements over jagged, technically shorter lines.
  • Multi-Algorithm Engine: I integrated multiple algorithms (A*, Dijkstra, and Greedy Best-First Search) into a single simulation engine. This allows users to actively compare how different logic performs under the exact same terrain constraints in real-time.

The A star algorithm on the new project

2.png 34.82 KB

The greedy algorithm for comparison 

astar.png 33.56 KB

Technical Growth and Takeaways This project represents my growth from writing sequential code to designing scalable systems. It required a deep dive into data structures, specifically utilizing Priority Queues (heaps) for performance optimization during node evaluation. By adding kinematic constraints and terrain weights, I transformed a standard computer science exercise into a practical tool for mechatronics logic, proving that efficient software design is crucial for optimal physical hardware execution.