Skip to content

Commit 16dc71d

Browse files
committed
init variable
1 parent 0cc9e1d commit 16dc71d

2 files changed

Lines changed: 1 addition & 9 deletions

File tree

GEMstack/onboard/perception/cone_detection_parking.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ def viz_object_states(self,
243243

244244

245245
def detect_parking_spot(self, cone_3d_centers):
246+
closest_parking_spot = None
246247
cone_ground_centers = np.array(cone_3d_centers)
247248
cone_ground_centers_2D = cone_ground_centers[:, :2]
248249
ordered_cone_ground_centers_2D = self.order_points_convex_hull(cone_ground_centers_2D)

GEMstack/onboard/perception/parking_utils.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import cv2
2-
import os
32
import numpy as np
43

54

@@ -41,30 +40,25 @@ def mouse_callback(event, x, y, flags, param):
4140
clicked_pts.clear()
4241

4342
cv2.destroyAllWindows()
44-
4543
return np.array(clicked_pts, dtype=np.float32)
4644

4745

48-
4946
def distPoint2LineAB(p, a, b):
5047
pa = p - a
5148
pb = p - b
5249
ba = b - a
53-
5450
dist = np.abs(np.cross(pa, pb)) / np.linalg.norm(ba)
5551
return dist
5652

5753

5854
def calculateCandidateScore(pose, cornerPoints):
5955
position = pose[0:2]
60-
6156
score = np.min([
6257
distPoint2LineAB(position, cornerPoints[0], cornerPoints[1]),
6358
distPoint2LineAB(position, cornerPoints[1], cornerPoints[2]),
6459
distPoint2LineAB(position, cornerPoints[2], cornerPoints[3]),
6560
distPoint2LineAB(position, cornerPoints[3], cornerPoints[0]),
6661
])
67-
6862
return score
6963

7064

@@ -88,7 +82,6 @@ def cvtPose2CarBox(carPose):
8882

8983
def find_all_candidate_parking_spots(cornerPts, angleStepDegree=10, positionStrideMeter=0.5):
9084
cornerPts = np.array(cornerPts, dtype=np.float32)
91-
9285
min_x = np.min(cornerPts[:, 0]) + 0.5
9386
max_x = np.max(cornerPts[:, 0]) - 0.5
9487
min_y = np.min(cornerPts[:, 1]) + 0.5
@@ -111,7 +104,6 @@ def find_all_candidate_parking_spots(cornerPts, angleStepDegree=10, positionStri
111104

112105
if judgeRectInPolygon(car_box_shifted, cornerPts):
113106
candidates.append((cx, cy, angleDegree))
114-
115107
return candidates
116108

117109

@@ -137,7 +129,6 @@ def drawCarPose(img, center, angleDegree, color=(0, 0, 255), scale=100):
137129
rect = (center, (GEM_E4_LENGTH, GEM_E4_WIDTH), float(angleDegree))
138130
box = cv2.boxPoints(rect)
139131
box_scaled = np.int32(box * scale)
140-
141132
cv2.polylines(img, [box_scaled], isClosed=True, color=color, thickness=2)
142133

143134

0 commit comments

Comments
 (0)