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

RC_Channel: TECS propulsion failure aux func #25644

Closed

Conversation

robertlong13
Copy link
Collaborator

Allows the user to set a switch to tell the TECS that propulsion has failed, causing it to switch to gliding control. I often set my aux functions tab up in Planner for a variety of emergency actions like this, and this would allow me a much easier way to handle engine-outs.

This PR also allows a much better avenue for a lua script to automatically flag that propulsion has failed, as opposed to directly setting the speed weight parameter. In addition to setting the speed weight, this flag prevents the TECS from setting "bad descent" and lowering the airspeed to a minimum, which probably is not the best speed for optimal glide.

ArduPlane/RC_Channel.cpp Outdated Show resolved Hide resolved
ArduPlane/RC_Channel.cpp Show resolved Hide resolved
Allows the user to set a switch to tell the TECS that propulsion has
failed. This also allows a safer avenue for a lua script to flag this,
instead of directly setting the speed weight parameter.
Allows the user to set a switch to tell the TECS that propulsion has
failed. This also allows a safer avenue for a lua script to flag this,
instead of directly setting the speed weight parameter.
Allows the user to set a switch to tell the TECS that propulsion has
failed. This also allows a safer avenue for a lua script to flag this,
instead of directly setting the speed weight parameter.
@peterbarker peterbarker force-pushed the pr/glide-aux-function branch from 980bf36 to 7ea6474 Compare April 5, 2024 00:58
@peterbarker
Copy link
Contributor

I've rebased this on master as it conflicted horribly.

@robertlong13 could you give this another test, please? There's no autotest included here, and I'm not sure what testing you did on this initially...

@robertlong13
Copy link
Collaborator Author

I've tested in RealFlight on an ALTI Transition. Killed the engine, then triggered the aux function 5s later. It glides like it should.

tecs_propulsion_fail

Onboard log: 00000003.zip

Copy link
Member

@IamPete1 IamPete1 left a comment

Choose a reason for hiding this comment

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

Needs a rebase again, but this change looks good.

However, it is abit concerning that we have a set_propulsion_failed_flag in TECS which is unused until now, so is completely untested. At least it looks to do the same thing as set_gliding_requested_flag which is used by soaring. I wonder if we would be better to remove the set_propulsion_failed_flag and use set_gliding_requested_flag for both.

@Hwurzburg Hwurzburg added the WikiNeeded needs wiki update label May 6, 2024
@tridge
Copy link
Contributor

tridge commented May 6, 2024

needs a rebase and an autotest, thanks!

@@ -8,6 +8,10 @@
-- If the aircraft drops below a predetermined minimum altitude, QLAND mode is engaged and the aircraft lands at its current position.
-- If the aircraft arrives within Q_FW_LND_APR_RAD of the return point before dropping below the minimum altitude, it should loiter down to the minimum altitude before switching to QRTL and landing.

-- constants
local RC_OPTION = {TECS_PROP_FAILED=177}
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this 178?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oof, great catch. This was missed in the rebase.

@robertlong13
Copy link
Collaborator Author

While working on the autotest for this, I dug a little deeper and learned that this is identical to having a lua script set THR_MAX to zero. That accomplishes exactly what I wanted when I set out on this PR. I didn't notice that when I first wrote this or I wouldn't have made it. In light of that, I don't think there's a reason to waste even 1 byte of flash space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Plane WikiNeeded needs wiki update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants