From a864c07de84c0f2293ca9c8c9b25ddfffce997a7 Mon Sep 17 00:00:00 2001 From: Willian Galvani Date: Wed, 4 Dec 2024 17:12:46 -0300 Subject: [PATCH] AutopilotManager: MAVLink-Server: add logging endpoint --- .../ardupilot_manager/mavlink_proxy/MAVLinkServer.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/services/ardupilot_manager/mavlink_proxy/MAVLinkServer.py b/core/services/ardupilot_manager/mavlink_proxy/MAVLinkServer.py index 867a0bcb6..11ac54a45 100644 --- a/core/services/ardupilot_manager/mavlink_proxy/MAVLinkServer.py +++ b/core/services/ardupilot_manager/mavlink_proxy/MAVLinkServer.py @@ -1,5 +1,6 @@ import re import subprocess +from datetime import datetime from typing import Optional from mavlink_proxy.AbstractRouter import AbstractRouter @@ -37,7 +38,11 @@ def convert_endpoint(endpoint: Endpoint) -> str: return f"zenoh:{endpoint.place}:{endpoint.argument}" raise ValueError(f"Endpoint of type {endpoint.connection_type} not supported on MAVLink-Server.") - endpoints = " ".join([convert_endpoint(endpoint) for endpoint in [master_endpoint, *self.endpoints()]]) + # MAVlink-Server takes direct file paths as endpoints, so we generate a timestamped file path + now = datetime.now().strftime("%Y-%m-%d-%H-%M-%S") + logging_endpoint = f"tlogwriter:/root/.config/ardupilot-manager/firmware/logs/mavlink-server-{now}.tlog" + str_endpoints = [convert_endpoint(endpoint) for endpoint in [master_endpoint, *self.endpoints()]] + endpoints = " ".join([*str_endpoints, logging_endpoint]) return f"{self.binary()} {endpoints}"