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

Fix reaction to rejected orbit command #19410

Merged
merged 6 commits into from
Mar 29, 2022
Merged

Conversation

MaEtUgR
Copy link
Member

@MaEtUgR MaEtUgR commented Mar 28, 2022

Describe problem solved by this pull request
This is a follow-up to #19362 fixing an already previoulsly existing bug. Thanks to @mrivi for finding it!

When commanding a too large Orbit she got invalid setpoints. I figured out that’s because since the introduction the command handling for flight tasks (which is only used for orbit yet) switches to the most basic position mode flight task upon command parameter rejection.

Describe your solution

  • Switch to the failsafe flight task when command parameters were not accepted.
    • This makes the drone just stop and wait for further actions.
    • This solves getting invalid setpoint messages when no RC is connected.
    • This also solves ending up in an "aggressive" position mode unexpectedly.
  • Report "denied" instead of "failed" as the command result in the acknowledgment for invalid parameters because that matches the MAVLink definition see: https://mavlink.io/en/messages/common.html#MAV_RESULT
  • Inform the user directly from the Orbit command processing when the radius exceeds the limit. This needs to be backward compatible with mavlink_log since AMC doesn't support events yet.
  • Minor refactoring.

Test data / coverage
This was tested in simulation to solve the issue and result in an improved user experience because of the error message and the correct command result.

@MaEtUgR MaEtUgR self-assigned this Mar 28, 2022
Base automatically changed from orbit-radius-limit to master March 28, 2022 15:57
@MaEtUgR MaEtUgR force-pushed the orbit-command-rejection-failsafe branch from d6048ac to 54c1c5a Compare March 28, 2022 18:37
@MaEtUgR
Copy link
Member Author

MaEtUgR commented Mar 29, 2022

This exact patch was already reviewed by @ThomasDebrunner before.
The only question that came up is checking equality instead of bigger or equal on the error code and that's the same because the possible errors are zero or negative:

enum class FlightTaskError : int {
NoError = 0,
InvalidTask = -1,
ActivationFailed = -2
};

@MaEtUgR MaEtUgR merged commit 7cd57b4 into master Mar 29, 2022
@MaEtUgR MaEtUgR deleted the orbit-command-rejection-failsafe branch March 29, 2022 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant