-
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 inability to climb the last few meters of takeoff #28792
base: master
Are you sure you want to change the base?
Conversation
@@ -119,14 +119,15 @@ void ModeTakeoff::update() | |||
gcs().send_text(MAV_SEVERITY_INFO, "Takeoff to %.0fm for %.1fm heading %.1f deg", | |||
alt, dist, direction); | |||
plane.takeoff_state.start_time_ms = millis(); | |||
plane.takeoff_state.level_off_start_time_ms = 0; |
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 tried to hunt for all the possible places where we would need a reset of this parameter.
if (takeoff_state.level_off_start_time_ms > 0) { | ||
// A takeoff is in progress. | ||
uint32_t now = AP_HAL::millis(); | ||
if ((now - takeoff_state.level_off_start_time_ms) > (uint32_t)(1000U * g.takeoff_pitch_limit_reduction_sec)) { |
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.
@peterbarker is this the right way to check a timeout in the face of time folding?
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.
Please investigate if sec_to_target needs to be multiplied by a factor of 2.
In case of linear decrease of pitch / climb-rate, the plane ends up half-way and mathematically does not converge to target altitude.
That is what I came up with during a dozen test flights with 4 different SW changes over the weekend.
I have no clue why this works in Plane 4.5.7.
When an airspeed sensor is not used, during a takeoff, the pitch angle is asymptotically driven to 0 as the takeoff altitude is approached. Some airplanes will then stop climbing and fail to reach altitude. To prevent an indefinite wait for the takeoff altitude to be reached, a dedicated level-off timeout has been introduced.
ef77e21
to
5c9f41c
Compare
Summary
This PR addresses #28685 and supersedes #28707.
Details
This affects takeoffs without an airspeed sensor.
Cause
Some airframes will not climb at 0 pitch, regardless of throttle setting.
Thus, the current takeoff level-off strategy of asymptotically forcing pitch to 0, results in the aircraft to never climb the final few meters.
Reproduction
The behaviour was reproduced in SITL, by setting:
PTCH_TRIM_DEG
: -10.0TKOFF_THR_MAX
: 75.0Solution
After the expected time to complete the takeoff has elapsed, drive the desired pitch gradually back to takeoff pitch, over the next 5 seconds.
Testing
Before:
The plane starts level off but manages to climb only up to 45m and hovers there, stuck in takeoff stage.
After:
The takeoff times out after 2s (
TKOFF_PLIM_SEC
) of being in the level-off maneuver.Alternatives
The proposed solution of widening the TECS pitch limits and letting TECS take over and regulate the last few meters of the climb was not feasible:
During an airspeedless takeoff, TECS uses throttle to correct for altitude errors.
It would use pitch (if it was allowed) to correct for airspeed errors).
Thus letting TECS command the pitch angle would not help.
The previous PR #28707 was deemed too complicated and too heavy-handed. This present PR prefers to hand over altitude control to TECS.