OpenMarine
Send all signalK event to UDP Port (for using navionics on ipad) - Printable Version

+- OpenMarine (https://forum.openmarine.net)
+-- Forum: OpenPlotter (https://forum.openmarine.net/forumdisplay.php?fid=1)
+--- Forum: How do I...? (https://forum.openmarine.net/forumdisplay.php?fid=3)
+--- Thread: Send all signalK event to UDP Port (for using navionics on ipad) (/showthread.php?tid=1644)

Pages: 1 2


Send all signalK event to UDP Port (for using navionics on ipad) - pkernevez - 2019-01-19

Hello,

I installed and configure my pi, every thing works fine. OpenCPN receives all the relevant information on TCP 10110 from signalK.
I would like to configure the network to receive the same NMEA messages on UDP 2000 for an application navionicson my ipad connected to the network .
I tried to use KPlex for that, as it's a multiplexer and it has udp output.
But Kplex only see a limited part of my messages : GPS and pressure (coming from I2C/BME280).
The other messages are directly send to SignalK via OPpypilot or OPsensors.

I thought to define a TCP route from SignalK to Kplex and then send all the messages to UDP through KPlex. But I think it will create a messages overflow as the same message will be sent and resent between KPlex and SignalK.


How can I sent all the message from KPlex to UDP ?

Regards,
Philippe

My configuration :
Openplotter 1.2.0 alpha
PI 3
SignalK 1.10.2

Sensors :
RS422/485 (NMEA input)
GPS USB

DS18B20 (temperature)
BME280 (pressure)
MPU 9255 (accelerator & compas)

 

Configuration signalk :

Code:
{
    "enablePluginLogging":true,
    "interfaces":{
        "appstore":true,
        "nmea-tcp":true,
        "plugins":true,
        "providers":true,
        "rest":true,
        "tcp":true,
        "webapps":true,
        "ws":true
    },
    "loggingDirectory":"/home/pi/Logs",
    "mdns":false,
    "pipedProviders":[
        {
            "enabled":false,
            "id":"OPcan",
            "pipeElements":[
                {
                    "options":{
                        "logging":false,
                        "subOptions":{
                            "device":"/dev/ttyOP_",
                            "type":"ngt-1"
                        },
                        "type":"NMEA2000"
                    },
                    "type":"providers/simple"
                }
            ]
        },
        {
            "enabled":false,
            "id":"OPpypilot",
            "pipeElements":[
                {
                    "options":{
                        "logging":false,
                        "subOptions":{
                            "host":"localhost",
                            "port":"20220",
                            "type":"tcp"
                        },
                        "type":"NMEA0183"
                    },
                    "type":"providers/simple"
                }
            ]
        },
        {
            "enabled":true,
            "id":"OPkplex",
            "pipeElements":[
                {
                    "options":{
                        "logging":false,
                        "subOptions":{
                            "host":"localhost",
                            "port":"30330",
                            "type":"tcp"
                        },
                        "type":"NMEA0183"
                    },
                    "type":"providers/simple"
                }
            ]
        },
        {
            "enabled":true,
            "id":"OPwifi",
            "pipeElements":[
                {
                    "options":{
                        "logging":false,
                        "subOptions":{
                            "port":"55561",
                            "type":"udp"
                        },
                        "type":"SignalK"
                    },
                    "type":"providers/simple"
                }
            ]
        },
        {
            "enabled":true,
            "id":"OPserial",
            "pipeElements":[
                {
                    "options":{
                        "logging":false,
                        "subOptions":{
                            "port":"55559",
                            "type":"udp"
                        },
                        "type":"SignalK"
                    },
                    "type":"providers/simple"
                }
            ]
        },
        {
            "enabled":true,
            "id":"OPnotifications",
            "pipeElements":[
                {
                    "options":{
                        "logging":false,
                        "subOptions":{
                            "port":"55558",
                            "type":"udp"
                        },
                        "type":"SignalK"
                    },
                    "type":"providers/simple"
                }
            ]
        },
        {
            "enabled":true,
            "id":"OPsensors",
            "pipeElements":[
                {
                    "options":{
                        "logging":false,
                        "subOptions":{
                            "port":"55557",
                            "type":"udp"
                        },
                        "type":"SignalK"
                    },
                    "type":"providers/simple"
                }
            ]
        }
    ],
    "port":3000,
    "security":{
        "strategy":"@signalk/sk-simple-token-security"
    },
    "ssl":false,
    "sslport":3443



Configuration KPlex :
Code:
# For advanced manual configuration, please visit: http://www.stripydog.com/kplex/configuration.html
# Please do not modify defaults nor OpenPlotter GUI settings.
# Add manual settings at the end of the document.

###defaults

[udp]
name=system
direction=in
port=10110

[tcp]
name=signalk
direction=out
mode=server
port=30330


###end of defaults

###OpenPlotter GUI settings

[udp]
name=pub_net
direction=out
optional=yes
address=10.10.10.255
port=2000

[serial]
name=gp
direction=in
optional=yes
filename=/dev/ttyOP_gp
baud=4800

###end of OpenPlotter GUI settings

###Manual settings



RE: Send all signalK event to UDP Port (for using navionics on ipad) - jim321 - 2019-01-19

node red ?

Code:
[{"id":"6de44897.e4c118","type":"websocket in","z":"fe42033c.31f16","name":"ws","server":"45e5d0ed.aaea7","client":"","x":106,"y":82,"wires":[["93a369bd.744038"]]},{"id":"93a369bd.744038","type":"udp out","z":"fe42033c.31f16","name":"","addr":"","iface":"","port":"2000","ipv":"udp4","outport":"","base64":false,"multicast":"false","x":231,"y":82,"wires":[]},{"id":"45e5d0ed.aaea7","type":"websocket-listener","z":"","path":"ws://localhost:3000/signalk/v1/stream","wholemsg":"false"}]



Send all signalK event to UDP Port (for using navionics on ipad) - tkurki - 2019-01-20

A plugin to do this directly from Signal K would take very little coding. Would you be interested in giving it a shot?


Sent from my iPhone using Tapatalk


Send all signalK event to UDP Port (for using navionics on ipad) - tkurki - 2019-01-20

I went ahead and wrote a plugin for this. @signalk/udp-nmea-plugin should be downloadable shortly.


Sent from my iPhone using Tapatalk


RE: Send all signalK event to UDP Port (for using navionics on ipad) - pkernevez - 2019-01-22

I've tried the plugin.
I've created 2 merge requests for small improvement.

I still have a problem : I only receive message coming from kplex (and I already can send those message to udp).
I suppose this is probably due to the filter ´app.signalk.on('nmea0183', send)´ that only resend message of 'nmea' type. Is it right ?
I'm also interested to receive other TCP or UDP like OPSensor

I've a screenshot of the message in KPlex but I can't upload it in the forum, the error message said that the file name is invalid, even it's a very simple name (screenshot.png or screenshot.jpeg).

    
Code:
    {
            "enabled":true,
            "id":"OPsensors",
            "pipeElements":[
                {
                    "options":{
                        "logging":false,
                        "subOptions":{
                            "port":"55557",
                            "type":"udp"
                        },
                        "type":"SignalK"
                    },
                    "type":"providers/simple"
                }
            ]
        }


When I listen on UDP I only have some message coming from KPlex

Code:
nc -kluvw 0 192.168.1.255 2000 | stdbuf -o0 tr '$' '\n' | grep XDR
Listening on [192.168.1.255] (family 0, port 2000)
APXDR,A,1.285,D,ROLL*67
APXDR,A,-0.44,D,PTCH*66
APXDR,A,1.283,D,ROLL*61
APXDR,A,-0.436,D,PTCH*57
APXDR,A,1.279,D,ROLL*64
APXDR,A,-0.438,D,PTCH*59
APXDR,A,1.273,D,ROLL*6E
APXDR,A,-0.448,D,PTCH*5E
APXDR,A,1.27,D,ROLL*5D
APXDR,A,-0.461,D,PTCH*55


If I do the same but on the signalK TCP connector I have other message coming from other input:

Code:
nc 192.168.1.131 10110 | stdbuf -o0 tr '$' '\n\$' | grep XDR
IIXDR,A,-0.4,D,PTCH,A,1.3,D,ROLL*77
APXDR,A,1.255,D,ROLL*6A
APXDR,A,-0.426,D,PTCH*56
IIXDR,P,0.9042,B,Barometer*18
IIXDR,C,22.38,C,TempAir*1D
IIXDR,A,-0.4,D,PTCH,A,1.3,D,ROLL*77
APXDR,A,1.254,D,ROLL*6B
APXDR,A,-0.427,D,PTCH*57
IIXDR,P,0.9043,B,Barometer*19
IIXDR,C,22.38,C,TempAir*1D
IIXDR,A,-0.4,D,PTCH,A,1.3,D,ROLL*77
APXDR,A,1.251,D,ROLL*6E
APXDR,A,-0.427,D,PTCH*57
IIXDR,P,0.9041,B,Barometer*1B
IIXDR,C,22.38,C,TempAir*1D

Is it possible to retrieve the missing message ?


RE: Send all signalK event to UDP Port (for using navionics on ipad) - barney2074 - 2019-01-29

Hi Teppo

thanks for writing the plugin.
However, I'm not sure if I am doing something wrong
When I try to install through the SK browser interface, it looks like it is ok, but does not do anything.

When I install through the command line ([color=rgba(0, 0, 0, 0.8)]npm i [/color][color=rgba(0, 0, 0, 0.8)]@signalk/udp-nmea-plugin)[/color]
pi@openplotter:~ $ npm i @signalk/udp-nmea-plugin

npm WARN saveError ENOENT: no such file or directory, open '/home/pi/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/home/pi/package.json'
npm WARN pi No description
npm WARN pi No repository field.
npm WARN pi No README data
npm WARN pi No license field.

+ @signalk/udp-nmea-plugin@1.1.0
updated 1 package and audited 3 packages in 6.321s
found 0 vulnerabilities

I get a file /home/pi/package-lock.json, with the following contents:
{

  "requires": true,
  "lockfileVersion": 1,
  "dependencies": {
    "@signalk/udp-nmea-plugin": {
      "version": "1.1.0",
      "resolved": "https://registry.npmjs.org/@signalk/udp-nmea-plugin/-/udp-nmea-plugin-1.1.0.tgz",
      "integrity": "sha512-PGtQ1eTAloOFto/RQkP4OtAalGKR/bxE4RFOliL5ly9xt7L0nfJCy5tJW2mVjmKMk8/hDE1kSoWjoEFSQiFnvA==",
      "requires": {
        "netmask": "^1.0.6"
      }
    },
    "netmask": {
      "version": "1.0.6",
      "resolved": "https://registry.npmjs.org/netmask/-/netmask-1.0.6.tgz",
      "integrity": "sha1-ICl+idhvb2QA8lDZ9Pa0wZRfzTU="
    }
  }
}


The only way I have been able to relay data to UDP port 2000 has been to configure OpenCPN on the Raspberry to output to UDP- but this seems to place a large load on the RPI- it is running at 100% most of the time, rather than ~20%. I don't normally use OpenCPN on the RPI.

thank you in advance & apologies if this is a dumb question.

Andrew


Send all signalK event to UDP Port (for using navionics on ipad) - tkurki - 2019-01-30

Did you enable and configure the plugin in the plugin configuration section of the server admin ui?


Sent from my iPhone using Tapatalk


RE: Send all signalK event to UDP Port (for using navionics on ipad) - barney2074 - 2019-01-31

(2019-01-30, 06:42 AM)tkurki Wrote: Did you enable and configure the plugin in the plugin configuration section of the server admin ui?


Sent from my iPhone using Tapatalk
Hi Teppo

Yes I did

I have played around with it some more, and found that I have to explicitly enter the broadcast IP address in the ui- even though it is identical  to the IP automatically shown in the UI

Not sure if this is a problem with the plugin, or a quirk with my system, but it seems to have solved the problem for me.

thanks for your reply and for the plugin


Andrew


RE: Send all signalK event to UDP Port (for using navionics on ipad) - Slovak - 2021-08-16

Per https://www.npmjs.com/package/@signalk/udp-nmea-plugin/v/1.2.2 and the description in SK when installing plugins, is this plugin only limited to NMEA 0183 output? Is there a similar path/method/plugin/configuration to achieve the same with NMEA 2000? I looked at https://github.com/SignalK/signalk-to-nmea2000 plugin but that doesn't allow to designate the broadcast address or port, so doesn't seem to accomplish the same.


RE: Send all signalK event to UDP Port (for using navionics on ipad) - tkurki - 2021-08-17

The plugin handles only nmea 0183 data.

What exactly are you trying to accomplish - what would be receiving the n2k data and what format does it expect? Unlike 0183 there is no single common format for transmitting n2k data over other media than canbus.