From 03304b0c9f48e1ccb7e7556d577c3a92dff97609 Mon Sep 17 00:00:00 2001 From: Soham Dave Date: Tue, 24 Sep 2024 21:30:04 -0400 Subject: [PATCH] Add files via upload --- decision_simple_waypoint.py | 10 +++++----- decision_waypoint_landing_pads.py | 4 ++-- detect_landing_pad.py | 4 +--- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/decision_simple_waypoint.py b/decision_simple_waypoint.py index 006b64b0..7f46312e 100644 --- a/decision_simple_waypoint.py +++ b/decision_simple_waypoint.py @@ -37,10 +37,9 @@ def __init__(self, waypoint: location.Location, acceptance_radius: float) -> Non # ↓ BOOTCAMPERS MODIFY BELOW THIS COMMENT ↓ # ============ - self.waypoint_found =False + self.waypoint_found = False self.landing_pad_found = False - # ============ # ↑ BOOTCAMPERS MODIFY ABOVE THIS COMMENT ↑ # ============ @@ -82,9 +81,10 @@ def run( if distance_squared < self.acceptance_radius**2: command = commands.Command.create_land_command() print("The drone is within the accepted range") - else: command = commands.Command.create_set_relative_destination_command( - destination_x, destination_y - ) + else: + command = commands.Command.create_set_relative_destination_command( + destination_x, destination_y + ) print(f"Moving to waypoint{waypoint.location_x},{waypoint.location_y}") # ============ diff --git a/decision_waypoint_landing_pads.py b/decision_waypoint_landing_pads.py index 172ad801..b98cffa2 100644 --- a/decision_waypoint_landing_pads.py +++ b/decision_waypoint_landing_pads.py @@ -61,9 +61,9 @@ def at_point(self, current_x: float, current_y: float) -> bool: bool: True if the drone is within the acceptance radius, False otherwise. """ distance_squared = (self.waypoint.location_x - current_x) ** 2 + ( - self.waypoint.location_y - current_y + self.waypoint.location_y - current_y ) ** 2 - return distance_squared <= self.acceptance_radius ** 2 + return distance_squared <= self.acceptance_radius**2 def run( self, report: drone_report.DroneReport, landing_pad_locations: "list[location.Location]" diff --git a/detect_landing_pad.py b/detect_landing_pad.py index 2b495054..bcd76c4b 100644 --- a/detect_landing_pad.py +++ b/detect_landing_pad.py @@ -100,7 +100,7 @@ def run(self, image: np.ndarray) -> "tuple[list[bounding_box.BoundingBox], np.nd # * verbose # conf threshold is around 0.7 predictions = self.__model.predict( - source=image, conf=0.7, device=self.__DEVICE, verbose =False + source=image, conf=0.7, device=self.__DEVICE, verbose=False ) # Get the Result object @@ -129,10 +129,8 @@ def run(self, image: np.ndarray) -> "tuple[list[bounding_box.BoundingBox], np.nd if not success: continue - return [], image_annotated - # ============ # ↑ BOOTCAMPERS MODIFY ABOVE THIS COMMENT ↑ # ============