SK
Signal K4mo ago
Aswin

Aswin - I could use some advice from one of the...

I could use some advice from one of the core developers on this one. I really, really want performance data generated by the polar performance plugin on my B&G Triton2 displays. The B&G performance plugin can generate a B&G specific PGN to send performance data back to the N2K network. However, the Triton2display will only use the B&G performance PGN when it comes from a H5000 sailing computer. Therefore the B&G performance plugin uses SimpleCan to emulate a H5000 device. SimpleCan only works on linux. I am running Windows. So there is my problem. I use the Yacht Devices Yden02 as a gateway between N2K and signalK server. This gateway has a bridging function and will pass on any received timestamped GPN unchanged. I could fork the B&G performance plugin and modify it to work for me. How does app.emit works? Can I use it in a way that I can emulate the presence of an H5000 device and send the appropriate PGN as if it was coming from this device knowing that the Yden will bridge the PGN unchanged?
13 Replies
Scott Bender
Scott Bender4mo ago
You can’t emulate another device using the yden02 All pgns sent through it will look like they come from the yden02
Aswin
AswinOP4mo ago
According to the information I got from Yacht Devices this is possible: "YDEN-02 gives direct R/W access to NMEA 2000 Media Layer. So, just make a full emulation of the CAN node — with a separate CAN node address [ dynamic, via Address Claim, pass fake H5000 64-bit UID in Address Claim] and reply with fake Product Information, PGN 126996 from this "virtual node" address. Tip: RAW protocol can pass Device Address unchanged if you send message in "full format" (used for bridging) — with both timestamp and R flag: 17:33:21.141 R 09F80115 A0 7D E6 18 C0 05 FB D5 not in short format 19F51323 01 02
Scott Bender
Scott Bender4mo ago
Hmm. Ok. I do currently use the short format. canboatjs would have to be enhanced to optionally send in “full format” or your code could connect to the yden and do everything, You could call pgnToYdgwRawFormat from canboatjs, which will return the short format, and then put the timestamp and R on the front and send over tcp to the yden. But won’t be a big deal for me to add to canboatjs. I can do that this week…
Aswin
AswinOP4mo ago
That would be very nice. Does that mean that I can then just use app.emit('nmea2000out', fullFormatPGN)?
Scott Bender
Scott Bender4mo ago
You would use the canboat json format and emit to nmea2000JsonOut That will do the encoding for you that would look something like this for address claim
{
"prio":6,
"src":44,
"dst":255,
"pgn":60928,
"fields": {
"Unique Number":1072,
"Manufacturer Code":"Yacht Devices",
"Device Instance Lower":0,
"Device Instance Upper":0,
"Device Function":130,
"Device Class":"Sensor Communication Interface",
"System Instance":0,
"Industry Group":"Marine",
"Spare": 1,
"Arbitrary address capable": 1
}
}
{
"prio":6,
"src":44,
"dst":255,
"pgn":60928,
"fields": {
"Unique Number":1072,
"Manufacturer Code":"Yacht Devices",
"Device Instance Lower":0,
"Device Instance Upper":0,
"Device Function":130,
"Device Class":"Sensor Communication Interface",
"System Instance":0,
"Industry Group":"Marine",
"Spare": 1,
"Arbitrary address capable": 1
}
}
I assume that plugin already does that?
Aswin
AswinOP4mo ago
Yes, the plugin already has some code for the address claim and product info simpleCan = new SimpleCan({ app, canDevice: canDevice, preferredAddress: sourceAddress, transmitPGNs: [ 126996 ], addressClaim: { 'Unique Number': 1731561, 'Manufacturer Code': 'Navico', 'Device Function': 190, 'Device Class': 'Internal Environment', 'Device Instance Lower': 0, 'Device Instance Upper': 0, 'System Instance': 0, 'Industry Group': 'Marine' }, productInfo: { 'NMEA 2000 Version': 2100, 'Product Code': 246, 'Model ID': 'H5000 CPU', 'Software Version Code': '2.0.45.0.29', 'Model Version': '', 'Model Serial Code': '005469', 'Certification Level': 2, 'Load Equivalency': 1 } })
Scott Bender
Scott Bender4mo ago
FYI, I have confirmed that this works. Have some more testing and cleanup to do. I’ve made it work like the socketcan one, so you don’t have to worry about doing address claims or negotiation. And I have an example plugin. Also making it easy to make so the existing plugin can support both socketcan and YD devices.
Aswin
AswinOP4mo ago
That is very nice. Now I have to find some time to fork the plugin. Thanks.
Scott Bender
Scott Bender4mo ago
I should be releasing tomorrow.
Scott Bender
Scott Bender4mo ago
Here’s the example plugin code. Should be pretty simple to update that plugin to support both devices. https://github.com/canboat/canboatjs/blob/yd-full-format/examples/signalk-device-emulator/src/index.ts
GitHub
canboatjs/examples/signalk-device-emulator/src/index.ts at yd-full-...
Native javascript NMEA 2000 decoder and encoder. Contribute to canboat/canboatjs development by creating an account on GitHub.
Scott Bender
Scott Bender4mo ago
I've released canboatjs v2.11.0 with this support
Ben
Ben4mo ago
Does this mean the b&g performance plugin now works with the YDNU?
Scott Bender
Scott Bender4mo ago
I have added the needed support to canboatjs, but I don’t think the plugin has been updated to use it.

Did you find this page helpful?