-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
MAV_RESULT: Clarify exactly what the possible results mean #1253
Conversation
These are my take (very slight variation) on suggestions from @olliw42. @auturgy @amilcarlucas @julianoes Would appreciate your review. Does anyone know the intention for The only real use I see is a more explicit error value than |
great. pl note that the distinction between MAV_RESULT_TEMPORARILY_REJECTED and MAV_RESULT_FAILED is not really "exactly" clarified there are currently in fact these three results, MAV_RESULT_TEMPORARILY_REJECTED , MAV_RESULT_FAILED , and MAV_RESULT_IN_PROGRESS, which are very very similar, since they all three indicate "command is supported" and "Retrying later may work". I would see these distinction: MAV_RESULT_TEMPORARILY_REJECTED: the implementation can't currently process it, but please retry MAV_RESULT_FAILED: the implementation can't process it because of some nearly fatal error. Retrying later might work, but most likely won't (since fatal reason most likely won't have been resolved) MAV_RESULT_IN_PROGRESS: the implementation is already processing the very same command and is in the course of achieve it's goal, so it actually doesn't make sense to retry, please don't retry. so a long running file upload would IMHO lead to a MAV_RESULT_TEMPORARILY_REJECTED not MAV_RESULT_IN_PROGRESS (since a 2nd command would try to upload a next chunk, not the same chunk). IMHO |
The distinction is that for Currently I believe that While that is a sensible definition of
|
if it is WIP with no documentation so we don't know the intention and are guessing, then there shouldn't be some half-cooked documentation there making us guessing and if we may want to use it ... that is, I then would strongly pledge to just write WIP and nothing else ! I agree that IN_RESULT is not really needed and I guess world will continue to spin without it I'm btw convinced that you will find several places and cases there the ack wasn't used as now outlined ... a consistent interpretation of the result was just missing .... so, there will be "consequences", but IMHO this just demonstrates why a spec should want to be a spec and a spec must be a spec |
Exactly. To me the question is what we should be using for an arming failure because of the fact that e.g. we don't have GPS signal. Should it be
I have added it and used it, so I have some thoughts:
After the long running action has finally completed a |
I think the conflict in case of the arming comes from a gross misuse of the concept IMHO it cannot be the purpose of the ack to report back command specific states, it only - and therefore IMHO should only - report back command generic states, i.e. info about the fate of the command but not about it's outcome the correct handling should be as it is done in so many other cases, namely the command should be acked PLUS trigger some sort of feedback message which carries the specific info |
so the distinction between MAV_RESULT_TEMPORARILY_REJECTED and MAV_RESULT_IN_PROGRESS is that the sender in the first case needs to decide itself if it wants to take action and retry by actively sending a new command, while in the 2nd case the sender can expect to see more ACKs coming in, reporting the progress, but without having to actively ask for the progress by sending new commands. Right? This makes sense IMHO. While the descriptions have improved they IMHO still don't sufficiently accurate make clear the course of events in the different cases. |
Co-Authored-By: Julian Oes <julian@oes.ch>
Thanks guys. I've updated the MAV_RESULT_IN_PROGRESS case for English. Note, the reason I found MAV_RESULT_IN_PROGRESS confusing is that the sequences show only a single ACK - https://mavlink.io/en/services/command.html. So there an update is required for this case. Of course it makes sense, but it wasn't clear that it is "supported".
DENIED means "command supported, invalid params", I think you mean MAV_RESULT_FAILED. My take on this is that MAV_RESULT_TEMPORARILY_REJECTED is returned if a system knows in advance that it can't execute is - e.g. state machine is not ready, while you use MAV_RESULT_FAILED for requests that should work considering the known vehicle state - e.g. request to LOG that fails due to broken SD card. On this basis prearm failure is MAV_RESULT_TEMPORARILY_REJECTED - because both the system making the request and the requested system do know in advance whether a command to arm will succeed. @olliw42 I am sure you will still find this ambiguous. How would you word them to remove that ambiguity, based on the current wording (i.e. don't start from scratch). |
I like the introduction of the notation "valid/invalid". This makes it clear what the conditions for the various responses are. I'm not totally happy with the notion of "will work/will not work". I couldn't come up with a better wording, sorry, but let me describe what I mean. E.g. "Retrying later may work": TEMPORARILY_REJECTED is in fact exactly the response for informing the sender that it should retry later! It is not just a "may" and it is not about "next time it will work", but it is "can't do now, retry later". Maybe changing the position of text might do it: MAV_RESULT_TEMPORARILY_REJECTED: "Command is valid, but cannot be executed at this time. Retry later. This usually indicates that the system is not ready to process the command (i.e. a state machine is busy)." As regards MAV_RESULT_FAILED: I guess I would try to be somewhat more pointed. Maybe: MAV_RESULT_FAILED: "Command is valid, but execution failed. The issue must be fixed before retrying the command. This typically indicates an environmental issue such as attempting to write a file when out of memory. As regards MAV_RESULT_IN_PROGRESS: As much as I see it, the sole justification of this response is to inform the sender that there WILL be a sequence of further acks! If the system knows at time of sending the ack that it will have completed the task on the typical timescale of the MAVLink communication it should send an ACCEPTED. So the minimal possible result is a IN_PROGRESS followed by a ACCEPTED. That is, "may be followed" is inaccurate. So, maybe something like MAV_RESULT_IN_PROGRESS: "This will be followed by further progress updates, i.e. the component will send further COMMAND_ACK messages with result MAV_RESULT_IN_PROGRESS (at a rate decided by the implementation), and must terminate with sending a COMMAND_ACK message with result MAV_RESULT_ACCEPTED. The progress field can be used to indicate the progress in percent (0 - 100), or should be set to 255 if not known. There is no need for the sender to retry the command, but if done during execution, the component will also return MAV_RESULT_IN_PROGRESS with an update progress." |
It can also be followed by something else than The progress part is documented in the message doc:
|
ah, that's of course right, thx for correcting this ... I guess what I tried to make more clear was that the key point of the IN_PROGRESS is that there WILL be further acks coming, and not just "may" be coming, which distinguishes it from the other acks.
yes, I have seen this and that's there I got the values from. It just seemed to me that it would be useful and help understanding the nature of the IN_PROGRESS if this woudl be mentioned here. But technically you are of course right that it's defined there. |
Thanks. I've updated in line with feedback. Didn't go to full detail on the .progress field, but mentioned it - as you say, useful. We can go into more detail in command protocol docs. @julianoes I'm still not happy with the definition of failed vs rejected.
The question is what do you do for the case where you know the message can't succeed for an environmental issue you do know about. For example prearm failing due to sensors not calibrated. In this case the issue isn't going to fix itself. It isn't temporary. We have some options:
I think "Failed" is correct for this. So
Is that reasonable? Is it implementable? Does that help the user? |
IMHO: Temporary rejection is for known issues that are expected to resolve themselves with time that is, it's IMHO the right ack if it is expected that the issue goes away with just waiting (during the wait time of course all sorts of things can happen, like the universe explodes, we can't capture also this, hence "is expected" in here) anything else, which is a valid message but couldn't be executed is FAILED (i.e. I would define failed as the logical negative to temporarily rejected) your example of a prearm failing due to sensors not calibrated is IMHO failed iff this will need e.g. some user intervention, but should be temporarily rejected if it is done e.g. by some EKF thing and this thing just needs a bit more time to settle. So, the answer would be implementation specific. But the implementation would know. I guess I've said this before, for something as state-full as prearm and arm it's IMHO outside of the scope of COMMAND_ACK to provide a detailed account of the source of issue. If that is what is wanted then there should be a complementing (PRE)ARM_ERROR message which gives a detailed error code. |
@olliw42 Thanks, that was my take on it too.
Yes, and you're right. The need for a way to monitor prearm reasons has been discussed many times. Proved difficult to get agreement on what the message should contain. Whether or not we do that, I think we can provide helpful advice here. |
I like that as a definition. So this means that GPS might come back when the universe explodes, right? |
I'm afraid I lack experience in this matter to provide an answer (LOL) |
Self merging. I am much happier with these definitions. Even if they are not perfect, they are definitely much more useful than previously, and they are consistent and "followable". FYI @auturgy Thanks guys for your advice and help. |
This clarifies the meaning of possible results (MAV_RESULT) of a command (in a COMMAND_ACK) to remove ambiguity on which should be used in what circumstance.