-
-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: Add NMEA stream handling to Course API. #1750
base: master
Are you sure you want to change the base?
Conversation
Set / clear destination from NMEA stream data.
Fixes issue of corrupted nextPoint value when emitting v1 course delta.
Setting this param causes the stream input to be ignored until the endpoint is called again without specifying `force`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did I understand the idea here correctly: we don't touch the 0183 and N2K parsers and instead make course API act on the sk messages they produce?
Short answer is yes. After considering a number of approaches I landed on this approach for the following reasons:
|
@tkurki is there anything further required here? |
@tkurki Have updated this to provide end points to store settings to enable the provisioning of a control in the server admin-ui. I have not included any changes to the admin-ui in this PR. |
I gave this a go with https://github.com/SignalK/signalk-server/blob/master/samples/gofree-merrimac.log that has BWC and RMB. Nextpoint shows up nicely in Freeboard. Just one thing that I noticed: should the source for course data be |
Have you been able to test this out in real world scenarios/data? |
I guess Swagger provides the minimal UI for this, so we can merge without a UI. Do you have ideas as to where in the Admin UI this setting would go? |
The docs now refer only to 0183, but PGN 129284 also provides nextPoint - update the docs to cater for this? I updated the PR description with a sentence as to motivation for this feature - what it allows. |
Probably should be the original source. I can make that change. |
I have tried it with as many source samples I could get and with my NMEA simulator tool. |
I think it aligns with being located in Server Settings with the other settings saved to the If the admin-UI called the api endpoint to change mode then it would not require a server re-start. In this case it might want to be located in another section. |
Only with the lmited devices I have and the data sources I can connect to. As part of that testing I raised SignalK/nmea0183-signalk#255 as nextPosition was not getting cleared when NMEA sentence contained no data. |
I updated the docs to reflect that the Course API looks at the the following paths populated by the
Sentences and PGNs can then continued to be managed in these plugins as required. |
Thinking about it a little further, I did originally consider this but it adds some source management overhead so as not to leave a litter of If the source should reflect the NMEA source, should the value be a combination of NMEA source id and |
I think the lifecycle of the values is kind of a separate concern - the same thing happens for all values that have had a value and then turn to null. I think there is more value in having the real source of the course destination available. I think you're thinking too much into the role of the logic in this PR. To me there's input from a source (0183, N2K, api calls) that is reflected in course API values. As an API user I might want to know where the value that I am seeing came from, not how the server works internally. I would also imagine that in most cases where this integration kicks in the course is primarily managed outside sk server, in the environment where the nmea data is coming from, so littering should be less of a problem. I started working on a generic timeout mechanism, maybe that should be implemented so that data is actually removed some day, not just cleared by sendin null 🤔 . |
Just so I'm clear we are only talking about the source of course.nextPoint not all the paths set by Course API. |
I have made an update that sets the source of the |
Add & use type discriminators for narrowing Update down to having values or meta. Avoids meta is more typescriptish.
Separate cases for (1) clear destination (2) update destination Less exit points for clarity.
Provide the ability for the Course API to set the destination based on the data received from NMEA connections. This allows application developers to use V2 Course API with course data coming from NMEA 0183 and NMEA 2000 sources.
Delta messages with a source.type of NMEA0183 or NMEA2000 containing path values for
navigation.courseRhumbline.nextPoint.position
ORnavigation.courseGreatCircle.nextPoint.position
will trigger invoke the course
setDestination()
method.Source priorities:
The following priorities are applied when determining whether a destination will be set from an NMEA delta:
nextPoint.position
data will be usedapiOnly
mode is enabled then NMEA sources are ignored.Approach:
A subscription has been added to the Course API for the paths
navigation.courseRhumbline.nextPoint.position
ORnavigation.courseGreatCircle.nextPoint.position
to listen for deltas generated by NMEA data connections and set / clear the destination using API methods.Note: The destination set by an NMEA source WILL NOT be cleared when the NMEA source sentence contains no data due to a
nmea0183-tosignalk
plugin processing issue (See SignalK/nmea0183-signalk#255)In the default mode (apiOnly=false)
Clearing a destination using an API request, when an NMEA source still has an active destination, will see the destination set to the value provided by the NMEA data.
Enabling apiOnly mode using
HTTP POST ./course/_config/apiOnly
will:Disabling apiOnly mode (default) using
HTTP DELETE ./course/_config/apiOnly
will: