Skip to content

Commit

Permalink
setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
koide3 committed Apr 1, 2024
1 parent cf5de1e commit 40e36dd
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 26 deletions.
25 changes: 14 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,18 @@ endif()
find_package(Python COMPONENTS Interpreter Development)
find_package(pybind11 CONFIG)

# Python binding
pybind11_add_module(small_gicp src/python/python.cpp)
target_include_directories(small_gicp PUBLIC
include
${EIGEN3_INCLUDE_DIR}
)
target_link_libraries(small_gicp PRIVATE
small_gicp_helper
OpenMP::OpenMP_CXX
)
# Python bindings
if(BUILD_PYTHON_BINDINGS)
pybind11_add_module(small_gicp src/python/python.cpp)
target_include_directories(small_gicp PUBLIC
include
${EIGEN3_INCLUDE_DIR}
)
target_link_libraries(small_gicp PRIVATE
small_gicp_helper
OpenMP::OpenMP_CXX
)
endif()

###############
## Benchmark ##
Expand All @@ -108,7 +110,8 @@ if(BUILD_BENCHMARKS)
add_compile_definitions(BUILD_WITH_IRIDESCENCE)
endif()
if (BUILD_WITH_FAST_GICP)
set(FAST_GICP_INCLUDE_DIR /home/koide/workspace/fast_gicp/include)
# set(FAST_GICP_INCLUDE_DIR /home/koide/workspace/fast_gicp/include)
set(FAST_GICP_INCLUDE_DIR $ENV{FAST_GICP_INCLUDE_DIR})
add_compile_definitions(BUILD_WITH_FAST_GICP)
endif()

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# small_gicp (fast_gicp2)

**small_gicp** is a header-only C++ library that provides efficient and parallelized fine point cloud registration algorithms (ICP, Point-to-Plane ICP, GICP, VGICP, etc.). It is a refined and optimized version of its predecessor, [fast_gicp](https://github.com/SMRT-AIST/fast_gicp), with the following features.
**small_gicp** is a header-only C++ library that offers efficient and parallelized algorithms for fine point cloud registration (ICP, Point-to-Plane ICP, GICP, VGICP, etc.). It is a refined and optimized version of its predecessor, [fast_gicp](https://github.com/SMRT-AIST/fast_gicp), re-written from scratch with the following features.

- **Highly Optimized** : The implementation of the core registration algorithm is further optimized from that in fast_gicp. It offers up to 2x speed up compared to fast_gicp.
- **All parallerized** : small_gicp offers parallelized implementations of several algorithms in the point cloud registration process (Downsampling, KdTree construction, Normal/covariance estimation). As a parallelism backend, either (or both) of [OpenMP](https://www.openmp.org/) and [Intel TBB](https://github.com/oneapi-src/oneTBB) can be used.
- **Minimum dependency** : Only [Eigen](https://eigen.tuxfamily.org/) (and bundled [nanoflann](https://github.com/jlblancoc/nanoflann) and [Sophus](https://github.com/strasdat/Sophus)) are required at a minimum. Optionally, it provides the [PCL](https://pointclouds.org/) registration interface so that it can be used as a drop-in replacement in many systems.
- **Customizable** : small_gicp is implemented with the trait mechanism that allows feeding any custom point cloud class to the registration algorithm. Furthermore, the template-based implementation allows customizing the regisration process with your original correspondence estimator and registration factors.
- **Python bindinds** (coming soon) : The isolation from PCL makes the small_gicp's python bindinds more portable and connectable to other libraries seamlessly.
- **Highly Optimized** : The implementation of the core registration algorithm is further optimized from that in fast_gicp. It enables up to 2x speed gain compared to fast_gicp.
- **All parallerized** : small_gicp offers parallelized implementations of several preprocessing algorithms to make the entire registration process parallelized (Downsampling, KdTree construction, Normal/covariance estimation). As a parallelism backend, either (or both) of [OpenMP](https://www.openmp.org/) and [Intel TBB](https://github.com/oneapi-src/oneTBB) can be used.
- **Minimum dependency** : Only [Eigen](https://eigen.tuxfamily.org/) (and bundled [nanoflann](https://github.com/jlblancoc/nanoflann) and [Sophus](https://github.com/strasdat/Sophus)) are required at a minimum. Optionally, it provides the [PCL](https://pointclouds.org/) registration interface so that it can be used as a drop-in replacement for registration algorithms in PCL.
- **Customizable** : small_gicp is implemented with the trait mechanism that enables feeding any custom point cloud class to the registration algorithm. Furthermore, the template-based implementation allows customizing the regisration process with your original correspondence estimator and registration factors.
- **Python bindinds** : The isolation from PCL makes small_gicp's python bindinds more portable and connectable to other libraries seamlessly.

Note that GPU-based implementations are NOT included in this package.

Expand Down
8 changes: 7 additions & 1 deletion docker/Dockerfile.gcc
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install --no-install-recommends -y \
&& apt-get install --no-install-recommends -y \
wget nano build-essential git cmake \
wget nano build-essential git cmake python3-pip pybind11-dev \
libeigen3-dev libfmt-dev libtbb-dev libomp-dev libpcl-dev libgtest-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN pip install -U setuptools pytest numpy scipy

COPY . /root/small_gicp
WORKDIR /root/small_gicp/build
RUN rm -rf ./*
Expand All @@ -22,6 +24,10 @@ RUN cmake .. -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON -DBUILD_BENCHMARKS=ON -DBUILD_
RUN cmake --build . -j$(nproc)
RUN ctest -j$(nproc)

WORKDIR /root/small_gicp
RUN python3 setup.py build && python3 setup.py install
RUN pytest src/example/basic_registration.py

WORKDIR /

CMD ["bash"]
8 changes: 7 additions & 1 deletion docker/Dockerfile.llvm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install --no-install-recommends -y \
&& apt-get install --no-install-recommends -y \
wget nano build-essential git cmake \
wget nano build-essential git cmake python3-pip pybind11-dev \
libeigen3-dev libfmt-dev libtbb-dev libomp-dev libpcl-dev libgtest-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
Expand All @@ -15,6 +15,8 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN pip install -U setuptools pytest numpy scipy

RUN update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld 50
ENV CC=clang
ENV CXX=clang++
Expand All @@ -30,6 +32,10 @@ RUN cmake .. -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON -DBUILD_BENCHMARKS=ON -DBUILD_
RUN cmake --build . -j$(nproc)
RUN ctest -j$(nproc)

WORKDIR /root/small_gicp
RUN python3 setup.py build && python3 setup.py install
RUN pytest src/example/basic_registration.py

WORKDIR /

CMD ["bash"]
5 changes: 1 addition & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def build_extension(self, ext: CMakeExtension) -> None:
# EXAMPLE_VERSION_INFO shows you how to pass a value into the C++ code
# from Python.
cmake_args = [
f"-DBUILD_PYTHON_BINDINGS=ON",
f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}{os.sep}",
f"-DPYTHON_EXECUTABLE={sys.executable}",
f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm
]
build_args = []
Expand All @@ -55,9 +55,6 @@ def build_extension(self, ext: CMakeExtension) -> None:
if "CMAKE_ARGS" in os.environ:
cmake_args += [item for item in os.environ["CMAKE_ARGS"].split(" ") if item]

# In this example, we pass in the version to C++. You might not need to.
cmake_args += [f"-DEXAMPLE_VERSION_INFO={self.distribution.get_version()}"]

if self.compiler.compiler_type != "msvc":
# Using Ninja-build since it a) is available as a wheel and b)
# multithreads automatically. MSVC would require all variables be
Expand Down
5 changes: 2 additions & 3 deletions src/example/basic_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from scipy.spatial.transform import Rotation

import small_gicp
from pyridescence import *


# Basic registation example with numpy arrays
Expand Down Expand Up @@ -97,8 +96,8 @@ def verify_result(T_target_source, gt_T_target_source):
error_trans = numpy.linalg.norm(error[:3, 3])
error_rot = Rotation.from_matrix(error[:3, :3]).magnitude()

assert error_trans < 0.01
assert error_rot < 0.01
assert error_trans < 0.05
assert error_rot < 0.05

import pytest

Expand Down

0 comments on commit 40e36dd

Please sign in to comment.