Cruisers Forum
 

Go Back   Cruisers & Sailing Forums > Seamanship, Navigation & Boat Handling > OpenCPN
Cruiser Wiki Click Here to Login
Register Vendors FAQ Community Calendar Today's Posts Log in

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 31-12-2021, 06:36   #76
Registered User

Join Date: Oct 2020
Location: SE USA
Boat: Hunter 38
Posts: 1,469
Re: Interoperability between OpenCPN(s) & Devices

Quote:
Originally Posted by sv_pelagia View Post
I am not entirely clear as to what is being asked here... but I will give it a shot.


I create waypoints and routes using OpenCPN. I use them in OpenCPN but also "send" them to my Furuno chartplotter


I usually save them as a GPX, then use another program (GPSUtility) to (i) change the symbols and (ii) save file as a Furuno rat/rou file.


It is too bad that OpenCPN cannot save waypoint/route files in formats other than just gpx. Also, OpenCPN symbols do not translate easily to those on other chartplotters.
I do something similar

Create routes in Open CPN and also using Predict Wind weather routing. I will export these in GPX and import to Aqua Map which supplements my help (open cpn at the nav station only at the moment,).

I would like to take weather route output, bring in to open cpn to edit, then make available to aqua map.

I can do it all now, but it takes multiple steps and imports exports etc. I wonder if there’s a way to share automatically.
flightlead404 is offline   Reply With Quote
Old 24-04-2022, 10:02   #77
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 316
Re: Interoperability between OpenCPN(s) & Devices

Thinking ahead here... several users run two separate OpenCPN installations, say one at the chart table and another on deck. One issue is keeping the two in sync.

I am minded to see if I can add socket comms to a future version of the JavaScript plugin. Given it would be super easy to transfer JavaScript objects such as waypoints or routes between scripts as JSON strings, this would open a convenient way of keeping waypoints and routes in sync between two OCPN systems without struggling with NMEA. Any interest in this? [This would be a project for me next winter after the 2022 season.]

Taking it a step further, if the slave system is to shadow the master system, it would need extra APIs so that a script running on the slave system could cause it to shadow the master system. I am thinking of:
  • Navigate to <position>
  • Move boat to <position>
  • Navigate to <waypoint>
  • Activate <route>
  • Activate next waypoint
  • Deactivate route
It takes a while for new APIs to be agreed and implemented in a future release of OCPN, so this is a sounding out of interest.

These APIs might also open the way for OCPN to follow a non-OCPN system doing the navigating and sending out NMEA RMB sentences.
Antipole is offline   Reply With Quote
Old 24-04-2022, 17:35   #78
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,766
Images: 2
Re: Interoperability between OpenCPN(s) & Devices

Antipole I've not kept up with your PI, but this sounds very good!
rgleason is offline   Reply With Quote
Old 28-04-2022, 22:30   #79
Registered User

Join Date: Feb 2016
Posts: 143
Re: Interoperability between OpenCPN(s) & Devices

Quote:
Originally Posted by Antipole View Post
Thinking ahead here... several users run two separate OpenCPN installations, say one at the chart table and another on deck. One issue is keeping the two in sync.

I am minded to see if I can add socket comms to a future version of the JavaScript plugin. Given it would be super easy to transfer JavaScript objects such as waypoints or routes between scripts as JSON strings, this would open a convenient way of keeping waypoints and routes in sync between two OCPN systems without struggling with NMEA. Any interest in this? [This would be a project for me next winter after the 2022 season.]
Lol, JSON over (web)socket is one core aspect of Signal K. In addition to navigation data like speeds and depths SK has also provisions for what we refer to as resources: waypoints: waypoints, routes, notes, regions and tracks. The actual content leverages https://geojson.org/, so it's not like we reinvented the whole wheel, just the "bearings": the APIs to handle the resources.


Quote:
Originally Posted by Antipole View Post
Taking it a step further, if the slave system is to shadow the master system, it would need extra APIs so that a script running on the slave system could cause it to shadow the master system. I am thinking of:
  • Navigate to <position>
  • Move boat to <position>
  • Navigate to <waypoint>
  • Activate <route>
  • Activate next waypoint
  • Deactivate route
It takes a while for new APIs to be agreed and implemented in a future release of OCPN, so this is a sounding out of interest.

These APIs might also open the way for OCPN to follow a non-OCPN system doing the navigating and sending out NMEA RMB sentences.
Yay, interoperability, as in the title!

It just so happens that we have been experimenting with https://en.wikipedia.org/wiki/OpenAPI_Specification for taking Signal K to the next level. Using OpenAPI/Swagger one can create an API specification that specifies the API endpoints, their parameters and responses. This allows much more systematic API usage and implementation and less ambiguous semantics.

In Signal K v1 we were very focused on "one data model to rule them all". Imho that is not enough and does not allow use case specific, richer APIs.

The APIs that we have been applying OpenAPI to are resources and course APIs. Resources API allows one to read & write resources as well as search them, for example by bounding box to plot on a map. Course API is all about the operations you already mentioned: how to set and manipulate the target/course/route that the vessel should navigate.

We have a publicly accessible demo of the aforementioned APIs as well as a web based plotter Freeboard that uses them. In Freeboard you can manage waypoints and routes and activate navigation.
The standardized OpenAPI description format allows us to use a generic UI called Swagger. Swagger renders the machine-oriented API descriptions in a human friendly format and allows testing the APIs for reading and writing the data.



The APIs and details are work in progress. It would be absolutely wonderful if somebody with intimate knowledge of O's logic related to route, waypoint and course APIs could have a look at the APIs. As OpenApi JSON they are available at
- https://github.com/SignalK/signalk-s...e/openApi.json
- https://github.com/SignalK/signalk-s...s/openApi.json
and the PR for these changes is at https://github.com/SignalK/signalk-server/pull/1381 where comments are welcome.
teppokurki is offline   Reply With Quote
Old 01-05-2022, 11:12   #80
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 316
Re: Interoperability between OpenCPN(s) & Devices

@teppokurki ... thanks for that.

If the JavaScript plugin gains the ability to read and write over sockets, it opens the way for scripts to bridge between OCPN and SignalK in a flexible way.

This would be much more realistic than trying to build SignalK compatibility into OCPN core at this time. If certain bridges became widely used, implementing them in OCPN core later could be considered.

So I think the first step is to add sockets to the JavaScript plugin and to add the necessary OCPN-style APIs to allow control of OCPN or for it to be controlled.
Antipole is offline   Reply With Quote
Old 01-05-2022, 11:35   #81
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 316
Re: Interoperability between OpenCPN(s) & Devices

Quote:
Originally Posted by Antipole View Post
Taking it a step further, if the slave system is to shadow the master system, it would need extra APIs so that a script running on the slave system could cause it to shadow the master system. I am thinking of:
  • Navigate to <position>
  • Move boat to <position>
  • Navigate to <waypoint>
  • Activate <route>
  • Activate next waypoint
  • Deactivate route
The above seem to meet what a 'slave' instance of OCPN needs but a 'master' OCPN needs to learn when to update a slave. For example, if a user creates or moves a waypoint, it needs to update the slave.

At present, for a plugin/script to know e.g. a waypoint has been modified elsewhere, it would have to keep a copy of them all and then read the current versions every few seconds and compare them to see if anything had changed. No thank you

So we need APIs alerting plugins to such things as:
  • Waypoint has been added, updated or deleted
  • Waypoint has been arrived at
  • Route has been added, updated or deleted
  • Route has been activated, deactivated or the active point advanced

What else is needed? Start/stop track recording?
Ideas please.

I will start developing a FlySpray ticket for what is needed. But it is going to need significant support for it to carry the necessary weight to get implemented.
Antipole is offline   Reply With Quote
Old 01-05-2022, 12:58   #82
Registered User

Join Date: Mar 2011
Posts: 732
Re: Interoperability between OpenCPN(s) & Devices

Re:
  • Waypoint has been added, updated or deleted - Refer to Flyspray FS#2805 for one suggestion.
  • Waypoint has been arrived at - Isn't that the purpose of the the OCPN plugin message OCPN_WPT_ARRIVED ?
  • Route has been activated, deactivated or the active point advanced - Similarly isn't that the purpose of the OCPN messages OCPN_RTE_ACTIVATED, OCPN_RTE_ENDED etc. ?
Earlier on in this thread I made a suggestion that perhaps the underlying route/waypoint/tracks storage mechanism should be replaced with a proper database. I'm not suggesting DB2, Oracle or SQL Server but I had a quick play with Litesync, which is based on SQLite and supports replication. I thought it has some promise however, the problem would be untangling the current spaghetti code to cleanly separate what one used to call the business logic & data access layers.

BTW, Instead of web sockets & JSON, how about going retro with DCE RPC and ASN.1 ? Just joking....
stevead is offline   Reply With Quote
Old 04-05-2022, 11:03   #83
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 316
Re: Interoperability between OpenCPN(s) & Devices

Quote:
Originally Posted by stevead View Post
Re:
  1. Waypoint has been added, updated or deleted - Refer to Flyspray FS#2805 for one suggestion.
  2. Waypoint has been arrived at - Isn't that the purpose of the the OCPN plugin message OCPN_WPT_ARRIVED ?
  3. Route has been activated, deactivated or the active point advanced - Similarly isn't that the purpose of the OCPN messages OCPN_RTE_ACTIVATED, OCPN_RTE_ENDED etc. ?
Thanks for the input.
1. Yes FS#2805 is headed in the right direction. We need a message when a waypoint is added, updated or deleted, whether via the GUI or through the APIs.
The message reply only needs to give the GUID as a plugin can retrieve other details using the GUID - except when a waypoint is deleted because it will be gone by the time the plugin requests the details.
2. OCPN_WPT_ARRIVED - yes that does the trick. There is a OCPN_WPT_ACTIVATED message but when a route advances, no new message is sent so a plugin may not realise the active waypoint has changed.
3. Yes - almost there. Still need OCPN_RTE_ADVANCED

I have raised a FlySpray requests FS#2888 & FS#2889 for these. Please support these with your vote.
Antipole is offline   Reply With Quote
Old 04-05-2022, 13:28   #84
Registered User

Join Date: Mar 2011
Posts: 732
Re: Interoperability between OpenCPN(s) & Devices

I haven't had time to play with any of this, busy battling my own demons, however
Quote:
OCPN_WPT_ARRIVED - yes that does the trick. There is a OCPN_WPT_ACTIVATED message but when a route advances, no new message is sent so a plugin may not realise the active waypoint has changed.
It would be nice if there was an appropriate OCPN message, but if the plugin supports the SetActiveLegInfo function, I would expect that when you have arrived at the waypoint the Plugin_Active_Leg_Info member arrival would change to true, and then the Plugin_Active_Leg_Info would advance to the next leg.

Nothing like well spec'd, consistent spaghetti code !
stevead is offline   Reply With Quote
Old 28-06-2022, 03:01   #85
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 316
Route and mark name charter set

At present, it seems that any character is allowable in the name of a waypoint, route or track - even !@£$%^&*()_+ is valid.

However, this is not the case when such names are sent out over NMEA. I have recently traced an issue I was having to my use of a comma in waypoint and route names, as in "Church Bay, Rathlin". A comma is the field separator in NMEA 0183 - you can imagine the chaos this caused.

Each sender of NMEA data could arrange suitable substations, but in the interests of interoperability I think there is a case for OpenCPN restricting the acceptable character set that can be used in these fields in the GUI. Plugins creating or editing these objects through the APIs would have to look after this themselves unless an API to filter a name was created.

What say others?
Antipole is offline   Reply With Quote
Old 28-06-2022, 05:15   #86
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,766
Images: 2
Re: Interoperability between OpenCPN(s) & Devices

How is current boat position, speed, etc handled? ....via nmea0183 data stream?
Is there any need for this information to be relayed through the API?

Re Extended character set, this is a problem best solved as a filter somehow, but does OpenCPN just automatically remove those characters or is there some GUI warning when entering the waypoint name when it is an illegal character?

What happens to existing waypoints that are using these problematical characters? A big purge with messages?

I think the characters / and \ in should also be excluded from the waypoint name accepted characters.
rgleason is offline   Reply With Quote
Old 28-06-2022, 08:21   #87
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 316
Re: Interoperability between OpenCPN(s) & Devices

Quote:
Originally Posted by rgleason View Post
Re Extended character set, this is a problem best solved as a filter somehow, but does OpenCPN just automatically remove those characters or is there some GUI warning when entering the waypoint name when it is an illegal character?
I seem to remember that with wxWidgets it is possible to set a character set on a field by field basis. It is also possible to declare a validation function which is called character by character such that non-acceptable characters simply do not type or beep.
[I am afloat at the mo and not in a position to check the facts here.]
Antipole is offline   Reply With Quote
Old 28-06-2022, 08:30   #88
Registered User

Join Date: Nov 2012
Location: Steinhatchee, FL
Posts: 402
Re: Interoperability between OpenCPN(s) & Devices

It is always best practice to sanitize any user input.
Be Free is online now   Reply With Quote
Old 06-07-2022, 09:19   #89
Registered User
 
rooiedirk's Avatar

Join Date: Aug 2010
Location: Netherlands
Boat: Oneoff
Posts: 515
Re: Interoperability between OpenCPN(s) & Devices

I don't think we should limit possibility's in O just because some outside (stupid)devices can't . However checking if a waypoint name is (nmea)valid before sending it over nmea is a good idea.
__________________
Navigation is know where you are and what to do to get where you want.
But also: Know where you don't want to be and what to do to don't get there.
rooiedirk is offline   Reply With Quote
Old 10-07-2022, 12:14   #90
Registered User
 
skkeith's Avatar

Join Date: Mar 2013
Location: Santa Cruz
Boat: 1975 Isander 28
Posts: 132
Re: Interoperability between OpenCPN(s) & Devices

I would like to see a gRPC interface on the OCPN API. OCPN would be a gRPC server. Keep the API the same and focus on hardening it. Force all the customization outside OCPN. You don't even need a plugin, you can do gRPC remote from anywhere. Please please please don't use xml or omg sql for this kind of thing. Do an RPC API. If you really need a database do REDIS please avoid xml if we are talking ease of device interoperability.


If you are not familiar, gRPC can be single or streaming single or bi-directional and is super easy to use in any language. The protobuf binary format can be used for efficiency or json if you want a pure asci human readable serialized form.


I guess I could make the gRPC server for OCPN API a OCPN plugin? I have never done OCPN dev before but I might just try this...
skkeith is offline   Reply With Quote
Reply

Tags
enc, opencpn, rope


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
Yacht Devices NMEA wifi to OpenCPN TheOffice OpenCPN 16 26-07-2018 15:12
What chartplotter brand / interoperability between brands CatNewBee Marine Electronics 10 17-08-2017 02:43
OpenCPN+Android : external USB-Serial devices ? PaulRowntree OpenCPN 7 02-04-2016 05:12
Synchronize Routes between OpenCPN Desktop and OpenCPN Android Tablets bgs OpenCPN 2 13-03-2016 19:47
Interoperability Sandero Marine Electronics 1 27-07-2014 17:41

Advertise Here


All times are GMT -7. The time now is 08:21.


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.