-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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:fix auto fence enable in Mode Takeoff #25785
Conversation
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 wonder if a much easier change of enabling fence on takeoff mode exit would achieve the same thing? Since there is no way to change the target altitude after takeoff the only difference would be if there was some sort of issue that prevented the maintaining altitude once it had been reached.
@@ -152,6 +149,13 @@ void ModeTakeoff::update() | |||
plane.calc_nav_pitch(); | |||
plane.calc_throttle(); | |||
//check if in long failsafe, if it is recall long failsafe now to get fs action via events call |
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.
This comment belongs with the bit of code under the addition.
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.
will fix
@@ -152,6 +149,13 @@ void ModeTakeoff::update() | |||
plane.calc_nav_pitch(); | |||
plane.calc_throttle(); | |||
//check if in long failsafe, if it is recall long failsafe now to get fs action via events call | |||
#if AP_FENCE_ENABLED | |||
const uint16_t altitude = plane.relative_ground_altitude(false,true); | |||
if (altitude >= alt && !have_auto_enabled_fence) { |
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 think the standard loiter check can be used?
if (altitude >= alt && !have_auto_enabled_fence) { | |
if (plane.reached_loiter_target() && (loiter.reached_target_alt || loiter.unable_to_acheive_target_alt) && !have_auto_enabled_fence) { |
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 will try it in SITL
but you could misconfigure such that the loiter breaches a fence....but it may be simpler...will create an alternate PR for consideration |
Your right of course, but then why are we letting the user arm in takeoff mode if they will just breach fence, it would save effort all round to not take off in the first place ;). Its a little more tricky if they arm in another mode and switch to takeoff tho... |
closing in favor of Pete's approach #25788 |
fixes bug in Mode takeoff where autoenable occurs immediately after initial phase of climb and triggers min alt fence breach....AUTO takeoffs (both fw and VTOL) do not autoenable until takeoff alt is obtained....this does the same
addresses #25783