Skip to content

Commit 1ac3a98

Browse files
committed
Fixed CI Issue
1 parent 745fb02 commit 1ac3a98

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

modules/bootcamp/decision_waypoint_landing_pads.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
from .. import commands
88
from .. import drone_report
9-
import math
109

1110
# Disable for bootcamp use
1211
# pylint: disable-next=unused-import
@@ -101,20 +100,20 @@ def run(
101100

102101
# stuff when landed @ waypoint
103102
closest_location = None
104-
min_distance = float("inf")
103+
min_distance_sq = float("inf")
105104

106-
for location in landing_pad_locations:
105+
for pad_location in landing_pad_locations:
107106
print("report position: " + str(report.position))
108-
print(str(location))
107+
print(str(pad_location))
109108

110-
distance = math.sqrt(
111-
(report.position.location_x - location.location_x) ** 2
112-
+ (report.position.location_y - location.location_y) ** 2
113-
)
109+
# no square root!
110+
distance_sq = (report.position.location_x - pad_location.location_x) ** 2 + (
111+
report.position.location_y - pad_location.location_y
112+
) ** 2
114113

115-
if distance < min_distance:
116-
min_distance = distance
117-
closest_location = location
114+
if distance_sq < min_distance_sq:
115+
min_distance_sq = distance_sq
116+
closest_location = pad_location
118117

119118
if closest_location is not None:
120119
command = commands.Command.create_set_relative_destination_command(

0 commit comments

Comments
 (0)