mirror of
https://github.com/AtsushiSakai/PythonRobotics.git
synced 2026-04-22 03:00:41 -04:00
support no obstacle in RRT* (#375)
This commit is contained in:
committed by
GitHub
parent
765f752165
commit
6d29bcd97d
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user