-
Notifications
You must be signed in to change notification settings - Fork 17.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
Plane: support DO_RETURN_PATH_START
mission item and command
#28574
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,8 +106,7 @@ void ModeRTL::navigate() | |
if ((plane.g.rtl_autoland == RtlAutoland::RTL_IMMEDIATE_DO_LAND_START) || | ||
(plane.g.rtl_autoland == RtlAutoland::RTL_THEN_DO_LAND_START && | ||
plane.reached_loiter_target() && | ||
labs(plane.calc_altitude_error_cm()) < 1000)) | ||
{ | ||
labs(plane.calc_altitude_error_cm()) < 1000)) { | ||
// we've reached the RTL point, see if we have a landing sequence | ||
if (plane.have_position && plane.mission.jump_to_landing_sequence(plane.current_loc)) { | ||
// switch from RTL -> AUTO | ||
|
@@ -116,12 +115,26 @@ void ModeRTL::navigate() | |
// return here so we don't change the radius and don't run the rtl update_loiter() | ||
return; | ||
} | ||
// mode change failed, revert force resume flag | ||
plane.mission.set_force_resume(false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this a separate bug fix? or related somehow? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Related in that the same pattern is in the new case. If the mode change failed then mission was left with force resume true. This means the next time you enter auto you will resume the mission and not restart ignoring edit: I'm sure you spotted it but we set |
||
} | ||
|
||
// prevent running the expensive jump_to_landing_sequence | ||
// on every loop | ||
plane.auto_state.checked_for_autoland = true; | ||
|
||
} else if (plane.g.rtl_autoland == RtlAutoland::DO_RETURN_PATH_START) { | ||
if (plane.have_position && plane.mission.jump_to_closest_mission_leg(plane.current_loc)) { | ||
plane.mission.set_force_resume(true); | ||
if (plane.set_mode(plane.mode_auto, ModeReason::RTL_COMPLETE_SWITCHING_TO_FIXEDWING_AUTOLAND)) { | ||
// return here so we don't change the radius and don't run the rtl update_loiter() | ||
return; | ||
} | ||
// mode change failed, revert force resume flag | ||
plane.mission.set_force_resume(false); | ||
} | ||
plane.auto_state.checked_for_autoland = true; | ||
} | ||
} | ||
} | ||
|
||
|
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'm a little worried about CPU usage - could we watchdog from calling this with a complex mission? might be worth measuring the CPU cost on a F4 per WP and think about max WP count