VTOL: treat Descend mode as Land (#22843)

* vtol_type: enable pusher assist also in Descend mode

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>

* vtol_type: treat Descend as Land for pusher assist

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>

---------

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
Silvan Fuhrer
2024-03-07 10:22:25 +01:00
committed by GitHub
parent bb5efa5577
commit 1e253a9626
2 changed files with 15 additions and 14 deletions
@@ -48,6 +48,7 @@
* Fixed-wing forward actuators refers to puller/pusher (standard VTOL), or forward-tilt (tiltrotor VTOL). * Fixed-wing forward actuators refers to puller/pusher (standard VTOL), or forward-tilt (tiltrotor VTOL).
* Only active if demanded down pitch is below VT_PITCH_MIN. * Only active if demanded down pitch is below VT_PITCH_MIN.
* Use VT_FWD_THRUST_SC to tune it. * Use VT_FWD_THRUST_SC to tune it.
* Descend mode is treated as Landing too.
* *
* Only active (if enabled) in Altitude, Position and Auto modes, not in Stabilized. * Only active (if enabled) in Altitude, Position and Auto modes, not in Stabilized.
* *
+14 -14
View File
@@ -444,16 +444,21 @@ float VtolType::pusher_assist()
} }
// the vehicle is "landing" if it is in auto mode and the type is set to LAND, and
// "descending" if it is in auto and climb rate controlled but not altitude controlled
const bool vehicle_is_landing_or_descending = _v_control_mode->flag_control_auto_enabled
&& ((_attc->get_pos_sp_triplet()->current.valid
&& _attc->get_pos_sp_triplet()->current.type == position_setpoint_s::SETPOINT_TYPE_LAND) ||
(_v_control_mode->flag_control_climb_rate_enabled && !_v_control_mode->flag_control_altitude_enabled));
// disable pusher assist depending on setting of forward_thrust_enable_mode: // disable pusher assist depending on setting of forward_thrust_enable_mode:
switch (_param_vt_fwd_thrust_en.get()) { switch (_param_vt_fwd_thrust_en.get()) {
case DISABLE: // disable in all modes case DISABLE: // disable in all modes
return 0.0f; return 0.0f;
break; break;
case ENABLE_WITHOUT_LAND: // disable in land mode case ENABLE_WITHOUT_LAND: // disable in land/descend mode
if (_attc->get_pos_sp_triplet()->current.valid if (vehicle_is_landing_or_descending) {
&& _attc->get_pos_sp_triplet()->current.type == position_setpoint_s::SETPOINT_TYPE_LAND
&& _v_control_mode->flag_control_auto_enabled) {
return 0.0f; return 0.0f;
} }
@@ -473,10 +478,8 @@ float VtolType::pusher_assist()
break; break;
case ENABLE_ABOVE_MPC_LAND_ALT1_WITHOUT_LAND: // disable if below MPC_LAND_ALT1 or in land mode case ENABLE_ABOVE_MPC_LAND_ALT1_WITHOUT_LAND: // disable if below MPC_LAND_ALT1 or in land/descend mode
if ((_attc->get_pos_sp_triplet()->current.valid if (vehicle_is_landing_or_descending ||
&& _attc->get_pos_sp_triplet()->current.type == position_setpoint_s::SETPOINT_TYPE_LAND
&& _v_control_mode->flag_control_auto_enabled) ||
(!PX4_ISFINITE(dist_to_ground) || (dist_to_ground < _param_mpc_land_alt1.get()))) { (!PX4_ISFINITE(dist_to_ground) || (dist_to_ground < _param_mpc_land_alt1.get()))) {
return 0.0f; return 0.0f;
} }
@@ -484,9 +487,7 @@ float VtolType::pusher_assist()
break; break;
case ENABLE_ABOVE_MPC_LAND_ALT2_WITHOUT_LAND: // disable if below MPC_LAND_ALT2 or in land mode case ENABLE_ABOVE_MPC_LAND_ALT2_WITHOUT_LAND: // disable if below MPC_LAND_ALT2 or in land mode
if ((_attc->get_pos_sp_triplet()->current.valid if (vehicle_is_landing_or_descending ||
&& _attc->get_pos_sp_triplet()->current.type == position_setpoint_s::SETPOINT_TYPE_LAND
&& _v_control_mode->flag_control_auto_enabled) ||
(!PX4_ISFINITE(dist_to_ground) || (dist_to_ground < _param_mpc_land_alt2.get()))) { (!PX4_ISFINITE(dist_to_ground) || (dist_to_ground < _param_mpc_land_alt2.get()))) {
return 0.0f; return 0.0f;
} }
@@ -494,10 +495,9 @@ float VtolType::pusher_assist()
break; break;
} }
// if the thrust scale param is zero or the drone is not in some position or altitude control mode, // if the thrust scale param is zero or the drone is not in a climb rate controlled mode,
// then the pusher-for-pitch strategy is disabled and we can return // then the pusher-for-pitch strategy is disabled and we can return
if (_param_vt_fwd_thrust_sc.get() < FLT_EPSILON || !(_v_control_mode->flag_control_position_enabled if (_param_vt_fwd_thrust_sc.get() < FLT_EPSILON || !(_v_control_mode->flag_control_climb_rate_enabled)) {
|| _v_control_mode->flag_control_altitude_enabled)) {
return 0.0f; return 0.0f;
} }