-
Notifications
You must be signed in to change notification settings - Fork 109
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
[J-Turtle] Fix uninitialized values in NavSatFix and add missing NavSatStatus UNKNOWN #220
Conversation
* Fixes ros2#196 Signed-off-by: Ryan Friedman <[email protected]>
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.
There's a few syntax suggestions but overall I think that this change makes sense. Could you do a few fixups and we can circulate this further. It would be great to get some input from other GPS users/maintainers. And also to look at where in the public codebase this is used to make sure that there doesn't seem to be any major incompatibilities/assumptions about this value that we'll break.
@@ -4,12 +4,13 @@ | |||
# type and the last time differential corrections were received. A | |||
# fix is valid when status >= STATUS_FIX. | |||
|
|||
int8 STATUS_UNKNOWN = -2 # status is not yet set |
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.
This makes sense to me to have an uninitialized state as the default.
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.
I view it as a safety problem that the default state is "healthy". Because ROSIDL supports a default constructor in C++, users of NavSatFix are not required to fill this out. Thus, if they take shortcuts, only fit out the lat-long fields, and lose GPS signal,they now report the status as having a fix even though the data is invalid and might not realize it.
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.
Doesn't defaulting to STATUS_NO_FIX
fix the problem?
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.
You could also default the latitude and longitude to NAN to avoid accidental visits to Null Island. https://en.wikipedia.org/wiki/Null_Island
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.
Doesn't defaulting to
STATUS_NO_FIX
fix the problem?
Yes, but adding a new value makes it exactly clear between these two situations:
- The ROS driver has started but it has not received a fix status message from the GPS =>
STATUS_UNKNOWN
- The ROS driver has communicated with the GPS, and the GPS said it has no fix =>
STATUS_NO_FIX
I'd vote for keeping these as distinct as one means you might have a wiring or baud issue, and the other means that you just need to wait for it to warm up or get a better view of the sky.
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.
I am a fan of setting the latitude and longitude to NAN as default (assuming the ROS IDL lets us do that).
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.
You could also default the latitude and longitude to NAN to avoid accidental visits to Null Island. https://en.wikipedia.org/wiki/Null_Island
This is not currently possible. See my docs PR which explains what's currently possible with NaN
.
ros2/ros2_documentation#4210
I am working on adding support for NaN defaults and NaN constants, but it's not clear whether it will make the Jazzy release.
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.
Adding in the NaN logic is reasonable, but I think that should be a sanity check of the data, more than the canonical way to know what the status is. Checking all field values for NaN can be very expensive versus being able to quickly check an enumeration and stop processing data early.
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.
I would be more of a NaN fan if tooling supported it better, but there's currently no way to to set a NaN value in DDS IDL, nor is it supported in JSON. See here for implementation notes. I'd prefer not hold up this PR which was intended as a bugfix with other things like NaN support.
ros2/rosidl#789
For reference default value syntax is defined here: https://design.ros2.org/articles/legacy_interface_definition.html |
* Don't over declare ones that are already unknown-initialized Signed-off-by: Ryan Friedman <[email protected]>
Signed-off-by: Ryan Friedman <[email protected]>
All fix-ups are complete. When you are happy, please share/tag some stakeholders. Cheers! |
@evenator @mikepurvis @danthony06 @kmhallen @hortovanyi I've seen your info on GPS packages. Do you have any concerns? |
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.
The changes look good to me. I've reached out for others thoughts.
@tfoote I think the changes look good, and mirror some experimental changes I've made for the gps_common package in ROS 2. One thing we've seen, and have gotten some open issues with, on the gps_common package is better real time kinematic GPS support. If we're making changes to this message, is it worth thinking about adding some additional definitions to indicate it's an RTK capable system, and whether or not it's actively using RTK corrections? |
If the device is uninitialised it shouldn't be publishing a NavSatFix message IMHO. NavSatFix is based on the older NMEA standard .. Will be releasing an update soon that will publish NavSatFix message from the UBX data, as a separate node with a high precision location. The UBLOX UBX values are different to the older NavSatFix values https://github.com/aussierobots/ublox_dgnss/blob/main/ublox_ubx_msgs/msg/UBXNavStatus.msg Of most concern to us is if the differential correction has been applied such that high precision (ie centimetre level accuracy) location is possible |
Heres a link to the proposed code for translation the status message for NavSatFix from UBX data. Havent merged and published this branch yet https://github.com/aussierobots/ublox_dgnss/blob/1e10c8562ad79a8fca1540a9c78968c117920980/ublox_nav_sat_fix_hp_node/src/ublox_nav_sat_fix_hp_node.cpp#L174 |
I don't think we're necessarily tied to NMEA 0183, and aren't directly representing that information in this message. There's plenty of non-NMEA 0183 based GPS receivers that can indicate things like a hardware fault that could be encapsulated by this unknown status that are separate from a normally functioning GPS receiver that just hasn't acquired a fix yet, and we still send out a NavSatFix message for them. |
@danthony06 in that scenario from a UBX perspective there is no fix https://github.com/aussierobots/ublox_dgnss/blob/main/ublox_ubx_msgs/msg/GpsFix.msg which translate through to |
I've used this message with many non-NMEA message standards. If there was a new ROS message for every GPS protocol, it would be unusable and couple two interfaces together. |
What is the effect of a subscribing application knowing it's RTK capable? We just populate the covariance and RTk happens to have a really low covariance when it goes into the state estimation. |
Yes, we also do this with the open source Novatel GPS driver to publish NavSatFix messages. I don't think we're disagreeing here. The benefit of knowing if the receiver is RTK receiver is it helps remove ambiguity if the receiver is not functioning properly, or is in degraded conditions. I'm specifically thinking of times where I've been trying to diagnose a faulty RTK receiver in the field, and it's nice to know if the system believes it's applying RTK corrections and the fix is still bad, or if it's RTK capable, but is not using them for some other reason. Looking at the covariances doesn't necessarily give me that level of insight into the system. |
The main reason to publish the NavSatFix message is for compatibility with existing tools and visualisation of location with co-variance matrices.
It really lacks a lot of other detail. Such as which constellations have been used, spoofing, dead reckoning, power state to name a few.
If there was a hardware issue wouldn’t it be better to publish a diagnostic message?
https://github.com/ros/diagnostics/blob/ros2/README.md
diagnostics/README.md at ros2 · ros/diagnostics
github.com
… I don't think we're necessarily tied to NMEA 0183, and aren't directly representing that information in this message. There's plenty of non-NMEA 0183 based GPS receivers that can indicate things like a hardware fault that could be encapsulated by this unknown status that are separate from a normally functioning GPS receiver that just hasn't acquired a fix yet, and we still send out a NavSatFix message for them.
I've used this message with many non-NMEA message standards. If there was a new ROS message for every GPS protocol, it would be unusable and couple two interfaces together.
Yes, we also do this with the open source Novatel GPS driver to publish NavSatFix messages. I don't think we're disagreeing here.
The benefit of knowing if the receiver is RTK receiver is it helps remove ambiguity if the receiver is not functioning properly, or is in degraded conditions. I'm specifically thinking of times where I've been trying to diagnose a faulty RTK receiver in the field, and it's nice to know if the system believes it's applying RTK corrections and the fix is still bad, or if it's RTK capable, but is not using them for some other reason. Looking at the covariances doesn't necessarily give me that level of insight into the system.
|
Yes, I was agreeing. Happy to add that fix type, a |
Agree, this is approach I've used too to use the diagnostics topic, for GPS diagnostics. The PR here is scoped for fixing the missing enumerations. Given the timeline for Iron freeze, I'd like to keep this discussion focused on small changes here to those specific enums, rather than adding in N number of other fields that may push back the merge beyond Iron. For Iron users, until then, diagnostics can be useful, and they can always use the GPSFix message in gps_common which has a lot more detail. I'm happy to work with the stakeholders to define the GPS message to support all the kinematics information.. but I don't think it needs to be done in this PR. |
This is what the UBX nav status message has in it navigation fix status informationbool diff_corr # differential corrections available It is separate from the gps fix value |
@Ryanf55 sounds good to me. Sorry to derail the conversation about the RTK status. |
my last comment - STATUS_UNKNOWN is STATUS_NO_FIX. There is no need to differentiate. If the device is not initialised or in fault or spoofed (compromised) it shouldn't publish a NavSatFix message |
Can you provide the reference?
This puts the burden on the subscribing application to rate-check the NavSatFix messages, and then handle timeout appropriately. Currently, in Foxglove map panel for example, it colors the icon based on the message. If the position fails, and it stops publishing, their UI will just show the last message received, but it just looks like the vehicle has stopped moving. When you publish status known, it colors the icon red. |
If the message has not started to be published or stops being published it is not reliable and should not be displayed. In the later case, it is no longer valid. What decay rate does the Foxglove map panel have for that type of message before it removes it?? NavSatFix is a message from a simpler time for GPS devices where accuracy was really 10s of meters - suitable for navigation by boats on water! Hence the NMEA standard. If I was asked to vote to add that new status item, I would vote no - it will break code for little gain IMHO. In my projects, I don't use NavSatFix, the publishing of it is really being added so that the projects can visualise the lat,lon,alt in high precision with existing tools. |
If we're successfully communicating with the GPS, I expect to see ROS messages, even if everything is invalid. Otherwise, I don't know if the device has malfunctioned, lost communications, or my node is simply misconfigured. This is also consistent with other sensors. For example, laser rangefinders typically still publish NaNs if they can't measure a target's distance, lidars will still publish pointclouds with all NaNs, and IMUs will publish even if they're unable to measure state in the devices I've used. |
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.
No objections from me.
I've written a few drivers now for lidars, computer vision cameras, can bus, IMUs etc - the most complicated are the GPS drivers - I don't agree with the above :) ... check the log files |
@tfoote If I remove the unknown status, and just have |
Unfortunately, no. The freeze was earlier this week. But if we get agreement on this, we can merge it into Rolling and have it ready for J-Turtle. |
Hey, I agree with your opinion about adding additional field for STATUS_RTK, STATUS_DGPS. Also, if it is possible, i think more information will be good. For example, my custom GPS message have these fields:
So, Are you thinking adding new fields or just add STUTUS_RTK? |
For gps_common, we are wrapping the gpsd client, so we mostly use the statuses they define here: https://gitlab.com/gpsd/gpsd/-/blob/master/include/gps.h#L193, which I think is pretty close to what you are proposing. I would not mention vendor specific solutions, like what I assume the _OMNISTAR member is, just because there's so many possible vendors. Instead, I would replace it with something more generic. |
Since ROS messages and API's already try to align with Linux conventions, this seems like a great idea. Agree on not adding vendor-specific messages. I don't see why a ROS consumers of GPS data would care which vendor their GPS sensor is using for corrections; I haven't seen other messages in this repo that have vendor specifics. |
I'd suggest adding a DGPS definition, because that's relatively common. Is PSRDIFF specific to Novatel receivers? I've only seen it used there, but I'm not sure if it's something proprietary to them. |
To the best of my knowledge, PSRDIFF is not specific to Novatel receivers and can be used for all GPS receivers. Additionally, I highly support the idea of adding a DGPS field. Moreover, I believe it would be beneficial to have more detailed fields for corrections, as it often requires checking the GPS interface. To address this issue, I have started using the Rviz plugin, which displays various GPS features, including corrections. Consequently, I currently utilize a custom message to send GPS status. Therefore, having more status fields is important to me. However, if other ROS users do not share this preference, I understand and respect their perspective. Regarding the OMNISTAR field, you are correct that it is very specific. I included all the fields from my example usage to demonstrate this to you. Furthermore, I have examined the gpsd repository you mentioned, @danthony06, and I am considering using a similar solution. Thank you for bringing it to my attention, and I appreciate your interest in this matter. |
I'd like to get this moving again. First of all, I have to say stability of interfaces is a great part of ROS. However, if the current definition is based on a 15-year-old technical state and even such simple things as adding a few (fake) enum values takes years (it was requested for ROS 1 in 2020), it really hits hard on the usability of ROS and leads to big fragmentation where everyone implements his own message type because the available ones do not fit. Let's first review existing ROS interfaces. Except NavSatStatus, there is gps_common/GPSStatus. It defines the following constants:
Don't ask me where 18 and 33 originated. I don't know and neither does git blame. WAAS is a special case of SBAS, so that can be ignored as there already is agreement that vendor-specific things should not be a part of this message. As this is the only other widely used generic ROS interface, I would suggest to keep the values of constants in NavSatStatus compatible. There's plainly no reason to redefine them differently (except for having a nice increasing number sequence). So my suggestion is:
This should cover most of the generally used algorithms for now and close future. Regarding statuses with dead-reckoning - I don't think they need special treatment. If the DR is short, the precision of the last valid mode will mostly hold, so the driver can keep e.g. RTK fix. If the DR is longer, the driver should downgrade to FIX and record the growing variance. But maybe I'm wrong on this one, I've never worked with a DR receiver. Regarding
I always treated ROS drivers as a bit more clever pieces. Each manufacturer has different SDK with different approaches. But ROS has some standard not only regarding data in the messages, but also regarding when the messages should be published. The role of the ROS driver is to adapt the SDK to the ROS API. Sometimes it's just passthrough, sometimes it requires more sophisticated transformations. Regarding Regarding future extensibility, it might also be good to consider moving the constant definitions to their own .msg files. That would have the great benefit that adding a new constant would not change the signature/hash of the status message, so adding new constants in the future would not be such a pain for downstream packages and inter-release interoperability. This approach can actually be used right away as NavSatStatus needs to be changed anyway to incorporate the default value (be it NO_FIX or UNKNOWN). For legacy reasons, the few constants defined in NavSatStatus could also be left there, with a comment that more constants are available in another .msg file. |
This pull request has been mentioned on ROS Discourse. There might be relevant details there: https://discourse.ros.org/t/future-of-ros-2-gps-support/33297/37 |
I like your statement: The part about Publishing NO_FIX makes it clear to consuming libraries that the ROS driver is up and running, but that it does not have connection to the GPS sensor device. Would you be ok if I took the minimum changes in the PR to fix the known issues, and then you do a follow up PR for adding the new constants as you propose above? Now is the time to do message work for J-turtle. |
If that was aimed at me, then sure, go ahead ;) |
Yup. If you agree with the current PR, then can you approve? I would like to document this context somewhere, but the message definition does not seem like the right place. Does anyone know where a good spot to document advanced usage and intent of messages is? |
Here are the standard fix code for NMEA that I believe NavSatFix is based on - this change doesnt make sense to me. However the UBX codes we use are different from the old NMEA https://www.sparkfun.com/datasheets/GPS/NMEA%20Reference%20Manual-Rev2.1-Dec07.pdf Table 1-4 Position Fix Indicator |
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.
I would suggest that we not complicate this by doing the NaN change now too. There was a bunch of discussion in June last year.
And there's a concrete proposal to extend the enumeration of fix types here: #220 (comment) from @peci1
ANd a thread from the end of the year proposing a new message. https://discourse.ros.org/t/future-of-ros-2-gps-support/33297/54 that would seem like a good idea too. @SteveMacenski
But as I haven't seen progress on that I think it would make sense to do at least this iteration for now while the next generation is being designed.
@@ -4,12 +4,13 @@ | |||
# type and the last time differential corrections were received. A | |||
# fix is valid when status >= STATUS_FIX. | |||
|
|||
int8 STATUS_UNKNOWN = -2 # status is not yet set |
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.
Adding in the NaN logic is reasonable, but I think that should be a sanity check of the data, more than the canonical way to know what the status is. Checking all field values for NaN can be very expensive versus being able to quickly check an enumeration and stop processing data early.
@tfoote I would just like to mention that that next generation isn't a fast moving freight train to the future and very well might not be something we ultimately spearhead if the right partners and collaborators don't assemble. I would not take the discussions in that thread as a indicator that this is the immediate priority - because frankly it doesn't seem to be from anyone involved thus far (but very hopeful that we'll get started with some parts of it sooner than later). Its looking increasingly like it will be scaled back to improvements over the handling of GPS data with new frameworks (i.e. replace navsattransform; use 'new' & standard GPS processing libraries) within ROS with new coordinate systems (optional UTM, ECEF, etc) rather than addressing the core message interface. Core interface message changes for RTK and other subtle details I think should be spearheaded by more active users of that data and experience deploying some of the more advanced systems available. Just like the
I'd welcome someone like @Ryanf55 or others to come and propose what that new future looks like on the interfaces side of things for replacing or augmenting Tl;dr: I wouldn't block 'good' here in expectation of 'great' coming along any day now. Some effort that I'm related to might come along before long that touches alot of GPS capabilities, but interface design isn't currently in that imminent scope. I encourage others with a vested interest and expertise to take that on and I'll be an early adopter of it. A group of 3-4 expert end users and 3-4 GNSS/INS manufacturers with ROS knowledge could get alot done in a few calls over a quarter, I think. Happy to help support assembling that group if someone wants to take the lead on it and bring it over the line |
Co-authored-by: Martin Pecka <[email protected]> Signed-off-by: Tully Foote <[email protected]>
+1 @SteveMacenski Yes I'd definitely like to land this incremental change. There was the one worry from @peci1 about the bitfield logic that I wanted to resolve. I've accepted his documentation suggestion to make that less of a worry. As we're approaching the cutoff for Jazzy feature freeze I'd like to land this as is without increasing scope. With the current scope of only adding enumerations it's backwards compatilble. Does anyone have any objections to doing this minimal change as proposed now? @Ryanf55 @peci1 @dagar |
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.
Thanks Tully, I'm happy with the PR now!
Approved! |
I'm happy to take this up in May. MicroStrain is a GNSS-INS manufacturer who understands ROS and also is very good at API design; I think we can leverage their expertise in designing messages for GNSS-INS. I also have a good relationship with Trimble who make the PX-1. It's pretty clear from the discussions here that NavSatFix is not appropriate for many use cases with GNSS-INS, and there is also a need for vendor-specific messages anyways. Is anyone interested in able to plan on a small working group in May to focus on interface design for GNSS-INS to try to cover some of the items here:
I don't consider myself an expert, but I do have time and access to multiple vendor's hardware to test on |
Thanks for all the effort to iterate on this change. It's small but will hopefully be helpful. I'm going to merge it as is and thanks @Ryanf55 for planning to kick off the planning for the next cycle after the release. |
…atStatus UNKNOWN (#220) * Fix unitialized values in NavSatFix and add missing UNKNOWN * Fixes #196 * Fix default initialization instead of constants * Define SERVICE_UNKNOWN Signed-off-by: Ryan Friedman <[email protected]> Signed-off-by: Tully Foote <[email protected]> Co-authored-by: Tully Foote <[email protected]> Co-authored-by: Martin Pecka <[email protected]>
I would love to get this in IRON by the freeze on Mon. April 17, 2023