Ardupilog - A DataFlash log to MATLAB converter

I haven’t tested against Octave, but I would suggest that you skip the file selector GUI by providing the filename directly: log = Ardupilog('/path/to/log').
It might give you better chances of working.

Thank you for the tip. I tried, but get the same error.

>> log = Ardupilog('15.BIN')
parse error near line 83 of file C:\Users\torby\Downloads\ardupilog\Ardupilog.m
  syntax error
>>>                 for prop = properties(obj)'
                                        ^
>>

So it might be some small difference between Octave and Matlab I am not understanding.

Ah, it seems that Octave does not have the same method for querying which are the attributes of a class. And I don’t know if it has that ability at all. Probably the API for introspection isn’t the same as Matlab’s.

I’m sorry, but I cannot help you further, as I don’t plan to support Octave too.

I understand that, and I don’t expect support on software the code is not written to run on. Thanks for looking into it, that was helpful.

Hi George, Thank you very much for your hard work!

I tried to run the matlab script to analyze my .bin file but get the following error :

Error using >
Matrix dimensions must agree.

Error in Ardupilog/findBootTimeUTC (line 507)
leapseconds = sum(recv_gps_datenum > leap_second_table);

Error in Ardupilog (line 74)
obj.findBootTimeUTC();

Error in test_log_matlab (line 1)
log = Ardupilog()

Also attached is the .bin file i’m trying to analyze. Is there a way to fix this issue? thank you very much

1 31-12-1969 19-00-00.bin (488 KB)

Hi @Abagaskara! Thank you for your compliments.
Give me a couple of days to check your log, I’m preoccupied these days.

1 Like

Will do, thank you very much for your response!

I believe it should be fixed now. Pull the latest master and try again.

Thank you very much for your help

Hi George!
This is great! This is way better structurized than Mission Planner’s built-in converter. Thanks for sharing this!
I gave it a try and I found a problem. Apparently the log structure has changed in ArduPilot 4.1, and the converter doesn’t like when a variable in the log has multiple instances, i.e. XKF1 has instances 1 and 2. The converter mixes them up and creates a single output that looks very noisy because aparently the function is toggling and picking data points from both instances. Can this be fixed? Thanks for your help!

Like we say in my parts… log or didn’t happen!
Joking aside, it will make debugging much easier.

True! I thought this problem could be easily reproduced with any platform running ArduPilot 4.1. Here goes my sample tho! Check out this link . I also included the Mission Planner Matlab file version as a reference, which also has the same problem. Notice that the matlab files only have 1 instance of XKF1 or ESC fused together, whereas the BIN file has multiple separated instances.
Best!

I see the issue. Unfortunately the identifier field is not the same in every message, so it will have to be a per-case approach. AND it will be necessary to enumerate all of the affected messages. If you can make me a list of as many multi-instance messages as you can it would help tremendously.

The fix isn’t going to be that hard.

I think we might have a winner here. Can you test branch unjumble-ekf?

Yes it works! Awesome thanks! One small suggestion though if it’s not too much, could you enumarate the first intance too? So that all the instances have a unifrom label format.

I thought I had answered you days ago, but apparently I hadn’t.
I don’t want to pursue this change, in order to not break other people’s code who have create scripts that utilize the primary, un-indexed topic names.

E.g. if someone has plotting utilities reading off of “NKF1”, they will now all break if I change the topic name to “NKF1_1”.

Thanks for the suggestion, though!

Hi George,
I’m trying to read my .bin log file into the MATLAB by Ardupilog,
unfortunately i’m getting the following error messages.

Ardupilog
Unrecognized method, property, or field 'C' for class 'LogMsgGroup'.

Error in Ardupilog/addLogMsgGroupInstances (line 346)
            instances = unique(logMsgGroup.(instanceFieldName));

Error in Ardupilog/readLog (line 218)
                obj.addLogMsgGroupInstances(obj.(msgName));

Error in Ardupilog (line 67)
            readLog(obj);

Ardupilot firmware: V3.6.9
MATLAB version: 2021b
My .bin log file:

I would appreciate any help.

I tend to use pymavlink for such things.

You can run straight out of Matlab, or manually.

eg:

pymavlink_path = 'foo';
file_name = 'Mylogfile.bin';
mat_name= 'Mylogfile.mat';
command = ['python  ', pymavlink_path, 'pymavlink\tools\', sprintf('mavlogdump.py "%s" --planner --format mat --mat_file "%s"',file_name,mat_name)];
if system(command) ~= 0 
    warning('Failed to convert: %s', file_name);
end
load(mat_name)
1 Like

Yeah, it didn’t work for me either.

The reason is you posted a pretty old log, that didn’t have instances in the NKF* messages.
I pushed a commit and it should be fixed now.
Can you try again and let me know if it works?

I should really have a set of standard logs to test on.
Too bad Github doesn’t provide a CI service for Matlab software :laughing:.

1 Like

Thanks a lot George, now it works like a charm.

1 Like