From 1200a138122b07f3c87f097bab254d6d5b91bfbc Mon Sep 17 00:00:00 2001 From: ES-Alexander Date: Wed, 30 Aug 2023 18:26:08 +1000 Subject: [PATCH 1/2] dvl-a50: mavlink2resthelper: fix incorrect IDs - `system_id` set to match the vehicle ID, since they should be part of the same system - `component_id` set to 197 (`MAV_COMP_ID_VISUAL_INERTIAL_ODOMETRY`) --- dvl-a50/mavlink2resthelper.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/dvl-a50/mavlink2resthelper.py b/dvl-a50/mavlink2resthelper.py index 9f29166..4013ddd 100644 --- a/dvl-a50/mavlink2resthelper.py +++ b/dvl-a50/mavlink2resthelper.py @@ -30,8 +30,8 @@ def __init__(self, vehicle: int = 1, component: int = 1): self.vision_template = """ {{ "header": {{ - "system_id": 255, - "component_id": 0, + "system_id": """ + str(vehicle) + """, + "component_id": 197, "sequence": 0 }}, "message": {{ @@ -55,8 +55,8 @@ def __init__(self, vehicle: int = 1, component: int = 1): self.vision_speed_estimate_template = """ {{ "header": {{ - "system_id": 255, - "component_id": 0, + "system_id": """ + str(vehicle) + """, + "component_id": 197, "sequence": 0 }}, "message": {{ @@ -83,8 +83,8 @@ def __init__(self, vehicle: int = 1, component: int = 1): self.global_vision_position_estimate_template = """ {{ "header": {{ - "system_id": 255, - "component_id": 0, + "system_id": """ + str(vehicle) + """, + "component_id": 197, "sequence": 0 }}, "message": {{ @@ -126,8 +126,8 @@ def __init__(self, vehicle: int = 1, component: int = 1): self.gps_origin_template = """ {{ "header": {{ - "system_id": 255, - "component_id": 0, + "system_id": """ + str(vehicle) + """, + "component_id": 197, "sequence": 0 }}, "message": {{ @@ -144,8 +144,8 @@ def __init__(self, vehicle: int = 1, component: int = 1): self.rangefinder_template = """ {{ "header": {{ - "system_id": 255, - "component_id": 0, + "system_id": """ + str(vehicle) + """, + "component_id": 197, "sequence": 0 }}, "message": {{ @@ -177,8 +177,8 @@ def __init__(self, vehicle: int = 1, component: int = 1): self.statustext_template = """ {{ "header": {{ - "system_id": 1, - "component_id": 1, + "system_id": """ + str(vehicle) + """, + "component_id": 197, "sequence": 0 }}, "message": {{ From 0aca939cc7a6b05b5ce82c8f4f21fc7d09ef9fde Mon Sep 17 00:00:00 2001 From: ES-Alexander Date: Thu, 28 Nov 2024 02:03:47 +1100 Subject: [PATCH 2/2] format with black to make CI happy --- dvl-a50/mavlink2resthelper.py | 48 ++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/dvl-a50/mavlink2resthelper.py b/dvl-a50/mavlink2resthelper.py index 4013ddd..27c3037 100644 --- a/dvl-a50/mavlink2resthelper.py +++ b/dvl-a50/mavlink2resthelper.py @@ -27,10 +27,13 @@ def __init__(self, vehicle: int = 1, component: int = 1): self.component = component # store vision template data so we don't need to fetch it multiple times self.start_time = time.time() - self.vision_template = """ + self.vision_template = ( + """ {{ "header": {{ - "system_id": """ + str(vehicle) + """, + "system_id": """ + + str(vehicle) + + """, "component_id": 197, "sequence": 0 }}, @@ -51,11 +54,15 @@ def __init__(self, vehicle: int = 1, component: int = 1): "confidence": {confidence} }} }}""" + ) - self.vision_speed_estimate_template = """ + self.vision_speed_estimate_template = ( + """ {{ "header": {{ - "system_id": """ + str(vehicle) + """, + "system_id": """ + + str(vehicle) + + """, "component_id": 197, "sequence": 0 }}, @@ -79,11 +86,15 @@ def __init__(self, vehicle: int = 1, component: int = 1): "reset_counter": 0 }} }}""" + ) - self.global_vision_position_estimate_template = """ + self.global_vision_position_estimate_template = ( + """ {{ "header": {{ - "system_id": """ + str(vehicle) + """, + "system_id": """ + + str(vehicle) + + """, "component_id": 197, "sequence": 0 }}, @@ -122,11 +133,15 @@ def __init__(self, vehicle: int = 1, component: int = 1): "reset_counter": {reset_counter} }} }}""" + ) - self.gps_origin_template = """ + self.gps_origin_template = ( + """ {{ "header": {{ - "system_id": """ + str(vehicle) + """, + "system_id": """ + + str(vehicle) + + """, "component_id": 197, "sequence": 0 }}, @@ -140,11 +155,15 @@ def __init__(self, vehicle: int = 1, component: int = 1): }} }} """ + ) - self.rangefinder_template = """ + self.rangefinder_template = ( + """ {{ "header": {{ - "system_id": """ + str(vehicle) + """, + "system_id": """ + + str(vehicle) + + """, "component_id": 197, "sequence": 0 }}, @@ -174,10 +193,14 @@ def __init__(self, vehicle: int = 1, component: int = 1): }} }} """ - self.statustext_template = """ + ) + self.statustext_template = ( + """ {{ "header": {{ - "system_id": """ + str(vehicle) + """, + "system_id": """ + + str(vehicle) + + """, "component_id": 197, "sequence": 0 }}, @@ -192,6 +215,7 @@ def __init__(self, vehicle: int = 1, component: int = 1): }} }} """ + ) def get_float(self, path: str, vehicle: Optional[int] = None, component: Optional[int] = None) -> float: """