-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
GPS preflight check: improve reporting #10586
Conversation
… 0.1 1 was too high to pass the EKF2 test (EKF2_REQ_SACC which is 0.5 by default) and thus switching into position mode in HIL was not possible.
So that they can be used for reporting errors.
estimator status init is not required.
@@ -113,7 +113,7 @@ static bool magnometerCheck(orb_advert_t *mavlink_log_pub, vehicle_status_s &sta | |||
|
|||
if (!mag_valid) { | |||
if (report_fail) { | |||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: MAG #%u invalid", instance); | |||
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: Mag #%u invalid", instance); |
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.
What does "Mag invalid" mean?
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.
Changed to Preflight Fail: no valid Data for Mag
. Is that better?
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.
Much better! Can you do it for accel/gyro too?
if (report_fail) { | ||
// Only report the first failure to avoid spamming | ||
if (status.gps_check_fail_flags & (1 << estimator_status_s::GPS_CHECK_FAIL_GPS_FIX)) { | ||
mavlink_log_critical(mavlink_log_pub, "Preflight %s: GPS fix not too low", fail_str); |
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.
What does this mean?
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.
Ha, my fail. Fixed.
45f1c5a
to
e600e7c
Compare
We should double check the QGC side. There was discussion of special handling for "PREFLIGHT" and "PREARM" messages previously. |
- previously it was possible to get a Position Control rejected message without further advice what was actually wrong. So now we report warnings even if gps is not required for arming (which could be annoying too...). - the GPS failure message was very generic, making it hard to debug the cause. Now we check every bit and send an appropriate warning All strings were checked not to exceed the maximum length of 50 characters.
e600e7c
to
fd7dd79
Compare
A quick QGC grep for PREFLIGHT did not reveal anything. |
Two more points to think about for later.
|
Looks like it's only "PreArm:" currently. @DonLakeFlyer @bkueng can we agree on what to do here? The way QGC handles "PreArm:" looks much nicer. |
|
||
success = false; | ||
goto out; | ||
const char *fail_str = enforce_gps_required ? "Fail" : "Warn"; |
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.
Let's use the existing mavlink severity levels instead.
https://mavlink.io/en/messages/common.html#MAV_SEVERITY
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.
FYI: The original pull which support the PreArm QGC thing was lost in the fray. The new one is here: mavlink/qgroundcontrol#6898 and could use some testing. |
This is a great PR! Much needed improvements. I'll humbly submit some wording suggestions as comments in-line with the code. thanks! |
@@ -113,7 +113,7 @@ static bool magnometerCheck(orb_advert_t *mavlink_log_pub, vehicle_status_s &sta | |||
|
|||
if (!mag_valid) { | |||
if (report_fail) { | |||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: MAG #%u invalid", instance); | |||
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: no valid Data for Mag #%u", instance); |
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.
Suggest: "Preflight Fail: no valid data from Mag #%u", or "Preflight Fail: invalid data from Mag #%u"
@@ -123,13 +123,13 @@ static bool magnometerCheck(orb_advert_t *mavlink_log_pub, vehicle_status_s &sta | |||
|
|||
if (!calibration_valid) { | |||
if (report_fail) { | |||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: MAG #%u UNCALIBRATED", instance); | |||
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: Mag #%u uncalibrated", instance); |
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 inconsistent use of the terms "Mag" and "Compass" can be confusing for users. In QGC you must go to the "Compass" calibration page to calibrate the Mag(s). This is a larger issue, so I guess I'm just making a comment more than suggesting a change here.
@@ -249,7 +249,7 @@ static bool accelerometerCheck(orb_advert_t *mavlink_log_pub, vehicle_status_s & | |||
|
|||
if (!accel_valid) { | |||
if (report_fail) { | |||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: ACCEL #%u invalid", instance); | |||
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: no valid Data for Accel #%u", instance); |
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.
suggest: "Preflight Fail: no valid data from Accel #%u" or "Preflight Fail: invalid data from Accel #%u"
@@ -313,7 +313,7 @@ static bool gyroCheck(orb_advert_t *mavlink_log_pub, vehicle_status_s &status, u | |||
|
|||
if (!gyro_valid) { | |||
if (report_fail) { | |||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: GYRO #%u invalid", instance); | |||
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: no valid Data for Gyro #%u", instance); |
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.
suggest: "Preflight Fail: no valid data from Gyro #%u" or "Preflight Fail: invalid data from Gyro #%u"
@@ -356,14 +356,14 @@ static bool baroCheck(orb_advert_t *mavlink_log_pub, vehicle_status_s &status, u | |||
|
|||
if (!baro_valid) { | |||
if (report_fail) { | |||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: BARO #%u invalid", instance); | |||
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: no valid Data for Baro #%u", instance); |
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.
suggest: "Preflight Fail: no valid data from Baro #%u" or "Preflight Fail: invalid data from Baro #%u"
@@ -389,7 +389,7 @@ static bool airspeedCheck(orb_advert_t *mavlink_log_pub, vehicle_status_s &statu | |||
if ((orb_copy(ORB_ID(differential_pressure), fd_diffpres, &differential_pressure) != PX4_OK) || | |||
(hrt_elapsed_time(&differential_pressure.timestamp) > 1_s)) { | |||
if (report_fail && !optional) { | |||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: AIRSPEED SENSOR MISSING"); | |||
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: Airspeed Sensor missing"); |
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.
Couple comments here:
- this is the first use of "< > sensor missing". The other sensors print out "no < > sensor". From a user standpoint I like the "< > sensor missing" message better because it implies that the sensor is both expected to be there and also that it is missing. The meaning for "no < > sensor" message is a bit more vague. Either way, I think we should aim for consistency.
- can this be extended to support multiple diffpres/airspeed sensors?
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.
- Good point, I switched to the 'sensor missing' version.
- I don't know, it's probably a bigger thing.
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.
- Yes it can and yes it's a slightly bigger thing.
@@ -400,7 +400,7 @@ static bool airspeedCheck(orb_advert_t *mavlink_log_pub, vehicle_status_s &statu | |||
if ((orb_copy(ORB_ID(airspeed), fd_airspeed, &airspeed) != PX4_OK) || | |||
(hrt_elapsed_time(&airspeed.timestamp) > 1_s)) { | |||
if (report_fail && !optional) { | |||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: AIRSPEED SENSOR MISSING"); | |||
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: Airspeed Sensor missing"); |
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.
same comment as I made in the "diffpres" section above. I'm also unclear as to why there are two of these, but I'll assume there is a good reason.
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.
It goes back to the change that allowed airspeed to be < 0. The code is checking |differential_pressure|, but could now be updated to check airspeed only. I think we already have this in a branch somewhere...
@@ -518,7 +518,7 @@ static bool ekf2Check(orb_advert_t *mavlink_log_pub, vehicle_status_s &vehicle_s | |||
// Check if preflight check performed by estimator has failed | |||
if (status.pre_flt_fail) { | |||
if (report_fail) { | |||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: EKF INTERNAL CHECKS"); | |||
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: EKF internal checks"); |
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.
what does this even mean? Can this message be written more specifically and in a way to be understood by the average user?
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.
It's one that I would like to get rid of as well. @priseborough ?
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.
Let's remove or re-write the language.
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.
"Preflight fail: Position unknown" or something like 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.
I changed it to Position unknown.
@@ -530,7 +530,7 @@ static bool ekf2Check(orb_advert_t *mavlink_log_pub, vehicle_status_s &vehicle_s | |||
|
|||
if (status.hgt_test_ratio > test_limit) { | |||
if (report_fail) { | |||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: EKF HGT ERROR"); | |||
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: EKF Height Error"); |
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 comment applies to all the messages that contain "EKF":
- the average user has no clue what an EKF is. They are very confused by these messages.
- the term "EKF" doesn't add any helpful information to any of these messages anyway.
- Suggest: "Preflight Fail: Height estimate error"
@@ -542,7 +542,7 @@ static bool ekf2Check(orb_advert_t *mavlink_log_pub, vehicle_status_s &vehicle_s | |||
|
|||
if (status.vel_test_ratio > test_limit) { | |||
if (report_fail) { | |||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: EKF VEL ERROR"); | |||
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: EKF Velocity Error"); |
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.
suggest: "Preflight Fail: Velocity estimate error" or "Preflight Fail: Velocity error"
@@ -554,7 +554,7 @@ static bool ekf2Check(orb_advert_t *mavlink_log_pub, vehicle_status_s &vehicle_s | |||
|
|||
if (status.pos_test_ratio > test_limit) { | |||
if (report_fail) { | |||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: EKF HORIZ POS ERROR"); | |||
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: EKF Horizontal Position Error"); |
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.
suggest: "Preflight Fail: Horizontal position error"
@@ -566,7 +566,7 @@ static bool ekf2Check(orb_advert_t *mavlink_log_pub, vehicle_status_s &vehicle_s | |||
|
|||
if (status.mag_test_ratio > test_limit) { | |||
if (report_fail) { | |||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: EKF YAW ERROR"); | |||
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: EKF Yaw Error"); |
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.
suggest: "Preflight Fail: Yaw error"
@@ -579,7 +579,7 @@ static bool ekf2Check(orb_advert_t *mavlink_log_pub, vehicle_status_s &vehicle_s | |||
if (fabsf(status.states[13]) > test_limit || fabsf(status.states[14]) > test_limit | |||
|| fabsf(status.states[15]) > test_limit) { | |||
if (report_fail) { | |||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: EKF HIGH IMU ACCEL BIAS"); | |||
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: EKF High IMU Accel Bias"); |
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.
suggest: "Preflight Fail: High Accelerometer Bias"
@@ -592,55 +592,59 @@ static bool ekf2Check(orb_advert_t *mavlink_log_pub, vehicle_status_s &vehicle_s | |||
if (fabsf(status.states[10]) > test_limit || fabsf(status.states[11]) > test_limit | |||
|| fabsf(status.states[12]) > test_limit) { | |||
if (report_fail) { | |||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: EKF HIGH IMU GYRO BIAS"); | |||
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: EKF High IMU Gyro Bias"); |
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.
suggest: "Preflight Fail: High Gyro Bias"
} else { | ||
if (!ekf_gps_fusion) { | ||
// Likely cause unknown | ||
mavlink_log_critical(mavlink_log_pub, "Preflight %s: EKF not using GPS", fail_str); |
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.
same comment that most users are confused by the term "EKF".
Suggest: "Preflight %s: System not using GPS"
Thanks @Antiheavy, great feedback. I think I incorperated all of it. I updated the PR to use the correct log level, and I think it's good now. Long-term the goal is to use the events interface for that. |
@@ -223,7 +223,7 @@ static bool magConsistencyCheck(orb_advert_t *mavlink_log_pub, vehicle_status_s | |||
|
|||
if (sensors.mag_inconsistency_ga > test_limit) { | |||
if (report_status) { | |||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: MAG SENSORS INCONSISTENT"); | |||
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: Compass Sensors inconsistent"); |
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.
Compass Sensors?
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.
From a user perspective I think "Compass Sensors inconsistent" is more easily understood and more consistent with the user interface in QGC. However, "Mag" and "Mag Sensor(s)" is still used in some of the other warnings.
On a side note: I think it is still okay if "MAG" is used in the parameters and other developer and integrator focused areas. In user focused areas (UX and non-developer documentation) "compass" is more easily understood.
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.
Compass instead of Mag seems better to me as long as we're consistent everywhere. Compass Sensors is what I was questioning that seemed inconsistent with other messages.
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.
So which is better: "Preflight Fail: Compass inconsistent" or "Preflight Fail: Compasses inconsistent"?
} | ||
} | ||
|
||
} else { | ||
if (!optional && report_fail) { | ||
mavlink_log_critical(mavlink_log_pub, "PREFLIGHT FAIL: NO MAG SENSOR #%u", instance); | ||
mavlink_log_critical(mavlink_log_pub, "Preflight Fail: Compass Sensor #%u missing", instance); |
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.
Edit: nevermind for consistency with other messages suggest using: "Preflight Fail: Compass #%u missing"
I'll merge this now and we can continue with any additional suggestions in another pull request or issue. |
Previously it was possible to get a Position Control rejected message without further advice what was actually wrong (the drone could even have a valid GPS position). So now we report warnings even if gps is not required for arming (which could be annoying too...).
The GPS failure message was very generic, making it hard to debug the cause. Now we check every bit and send an appropriate warning. EKF2 has threshold parameters for each of those checks.
All strings were checked not to exceed the maximum length of 50 characters.
Additional changes: