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

Copter: support DO_RETURN_PATH_START in AUTO RTL mode #26383

Merged
merged 5 commits into from
Apr 29, 2024

Conversation

IamPete1
Copy link
Member

@IamPete1 IamPete1 commented Mar 3, 2024

This adds support for a new mission item (ArduPilot/mavlink#212, mavlink/mavlink#2088) that acts as a marker to the autopilot that it can rejoin a mission at any point after this marker and before a landing or MAV_CMD_DO_LAND_START.

Demo: https://youtu.be/SoHXRTD0vEs?si=pHTvRDMcOsStv4l6

This was originally done on 4.1.0 where it has a lots of testing on real vehicles this rebase has not had the same level of testing.

Along with the new mission item this also adds support for passing in a location to the various DO_LAND_... AP mission functions. Copter then uses this to pass in the stopping point rather than the current location. Helpers are added to so the current method without location still works for plane. Passing in the stopping point prevents copter going back on itself when a rejoin is commanded as it is about to pass a way point at speed. Where the next waypoint is still in front of the vehicles current location but it can't stop in time to hit it and has to go back.

Both DO_LAND_START and DO_RETURN_PATH_START can be sent as commands to trigger there respective behavior and enter Auto RTL mode. Entering Auto RTL mode manually will first look for a DO_RETURN_PATH_START and if it cannot find one it will look for a DO_LAND_START. We might want to add a parameter like plane's RTL_AUTOLAND to control which we do when switching to Auto RTL mode.

I have added a auto test, but some manual testing is probably also a good idea.

@IamPete1
Copy link
Member Author

Not expecting this to be merged, but looking for approval of the concept so we can get the MAVLink PR (mavlink/mavlink#2088) merged.

I did a longer explanation of why this might be needed there: mavlink/mavlink#2088 (comment)

@rmackay9
Copy link
Contributor

I'm really looking forward to this feature!

Copy link
Collaborator

@davidbuzz davidbuzz left a comment

Choose a reason for hiding this comment

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

i like this, support it being merged, doesn't solve all the complex use cases, but helps many

@davidbuzz
Copy link
Collaborator

... todo add a plane impl. :-)

@peterbarker
Copy link
Contributor

This looks very cool.

tridge liked it too.

@IamPete1 IamPete1 changed the title Copter: support DO_LAND_REJOIN in AUTO RTL mode Copter: support DO_RETURN_PATH_START in AUTO RTL mode Apr 5, 2024
@@ -2374,14 +2387,62 @@ bool AP_Mission::jump_to_landing_sequence(const Location &current_loc)
}

GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Landing sequence start");
_flags.in_landing_sequence = true;
Copy link
Member Author

Choose a reason for hiding this comment

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

This is not needed because set_current_cmd will do it already.

@IamPete1
Copy link
Member Author

This picked up a conflict in arducopter.py autotest, I have rebased.

@IamPete1
Copy link
Member Author

Rebased.

@IamPete1 IamPete1 requested a review from rmackay9 April 22, 2024 13:08
if (_flags.state == MISSION_RUNNING) {
// if mission is already running don't switch away from a active landing or return path
if (_flags.in_landing_sequence) {
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Landing sequence active");
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally we should have the subsystem prefixed on the text messages I think. I suspect we have other examples in the mission library that don't use a prefix.. we probably should though. Not a blocker though.

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.

This is a big change so its hard to be sure that it is all OK but this PR includes an autotest and we are at the beginning of a dev cycle so it should get lots of testing before the official release.

Great feature!

@rmackay9 rmackay9 merged commit 001979d into ArduPilot:master Apr 29, 2024
91 checks passed
@tridge tridge mentioned this pull request Apr 29, 2024
52 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Copter WikiNeeded needs wiki update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants