From 59041a49c739e1af0833d817a6306d23482f5836 Mon Sep 17 00:00:00 2001 From: Adityya Kaushal Date: Thu, 18 Sep 2025 02:42:10 -0400 Subject: [PATCH 1/5] Initial commit (REQUIREMENT VERSION MISMATCH) --- config.yaml | 1 + main_2025.py | 3 +++ modules/flight_interface/flight_interface.py | 1 + modules/flight_interface/flight_interface_worker.py | 1 + requirements-pytorch.txt | 4 ++-- 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/config.yaml b/config.yaml index af4d4dd8..8df164cc 100644 --- a/config.yaml +++ b/config.yaml @@ -56,6 +56,7 @@ flight_interface: timeout: 30.0 # seconds baud_rate: 57600 # symbol rate worker_period: 0.1 # seconds + enable_hitl: false # bool data_merge: timeout: 60.0 # seconds diff --git a/main_2025.py b/main_2025.py index 1f43b8f3..21332e71 100644 --- a/main_2025.py +++ b/main_2025.py @@ -50,6 +50,7 @@ def main() -> int: action="store_true", help="option to show annotated image", ) + parser.add_argument("--enable-hitl", action="store_true", help="enable the hitl workflow") args = parser.parse_args() # Configuration settings @@ -137,6 +138,7 @@ def main() -> int: FLIGHT_INTERFACE_TIMEOUT = config["flight_interface"]["timeout"] FLIGHT_INTERFACE_BAUD_RATE = config["flight_interface"]["baud_rate"] FLIGHT_INTERFACE_WORKER_PERIOD = config["flight_interface"]["worker_period"] + FLIGHT_INTERFACE_ENABLE_HITL = config["flight_interface"]["enable_hitl"] DATA_MERGE_TIMEOUT = config["data_merge"]["timeout"] @@ -293,6 +295,7 @@ def main() -> int: FLIGHT_INTERFACE_TIMEOUT, FLIGHT_INTERFACE_BAUD_RATE, FLIGHT_INTERFACE_WORKER_PERIOD, + FLIGHT_INTERFACE_ENABLE_HITL, LOG_TIMINGS, ), input_queues=[ diff --git a/modules/flight_interface/flight_interface.py b/modules/flight_interface/flight_interface.py index df857245..ac7f6ae0 100644 --- a/modules/flight_interface/flight_interface.py +++ b/modules/flight_interface/flight_interface.py @@ -25,6 +25,7 @@ def create( timeout_home: float, baud_rate: int, local_logger: logger.Logger, + enable_hitl: bool = False, ) -> "tuple[bool, FlightInterface | None]": """ address: TCP address or port. diff --git a/modules/flight_interface/flight_interface_worker.py b/modules/flight_interface/flight_interface_worker.py index 1b420389..e33474d6 100644 --- a/modules/flight_interface/flight_interface_worker.py +++ b/modules/flight_interface/flight_interface_worker.py @@ -18,6 +18,7 @@ def flight_interface_worker( timeout: float, baud_rate: int, period: float, + enable_hitl: bool, log_timings: bool, input_queue: queue_proxy_wrapper.QueueProxyWrapper, coordinates_input_queue: queue_proxy_wrapper.QueueProxyWrapper, diff --git a/requirements-pytorch.txt b/requirements-pytorch.txt index f85de84d..080c64db 100644 --- a/requirements-pytorch.txt +++ b/requirements-pytorch.txt @@ -1,5 +1,5 @@ # For any non-Jetson computer (i.e. all developers) --extra-index-url https://download.pytorch.org/whl/cu124 -torch==2.4.1 -torchvision==0.19.1 +torch==2.7.0 +torchvision==0.22.0 ultralytics From 2582f735fb73209afa6538e0bb1d3d07f09fb1ad Mon Sep 17 00:00:00 2001 From: Adityya Kaushal Date: Thu, 18 Sep 2025 03:17:58 -0400 Subject: [PATCH 2/5] fix: Updated common submodule + added string path for images --- config.yaml | 1 + main_2025.py | 9 +++++++-- modules/common | 2 +- modules/flight_interface/flight_interface.py | 11 +++++++++-- modules/flight_interface/flight_interface_worker.py | 3 ++- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/config.yaml b/config.yaml index 8df164cc..3d8d0f83 100644 --- a/config.yaml +++ b/config.yaml @@ -57,6 +57,7 @@ flight_interface: baud_rate: 57600 # symbol rate worker_period: 0.1 # seconds enable_hitl: false # bool + images_path: "./tests/integration/" # file path data_merge: timeout: 60.0 # seconds diff --git a/main_2025.py b/main_2025.py index 21332e71..618b90b1 100644 --- a/main_2025.py +++ b/main_2025.py @@ -50,7 +50,7 @@ def main() -> int: action="store_true", help="option to show annotated image", ) - parser.add_argument("--enable-hitl", action="store_true", help="enable the hitl workflow") + parser.add_argument("--enable_hitl", action="store_true", help="enable the hitl workflow") args = parser.parse_args() # Configuration settings @@ -138,7 +138,11 @@ def main() -> int: FLIGHT_INTERFACE_TIMEOUT = config["flight_interface"]["timeout"] FLIGHT_INTERFACE_BAUD_RATE = config["flight_interface"]["baud_rate"] FLIGHT_INTERFACE_WORKER_PERIOD = config["flight_interface"]["worker_period"] - FLIGHT_INTERFACE_ENABLE_HITL = config["flight_interface"]["enable_hitl"] + if args.enable_hitl: + FLIGHT_INTERFACE_ENABLE_HITL = True + else: + FLIGHT_INTERFACE_ENABLE_HITL = config["flight_interface"]["enable_hitl"] + FLIGHT_INTERFACE_IMAGES_PATH = config["flight_interface"]["images_path"] DATA_MERGE_TIMEOUT = config["data_merge"]["timeout"] @@ -296,6 +300,7 @@ def main() -> int: FLIGHT_INTERFACE_BAUD_RATE, FLIGHT_INTERFACE_WORKER_PERIOD, FLIGHT_INTERFACE_ENABLE_HITL, + FLIGHT_INTERFACE_IMAGES_PATH, LOG_TIMINGS, ), input_queues=[ diff --git a/modules/common b/modules/common index a48579ef..14dae387 160000 --- a/modules/common +++ b/modules/common @@ -1 +1 @@ -Subproject commit a48579ef93b187e0a6b72ca941108866e270f089 +Subproject commit 14dae3875b4594178a2da6eeccb9354b7ba79ad3 diff --git a/modules/flight_interface/flight_interface.py b/modules/flight_interface/flight_interface.py index ac7f6ae0..fe6b16e6 100644 --- a/modules/flight_interface/flight_interface.py +++ b/modules/flight_interface/flight_interface.py @@ -25,14 +25,21 @@ def create( timeout_home: float, baud_rate: int, local_logger: logger.Logger, - enable_hitl: bool = False, + images_path: str | None, + enable_hitl: bool, ) -> "tuple[bool, FlightInterface | None]": """ address: TCP address or port. timeout_home: Timeout for home location in seconds. baud_rate: Baud rate for the connection. """ - result, controller = flight_controller.FlightController.create(address, baud_rate) + if enable_hitl: + if images_path is None: + return False, None + result, controller = flight_controller.FlightController.create(address, baud_rate, enable_hitl, images_path=images_path) + else: + result, controller = flight_controller.FlightController.create(address, baud_rate) + if not result: local_logger.error("controller could not be created", True) return False, None diff --git a/modules/flight_interface/flight_interface_worker.py b/modules/flight_interface/flight_interface_worker.py index e33474d6..103d0536 100644 --- a/modules/flight_interface/flight_interface_worker.py +++ b/modules/flight_interface/flight_interface_worker.py @@ -19,6 +19,7 @@ def flight_interface_worker( baud_rate: int, period: float, enable_hitl: bool, + images_path: str | None, log_timings: bool, input_queue: queue_proxy_wrapper.QueueProxyWrapper, coordinates_input_queue: queue_proxy_wrapper.QueueProxyWrapper, @@ -50,7 +51,7 @@ def flight_interface_worker( local_logger.info("Logger initialized", True) result, interface = flight_interface.FlightInterface.create( - address, timeout, baud_rate, local_logger + address, timeout, baud_rate, local_logger, images_path, enable_hitl ) if not result: local_logger.error("Worker failed to create class object", True) From 20e15fad27eef8b979486ef0550b68ba473ef1fe Mon Sep 17 00:00:00 2001 From: Adityya Kaushal Date: Thu, 18 Sep 2025 03:18:29 -0400 Subject: [PATCH 3/5] fix: Formatted for CI/CD --- modules/auto_landing/auto_landing.py | 6 +++--- modules/flight_interface/flight_interface.py | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/auto_landing/auto_landing.py b/modules/auto_landing/auto_landing.py index be596d3c..14df6def 100644 --- a/modules/auto_landing/auto_landing.py +++ b/modules/auto_landing/auto_landing.py @@ -1,6 +1,6 @@ -""" -Auto-landing script that calculates the necessary parameters -for use with LANDING_TARGET MAVLink command. +""" +Auto-landing script that calculates the necessary parameters +for use with LANDING_TARGET MAVLink command. """ import math diff --git a/modules/flight_interface/flight_interface.py b/modules/flight_interface/flight_interface.py index fe6b16e6..61c1a1c2 100644 --- a/modules/flight_interface/flight_interface.py +++ b/modules/flight_interface/flight_interface.py @@ -36,7 +36,9 @@ def create( if enable_hitl: if images_path is None: return False, None - result, controller = flight_controller.FlightController.create(address, baud_rate, enable_hitl, images_path=images_path) + result, controller = flight_controller.FlightController.create( + address, baud_rate, enable_hitl, images_path=images_path + ) else: result, controller = flight_controller.FlightController.create(address, baud_rate) From f97ab9070c9c92778a647d0e2cced5cb6f841b24 Mon Sep 17 00:00:00 2001 From: Adityya Kaushal Date: Fri, 19 Sep 2025 14:18:01 -0400 Subject: [PATCH 4/5] fix: updated image file path to source from brightspot detection examples --- config.yaml | 2 +- main_2025.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/config.yaml b/config.yaml index 3d8d0f83..afe5c1c9 100644 --- a/config.yaml +++ b/config.yaml @@ -57,7 +57,7 @@ flight_interface: baud_rate: 57600 # symbol rate worker_period: 0.1 # seconds enable_hitl: false # bool - images_path: "./tests/integration/" # file path + images_path: "tests/brightspot_example" # file path data_merge: timeout: 60.0 # seconds diff --git a/main_2025.py b/main_2025.py index 618b90b1..45bc9ac1 100644 --- a/main_2025.py +++ b/main_2025.py @@ -130,7 +130,8 @@ def main() -> int: ) case _: main.logger.error( - f"Inputted an invalid detect target option: {DETECT_TARGET_OPTION}", True + f"Inputted an invalid detect target option: {DETECT_TARGET_OPTION}", + True, ) return -1 @@ -386,7 +387,11 @@ def main() -> int: result, communications_worker_properties = worker_manager.WorkerProperties.create( count=1, target=communications_worker.communications_worker, - work_arguments=(COMMUNICATIONS_TIMEOUT, COMMUNICATIONS_WORKER_PERIOD, LOG_TIMINGS), + work_arguments=( + COMMUNICATIONS_TIMEOUT, + COMMUNICATIONS_WORKER_PERIOD, + LOG_TIMINGS, + ), input_queues=[ flight_interface_to_communications_queue, cluster_estimation_to_communications_queue, From 0e99acdc5037d9b7381def8d3919768f2846bc25 Mon Sep 17 00:00:00 2001 From: Adityya Kaushal Date: Mon, 22 Sep 2025 20:00:22 -0400 Subject: [PATCH 5/5] fix: pylint --- tests/integration/test_flight_interface_hardware.py | 5 +++++ tests/integration/test_flight_interface_worker.py | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/tests/integration/test_flight_interface_hardware.py b/tests/integration/test_flight_interface_hardware.py index 654d5134..a0f6ce72 100644 --- a/tests/integration/test_flight_interface_hardware.py +++ b/tests/integration/test_flight_interface_hardware.py @@ -11,6 +11,9 @@ MAVLINK_CONNECTION_ADDRESS = "tcp:localhost:14550" FLIGHT_INTERFACE_TIMEOUT = 10.0 # seconds FLIGHT_INTERFACE_BAUD_RATE = 57600 # symbol rate +FLIGHT_INTERFACE_WORKER_PERIOD = 0.1 # seconds +FLIGHT_ENABLE_HITL = False # bool +FLIGHT_IMAGE_PATH = "tests/brightspot_example" # file path def main() -> int: @@ -29,6 +32,8 @@ def main() -> int: FLIGHT_INTERFACE_TIMEOUT, FLIGHT_INTERFACE_BAUD_RATE, local_logger, + FLIGHT_IMAGE_PATH, + FLIGHT_ENABLE_HITL, ) assert result assert interface is not None diff --git a/tests/integration/test_flight_interface_worker.py b/tests/integration/test_flight_interface_worker.py index 97ea874a..472b3336 100644 --- a/tests/integration/test_flight_interface_worker.py +++ b/tests/integration/test_flight_interface_worker.py @@ -17,6 +17,8 @@ FLIGHT_INTERFACE_TIMEOUT = 10.0 # seconds FLIGHT_INTERFACE_BAUD_RATE = 57600 # symbol rate FLIGHT_INTERFACE_WORKER_PERIOD = 0.1 # seconds +FLIGHT_ENABLE_HITL = False # bool +FLIGHT_IMAGE_PATH = "tests/brightspot_example" # file path def apply_decision_test( @@ -115,6 +117,8 @@ def main() -> int: FLIGHT_INTERFACE_TIMEOUT, FLIGHT_INTERFACE_BAUD_RATE, FLIGHT_INTERFACE_WORKER_PERIOD, + FLIGHT_ENABLE_HITL, + FLIGHT_IMAGE_PATH, in_queue, # Added input_queue communications_in_queue, out_queue,