From 3dc50d4e6889191f7ee0ad85514d47b83c817f4b Mon Sep 17 00:00:00 2001 From: FrancoisCarouge Date: Tue, 24 Dec 2024 21:18:41 -0800 Subject: [PATCH] [units] add mp-units library --- .github/workflows/cppcheck.yml | 1 + support/CMakeLists.txt | 1 + support/mp_units/CMakeLists.txt | 71 ++++++++++++++++++++++++++++++ support/mp_units/fcarouge/unit.hpp | 55 +++++++++++++++++++++++ 4 files changed, 128 insertions(+) create mode 100644 support/mp_units/CMakeLists.txt create mode 100644 support/mp_units/fcarouge/unit.hpp diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml index 63e954b03..8ac6873ed 100644 --- a/.github/workflows/cppcheck.yml +++ b/.github/workflows/cppcheck.yml @@ -47,5 +47,6 @@ jobs: -I support/eigen \ -I support/generator \ -I support/lazy \ + -I support/mp_units \ -I support/naive \ . diff --git a/support/CMakeLists.txt b/support/CMakeLists.txt index 853defe01..7b270c7ec 100644 --- a/support/CMakeLists.txt +++ b/support/CMakeLists.txt @@ -38,6 +38,7 @@ For more information, please refer to ]] add_subdirectory("eigen") add_subdirectory("main") +add_subdirectory("mp_units") add_subdirectory("naive") add_library(kalman_options INTERFACE) diff --git a/support/mp_units/CMakeLists.txt b/support/mp_units/CMakeLists.txt new file mode 100644 index 000000000..6ea86cbda --- /dev/null +++ b/support/mp_units/CMakeLists.txt @@ -0,0 +1,71 @@ +#[[ __ _ __ __ _ _ +| |/ / /\ | | | \/ | /\ | \ | | +| ' / / \ | | | \ / | / \ | \| | +| < / /\ \ | | | |\/| | / /\ \ | . ` | +| . \ / ____ \| |____| | | |/ ____ \| |\ | +|_|\_\/_/ \_\______|_| |_/_/ \_\_| \_| + +Kalman Filter +Version 0.4.0 +https://github.com/FrancoisCarouge/Kalman + +SPDX-License-Identifier: Unlicense + +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to ]] + +include(FetchContent) + +FetchContent_Declare( + fmt + GIT_REPOSITORY "https://github.com/fmtlib/fmt" + GIT_SHALLOW TRUE + FIND_PACKAGE_ARGS NAMES fmt) +FetchContent_MakeAvailable(fmt) + +FetchContent_Declare( + gsl-lite + GIT_REPOSITORY "https://github.com/gsl-lite/gsl-lite" + GIT_SHALLOW TRUE + FIND_PACKAGE_ARGS NAMES gsl-lite) +FetchContent_MakeAvailable(gsl-lite) + +FetchContent_Declare( + mp-units + GIT_REPOSITORY "https://github.com/mpusz/mp-units" + GIT_SHALLOW TRUE + SOURCE_SUBDIR "src" FIND_PACKAGE_ARGS NAMES mp-units) +FetchContent_MakeAvailable(mp-units) + +target_compile_options(mp-units INTERFACE $, , + -Wno-double-promotion>) +target_compile_options(mp-units INTERFACE $, , + -Wno-undef>) + +add_library(kalman_unit_mp_units INTERFACE) +target_sources( + kalman_unit_mp_units INTERFACE FILE_SET "unit_headers" TYPE "HEADERS" FILES + "fcarouge/unit.hpp") +target_link_libraries(kalman_unit_mp_units INTERFACE mp-units::mp-units) diff --git a/support/mp_units/fcarouge/unit.hpp b/support/mp_units/fcarouge/unit.hpp new file mode 100644 index 000000000..080f1bcf3 --- /dev/null +++ b/support/mp_units/fcarouge/unit.hpp @@ -0,0 +1,55 @@ +/* __ _ __ __ _ _ +| |/ / /\ | | | \/ | /\ | \ | | +| ' / / \ | | | \ / | / \ | \| | +| < / /\ \ | | | |\/| | / /\ \ | . ` | +| . \ / ____ \| |____| | | |/ ____ \| |\ | +|_|\_\/_/ \_\______|_| |_/_/ \_\_| \_| + +Kalman Filter +Version 0.4.0 +https://github.com/FrancoisCarouge/Kalman + +SPDX-License-Identifier: Unlicense + +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to */ + +#ifndef FCAROUGE_UNIT_HPP +#define FCAROUGE_UNIT_HPP + +//! @file +//! @brief Quantities and units facade for mp-units third party implementation. +//! +//! @details Supporting quantities, values, and functions. + +#include + +namespace fcarouge { +//! @brief The physical unit quantity. +template +using quantity = mp_units::quantity; +} // namespace fcarouge + +#endif // FCAROUGE_UNIT_HPP