Skip to content

Commit 661c357

Browse files
committed
It is not possible to arm with the tkoff controller for the aircraft and the autogyro switched on at the same time.
1 parent 904d9cd commit 661c357

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/****************************************************************************
22
*
3-
* Copyright (c) 2019-2020 PX4 Development Team. All rights reserved.
3+
* Copyright (c) 2019-2022 PX4 Development Team. All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
66
* modification, are permitted provided that the following conditions
@@ -37,6 +37,7 @@
3737
#include <systemlib/mavlink_log.h>
3838
#include <uORB/topics/vehicle_command_ack.h>
3939
#include <HealthFlags.h>
40+
#include <lib/parameters/param.h>
4041

4142
bool PreFlightCheck::preArmCheck(orb_advert_t *mavlink_log_pub, const vehicle_status_flags_s &status_flags,
4243
const vehicle_control_mode_s &control_mode,
@@ -222,5 +223,18 @@ bool PreFlightCheck::preArmCheck(orb_advert_t *mavlink_log_pub, const vehicle_st
222223
}
223224

224225

226+
int32_t param_rwto_tkoff{0};
227+
param_get(param_find("RWTO_TKOFF"), &param_rwto_tkoff);
228+
int32_t param_ag_tkoff{0};
229+
param_get(param_find("AG_TKOFF"), &param_ag_tkoff);
230+
231+
if (param_rwto_tkoff && param_ag_tkoff) {
232+
if (report_fail) {
233+
mavlink_log_critical(mavlink_log_pub, "Arming denied, FW and AG takeoff eneabled together");
234+
}
235+
prearm_ok = false;
236+
}
237+
238+
225239
return prearm_ok;
226240
}

src/modules/commander/Commander.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,15 @@ transition_result_t Commander::arm(arm_disarm_reason_t calling_reason, bool run_
730730
tune_negative(true);
731731
return TRANSITION_DENIED;
732732
}
733+
734+
if (_param_rwto_tkoff.get() && _param_ag_tkoff.get()) {
735+
mavlink_log_critical(&_mavlink_log_pub, "Arming denied: Check takeoff parameters\t");
736+
events::send(events::ID("commander_arm_denied_takeoff_parameters"),
737+
{events::Log::Critical, events::LogInternal::Info},
738+
"Arming denied: FW and AG takeoff eneabled together");
739+
tune_negative(true);
740+
return TRANSITION_DENIED;
741+
}
733742
}
734743

735744
transition_result_t arming_res = arming_state_transition(_status, _vehicle_control_mode, _safety,

src/modules/commander/Commander.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ class Commander : public ModuleBase<Commander>, public ModuleParams
251251

252252
(ParamInt<px4::params::COM_FLIGHT_UUID>) _param_flight_uuid,
253253
(ParamInt<px4::params::COM_TAKEOFF_ACT>) _param_takeoff_finished_action,
254+
(ParamInt<px4::params::RWTO_TKOFF>) _param_rwto_tkoff,
255+
(ParamInt<px4::params::AG_TKOFF>) _param_ag_tkoff,
254256

255257
// Circuit breakers
256258
(ParamInt<px4::params::CBRK_SUPPLY_CHK>) _param_cbrk_supply_chk,

0 commit comments

Comments
 (0)