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
|
@ -243,18 +243,18 @@ static int8_t loiterDirection(void) {
|
||||||
|
|
||||||
if (pidProfile()->loiter_direction == NAV_LOITER_YAW) {
|
if (pidProfile()->loiter_direction == NAV_LOITER_YAW) {
|
||||||
|
|
||||||
if (rcCommand[YAW] < -250) {
|
if (rcCommand[YAW] < -250) {
|
||||||
loiterDirYaw = 1; //RIGHT //yaw is contrariwise
|
loiterDirYaw = 1; //RIGHT //yaw is contrariwise
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rcCommand[YAW] > 250) {
|
if (rcCommand[YAW] > 250) {
|
||||||
loiterDirYaw = -1; //LEFT //see annexCode in fc_core.c
|
loiterDirYaw = -1; //LEFT //see annexCode in fc_core.c
|
||||||
}
|
}
|
||||||
|
|
||||||
dir = loiterDirYaw;
|
dir = loiterDirYaw;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_RC_MODE_ACTIVE(BOXLOITERDIRCHN)) {
|
if (IS_RC_MODE_ACTIVE(BOXLOITERDIRCHN)) {
|
||||||
dir *= -1;
|
dir *= -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -612,13 +612,21 @@ bool isFixedWingLandingDetected(void)
|
||||||
/*-----------------------------------------------------------
|
/*-----------------------------------------------------------
|
||||||
* FixedWing emergency landing
|
* 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[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[YAW] = -pidRateToRcCommand(failsafeConfig()->failsafe_fw_yaw_rate, currentControlRateProfile->stabilized.rates[FD_YAW]);
|
||||||
rcCommand[THROTTLE] = currentBatteryProfile->failsafe_throttle;
|
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);
|
applyFixedWingLaunchController(currentTimeUs);
|
||||||
}
|
}
|
||||||
else if (navStateFlags & NAV_CTL_EMERG) {
|
else if (navStateFlags & NAV_CTL_EMERG) {
|
||||||
applyFixedWingEmergencyLandingController();
|
applyFixedWingEmergencyLandingController(currentTimeUs);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#ifdef NAV_FW_LIMIT_MIN_FLY_VELOCITY
|
#ifdef NAV_FW_LIMIT_MIN_FLY_VELOCITY
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue