Skip to content

Commit 4fa64f6

Browse files
sfuhrerLorenzMeier
authored andcommitted
pre arm check: add circuit breaker for the VTOL arming in fixed-wing mode prevention
Added a new circuit breaker that, if set, enables arming in fixed-wing mode for VTOLs. Signed-off-by: Silvan Fuhrer <[email protected]>
1 parent f4df3fb commit 4fa64f6

File tree

6 files changed

+22
-1
lines changed

6 files changed

+22
-1
lines changed

msg/vehicle_status_flags.msg

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ bool circuit_breaker_engaged_enginefailure_check
2121
bool circuit_breaker_flight_termination_disabled
2222
bool circuit_breaker_engaged_usb_check
2323
bool circuit_breaker_engaged_posfailure_check # set to true when the position valid checks have been disabled
24+
bool circuit_breaker_vtol_fw_arming_check # set to true if for VTOLs arming in fixed-wing mode should be allowed
2425

2526
bool offboard_control_signal_found_once
2627
bool offboard_control_signal_lost

src/lib/circuit_breaker/circuit_breaker.h

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
#define CBRK_ENGINEFAIL_KEY 284953
5858
#define CBRK_USB_CHK_KEY 197848
5959
#define CBRK_VELPOSERR_KEY 201607
60+
#define CBRK_VTOLARMING_KEY 159753
6061

6162
#include <stdint.h>
6263

src/lib/circuit_breaker/circuit_breaker_params.c

+15
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,18 @@ PARAM_DEFINE_INT32(CBRK_USB_CHK, 0);
176176
* @group Circuit Breaker
177177
*/
178178
PARAM_DEFINE_INT32(CBRK_VELPOSERR, 0);
179+
180+
/**
181+
* Circuit breaker for arming in fixed-wing mode check
182+
*
183+
* Setting this parameter to 159753 will enable arming in fixed-wing
184+
* mode for VTOLs.
185+
* WARNING: ENABLING THIS CIRCUIT BREAKER IS AT OWN RISK
186+
*
187+
* @reboot_required true
188+
* @min 0
189+
* @max 159753
190+
* @category Developer
191+
* @group Circuit Breaker
192+
*/
193+
PARAM_DEFINE_INT32(CBRK_VTOLARMING, 0);

src/modules/commander/Arming/PreFlightCheck/checks/preArmCheck.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ bool PreFlightCheck::preArmCheck(orb_advert_t *mavlink_log_pub, const vehicle_st
134134
}
135135
}
136136

137-
if (status.is_vtol && status.vehicle_type != vehicle_status_s::VEHICLE_TYPE_ROTARY_WING) {
137+
if (!status_flags.circuit_breaker_vtol_fw_arming_check && status.is_vtol
138+
&& status.vehicle_type != vehicle_status_s::VEHICLE_TYPE_ROTARY_WING) {
138139
if (prearm_ok) {
139140
mavlink_log_critical(mavlink_log_pub, "Arming denied! Vehicle is not in multicopter mode");
140141
prearm_ok = false;

src/modules/commander/Commander.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -2340,6 +2340,8 @@ Commander::get_circuit_breaker_params()
23402340
CBRK_FLIGHTTERM_KEY);
23412341
status_flags.circuit_breaker_engaged_posfailure_check = circuit_breaker_enabled_by_val(_param_cbrk_velposerr.get(),
23422342
CBRK_VELPOSERR_KEY);
2343+
status_flags.circuit_breaker_vtol_fw_arming_check = circuit_breaker_enabled_by_val(_param_cbrk_vtolarming.get(),
2344+
CBRK_VTOLARMING_KEY);
23432345
}
23442346

23452347
void

src/modules/commander/Commander.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ class Commander : public ModuleBase<Commander>, public ModuleParams
243243
(ParamInt<px4::params::CBRK_ENGINEFAIL>) _param_cbrk_enginefail,
244244
(ParamInt<px4::params::CBRK_FLIGHTTERM>) _param_cbrk_flightterm,
245245
(ParamInt<px4::params::CBRK_VELPOSERR>) _param_cbrk_velposerr,
246+
(ParamInt<px4::params::CBRK_VTOLARMING>) _param_cbrk_vtolarming,
246247

247248
// Geofrence
248249
(ParamInt<px4::params::GF_ACTION>) _param_geofence_action,

0 commit comments

Comments
 (0)