How to convert .BIN to .csv or .mat; Error with Mission Planner

1,008 views
Skip to first unread message

Andreas Hirt

unread,
Jan 19, 2016, 2:12:18 PM1/19/16
to swiftnav-discuss
Hi,

we integrated the piksi to the pixhawk and so far its working good. 
To optimize our vehicle and EKF-settings I would also like to show and analyse the GPS-track of the piksi with Matlab. But when I try to convert the logged .BIN file with MP to a .log or .mat file there is going something wrong.

To describe the problem, I attached pictures of the Lng-value of the GPS (ublox) and the GPS2 (piksi) shown in MP. The other pictures shows the plotted GPS-data in Matlab of the .mat file, the converted .BIN file from MP.
As you can see, the GPS2 data is lost during the conversion ...
The original logfile (Flight19_01.BIN file) can be downloaded from : 
(size: 29 MB)

Does anyone has a solution or an other tool for this problem? I m not a programmer, so I'm not able to write a script for that :(

Thanks in advance for any help and best regards

Andreas

Lng_GPS_and_GPS2.png
Matlab_plot_GPS_LatLng.png
Matlab_plot_GPS2_LatLng.png

Andreas Hirt

unread,
Jan 21, 2016, 4:11:06 AM1/21/16
to swiftnav-discuss

I'm not sure if this error is caused by a fault/different way of logging the flight-data when piksi is activated, or by the conversion of MP.  Anyway, if someone has the same problem, you can use the sdlog2dump.py script from this site:

https://pixhawk.org/users/tutorials/matlab


As my logged .BIN file is a bit different to the example-file, I had to change the python-script in the following lines:

Line 62, add:   "d": ("d", None),

Line287, change "time_msg = TIME" to: time_msg = None


Use this file with this command:

python sdlog2_dump.py Logfilename.BIN -f "export.csv" -d "," -n ""


The result is that all data (also the data of the piksi) is stored in a csv-file.


Best regards,

Andreas

dzo...@swift-nav.com

unread,
Jan 21, 2016, 2:22:19 PM1/21/16
to swiftnav-discuss
Additionally,
Swift has a script that convert the .BIN files to our logging format of JSON serialized SBP stream.  See https://github.com/swift-nav/piksi_tools/blob/master/piksi_tools/ardupilot/mavlink_decode.py

Best,
Dennis
Reply all
Reply to author
Forward
0 new messages