This repository was archived by the owner on Nov 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Complete autonomous landing module #262
Merged
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2f4f5bf
Complete autonomous landing module
danielquzhao 2e93ec1
remove typing import
danielquzhao 1bc3259
remove largest area and nearest to center
danielquzhao 41e3923
Remove command queue and add a constant to config.yaml
danielquzhao 52f1cf1
modify test file
danielquzhao d39db20
Add testing using config.yaml
danielquzhao 26a7ecd
Pass linters
danielquzhao 413e7b1
Update test_auto_landing_worker.py
danielquzhao ec1806b
Formatting
danielquzhao 5c19b44
pass -> continue
danielquzhao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
|
|
||
| import os | ||
| import pathlib | ||
| import queue | ||
| import time | ||
|
|
||
| from utilities.workers import queue_proxy_wrapper | ||
|
|
@@ -18,16 +19,23 @@ def auto_landing_worker( | |
| im_h: float, | ||
| im_w: float, | ||
| period: float, | ||
| detection_strategy: auto_landing.DetectionSelectionStrategy, | ||
| input_queue: queue_proxy_wrapper.QueueProxyWrapper, | ||
| output_queue: queue_proxy_wrapper.QueueProxyWrapper, | ||
| controller: worker_controller.WorkerController, | ||
| ) -> None: | ||
| """ | ||
| Worker process. | ||
| Worker process for auto-landing operations. | ||
|
|
||
| period: Wait time in seconds. | ||
| input_queue and output_queue are data queues. | ||
| controller is how the main process communicates to this worker process. | ||
| fov_x: Horizontal field of view in degrees. | ||
| fov_y: Vertical field of view in degrees. | ||
| im_h: Image height in pixels. | ||
| im_w: Image width in pixels. | ||
| period: Wait time in seconds between processing cycles. | ||
| detection_strategy: Strategy for selecting detection when multiple targets are present. | ||
| input_queue: Queue for receiving merged odometry detections. | ||
| output_queue: Queue for sending auto-landing information. | ||
| controller: Worker controller for pause/exit management. | ||
| """ | ||
|
|
||
| worker_name = pathlib.Path(__file__).stem | ||
|
|
@@ -42,25 +50,33 @@ def auto_landing_worker( | |
|
|
||
| local_logger.info("Logger initialized", True) | ||
|
|
||
| result, auto_lander = auto_landing.AutoLanding.create(fov_x, fov_y, im_h, im_w, local_logger) | ||
|
|
||
| # Create auto-landing instance | ||
| result, auto_lander = auto_landing.AutoLanding.create( | ||
| fov_x, fov_y, im_h, im_w, local_logger, detection_strategy | ||
| ) | ||
| if not result: | ||
| local_logger.error("Worker failed to create class object", True) | ||
| local_logger.error("Worker failed to create AutoLanding object", True) | ||
| return | ||
|
|
||
| # Get Pylance to stop complaining | ||
| assert auto_lander is not None | ||
|
|
||
| local_logger.info("Auto-landing worker initialized successfully", True) | ||
|
|
||
| while not controller.is_exit_requested(): | ||
| controller.check_pause() | ||
|
|
||
| input_data = input_queue.queue.get() | ||
| if input_data is None: | ||
| continue | ||
| # Process detections if available | ||
| input_data = None | ||
| try: | ||
| input_data = input_queue.queue.get_nowait() | ||
| except queue.Empty: | ||
| # No data available, continue | ||
| pass | ||
|
||
|
|
||
| result, value = auto_lander.run(input_data) | ||
| if not result: | ||
| continue | ||
| if input_data is not None: | ||
| result, landing_info = auto_lander.run(input_data) | ||
| if result and landing_info: | ||
| output_queue.queue.put(landing_info) | ||
|
|
||
| output_queue.queue.put(value) | ||
| time.sleep(period) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iffy about first detection because it also runs on the assumption that the first detection is correct, but leaving for now