-
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
TECS: Fix airspeed control during takeoff #27174
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.
in our testing we put in an additional check that throttle doesn't go below cruise in takeoff, should we add that in?
For the rest of the climb, it will be equivalent to setting a lower TECS throttle limit. |
83e51c3
to
04b6983
Compare
@tridge in the end I bit the bullet and forced a lower throttle limit of The alternative would be to bring back the artificial altitude demand or change the minimum pitch angle logic. The updated test results can be found here: Of course, I can upload the SITL .bin logs if required. |
04b6983
to
1a782b7
Compare
1a782b7
to
dfb8ede
Compare
Has this been tested with normal hand launched 1m foamies using defaults (which most users would use) both with and without an airspeed sensor? |
Not specifically. Do you have specific testing steps in mind? What if I use RealFlight to hand-launch this model, after resetting the TECS parameters? |
Can't hurt,but I can test on a real plane this week when weather permits |
Unfortunately I have no real-world flight testing capabilities around here. I'd be much obliged if you did. |
@Hwurzburg I tried with hand-launching the Aeroscout with RealFlight and a 2x2 test matrix:
I used the parameter files found here: https://github.com/ArduPilot/SITL_Models/tree/master/RealFlight/Tridge/Planes/Aeroscout except I deleted all I also used this short mission in the tests: Here are the logs: |
Okay, I'll change when I'm back from vacation.
Do our build options guarantee initialization to the default value, which I
guess is false for boolean and zero for numerical?
…On Fri, 31 May 2024, 07:02 Andrew Tridgell, ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In libraries/AP_TECS/AP_TECS.h
<#27174 (comment)>
:
> @@ -419,6 +419,9 @@ class AP_TECS {
// need to reset on next loop
bool _need_reset;
+ // Checks if we reset at the beginning of takeoff.
+ bool _reset_after_takeoff{false};
@Georacer <https://github.com/Georacer> it also should not be initialised
to false - the init just wastes flash space
—
Reply to this email directly, view it on GitHub
<#27174 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAYBBLHK5W5E6OS5OK65PMTZE7Y35AVCNFSM6AAAAABILPUY2SVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDAOBZHA2TONJWGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
yes |
@Hwurzburg, the TAKEOFF flight mode is not within the scope of this PR, only AUTO is. If I negatively affected TAKEOFF, we can examine that separately.
The point of this PR is primarily to prevent the aircraft from overspeeding, by intentionally giving TECS back its throttle control during the climb. |
we may need a TECS API called by mode_takeoff.cpp that forces for the next loop full throttle to be used, this would apply below TKOFF_LVL_ALT |
I must say that I am opposed to
|
Hey @Hwurzburg ! So for today, my intention was to make it so in TAKEOFF mode,
It's quite complex to fix this in TAKEOFF mode, as that mode interferes with the FlightStage quite a bit, making it hard for TECS to understand what's going on. In any case, I have now adjusted this PR it so the throttle will be kept at max until TKOFF_LVL_ALT, which is the old behaviour. A graph of how TAKEOFF mode works with this PR: And a graph of how AUTO mode works with this PR, with TKOFF_LVL_ALT=30: Are you satisfied with these changes? |
fa7f6d5
to
bc635b3
Compare
@tridge I've avoided doing that for now, with the latest changes. I've chosen another way to let TECS know of TKOFF_LVL_ALT, see |
f5b27d6
to
1462fbe
Compare
I've updated the original PR text, since there has been a significant rework in the last two weeks. To address the review comments that were pending: 2. Taking into account takeoffs that happen mid-mission, from a deep valley. 3. How about reverse-throttle setups? 4. What about when ARSPD_USE=0? 5. Do we need to increase TKOFF_LVL_ALT? New behaviour:
|
Autotests for takeoffs have been added for Plane, covering AUTO and TAKEOFF mode takeoffs. An auxiliary `set_servo` method has been added to `vehicle_test_suite.py`.
1462fbe
to
57f7b29
Compare
sorry wont be able test fly...did a quick sim with no airspeed sensor and defaults...master drops throttle after tkoff_lvl_alt is reached (5m)...but this keeps it maxed until over 2x that alt....why? |
This is intentional (as written above), in order to guarantee that the plane can climb without stalling up until TKOFF_LVL_ALT while fixed at TKOFF_LVL_PITCH or higher. If one installs an airspeed sensor and is confident about their tuning, they can set TKOFF_MODE=1 and it will fly with normal TECS past TKOFF_LVL_ALT. |
when does thr drop without aspd sensore if not after TKOFF_LVL_ALT? edit: just read your comment....will recheck my sim..yep its okay |
I'm not sure I understand your concern. Is it that while doing an AUTO takeoff the thruster shouldn't be wide open for the whole climb? |
libraries/AP_TECS/AP_TECS.cpp
Outdated
const uint32_t dt = now - _takeoff_start_ms; | ||
if (dt*0.001 < aparm.takeoff_throttle_max_t) { | ||
_THRminf = _THRmaxf; | ||
} else { |
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.
what is this????
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 particular if-statement is the implementation of TKOFF_THR_MAX_T: It ensures throttle is at max for the first TKOFF_THR_MAX_T seconds.
I didn't create it; I moved it from _update_throttle_without_airspeed
further above to make it common with both with- and without-airspeed measurement cases. Thus simplifying the default takeoff logic.
These concern the TAKEOFF flight stage and address ArduPilot#27147. * Logging metadata fixes * Disabled continuous TECS reset during takeoff * Fixed bug in reached_speed_takeoff calculation * Limited SPDWEIGHT=2 to only first part of takeoff climb * _post_TO_hgt_offset set to constant * Takeoff I-gain now defaults to 0 and is used * Use at least TRIM_THROTTLE during the climb * Updated description of TECS_TKOFF_IGAIN with new behaviour * Forced max throttle while below TKOFF_LVL_ALT * Added throttle constraints in no-airspeed mode Additionally, set_min_throttle() has been created, that allows one to set the minimum TECS throttle for the next update_pitch_throttle() loop. Additionally, the throttle limits system has been reworked. TECS will receive external throttle limits from Plane and will always take them into account and respect them.
This is a rework so that servos.cpp is responsible for setting the throttle limits under more circumstances and always notifies TECS when it does so. Additionally, the TAKEOFF mode has been improved with a new parameters TKOFF_MODE and TKOFF_THR_MIN that extend the throttle behaviour.
57f7b29
to
c1d113f
Compare
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.
with the change to use TKOFF_OPTIONS I'm happy for this to go in
many thanks to @Hwurzburg for the careful testing!!
ArduPlane/Parameters.cpp
Outdated
ASCALAR(takeoff_throttle_min, "TKOFF_THR_MIN", 60), | ||
|
||
// @Param: TKOFF_MODE | ||
// @DisplayName: Takeoff mode |
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.
add TKOFF_OPTIONS, with first bit being this option
6e3cb18
to
04ec2b9
Compare
This PR addresses #27147 and #27211.
It fixes a lot of bugs currently lodged in TECS during a takeoff, both in TAKEOFF and AUTO modes. The major one was that TECS was operating in reset mode during all of FlightStage::TAKEOFF.
It refactors the throttle limits system for Plane so that:
servo.cpp
is the primary place where throttle limits (upper and lower) are imposed.mode_takeoff.cpp
will also impose throttle limits according to its functionality description.AP_TECS.cpp
will take those limits into account, also for the no-airspeed case, which was missed previously.This has the benefit that TECS doesn't need to incorporate the logic for the various throttle limits decisions.
Logging of the throttle limits that TECS uses is added, in place of duplicate pitch limit logging.
Finally, it introduces
TKOFF_MODE
andTKOFF_THR_MIN
. By defaultTKOFF_MODE
makes it so that all takeoff climbs are done in max throttle (THR_MAX
orTKOFF_THR_MAX
).When
TKOFF_MODE=1
the throttle range pastTKOFF_LVL_ALT
can very between min and max.TKOFF_THR_MIN
is also taken into account in quadplane transitions.A lot of tests have been added to expose the new functionality.
Old PR text:
The major change in TECS behaviour is that it will no longer force full throttle and a speed weight of 2 during the whole of a TAKEOFF waypoint. Instead, it will limit this behaviour for the part while the airspeed is below the setpoint.
The changes make it so the aircraft does not overspeed during the climb.
It depends on #27125 for easier testing of the changes, by invoking
./Tools/autotest/autotest.py build.Plane test.Plane.CatapultTakeoff
or equivalent.The commits of this PR are purposely split for now, to facilitate comparison and testing of each change.
You can find a detailed explanation of the reasoning behind the changes in the attached .pdf.
PR_explanation.pdf