I have a pixhawk that is connected to my laptop using usb, and I want to download ulog log files from the pixhawk to the laptop.
I started to make a script that uses mavlink to download pixhawk ulogs by firstusing the LOG_REQUEST_LIST to first fetch the list of all logs, and for each LOG_ENTRY, I send a LOG_REQUEST_DATA message to fetch the data synchronously for all logs. I noticed that the max download speed that I get for downloading the logs using mavlink through my script is ~450kbps while QGroundControl is able to reach ~800kbps when downloading logs.
How is QGroundControl able to attain these speeds, and why cannot it be attained through mavlink directly? Is there any way to make these speeds faster?
Because QGroudControl is using the MAVFTP protocol.
If you change your script to also use the MAVFTP protocol you will also get those speeeds.
Take a look at mavProxy for inspiration. That SW also does that.
I have looked through the LogDownloadController.cc file in QGroundControl and it looks like it is using similar message structures such as LOG_ENTRY and LOG_DATA, and they seem to be downloading data in chunks by sending the LOG_REQUEST_DATA commands per chunk. This was simialr to what it was attempting to do aswell but in a separate script. I wasnt able to find any reference to an FTP protocol being used in QGroundControl.