ISSUE - Downloading logs using LOG_REQUEST_DATA

Hello All,

I’m having an issue downloading logs over telemetry from ardupilot using mavlink messages (using Mavlink V1 protocol - Node.js and ArduCopter v3.6.11)

I’m able to use the LOG_REQUEST_LIST message to fetch the list of log files on the drone and I’m successfully receiving the LOG_ENTRY response message back.

Next, I create the LOG_REQUEST_DATA request message and then write it to the serial port.

var request = new mavlink.messages.log_request_data(targetSystem, targetComponent, 1, 0, 90);
Request object:
format: ‘<IIHBB’,
id: 1,
order_map: [ 3, 4, 2, 0, 1 ],
crc_extra: 116,
fieldnames: [ ‘target_system’, ‘target_component’, ‘id’, ‘ofs’, ‘count’ ],
target_system: 1,
target_component: 1,
ofs: 0,
count: 90

After that point I do not receive any message back with the name LOG_DATA.

What could I be doing wrong? Please let me know if any other information is required. While debugging, I found that the same function works when I download logs using Mission Planner or QGroundControl. For some reason, when my script sends the command it does not seem to work.

Thank you for your time,

First update to 3.6.12 or even better 4.0.4-rc2

@peterbarker @Michael_Oborne Any ideas what I might be doing wrong? This same code works when connecting to mission planner and downloading logs manually. @amilcarlucas I tried updating to 3.6.12 and got the same result. In the current build, I’m not able to update to 4.0.4-rc2. I’m working on making that happen but I would like to resolve this issue with version 3.6.12. Thank you for your time.

try setting count to 0xFFFFFFFF;

@Michael_Oborne Tried setting count to 0xFFFFFFFF but got the same result.

@rmackay9 Any ideas what might be going wrong?

mavlink.messages.log_request_data(targetSystem, targetComponent, 1, 0, 90

What are the numbers at the end?

The numbers at the end are the “log id”, “offset into the log”, and “number of bytes”, respectively. These fields are as per the mavlink.js file. Following is the function definition in mavlink.js:

Request a chunk of a log
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
id : Log id (from LOG_ENTRY reply) (uint16_t)
ofs : Offset into the log (uint32_t)
count : Number of bytes (uint32_t)


mavlink.messages.log_request_data = function(target_system, target_component, id, ofs, count) {
this.format = ‘<IIHBB’; = mavlink.MAVLINK_MSG_ID_LOG_REQUEST_DATA;
this.order_map = [3, 4, 2, 0, 1];
this.crc_extra = 116; = ‘LOG_REQUEST_DATA’;
this.fieldnames = [‘target_system’, ‘target_component’, ‘id’, ‘ofs’, ‘count’];