Files
PX4-Autopilot/test/mavsdk_tests/CMakeLists.txt
T
Ramon Roche 150094a592 test(ekf2): add SIH SITL test for EKF2 selector regression
Adds a two-phase test that reproduces the EKF2 selector whipsaw from
#27013:

Phase 1: Inject accel clipping on IMU 0 so EKF0 declares cs_baro_fault
and its Z state diverges from baro (switches to GPS-only height).

Phase 2: Move clipping to IMU 1. EKF0 now has no filter_fault_flags
but retains diverged Z. EKF1 gets bad_acc_clipping. The selector falls
back to the "healthy" but diverged EKF0, causing altitude spikes.

Verified locally: test fails with 9.3m altitude deviation (5m tolerance),
confirming the selector bug is reproducible in SIH SITL.

Also adds dual magnetometer to sensor_mag_sim (matching v6c sensor
topology), SIH test runner, CI workflow, and set_param_float helper.

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-04-13 10:43:57 -07:00

58 lines
1.6 KiB
CMake

cmake_minimum_required(VERSION 3.5.1)
project(mavsdk_tests CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
file(READ MAVSDK_VERSION MAVSDK_VERSION)
string(STRIP ${MAVSDK_VERSION} MAVSDK_VERSION)
find_package(MAVSDK "${MAVSDK_VERSION}" REQUIRED)
find_package(Threads REQUIRED)
if(MAVSDK_FOUND)
add_executable(mavsdk_tests
test_main.cpp
autopilot_tester.cpp
autopilot_tester_failure.cpp
autopilot_tester_rtl.cpp
autopilot_tester_figure_eight.cpp
# follow-me needs a MAVSDK update:
# https://github.com/mavlink/MAVSDK/pull/1770
# autopilot_tester_follow_me.cpp
test_multicopter_basics.cpp
test_multicopter_control_allocation.cpp
test_multicopter_failure_injection.cpp
test_multicopter_failsafe.cpp
test_multicopter_mission.cpp
test_multicopter_offboard.cpp
test_multicopter_manual.cpp
test_vtol_mission.cpp
test_vtol_figure_eight.cpp
test_vtol_rtl.cpp
test_vtol_mission_wind.cpp
test_vtol_loiter_airspeed_failure_blockage.cpp
test_ekf2_selector.cpp
# test_multicopter_follow_me.cpp
)
target_link_libraries(mavsdk_tests
MAVSDK::mavsdk
${CMAKE_THREAD_LIBS_INIT}
)
target_include_directories(mavsdk_tests PUBLIC ${CMAKE_BINARY_DIR}/..)
target_compile_options(mavsdk_tests
PRIVATE
-Wall
-Wextra
-Werror
-Wno-error=deprecated-declarations
)
else()
message("MAVSDK C++ not found, skipping mavsdk_tests build..")
endif()