Skip to content

Commit 737e909

Browse files
author
Benedikt Mersch
authored
Add separate deskewing, taken from MapMOS (#44)
1 parent 428cee2 commit 737e909

File tree

16 files changed

+752
-10
lines changed

16 files changed

+752
-10
lines changed

pyproject.toml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ authors = [
77
{ name = "Benedikt Mersch", email = "[email protected]" },
88
]
99
dependencies = [
10-
"kiss-icp>=1.0.0",
10+
"kiss-icp>=1.2.0",
1111
"diskcache>=5.3.0",
1212
"pytorch_lightning>=1.6.4",
1313
]
@@ -28,8 +28,21 @@ mos4d_pipeline = "mos4d.cli:app"
2828
Homepage = "https://github.com/PRBonn/4DMOS"
2929

3030
[build-system]
31-
requires = ["setuptools >= 61.0"]
32-
build-backend = "setuptools.build_meta"
31+
requires = [
32+
"scikit_build_core","pybind11",
33+
]
34+
build-backend = "scikit_build_core.build"
35+
36+
[tool.scikit-build]
37+
build-dir = "build"
38+
cmake.verbose = false
39+
cmake.minimum-version = "3.16"
40+
cmake.source-dir = "src/mos4d/pybind/"
41+
editable.mode = "redirect"
42+
editable.rebuild = true
43+
editable.verbose = true
44+
sdist.exclude = ["pybind/"]
45+
wheel.install-dir = "mos4d/pybind/"
3346

3447
[tool.black]
3548
line-length = 100

scripts/precache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def precache(
6868
from mos4d.datasets.mos4d_dataset import collate_fn
6969

7070
cfg = load_config(config)
71-
sequences = list(sequence) if len(sequence) > 0 else cfg.training.train + cfg.training.val
71+
sequences = list(sequence) if sequence != None else cfg.training.train + cfg.training.val
7272

7373
data_iterable = DataLoader(
7474
Dataset(

src/mos4d/__init__.py

Whitespace-only changes.

src/mos4d/odometry.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from kiss_icp.kiss_icp import KissICP
2626

2727
from mos4d.config import DataConfig, OdometryConfig
28+
from mos4d.pybind import mos4d_pybind
2829

2930

3031
def parse_config(config_data: DataConfig, config_odometry: OdometryConfig):
@@ -50,10 +51,7 @@ def __init__(
5051

5152
def register_points(self, points, timestamps, scan_index):
5253
# Apply motion compensation
53-
points = self.compensator.deskew_scan(points, timestamps, self.last_delta)
54-
55-
# Preprocess the input cloud
56-
points_prep = self.preprocess(points)
54+
points_prep = self.preprocessor.preprocess(points, timestamps, self.last_delta)
5755

5856
# Voxelize
5957
source, points_downsample = self.voxelize(points_prep)
@@ -72,6 +70,8 @@ def register_points(self, points, timestamps, scan_index):
7270
kernel=sigma / 3,
7371
)
7472

73+
point_deskewed = self.deskew(points, timestamps, self.last_delta)
74+
7575
# Compute the difference between the prediction and the actual estimate
7676
model_deviation = np.linalg.inv(initial_guess) @ new_pose
7777

@@ -81,14 +81,26 @@ def register_points(self, points, timestamps, scan_index):
8181
self.last_delta = np.linalg.inv(self.last_pose) @ new_pose
8282
self.last_pose = new_pose
8383

84-
points_reg = self.transform(points, self.last_pose)
85-
return np.asarray(points_reg)
84+
return self.transform(point_deskewed, self.last_pose)
8685

8786
def transform(self, points, pose):
8887
points_hom = np.hstack((points, np.ones((len(points), 1))))
8988
points = (pose @ points_hom.T).T[:, :3]
9089
return points
9190

91+
def deskew(self, points, timestamps, relative_motion):
92+
return (
93+
np.asarray(
94+
mos4d_pybind._deskew(
95+
frame=mos4d_pybind._Vector3dVector(points),
96+
timestamps=timestamps,
97+
relative_motion=relative_motion,
98+
)
99+
)
100+
if self.config.data.deskew
101+
else points
102+
)
103+
92104
def current_pose(self):
93105
return self.last_pose
94106

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Eigen is primarily MPL2 licensed. See COPYING.MPL2 and these links:
2+
http://www.mozilla.org/MPL/2.0/
3+
http://www.mozilla.org/MPL/2.0/FAQ.html
4+
5+
Some files contain third-party code under BSD or LGPL licenses, whence the other
6+
COPYING.* files here.
7+
8+
All the LGPL code is either LGPL 2.1-only, or LGPL 2.1-or-later.
9+
For this reason, the COPYING.LGPL file contains the LGPL 2.1 text.
10+
11+
If you want to guarantee that the Eigen code that you are #including is licensed
12+
under the MPL2 and possibly more permissive licenses (like BSD), #define this
13+
preprocessor symbol:
14+
EIGEN_MPL2_ONLY
15+
For example, with most compilers, you could add this to your project CXXFLAGS:
16+
-DEIGEN_MPL2_ONLY
17+
This will cause a compilation error to be generated if you #include any code that is
18+
LGPL licensed.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# MIT License
2+
#
3+
# Copyright (c) 2022 Ignacio Vizzo, Tiziano Guadagnino, Benedikt Mersch, Cyrill
4+
# Stachniss.
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy
7+
# of this software and associated documentation files (the "Software"), to deal
8+
# in the Software without restriction, including without limitation the rights
9+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
# copies of the Software, and to permit persons to whom the Software is
11+
# furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included in all
14+
# copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
# SOFTWARE.
23+
24+
# TODO: Yet another manual release dne by nacho. This should be updated whenever the Eigen team
25+
# release a new version that is not 3.4. That version does not include this necessary changes:
26+
# - https://gitlab.com/libeigen/eigen/-/merge_requests/893/diffs
27+
28+
set(EIGEN_BUILD_DOC OFF CACHE BOOL "Don't build Eigen docs")
29+
set(EIGEN_BUILD_TESTING OFF CACHE BOOL "Don't build Eigen tests")
30+
set(EIGEN_BUILD_PKGCONFIG OFF CACHE BOOL "Don't build Eigen pkg-config")
31+
set(EIGEN_BUILD_BLAS OFF CACHE BOOL "Don't build blas module")
32+
set(EIGEN_BUILD_LAPACK OFF CACHE BOOL "Don't build lapack module")
33+
34+
include(FetchContent)
35+
FetchContent_Declare(eigen SYSTEM URL https://github.com/nachovizzo/eigen/archive/refs/tags/3.4.90.tar.gz)
36+
FetchContent_MakeAvailable(eigen)
37+
38+
if(${CMAKE_VERSION} VERSION_LESS 3.25)
39+
get_target_property(eigen_include_dirs eigen INTERFACE_INCLUDE_DIRECTORIES)
40+
set_target_properties(eigen PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${eigen_include_dirs}")
41+
endif()
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# MIT License
2+
#
3+
# Copyright (c) 2022 Ignacio Vizzo, Tiziano Guadagnino, Benedikt Mersch, Cyrill
4+
# Stachniss.
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy
7+
# of this software and associated documentation files (the "Software"), to deal
8+
# in the Software without restriction, including without limitation the rights
9+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
# copies of the Software, and to permit persons to whom the Software is
11+
# furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included in all
14+
# copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
# SOFTWARE.
23+
24+
# Silence timestamp warning
25+
if(CMAKE_VERSION VERSION_GREATER 3.24)
26+
cmake_policy(SET CMP0135 OLD)
27+
endif()
28+
29+
if(USE_SYSTEM_EIGEN3)
30+
find_package(Eigen3 QUIET NO_MODULE)
31+
endif()
32+
if(NOT USE_SYSTEM_EIGEN3 OR NOT TARGET Eigen3::Eigen)
33+
set(USE_SYSTEM_EIGEN3 OFF)
34+
include(${CMAKE_CURRENT_LIST_DIR}/eigen/eigen.cmake)
35+
endif()
36+
37+
if(USE_SYSTEM_SOPHUS)
38+
find_package(Sophus QUIET NO_MODULE)
39+
endif()
40+
if(NOT USE_SYSTEM_SOPHUS OR NOT TARGET Sophus::Sophus)
41+
set(USE_SYSTEM_SOPHUS OFF)
42+
include(${CMAKE_CURRENT_LIST_DIR}/sophus/sophus.cmake)
43+
endif()
44+
45+
# tbb needs to be statically linked, so, also do it always :)
46+
if(USE_SYSTEM_TBB)
47+
find_package(TBB QUIET NO_MODULE)
48+
endif()
49+
if(NOT USE_SYSTEM_TBB OR NOT TARGET TBB::tbb)
50+
set(USE_SYSTEM_TBB OFF)
51+
include(${CMAKE_CURRENT_LIST_DIR}/tbb/tbb.cmake)
52+
endif()
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2008-2015 Jesse Beder.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWAR
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# MIT License
2+
#
3+
# # Copyright (c) 2023 Saurabh Gupta, Ignacio Vizzo, Cyrill Stachniss, University of Bonn
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in all
13+
# copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
include(FetchContent)
23+
24+
set(SOPHUS_USE_BASIC_LOGGING ON CACHE BOOL "Don't use fmt for Sophus libraru")
25+
set(BUILD_SOPHUS_TESTS OFF CACHE BOOL "Don't build Sophus tests")
26+
set(BUILD_SOPHUS_EXAMPLES OFF CACHE BOOL "Don't build Sophus Examples")
27+
28+
# TODO: after https://github.com/strasdat/Sophus/pull/502 gets merged go back to mainstream
29+
FetchContent_Declare(sophus SYSTEM URL https://github.com/nachovizzo/Sophus/archive/refs/tags/1.22.11.tar.gz)
30+
FetchContent_MakeAvailable(sophus)

0 commit comments

Comments
 (0)