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_AHRS: give clearer prearm messages #24243

Merged
merged 1 commit into from
Aug 1, 2023
Merged

Conversation

Hwurzburg
Copy link
Collaborator

@Hwurzburg Hwurzburg commented Jul 7, 2023

this comes up over and over....
two alternatives for improvement....the latter commit being suggested by Tim T. and I think I agree....at least it gives the user directions on how to resolve it...

but this is about as clear as you can make it unfortunately since the inconsistency can be from many sources

whichever the group decides on I will remove the other/squash

@peterbarker we need to discuss TIm's idea of automating this page also : https://ardupilot.org/plane/docs/common-prearm-safety-checks.html....I sent you a metadata format proposal

edit: Peter and I have talked at length....there are 3 options:

  1. I try to improve the wiki page on prearms....which I have done
  2. we try to add metadata to selected cryptic prearms like this and parse to auto update the wiki docs in some manner...currently there are over ~400 potential messages although many don't need explanation
  3. we add a mechanism to provide the GCS with json base information on selected prearms that allow clicking in the messages screen to provide detailed resolution data

#3 is a very large effort
#2 is many days of python work and testing plus the C++ effort (which Peter is unable to do with his current load)
#1 is done, but any other nagging messages can be added and expanded...

inflight error messages are another topic and beyond scope here

@timtuxworth
Copy link
Contributor

So there are 2 completely different use cases here.

  1. regular user who just needs to take the plane outside to get a satellite fix - this user will never set AHRS_TYPE, probably doesn't even know or care what AHRS, EKF3, EKF2 etc are.
  2. more advanced or experimental user who is messing with AHRS_TYPE or other low level configuration. This user is probably comfortable looking in the log post flight and trying to jam meaningful information into 50 characters for them is really a wast of time - the data is in the log.

@Hwurzburg
Copy link
Collaborator Author

there are many more ways to get the inconsistency than just sufficient GPS....

and its easy for a user upgrading from older firmware to mess up AHRS_TYPE when moving to EKF3....so AHRS_TYPE issues have come mainly from normal users...so the not using AHRS type message is 100% needed and its exactly clear that you are not using the selected AHRS type....anyway this PR only deals with the filter inconsistency messages

@timtuxworth
Copy link
Contributor

#24243 is much better (I've added comments), but users will still be confused by:

DCM/EKF2/EKF3 - they should not need to care about this. IMO this bleeding of developer interests into the UI for end users is very unfortunate.

As a user/pilot I am still very confused about what it actually means if EKF is complaining about Roll/Pitch or Yaw.

Copy link
Contributor

@timtuxworth timtuxworth left a comment

Choose a reason for hiding this comment

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

In essence adding "Wait or check sensors" is great, but "R/P" not so great. By looking at the code that triggers this
const float rp_diff_rad = primary_quat.roll_pitch_difference(ekf2_quat);
I figured using "difference" vs "inconsistent" - 2 characters would be saved which gives us the full word "roll/pitch" back

@@ -2277,7 +2277,7 @@ bool AP_AHRS::attitudes_consistent(char *failure_msg, const uint8_t failure_msg_
// check roll and pitch difference
const float rp_diff_rad = primary_quat.roll_pitch_difference(ekf2_quat);
if (rp_diff_rad > ATTITUDE_CHECK_THRESH_ROLL_PITCH_RAD) {
hal.util->snprintf(failure_msg, failure_msg_len, "EKF2 Roll/Pitch inconsistent by %d deg", (int)degrees(rp_diff_rad));
hal.util->snprintf(failure_msg, failure_msg_len, "EKF2: R/P inconsistent. Wait or check sensors");
Copy link
Contributor

Choose a reason for hiding this comment

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

The second part is great. Sorry to say but R/P doesn't help a non developer pilot. My reaction would be "WTF is R/P" if I get this message while on the field getting ready to fly.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also - does a pilot/user really know or care that it is EKF2 (or 3 or DCM) - answer no and it only confuses them.

Copy link
Contributor

Choose a reason for hiding this comment

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

How about: "EKF2: Roll/Pitch difference. Wait or check sensors"
using "difference" instead of "inconsistent" saves 2 characters and gets it into 50 characters".

Copy link
Collaborator Author

@Hwurzburg Hwurzburg Jul 7, 2023

Choose a reason for hiding this comment

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

its not a roll to pitch difference which gets implied.....inconsistent is more accurate....alternatively... Atittude inconsistent instead of Roll/Pitch although yaw is considered attitude also...I think the commit language is best as is

Copy link
Contributor

@timtuxworth timtuxworth Jul 8, 2023

Choose a reason for hiding this comment

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

If you used "EKF3: Attitude off by 10 deg. Wait/check sensors" you could also use the same message for Yaw (which is also attitude) - so you could save about 45 bytes of flash by reusing the string.

Actually if you used "%s: Attitude off by %d deg. Wait/check sensors" and pass "EKF3"/"EKF2"/"DCM" as a parameter you save even more, by replacing all the messages with this one string.

Copy link

Choose a reason for hiding this comment

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

Even for me as someone who somehow knows what happens inside the EKF would be confused by R/P, Roll/Pitch would be way better.

@@ -2286,7 +2286,7 @@ bool AP_AHRS::attitudes_consistent(char *failure_msg, const uint8_t failure_msg_
primary_quat.angular_difference(ekf2_quat).to_axis_angle(angle_diff);
const float yaw_diff = fabsf(angle_diff.z);
if (check_yaw && (yaw_diff > ATTITUDE_CHECK_THRESH_YAW_RAD)) {
hal.util->snprintf(failure_msg, failure_msg_len, "EKF2 Yaw differs from current AHRS by %d deg", (int)degrees(yaw_diff));
hal.util->snprintf(failure_msg, failure_msg_len, "EKF2: Yaw inconsistent, Wait or check sensors");
Copy link
Contributor

Choose a reason for hiding this comment

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

To be consistent with Roll/Pitch - "EKF2: Yaw difference. Wait or check sensors"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

see above

@@ -2313,7 +2313,7 @@ bool AP_AHRS::attitudes_consistent(char *failure_msg, const uint8_t failure_msg_
primary_quat.angular_difference(ekf3_quat).to_axis_angle(angle_diff);
const float yaw_diff = fabsf(angle_diff.z);
if (check_yaw && (yaw_diff > ATTITUDE_CHECK_THRESH_YAW_RAD)) {
hal.util->snprintf(failure_msg, failure_msg_len, "EKF3 Yaw differs from current AHRS by %d deg", (int)degrees(yaw_diff));
hal.util->snprintf(failure_msg, failure_msg_len, "EKF3: Yaw inconsistent, Wait or check sensors");
Copy link
Contributor

Choose a reason for hiding this comment

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

"EKF3: Yaw difference. Wait or check sensors"

@@ -2329,7 +2329,7 @@ bool AP_AHRS::attitudes_consistent(char *failure_msg, const uint8_t failure_msg_
// check roll and pitch difference
const float rp_diff_rad = primary_quat.roll_pitch_difference(dcm_quat);
if (rp_diff_rad > ATTITUDE_CHECK_THRESH_ROLL_PITCH_RAD) {
hal.util->snprintf(failure_msg, failure_msg_len, "DCM R/P differs from current AHRS by %d deg", (int)degrees(rp_diff_rad));
hal.util->snprintf(failure_msg, failure_msg_len, "DCM: R/P inconsistent. Wait or check sensors");
Copy link
Contributor

Choose a reason for hiding this comment

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

"DCM: Roll/Pitch difference. Wait or check sensors"
for consistency with EKF2 and EKF3

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

again, disagree with your suggestion

@@ -2344,7 +2344,7 @@ bool AP_AHRS::attitudes_consistent(char *failure_msg, const uint8_t failure_msg_
primary_quat.angular_difference(dcm_quat).to_axis_angle(angle_diff);
const float yaw_diff = fabsf(angle_diff.z);
if (check_yaw && (yaw_diff > ATTITUDE_CHECK_THRESH_YAW_RAD)) {
hal.util->snprintf(failure_msg, failure_msg_len, "DCM Yaw differs from current AHRS by %d deg", (int)degrees(yaw_diff));
hal.util->snprintf(failure_msg, failure_msg_len, "DCM: Yaw inconsistent, Wait or check sensors");
Copy link
Contributor

Choose a reason for hiding this comment

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

DCM: Yaw difference. Wait or check sensors.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

and again

@IamPete1
Copy link
Member

IamPete1 commented Jul 8, 2023

DCM/EKF2/EKF3 - they should not need to care about this. IMO this bleeding of developer interests into the UI for end users is very unfortunate.

We should aspire to bring users to a level of higher understanding not dumb down the interface to the lowest level. I agree these messages could be better, but we can make them better by adding more information not by removing what is already there.

Think of these messages like the engine low temperature light in your car. Most people don't care or pay much attention. The blue light goes out after a bit once the engine has got up to temperature, all good. However some engines will break if you run them too hard when there cold, some drivers like to look after there engines and let them warm up before going for a drive. Unlike car manufactures we don't have the benefit of knowing what sort of car our warning light will be fitted in. So we have to provide as much information as possible (as I say we could do better here) and leave it to the user to ignore or not based on there use case.

@rmackay9
Copy link
Contributor

rmackay9 commented Jul 8, 2023

I think we (including me) should work on a big "errors and warnings" wiki page that gives instructions to the user on what they can do in these situtations. I think that it's going to be very difficult to provide enough advice to the user in just 54 characters no matter how hard we try.

@timtuxworth
Copy link
Contributor

We should aspire to bring users to a level of higher understanding not dumb down the interface to the lowest level. I agree these messages could be better, but we can make them better by adding more information not by removing what is already there.

In 50 characters?

How about user friendly messages, with an "ADVANCED_MESSAGES_ENABLE" setting that displays these detailed messages, in addition to the user message?

@timtuxworth
Copy link
Contributor

timtuxworth commented Jul 8, 2023

Think of these messages like the engine low temperature light in your car. Most people don't care or pay much attention. The blue light goes out after a bit once the engine has got up to temperature, all good. However some engines will break if you run them too hard when they're cold, some drivers like to look after there engines and let them warm up before going for a drive. Unlike car manufactures we don't have the benefit of knowing what sort of car our warning light will be fitted in. So we have to provide as much information as possible (as I say we could do better here) and leave it to the user to ignore or not based on their use case.

Great example. The mechanic connects the engine diagnostics to a computer in the workshop to get the full picture. (just like a developer reviewing a log file after a flight) The "light" is the dumbed down UI for the user. That is EXACTLY what we need! Specifically: "Check engine" - there is a check engine light.

The ArduPilot messages need to tell the pilot/user

  1. what is wrong
    2. what they should do about it

@Hwurzburg
Copy link
Collaborator Author

@rmackay9 > I think we (including me) should work on a big "errors and warnings" wiki page that gives instructions to the user on what they can do in these situtations. I think that it's going to be very difficult to provide enough advice to the user in just 54 characters no matter how hard we try.

there already exists that page....it needs updating...and perhaps automation...https://ardupilot.org/plane/docs/common-prearm-safety-checks.html

@timtuxworth
Copy link
Contributor

That page only refers to pre-arms @Hwurzburg - are you suggesting to make it more general?

@Hwurzburg
Copy link
Collaborator Author

Hwurzburg commented Jul 8, 2023

prearms are the only thing that prevents a user from flying ...in flight messages are almost always just informational and most the user can do nothing about while flying....yaw resets, lane switches, etc......and the normal feedback messages like transitions being complete and waypoints being crossed....if there are any that need user intervention and are unclear, we could add a page for them...aside from watchdogs, which we have a page for, I cant think of user actionable inflight messages off hand that are not clear
making GCS messages totally dumbed down is not a good solution in my opinion....helping a user resolve arming issues is a good goal however

@IamPete1
Copy link
Member

IamPete1 commented Jul 8, 2023

Great example. The mechanic connects the engine diagnostics to a computer in the workshop to get the full picture. (just like a developer reviewing a log file after a flight) The "light" is the dumbed down UI for the user. That is EXACTLY what we need! Specifically: "Check engine" - there is a check engine light.

Maybe I didn't think my analogy through enough. This message is not the warning light, it is a hint about extra information the mechanic needs. The warning light is the vehicle refusing to arm.

The ArduPilot messages need to tell the pilot/user

  1. what is wrong
    2. what they should do about it

In most cases I disagree that we should tell users that to do, the action is often not clear to ArduPilot, if it was then we would do it automatically. There are some exceptions, like the pre-arm that you need to reboot after compass calibration, where there is a single action that will resolve. However this EKF stuff is a prime example of a issue that could be caused by a number of things. We should provide as much information about the issue as possible. The advice on how to resolve should be elsewhere, we probably could do a better job at documenting such things, maybe some flow charts or similar. I guess in that context the what they should do becomes "go and have a look at this flow chart".

Maybe some sort of metadata could be provided to the GCS as we do for params and logs. There could be a regex for the pre-arm and a link to a page giving more information.

@timtuxworth
Copy link
Contributor

timtuxworth commented Jul 8, 2023

prearms are the only thing that prevents a user from flying ...in flight messages are almost always just informational and most the user can do nothing about while flying....yaw resets, lane switches, etc......and the normal feedback messages like transitions being complete and waypoints being crossed....if there are any that need user intervention and are unclear, we could add a page for them...aside from watchdogs, which we have a page for, I cant think of user actionable inflight messages off hand that are not clear
making GCS messages totally dumbed down is not a good solution in my opinion....helping a user resolve arming issues is a good goal however

In my mind I've linked this to the "Lane Switch" message PR #24181 - it's basically the same thing - the user experience for a non-developer is being muddied with information designed to help developers - generally causing confusion.

@timtuxworth
Copy link
Contributor

timtuxworth commented Jul 8, 2023

Maybe some sort of metadata could be provided to the GCS as we do for params and logs. There could be a regex for the pre-arm and a link to a page giving more information.

Excellent idea! The metadata could also be harvested directly into he wiki - right @Hwurzburg ? If you get something started I would be happy to contribute.

@Hwurzburg
Copy link
Collaborator Author

I am discussing with Peter already...see the description box of the PR

@Hwurzburg
Copy link
Collaborator Author

Hwurzburg commented Jul 8, 2023

fyi...there are over 280 prearm/arming failure messages..just in the ARMING modules ...most are not cryptic....only the cryptic ones need be metadata tagged and searchable in the wiki
failuremessages.txt

there are probably a hundred more in the various other modules

@timtuxworth
Copy link
Contributor

fyi...there are over 280 prearm/arming failure messages..just in the ARMING modules ...most are not cryptic....only the cryptic ones need be metadata tagged and searchable in the wiki failuremessages.txt

there are probably a hundred more in the various other modules

Who defines "cryptic"? I'm thinking there are messages you (or even I) might think are obvious that others might need more explanation.

@Hwurzburg
Copy link
Collaborator Author

Hwurzburg commented Jul 11, 2023

Who defines "cryptic"? I'm thinking there are messages you (or even I) might think are obvious that others might need more explanation.

anyone who provides end user support as support engineers or admins the RCG or Facebook groups or monitors the help channels would have exposure to users complaining: "what do I do when I get this?"

@Hwurzburg Hwurzburg force-pushed the messages branch 2 times, most recently from 36a52c8 to 16e0286 Compare July 17, 2023 15:00
@Hwurzburg Hwurzburg changed the title AP_AHRS: give clearer prearm messages AP_AHRS: give clearer prearm messagesAP_AHRS:Improve prearm messages for filter inconsistencies Jul 17, 2023
@Hwurzburg
Copy link
Collaborator Author

Flash reduction via refactor is good but scope creep...I will leave that to someone else...
after all the discussion inputs, I have chosen a slightly different message and this I what I will go with for the devcall today...it informs precisely why the prearm occurs, although the possible causes cannot be delineated in a one line message, nor a precise solution so I think this is the best that we can do at this point...

@timtuxworth
Copy link
Contributor

I don't see how adding "AHRS" helps at all. For those that don't know what that is, it's just babble. For those who do know, they will already know this is about AHRS. I'd suggest dropping "with current AHRS", but either way I think it's better than what we get now.

@Hwurzburg
Copy link
Collaborator Author

Hwurzburg commented Jul 17, 2023

then EKF or DCM will be similarly lost...but if they get these messages and they don't resolve themselves they will have to learn what AHRS and EKF mean....to relay the issue at the least to more knowledgeable people...any search of the wiki for EKF
explains what they are

@rmackay9
Copy link
Contributor

I agree that adding "AHRS" won't help most users. They will just wonder, "What's an EKF vs an AHRS?". We also need to be careful that the mesasges don't become too long because then the message will wrap and won't be clearly visible on the MP HUD.

@@ -2277,7 +2277,7 @@ bool AP_AHRS::attitudes_consistent(char *failure_msg, const uint8_t failure_msg_
// check roll and pitch difference
const float rp_diff_rad = primary_quat.roll_pitch_difference(ekf2_quat);
if (rp_diff_rad > ATTITUDE_CHECK_THRESH_ROLL_PITCH_RAD) {
hal.util->snprintf(failure_msg, failure_msg_len, "EKF2 Roll/Pitch inconsistent by %d deg", (int)degrees(rp_diff_rad));
hal.util->snprintf(failure_msg, failure_msg_len, "EKF2 Roll/Pitch inconsistent with current AHRS. Wait or check sensors");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
hal.util->snprintf(failure_msg, failure_msg_len, "EKF2 Roll/Pitch inconsistent with current AHRS. Wait or check sensors");
hal.util->snprintf(failure_msg, failure_msg_len, "%s Roll/Pitch inconsistent with current AHRS. Wait or check sensors", "EKF2");

etc elsewhere.

This will let the compiler re-use the format string, actually saving bytes on this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

.... could potentially be

Suggested change
hal.util->snprintf(failure_msg, failure_msg_len, "EKF2 Roll/Pitch inconsistent with current AHRS. Wait or check sensors");
hal.util->snprintf(failure_msg, failure_msg_len, "%s %s inconsistent with current AHRS. Wait or check sensors", "EKF2", "Roll/Pitch");

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

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 look like it was done in this PR.

This branch shows what I meant; feel free to cherry-pick the patch :-)

https://github.com/ArduPilot/ardupilot/compare/master...peterbarker:ardupilot:pr/save-bytes?expand=1

That branch saves 224 bytes vs master, whereas this one costs 80-odd bytes,

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

okay done....credit given...thanks

libraries/AP_AHRS/AP_AHRS.cpp Outdated Show resolved Hide resolved
@Hwurzburg Hwurzburg changed the title AP_AHRS: give clearer prearm messagesAP_AHRS:Improve prearm messages for filter inconsistencies AP_AHRS: give clearer prearm messages Jul 18, 2023
Copy link
Contributor

@rmackay9 rmackay9 left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@@ -2257,6 +2257,11 @@ void AP_AHRS::getCorrectedDeltaVelocityNED(Vector3f& ret, float& dt) const
ret.z += GRAVITY_MSS*dt;
}

void AP_AHRS::set_failure_inconsistent_message(const char *estimator, const char *axis, float diff_rad, char *failure_msg, const uint8_t failure_msg_len) const
Copy link
Contributor

Choose a reason for hiding this comment

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

This is my patch, but I could've used snprintf_failure_inconsistent_message here

@rmackay9
Copy link
Contributor

We agreed on the dev call that we can merge once Henry has confirmed he's completed testing.

@rmackay9
Copy link
Contributor

rmackay9 commented Aug 1, 2023

image
Tested and above is a screen shot from SITL.

@rmackay9 rmackay9 merged commit 0aef2cc into ArduPilot:master Aug 1, 2023
@Hwurzburg Hwurzburg deleted the messages branch August 1, 2023 00:11
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.

8 participants