Skip to content
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_Arming: check all GPS's for fix and health #18333

Merged
merged 1 commit into from
Aug 30, 2021

Conversation

IamPete1
Copy link
Member

This prevents comparing the distance between two GPS where one has a fix and the other does not. If you have two GPS's setup they must now both be healthy and both have a 3D fix. Currently we will do all_consistent check if only the primary is healthy and has a fix, this results in exciting errors such a the one I hit in the wild where the GPS was reporting a position inconsistency of 5731458m (the distance between my true location and 0 lat 0 long)

image

@IamPete1 IamPete1 added the GPS label Aug 15, 2021
libraries/AP_GPS/AP_GPS.h Outdated Show resolved Hide resolved
libraries/AP_GPS/AP_GPS.h Outdated Show resolved Hide resolved
Copy link
Contributor

@WickedShell WickedShell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting a message back of "Bad GPS Position" is actually worse then the previous distance number. The number showed that clearly they two were different, whereas bad position doesn't tell us which is wrong, and it leaves us easily staring at just the primary. The message should be telling you which GPS has a bad status.

I think the check either needs to move into AP_GPS and tell you which GPS has a low status/bad health, or you need to just encode the logic in AP_Arming to do the scan. But the error strings really need to get better for this change to not just create more confusion.

libraries/AP_GPS/AP_GPS.cpp Outdated Show resolved Hide resolved
libraries/AP_GPS/AP_GPS.cpp Outdated Show resolved Hide resolved
libraries/AP_GPS/AP_GPS.cpp Outdated Show resolved Hide resolved
libraries/AP_GPS/AP_GPS.cpp Outdated Show resolved Hide resolved
libraries/AP_GPS/AP_GPS.cpp Outdated Show resolved Hide resolved
@IamPete1
Copy link
Member Author

IamPete1 commented Aug 19, 2021

Move to only check within AP arming, AP_GPS changes removed, much smaller patch.

I still need to give this some testing in SITL.

@IamPete1 IamPete1 added NeedsTesting and removed GPS labels Aug 19, 2021
for (uint8_t i = 0; i < gps.num_sensors(); i++) {
if (gps.get_type(i) == AP_GPS::GPS_Type::GPS_TYPE_NONE) {
if (gps.primary_sensor() == i) {
check_failed(ARMING_CHECK_GPS, report, "GPS primary not configured");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this block you from disabling GPS if you don't need it? This looks like it will have the indoor positioning people yelling at us...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it does, but you already have to turn off the gps check or you fail at hdop, see #14661

IMHO we should not be comming into the gps check at all in that case

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sorta breaks the template here: https://github.com/ArduPilot/ardupilot/blob/master/libraries/AP_Arming/AP_Arming.cpp#L1215

If we want to not run GPS checks then we should be bailing in the start of GPS checks. (How to reliably ID that is a different discussion)

libraries/AP_Arming/AP_Arming.cpp Outdated Show resolved Hide resolved
check_failed(ARMING_CHECK_GPS, report, "GPS is not healthy");
return false;
//GPS OK?
if (!AP::ahrs().home_is_set() ||
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do think it is a little odd checking home as part of the GPS checks. Maybe we should move this, although nowhere really jumps out as better.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AP_AHRS::pre_arm_checks ?

It's gated on the GPS checks being engaged, which is a bit silly, but we can continue to use that in the pre_arm_checks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checking home which is not GPS specific can lead to the wrong GPS being identified, is primary is set to 2nd GPS and no home it will say 1st GPS is bad

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved home check to after per-gps checks.

@IamPete1 IamPete1 force-pushed the GPS_arming branch 2 times, most recently from 0ef5f41 to bf10a2f Compare August 22, 2021 22:10
@IamPete1
Copy link
Member Author

rebased and stopped trying to check the type of the blended instance.

@IamPete1 IamPete1 changed the title AP_GPS/AP_Arming: add checks for all healthy and worst fix and check on arming AP_Arming: check all GPS's for fix and health Aug 22, 2021
@davidbuzz
Copy link
Collaborator

seem fair to me. all tests pass.

Copy link
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like what we agreed upon at the call this-morning.

Also really ought to be moved into AP_GPS IMO - but that's a PR for another day.

#endif
(gps.get_type(i) == AP_GPS::GPS_Type::GPS_TYPE_NONE)) {
if (gps.primary_sensor() == i) {
check_failed(ARMING_CHECK_GPS, report, "GPS %i: primary but not configured", i+1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"configured" is a terrible word to use in relation to GPSs here :-)

@peterbarker
Copy link
Contributor

... also, +1 for grocer's apostrophe.

@tridge tridge merged commit ce56bfe into ArduPilot:master Aug 30, 2021
@IamPete1 IamPete1 deleted the GPS_arming branch August 30, 2021 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants