Skip to content
This repository was archived by the owner on Nov 13, 2025. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ flight_interface:
timeout: 30.0 # seconds
baud_rate: 57600 # symbol rate
worker_period: 0.1 # seconds
enable_hitl: false # bool
images_path: "tests/brightspot_example" # file path

data_merge:
timeout: 60.0 # seconds
Expand Down
17 changes: 15 additions & 2 deletions main_2025.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -129,14 +130,20 @@ 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

FLIGHT_INTERFACE_ADDRESS = config["flight_interface"]["address"]
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"]
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"]

Expand Down Expand Up @@ -293,6 +300,8 @@ def main() -> int:
FLIGHT_INTERFACE_TIMEOUT,
FLIGHT_INTERFACE_BAUD_RATE,
FLIGHT_INTERFACE_WORKER_PERIOD,
FLIGHT_INTERFACE_ENABLE_HITL,
FLIGHT_INTERFACE_IMAGES_PATH,
LOG_TIMINGS,
),
input_queues=[
Expand Down Expand Up @@ -378,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,
Expand Down
6 changes: 3 additions & 3 deletions modules/auto_landing/auto_landing.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 11 additions & 1 deletion modules/flight_interface/flight_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,23 @@ def create(
timeout_home: float,
baud_rate: int,
local_logger: logger.Logger,
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
Expand Down
4 changes: 3 additions & 1 deletion modules/flight_interface/flight_interface_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ def flight_interface_worker(
timeout: float,
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,
Expand Down Expand Up @@ -49,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)
Expand Down
4 changes: 2 additions & 2 deletions requirements-pytorch.txt
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions tests/integration/test_flight_interface_hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/test_flight_interface_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down
Loading