1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-21 23:35:30 +03:00

Do not raise THROTTLE during NAV_CTL_LAND when nose is UP

This commit is contained in:
Pawel Spychalski (DzikuVx) 2017-05-28 08:49:51 +02:00
parent 05cee111ff
commit df619eb551
3 changed files with 14 additions and 2 deletions

View file

@ -506,7 +506,7 @@ static const navigationFSMStateDescriptor_t navFSM[NAV_STATE_COUNT] = {
[NAV_STATE_WAYPOINT_RTH_LAND] = {
.onEntry = navOnEnteringState_NAV_STATE_WAYPOINT_RTH_LAND,
.timeoutMs = 10,
.stateFlags = NAV_CTL_ALT | NAV_CTL_POS | NAV_CTL_YAW | NAV_REQUIRE_ANGLE | NAV_REQUIRE_MAGHOLD | NAV_REQUIRE_THRTILT | NAV_AUTO_WP,
.stateFlags = NAV_CTL_ALT | NAV_CTL_POS | NAV_CTL_YAW | NAV_CTL_LAND | NAV_REQUIRE_ANGLE | NAV_REQUIRE_MAGHOLD | NAV_REQUIRE_THRTILT | NAV_AUTO_WP,
.mapToFlightModes = NAV_WP_MODE | NAV_ALTHOLD_MODE,
.mwState = MW_NAV_STATE_LAND_IN_PROGRESS,
.mwError = MW_NAV_ERROR_LANDING,

View file

@ -407,8 +407,17 @@ void applyFixedWingPitchRollThrottleController(navigationFSMStateFlags_t navStat
if (isPitchAdjustmentValid && (navStateFlags & NAV_CTL_ALT)) {
pitchCorrection += posControl.rcAdjustment[PITCH];
throttleCorrection += DECIDEGREES_TO_DEGREES(pitchCorrection) * navConfig()->fw.pitch_to_throttle;
if (navStateFlags & NAV_CTL_LAND) {
/*
* During LAND we do not allow to raise THROTTLE when nose is up
* to reduce speed
*/
throttleCorrection = constrain(throttleCorrection, minThrottleCorrection, 0);
} else {
throttleCorrection = constrain(throttleCorrection, minThrottleCorrection, maxThrottleCorrection);
}
}
// Speed controller - only apply in POS mode
if (navStateFlags & NAV_CTL_POS) {

View file

@ -230,6 +230,9 @@ typedef enum {
NAV_RC_ALT = (1 << 11),
NAV_RC_POS = (1 << 12),
NAV_RC_YAW = (1 << 13),
/* Additional flags */
NAV_CTL_LAND = (1 << 14),
} navigationFSMStateFlags_t;
typedef struct {