Downloading Logs using LOG_REQUEST_DATA

345 views
Skip to first unread message

Amar Kacheria

unread,
Jun 25, 2020, 6:27:28 PM6/25/20
to MAVLink
Hello All, 

I'm having an issue downloading logs over telemetry from ardupilot using mavlink messages (using Mavlink V1 protocol 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,
  name: 'LOG_REQUEST_DATA',
  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?

Thank you for your time, 
Amar

Hamish Willee

unread,
Jun 28, 2020, 9:57:42 PM6/28/20
to MAVLink
Hi Amar,

I don't know. But given this is an ArduPilot-specific question, I suggest you ask for help at: https://discuss.ardupilot.org/c/ground-control-software/mavlink/116

Regards
Hamish

Amar Kacheria

unread,
Jun 29, 2020, 11:42:15 AM6/29/20
to MAVLink
Thanks Hamish, I have raised the issue on the link you provided. 

Amar Kacheria

unread,
Jan 4, 2021, 9:29:47 AM1/4/21
to mav...@googlegroups.com
Hi Hamish, 

After further investigation on this issue of downloading logs, I have found that it is a mavlink issue. 

After digging through the mavlink.js file (generated using mavgen), I found that certain mavlink messages have clashing argument names. 

Each mavlink message gets an id attribute which is the id of the mavlink message. However, the "request_log_data" message requires an "id" attribute which specifies the id of the requested log file. I believe the id fields here are clashing with each other and thus the call to request the data is not responding. 

Below is the function definition of the "request_log_data" function. 

"this.set(arguments)" overwrites the "this.id" variable with the log id passed as the argument. So the "MAVLINK_MSG_ID_LOG_REQUEST_DATA" is never set on the object. 

image.png

Can you please suggest if there is a workaround to be able to use this function? 

This does not seem unique to the javascript language. Same issue is open for python as well. 

Thank you, 
Amar


--
Sie erhalten diese Nachricht, weil Sie in Google Groups ein Thema der Gruppe "MAVLink" abonniert haben.
Wenn Sie sich von diesem Thema abmelden möchten, rufen Sie https://groups.google.com/d/topic/mavlink/9cRgGSRzCLw/unsubscribe auf.
Wenn Sie sich von dieser Gruppe und allen Themen dieser Gruppe abmelden möchten, senden Sie eine E-Mail an mavlink+u...@googlegroups.com.
Wenn Sie diese Diskussion im Web verfolgen möchten, rufen Sie https://groups.google.com/d/msgid/mavlink/198f4431-bcba-4c30-a060-354f1cdbe6b4n%40googlegroups.com auf.


--
Amar R. Kacheria

Case Western Reserve University
B.S. Biomedical Engineering, 2014
Mobile: 304-893-4316

Amar Kacheria

unread,
Jan 7, 2021, 9:11:22 PM1/7/21
to mav...@googlegroups.com
For whoever else might be facing a similar issue in javascript or python. Found a workaround for this issue by modifying the mavlink.js file as per below:

image.png

It seems the arguments are sent in some sort of order so the attribute name does not matter. This allows the log_id to be passed while keeping the id of the message.

Best,
Amar

Hamish Willee

unread,
Jan 13, 2021, 9:52:07 PM1/13/21
to MAVLink
Hi Amar,
Sorry not to have got back to you - I have been off the grid for a few weeks. Looks like you found your solution.

FWIW " It seems the arguments are sent in some sort of order so the attribute name does not matter." Correct - fields are packed in a specific order for sending over the wire - and at this point the order is already set.

Cheers
Hamish

Reply all
Reply to author
Forward
0 new messages