Skip to content

Commit ad19902

Browse files
committed
Fixed for Linter Errors
1 parent 2b5d668 commit ad19902

File tree

4 files changed

+24
-13
lines changed

4 files changed

+24
-13
lines changed

modules/bootcamp/decision_simple_waypoint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def run(
6969
# ↓ BOOTCAMPERS MODIFY BELOW THIS COMMENT ↓
7070
# ============
7171

72-
# Check the report to see what the status of the drone is
72+
# Check the report to see what the status of the drone is
7373
if report.status == drone_status.DroneStatus.HALTED:
7474

7575
# First check whether it has gotten to the waypoint
@@ -85,7 +85,7 @@ def run(
8585
else:
8686
command = commands.Command.create_land_command()
8787

88-
#raise NotImplementedError
88+
# raise NotImplementedError
8989

9090
# ============
9191
# ↑ BOOTCAMPERS MODIFY ABOVE THIS COMMENT ↑

modules/bootcamp/decision_waypoint_landing_pads.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,31 +81,40 @@ def run(
8181
elif not self.landpad_reached:
8282
# Find the closest pad and store it in closest_landpad
8383
# This is using the min() method to iterate through each pad, get the distance to it and compare it with others
84-
closest_pad = min(landing_pad_locations, key=lambda pad: self.get_distance(report.position, pad))
84+
closest_pad = min(
85+
landing_pad_locations, key=lambda pad: self.get_distance(report.position, pad)
86+
)
8587
print(f"Closest Landpad: {closest_pad.location_x}, {closest_pad.location_y}")
8688

8789
# Move to the closest landpad
8890
x_dist = closest_pad.location_x - report.position.location_x
8991
y_dist = closest_pad.location_y - report.position.location_y
90-
#print(f"{x_dist}, {y_dist}")
92+
# print(f"{x_dist}, {y_dist}")
9193
command = commands.Command.create_set_relative_destination_command(x_dist, y_dist)
92-
94+
9395
self.landpad_reached = True
9496

9597
else:
9698
command = commands.Command.create_land_command()
9799

98-
#raise NotImplementedError
100+
# raise NotImplementedError
99101

100102
return command
101-
103+
102104
# Method used to check distance sqaured between two locations
103105
# We don't need the square root since this is for comparison only
104-
def get_distance(self, loc_1: location.Location, loc_2: location.Location):
106+
def get_distance(self, loc_1: location.Location, loc_2: location.Location) -> float:
107+
"""
108+
This method is used to get the distance squared between any two locations
109+
110+
"""
111+
x = loc_1.location_x - loc_2.location_x
112+
y = loc_1.location_y - loc_2.location_y
113+
105114
# Don't need to square root when comparing between squares
106-
hypotenuse_squared = (loc_1.location_x - loc_2.location_x) ** 2 + (loc_1.location_y - loc_2.location_y) ** 2
115+
hypotenuse_squared = (x**2) + (y**2)
107116
return hypotenuse_squared
108-
117+
109118
# ============
110119
# ↑ BOOTCAMPERS MODIFY ABOVE THIS COMMENT ↑
111-
# ============
120+
# ============

modules/bootcamp/detect_landing_pad.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ def run(self, image: np.ndarray) -> "tuple[list[bounding_box.BoundingBox], np.nd
9595
# * conf
9696
# * device
9797
# * verbose
98-
predictions = self.__model.predict(source=image, conf=0.7, device=self.__DEVICE, verbose=False)
98+
predictions = self.__model.predict(
99+
source=image, conf=0.7, device=self.__DEVICE, verbose=False
100+
)
99101

100102
# Get the Result object
101103
# Only 1 image was used therefore we access the first result in the list

modules/bootcamp/tests/run_decision_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# to reach the 1st command
2222
# Increase the step size if your computer is lagging
2323
# Larger step size is smaller FPS
24-
TIME_STEP_SIZE = 0.15 # seconds
24+
TIME_STEP_SIZE = 0.15 # seconds
2525

2626
# OpenCV ignores your display settings,
2727
# so if the window is too small or too large,

0 commit comments

Comments
 (0)