Remote Lua Upload

Hi team

I am wondering if there is a way of uploading a lua script remotely to an autopilot - i have been using the file upload method traditionally with a lift and shift of lua scripts into the scripts folder but im wondering if there is a way of doing this via a mavlink connection string in python? would be useful to no have to have a physical connection to the AP each time i want to update a script, thanks!

Use mavFTP, it should work over any link with reasonable throughput (anything but those tiny satellite modems that use high latency mode).

Thanks @LupusTheCanine
Was looking at the MAV FTP protocol - but can’t seem to find any examples of this being done from a remote source - only via mission planner - any chance you know of a guide / example you could point me towards?

this main page doesnt seem to go into it!

I don’t because I use MP for uploading scripts.

For example you can use pymavlink mavutil.
Establish a connection, then use that to establish a mavftp connection and cmd_put the lua script.
You could probably check the code of the Methodical Configurator for a concrete example, or use any LLM for examples

1 Like

I don’t understand what you mean by “remote source.” Mission Planner was designed to connect both locally (USB/serial) and remotely (serial radio or networked). You can use MP to transfer script files via MAVFTP over nearly any telemetry connection.

You can check mavftp impelementation on mavproxy: MAVProxy/MAVProxy/modules/mavproxy_ftp.py at master · ArduPilot/MAVProxy · GitHub

by remote i just mean something that doesn’t have a serial connection to the autopilot and is not a GCS with under the hood methods of wireless upload i.e
a machine running some custom python code with a mavlink connection string (pymavlink) as its only path to the AP

thanks @beska I will have a dig :slight_smile:

As long as all nodes in the chain support MAVLink routing it shouldn’t be different from direct connection.

Mavftp is a python command that you get with pymavlink.

After installing pymavlink execute the command line:

Mavftp --help

@WARGRaph the AMC uses the “mavftp.py” from pymavlink. That mavftp.py was first developed inside AMC for AMC based on the mavproxy code, but I have now moved it upstream to pymavlink so that other software can use it as well.

It is a command line executable so you can call it from bash or powersell scripts and also a python module meaning you can import it in your python code:

from pymavlink import mavftp

And call the public API functions it exposes.

1 Like