1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-23 16:25:26 +03:00

Option to enable/disable landing as a last stage of RTH

This commit is contained in:
Konstantin Sharlaimov (DigitalEntity) 2017-02-05 19:35:07 +10:00
parent 967caed6cb
commit 8fad3e3290
4 changed files with 7 additions and 7 deletions

View file

@ -169,6 +169,7 @@ Re-apply any new defaults as desired.
| nav_min_rth_distance | 500 | Minimum distance from homepoint when RTH can be activated [cm] |
| nav_rth_climb_first | ON | If set to ON drone will climb to nav_rth_altitude first and head home afterwards. If set to OFF drone will head home instantly and climb on the way. |
| nav_rth_tail_first | OFF | If set to ON drone will return tail-first. Obviously meaningless for airplanes. |
| nav_rth_allow_landing | ON | If set to ON drone will land as a last phase of RTH. |
| nav_rth_alt_mode | AT_LEAST | Configure how the aircraft will manage altitude on the way home, se Navigation modes on wiki for more details |
| nav_rth_altitude | 1000 | Used in EXTRA, FIXED and AT_LEAST rth alt modes (Default 1000 means 10 meters) |
| nav_mc_bank_angle | 30 | Maximum banking angle (deg) that multicopter navigation is allowed to set. Machine must be able to satisfy this angle without loosing altitude |

View file

@ -803,6 +803,7 @@ static const clivalue_t valueTable[] = {
{ "nav_min_rth_distance", VAR_UINT16 | MASTER_VALUE, .config.minmax = { 0, 5000 }, PG_NAV_CONFIG, offsetof(navConfig_t, general.min_rth_distance) },
{ "nav_rth_climb_first", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_NAV_CONFIG, offsetof(navConfig_t, general.flags.rth_climb_first) },
{ "nav_rth_tail_first", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_NAV_CONFIG, offsetof(navConfig_t, general.flags.rth_tail_first) },
{ "nav_rth_allow_landing", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_NAV_CONFIG, offsetof(navConfig_t, general.flags.rth_allow_landing) },
{ "nav_rth_alt_mode", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_NAV_RTH_ALT_MODE }, PG_NAV_CONFIG, offsetof(navConfig_t, general.flags.rth_alt_control_mode) },
{ "nav_rth_abort_threshold", VAR_UINT16 | MASTER_VALUE | MODE_MAX, .config.max = { 65000 }, PG_NAV_CONFIG, offsetof(navConfig_t, general.rth_abort_threshold) },
{ "nav_rth_altitude", VAR_UINT16 | MASTER_VALUE | MODE_MAX, .config.max = { 65000 }, PG_NAV_CONFIG, offsetof(navConfig_t, general.rth_altitude) },

View file

@ -73,6 +73,7 @@ PG_RESET_TEMPLATE(navConfig_t, navConfig,
.rth_climb_first = 1, // Climb first, turn after reaching safe altitude
.rth_tail_first = 0,
.disarm_on_landing = 0,
.rth_allow_landing = 1,
},
// General navigation parameters
@ -1152,11 +1153,7 @@ static navigationFSMEvent_t navOnEnteringState_NAV_STATE_RTH_3D_LANDING(navigati
return NAV_FSM_EVENT_SWITCH_TO_EMERGENCY_LANDING;
}
if (STATE(FIXED_WING)) {
// FIXME: Continue loitering at home altitude
return NAV_FSM_EVENT_NONE;
}
else {
if (navConfig()->general.flags.rth_allow_landing) {
// A safeguard - if sonar is available and it is reading < 50cm altitude - drop to low descend speed
if (posControl.flags.hasValidSurfaceSensor && posControl.actualState.surface >= 0 && posControl.actualState.surface < 50.0f) {
// land_descent_rate == 200 : descend speed = 30 cm/s, gentle touchdown
@ -1175,9 +1172,9 @@ static navigationFSMEvent_t navOnEnteringState_NAV_STATE_RTH_3D_LANDING(navigati
float descentVelLimited = MIN(-descentVelScaling * navConfig()->general.land_descent_rate, -50.0f);
updateAltitudeTargetFromClimbRate(descentVelLimited, CLIMB_RATE_RESET_SURFACE_TARGET);
}
return NAV_FSM_EVENT_NONE;
}
return NAV_FSM_EVENT_NONE;
}
}

View file

@ -99,6 +99,7 @@ typedef struct navConfig_s {
uint8_t rth_climb_first; // Controls the logic for initial RTH climbout
uint8_t rth_tail_first; // Return to home tail first
uint8_t disarm_on_landing; //
uint8_t rth_allow_landing; // Enable landing as last stage of RTH
} flags;
uint8_t pos_failure_timeout; // Time to wait before switching to emergency landing (0 - disable)