diff --git a/src/lib/parameters/param_translation.cpp b/src/lib/parameters/param_translation.cpp index bf526bdfa3..f678850b67 100644 --- a/src/lib/parameters/param_translation.cpp +++ b/src/lib/parameters/param_translation.cpp @@ -269,11 +269,29 @@ bool param_modify_on_import(bson_node_t node) } } - // 2022-11-09: translate LAUN_ALL_ON->LAUN_DETCN_ON + // 2022-11-09: translate several fixed-wing launch parameters { if (strcmp("LAUN_ALL_ON", node->name) == 0) { - strcpy(node->name, "LAUN_DETCN_ON"); - PX4_INFO("copying %s -> %s", "LAUN_ALL_ON", "LAUN_DETCN_ON"); + strcpy(node->name, "FW_LAUN_DETCN_ON"); + PX4_INFO("copying %s -> %s", "LAUN_ALL_ON", "FW_LAUN_DETCN_ON"); + return true; + } + + if (strcmp("LAUN_CAT_A", node->name) == 0) { + strcpy(node->name, "FW_LAUN_AC_THLD"); + PX4_INFO("copying %s -> %s", "LAUN_CAT_A", "FW_LAUN_AC_THLD"); + return true; + } + + if (strcmp("LAUN_CAT_T", node->name) == 0) { + strcpy(node->name, "FW_LAUN_AC_T"); + PX4_INFO("copying %s -> %s", "LAUN_CAT_T", "FW_LAUN_AC_T"); + return true; + } + + if (strcmp("LAUN_CAT_MDEL", node->name) == 0) { + strcpy(node->name, "FW_LAUN_MOT_DEL"); + PX4_INFO("copying %s -> %s", "LAUN_CAT_MDEL", "FW_LAUN_MOT_DEL"); return true; } } diff --git a/src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp b/src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp index 32636c1795..adf0d8c6c8 100644 --- a/src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp +++ b/src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp @@ -1537,7 +1537,7 @@ FixedwingPositionControl::control_auto_takeoff(const hrt_abstime &now, const flo } else { /* Perform launch detection */ - if (!_skipping_takeoff_detection && _param_laun_detcn_on.get() && + if (!_skipping_takeoff_detection && _param_fw_laun_detcn_on.get() && _launchDetector.getLaunchDetected() < launch_detection_status_s::STATE_FLYING) { if (_control_mode.flag_armed) { @@ -1553,7 +1553,7 @@ FixedwingPositionControl::control_auto_takeoff(const hrt_abstime &now, const flo } if (!_launch_detected && _launchDetector.getLaunchDetected() > launch_detection_status_s::STATE_WAITING_FOR_LAUNCH - && _param_laun_detcn_on.get()) { + && _param_fw_laun_detcn_on.get()) { _launch_detected = true; _launch_global_position = global_position; _takeoff_ground_alt = _current_altitude; @@ -1574,7 +1574,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 - && _param_laun_detcn_on.get()) { + && _param_fw_laun_detcn_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 a903133b80..3b9f144289 100644 --- a/src/modules/fw_pos_control_l1/FixedwingPositionControl.hpp +++ b/src/modules/fw_pos_control_l1/FixedwingPositionControl.hpp @@ -878,7 +878,7 @@ private: (ParamFloat) _param_fw_tko_airspd, (ParamFloat) _param_rwto_psp, - (ParamBool) _param_laun_detcn_on + (ParamBool) _param_fw_laun_detcn_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 6261f2460d..44af21e71e 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 @@ -1129,4 +1129,4 @@ PARAM_DEFINE_FLOAT(FW_WIND_ARSP_SC, 0.f); * @boolean * @group FW Launch detection */ -PARAM_DEFINE_INT32(LAUN_DETCN_ON, 0); +PARAM_DEFINE_INT32(FW_LAUN_DETCN_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 d8ab570a08..3bda64ef24 100644 --- a/src/modules/fw_pos_control_l1/launchdetection/LaunchDetector.h +++ b/src/modules/fw_pos_control_l1/launchdetection/LaunchDetector.h @@ -102,9 +102,9 @@ private: uint state_{launch_detection_status_s::STATE_WAITING_FOR_LAUNCH}; DEFINE_PARAMETERS( - (ParamFloat) _param_laun_cat_a, - (ParamFloat) _param_laun_cat_t, - (ParamFloat) _param_laun_cat_mdel + (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 c317a1b849..5ecade1c23 100644 --- a/src/modules/fw_pos_control_l1/launchdetection/launchdetection_params.c +++ b/src/modules/fw_pos_control_l1/launchdetection/launchdetection_params.c @@ -39,15 +39,10 @@ * @author Thomas Gubler */ -/* - * Catapult launch detection parameters - * - */ - /** - * Catapult accelerometer threshold. + * Trigger acceleration threshold * - * LAUN_CAT_A for LAUN_CAT_T serves as threshold to trigger launch detection. + * Launch is detected when acceleration in body forward direction is above FW_LAUN_AC_THLD for FW_LAUN_AC_T seconds. * * @unit m/s^2 * @min 0 @@ -55,12 +50,12 @@ * @increment 0.5 * @group FW Launch detection */ -PARAM_DEFINE_FLOAT(LAUN_CAT_A, 30.0f); +PARAM_DEFINE_FLOAT(FW_LAUN_AC_THLD, 30.0f); /** - * Catapult time threshold. + * Trigger time * - * LAUN_CAT_A for LAUN_CAT_T serves as threshold to trigger launch detection. + * Launch is detected when acceleration in body forward direction is above FW_LAUN_AC_THLD for FW_LAUN_AC_T seconds. * * @unit s * @min 0.0 @@ -69,7 +64,7 @@ PARAM_DEFINE_FLOAT(LAUN_CAT_A, 30.0f); * @increment 0.05 * @group FW Launch detection */ -PARAM_DEFINE_FLOAT(LAUN_CAT_T, 0.05f); +PARAM_DEFINE_FLOAT(FW_LAUN_AC_T, 0.05f); /** * Motor delay @@ -84,4 +79,4 @@ PARAM_DEFINE_FLOAT(LAUN_CAT_T, 0.05f); * @increment 0.5 * @group FW Launch detection */ -PARAM_DEFINE_FLOAT(LAUN_CAT_MDEL, 0.0f); +PARAM_DEFINE_FLOAT(FW_LAUN_MOT_DEL, 0.0f);