From 240dccf05db3d7cb9dfc46a4a186a20497c0eebd Mon Sep 17 00:00:00 2001 From: Willian Galvani Date: Thu, 26 Sep 2024 16:20:54 -0300 Subject: [PATCH] Tools: add mavftp --- core/services/ardupilot_manager/ArduPilotManager.py | 9 +++++++++ core/start-blueos-core | 1 + core/tools/install-system-tools.sh | 3 ++- core/tools/mavftp/bootstrap.sh | 12 ++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100755 core/tools/mavftp/bootstrap.sh diff --git a/core/services/ardupilot_manager/ArduPilotManager.py b/core/services/ardupilot_manager/ArduPilotManager.py index f015118ba7..a414f608bc 100644 --- a/core/services/ardupilot_manager/ArduPilotManager.py +++ b/core/services/ardupilot_manager/ArduPilotManager.py @@ -392,6 +392,15 @@ async def start_mavlink_manager(self, device: Endpoint) -> None: persistent=True, protected=True, ), + Endpoint( + name="MavFTP", + owner=self.settings.app_name, + connection_type=EndpointType.UDPClient, + place="127.0.0.1", + argument=14555, + persistent=True, + protected=True, + ), ] for endpoint in default_endpoints: try: diff --git a/core/start-blueos-core b/core/start-blueos-core index 782a729218..4c5f61b7ef 100755 --- a/core/start-blueos-core +++ b/core/start-blueos-core @@ -126,6 +126,7 @@ SERVICES=( 'nginx',250,"nice -18 nginx -g \"daemon off;\" -c $TOOLS_PATH/nginx/nginx.conf" 'log_zipper',250,"nice -20 $SERVICES_PATH/log_zipper/main.py '/shortcuts/system_logs/\\\\*\\\\*/\\\\*.log' --max-age-minutes 60" 'bag_of_holding',250,"$SERVICES_PATH/bag_of_holding/main.py" + 'mavftp',250,"nice -19 /home/pi/tools/mavftp/pymavlink/mavftpfs.py --mountpoint /root/.config/ardupilot-manager/logs/mavftp" ) tmux -f /etc/tmux.conf start-server diff --git a/core/tools/install-system-tools.sh b/core/tools/install-system-tools.sh index 430a3c89fe..9b7a3b8a43 100755 --- a/core/tools/install-system-tools.sh +++ b/core/tools/install-system-tools.sh @@ -11,6 +11,7 @@ TOOLS=( logviewer mavlink_camera_manager scripts + mavftp ) parallel --halt now,fail=1 '/home/pi/tools/{}/bootstrap.sh' ::: "${TOOLS[@]}" @@ -18,4 +19,4 @@ parallel --halt now,fail=1 '/home/pi/tools/{}/bootstrap.sh' ::: "${TOOLS[@]}" # Tools that uses apt to do the installation # APT is terrible like pip and don't know how to handle parallel installation # These should periodically be moved onto the base image -apt update && apt install -y --no-install-recommends dhcpcd5 fuse libfuse2 +apt update && apt install -y --no-install-recommends dhcpcd5 fuse libfuse2 git diff --git a/core/tools/mavftp/bootstrap.sh b/core/tools/mavftp/bootstrap.sh new file mode 100755 index 0000000000..1a765d78d0 --- /dev/null +++ b/core/tools/mavftp/bootstrap.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -e +# TODO: all of this should be replaced with a single pip install once the pr at pymavlink is merged and there's a new version tagged +mkdir -p /home/pi/tools/mavftp +cd /home/pi/tools/mavftp +apt update && apt install -y git libxml2-dev libxslt-dev build-essential gcc zlib1g-dev +git clone --depth 1 --branch mavftp_updates https://github.com/Williangalvani/pymavlink.git +git clone --depth 1 https://github.com/Ardupilot/mavlink.git +cd pymavlink +pip install fusepy==3.0.1 lxml +MDEF="../mavlink/message_definitions" python -m pip install . -v +apt remove -y git build-essential && apt autoremove -y && apt clean -y \ No newline at end of file