Open dpazz opened 7 months ago
I think it can be solved changing the key transferred to callback in navigationdata.js line 37 from: 'navigation.courseRhumbline.nextPoint', to 'navigation.courseRhumbline.nextPoint.position',
The source for the navigation data is RMB - so I think the error has been introduced with https://github.com/SignalK/nmea0183-signalk/commit/141bcbeae961982fb96d74c10e06864cff0507bd.
As far as I understand the RMB parser is now inline with the spec (although the documentation at https://signalk.org/specification/1.7.0/doc/vesselsBranch.html does not really describe the "position" property of nextPoint). So I guess the signalkto-nmea2000 must also be adapted. No sure how freeboard-Sk is doing this...
I think the misleading is due to the 1.7.0 Sk spec. because nextPoint and previousPoint have different schema (resulting "incomplete" for the former where the "position" object is undefined) : even they are entities of the same type. I think that before any code release of the plugins an agreement on "fixing" the spec. should be reached
In the SK schema things are already different: https://github.com/SignalK/specification/blob/b3bbad26fe131b25b372dab85edeb87eb6d6da26/schemas/groups/navigation.json#L94
I missed this screenshot to be more clear
I think it can be solved changing the key transferred to callback in navigationdata.js line 37 from: 'navigation.courseRhumbline.nextPoint', to 'navigation.courseRhumbline.nextPoint.position',
This fixed the issue for me. Thank you @dpazz
I think it can be solved changing the key transferred to callback in navigationdata.js line 37 from: 'navigation.courseRhumbline.nextPoint', to 'navigation.courseRhumbline.nextPoint.position',
That fixed it for me as well, thanks. Looks like https://github.com/SignalK/signalk-to-nmea2000/pull/99 is the full fix.
If the "Navigation Data" option is enabled in the plugin this exception appears in the log: Mar 17 17:23:55 TypeError: Cannot read properties of null (reading 'latitude') at callback (/home/pi/.signalk/node_modules/signalk-to-nmea2000/conversions/navigationdata.js:69:39) at /home/pi/.signalk/node_modules/signalk-to-nmea2000/index.js:209:44 at Next.valueF (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:912:14) at Next.value (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:901:31) at /home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:1048:24 at /home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:463:23 at processAfters (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:359:11) at Object.inTransaction (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:439:9) at Dispatcher.push (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:1214:24) at Dispatcher.handleEvent (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:1267:17) at /home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:242:17 at /home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:1787:17 at Timeout.sender [as _onTimeout] (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:2242:14) at listOnTimeout (node:internal/timers:569:17) at process.processTimers (node:internal/timers:512:7) But data required for conversion) are there (...nextPoint.position obj has a 'not null' latitude property), as is reported by Data Browser (see the attached screenshot). The signalk-server release is the last one (2.6.2) but I didn't looked to see if the exception occured in previous releases too.