Update loop conditions to be more idiomatic; fix missing imports (#768)

* missing import

* use while true
This commit is contained in:
Andrey Bozhko
2023-01-01 05:44:34 -06:00
committed by GitHub
parent 1d683435c6
commit 2916273e62
10 changed files with 10 additions and 9 deletions

View File

@@ -162,7 +162,7 @@ class LShapeFitting:
S.append(C)
# Merge cluster
while 1:
while True:
no_change = True
for (c1, c2) in list(itertools.permutations(range(len(S)), 2)):
if S[c1] & S[c2]:

View File

@@ -71,7 +71,7 @@ class AStarPlanner:
open_set, closed_set = dict(), dict()
open_set[self.calc_grid_index(start_node)] = start_node
while 1:
while True:
if len(open_set) == 0:
print("Open set is empty..")
break

View File

@@ -75,7 +75,7 @@ class BidirectionalAStarPlanner:
current_B = goal_node
meet_point_A, meet_point_B = None, None
while 1:
while True:
if len(open_set_A) == 0:
print("Open set A is empty..")
break

View File

@@ -76,7 +76,7 @@ class BidirectionalBreadthFirstSearchPlanner:
meet_point_A, meet_point_B = None, None
while 1:
while True:
if len(open_set_A) == 0:
print("Open set A is empty..")
break

View File

@@ -67,7 +67,7 @@ class BreadthFirstSearchPlanner:
open_set, closed_set = dict(), dict()
open_set[self.calc_grid_index(nstart)] = nstart
while 1:
while True:
if len(open_set) == 0:
print("Open set is empty..")
break

View File

@@ -67,7 +67,7 @@ class DepthFirstSearchPlanner:
open_set, closed_set = dict(), dict()
open_set[self.calc_grid_index(nstart)] = nstart
while 1:
while True:
if len(open_set) == 0:
print("Open set is empty..")
break

View File

@@ -71,7 +71,7 @@ class Dijkstra:
open_set, closed_set = dict(), dict()
open_set[self.calc_index(start_node)] = start_node
while 1:
while True:
c_id = min(open_set, key=lambda o: open_set[o].cost)
current = open_set[c_id]

View File

@@ -67,7 +67,7 @@ class BestFirstSearchPlanner:
open_set, closed_set = dict(), dict()
open_set[self.calc_grid_index(nstart)] = nstart
while 1:
while True:
if len(open_set) == 0:
print("Open set is empty..")
break

View File

@@ -65,7 +65,7 @@ def calc_distance_heuristic(gx, gy, ox, oy, resolution, rr):
open_set[calc_index(goal_node, x_w, min_x, min_y)] = goal_node
priority_queue = [(0, calc_index(goal_node, x_w, min_x, min_y))]
while 1:
while True:
if not priority_queue:
break
cost, c_id = heapq.heappop(priority_queue)

View File

@@ -1,4 +1,5 @@
from Mapping.grid_map_lib.grid_map_lib import GridMap
import conftest
import numpy as np