Skip to content

Commit 5e765e4

Browse files
committed
fix gif rendering issues
1 parent 89192f9 commit 5e765e4

1 file changed

Lines changed: 71 additions & 1 deletion

File tree

docs/modules/5_path_planning/dynamic_bfs_maze_solver/dynamic_bfs_maze_solver_main.rst

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,33 @@ Overview
1111
This example demonstrates a **dynamic maze-solving algorithm** based on the **Breadth-First Search (BFS)** strategy.
1212
The visualizer dynamically updates a maze in real time while the solver attempts to reach a moving target.
1313

14-
A sample animation frame:
14+
Features
15+
~~~~~~~~
16+
17+
- **Dynamic Maze Solving**: Real-time BFS pathfinding on a grid
18+
- **Moving Target**: The target position changes dynamically during the search
19+
- **Evolving Obstacles**: Obstacles can appear/disappear randomly during execution
20+
- **Visual Feedback**:
21+
22+
- Black dots represent obstacles
23+
- Solver position is shown with live updates
24+
- Path visualization shows the solution trajectory
25+
- Breadcrumb trail displays the solver's movement history
26+
27+
Sample Animation
28+
~~~~~~~~~~~~~~~~
29+
30+
A sample animation frame from the dynamic maze solver:
1531

1632
.. image:: https://github.com/AtsushiSakai/PythonRoboticsGifs/raw/master/PathPlanning/DynamicMazeSolver/animation.gif
33+
:width: 600
34+
:align: center
35+
36+
The visualization shows:
37+
- **Grid Layout**: The maze environment with obstacles (black points)
38+
- **Target**: Red/green markers indicating the goal position
39+
- **Path**: The solution path traced by the BFS algorithm
40+
- **Real-time Updates**: Continuous animation showing the solver in action
1741

1842
Algorithmic Background
1943
----------------------
@@ -29,6 +53,52 @@ The BFS algorithm is a graph traversal method that explores nodes in layers, gua
2953
3054
where R and C denote the number of rows and columns in the grid.
3155

56+
Usage Example
57+
~~~~~~~~~~~~~
58+
59+
To run the dynamic maze solver:
60+
61+
.. code-block:: python
62+
63+
from PathPlanning.DynamicMazeSolver.dynamic_maze_solver import MazeVisualizer
64+
65+
# Define the maze (0 = free space, 1 = obstacle)
66+
initial_maze = [
67+
[0, 1, 0, 0, 0, 0, 0, 0, 1, 0],
68+
[0, 1, 0, 1, 1, 0, 1, 0, 1, 0],
69+
[0, 0, 0, 1, 0, 0, 1, 0, 0, 0],
70+
[0, 1, 0, 1, 0, 1, 1, 1, 1, 0],
71+
[0, 1, 0, 0, 0, 0, 0, 0, 1, 0],
72+
[0, 1, 1, 1, 1, 1, 1, 0, 1, 0],
73+
[0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
74+
[1, 1, 1, 1, 0, 1, 1, 1, 1, 0],
75+
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
76+
]
77+
78+
# Set start and end points
79+
start_point = (0, 0)
80+
end_point = (8, 9)
81+
82+
# Create visualizer and run
83+
visualizer = MazeVisualizer(initial_maze, start_point, end_point)
84+
visualizer.run()
85+
86+
Expected Output
87+
~~~~~~~~~~~~~~~
88+
89+
When you run the solver, you will see an interactive matplotlib window displaying:
90+
91+
- **Grid with Obstacles**: Black points representing walls and obstacles
92+
- **Start Position**: Marked at the initial coordinates
93+
- **Target Position**: The goal location (changes dynamically)
94+
- **Solver Path**: The trajectory computed by BFS algorithm
95+
- **Animation**: Real-time visualization of the pathfinding process
96+
- **Status Bar**: Shows frame count and current path length
97+
98+
The animation continues until either:
99+
- The solver reaches the target position (success)
100+
- The maximum number of frames is reached (500 frames by default)
101+
32102
Code Link
33103
+++++++++
34104

0 commit comments

Comments
 (0)