-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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. 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. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,6 +121,7 @@ bool Plane::auto_takeoff_check(void) | |
takeoff_state.launchTimerStarted = false; | ||
takeoff_state.last_tkoff_arm_time = 0; | ||
takeoff_state.start_time_ms = now; | ||
takeoff_state.level_off_start_time_ms = 0; | ||
takeoff_state.throttle_max_timer_ms = now; | ||
steer_state.locked_course_err = 0; // use current heading without any error offset | ||
return true; | ||
|
@@ -316,6 +317,7 @@ int16_t Plane::get_takeoff_pitch_min_cd(void) | |
// make a note of that altitude to use it as a start height for scaling | ||
gcs().send_text(MAV_SEVERITY_INFO, "Takeoff level-off starting at %dm", int(remaining_height_to_target_cm/100)); | ||
auto_state.height_below_takeoff_to_level_off_cm = remaining_height_to_target_cm; | ||
takeoff_state.level_off_start_time_ms = AP_HAL::millis(); | ||
} | ||
} | ||
} | ||
|
@@ -376,9 +378,8 @@ void Plane::landing_gear_update(void) | |
#endif | ||
|
||
/* | ||
check takeoff_timeout; checks time after the takeoff start time; returns true if timeout has occurred and disarms on timeout | ||
check takeoff_timeout; checks time after the takeoff start time; returns true if timeout has occurred | ||
*/ | ||
|
||
bool Plane::check_takeoff_timeout(void) | ||
{ | ||
if (takeoff_state.start_time_ms != 0 && g2.takeoff_timeout > 0) { | ||
|
@@ -400,3 +401,17 @@ bool Plane::check_takeoff_timeout(void) | |
return false; | ||
} | ||
|
||
/* | ||
check if the pitch level-off time has expired; returns true if timeout has occurred | ||
*/ | ||
bool Plane::check_takeoff_timeout_level_off(void) | ||
{ | ||
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 commentThe 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? |
||
return true; | ||
} | ||
} | ||
return false; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
QGC WPL 110 | ||
0 0 0 16 0.000000 0.000000 0.000000 0.000000 -35.363262 149.165237 584.390015 1 | ||
1 0 3 22 15.000000 0.000000 0.000000 0.000000 -35.361279 149.164230 50.000000 1 | ||
2 0 3 16 0.000000 0.000000 0.000000 0.000000 -35.361229 149.163025 80.000000 1 | ||
3 0 3 16 0.000000 0.000000 0.000000 0.000000 -35.364563 149.163773 80.000000 1 | ||
4 0 3 16 0.000000 0.000000 0.000000 0.000000 -35.364384 149.164795 80.000000 1 | ||
5 0 3 16 0.000000 0.000000 0.000000 0.000000 -35.361027 149.164093 80.000000 1 | ||
6 0 0 177 2.000000 3.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1 | ||
7 0 3 189 0.000000 0.000000 0.000000 0.000000 -35.362915 149.162613 60.000000 1 | ||
8 0 3 16 0.000000 0.000000 0.000000 0.000000 -35.363136 149.162750 60.000000 1 | ||
9 0 3 16 0.000000 0.000000 0.000000 0.000000 -35.365467 149.164215 55.000000 1 | ||
10 0 3 16 0.000000 0.000000 0.000000 0.000000 -35.365009 149.165482 39.889999 1 | ||
11 0 3 21 0.000000 0.000000 0.000000 1.000000 -35.363041 149.165222 0.000000 1 |
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.