mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-13 19:40:27 +03:00
Merge pull request #7364 from breadoven/abo_FW_emerg_landing_descent_rate
Fixed wing emergency landing vertical rate control addition
This commit is contained in:
commit
b51cb7739a
1 changed files with 15 additions and 7 deletions
|
@ -612,13 +612,21 @@ bool isFixedWingLandingDetected(void)
|
|||
/*-----------------------------------------------------------
|
||||
* FixedWing emergency landing
|
||||
*-----------------------------------------------------------*/
|
||||
void applyFixedWingEmergencyLandingController(void)
|
||||
void applyFixedWingEmergencyLandingController(timeUs_t currentTimeUs)
|
||||
{
|
||||
// FIXME: Use altitude controller if available (similar to MC code)
|
||||
rcCommand[ROLL] = pidAngleToRcCommand(failsafeConfig()->failsafe_fw_roll_angle, pidProfile()->max_angle_inclination[FD_ROLL]);
|
||||
rcCommand[PITCH] = pidAngleToRcCommand(failsafeConfig()->failsafe_fw_pitch_angle, pidProfile()->max_angle_inclination[FD_PITCH]);
|
||||
rcCommand[YAW] = -pidRateToRcCommand(failsafeConfig()->failsafe_fw_yaw_rate, currentControlRateProfile->stabilized.rates[FD_YAW]);
|
||||
rcCommand[THROTTLE] = currentBatteryProfile->failsafe_throttle;
|
||||
|
||||
if (posControl.flags.estAltStatus >= EST_USABLE) {
|
||||
updateClimbRateToAltitudeController(-1.0f * navConfig()->general.emerg_descent_rate, ROC_TO_ALT_NORMAL);
|
||||
applyFixedWingAltitudeAndThrottleController(currentTimeUs);
|
||||
|
||||
int16_t pitchCorrection = constrain(posControl.rcAdjustment[PITCH], -DEGREES_TO_DECIDEGREES(navConfig()->fw.max_dive_angle), DEGREES_TO_DECIDEGREES(navConfig()->fw.max_climb_angle));
|
||||
rcCommand[PITCH] = -pidAngleToRcCommand(pitchCorrection, pidProfile()->max_angle_inclination[FD_PITCH]);
|
||||
} else {
|
||||
rcCommand[PITCH] = pidAngleToRcCommand(failsafeConfig()->failsafe_fw_pitch_angle, pidProfile()->max_angle_inclination[FD_PITCH]);
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
|
@ -641,7 +649,7 @@ void applyFixedWingNavigationController(navigationFSMStateFlags_t navStateFlags,
|
|||
applyFixedWingLaunchController(currentTimeUs);
|
||||
}
|
||||
else if (navStateFlags & NAV_CTL_EMERG) {
|
||||
applyFixedWingEmergencyLandingController();
|
||||
applyFixedWingEmergencyLandingController(currentTimeUs);
|
||||
}
|
||||
else {
|
||||
#ifdef NAV_FW_LIMIT_MIN_FLY_VELOCITY
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue