Skip to content

Commit

Permalink
AutopilotManager: MAVLink-Server: add logging endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Williangalvani authored and patrickelectric committed Dec 5, 2024
1 parent 73dffa4 commit a864c07
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import re
import subprocess
from datetime import datetime
from typing import Optional

from mavlink_proxy.AbstractRouter import AbstractRouter
Expand Down Expand Up @@ -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}"

Expand Down

0 comments on commit a864c07

Please sign in to comment.