Friday, 11 August 2017

OpenPlotter, NMEA data TO file

             Updated 2017-08-14

Sometimes You want to "take home" Your latest trip on sea and "replay" it or replay it doing some changes in the settings for the OpenPlotter or OpenCPN applikation and se the result direct.

One way is to create log files with the the "raw" NMEA data and then use them at home with tips from this post.

Creating log files from NMEA 2000 bus, N2K, is the most straightforward.

Check what name Your CAN usb interface have. One way doing it is reading the log from auto setup found in OP=> Tools => Auto Setup.

Open Terminal and just type the following with Your CAN usb name

actisense-serial -r /dev/ttyUSB0 > N2K_2017-08-08.txt

This will lock the screen and create the file "N2K_2017-08-08.txt" and fill it with "raw" N2K data. Stop the recording with Ctrl + c. 

Check the file content with 

less N2K_2017-08-08.txt

and You will see something like 

2016-08-26T13:22:05.531Z,0,262161,0,0,13,01,0e,00,0f,f3,01,00,00,00,00,00,02,00
2016-08-26T13:22:05.532Z,0,262386,0,0,33,01,0e,00,0f,f3,01,00,00,00,00,00,02,.....
2016-08-26T13:22:05.532Z,0,262384,0,0,14,01,0e,00,0f,f3,01,00,00,00,00,00,93,08,08 
2016-08-26T13:22:05.532Z,2,129025,1,255,8,5c,64,74,21,6d,7a,56,07
2016-08-26T13:22:05.532Z,2,128259,35,255,8,84,a4,00,ff,ff,00,ff,ff
2016-08-26T13:22:05.532Z,5,130311,35,255,8,84,c0,a7,72,ff,7f,ff,ff

"Enter" for more rows and "q" for quit.

Creating log files from NMEA 0183, N1, is a little more complicated.

If You have more then one N1 source, own created, in "NMEA0183/KPLEX tab" and it's OK for You to manually edit the KPLEX config file then go on direct here or another method will follow later in this post

KPLEX can be configured to create and write N1 data to a file.

Open "OP => NMEA0183" => click on "Advanced" and add the following at the end, after ###Manual settings, of the config file

[file]
name=file
direction=out
filename=NMEA0183_2017-08-08.txt
append=yes

Close with "File => Quit"  Save.... "Yes"

Open "OP => NMEA0183" => click on "Restart" and then the output will be written to the file.

When You want to stop recording, edit the configuration file again. Easiest way is just to put a # before the rows You added. Then they will be handled as comments.

And another way

To read the data install the minimal terminal emulator Picocom by open Terminal and then type the following

cd .config
git clone https://github.com/npat-efault/picocom.git
cd picocom
make

Check what name Your NMEA 0183 usb interface have. One way doing it is reading the log from auto setup found in OP=> Tools => Auto Setup.

To read the data it is a must that You disable the input from Your selected NMEA 0183 usb interface at the OP => NMEA 0183/Kplex tab. Uncheck Your device and Restart. 

Continue with typing the following with Your NMEA 0183 usb name and the right baudrate.

picocom -b 4800 /dev/ttyUSB0 > NMEA0183_2017-08-08.txt

This will lock the screen and create the file "NMEA0183_2017-08-08.txt" and fill it with "raw" NMEA0183 data. Stop the recording with Ctrl + a +x.

Check the file content with 

less NMEA0183_2017-08-08.txt

and You will see something like 

$GPRMC,195719,A,5310.8115,N,00525.7025,E,0.0,0.0,160414,0.7,E,A*10
$GPVTG,0.0,T,359.3,M,0.0,N,0.0,K,A*2F
$GPZDA,195719,16,04,14,-02,00*63
$GPAAM,,,,N,*38
$GPAPB,,,,,,,,,,,,,,,N*26
$GPBOD,,T,,M,,*47
$GPRMB,,,,,,,,,,,,,,N*04
$GPXTE,,,,,N,N*5E

"Enter" for more rows and "q" for quit.

These files can then be used at home using tips from this post.

No comments:

Post a Comment