PythonRobotics Logo

Table of Contents

  • Getting Started
  • Introduction
  • Localization
  • Mapping
  • SLAM
  • Path Planning
    • Dynamic Window Approach
    • Bug planner
    • Grid based search
      • Breadth First Search
        • Code Link
      • Depth First Search
        • Code Link
      • Dijkstra algorithm
        • Code Link
      • A* algorithm
        • Code Link
      • Bidirectional A* algorithm
        • Code Link
      • Theta* algorithm
        • Reference
        • Code Link
      • D* algorithm
        • Code Link
        • Reference
      • D* lite algorithm
        • Code Link
        • Reference
      • Potential Field algorithm
        • Code Link
        • Reference
    • Time based grid search
    • Model Predictive Trajectory Generator
    • State Lattice Planning
    • Probabilistic Road-Map (PRM) planning
    • Visibility Road-Map planner
    • Voronoi Road-Map planning
    • Rapidly-Exploring Random Trees (RRT)
    • Particle Swarm Optimization Path Planning
    • Cubic spline planning
    • B-Spline planning
    • Catmull-Rom Spline Planning
    • Clothoid path planning
    • Eta^3 Spline path planning
    • Bezier path planning
    • Quintic polynomials planning
    • Dubins path planning
    • Reeds Shepp planning
    • LQR based path planning
    • Hybrid a star
    • Optimal Trajectory in a Frenet Frame
    • Coverage path planner
    • Elastic Bands
  • Path Tracking
  • Arm Navigation
  • Aerial Navigation
  • Bipedal
  • Inverted Pendulum
  • Mission Planning
  • Utilities
  • Appendix
PythonRobotics
  • Path Planning
  • Grid based search
  • Edit on GitHub

Grid based search

Breadth First Search

This is a 2D grid based path planning with Breadth first search algorithm.

https://github.com/AtsushiSakai/PythonRoboticsGifs/raw/master/PathPlanning/BreadthFirstSearch/animation.gif

In the animation, cyan points are searched nodes.

Code Link

PathPlanning.BreadthFirstSearch.breadth_first_search.BreadthFirstSearchPlanner(ox, oy, reso, rr)[source]

Depth First Search

This is a 2D grid based path planning with Depth first search algorithm.

https://github.com/AtsushiSakai/PythonRoboticsGifs/raw/master/PathPlanning/DepthFirstSearch/animation.gif

In the animation, cyan points are searched nodes.

Code Link

PathPlanning.DepthFirstSearch.depth_first_search.DepthFirstSearchPlanner(ox, oy, reso, rr)[source]

Dijkstra algorithm

This is a 2D grid based shortest path planning with Dijkstra’s algorithm.

https://github.com/AtsushiSakai/PythonRoboticsGifs/raw/master/PathPlanning/Dijkstra/animation.gif

In the animation, cyan points are searched nodes.

Code Link

PathPlanning.Dijkstra.dijkstra.DijkstraPlanner(ox, oy, resolution, robot_radius)[source]

A* algorithm

This is a 2D grid based shortest path planning with A star algorithm.

https://github.com/AtsushiSakai/PythonRoboticsGifs/raw/master/PathPlanning/AStar/animation.gif

In the animation, cyan points are searched nodes.

Its heuristic is 2D Euclid distance.

Code Link

PathPlanning.AStar.a_star.AStarPlanner(ox, oy, resolution, rr)[source]

Bidirectional A* algorithm

This is a 2D grid based shortest path planning with bidirectional A star algorithm.

https://github.com/AtsushiSakai/PythonRoboticsGifs/raw/master/PathPlanning/BidirectionalAStar/animation.gif

In the animation, cyan points are searched nodes.

Code Link

PathPlanning.BidirectionalAStar.bidirectional_a_star.BidirectionalAStarPlanner(ox, oy, resolution, rr)[source]

Theta* algorithm

This is a 2D grid based shortest path planning with Theta star algorithm.

It offers an optimization over the A star algorithm to generate any-angle paths. Unlike A star, which always assigns the current node as the parent of the successor, Theta star checks for a line-of-sight (unblocked path) from an earlier node (typically the parent of the current node) to the successor, and directly assigns it as a parent if visible. This reduces cost by replacing staggered segments with straight lines.

Checking for line of sight involves verifying that no obstacles block the straight line between two nodes. On a grid, this means identifying all the discrete cells that the line passes through to determine if they are empty. Bresenham’s line algorithm is commonly used for this purpose. Starting from one endpoint, it incrementally steps along one axis, while considering the gradient to determine the position on the other axis. Because it relies only on integer addition and subtraction, it is both efficient and precise for grid-based visibility checks in Theta star.

As a result, Theta star produces shorter, smoother paths than A star, ideal for ground or aerial robots operating in continuous environments where smoother motion enables higher acceleration and reduced travel time.

https://github.com/AtsushiSakai/PythonRoboticsGifs/raw/master/PathPlanning/ThetaStar/animation.gif

In the animation, each cyan arrow represents a node pointing to its parent.

Reference

  • Theta*: Any-Angle Path Planning on Grids

  • Bresenham’s line algorithm

Code Link

PathPlanning.ThetaStar.theta_star.ThetaStarPlanner(ox, oy, resolution, rr)[source]

D* algorithm

This is a 2D grid based shortest path planning with D star algorithm.

https://github.com/AtsushiSakai/PythonRoboticsGifs/raw/master/PathPlanning/DStar/animation.gif

The animation shows a robot finding its path avoiding an obstacle using the D* search algorithm.

Code Link

class PathPlanning.DStar.dstar.Dstar(maps)[source]

Reference

  • D* search Wikipedia

D* lite algorithm

This is a 2D grid based path planning and replanning with D star lite algorithm.

https://github.com/AtsushiSakai/PythonRoboticsGifs/raw/master/PathPlanning/DStarLite/animation.gif

Code Link

class PathPlanning.DStarLite.d_star_lite.DStarLite(ox: list, oy: list)[source]

Reference

  • Improved Fast Replanning for Robot Navigation in Unknown Terrain

Potential Field algorithm

This is a 2D grid based path planning with Potential Field algorithm.

https://github.com/AtsushiSakai/PythonRoboticsGifs/raw/master/PathPlanning/PotentialFieldPlanning/animation.gif

In the animation, the blue heat map shows potential value on each grid.

Code Link

PathPlanning.PotentialFieldPlanning.potential_field_planning.potential_field_planning(sx, sy, gx, gy, ox, oy, reso, rr)[source]

Reference

  • Robotic Motion Planning:Potential Functions

Previous Next

© Copyright 2018-now, Atsushi Sakai.

Built with Sphinx using a theme provided by Read the Docs.