Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
saurabh1002 committed Mar 14, 2024
1 parent d4d1d68 commit e6d50e1
Show file tree
Hide file tree
Showing 54 changed files with 3,337 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
BasedOnStyle: Google
UseTab: Never
IndentWidth: 4
AccessModifierOffset: -4
ColumnLimit: 100
BinPackParameters: false
SortIncludes: true
Standard: c++17
DerivePointerAlignment: false
PointerAlignment: Right
4 changes: 4 additions & 0 deletions .cmake-format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
enable_markup: false
line_width: 120
format:
max_subgroups_hwrap: 5
126 changes: 126 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
build/
install/
log/
results/
wheelhouse/
_skbuild/
.gitlab-ci-local/

# Created by https://www.toptal.com/developers/gitignore/api/python,c++
# Edit at https://www.toptal.com/developers/gitignore?templates=python,c++
### C++ ###
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# pytype static type analyzer
.pytype/

# VSCode
.vscode
37 changes: 37 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
stages:
- format
- build
cache:
paths:
- .cache/pip

#----- format stage --------------------------------------------------------------------------------
black:
image: python:3.8
stage: format
before_script:
- pip install black
script:
- black --line-length 100 --check $CI_PROJECT_DIR

clang-format:
image: ubuntu:22.04
stage: format
before_script:
- apt-get update && apt-get install --no-install-recommends -y clang-format
script:
- clang-format -Werror --dry-run $(find . -regextype posix-extended -regex ".*\.(cpp|hpp|h)")

#----- build stage ---------------------------------------------------------------------------------
cpp:
image: gitlab.ipb.uni-bonn.de:4567/ssg1002/map_closures:latest
stage: build
script:
make cpp

pip_package:
image: gitlab.ipb.uni-bonn.de:4567/ssg1002/map_closures:latest
stage: build
script:
- VERBOSE=1 pip install --verbose ./python/
- map_closure_pipeline --version
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v14.0.0
hooks:
- id: clang-format
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
args: [--config=python/pyproject.toml]
- repo: https://github.com/ahans/cmake-format-precommit
rev: 8e52fb6506f169dddfaa87f88600d765fca48386
hooks:
- id: cmake-format
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--settings-path=python/pyproject.toml"]
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2024 Photogrammetry & Robotics Bonn
Copyright (c) 2024 Saurabh Gupta, Tiziano Guadagnino, Benedikt Mersch,
Ignacio Vizzo, Cyrill Stachniss.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.PHONY: cpp

install:
@pip install --verbose ./python/

uninstall:
@pip -v uninstall map-closures

editable:
@pip install scikit-build-core pyproject_metadata pathspec pybind11 ninja cmake
@pip install --no-build-isolation -ve ./python/

cpp:
@cmake -Bbuild cpp/map_closures/
@cmake --build build -j$(nproc --all)
Empty file added config/README.md
Empty file.
5 changes: 5 additions & 0 deletions config/basic_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
density_map_resolution: 0.5
density_threshold: 0.05
hamming_distance_threshold: 50
inliers_threshold: 10
local_map_factor: 0.6 # Local Map size as a multiple of the maximum range of the LiDAR
48 changes: 48 additions & 0 deletions cpp/map_closures/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# MIT License
#
# Copyright (c) 2024 Saurabh Gupta, Tiziano Guadagnino, Benedikt Mersch,
# Ignacio Vizzo, Cyrill Stachniss.
#
# 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.

cmake_minimum_required(VERSION 3.16...3.26)
project(map_closures_cpp VERSION 0.1.0 LANGUAGES CXX)

option(USE_CCACHE "Build using Ccache if found on the path" ON)
option(USE_SYSTEM_EIGEN3 "Use system pre-installed Eigen" ON)

# ccache setup
if(USE_CCACHE)
find_program(CCACHE_PATH ccache)
if(CCACHE_PATH)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
message(STATUS "Using ccache: ${CCACHE_PATH}")
endif()
endif()

set(CMAKE_BUILD_TYPE Release)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

include(thirdparty/find_dependencies.cmake)
include(cmake/CompilerOptions.cmake)

add_subdirectory(core)
add_subdirectory(pipeline)
22 changes: 22 additions & 0 deletions cpp/map_closures/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2024 Saurabh Gupta, Tiziano Guadagnino, Benedikt Mersch,
Ignacio Vizzo, Cyrill Stachniss.

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.
Empty file added cpp/map_closures/README.md
Empty file.
52 changes: 52 additions & 0 deletions cpp/map_closures/cmake/CompilerOptions.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# MIT License
#
# Copyright (c) 2024 Saurabh Gupta, Tiziano Guadagnino, Benedikt Mersch,
# Ignacio Vizzo, Cyrill Stachniss.
#
# 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.

function(set_global_target_properties target)
target_compile_features(${target} PUBLIC cxx_std_17)
target_compile_definitions(${target} PUBLIC $<$<COMPILE_LANG_AND_ID:CXX,MSVC>:_USE_MATH_DEFINES>)
target_compile_options(
${target}
PRIVATE # Clang
$<$<COMPILE_LANG_AND_ID:CXX,Clang>:-fcolor-diagnostics>
$<$<COMPILE_LANG_AND_ID:CXX,Clang>:-Werror>
$<$<COMPILE_LANG_AND_ID:CXX,Clang>:-Wall>
$<$<COMPILE_LANG_AND_ID:CXX,Clang>:-Wextra>
$<$<COMPILE_LANG_AND_ID:CXX,Clang>:-Wno-sign-compare>
$<$<COMPILE_LANG_AND_ID:CXX,Clang>:-Wno-sign-conversion>
$<$<COMPILE_LANG_AND_ID:CXX,Clang>:-Wno-ignored-qualifiers>
# GNU
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-fdiagnostics-color=always>
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Werror>
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wall>
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wextra>
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-pedantic>
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wcast-align>
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wno-sign-compare>
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Woverloaded-virtual>
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wdisabled-optimization>
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wno-ignored-qualifiers>)
set(INCLUDE_DIRS ${PROJECT_SOURCE_DIR})
get_filename_component(INCLUDE_DIRS ${INCLUDE_DIRS} PATH)
target_include_directories(${target} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC $<BUILD_INTERFACE:${INCLUDE_DIRS}> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
endfunction()
Loading

0 comments on commit e6d50e1

Please sign in to comment.