diff --git a/src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp b/src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp index 3ee511b2fe..f306c39c1b 100644 --- a/src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp +++ b/src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp @@ -1530,7 +1530,7 @@ FixedwingPositionControl::control_auto_takeoff(const hrt_abstime &now, const flo } else { /* Perform launch detection */ - if (!_skipping_takeoff_detection && _launchDetector.launchDetectionEnabled() && + if (!_skipping_takeoff_detection && _param_laun_all_on.get() && _launchDetector.getLaunchDetected() < launch_detection_status_s::STATE_FLYING) { if (_control_mode.flag_armed) { @@ -1546,7 +1546,7 @@ FixedwingPositionControl::control_auto_takeoff(const hrt_abstime &now, const flo } if (!_launch_detected && _launchDetector.getLaunchDetected() > launch_detection_status_s::STATE_WAITING_FOR_LAUNCH - && _launchDetector.launchDetectionEnabled()) { + && _param_laun_all_on.get()) { _launch_detected = true; _launch_global_position = global_position; _takeoff_ground_alt = _current_altitude; @@ -1561,7 +1561,7 @@ FixedwingPositionControl::control_auto_takeoff(const hrt_abstime &now, const flo /* Set control values depending on the detection state */ if (_launchDetector.getLaunchDetected() > launch_detection_status_s::STATE_WAITING_FOR_LAUNCH - && _launchDetector.launchDetectionEnabled()) { + && _param_laun_all_on.get()) { /* Launch has been detected, hence we have to control the plane. */ if (_param_fw_use_npfg.get()) { diff --git a/src/modules/fw_pos_control_l1/FixedwingPositionControl.hpp b/src/modules/fw_pos_control_l1/FixedwingPositionControl.hpp index 71a5668ff9..ede43e542a 100644 --- a/src/modules/fw_pos_control_l1/FixedwingPositionControl.hpp +++ b/src/modules/fw_pos_control_l1/FixedwingPositionControl.hpp @@ -874,7 +874,8 @@ private: (ParamFloat) _param_fw_tko_airspd, - (ParamFloat) _param_rwto_psp + (ParamFloat) _param_rwto_psp, + (ParamBool) _param_laun_all_on ) }; diff --git a/src/modules/fw_pos_control_l1/fw_pos_control_l1_params.c b/src/modules/fw_pos_control_l1/fw_pos_control_l1_params.c index 522a9a0898..8a890ebe1e 100644 --- a/src/modules/fw_pos_control_l1/fw_pos_control_l1_params.c +++ b/src/modules/fw_pos_control_l1/fw_pos_control_l1_params.c @@ -1118,3 +1118,11 @@ PARAM_DEFINE_INT32(FW_LND_ABORT, 3); * @group FW TECS */ PARAM_DEFINE_FLOAT(FW_WIND_ARSP_SC, 0.f); + +/** + * Launch detection + * + * @boolean + * @group FW Launch detection + */ +PARAM_DEFINE_INT32(LAUN_ALL_ON, 0); diff --git a/src/modules/fw_pos_control_l1/launchdetection/LaunchDetector.h b/src/modules/fw_pos_control_l1/launchdetection/LaunchDetector.h index d5912c3650..fbdf1a6cd1 100644 --- a/src/modules/fw_pos_control_l1/launchdetection/LaunchDetector.h +++ b/src/modules/fw_pos_control_l1/launchdetection/LaunchDetector.h @@ -74,11 +74,6 @@ public: */ uint getLaunchDetected() const; - /** - * @return Launch detection is enabled - */ - bool launchDetectionEnabled() { return _param_laun_all_on.get(); } - void forceSetFlyState() { _state = launch_detection_status_s::STATE_FLYING; } private: @@ -100,7 +95,6 @@ private: uint _state{launch_detection_status_s::STATE_WAITING_FOR_LAUNCH}; DEFINE_PARAMETERS( - (ParamBool) _param_laun_all_on, (ParamFloat) _param_laun_cat_a, (ParamFloat) _param_laun_cat_t, (ParamFloat) _param_laun_cat_mdel diff --git a/src/modules/fw_pos_control_l1/launchdetection/launchdetection_params.c b/src/modules/fw_pos_control_l1/launchdetection/launchdetection_params.c index bc19f20bf8..c317a1b849 100644 --- a/src/modules/fw_pos_control_l1/launchdetection/launchdetection_params.c +++ b/src/modules/fw_pos_control_l1/launchdetection/launchdetection_params.c @@ -40,18 +40,10 @@ */ /* - * Catapult launch detection parameters, accessible via MAVLink + * Catapult launch detection parameters * */ -/** - * Launch detection - * - * @boolean - * @group FW Launch detection - */ -PARAM_DEFINE_INT32(LAUN_ALL_ON, 0); - /** * Catapult accelerometer threshold. *