Skip to content

Commit

Permalink
support no obstacle in RRT* (AtsushiSakai#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
mahyaret authored Aug 11, 2020
1 parent 765f752 commit 6d29bcd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions PathPlanning/RRTStar/rrt_star.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ def planning(self, animation=True, search_until_max_iter=True):

if (not search_until_max_iter) and new_node: # check reaching the goal
last_index = self.search_best_goal_node()
if last_index:
if last_index is not None:
return self.generate_final_course(last_index)

print("reached max iteration")

last_index = self.search_best_goal_node()
if last_index:
if last_index is not None:
return self.generate_final_course(last_index)

return None
Expand Down
11 changes: 11 additions & 0 deletions tests/test_rrt_star.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,18 @@ def test1(self):
m.show_animation = False
m.main()

def test_no_obstacle(self):
obstacle_list = []

# Set Initial parameters
rrt_star = m.RRTStar(start=[0, 0],
goal=[6, 10],
rand_area=[-2, 15],
obstacle_list=obstacle_list)
path = rrt_star.planning(animation=False)
assert path is not None

if __name__ == '__main__': # pragma: no cover
test = Test()
test.test1()
test.test_no_obstacle()

0 comments on commit 6d29bcd

Please sign in to comment.