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 30-06-2022, 15:39   #31
Registered User

Join Date: May 2013
Location: NSW, Australia
Boat: Richter 42
Posts: 1,077
Re: OpenCPN 5.6.2 - SignalK connection causes freeze

I turned off the wifi altogether and did the test again. It still locked up almost instantly when signalk was used. What other information can I provide to show the issue?

Code:
log switching to signal k
--------------------------
08:12:56.131 MESSAGE NetworkDataStream.cpp:402 TCP NetworkDataStream connection established: TCP:localhost:10110
08:17:08.183 MESSAGE datastream.cpp:138 makeDataStream Signal K:localhost:3000
08:17:08.183 MESSAGE datastream.cpp:206 ConnectionParams CTOR
08:17:08.184 MESSAGE SignalKDataStream.cpp:610 Opening Signal K WebSocket client: Signal K:localhost:3000
08:17:08.187 MESSAGE o-charts_pi.cpp:1003 o_charts_pi:  Calculated pix/mm = 3.77581
08:17:08.370 MESSAGE s52plib.cpp:518 Core s52plib:  ppmm: 3.77581 rv_scale_factor: 1.4125  calc_display_size_mm: 339
08:17:08.370 MESSAGE chcanv.cpp:2376 Metrics:  m_display_size_mm: 339     g_Platform->getDisplaySize():  1280:1024   
08:17:08.370 MESSAGE chcanv.cpp:2381 wxDisplaySize(): 1280 1024
08:17:08.372 MESSAGE o-charts_pi.cpp:1003 o_charts_pi:  Calculated pix/mm = 3.77581
08:17:09.267 MESSAGE SignalKEventHandler.cpp:65 Connected to Signal K server version: 1.43.0

conf
-----
 signalk on


 DataConnections=1;3;localhost;3000;0;;4800;1;0;0;;0;;3;0;0;0;1;SIGNALK input;0|1;1;127.0.0.1;10112;0;;4800;0;2;0;;0;APB,ECRMB,WV;1;0;0;0;1;OpencpnOut;0|1;0;127.0.0.1;10110;0;;4800;0;2;1;EC,WV;1;;1;0;0;0;0;SignalK TCP ouput;0|1;1;127.0.0.1;12000;0;;4800;0;0;1;;1;;1;0;1;0;0;AIS NMEA;1|1;1;127.0.0.1;10111;0;;4800;1;0;1;;1;;1;0;0;0;0;SignalK UDP input;0|1;0;localhost;10110;0;;4800;1;0;1;APB,WC,ECRMB;0;;2;0;0;0;1;SignalK TCP input;0

 nmea on, signalk off


 DataConnections=1;3;localhost;3000;0;;4800;1;0;0;;0;;3;0;0;0;0;SIGNALK input;0|1;1;127.0.0.1;10112;0;;4800;0;2;0;;0;APB,ECRMB,WV;1;0;0;0;1;OpencpnOut;0|1;0;127.0.0.1;10110;0;;4800;0;2;1;EC,WV;1;;1;0;0;0;0;SignalK TCP ouput;0|1;1;127.0.0.1;12000;0;;4800;0;0;1;;1;;1;0;1;0;0;AIS NMEA;1|1;1;127.0.0.1;10111;0;;4800;1;0;1;;1;;1;0;0;0;0;SignalK UDP input;0|1;0;localhost;10110;0;;4800;1;0;1;APB,WC,ECRMB;0;;2;0;0;0;1;SignalK TCP input;0
jongough is offline   Reply With Quote
Old 30-06-2022, 16:25   #32
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,397
Re: OpenCPN 5.6.2 - SignalK connection causes freeze

Jon...
You have shown the issue clearly on your hardware.
Problem is that neither Hakan nor I can reproduce.
I am running on rPi4, and that may be related. I will need to dig out and configure an rpi3b+ system to perfectly replicate your environment.
I re-iterate my config. Please let me know if there is any difference to your tests:


1. Rpi4, running OpenPlotter 32/Buster
2. sK Playback plugin installed, executing repeated playback of your provide delta streams.


3(a) OCPN 562 running on same rPi4, using sK connection, (localhost:3000)
or
3(b) OCPN 562 running on linux desktop, receiving data from sK server (1), using connection sK(192.168.37.xx:3000).


Both 3(a) and 3(b) will run indefinitely without fault.


Dave
bdbcat is online now   Reply With Quote
Old 30-06-2022, 17:59   #33
Registered User

Join Date: May 2013
Location: NSW, Australia
Boat: Richter 42
Posts: 1,077
Re: OpenCPN 5.6.2 - SignalK connection causes freeze

I have turned off all AIS sentences within signalk and restarted OPCN. Then selectively turned on HDM, II*, VDM, VDO and RMC restarting signalk each time. The wind and autopilot sentences are OK and all works. I then turned on VDM and VDO sentences, the AIS vessel sentences, and again OCPN worked fine. That left the RMC sentence from my DigitalYacht AIT1000 Class B transponder. When I turned that back on it almost immediately hung. I killed OCPN, removed the RMC sentence and again it is all OK.

The signalk definition within OCPN only allows it to be turned on or off, there is no filtering capability so the testing had to be done with removing sentences within signalk.

https://www.rfwireless-world.com/Ter...sentences.html


Code:
$GPRMC,003527.00,A,2727.26548,S,15311.33558,E,0.014,,010722,,,A*6F
$GPRMC,003528.00,A,2727.26528,S,15311.33557,E,0.028,139.77,010722,,,A*73
$GPRMC,003529.00,A,2727.26506,S,15311.33557,E,0.015,,010722,,,A*65
$GPRMC,003530.00,A,2727.26485,S,15311.33560,E,0.011,,010722,,,A*67
$GPRMC,003531.00,A,2727.26466,S,15311.33559,E,0.014,,010722,,,A*64
$GPRMC,003532.00,A,2727.26451,S,15311.33558,E,0.006,,010722,,,A*61
$GPRMC,003533.00,A,2727.26438,S,15311.33558,E,0.010,,010722,,,A*68
$GPRMC,003534.00,A,2727.26433,S,15311.33560,E,0.003,,010722,,,A*6D
I wonder if there is a problem with this input?


It is difficult to workout where the RMC sentence is used and what has changed between the two versions. There does not appear to be much in the RMC sentence that could cause an issue, but.....
jongough is offline   Reply With Quote
Old 30-06-2022, 18:21   #34
Registered User

Join Date: May 2013
Location: NSW, Australia
Boat: Richter 42
Posts: 1,077
Re: OpenCPN 5.6.2 - SignalK connection causes freeze

Here is the dpkg info for OCPN:
Package: opencpn
Status: install ok installed
Priority: extra
Section: misc
Installed-Size: 43772
Maintainer: Pavel Kalian <pavel@kalian.cz>
Architecture: armhf
Version: 5.6.2.2~ubuntu18.04.1
Replaces: opencpn-data (<< 5.6.2.2~ubuntu18.04.1), opencpn-gshhs-crude (<< 5.6.2.2~ubuntu18.04.1), opencpn-plugin-chartdldr, opencpn-plugin-wmm, opencpn-tcdata (<< 5.6.2.2~ubuntu18.04.1)
Provides: opencpn-plugin-chartdldr, opencpn-plugin-wmm
Depends: libarchive13 (>= 3.0.4), libbz2-1.0, libc6 (>= 2.27), libcairo2 (>= 1.2.4), libcurl4 (>= 7.16.2), libelf1 (>= 0.131), libexif12 (>= 0.6.21-1~), libexpat1 (>= 2.0.1), libgcc1 (>= 1:3.5), libgl1, libglib2.0-0 (>= 2.12.0), liblz4-1 (>= 0.0~r113), liblzma5 (>= 5.1.1alpha+20120614), libpango-1.0-0 (>= 1.22.0), libpangocairo-1.0-0 (>= 1.14.0), libportaudio2 (>= 19+svn20101113), libsndfile1 (>= 1.0.20), libsqlite3-0 (>= 3.7.3), libstdc++6 (>= 6), libtinyxml2.6.2v5, libudev1 (>= 183), libusb-1.0-0 (>= 2:1.0.16), libwxbase3.0-0v5 (>= 3.0.4+dfsg), libwxgtk3.0-0v5 (>= 3.0.4+dfsg), libx11-6, zlib1g (>= 1:1.2.3.4), wx3.0-i18n
Recommends: xcalib, xdg-utils, opencpn-doc, opencpn-sglock-amd64, opencpn-sglock-arm32, libusb-0.1-4
Breaks: opencpn-gshhs-crude (<< 5.6.2.2~ubuntu18.04.1), opencpn-tcdata (<< 5.6.2.2~ubuntu18.04.1)
Conflicts: opencpn-plugin-chartdldr, opencpn-plugin-wmm
Conffiles:
/etc/udev/rules.d/98-sglock-ocpn.rules 5e5292dc38cb21b85542be2fd1d65874 obsolete
Description: Concise chartplotter and navigation software
OpenCPN is a free software (GPLv2) project to create a concise chartplotter and navigation software for use as an underway or planning tool. OpenCPN is developed by a team of active sailors using real world conditions for program testing and refinement.
Homepage: http://www.opencpn.org
Still investigating. Is there a possibility for a filter to be applied to the signalk data stream within OCPN?
jongough is offline   Reply With Quote
Old 30-06-2022, 18:25   #35
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,397
Re: OpenCPN 5.6.2 - SignalK connection causes freeze

Jon...
The RMC sentence go INTO the sK server looks fine.
What we would like to see is the resulting JSON delta message emitted by the server.
I have looked at the provided delta files from earlier, and it is hard to pick out specifically.


Can you filter out everything except the RMC message going into the server, and record the resulting JSON output from the server?


Dave
bdbcat is online now   Reply With Quote
Old 30-06-2022, 19:40   #36
Registered User

Join Date: May 2013
Location: NSW, Australia
Boat: Richter 42
Posts: 1,077
Re: OpenCPN 5.6.2 - SignalK connection causes freeze

This should be the signalk data log for the AIS GPS info.
Attached Files
File Type: pdf sk-delta-log.2022-07-01.log.gz.pdf (7.2 KB, 19 views)
jongough is offline   Reply With Quote
Old 30-06-2022, 19:50   #37
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,397
Re: OpenCPN 5.6.2 - SignalK connection causes freeze

Jon...
A little confused.
You have said that the RMC message coming from you AIS receiver seems to be the offending data. That is, if you remove RMC from the AIS receiver, then OCPN works correctly.
Is this correct?


Is it correct that your AIS receiver is synthesizing RMC messages, and those messages are input to the sK server?
Or, is the source of "RMC data" actually derived from AIVDO messages?


Dave
bdbcat is online now   Reply With Quote
Old 30-06-2022, 20:20   #38
Registered User

Join Date: May 2013
Location: NSW, Australia
Boat: Richter 42
Posts: 1,077
Re: OpenCPN 5.6.2 - SignalK connection causes freeze

If I exclude with signalk the GPRMC message from the AIT1000 OCPN does not hang. If I include it OCPN hangs.
The AIT1000 outputs GPRMC, AIVDM & AIVDO messages on the USB connection.


From the manual.
GPS output options
o By default the AIS transponder will output its current GPS position data every four seconds via the USB and NMEA serial interfaces. This information is sent using the GPRMC sentence and can be used to provide your vessels GPS position to a chart plotter connected to the unit. A higher position update rate (once per second) is available as an option and will result in a more accurate display of your vessels position, speed and course on a connected chart plotter. To use this option select the "Output GPS data every second" option and click
'Update'
jongough is offline   Reply With Quote
Old 30-06-2022, 21:10   #39
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,397
Re: OpenCPN 5.6.2 - SignalK connection causes freeze

Jon...


I think I found some suspicious code, possibly responsible for problems.

Do you have a setup ability to allow you to build OCPN from source?


Dave
bdbcat is online now   Reply With Quote
Old 30-06-2022, 21:32   #40
Registered User

Join Date: May 2013
Location: NSW, Australia
Boat: Richter 42
Posts: 1,077
Re: OpenCPN 5.6.2 - SignalK connection causes freeze

Currently I really don't have much in the way of build capability on the boat. I can run stuff easy enough, but debugging is more a thought experiment. If you can build a version of opencpn binary for the Pi I can test it by just replacing the current one (not sure an install would help too much either as I want to leave as much untouched as possible to reduce the changes). If the debugging/tracing information is available I can help close in on the issue if there is one. I am not sure where in the code the information is processed, so if you can point at any particular module or area I can have a look at that as well.


Thanks.
jongough is offline   Reply With Quote
Old 30-06-2022, 21:47   #41
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,397
Re: OpenCPN 5.6.2 - SignalK connection causes freeze

Jon...
Its late here, but food for thought today...


The RMC messages as processed by sK will contain some "NULL" values, especially for CourseOverGroundTrue.


{"updates":[{"source":{"sentence":"RMC","talker":"GP","type":" NMEA0183","label":"ais"},"timestamp":"2022-07-01T02:24:32.000Z","values":[{"path":"navigation.position","value":{"longitude" :153.18893266666666,"latitude":-27.4544215}},{"path":"navigation.courseOverGroundTrue","value":null},{"path":"navigation.speedOverGround","value":0.0 020577782990816138},{"path":"navigation.magneticVa riation","value":null},{"path":"navigation.magneti cVariationAgeOfService","value":1656642272},{"path ":"navigation.datetime","value":"2022-07-01T02:24:32.000Z"}],"$source":"ais.GP"}],"context":"vessels.urn:mrn:imo:mmsi:503447900" }



We have seen OCPN 562 react poorly to this, in this code:


Code:
void SignalKEventHandler::updateNavigationCourseOverGround(
    wxJSONValue &value, const wxString &sfixtime) const {
  double cog_rad = value.AsDouble();
  double cog_deg = GEODESIC_RAD2DEG(cog_rad);
  // wxLogMessage(wxString::Format(_T(" ***** COG: %f, %f"), cog_rad, cog_deg));
  m_frame->setCourseOverGround(cog_deg);
  m_frame->PostProcessNMEA(false, false, true, sfixtime);
}
If "value" is JSON_NULL, then reading value "AsDouble() will produce garbage. Later stages may fault with this undefined input.


This bug is fixed in OCPN github master, by still exists in 562.


I'll be back tomorrow with more info...
Dave
bdbcat is online now   Reply With Quote
Old 30-06-2022, 23:38   #42
Registered User

Join Date: May 2013
Location: NSW, Australia
Boat: Richter 42
Posts: 1,077
Re: OpenCPN 5.6.2 - SignalK connection causes freeze

That definitely looks like it may cause an issue. It appears that some of these have been fixed, but it would appear that 'updateNavigationSpeedOverGround', 'updateNavigationCourseOverGround', 'updateHeadingMagnetic' and 'updateMagneticVariance' need checking for really being valid doubles. It seems that signalk needs 'defensive' programming techniques applied to the JSON messages.

I wonder if there is a plugin for signalk that can 'remove' these keys where there are invalid values? I also think it may be worthwhile allowing 'filtering' on signalk input.

However, I now have two ways to work with the current 5.6.2:
  1. Don't use signalk as input, rather use the nmea0183 TCP port 10110
  2. Filter the RMC message from the AIS and allow both signalk and nmea0183 input in.
I need to test these by going somewhere and using the autopilot to see how well it works. Maybe in a couple of days.
jongough is offline   Reply With Quote
Old 01-07-2022, 00:48   #43
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,142
Re: OpenCPN 5.6.2 - SignalK connection causes freeze

Quote:
I also think it may be worthwhile allowing 'filtering' on signalk input.
Wouldn't that be to invent the wheel again? There are, as you mentioned, filter functions in the SK server.
But O must of course handle and don't use NULL values as of the changes Dave referred to.
Hakan is offline   Reply With Quote
Old 01-07-2022, 17:16   #44
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,397
Re: OpenCPN 5.6.2 - SignalK connection causes freeze

Jon...
I have committed code to Ubuntu launchpad, OpenCPN Beta repo, which may correct the "value=null" problem for your GPS sentences.


It is version 5.6.2+6901+4e51f3904.
It may be found at https://launchpad.net/~bdbcat/+archive/ubuntu/opencpn


Package builds are currently complete for amd64, in build queue for other ARCHs.


Please let me know if this solves the instant problem.


Thanks
Dave
bdbcat is online now   Reply With Quote
Old 01-07-2022, 18:23   #45
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,397
Re: OpenCPN 5.6.2 - SignalK connection causes freeze

Jon...
All Packages built and published now.
Dave
bdbcat is online now   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
Connect SignalK to OpenCPN workmaster2n OpenCPN 1 21-03-2022 14:01
OpenCPN and SignalK deanfourie OpenCPN 14 20-03-2020 04:09
SignalK development ? verkerkbr OpenCPN 122 02-04-2018 10:30
Rebuild Texture Cache causes crash in OpenCPN 4.0 jim326 OpenCPN 12 04-04-2015 04:00

Advertise Here


All times are GMT -7. The time now is 19:15.


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.