mirror of
https://github.com/AtsushiSakai/PythonRobotics.git
synced 2026-01-14 04:17:55 -05:00
add gif
This commit is contained in:
@@ -13,8 +13,6 @@ u"""
|
||||
import random
|
||||
import math
|
||||
import copy
|
||||
import matplotrecorder
|
||||
matplotrecorder.donothing = True
|
||||
|
||||
|
||||
class RRT():
|
||||
@@ -149,7 +147,11 @@ class Node():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print("start RRT path planning")
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotrecorder
|
||||
matplotrecorder.donothing = True
|
||||
|
||||
# ====Search Path with RRT====
|
||||
obstacleList = [
|
||||
(5, 5, 1),
|
||||
|
||||
@@ -14,7 +14,6 @@ import math
|
||||
import copy
|
||||
import numpy as np
|
||||
import dubins_path_planning
|
||||
# import matplotrecorder
|
||||
|
||||
|
||||
class RRT():
|
||||
@@ -188,7 +187,7 @@ class RRT():
|
||||
plt.axis([-2, 15, -2, 15])
|
||||
plt.grid(True)
|
||||
plt.pause(0.01)
|
||||
# matplotrecorder.save_frame() # save each frame
|
||||
matplotrecorder.save_frame() # save each frame
|
||||
|
||||
def GetNearestListIndex(self, nodeList, rnd):
|
||||
dlist = [(node.x - rnd[0]) ** 2 +
|
||||
@@ -228,8 +227,10 @@ class Node():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print("Start rrt start planning")
|
||||
print("Start rrt planning")
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotrecorder
|
||||
matplotrecorder.donothing = True
|
||||
# ====Search Path with RRT====
|
||||
obstacleList = [
|
||||
(5, 5, 1),
|
||||
@@ -254,7 +255,7 @@ if __name__ == '__main__':
|
||||
plt.pause(0.001)
|
||||
plt.show()
|
||||
|
||||
# for i in range(10):
|
||||
# matplotrecorder.save_frame() # save each frame
|
||||
for i in range(10):
|
||||
matplotrecorder.save_frame() # save each frame
|
||||
|
||||
# matplotrecorder.save_movie("animation.gif", 0.1)
|
||||
matplotrecorder.save_movie("animation.gif", 0.1)
|
||||
|
||||
BIN
scripts/PathPlanning/RRTstar/animation.gif
Normal file
BIN
scripts/PathPlanning/RRTstar/animation.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 39 MiB |
@@ -13,8 +13,6 @@ import random
|
||||
import math
|
||||
import copy
|
||||
import numpy as np
|
||||
import matplotrecorder
|
||||
matplotrecorder.donothing = False
|
||||
|
||||
|
||||
class RRT():
|
||||
@@ -238,8 +236,11 @@ class Node():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print("Start rrt start planning")
|
||||
print("Start rrt planning")
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotrecorder
|
||||
matplotrecorder.donothing = True
|
||||
|
||||
# ====Search Path with RRT====
|
||||
obstacleList = [
|
||||
(5, 5, 1),
|
||||
@@ -253,7 +254,7 @@ if __name__ == '__main__':
|
||||
# Set Initial parameters
|
||||
rrt = RRT(start=[0, 0], goal=[5, 10],
|
||||
randArea=[-2, 15], obstacleList=obstacleList)
|
||||
path = rrt.Planning(animation=True)
|
||||
path = rrt.Planning(animation=False)
|
||||
|
||||
# Draw final path
|
||||
rrt.DrawGraph()
|
||||
|
||||
Reference in New Issue
Block a user