support no obstacle in RRT* (#375)

This commit is contained in:
Mahyar Abdeetedal
2020-08-11 03:31:45 -04:00
committed by GitHub
parent 765f752165
commit 6d29bcd97d
2 changed files with 13 additions and 2 deletions

View File

@@ -81,13 +81,13 @@ class RRTStar(RRT):
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

View File

@@ -20,7 +20,18 @@ class Test(TestCase):
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()