Skip to content

Commit

Permalink
Refactor project structure to facilitate ROS development
Browse files Browse the repository at this point in the history
  • Loading branch information
nachovizzo committed Jan 13, 2023
1 parent 743fa5a commit a31f539
Show file tree
Hide file tree
Showing 68 changed files with 70 additions and 78 deletions.
18 changes: 4 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,18 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.16...3.24)
project(kiss_icp VERSION 0.0.13 LANGUAGES CXX)
project(kiss_icp VERSION 0.0.14 LANGUAGES CXX)

# Setup build options
option(USE_SYSTEM_EIGEN3 "Use system pre-installed eigen3" ON)
# Set build options
option(USE_SYSTEM_PYBIND11 "Use system pre-installed pybind11" ON)
option(USE_SYSTEM_TBB "Use system pre-installed oneAPI/tbb" ON)
option(BUILD_PYTHON_BINDINGS "Build the python module" OFF)
mark_as_advanced(BUILD_PYTHON_BINDINGS)

# Set build type
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 17)

# Find Dependencies from the 3rdparty directory.
include(3rdparty/find_dependencies.cmake)
include(3rdparty/skbuild.cmake)

add_subdirectory(src/kiss_icp/cpp)
add_subdirectory(src/cpp)
if(BUILD_PYTHON_BINDINGS)
add_subdirectory(src/kiss_icp/pybind)
add_subdirectory(src/pybind)
endif()
10 changes: 5 additions & 5 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
recursive-include src/kiss_icp *.py
recursive-include src/kiss_icp *.yaml
recursive-include src/kiss_icp *.cpp
recursive-include src/kiss_icp *.hpp
recursive-include src/kiss_icp *.h
recursive-include src *.py
recursive-include src *.yaml
recursive-include src *.cpp
recursive-include src *.hpp
recursive-include src *.h
global-include CMakeLists.txt
global-include LICENSE
global-include *.cmake
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,8 @@ If you use this library for any academic work, please cite our original [paper](
codeurl = {https://github.com/PRBonn/kiss-icp},
}
```

## Star History

[![Star History Chart](https://api.star-history.com/svg?repos=PRBonn/kiss-icp&type=Date)](https://star-history.com/#PRBonn/kiss-icp&Date)

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = kiss_icp
version = 0.0.13
version = 0.0.14
author = Ignacio Vizzo
author_email = [email protected]
description = Simple yet effective 3D LiDAR-Odometry registration pipeline
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def cmd_exists(cmd):

with skbuild_isolated_context():
setup(
packages=["kiss_icp"] if sys.argv[1] == "develop" else find_packages("src"),
package_dir={"": "src"},
cmake_install_dir="src/kiss_icp/pybind/",
packages=["kiss_icp"] if sys.argv[1] == "develop" else find_packages("src/python"),
package_dir={"": "src/python"},
cmake_install_dir="src/python/kiss_icp/pybind/",
cmake_args=["-DBUILD_PYTHON_BINDINGS:BOOL=ON"],
entry_points={"console_scripts": ["kiss_icp_pipeline=kiss_icp.tools.cmd:run"]},
include_package_data=False,
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ if(CMAKE_VERSION VERSION_GREATER 3.24)
cmake_policy(SET CMP0135 OLD)
endif()

# tsl_robin is fast to fetch, don't ask for system-wise installation
include(${CMAKE_CURRENT_LIST_DIR}/tsl_robin/tsl_robin.cmake)

if(USE_SYSTEM_EIGEN3)
find_package(Eigen3 QUIET NO_MODULE)
endif()
Expand All @@ -40,19 +43,6 @@ if(NOT USE_SYSTEM_EIGEN3 OR NOT EIGEN3_FOUND)
include(${CMAKE_CURRENT_LIST_DIR}/eigen/eigen.cmake)
endif()

if(BUILD_PYTHON_BINDINGS)
if(USE_SYSTEM_PYBIND11)
find_package(pybind11 QUIET)
endif()
if(NOT USE_SYSTEM_PYBIND11 OR NOT pybind11_FOUND)
set(USE_SYSTEM_PYBIND11 OFF)
include(${CMAKE_CURRENT_LIST_DIR}/pybind11/pybind11.cmake)
endif()
endif()

# tsl_robin is fast to fetch, don't ask for system-wise installation
include(${CMAKE_CURRENT_LIST_DIR}/tsl_robin/tsl_robin.cmake)

# tbb needs to be statically linked, so, also do it always :)
if(USE_SYSTEM_TBB)
find_package(TBB QUIET NO_MODULE)
Expand All @@ -61,3 +51,4 @@ if(NOT USE_SYSTEM_TBB OR NOT TBB_FOUND)
set(USE_SYSTEM_TBB OFF)
include(${CMAKE_CURRENT_LIST_DIR}/tbb/tbb.cmake)
endif()

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions src/kiss_icp/cpp/CMakeLists.txt → src/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,18 @@
# 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.
cmake_minimum_required(VERSION 3.16...3.24)
project(kiss_icp VERSION 0.0.14 LANGUAGES CXX)

# Setup build options
option(USE_SYSTEM_EIGEN3 "Use system pre-installed eigen3" ON)
option(USE_SYSTEM_TBB "Use system pre-installed oneAPI/tbb" ON)

# Set build type (repeat here for C++ only consumers)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

include(3rdparty/find_dependencies.cmake)
add_subdirectory(kiss_icp)
add_subdirectory(metrics)
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
# 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.
pybind11_add_module(kiss_icp_pybind MODULE kiss_icp_pybind.cpp)
target_link_libraries(kiss_icp_pybind PRIVATE kiss_icp metrics)
install(TARGETS kiss_icp_pybind DESTINATION .)
add_library(kiss_icp STATIC)
add_library(kiss_icp::kiss_icp ALIAS kiss_icp)
target_sources(kiss_icp PRIVATE Registration.cpp Deskew.cpp VoxelHashMap.cpp Preprocessing.cpp)
target_compile_features(kiss_icp PRIVATE cxx_std_17)
target_compile_options(kiss_icp PRIVATE -Wall -Wextra)
target_include_directories(
kiss_icp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
target_link_libraries(kiss_icp PUBLIC Eigen3::Eigen tsl::robin_map TBB::tbb)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

#include <Eigen/Core>
#include <algorithm>
#include <iostream>
#include <limits>
#include <vector>

Expand All @@ -37,11 +36,11 @@ std::vector<Eigen::Vector3d> VoxelDownsample(const std::vector<Eigen::Vector3d>
for (const auto &point : frame) {
const auto voxel = Voxel(point, voxel_size);
if (grid.contains(voxel)) continue;
grid[voxel] = point;
grid.insert({voxel, point});
}
std::vector<Eigen::Vector3d> frame_dowsampled;
frame_dowsampled.reserve(frame.size());
for (const auto &[voxel, point] : grid) {
frame_dowsampled.reserve(grid.size());
for (const auto &[_, point] : grid) {
frame_dowsampled.emplace_back(point);
}
return frame_dowsampled;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ struct VoxelBlock {
points.emplace_back(point);
}

[[nodiscard]] inline bool IsFull() const { return num_points_ == points.size(); }
[[nodiscard]] inline size_t size() const { return points.size(); }
inline bool IsFull() const { return static_cast<size_t>(num_points_) == points.size(); }
inline size_t size() const { return points.size(); }

std::vector<Eigen::Vector3d> points;
int num_points_{};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
# 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.
add_library(kiss_icp Registration.cpp Deskew.cpp VoxelHashMap.cpp Preprocessing.cpp)
add_library(metrics STATIC)
add_library(kiss_icp::metrics ALIAS metrics)
target_sources(metrics PRIVATE Metrics.cpp)
target_include_directories(
kiss_icp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>)
target_link_libraries(kiss_icp Eigen3::Eigen tsl::robin_map TBB::tbb)
target_compile_features(kiss_icp PRIVATE cxx_std_17)
metrics PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
target_link_libraries(metrics PUBLIC Eigen3::Eigen)
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// 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.
#include "metrics.hpp"
#include "Metrics.hpp"

#include <Eigen/Core>
#include <tuple>
Expand Down
File renamed without changes.
24 changes: 0 additions & 24 deletions src/kiss_icp/cpp/metrics/CMakeLists.txt

This file was deleted.

12 changes: 12 additions & 0 deletions 3rdparty/skbuild.cmake → src/pybind/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,15 @@ if(${SKBUILD})
set(ignore ${Python_FIND_REGISTRY})
set(ignore ${Python_ROOT_DIR})
endif()

if(USE_SYSTEM_PYBIND11)
find_package(pybind11 QUIET)
endif()
if(NOT USE_SYSTEM_PYBIND11 OR NOT pybind11_FOUND)
set(USE_SYSTEM_PYBIND11 OFF)
include(${CMAKE_CURRENT_LIST_DIR}/pybind11/pybind11.cmake)
endif()

pybind11_add_module(kiss_icp_pybind MODULE kiss_icp_pybind.cpp)
target_link_libraries(kiss_icp_pybind PRIVATE kiss_icp::kiss_icp kiss_icp::metrics)
install(TARGETS kiss_icp_pybind DESTINATION .)
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "kiss_icp/Map.hpp"
#include "kiss_icp/Preprocessing.hpp"
#include "kiss_icp/VoxelHashMap.hpp"
#include "metrics/metrics.hpp"
#include "metrics/Metrics.hpp"
#include "stl_vector_eigen.h"

namespace py = pybind11;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
# 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.
__version__ = "0.0.13"
__version__ = "0.0.14"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ def _initialize_visualizer(self):
"\t[SPACE] to pause/start\n"
"\t [ESC] to exit\n"
"\t [N] to step\n"
"\t [R] to toggle on/off the raw frame\n"
"\t [F] to toggle on/off the input cloud to the pipeline\n"
"\t [K] to toggle on/off the subsbampled frame\n"
"\t [M] to toggle on/off the local map\n"
Expand Down
File renamed without changes.

0 comments on commit a31f539

Please sign in to comment.