-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
AP_NavEKF3: ensure EK3 does not read GPS when disabled #27195
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -234,7 +234,8 @@ bool NavEKF3_core::getPosNE(Vector2f &posNE) const | |
// In constant position mode the EKF position states are at the origin, so we cannot use them as a position estimate | ||
if(validOrigin) { | ||
auto &gps = dal.gps(); | ||
if ((gps.status(selected_gps) >= AP_DAL_GPS::GPS_OK_FIX_2D)) { | ||
if (frontend->sources.getPosXYSource() == AP_NavEKF_Source::SourceXY::GPS | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One concern is that the position may jump as the user changes between source sets. So a source set that includes GPS will show the latest GPS position but if the user then switches back to external nav, it'll jump back to the last good position estimate. I actually agree with this change or something like it. I've always thought it odd that the EKF3 sometimes reports the raw GPS position instead of the EKF position. We already report the raw GPS position to the GCS so I'm not sure we really need to report it again through the EKF. That's probably too big a change for the GCSs to absorb though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Resolving that problem is complicated by the fact that the EKF can return a position estimate even when it is feeling ill. It will do this if it has ever managed to get an origin (i.e. be happy with where it is), and when the GPS is not capable of providing a location. What that means is that never returning a GPS from the EKF would mean changing the interface we use onto the backends to be more complicated. e.g. "EK3 give me a location". What, you can't do that? OK, "GPS, what about you?" Really?! OK, "EK3, please give me your best guess". I don't think it will be all that pretty. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... you can't really use the data if getLLH returns false; if it has never seen an origin and the GPS isn't giving a location then |
||
&& gps.status(selected_gps) >= AP_DAL_GPS::GPS_OK_FIX_2D) { | ||
// If the origin has been set and we have GPS, then return the GPS position relative to the origin | ||
const Location &gpsloc = gps.location(selected_gps); | ||
posNE = public_origin.get_distance_NE_ftype(gpsloc).tofloat(); | ||
|
@@ -348,7 +349,8 @@ bool NavEKF3_core::getLLH(Location &loc) const | |
bool NavEKF3_core::getGPSLLH(Location &loc) const | ||
{ | ||
const auto &gps = dal.gps(); | ||
if ((gps.status(selected_gps) >= AP_DAL_GPS::GPS_OK_FIX_3D)) { | ||
if (frontend->sources.getPosXYSource() == AP_NavEKF_Source::SourceXY::GPS && | ||
gps.status(selected_gps) >= AP_DAL_GPS::GPS_OK_FIX_3D) { | ||
loc = gps.location(selected_gps); | ||
return true; | ||
} | ||
|
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.
Although it's unusual a user could enable only altitude or only velocity (xy or z) while not using xy position so I think we need a more fine grained method to disable it. Also remember that even if the active source isn't GPS, it is still possible if EK3_SRC_OPTIONS = 1 (Fuse all velocities) that GPS velocities from another source set (e.g. not the active source set) could be used.