Mavftp-cli: First release

I created a small proof of concept of mavftp-cli tool to help me fetch files from serial based flight controllers.
It provides the basic functionalities but I believe that is already helpful if someone wants to download a standalone binary to grab some files.
The repository is available here: GitHub - patrickelectric/mavftp-cli: A command line interface to help with mavftp access

The idea in the future is to allow the same ftp functionality though mavlink2rest.

USAGE:
    mavftp-cli [OPTIONS] <SUBCOMMAND>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
        --connection <connection>    Connection string [default: tcpout:0.0.0.0:5760]

SUBCOMMANDS:
    crc       Calculate CRC32 for a file
    create    Create a file
    help      Prints this message or the help of the given subcommand(s)
    list      List files in a directory
    mkdir     Create a directory
    read      Read a file
    remove    Remove a file
    reset     Reset sessions
    rmdir     Remove a directory
    write     Write to a file
$ ./mavftp-cli --connection serial:/dev/ttyACM2:115200 list
Type Name                           Size      
----------------------------------------
F    ./.Trash-1000                  39 B      
F    ./.Trashes                     39 B      
D    ./.fseventsd                             
F    ./.metadata_never_index        39 B      
D    ./APM                                    
F    ./dataman                      61.1 KB   
D    ./log                                    
F    ./param_import_fail.bson       16.0 KB   
F    ./param_import_fail.txt        1.1 KB    
F    ./parameters_backup.bson       454 B 
$ ./mavftp-cli --connection serial:/dev/ttyACM2:115200 read ./APM/LOGS/00000001.BIN
  [00:00:01] [##############################] 514.02 KiB/514.02 KiB (0.0s)
calculated crc: 0xd33fda9f

$ ls -lah 00000001.BIN 
-rw-r--r-- 1 patrick patrick 515K Mar 19 11:19 00000001.BIN
4 Likes

That is great.
On safety, it should be to prevent log download during flight thus ! That can kill a drone. Probably best to ask to use the log download protocol to get the logs too. That is the safest and fastest way

1 Like

@khancyr Thanks for you notes! I’ll add the test for arming state.

From our tests, mavftp runs faster than LOG_REQUEST_DATA/LOG_DATA, it may be because mavftp continues to send the entire payload until it reaches EOF and the message size is 255 bytes against 90 of LOG_DATA. The speed difference is kind of huge…

interesting. Tested on what FCU and which link ? The interest in using the log_request is that it got thread priority so that boost it. You should have more than 350kb/s on usb on a Cube even on fat logs, counting speed as you start recieving data, no when you send the first resquest. First request for log size is slow as the fcu need to lookup all logs for the right one.

Just thinking at another issue to tacle with FTP logs : how do you kown which one is the latest ?

@patrickelectric
Hi , i just try the Windows bin , with my FC , but when i try the list command it seems that the script remains in loop , printing nothing. I use the baudrate that i use in Mission Planner (115200) and use serial:COMX:115200 as input . btw , thanks for this wonderful tool

Hi Davide,

Sadly there is no way for me to test under windows at the moment. But the argument that you are proving should be enough to run it.
At the moment the code is pretty simple and it’s necessary for the vehicle to have a system_id as 1 and using mavlink2 as the communication method. Be sure to be running new ArduPilot version for your vehicle as well.

1 Like

I don’t have the numbers at the moment but we had problems with download speed when having huge missions that was much faster and safe fetching it though mavftp.