471ff12e70
The existing suite passed both before and after the fusion fixes, so it never covered either failure. Two tests close that gap; both were checked against the pre-fix sources and fail there. calibration_offset_test reproduces the bench part's +28 mg zero-g offset and requires startup to complete, while still refusing a sustained 3 m/s2 acceleration. It also asserts the blind spot rather than leaving it implicit: horizontal acceleration adds to gravity in quadrature, so 1.5 m/s2 moves the magnitude by only 0.11 m/s2 and is not separable from offset by any accelerometer gate. Separating it needs GNSS velocity. long_outage_trajectory_test drives pedestrian, gentle-car (0-100 km/h in 30 s), slow-city and isolated-mount profiles across 1 and 5 minute outages, using the production rest supervisor rather than a hand-set flag. Only the isolated-mount slow-city case reproduces the field bug: GNSS motion evidence compares displacement against covariance, so 4 m/s under 6 m sigma scores a displacement NIS of 0.22 against a 9.21 gate and reads as stationary, whereas highway speed scores 42.9 and is correctly called moving. Pre-fix that case produces 608 zero-velocity updates while driving, matching the 609 in the board logs. Drift is judged against the filter's own covariance rather than a fixed distance. Five minutes unaided legitimately reaches kilometres on this hardware; what must not happen is the error outrunning the covariance, which is divergence rather than honest coasting. tdk_noise_test characterises the sensor at rest through the production driver, so ODR, full scale, UI filter and LSB scaling match the flight build, and reports the norms fusion_motion_update() actually gates on. It also carries an INT1-to-PLIC continuity test that drives the pin to a static level and reads the PLIC pending bit directly, separating a broken line from a source that never fires. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
158 lines
8.1 KiB
Makefile
158 lines
8.1 KiB
Makefile
CC ?= cc
|
|
CFLAGS ?= -std=c11 -O2 -Wall -Wextra -Wpedantic
|
|
CFLAGS += -I../../gps_system/header
|
|
LDLIBS ?= -lm
|
|
|
|
GPS_TIME_SOURCE := ../../gps_system/src/gps/gps_time_anchor.c
|
|
GPS_EPOCH_SOURCE := ../../gps_system/src/gps/gps_nav_epoch.c
|
|
ESKF_SOURCES := ../../gps_system/src/fusion/eskf.c ../../gps_system/src/fusion/fusion_motion.c ../../gps_system/src/fusion/fusion_rest_detector.c ../../gps_system/src/fusion/fusion_engine.c ../../gps_system/src/fusion/fusion_gps_adapter.c ../../gps_system/src/fusion/fusion_bus.c
|
|
IMU_PROFILE_SOURCE := ../../gps_system/src/adapters/imu_fusion_profile.c
|
|
|
|
.PHONY: all test gps-system-test scenario-logs sanitize profile benchmark clean
|
|
|
|
all: standalone_gps_integrity_test eskf_motion_test fusion_rest_detector_test fusion_synthetic_test imu_quality_synthetic_test async_tilt_recovery_test async_rate_matrix_test gps_reacquisition_test platform_scenario_matrix_test gps_failure_scenario_test calibration_offset_test long_outage_trajectory_test
|
|
|
|
standalone_gps_integrity_test: standalone_gps_integrity_test.c $(GPS_TIME_SOURCE) $(GPS_EPOCH_SOURCE)
|
|
$(CC) $(CFLAGS) $^ -o $@ $(LDLIBS)
|
|
|
|
eskf_motion_test: eskf_motion_test.c $(ESKF_SOURCES)
|
|
$(CC) $(CFLAGS) $^ -o $@ $(LDLIBS)
|
|
|
|
fusion_rest_detector_test: fusion_rest_detector_test.c ../../gps_system/src/fusion/fusion_rest_detector.c
|
|
$(CC) $(CFLAGS) $^ -o $@ $(LDLIBS)
|
|
|
|
fusion_synthetic_test: fusion_synthetic_test.c $(ESKF_SOURCES)
|
|
$(CC) $(CFLAGS) $^ -o $@ $(LDLIBS)
|
|
|
|
imu_quality_synthetic_test: imu_quality_synthetic_test.c $(ESKF_SOURCES) $(IMU_PROFILE_SOURCE)
|
|
$(CC) $(CFLAGS) $^ -o $@ $(LDLIBS)
|
|
|
|
async_tilt_recovery_test: async_tilt_recovery_test.c $(ESKF_SOURCES)
|
|
$(CC) $(CFLAGS) $^ -o $@ $(LDLIBS)
|
|
|
|
async_rate_matrix_test: async_rate_matrix_test.c $(ESKF_SOURCES)
|
|
$(CC) $(CFLAGS) $^ -o $@ $(LDLIBS)
|
|
|
|
gps_reacquisition_test: gps_reacquisition_test.c $(ESKF_SOURCES)
|
|
$(CC) $(CFLAGS) $^ -o $@ $(LDLIBS)
|
|
|
|
platform_scenario_matrix_test: platform_scenario_matrix_test.c $(ESKF_SOURCES)
|
|
$(CC) $(CFLAGS) $^ -o $@ $(LDLIBS)
|
|
|
|
gps_failure_scenario_test: gps_failure_scenario_test.c $(ESKF_SOURCES)
|
|
$(CC) $(CFLAGS) $^ -o $@ $(LDLIBS)
|
|
|
|
calibration_offset_test: calibration_offset_test.c $(ESKF_SOURCES) $(IMU_PROFILE_SOURCE)
|
|
$(CC) $(CFLAGS) $^ -o $@ $(LDLIBS)
|
|
|
|
long_outage_trajectory_test: long_outage_trajectory_test.c $(ESKF_SOURCES) $(IMU_PROFILE_SOURCE)
|
|
$(CC) $(CFLAGS) $^ -o $@ $(LDLIBS)
|
|
|
|
test: standalone_gps_integrity_test eskf_motion_test fusion_rest_detector_test fusion_synthetic_test imu_quality_synthetic_test async_tilt_recovery_test async_rate_matrix_test gps_reacquisition_test platform_scenario_matrix_test gps_failure_scenario_test calibration_offset_test long_outage_trajectory_test
|
|
./standalone_gps_integrity_test
|
|
./eskf_motion_test
|
|
./fusion_rest_detector_test
|
|
./fusion_synthetic_test
|
|
./imu_quality_synthetic_test
|
|
./async_tilt_recovery_test
|
|
./async_rate_matrix_test
|
|
./gps_reacquisition_test
|
|
./platform_scenario_matrix_test
|
|
./gps_failure_scenario_test
|
|
./calibration_offset_test
|
|
./long_outage_trajectory_test
|
|
|
|
gps-system-test: standalone_gps_integrity_test
|
|
./standalone_gps_integrity_test
|
|
|
|
scenario-logs: platform_scenario_matrix_test
|
|
mkdir -p output/scenarios
|
|
@for scenario in stationary pedestrian car aircraft; do \
|
|
for gps in 200 500 1000; do \
|
|
for imu in 19 20 200 300; do \
|
|
./platform_scenario_matrix_test --log $$scenario $$gps $$imu \
|
|
output/scenarios/$${scenario}_gps$${gps}_imu$${imu}.log >/dev/null || exit $$?; \
|
|
done; \
|
|
done; \
|
|
done
|
|
@echo "Wrote 48 replay logs under output/scenarios/"
|
|
|
|
sanitize:
|
|
$(CC) -std=c11 -O1 -g -Wall -Wextra -Wpedantic -Werror \
|
|
-fsanitize=address,undefined -fno-omit-frame-pointer \
|
|
-I../../gps_system/header standalone_gps_integrity_test.c \
|
|
$(GPS_TIME_SOURCE) $(GPS_EPOCH_SOURCE) \
|
|
-o standalone_gps_integrity_test_san $(LDLIBS)
|
|
ASAN_OPTIONS=detect_leaks=1:halt_on_error=1 \
|
|
UBSAN_OPTIONS=halt_on_error=1 ./standalone_gps_integrity_test_san
|
|
$(CC) -std=c11 -O1 -g -Wall -Wextra -Wpedantic -Werror \
|
|
-fsanitize=address,undefined -fno-omit-frame-pointer \
|
|
-I../../gps_system/header fusion_rest_detector_test.c \
|
|
../../gps_system/src/fusion/fusion_rest_detector.c \
|
|
-o fusion_rest_detector_test_san $(LDLIBS)
|
|
ASAN_OPTIONS=detect_leaks=1:halt_on_error=1 \
|
|
UBSAN_OPTIONS=halt_on_error=1 ./fusion_rest_detector_test_san
|
|
$(CC) -std=c11 -O1 -g -Wall -Wextra -Wpedantic -Werror \
|
|
-fsanitize=address,undefined -fno-omit-frame-pointer \
|
|
-I../../gps_system/header eskf_motion_test.c $(ESKF_SOURCES) \
|
|
-o eskf_motion_test_san $(LDLIBS)
|
|
ASAN_OPTIONS=detect_leaks=1:halt_on_error=1 \
|
|
UBSAN_OPTIONS=halt_on_error=1 ./eskf_motion_test_san
|
|
$(CC) -std=c11 -O1 -g -Wall -Wextra -Wpedantic -Werror \
|
|
-fsanitize=address,undefined -fno-omit-frame-pointer \
|
|
-I../../gps_system/header fusion_synthetic_test.c $(ESKF_SOURCES) \
|
|
-o fusion_synthetic_test_san $(LDLIBS)
|
|
ASAN_OPTIONS=detect_leaks=1:halt_on_error=1 \
|
|
UBSAN_OPTIONS=halt_on_error=1 ./fusion_synthetic_test_san
|
|
$(CC) -std=c11 -O1 -g -Wall -Wextra -Wpedantic -Werror \
|
|
-fsanitize=address,undefined -fno-omit-frame-pointer \
|
|
-I../../gps_system/header imu_quality_synthetic_test.c $(ESKF_SOURCES) \
|
|
$(IMU_PROFILE_SOURCE) -o imu_quality_synthetic_test_san $(LDLIBS)
|
|
ASAN_OPTIONS=detect_leaks=1:halt_on_error=1 \
|
|
UBSAN_OPTIONS=halt_on_error=1 ./imu_quality_synthetic_test_san
|
|
$(CC) -std=c11 -O1 -g -Wall -Wextra -Wpedantic -Werror \
|
|
-fsanitize=address,undefined -fno-omit-frame-pointer \
|
|
-I../../gps_system/header async_tilt_recovery_test.c $(ESKF_SOURCES) \
|
|
-o async_tilt_recovery_test_san $(LDLIBS)
|
|
ASAN_OPTIONS=detect_leaks=1:halt_on_error=1 \
|
|
UBSAN_OPTIONS=halt_on_error=1 ./async_tilt_recovery_test_san
|
|
$(CC) -std=c11 -O1 -g -Wall -Wextra -Wpedantic -Werror \
|
|
-fsanitize=address,undefined -fno-omit-frame-pointer \
|
|
-I../../gps_system/header async_rate_matrix_test.c $(ESKF_SOURCES) \
|
|
-o async_rate_matrix_test_san $(LDLIBS)
|
|
ASAN_OPTIONS=detect_leaks=1:halt_on_error=1 \
|
|
UBSAN_OPTIONS=halt_on_error=1 ./async_rate_matrix_test_san
|
|
$(CC) -std=c11 -O1 -g -Wall -Wextra -Wpedantic -Werror \
|
|
-fsanitize=address,undefined -fno-omit-frame-pointer \
|
|
-I../../gps_system/header gps_reacquisition_test.c $(ESKF_SOURCES) \
|
|
-o gps_reacquisition_test_san $(LDLIBS)
|
|
ASAN_OPTIONS=detect_leaks=1:halt_on_error=1 \
|
|
UBSAN_OPTIONS=halt_on_error=1 ./gps_reacquisition_test_san
|
|
$(CC) -std=c11 -O1 -g -Wall -Wextra -Wpedantic -Werror \
|
|
-fsanitize=address,undefined -fno-omit-frame-pointer \
|
|
-I../../gps_system/header platform_scenario_matrix_test.c $(ESKF_SOURCES) \
|
|
-o platform_scenario_matrix_test_san $(LDLIBS)
|
|
ASAN_OPTIONS=detect_leaks=1:halt_on_error=1 \
|
|
UBSAN_OPTIONS=halt_on_error=1 ./platform_scenario_matrix_test_san
|
|
$(CC) -std=c11 -O1 -g -Wall -Wextra -Wpedantic -Werror \
|
|
-fsanitize=address,undefined -fno-omit-frame-pointer \
|
|
-I../../gps_system/header gps_failure_scenario_test.c $(ESKF_SOURCES) \
|
|
-o gps_failure_scenario_test_san $(LDLIBS)
|
|
ASAN_OPTIONS=detect_leaks=1:halt_on_error=1 \
|
|
UBSAN_OPTIONS=halt_on_error=1 ./gps_failure_scenario_test_san
|
|
|
|
profile:
|
|
$(CC) -std=c11 -O2 -g -pg -Wall -Wextra -Wpedantic \
|
|
-I../../gps_system/header fusion_synthetic_test.c $(ESKF_SOURCES) \
|
|
-o fusion_synthetic_test_gprof $(LDLIBS)
|
|
./fusion_synthetic_test_gprof
|
|
gprof ./fusion_synthetic_test_gprof gmon.out
|
|
|
|
benchmark: standalone_gps_integrity_test
|
|
./standalone_gps_integrity_test --bench-clean 100000
|
|
./standalone_gps_integrity_test --bench-single 100000
|
|
./standalone_gps_integrity_test --bench-double 100000
|
|
|
|
clean:
|
|
rm -f standalone_gps_integrity_test standalone_gps_integrity_test_san standalone_gps_integrity_test_gprof eskf_motion_test eskf_motion_test_san fusion_rest_detector_test fusion_rest_detector_test_san fusion_synthetic_test fusion_synthetic_test_san fusion_synthetic_test_gprof fusion_synthetic_trace imu_quality_synthetic_test imu_quality_synthetic_test_san async_tilt_recovery_test async_tilt_recovery_test_san async_rate_matrix_test async_rate_matrix_test_san gps_reacquisition_test gps_reacquisition_test_san platform_scenario_matrix_test platform_scenario_matrix_test_san gps_failure_scenario_test gps_failure_scenario_test_san calibration_offset_test calibration_offset_test_san long_outage_trajectory_test long_outage_trajectory_test_san gmon.out
|