diff --git a/src/modules/ekf2/CMakeLists.txt b/src/modules/ekf2/CMakeLists.txt index d24a654f32..f65a5f1e28 100644 --- a/src/modules/ekf2/CMakeLists.txt +++ b/src/modules/ekf2/CMakeLists.txt @@ -116,7 +116,6 @@ endif() set(EKF_LIBS) set(EKF_SRCS) list(APPEND EKF_SRCS - EKF/bias_estimator.cpp EKF/control.cpp EKF/covariance.cpp EKF/ekf.cpp @@ -259,6 +258,7 @@ px4_add_module( world_magnetic_model ${EKF_LIBS} + bias_estimator output_predictor UNITY_BUILD ) diff --git a/src/modules/ekf2/EKF/CMakeLists.txt b/src/modules/ekf2/EKF/CMakeLists.txt index a98eaedcae..1680967dfc 100644 --- a/src/modules/ekf2/EKF/CMakeLists.txt +++ b/src/modules/ekf2/EKF/CMakeLists.txt @@ -31,12 +31,12 @@ # ############################################################################ +add_subdirectory(bias_estimator) add_subdirectory(output_predictor) set(EKF_LIBS) set(EKF_SRCS) list(APPEND EKF_SRCS - bias_estimator.cpp control.cpp covariance.cpp ekf.cpp @@ -147,6 +147,7 @@ target_include_directories(ecl_EKF PUBLIC ${EKF_GENERATED_DERIVATION_INCLUDE_PAT target_link_libraries(ecl_EKF PRIVATE + bias_estimator geo output_predictor world_magnetic_model diff --git a/src/modules/ekf2/EKF/bias_estimator/CMakeLists.txt b/src/modules/ekf2/EKF/bias_estimator/CMakeLists.txt new file mode 100644 index 0000000000..b2346919e1 --- /dev/null +++ b/src/modules/ekf2/EKF/bias_estimator/CMakeLists.txt @@ -0,0 +1,41 @@ +############################################################################ +# +# Copyright (c) 2024 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +add_library(bias_estimator + bias_estimator.cpp + bias_estimator.hpp + height_bias_estimator.hpp + position_bias_estimator.hpp +) + +add_dependencies(bias_estimator prebuild_targets) diff --git a/src/modules/ekf2/EKF/bias_estimator.cpp b/src/modules/ekf2/EKF/bias_estimator/bias_estimator.cpp similarity index 100% rename from src/modules/ekf2/EKF/bias_estimator.cpp rename to src/modules/ekf2/EKF/bias_estimator/bias_estimator.cpp diff --git a/src/modules/ekf2/EKF/bias_estimator.hpp b/src/modules/ekf2/EKF/bias_estimator/bias_estimator.hpp similarity index 100% rename from src/modules/ekf2/EKF/bias_estimator.hpp rename to src/modules/ekf2/EKF/bias_estimator/bias_estimator.hpp diff --git a/src/modules/ekf2/EKF/height_bias_estimator.hpp b/src/modules/ekf2/EKF/bias_estimator/height_bias_estimator.hpp similarity index 99% rename from src/modules/ekf2/EKF/height_bias_estimator.hpp rename to src/modules/ekf2/EKF/bias_estimator/height_bias_estimator.hpp index 5cb03cbfdd..9fe1ee7dac 100644 --- a/src/modules/ekf2/EKF/height_bias_estimator.hpp +++ b/src/modules/ekf2/EKF/bias_estimator/height_bias_estimator.hpp @@ -39,7 +39,7 @@ #define EKF_HEIGHT_BIAS_ESTIMATOR_HPP #include "bias_estimator.hpp" -#include "common.h" +#include "../common.h" class HeightBiasEstimator: public BiasEstimator { diff --git a/src/modules/ekf2/EKF/position_bias_estimator.hpp b/src/modules/ekf2/EKF/bias_estimator/position_bias_estimator.hpp similarity index 99% rename from src/modules/ekf2/EKF/position_bias_estimator.hpp rename to src/modules/ekf2/EKF/bias_estimator/position_bias_estimator.hpp index 0cba8fcd99..629bb538a1 100644 --- a/src/modules/ekf2/EKF/position_bias_estimator.hpp +++ b/src/modules/ekf2/EKF/bias_estimator/position_bias_estimator.hpp @@ -39,7 +39,6 @@ #define EKF_POSITION_BIAS_ESTIMATOR_HPP #include "bias_estimator.hpp" -#include "common.h" class PositionBiasEstimator { diff --git a/src/modules/ekf2/EKF/ekf.h b/src/modules/ekf2/EKF/ekf.h index 1afdd559a4..3aca5c93c7 100644 --- a/src/modules/ekf2/EKF/ekf.h +++ b/src/modules/ekf2/EKF/ekf.h @@ -49,9 +49,9 @@ # include "yaw_estimator/EKFGSF_yaw.h" #endif // CONFIG_EKF2_GNSS -#include "bias_estimator.hpp" -#include "height_bias_estimator.hpp" -#include "position_bias_estimator.hpp" +#include "bias_estimator/bias_estimator.hpp" +#include "bias_estimator/height_bias_estimator.hpp" +#include "bias_estimator/position_bias_estimator.hpp" #include