Skip to content

Commit 8f63c88

Browse files
committed
Revert "add logic for saving animation as gif"
This reverts commit 6391677.
1 parent e49b6cf commit 8f63c88

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

PathPlanning/TimeBasedPathPlanning/Plotting.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import imageio.v2 as imageio
21
import numpy as np
32
import matplotlib.pyplot as plt
43
from PathPlanning.TimeBasedPathPlanning.GridWithDynamicObstacles import (
@@ -45,7 +44,7 @@ def PlotNodePath(grid: Grid, start: Position, goal: Position, path: NodePath):
4544
'''
4645
Plot a series of agent paths.
4746
'''
48-
def PlotNodePaths(grid: Grid, start_and_goals: list[StartAndGoal], paths: list[NodePath], save_gif: bool = False):
47+
def PlotNodePaths(grid: Grid, start_and_goals: list[StartAndGoal], paths: list[NodePath]):
4948
fig = plt.figure(figsize=(10, 7))
5049

5150
ax = fig.add_subplot(
@@ -99,12 +98,7 @@ def PlotNodePaths(grid: Grid, start_and_goals: list[StartAndGoal], paths: list[N
9998
max_time = max(path.goal_reached_time() for path in paths)
10099

101100
# Animation loop
102-
frames = []
103101
for i in range(0, max_time + 1):
104-
if save_gif:
105-
plt.savefig(f"frame_{i:03d}.png") # Save each frame as an image
106-
frames.append(imageio.imread(f"frame_{i:03d}.png"))
107-
108102
# Update obstacle positions
109103
obs_positions = grid.get_obstacle_positions_at_time(i)
110104
obs_points.set_data(obs_positions[0], obs_positions[1])
@@ -128,7 +122,4 @@ def PlotNodePaths(grid: Grid, start_and_goals: list[StartAndGoal], paths: list[N
128122

129123
plt.pause(0.2)
130124

131-
if save_gif:
132-
imageio.mimsave("path_animation2.gif", frames, fps=5) # Convert images to GIF
133-
134125
plt.show()

0 commit comments

Comments
 (0)