Integrate asynchronous GPS IMU fusion

This commit is contained in:
2026-07-16 23:49:43 +03:00
parent 38a96dd88f
commit 7cc3eb2a54
80 changed files with 3901 additions and 553 deletions
+38 -26
View File
@@ -1,5 +1,12 @@
TARGET := gps_system
# Keep the standalone app build observable on the board. The board and parent
# software Makefiles already pass these values, but a direct `make` in this
# directory previously compiled every GPS_LOG call out and produced a silent
# UART image.
GPS_DEBUG ?= 1
GPS_DEBUG_LEVEL ?= 4
# The current Genesys2 Rocket/fabric domain that clocks the UART is 50 MHz.
# Keep the requested 115200 baud physical rather than producing 57600 baud
# with the common 100 MHz fallback divider.
@@ -9,55 +16,59 @@ BSP_UART_CLOCK_HZ ?= 50000000
# Accepted values: auto, tdk, st (stm is an alias for st).
IMU_SENSOR ?= auto
ifeq ($(IMU_SENSOR),auto)
IMU_DRIVER_SRCS := src/tdk_icm42688.c src/st_lsm6dsox.c
IMU_DRIVER_SRCS := src/drivers/imu/tdk_icm42688.c src/drivers/imu/st_lsm6dsox.c
IMU_BACKEND_CFLAG := -DIMU_SENSOR_BUILD_AUTO=1
else ifeq ($(IMU_SENSOR),tdk)
IMU_DRIVER_SRCS := src/tdk_icm42688.c
IMU_DRIVER_SRCS := src/drivers/imu/tdk_icm42688.c
IMU_BACKEND_CFLAG := -DIMU_SENSOR_BUILD_TDK=1
else ifeq ($(IMU_SENSOR),st)
IMU_DRIVER_SRCS := src/st_lsm6dsox.c
IMU_DRIVER_SRCS := src/drivers/imu/st_lsm6dsox.c
IMU_BACKEND_CFLAG := -DIMU_SENSOR_BUILD_ST=1
else ifeq ($(IMU_SENSOR),stm)
IMU_DRIVER_SRCS := src/st_lsm6dsox.c
IMU_DRIVER_SRCS := src/drivers/imu/st_lsm6dsox.c
IMU_BACKEND_CFLAG := -DIMU_SENSOR_BUILD_ST=1
else
$(error IMU_SENSOR must be auto, tdk, st or stm)
endif
# Zero means use the selected backend's default. The legacy TDK variable is
# accepted so existing build commands remain valid.
# A non-zero value is a sensor-independent target. The common layer accepts
# only a hardware ODR within 5%; thus 200 selects 200 Hz on TDK and the real
# 208 Hz setting on LSM6DSOX. Zero keeps the backend default.
ifdef TDK_IMU_ODR_HZ
IMU_ODR_HZ ?= $(TDK_IMU_ODR_HZ)
else
IMU_ODR_HZ ?= 0
IMU_ODR_HZ ?= 50
endif
IMU_ACCEL_FS_G ?= 0
IMU_GYRO_FS_DPS ?= 0
GPS_ESKF_ENABLE ?= 1
APP_SRCS := \
gps_test.c \
src/imu_calibration.c \
src/imu_sensor.c \
src/imu_sensor_profile.c \
gps_system.c \
src/gps/gps_receiver.c \
src/imu/imu_calibration.c \
src/imu/imu_sensor.c \
src/adapters/imu_fusion_profile.c \
src/adapters/gps_system_uart.c \
$(IMU_DRIVER_SRCS) \
src/eskf.c \
src/fusion_motion.c \
src/fusion_engine.c \
src/fusion_bus.c \
src/fusion_gps_adapter.c \
src/navigation_fusion.c \
src/gps_fusion_publisher.c \
src/gps_ip.c \
src/gps_interrupt_handlers.c \
src/gps_time_anchor.c \
src/gps_pps.c \
src/linked_list.c \
src/NavEquations.c \
src/matrixLib.c
src/fusion/eskf.c \
src/fusion/fusion_motion.c \
src/fusion/fusion_rest_detector.c \
src/fusion/fusion_engine.c \
src/fusion/fusion_gps_adapter.c \
src/fusion/navigation_fusion.c \
src/adapters/gps_fusion_publisher.c \
src/gps/gps_ip.c \
src/gps/gps_interrupt_handlers.c \
src/gps/gps_time_anchor.c \
src/gps/gps_pps.c \
src/gps/linked_list.c \
src/gps/NavEquations.c \
src/gps/matrixLib.c
BSP_SRCS := init.c uart.c plic.c irq.c spi_flash.c pmod_spi.c
GPS_NAV_SOLVE_TIMER_TICKS ?= 50
GPS_NAV_SOLVE_TIMER_TICKS ?= 10
include ../common/app.mk
@@ -66,6 +77,7 @@ CFLAGS += $(IMU_BACKEND_CFLAG) \
-DIMU_ODR_HZ=$(IMU_ODR_HZ) \
-DIMU_ACCEL_FS_G=$(IMU_ACCEL_FS_G) \
-DIMU_GYRO_FS_DPS=$(IMU_GYRO_FS_DPS) \
-DGPS_ESKF_ENABLE=$(GPS_ESKF_ENABLE) \
-DGPS_NAV_SOLVE_TIMER_TICKS=$(GPS_NAV_SOLVE_TIMER_TICKS)
LDLIBS += -lm