RC_Channel: add EKF_RESET aux function for bootstrap reset

Add RCx_OPTION=187 (EKF_RESET) aux function that triggers a full EKF
bootstrap reset on HIGH, gated to fire only on state transition.
Sends GCS status message indicating whether the reset succeeded or
failed. Available for all vehicle types.

Gated by AP_AHRS_EKF_RESET_ENABLED compile-time option.
This commit is contained in:
Andy Piper
2026-05-13 18:04:37 +01:00
parent 14a413ea8a
commit 76999e2ea5
2 changed files with 21 additions and 2 deletions
+18 -2
View File
@@ -250,8 +250,9 @@ const AP_Param::GroupInfo RC_Channel::var_info[] = {
// @Values{Copter}: 182: AHRS AutoTrim
// @Values{Plane}: 183: AUTOLAND mode
// @Values{Plane}: 184: System ID Chirp
// @Values{Copter, Rover, Plane, Blimp, Sub}: 185:Mount Roll/Pitch Lock
// @Values{Copter, Rover, Plane, Blimp, Sub}: 186:Mount POI Lock
// @Values{Copter, Rover, Plane, Blimp, Sub}: 185:Mount Roll/Pitch Lock
// @Values{Copter, Rover, Plane, Blimp, Sub}: 186:Mount POI Lock
// @Values{Copter, Rover, Plane, Blimp, Sub}: 187:EKF Reset
// @Values{Rover}: 201:Roll
// @Values{Rover}: 202:Pitch
// @Values{Rover}: 207:MainSail
@@ -697,6 +698,9 @@ void RC_Channel::init_aux_function(const AUX_FUNC ch_option, const AuxSwitchPos
case AUX_FUNC::EKF_LANE_SWITCH:
case AUX_FUNC::EKF_YAW_RESET:
#endif
#if AP_AHRS_EKF_RESET_ENABLED
case AUX_FUNC::EKF_RESET:
#endif
#if HAL_GENERATOR_ENABLED
case AUX_FUNC::GENERATOR: // don't turn generator on or off initially
#endif
@@ -1926,6 +1930,18 @@ bool RC_Channel::do_aux_function(const AuxFuncTrigger &trigger)
AP::ahrs().request_yaw_reset();
break;
#if AP_AHRS_EKF_RESET_ENABLED
case AUX_FUNC::EKF_RESET:
if (ch_flag == AuxSwitchPos::HIGH) {
if (AP::ahrs().reset_configured_backend() && hal.util->get_soft_armed()) {
GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "EKF bootstrap reset performed");
} else {
GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "EKF bootstrap reset failed");
}
}
break;
#endif // AP_AHRS_EKF_RESET_ENABLED
case AUX_FUNC::AHRS_TYPE: {
#if HAL_NAVEKF3_AVAILABLE && AP_EXTERNAL_AHRS_ENABLED
AP::ahrs().set_ekf_type(ch_flag==AuxSwitchPos::HIGH? AP_AHRS::EKFType::EXTERNAL : AP_AHRS::EKFType::THREE);
+3
View File
@@ -372,6 +372,9 @@ public:
#if AP_MOUNT_POI_LOCK_ENABLED
MOUNT_POI_LOCK = 186, // Lock mount target to current ROI seen and switch mount to GPS Targeting mode
#endif // AP_MOUNT_POI_LOCK_ENABLED
#if AP_AHRS_EKF_RESET_ENABLED
EKF_RESET = 187, // trigger full EKF bootstrap reset
#endif // AP_AHRS_EKF_RESET_ENABLED
// inputs from 200 will eventually used to replace RCMAP
ROLL = 201, // roll input
PITCH = 202, // pitch input