-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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
Add support for Covariance for GPS Accuracy #23259
Comments
I think horizontal_accuracy() and vertical_accuracy() would likely be more appropriate, and less maths |
The notes are how to implement this are discussed here. Ready for implementation. |
Thoughts on the following? In AP_GPS.h add the following enum // Match https://docs.ros2.org/foxy/api/sensor_msgs/msg/NavSatFix.html
enum class GPS_CovarianceType {
UNKNOWN = 0, ///< The GPS does not support any accuracy metrics
APPROXIMATED = 1, ///< The accuracy is approximated through metrics such as HDOP/VDOP
DIAGONAL_KNOWN = 2, ///< The diagonal (east, north, up) components of covariance are reported by the GPS
KNOWN = 3, ///< The full covariance array is reported by the GPS
}; Then, add the following generic method to populate a covariance array in AP_GPS class. Use either a raw array, or GPS_CovarianceType covariance(const uint8_t instance, double cov[]) const WARN_IF_UNUSED OR GPS_CovarianceType covariance(const uint8_t instance, std::array<double, 9>& cov) const WARN_IF_UNUSED OR GPS_CovarianceType covariance(const uint8_t instance, Matrix3d& cov) const WARN_IF_UNUSED |
Septentrio provides a full covariance matrix for us, we actually derive the horizontal/vertical accuracy numbers from it. |
Great to know! I'd love to see some of the nice GPS backends override this method to populate the full covariance matrices when possible, however it's out of scope for the initial PR. Ublox M8 also can do it according to their API docs, and that's a pretty widely used device from what I understand. |
@Ryanf55 fair enough. For future reference it's here: https://github.com/ArduPilot/ardupilot/blob/master/libraries/AP_GPS/AP_GPS_SBF.cpp#L494 and the struct is here: https://github.com/ArduPilot/ardupilot/blob/master/libraries/AP_GPS/AP_GPS_SBF.h#L202 |
The usage of this new feature will be covered in this ticket: It's next up. I'm proposing to merge this as-is without a consumer to keep PR scope small. EDIT: No dead code allowed. It's going in. |
Feature request
In order to support the ROS2 NavSatFix message, which Ardupilot can publish over DDS, the covariance field for accuracy needs to be filled in. Currently,
AP_GPS
does not have any support for covariance; only hdop and vdop.Describe the solution you'd like
Describe alternatives you've considered
I initially implemented this logic in the DDS layer of Ardupilot, but calculating covariance is something the GPS library could be doing.
Platform
[ x] All
[ ] AntennaTracker
[ ] Copter
[ ] Plane
[ ] Rover
[ ] Submarine
Additional context
The text was updated successfully, but these errors were encountered: