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 22-01-2020, 11:58   #61
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,401
Re: Signal K Implementation

Teppokurki, Bram, et al...


Working on a WebSocket access to signalK server for OCPN core. So far so good.


But in this mode, it seems that there is no special delimiter character between streamed JSON messages coming from the server. Could this be right?
The TCP socket interface seems to always append CRLF to each JSON message.


What am I missing?
Thanks
Dave
bdbcat is offline   Reply With Quote
Old 22-01-2020, 13:16   #62
Registered User

Join Date: Feb 2016
Posts: 143
Re: Signal K Implementation

WebSocket transmits messages, each message a JSON string, whereas tcp transmits bytes and needs delimiters to simplify parsing.

No idea what ws lib you are using, so can’t comment on how exactly things work there,bur here’s a sample

https://github.com/zaphoyd/websocket...int_client.cpp
teppokurki is offline   Reply With Quote
Old 22-01-2020, 15:58   #63
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,401
Re: Signal K Implementation

teppokurki...
Thanks
As I suspected, but just wanted to hear independent confirmation.

I am using
https://github.com/dhbaird/easywsclient
Seems reliable and simple to integrate, so far.


Dave
bdbcat is offline   Reply With Quote
Old 22-01-2020, 19:59   #64
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,401
Re: Signal K Implementation

All...


OpenCPN core SignalK implementation converted to WebSocket interface method. New code available in github, build artifacts in the normal spots.
Basic functionality confirmed on linux and Windows.

All testing appreciated.


Untested/unconfirmed so far:
1. Heavy AIS loading.
2. TLS (https) access.


Thanks
Dave
bdbcat is offline   Reply With Quote
Old 22-01-2020, 22:47   #65
Registered User
 
rooiedirk's Avatar

Join Date: Aug 2010
Location: Netherlands
Boat: Oneoff
Posts: 511
Re: Signal K Implementation

I'm getting a crash now if I try to add a Signal-K connection. (Used to work before)

BackTrace:
Code:
ASSERT INFO:
../include/wx/thrimpl.cpp(41): assert "m_internal" failed in Lock(): wxMutex::Lock(): not initialized

BACKTRACE:
[1] wxMutex::Lock()
[2] wxThread::Delete(void**, wxThreadWait)
[3] SignalKDataStream::CloseWebSocket()
[4] SignalKDataStream::Close()
[5] Multiplexer::StopAndRemoveStream(DataStream*)
[6] options::OnApplyClick(wxCommandEvent&)
[7] wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&)
[8] wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*)
[9] wxEvtHandler::TryHereOnly(wxEvent&)
[10] wxEvtHandler::ProcessEventLocally(wxEvent&)
[11] wxEvtHandler::ProcessEvent(wxEvent&)
[12] wxWindowBase::TryAfter(wxEvent&)
[13] wxEvtHandler::SafelyProcessEvent(wxEvent&)
[14] g_closure_invoke
[15] g_signal_emit_valist
[16] g_signal_emit
[17] g_closure_invoke
[18] g_signal_emit_valist
[19] g_signal_emit
[20] g_closure_invoke
[21] g_signal_emit_valist
[22] g_signal_emit
[23] gtk_propagate_event
[24] gtk_main_do_event
[25] g_main_context_dispatch
[26] g_main_loop_run
[27] gtk_main
[28] wxGUIEventLoop::DoRun()
[29] wxEventLoopBase::Run()
[30] wxDialog::ShowModal()
[31] MyFrame::DoOptionsDialog()
[32] MyFrame::DoSettings()
[33] MyFrame::OnToolLeftClick(wxCommandEvent&)
[34] wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&)
[35] wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*)
[36] wxEvtHandler::TryHereOnly(wxEvent&)
[37] wxEvtHandler::DoTryChain(wxEvent&)
[38] wxEvtHandler::ProcessEvent(wxEvent&)
[39] wxEvtHandler::ProcessPendingEvents()
[40] wxAppConsoleBase::ProcessPendingEvents()
[41] wxApp::DoIdle()
[42] g_main_context_dispatch
[43] g_main_loop_run
[44] gtk_main
[45] wxGUIEventLoop::DoRun()
[46] wxEventLoopBase::Run()
[47] wxAppConsoleBase::MainLoop()
[48] wxEntry(int&, wchar_t**)
[49] main
[50] __libc_start_main
[51] _start
__________________
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 23-01-2020, 00:04   #66
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,147
Re: Signal K Implementation

Dave..
Here tested on RPi3.stretch. Today's master build.
SK is on RPi4 OpenPlotter. Data sent from my Win10 to SK.

There was a difference from earlier code. Now the Signal.K detection found port 3000 compared to earlier 8375 but I can use both and no data difference detected. (Signal-K itself is also updated in between if that's relevant.)
Data received is GPS: (pos, cog, sog) and HDT. No AIS and as before nothing else but GPS to Dashboard.
If I switch to SK-connection by TCP all data, like AIS and DB are there.


From my Win10:
There the Automatic server discovery found port 8375.
I've not been able to test if AIS is received there since that's so far the source. I can rearrange if needed. Please advice.


Håkan
Attached Thumbnails
Click image for larger version

Name:	SK.jpg
Views:	100
Size:	53.4 KB
ID:	207420  
Hakan is offline   Reply With Quote
Old 23-01-2020, 07:11   #67
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,401
Re: Signal K Implementation

Hakan...


The older signalK interface via TCP socket is no longer active in the source, so any existing connections at port 8375 should not work, and should be deleted. The Websocket port is normally 3000, and is discovered as such.


I see a problem in the code preventing AIS targets from being transmitted by sK on the WebSocket interface. Will fix today.


Thanks
Dave
bdbcat is offline   Reply With Quote
Old 23-01-2020, 07:19   #68
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,401
Re: Signal K Implementation

Rooiedirk...
re:
"I'm getting a crash now if I try to add a Signal-K connection. (Used to work before)"


What platform, please?
Thanks
Dave
bdbcat is offline   Reply With Quote
Old 23-01-2020, 09:43   #69
Registered User

Join Date: Oct 2014
Location: Netherlands
Boat: Halmatic 30
Posts: 1,106
Re: Signal K Implementation

Hi Dave,

just tested the latest OpenCPN version form Cloudsmith on my Linux Mint Tricia 64AMD.

Seaching for a SignalK connection for my local system. This works with the 3000 port and also with 8375 port. The Ip adress is the IP of this system. If I change the Ip adress to localhost it also works.

Then tested this system with the connection to the SignalK server on my Raspberry Pi4. This also works with the IP adres of the Pi and with port 3000 and 8375.

Very good !!

I also have done some test with my GPS NMEA2000 and a canbus card and I'am receiving the GPS data in OpenCPN in SignalK.

The RPI4 is running on 64 bits Raspian with the add-ons from OpenPlotter. The serial options of OpenPlotter with aliases for serial hardware and then switching this to SignalK works also very well.

The Pi4 with this 64 bits OS runs just as fast as my other Linux systems.

SignalK becomes certainly the mainstay for the different input and output sources for a navigation system.

One thing I have not tested yet is the output in SignalK format from OpenCPN. That worked with nmea183.

Example: I have made route to a waypoint. That is done in OpenCPN. Now i like to have this output course and distance in SignalK for other purposes.

Is there with SignalK a way back from OpenCPN to the server ?

Thanks for all your efforts,

Regards,

Bram
verkerkbr is offline   Reply With Quote
Old 23-01-2020, 15:12   #70
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,401
Re: Signal K Implementation

Bram...


re:
"Is there with SignalK a way back from OpenCPN to the server ?"


This is not yet implemented. Let us discuss the various use cases for this function, to understand how best to implement.
Here are some:
1. Following a route laid out in OCPN: What sK messages should be output in this case? I suppose this should be whatever set is required to activate an N2K interfaced Autopilot? And what would those be?

2. Navigate to point: Same as (1), I think.
3. Others?


Input required....
Thanks
Dave
bdbcat is offline   Reply With Quote
Old 23-01-2020, 15:46   #71
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,401
Re: Signal K Implementation

Bram/Hakan...


To clarify the UI:
1. If you select Automatic Server Discovery, then the IP address and Port entered in the Connections Parameters dialog does not matter, and will be ignored. The connection will "discover" a signalK server while opening, and use that ip and port for communication.


2. If you select "Discover Now" button, you will see the actual discovered port for a signalK WebSocket service interface. This is really shown for information only. see (1).

3. The current code always uses WebSocket for signalK interface. When the rPI OpenPlotter sK server is available, the WebSocket service will be discovered at port 3000, unless changed from default by a user.


4. You can test this if you disable Automatic Discovery, and try to use port 3875 for signalK. Nothing will be received, because there is no signalK WebSocket server at that port.


Clear?
Dave
bdbcat is offline   Reply With Quote
Old 23-01-2020, 16:58   #72
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,401
Re: Signal K Implementation

All Testers...


I have modified signalK support in OCPN core to receive AIS messages from servers configured for input of those messages. Code in github now, artifacts building.


To test, we would like to see some high-density AIS target environments, and evaluate the system processor load in this condition.



Good Luck
Dave
bdbcat is offline   Reply With Quote
Old 24-01-2020, 00:30   #73
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,147
Re: Signal K Implementation

Dave..
  1. AIS messages are now streaming from SK to OCPN. Confirmed!
    I'll do a "massive" AIS test during the day.
    One note: AIS targets received on this channel are using kind of a "back door" into OCPN logic. The own ship target is not sorted out! When streaming the same data through OCPN multiplexer by a TCP connection from the SK server, the own ship AIS target is sorted out.
  2. SK socket connections better understood now. Thanks for the info. The port and IP parameters shown are more for a show than real info?
    So if I've two SK servers on the net how would I know which one I'm connected to? Should I then switch automatic detection off and enter manually instead? (Maybe not realistic?)
  3. The possible use of SK instead of OCPN multiplexer would change philosophy for how things are set up and connected in the boat.
    O's NMEA Debug/ Dashboard/ Tactics/ VDR/ Watchdog etc are useless and external programs has to be used instead.
    The autopilot, connected to O's multiplexer/serial port can't get wind data if present. If the AP should be connected to SK we need some info from O to SK as discussed above.
    Conclusion: SK would be a tool to connect OCPN as a viewer on a NMEA2000 net. If my boat use a NMEA0183 net OCPN's multiplexer is still the most efficient? (SK and OpenPlotter is though a nice tool to connect 1-wire and Ic2 sensors on a RPi and pass the info to NMEA0183 via a SK-TCP connection)
Hakan is offline   Reply With Quote
Old 24-01-2020, 01:34   #74
Registered User

Join Date: Oct 2014
Location: Netherlands
Boat: Halmatic 30
Posts: 1,106
Re: Signal K Implementation

Quote:
Originally Posted by bdbcat View Post
Bram...
re:
"Is there with SignalK a way back from OpenCPN to the server ?"

This is not yet implemented. Let us discuss the various use cases for this function, to understand how best to implement.
Here are some:
1. Following a route laid out in OCPN: What sK messages should be output in this case? I suppose this should be whatever set is required to activate an N2K interfaced Autopilot? And what would those be?

2. Navigate to point: Same as (1), I think.
3. Others?


Input required....
Thanks
Dave
Good Morning Dave,

it did a simple test in the past. Outgoing output setting in OpenCPN. TCP localhost port 2000. And in the SignalK server setup new connection for incoming NMEA183 on port 2000.

That worked. See image with MX Tommy app (SignalK) showing distance and course of the OpenCPN route.

There is also an application for use as an autopilot called Pypilot made by Sean Depaigner. Using a route from OpenCPN to steer the autoplilot. Have not tried this yet. (Boat in winter storage).

But it is perhaps a good idea to look at the code of the Pypilot to see what is needed as output from OpenCPN.

Regards,


Bram
Attached Thumbnails
Click image for larger version

Name:	nmea_test.jpg
Views:	72
Size:	355.6 KB
ID:	207491  
verkerkbr is offline   Reply With Quote
Old 24-01-2020, 02:47   #75
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,147
Re: Signal K Implementation

Dave..
A small AIS load test.
Here I'm using a AIS feed that includes some 600 AIS targets. Streaming from my Win10 to SignK on RPi4 via UDP. The test of performance is done on a RPi3 wlan connected to RPi4-SignK.
CPU load on the RPi3 when:
Connected to SignK via SignalK socket and normal, ~50 AIS targets >> 40%
Connected to SignK via SignalK socket and about 600 AIS targets >> 55%
Connected to SignK via TCP/multiplexer and about 600 AIS targets >> 60%
Connected to SignK via TCP/multiplexer and normal, ~50 AIS targets >> 40%

Note: When TCP connected also depth, wind etc are parsed by the multiplexer and Dashboard.
Shots:
1. RPi3 when connected to SignK by socket and 600 AIS
2. Also when socket connected. S/Y MOMO is my boat as mentioned in my previous post.
Hakan is offline   Reply With Quote
Reply

Tags
men


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
Open source implementation of PACTOR-3 and -4 Jammer Marine Electronics 53 02-02-2019 16:30
Navico BR24 Radar - Open Source protocol implementation maxxflow OpenCPN 23 30-07-2012 04:20
New Waypoint Properties Implementation nohal OpenCPN 206 14-07-2012 12:38
GPS signal too weak on Datamarine 5000 phorvati Marine Electronics 2 11-08-2009 14:26
Info on Signal flag Fonts ? JMRmarinero Flotsam & Sailing Miscellany 2 28-06-2007 08:54

Advertise Here


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


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.