MAVSDK FTP: upload works, download/list fails

Hey!

I’m have trouble with the ftp examples from MAVSDK.

I’m launching a mavlink ftp server from my companion pc, which is connected to the cube orange. The cube orange is connected to a Herelink remote control system.

I’m launching a mavlink ftp client from my second pc, which is connected to qgc on the Herelink ground unit via USB tethering.

I’m currently able to upload files, however I cannot download or list files. If I try this, I get a protocol error for dir, with a warning of an invalid path (while the path it prints is actually valid) and File does not exists for downloading a file, while the file does exist.

I did make sure that the permissions of the folder were set to read/write/execute for all groups on my pc.

Any possible fixes?

What if you try an FTP client from the same machine?
This way you may rule out any issues with communication, and check that the FTP server works Ok.

thanks for your reply! I tried it with the client on the same computer, but I get the same error. Uploading works, downloading does not. Any other suggestions?

Ok. So it looks like your FTP server is not properly configured.

I’m not familiar with MAVSDK FTP examples, but from documentation you should receive a NAK with error code (i.e. UnkownCommand, FileNotFound, etc.)
So what are the error code(s) you received?
In addition, it would be great you mention on what OS you’re running the MAVSDK FTP server.

One more thing. You said upload works, but have you really confirmed that the file(s) you uploaded are actually written to disk on the proper location?

Pablo

Hi!

I obtain the error “File does not exist” or “Protocol error” (see class Ftp · MAVSDK Guide result section) for downloading and listing files respectively. In this issue I provided some outputs, if more outputs help I will defintely upload them! File transfer MAVSDK: Protocol Error

For the server I’m using stock ubuntu, but also tried on mac with the same results.

I confirmed the upload files are the correct files written to the expected location (folder of ftp_server, from where I launch the server).

Thanks for your time and quick replies :)!

Okay, apparently it comes down to a bug in MAVSDK described here: `set_root_directory()` does not set the root directory (FTP) · Issue #1766 · mavlink/MAVSDK · GitHub. Issue is marked as open, but a proposed solution for the server can be found in the comments:

while (true) {
    std::this_thread::sleep_for(std::chrono::seconds(1));

    for (auto system : mavsdk.systems()) { // Iterate through all available systems and call set_root_directory
        auto ftp_server = Ftp{system};
        ftp_server.set_root_directory("/home/ubuntu/ftp_test");
    }
}```