Skip to content

Commit a864c07

Browse files
Williangalvanipatrickelectric
authored andcommitted
AutopilotManager: MAVLink-Server: add logging endpoint
1 parent 73dffa4 commit a864c07

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

core/services/ardupilot_manager/mavlink_proxy/MAVLinkServer.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import re
22
import subprocess
3+
from datetime import datetime
34
from typing import Optional
45

56
from mavlink_proxy.AbstractRouter import AbstractRouter
@@ -37,7 +38,11 @@ def convert_endpoint(endpoint: Endpoint) -> str:
3738
return f"zenoh:{endpoint.place}:{endpoint.argument}"
3839
raise ValueError(f"Endpoint of type {endpoint.connection_type} not supported on MAVLink-Server.")
3940

40-
endpoints = " ".join([convert_endpoint(endpoint) for endpoint in [master_endpoint, *self.endpoints()]])
41+
# MAVlink-Server takes direct file paths as endpoints, so we generate a timestamped file path
42+
now = datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
43+
logging_endpoint = f"tlogwriter:/root/.config/ardupilot-manager/firmware/logs/mavlink-server-{now}.tlog"
44+
str_endpoints = [convert_endpoint(endpoint) for endpoint in [master_endpoint, *self.endpoints()]]
45+
endpoints = " ".join([*str_endpoints, logging_endpoint])
4146

4247
return f"{self.binary()} {endpoints}"
4348

0 commit comments

Comments
 (0)