Skip to content

Commit 6d29bcd

Browse files
authored
support no obstacle in RRT* (AtsushiSakai#375)
1 parent 765f752 commit 6d29bcd

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

PathPlanning/RRTStar/rrt_star.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ def planning(self, animation=True, search_until_max_iter=True):
8181

8282
if (not search_until_max_iter) and new_node: # check reaching the goal
8383
last_index = self.search_best_goal_node()
84-
if last_index:
84+
if last_index is not None:
8585
return self.generate_final_course(last_index)
8686

8787
print("reached max iteration")
8888

8989
last_index = self.search_best_goal_node()
90-
if last_index:
90+
if last_index is not None:
9191
return self.generate_final_course(last_index)
9292

9393
return None

tests/test_rrt_star.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,18 @@ def test1(self):
2020
m.show_animation = False
2121
m.main()
2222

23+
def test_no_obstacle(self):
24+
obstacle_list = []
25+
26+
# Set Initial parameters
27+
rrt_star = m.RRTStar(start=[0, 0],
28+
goal=[6, 10],
29+
rand_area=[-2, 15],
30+
obstacle_list=obstacle_list)
31+
path = rrt_star.planning(animation=False)
32+
assert path is not None
2333

2434
if __name__ == '__main__': # pragma: no cover
2535
test = Test()
2636
test.test1()
37+
test.test_no_obstacle()

0 commit comments

Comments
 (0)