Cruisers Forum
 


Reply
  This discussion is proudly sponsored by:
Please support our sponsors and let them know you heard about their products on Cruisers Forums. Advertise Here
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 23-12-2019, 02:34   #1
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 315
Picking up data from OpenCPN

My existing Mac set up has my ship's log written in FileMaker which collects data (position and other data such as HDG, CMG, wind, depth etc.) from MacENC via AppleScript calls. So when I log start/end of passage or any event, these data get added to the log automatically.

Given Catalina no longer supports 32bit apps, I am moving to OpenCPN instead of MacENC and from FileMaker (64bit too expensive) to, likely, TapForms for the log. (BTW TapForms supports JavaScript coding.). I have OpenCPN receiving my NMEA data fine.

So, I need a way to programmatically collect the above data from OpenCPN. Unfortunately, OpenCPN has no AppleScript support. The Dashboard plugin has the data but I see no way of extracting it - not even by copy & paste.

Any suggestions as to how I can get at this data will be much appreciated. I am not up to speed on plugins, so would need pointers if I have to go down that route. Thanks.
Antipole is offline   Reply With Quote
Old 23-12-2019, 04:29   #2
Registered User

Join Date: Jul 2010
Location: Hannover - Germany
Boat: Amel Sharki
Posts: 2,546
Re: Picking up data from OpenCPN

You may use VDR. It is a plugin available for Mac also:
https://www.opencpn.org/OpenCPN/plugins/vdr.html
CarCode is offline   Reply With Quote
Old 23-12-2019, 07:39   #3
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 315
Re: Picking up data from OpenCPN

@carcode - thanks for pointing me to VDR. I have installed it and played the sample file.

As I understand it, VDR allows me to record the NMEA data stream but I would need to post process that to extract the data I want retrospectively. There is no way of getting it to pass out the data on demand?
Antipole is offline   Reply With Quote
Old 23-12-2019, 08:29   #4
Registered User

Join Date: Jul 2010
Location: Hannover - Germany
Boat: Amel Sharki
Posts: 2,546
Re: Picking up data from OpenCPN

Perhaps you want to try the Logbook Konni? It has some features you are looking for:
https://www.opencpn.org/OpenCPN/plug...bookkonni.html
CarCode is offline   Reply With Quote
Old 24-12-2019, 03:42   #5
Registered User
 
transmitterdan's Avatar

Join Date: Oct 2011
Boat: Valiant 42
Posts: 6,008
Re: Picking up data from OpenCPN

Quote:
Originally Posted by Antipole View Post
@carcode - thanks for pointing me to VDR. I have installed it and played the sample file.



As I understand it, VDR allows me to record the NMEA data stream but I would need to post process that to extract the data I want retrospectively. There is no way of getting it to pass out the data on demand?
OpenCPN has the ability to connect to a simple TCP socket and send all NMEA data in close to real time to that socket. You could create a Python or Java script to act as a TCP service which OpenCPN will happily deliver all the NMEA data. At that point you have to parse the NMEA protocol but that is not too difficult and I think a search may turn up existing code to do that. Depending on exactly what data you are interested in parsing may be trivially easy.
transmitterdan is offline   Reply With Quote
Old 24-12-2019, 04:12   #6
Registered User

Join Date: Feb 2016
Posts: 143
Re: Picking up data from OpenCPN

Consider installing Signal K server and routing data from O to SK via TCP. SK will parse NMEA0183 and provide a simple HTTP api to access the latest values on demand. You can use curl from AppleScript to do http if that is your tech of choice.

https://github.com/SignalK/signalk-server-node/

https://stackoverflow.com/questions/...plescript-rest
teppokurki is offline   Reply With Quote
Old 24-12-2019, 05:14   #7
Registered User

Join Date: Jul 2010
Location: Hannover - Germany
Boat: Amel Sharki
Posts: 2,546
Re: Picking up data from OpenCPN

Why not a little bit more complicated?
It is winter time, people cannot sail and have so much time...
CarCode is offline   Reply With Quote
Old 24-12-2019, 06:01   #8
Registered User

Join Date: Feb 2016
Posts: 143
Re: Picking up data from OpenCPN

Yep. Complicated/simple is in the eye of the OP...

Given Tap Forms has js that would be my choice for http data access.
teppokurki is offline   Reply With Quote
Old 24-12-2019, 09:54   #9
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 315
Re: Picking up data from OpenCPN

Thanks for the suggestions.

Looks like simplest would be to write Javascript within TapForms to read the NMEA stream directly, without going via OpenCPN. There are recipies for this - it does not look fearsome. I have set up my NMEA2000-WiFi gateway to send NMEA0183 data over UDP, so this should keep things simple - no open and closing of connections.

It will take a while before I can get around to this but I will report back in due course.
Antipole is offline   Reply With Quote
Old 27-12-2019, 08:41   #10
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,720
Images: 2
Re: Picking up data from OpenCPN

Carcode suggested Logbook konni, and if it has all the data you want, it might be very easy to use. The data set has been extended several times.

However the signalk and vdrplayer suggestuons are also good.
rgleason is offline   Reply With Quote
Old 29-12-2019, 02:47   #11
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 315
Re: Picking up data from OpenCPN

Turns out JS cannot access network data (TCP or UDP) - at least I have not found any way.

Given that any web page visited can download any JS and execute it, JS is very restricted as to what it can access outside its own walled garden. Otherwise a web page could read any network traffic on your computer or any file etc. So these restrictions are understandable, especially on Apple devices.
Antipole is offline   Reply With Quote
Old 29-12-2019, 05:57   #12
Registered User

Join Date: Feb 2016
Posts: 143
Re: Picking up data from OpenCPN

These restrictions are runtime environment specific: browser sandbox is very different from Node.js, where UDP and TCP work. I guess TapForms’ js support has browser ancestry.

Your problem underlines the reasons Signal K exists: to provide an easy way to access marine data, without the need to fiddle with lower level protocols (http/ws versus tcp) and nmea parsing (json versus NMEA0183/2000).
teppokurki is offline   Reply With Quote
Old 06-01-2020, 11:11   #13
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 315
Re: Picking up data from OpenCPN

I have a solution - not actually via OpenCPN, but for neatness to close off this thread I will relate it:

I have discovered the Monkeybread plugin for FileMaker, which adds a vast array of functions to standard FileMaker, including handling both TCP and UDP sockets. I can read the NMEA data stream directly without going via OPenCPN.

This still leaves me with the issue that my Filemaker v10 is 32 bit and will not run on Catalina. Maybe I have to upgrade (£££) but that is outside the scope of this forum.
Antipole is offline   Reply With Quote
Reply

Tags
enc, opencpn


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data buoys in Philippines: Data base of locations? pbmaise Pacific & South China Sea 0 03-12-2016 22:28
No GPS data even though data stream window ... Netsurfer OpenCPN 10 09-06-2011 04:41
Picking a livaboard cascott Monohull Sailboats 13 13-08-2008 21:03
Help Picking a Boat for Bareboat Certification in BVI marty9876 Training, Licensing & Certification 14 07-07-2008 07:04
Picking up the California wind rebate rebel heart Electrical: Batteries, Generators & Solar 2 25-08-2007 09:24

Advertise Here


All times are GMT -7. The time now is 03:59.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.