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
Using message_encode_decode to send MAVlink messages #247
Merged
HermanG05
merged 18 commits into
main
from
Use-message_encode_decode-to-send-MAVlink-message-fixed
Feb 6, 2025
Merged
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
fb4418d
Initial commit
HermanG05 4524414
common updates
HermanG05 882eb86
Changed worker_id to enum type in communications
HermanG05 b37f535
Modified config.yaml to include new worker argument
HermanG05 04d0767
Updated common
HermanG05 1f99de0
Fixed common (hopefully)
HermanG05 dbb6446
Updated common
HermanG05 313c324
added argument to flight interface hardware integration test
HermanG05 42e91c7
Modified test_flight_interface_worker to handle new inputs, added exc…
HermanG05 e08f5d3
fixed linting
HermanG05 34ab226
Added message queue to communications, moved checking to inside run()…
HermanG05 dc6f1f3
fixed linting error
HermanG05 7c809a7
removed conditional
HermanG05 f056b62
updated common
HermanG05 7070a1e
moved metadata encoding to run()
HermanG05 485b1fe
removed unnecessary imports
HermanG05 f709292
updated
HermanG05 b6bd57c
removed redundant check
HermanG05 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,3 +77,4 @@ cluster_estimation: | |
|
|
||
| communications: | ||
| timeout: 30.0 # seconds | ||
| worker_period: 0.5 # seconds | ||
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
Submodule common
updated
5 files
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 |
|---|---|---|
|
|
@@ -8,6 +8,9 @@ | |
| from ..common.modules import position_global | ||
| from ..common.modules import position_local | ||
| from ..common.modules.logger import logger | ||
| from ..common.modules.data_encoding import message_encoding_decoding | ||
| from ..common.modules.data_encoding import metadata_encoding_decoding | ||
| from ..common.modules.data_encoding import worker_enum | ||
| from ..common.modules.mavlink import local_global_conversion | ||
|
|
||
|
|
||
|
|
@@ -51,7 +54,7 @@ def __init__( | |
| def run( | ||
| self, | ||
| objects_in_world: list[object_in_world.ObjectInWorld], | ||
| ) -> tuple[True, list[object_in_world.ObjectInWorld]] | tuple[False, None]: | ||
| ) -> tuple[True, list[bytes], bytes] | tuple[False, None, None]: | ||
|
|
||
| objects_in_world_global = [] | ||
| for object_in_world in objects_in_world: | ||
|
|
@@ -69,7 +72,7 @@ def run( | |
| self.__logger.warning( | ||
| f"Could not convert ObjectInWorld to PositionLocal:\nobject in world: {object_in_world}" | ||
| ) | ||
| return False, None | ||
| return False, None, None | ||
|
|
||
| result, object_in_world_global = ( | ||
| local_global_conversion.position_global_from_position_local( | ||
|
|
@@ -81,10 +84,29 @@ def run( | |
| self.__logger.warning( | ||
| f"position_global_from_position_local conversion failed:\nhome_position: {self.__home_position}\nobject_position_local: {object_position_local}" | ||
| ) | ||
| return False, None | ||
| return False, None, None | ||
|
|
||
| objects_in_world_global.append(object_in_world_global) | ||
|
|
||
| self.__logger.info(f"{time.time()}: {objects_in_world_global}") | ||
|
|
||
| return True, objects_in_world | ||
| encoded_position_global_objects = [] | ||
| for object in object_in_world_global: | ||
|
|
||
| result, message = message_encoding_decoding.encode_position_global( | ||
| worker_enum.WorkerEnum.COMMUNICATIONS_WORKER, object | ||
| ) | ||
| if not result: | ||
| self.__logger.warning("Conversion from PositionGlobal to bytes failed", True) | ||
| return False, None, None | ||
|
|
||
| encoded_position_global_objects.append(message) | ||
|
|
||
| result, metadata = metadata_encoding_decoding.encode_metadata( | ||
| worker_enum.WorkerEnum.COMMUNICATIONS_WORKER, len(encoded_position_global_objects) | ||
| ) | ||
| if not result: | ||
| self.__logger.error("Failed to encode metadata", True) | ||
| return False, None, None | ||
|
|
||
| return True, encoded_position_global_objects, metadata | ||
|
||
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
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
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.
Where is this change? Can you make this a PR in common or something?