From 38f90e2fea7a3ca6e5afa49dd79f668769564d85 Mon Sep 17 00:00:00 2001 From: "k.koide" Date: Thu, 25 Jul 2024 13:19:03 +0900 Subject: [PATCH 1/6] comply ROS2 --- CMakeLists.txt | 31 ++++++++++++++++++++++++------- include/glim/util/config_impl.hpp | 12 +++++++----- package.xml | 2 +- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e35a851..0f8426ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,7 +86,7 @@ add_library(glim SHARED target_include_directories(glim PUBLIC $ $ - $ + $ ${OpenCV_INCLUDE_DIRS} ) target_link_libraries(glim @@ -166,7 +166,27 @@ endif() ## Install ## ############# -include(GNUInstallDirs) +if($ENV{ROS_VERSION} EQUAL 1) + # No idea + set(CMAKE_INSTALL_INCLUDEDIR "include/glim") + set(CMAKE_INSTALL_BINDIR "bin/glim") + set(CMAKE_INSTALL_LIBDIR "lib/glim") + set(CMAKE_INSTALL_DATADIR "share/glim") + set(CMAKE_CONFIG_INSTALL_DIR "share/glim") +elseif($ENV{ROS_VERSION} EQUAL 2) + set(CMAKE_INSTALL_INCLUDEDIR "include/glim") + set(CMAKE_INSTALL_BINDIR "bin/glim") + set(CMAKE_INSTALL_LIBDIR "lib/glim") + set(CMAKE_INSTALL_DATADIR "share/glim") + set(CMAKE_CONFIG_INSTALL_DIR "share/glim") +else() + include(GNUInstallDirs) + set(CMAKE_CONFIG_INSTALL_DIR + "${CMAKE_INSTALL_LIBDIR}/cmake/glim" + CACHE PATH "Install directory for CMake config files" + ) +endif() + install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(TARGETS ${glim_LIBRARIES} EXPORT glim-targets @@ -174,10 +194,6 @@ install(TARGETS ${glim_LIBRARIES} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) -set(CMAKE_CONFIG_INSTALL_DIR - "${CMAKE_INSTALL_LIBDIR}/cmake/glim" - CACHE PATH "Install directory for CMake config files" -) include(CMakePackageConfigHelpers) install(EXPORT glim-targets FILE glim-targets.cmake @@ -210,7 +226,8 @@ if(DEFINED ENV{ROS_VERSION}) install(DIRECTORY config DESTINATION share/glim) ament_export_include_directories(include ${EIGEN3_INCLUDE_DIR} ${OpenCV_INCLUDE_DIRS}) ament_export_libraries(${glim_LIBRARIES} ${GTSAM_LIBRARIES} fmt spdlog::spdlog) - ament_package() + ament_export_interfaces(glim-targets HAS_LIBRARY_TARGET) + ament_package(CONFIG_EXTRAS "cmake/glim-config.cmake.in") elseif($ENV{ROS_VERSION} EQUAL 1) # ROS1 find_package(catkin REQUIRED) diff --git a/include/glim/util/config_impl.hpp b/include/glim/util/config_impl.hpp index 41d164c2..c4d6abce 100644 --- a/include/glim/util/config_impl.hpp +++ b/include/glim/util/config_impl.hpp @@ -234,11 +234,13 @@ T Config::param_cast_nested(const std::vector& nested_module_names, return *found; } -#define DEFINE_CONFIG_IO_SPECIALIZATION(TYPE) \ - template TYPE Config::param(const std::string&, const std::string&, const TYPE&) const; \ - template TYPE Config::param_cast(const std::string&, const std::string&) const; \ - template TYPE Config::param_nested(const std::vector&, const std::string&, const TYPE&) const; \ - template TYPE Config::param_cast_nested(const std::vector&, const std::string&) const; \ +#define DEFINE_CONFIG_IO_SPECIALIZATION(TYPE) \ + template std::optional Config::param(const std::string& module_name, const std::string& param_name) const; \ + template TYPE Config::param(const std::string&, const std::string&, const TYPE&) const; \ + template TYPE Config::param_cast(const std::string&, const std::string&) const; \ + template std::optional Config::param_nested(const std::vector& nested_module_names, const std::string& param_name) const; \ + template TYPE Config::param_nested(const std::vector&, const std::string&, const TYPE&) const; \ + template TYPE Config::param_cast_nested(const std::vector&, const std::string&) const; \ template bool Config::override_param(const std::string&, const std::string&, const TYPE&); } // namespace glim diff --git a/package.xml b/package.xml index 7fdfdae4..b8e7274c 100644 --- a/package.xml +++ b/package.xml @@ -2,7 +2,7 @@ glim - 0.0.0 + 1.0.1 3D LiDAR-IMU mapping framework k.koide MIT From 52c879d6570b8315db0ce170a6322fd7eb37dfba Mon Sep 17 00:00:00 2001 From: "k.koide" Date: Thu, 25 Jul 2024 14:10:14 +0900 Subject: [PATCH 2/6] install to lib --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f8426ca..39836112 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -169,14 +169,14 @@ endif() if($ENV{ROS_VERSION} EQUAL 1) # No idea set(CMAKE_INSTALL_INCLUDEDIR "include/glim") + set(CMAKE_INSTALL_LIBDIR "lib") set(CMAKE_INSTALL_BINDIR "bin/glim") - set(CMAKE_INSTALL_LIBDIR "lib/glim") set(CMAKE_INSTALL_DATADIR "share/glim") set(CMAKE_CONFIG_INSTALL_DIR "share/glim") elseif($ENV{ROS_VERSION} EQUAL 2) set(CMAKE_INSTALL_INCLUDEDIR "include/glim") + set(CMAKE_INSTALL_LIBDIR "lib") set(CMAKE_INSTALL_BINDIR "bin/glim") - set(CMAKE_INSTALL_LIBDIR "lib/glim") set(CMAKE_INSTALL_DATADIR "share/glim") set(CMAKE_CONFIG_INSTALL_DIR "share/glim") else() From e711971002832b43f93c9e531eae65c00c41ee25 Mon Sep 17 00:00:00 2001 From: "k.koide" Date: Fri, 26 Jul 2024 14:37:32 +0900 Subject: [PATCH 3/6] ROS1 installation --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 39836112..a28e3351 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -234,6 +234,7 @@ if(DEFINED ENV{ROS_VERSION}) catkin_package( INCLUDE_DIRS include LIBRARIES ${glim_LIBRARIES} ${GTSAM_LIBRARIES} fmt spdlog::spdlog + CFG_EXTRAS "glim-config.cmake" ) endif() endif() \ No newline at end of file From 4c642fb7993ed29a388839b9d6f64ea2bced3c00 Mon Sep 17 00:00:00 2001 From: koide3 <31344317+koide3@users.noreply.github.com> Date: Fri, 26 Jul 2024 15:02:49 +0900 Subject: [PATCH 4/6] pointer to sensor setup guide (#49) --- docs/parameters.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/parameters.md b/docs/parameters.md index 9a326894..99d2be6f 100644 --- a/docs/parameters.md +++ b/docs/parameters.md @@ -1,5 +1,8 @@ # Important parameters +!!! info + See the [sensor setup buide](https://github.com/koide3/glim/wiki/Sensor-setup-guide) for configurations of popular sensors (including Livox MID360 and Azure Kinect). + !!! info See the Configuration files section in [Getting started](quickstart.md) to change the location of configuration files. From 23960540ed0fbd4fd18de7ccf9969d002abe3438 Mon Sep 17 00:00:00 2001 From: koide3 <31344317+koide3@users.noreply.github.com> Date: Fri, 26 Jul 2024 15:03:38 +0900 Subject: [PATCH 5/6] Create LICENSE --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..7e937def --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 koide3 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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 OR COPYRIGHT HOLDERS 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. From 8950d1568b3520bc6da0aac6f82c4fd80a976f2b Mon Sep 17 00:00:00 2001 From: "k.koide" Date: Fri, 26 Jul 2024 16:51:46 +0900 Subject: [PATCH 6/6] install config for ROS1 --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 32183935..a2d70b7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -239,5 +239,6 @@ if(DEFINED ENV{ROS_VERSION}) INCLUDE_DIRS include LIBRARIES ${glim_LIBRARIES} ${GTSAM_LIBRARIES} fmt spdlog::spdlog ) + install(DIRECTORY config DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) endif() endif() \ No newline at end of file