diff --git a/docs/en/config/safety.md b/docs/en/config/safety.md
index 3487d4a3023..69f6b12df7d 100644
--- a/docs/en/config/safety.md
+++ b/docs/en/config/safety.md
@@ -400,7 +400,7 @@ The parameters that control when the quad-chute will trigger are listed in the t
| [VT_FW_MIN_ALT](../advanced_config/parameter_reference.md#VT_FW_MIN_ALT) | Minimum altitude above Home for fixed-wing flight. When the altitude drops below this value in fixed-wing flight the vehicle a quad-chute is triggered. |
| [VT_FW_QC_R](../advanced_config/parameter_reference.md#VT_FW_QC_R) | Absolute roll threshold for quad-chute triggering in FW mode. |
| [VT_FW_QC_P](../advanced_config/parameter_reference.md#VT_FW_QC_P) | Absolute pitch threshold for quad-chute triggering in FW mode. |
-| [VT_EF_TIME](../advanced_config/parameter_reference.md#VT_EF_TIME) | Pusher failure detection time for standard VTOLs using pusher assist ([VT_FWD_THRUST_EN]). In multicopter mode, the failure detection triggers if, for this time, the pusher assist throttle is above [VT_EF_THROT] but the forward velocity stays more than [VT_EF_VEL_ERR] below its setpoint. It blocks front transitions until reboot. A working pusher that cannot keep up, as in a strong headwind, may be reported too. A failure is only detected once pusher assist is needed. Prior to detection, a front transition will still be executed but fail. Set to 0 to disable; in flight this allows front transitions again. |
+| [VT_EF_TIME](../advanced_config/parameter_reference.md#VT_EF_TIME) | Pusher failure detection time for standard VTOLs and tiltrotors using pusher assist ([VT_FWD_THRUST_EN]): the pusher throttle, or the forward tilt of a tiltrotor. In multicopter mode, the failure detection triggers if, for this time, the pusher assist is above [VT_EF_THROT] but the forward velocity stays more than [VT_EF_VEL_ERR] below its setpoint. It blocks front transitions until reboot. A working pusher that cannot keep up, as in a strong headwind, may be reported too. A failure is only detected once pusher assist is needed. Prior to detection, a front transition will still be executed but fail. Set to 0 to disable; in flight this allows front transitions again. |
[VT_FWD_THRUST_EN]: ../advanced_config/parameter_reference.md#VT_FWD_THRUST_EN
[VT_EF_THROT]: ../advanced_config/parameter_reference.md#VT_EF_THROT
@@ -410,7 +410,7 @@ The parameters that control when the quad-chute will trigger are listed in the t
First estimates for the pusher failure detection parameters:
-- [VT_EF_THROT]: about 80% of the highest pusher assist throttle, `VT_FWD_THRUST_SC * (sin(VT_PITCH_MIN) + sin(MPC_TILTMAX_AIR))` (at most 0.9).
+- [VT_EF_THROT]: about 80% of the highest pusher assist (pusher throttle, or forward tilt of a tiltrotor), `VT_FWD_THRUST_SC * (sin(VT_PITCH_MIN) + sin(MPC_TILTMAX_AIR))` (at most 0.9).
With the defaults this is `0.7 * (sin(0°) + sin(45°)) = 0.49`, which gives the default of 0.4.
- [VT_EF_VEL_ERR]: below the speed of your multicopter legs, as a failed pusher leaves the vehicle far below its velocity setpoint.
- [VT_EF_TIME](#VT_EF_TIME): longer than the gusts and accelerations of normal flight.
@@ -421,8 +421,9 @@ To check them in flight:
2. Fly a multicopter leg with pusher assist at your usual speed and at a safe altitude, for example in a mission.
3. Stop the pusher with `failure motor wrong -i ` (see [System Failure Injection](../debug/failure_injection.md)), where `` is the motor number of the pusher in the [actuator configuration](../config/actuators.md).
A pusher failure should be reported `VT_EF_TIME` after the vehicle has slowed down.
-4. In the [flight log](../log/flight_log_analysis.md), check that after the failure the pusher assist throttle (`vehicle_thrust_setpoint` instance 0, `xyz[0]`) rises above `VT_EF_THROT`, and the forward velocity (along the heading) falls more than `VT_EF_VEL_ERR` below its setpoint (`vx` and `vy` of `vehicle_local_position` and `vehicle_local_position_setpoint`).
- The position controller does not always demand the full `MPC_TILTMAX_AIR` tilt, especially when it is large, so the pusher assist throttle can stay below the estimate.
+ On a tiltrotor, skip this step: it would stop a lift motor, and a tilt failure cannot be injected. Only check the logs of normal flights, as described below.
+4. In the [flight log](../log/flight_log_analysis.md), check that after the failure the pusher assist throttle (`vehicle_thrust_setpoint` instance 0, `xyz[0]`; on a tiltrotor the forward tilt, `tiltrotor_extra_controls.collective_tilt_normalized_setpoint` minus `VT_TILT_MC`) rises above `VT_EF_THROT`, and the forward velocity (along the heading) falls more than `VT_EF_VEL_ERR` below its setpoint (`vx` and `vy` of `vehicle_local_position` and `vehicle_local_position_setpoint`).
+ The position controller does not always demand the full `MPC_TILTMAX_AIR` vehicle tilt, especially when it is large, so the pusher assist throttle can stay below the estimate.
In the logs of normal flights, including flights in the strongest wind you fly in, both conditions should only hold together for much less than `VT_EF_TIME`.
diff --git a/docs/en/releases/main.md b/docs/en/releases/main.md
index 5d5e436ff37..3479967a764 100644
--- a/docs/en/releases/main.md
+++ b/docs/en/releases/main.md
@@ -208,7 +208,7 @@ Please continue reading for [upgrade instructions](#upgrade-guide).
- After a [quad-chute](../config/safety.md#quad-chute-failsafe), Mission and VTOL Takeoff mode no longer command forward transitions and continue in multicopter mode. Before, a resumed mission commanded the next transition again, which also cleared the quad-chute, and with [COM_QC_ACT](../advanced_config/parameter_reference.md#COM_QC_ACT) set to Warning a quad-chute during a mission transition left the mission waiting at that item.
- A [quad-chute](../config/safety.md#quad-chute-failsafe) commanded with `MAV_CMD_DO_VTOL_TRANSITION` (`param2` = 1) now only switches to multicopter mode, as it is not caused by a failure. It no longer executes [COM_QC_ACT](../advanced_config/parameter_reference.md#COM_QC_ACT) or requires a reboot before the next arming.
-- Standard VTOLs using pusher assist ([VT_FWD_THRUST_EN](../advanced_config/parameter_reference.md#VT_FWD_THRUST_EN)) now detect a pusher failure in multicopter mode, when the forward velocity stays well below its setpoint although the pusher assist throttle is above [VT_EF_THROT](../advanced_config/parameter_reference.md#VT_EF_THROT). A detected failure is handled as a [quad-chute](../config/safety.md#quad-chute-failsafe) that blocks front transitions until reboot. Setting [VT_EF_TIME](../advanced_config/parameter_reference.md#VT_EF_TIME) to 0 disables the detection and, in flight, allows front transitions again.
+- Standard VTOLs and tiltrotors using pusher assist ([VT_FWD_THRUST_EN](../advanced_config/parameter_reference.md#VT_FWD_THRUST_EN)) now detect a pusher failure in multicopter mode, when the forward velocity stays well below its setpoint although the pusher assist (the pusher throttle, or the forward tilt of a tiltrotor) is above [VT_EF_THROT](../advanced_config/parameter_reference.md#VT_EF_THROT). A detected failure is handled as a [quad-chute](../config/safety.md#quad-chute-failsafe) that blocks front transitions until reboot. Setting [VT_EF_TIME](../advanced_config/parameter_reference.md#VT_EF_TIME) to 0 disables the detection and, in flight, allows front transitions again.
### Fixed-wing
diff --git a/src/modules/vtol_att_control/standard.cpp b/src/modules/vtol_att_control/standard.cpp
index dbe20e2339e..d1b999af2fc 100644
--- a/src/modules/vtol_att_control/standard.cpp
+++ b/src/modules/vtol_att_control/standard.cpp
@@ -61,10 +61,7 @@ Standard::parameters_update()
// make sure that pusher ramp in backtransition is smaller than back transition (max) duration
_param_vt_b_trans_ramp.set(math::min(_param_vt_b_trans_ramp.get(), _param_vt_b_trans_dur.get()));
- // disabling the detection in flight overrides a detected pusher failure, e.g. a false positive in strong wind
- if (!isPusherFailureDetectionEnabled()) {
- _pusher_failed = false;
- }
+ clearPusherFailureIfDisabled();
}
void Standard::update_vtol_state()
@@ -186,9 +183,6 @@ void Standard::update_transition_state()
VtolType::update_transition_state();
- // the pusher failure detection restarts in multicopter mode
- _pusher_failure_hysteresis.set_state_and_update(false, now);
-
// we get attitude setpoint from a multirotor flighttask if climbrate is controlled.
// in any other case the fixed wing attitude controller publishes attitude setpoint from manual stick input.
if (_v_control_mode->flag_control_climb_rate_enabled) {
@@ -298,27 +292,7 @@ void Standard::update_mc_state()
_pusher_throttle = VtolType::pusher_assist();
- _pusher_failed = _pusher_failed || isPusherFailureDetected();
-}
-
-bool Standard::isPusherFailureDetected()
-{
- bool pusher_ineffective = false;
-
- if (isPusherFailureDetectionEnabled() && _pusher_throttle > _param_vt_ef_throt.get() && _local_pos->v_xy_valid) {
- const Quatf q(_v_att->q);
- const float forward_vel = q.rotateVectorInverse(Vector3f(_local_pos->vx, _local_pos->vy, _local_pos->vz))(0);
- const float forward_vel_sp = q.rotateVectorInverse(Vector3f(_local_pos_sp->vx, _local_pos_sp->vy,
- _local_pos_sp->vz))(0);
-
- // NAN velocities fail the comparison and never detect
- pusher_ineffective = forward_vel_sp - forward_vel > _param_vt_ef_vel_err.get();
- }
-
- _pusher_failure_hysteresis.set_hysteresis_time_from(false, (hrt_abstime)(1_s * math::max(_param_vt_ef_time.get(), 0.f)));
- _pusher_failure_hysteresis.set_state_and_update(pusher_ineffective, hrt_absolute_time());
-
- return _pusher_failure_hysteresis.get_state();
+ _pusher_failed = _pusher_failed || isPusherFailureDetected(_pusher_throttle);
}
void Standard::update_fw_state()
diff --git a/src/modules/vtol_att_control/standard.h b/src/modules/vtol_att_control/standard.h
index 1b27816703b..9239be3a0e9 100644
--- a/src/modules/vtol_att_control/standard.h
+++ b/src/modules/vtol_att_control/standard.h
@@ -47,8 +47,6 @@
#define STANDARD_H
#include "vtol_type.h"
-#include
-
class Standard : public VtolType
{
@@ -82,23 +80,12 @@ private:
hrt_abstime _last_time_pusher_transition_update{0};
float _front_transition_pitch{NAN};
- systemlib::Hysteresis _pusher_failure_hysteresis{false};
- bool _pusher_failed{false}; ///< latched until reboot or until the detection is disabled
-
void parameters_update() override;
- bool isPusherFailureDetectionEnabled() const { return _param_vt_ef_time.get() > FLT_EPSILON; }
-
- /** Pusher assist above VT_EF_THROT, but the forward velocity stays below its setpoint */
- bool isPusherFailureDetected();
-
DEFINE_PARAMETERS_CUSTOM_PARENT(VtolType,
(ParamFloat) _param_vt_psher_slew,
(ParamFloat) _param_vt_b_trans_ramp,
- (ParamFloat) _param_fw_psp_off,
- (ParamFloat) _param_vt_ef_time,
- (ParamFloat) _param_vt_ef_throt,
- (ParamFloat) _param_vt_ef_vel_err
+ (ParamFloat) _param_fw_psp_off
)
};
#endif
diff --git a/src/modules/vtol_att_control/standard_params.yaml b/src/modules/vtol_att_control/standard_params.yaml
index 256147f75b5..5525b5fb81a 100644
--- a/src/modules/vtol_att_control/standard_params.yaml
+++ b/src/modules/vtol_att_control/standard_params.yaml
@@ -64,10 +64,11 @@ parameters:
description:
short: Pusher failure detection time
long: A pusher failure is detected in multicopter mode when, for this time, the
- pusher assist throttle is above VT_EF_THROT, but the forward velocity stays more
- than VT_EF_VEL_ERR below its setpoint. It is handled as a quad-chute that blocks
- front transitions until reboot or until disabled. Only used by standard VTOLs when
- VT_FWD_THRUST_EN is enabled. Set to 0 to disable.
+ pusher assist is above VT_EF_THROT, but the forward velocity stays more than
+ VT_EF_VEL_ERR below its setpoint. Pusher assist is the pusher throttle of a standard
+ VTOL, or the forward tilt of a tiltrotor. It is handled as a quad-chute that blocks
+ front transitions until reboot or until disabled. Only used by standard VTOLs and
+ tiltrotors when VT_FWD_THRUST_EN is enabled. Set to 0 to disable.
type: float
default: 5.0
unit: s
@@ -77,9 +78,10 @@ parameters:
decimal: 1
VT_EF_THROT:
description:
- short: Pusher failure detection throttle threshold
- long: Has to be below the highest pusher assist throttle, which VT_FWD_THRUST_SC,
- VT_PITCH_MIN and MPC_TILTMAX_AIR set.
+ short: Pusher failure detection pusher assist threshold
+ long: Pusher throttle of a standard VTOL, or forward tilt of a tiltrotor above VT_TILT_MC.
+ Has to be below the highest pusher assist, which VT_FWD_THRUST_SC, VT_PITCH_MIN and
+ MPC_TILTMAX_AIR set.
type: float
default: 0.4
min: 0.0
diff --git a/src/modules/vtol_att_control/test_vtol_quadchute.cpp b/src/modules/vtol_att_control/test_vtol_quadchute.cpp
index dc748474e5a..be00d95c07f 100644
--- a/src/modules/vtol_att_control/test_vtol_quadchute.cpp
+++ b/src/modules/vtol_att_control/test_vtol_quadchute.cpp
@@ -100,15 +100,15 @@ protected:
}
// Pusher command of one Run() cycle, update_mc_state() only runs on a new attitude setpoint
- float runCycle(VtolAttitudeControl &attc, Standard &standard, bool new_attitude_setpoint)
+ float runCycle(VtolAttitudeControl &attc, VtolType &vtol, bool new_attitude_setpoint)
{
- standard.update_vtol_state();
+ vtol.update_vtol_state();
if (new_attitude_setpoint) {
- standard.update_mc_state();
+ vtol.update_mc_state();
}
- standard.fill_actuator_outputs();
+ vtol.fill_actuator_outputs();
return attc.get_thrust_setpoint_0()->xyz[0];
}
};
@@ -156,6 +156,7 @@ protected:
void TearDown() override
{
param_reset(param_find("VT_EF_TIME"));
+ param_reset(param_find("VT_TILT_MC"));
VtolQuadchutePusherTest::TearDown();
}
@@ -181,13 +182,15 @@ protected:
attc.vehicle_cmd_poll();
}
+ QuadchuteReason quadchuteReason(const VtolAttitudeControl &attc) const { return attc._quadchute_reason; }
+
// Fly multicopter mode until the quad-chute or the timeout, returns the flight time
- hrt_abstime fly(VtolAttitudeControl &attc, Standard &standard, hrt_abstime timeout)
+ hrt_abstime fly(VtolAttitudeControl &attc, VtolType &vtol, hrt_abstime timeout)
{
const hrt_abstime start = hrt_absolute_time();
while (!attc.is_fixed_wing_system_failure() && hrt_elapsed_time(&start) < timeout) {
- runCycle(attc, standard, true);
+ runCycle(attc, vtol, true);
px4_usleep(10_ms);
}
@@ -279,3 +282,52 @@ TEST_F(VtolPusherFailureTest, PusherAssistBelowThresholdIsNoPusherFailure)
fly(attc, standard, 300_ms);
EXPECT_FALSE(attc.is_fixed_wing_system_failure());
}
+
+// A tiltrotor assists with forward tilt instead of a pusher, which the same detection checks
+TEST_F(VtolPusherFailureTest, TiltrotorWithoutForwardMotionIsPusherFailure)
+{
+ VtolAttitudeControl attc;
+ Tiltrotor tiltrotor(&attc);
+ setHover(attc, 0.f);
+
+ fly(attc, tiltrotor, 2_s);
+ EXPECT_EQ(quadchuteReason(attc), QuadchuteReason::PusherFailure);
+ EXPECT_FLOAT_EQ(tiltrotor.pusher_assist(), 0.f); // the tilt goes back to VT_TILT_MC
+
+ // latched: a front transition command does not start a transition
+ commandFrontTransition(attc);
+ ASSERT_FALSE(attc.is_quadchute_active());
+ tiltrotor.update_vtol_state();
+ EXPECT_TRUE(attc.is_fixed_wing_system_failure());
+ EXPECT_EQ(tiltrotor.get_mode(), mode::ROTARY_WING);
+}
+
+TEST_F(VtolPusherFailureTest, TiltrotorTiltAssistBelowThresholdIsNoPusherFailure)
+{
+ // only the tilt above VT_TILT_MC counts: 0.1 + 0.35 of tilt assist is still below VT_EF_THROT (0.4)
+ const float tilt_mc = 0.1f;
+ param_set(param_find("VT_TILT_MC"), &tilt_mc);
+ VtolAttitudeControl attc;
+ Tiltrotor tiltrotor(&attc);
+ setHover(attc, 0.f, 5.f, -30.f);
+
+ fly(attc, tiltrotor, 300_ms);
+ EXPECT_FALSE(attc.is_fixed_wing_system_failure());
+}
+
+TEST_F(VtolPusherFailureTest, TiltrotorDisablingDetectionAllowsFrontTransitions)
+{
+ VtolAttitudeControl attc;
+ Tiltrotor tiltrotor(&attc);
+ setHover(attc, 0.f);
+ fly(attc, tiltrotor, 2_s);
+ ASSERT_TRUE(attc.is_fixed_wing_system_failure());
+
+ const float ef_time = 0.f;
+ param_set(param_find("VT_EF_TIME"), &ef_time);
+ static_cast(tiltrotor).parameters_update();
+ commandFrontTransition(attc);
+ tiltrotor.update_vtol_state();
+ EXPECT_FALSE(attc.is_fixed_wing_system_failure());
+ EXPECT_EQ(tiltrotor.get_mode(), mode::TRANSITION_TO_FW);
+}
diff --git a/src/modules/vtol_att_control/tiltrotor.cpp b/src/modules/vtol_att_control/tiltrotor.cpp
index 730ce12cc9f..90bc804b231 100644
--- a/src/modules/vtol_att_control/tiltrotor.cpp
+++ b/src/modules/vtol_att_control/tiltrotor.cpp
@@ -57,6 +57,8 @@ void
Tiltrotor::parameters_update()
{
VtolType::updateParams();
+
+ clearPusherFailureIfDisabled();
}
void Tiltrotor::update_vtol_state()
@@ -67,6 +69,11 @@ void Tiltrotor::update_vtol_state()
* forward completely. For the backtransition the motors simply rotate back.
*/
+ // without forward tilt a front transition would fail too, so this quad-chute stays until reboot
+ if (_pusher_failed) {
+ _attc->quadchute(QuadchuteReason::PusherFailure);
+ }
+
if (_attc->is_quadchute_active()) {
// Failsafe event, switch to MC mode immediately
_vtol_mode = vtol_mode::MC_MODE;
@@ -191,8 +198,11 @@ void Tiltrotor::update_mc_state()
{
VtolType::update_mc_state();
- _tilt_control = VtolType::pusher_assist() + _param_vt_tilt_mc.get();
+ const float tilt_assist = VtolType::pusher_assist();
+ _tilt_control = tilt_assist + _param_vt_tilt_mc.get();
_mc_yaw_weight = 1.0f;
+
+ _pusher_failed = _pusher_failed || isPusherFailureDetected(tilt_assist);
}
void Tiltrotor::update_fw_state()
diff --git a/src/modules/vtol_att_control/vtol_type.cpp b/src/modules/vtol_att_control/vtol_type.cpp
index 47563afb937..adaac2c26b7 100644
--- a/src/modules/vtol_att_control/vtol_type.cpp
+++ b/src/modules/vtol_att_control/vtol_type.cpp
@@ -162,6 +162,9 @@ void VtolType::update_transition_state()
_time_since_trans_start = (float)(t_now - _transition_start_timestamp) * 1e-6f;
+ // the pusher failure detection restarts in multicopter mode
+ _pusher_failure_hysteresis.set_state_and_update(false, t_now);
+
check_quadchute_condition();
_last_thr_in_mc = _vehicle_thrust_setpoint_virtual_mc->xyz[2];
@@ -399,6 +402,33 @@ void VtolType::check_quadchute_condition()
}
}
+bool VtolType::isPusherFailureDetected(float assist)
+{
+ bool pusher_ineffective = false;
+
+ if (isPusherFailureDetectionEnabled() && assist > _param_vt_ef_throt.get() && _local_pos->v_xy_valid) {
+ const Quatf q(_v_att->q);
+ const float forward_vel = q.rotateVectorInverse(Vector3f(_local_pos->vx, _local_pos->vy, _local_pos->vz))(0);
+ const float forward_vel_sp = q.rotateVectorInverse(Vector3f(_local_pos_sp->vx, _local_pos_sp->vy,
+ _local_pos_sp->vz))(0);
+
+ // NAN velocities fail the comparison and never detect
+ pusher_ineffective = forward_vel_sp - forward_vel > _param_vt_ef_vel_err.get();
+ }
+
+ _pusher_failure_hysteresis.set_hysteresis_time_from(false, (hrt_abstime)(1_s * math::max(_param_vt_ef_time.get(), 0.f)));
+ _pusher_failure_hysteresis.set_state_and_update(pusher_ineffective, hrt_absolute_time());
+
+ return _pusher_failure_hysteresis.get_state();
+}
+
+void VtolType::clearPusherFailureIfDisabled()
+{
+ if (!isPusherFailureDetectionEnabled()) {
+ _pusher_failed = false;
+ }
+}
+
float VtolType::pusher_assist()
{
// Altitude above ground is local z-position or altitude above home or distance sensor altitude depending on what's available
diff --git a/src/modules/vtol_att_control/vtol_type.h b/src/modules/vtol_att_control/vtol_type.h
index 0c4abe3d6b4..3d3f2c6b5d1 100644
--- a/src/modules/vtol_att_control/vtol_type.h
+++ b/src/modules/vtol_att_control/vtol_type.h
@@ -44,6 +44,7 @@
#define VTOL_TYPE_H
#include
+#include
#include
#include
@@ -329,6 +330,18 @@ protected:
int _altitude_reset_counter{0};
+ // multicopter pusher failure detection, on the pusher throttle of a standard VTOL or the forward tilt of a tiltrotor
+ systemlib::Hysteresis _pusher_failure_hysteresis{false};
+ bool _pusher_failed{false}; ///< latched until reboot or until the detection is disabled
+
+ bool isPusherFailureDetectionEnabled() const { return _param_vt_ef_time.get() > FLT_EPSILON; }
+
+ /** Pusher assist (from pusher_assist()) above VT_EF_THROT, but the forward velocity stays below its setpoint */
+ bool isPusherFailureDetected(float assist);
+
+ /** Disabling the detection in flight clears a detected pusher failure, e.g. a false positive in strong wind */
+ void clearPusherFailureIfDisabled();
+
DEFINE_PARAMETERS_CUSTOM_PARENT(ModuleParams,
(ParamBool) _param_vt_elev_mc_lock,
(ParamFloat) _param_vt_fw_min_alt,
@@ -361,7 +374,10 @@ protected:
(ParamFloat) _param_mpc_land_alt2,
(ParamFloat) _param_vt_lnd_pitch_min,
(ParamFloat) _param_weight_base,
- (ParamFloat) _param_weight_gross
+ (ParamFloat) _param_weight_gross,
+ (ParamFloat) _param_vt_ef_time,
+ (ParamFloat) _param_vt_ef_throt,
+ (ParamFloat) _param_vt_ef_vel_err
)