-
-
Notifications
You must be signed in to change notification settings - Fork 72
/
ros-noetic-slam-toolbox.patch
169 lines (153 loc) · 5.78 KB
/
ros-noetic-slam-toolbox.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b423d97..17e60c8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,6 +40,7 @@ find_package(Cholmod REQUIRED)
find_package(LAPACK REQUIRED)
find_package(Ceres REQUIRED COMPONENTS SuiteSparse)
find_package(rostest REQUIRED)
+find_package(TBB REQUIRED CONFIG)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_definitions(-DQT_NO_KEYWORDS)
@@ -90,7 +91,7 @@ add_library(ceres_solver_plugin solvers/ceres_solver.cpp)
target_link_libraries(ceres_solver_plugin ${catkin_LIBRARIES}
${CERES_LIBRARIES}
${Boost_LIBRARIES}
- ${TBB_LIBRARIES}
+ TBB::tbb
)
#### Tool lib for mapping
diff --git a/lib/karto_sdk/CMakeLists.txt b/lib/karto_sdk/CMakeLists.txt
index ad6ef02..15eab81 100644
--- a/lib/karto_sdk/CMakeLists.txt
+++ b/lib/karto_sdk/CMakeLists.txt
@@ -8,7 +8,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
find_package(catkin REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(Boost REQUIRED system serialization filesystem thread)
-find_package(TBB REQUIRED)
+find_package(TBB REQUIRED CONFIG)
add_compile_options(-std=c++17)
catkin_package(
@@ -26,7 +26,7 @@ add_definitions(${EIGEN3_DEFINITIONS})
include_directories(include ${catkin_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
add_library(kartoSlamToolbox SHARED src/Karto.cpp src/Mapper.cpp)
-target_link_libraries(kartoSlamToolbox ${Boost_LIBRARIES} ${TBB_LIBRARIES})
+target_link_libraries(kartoSlamToolbox ${Boost_LIBRARIES} TBB::tbb)
install(DIRECTORY include/ DESTINATION include)
install(TARGETS kartoSlamToolbox
diff --git a/lib/karto_sdk/include/karto_sdk/Karto.h b/lib/karto_sdk/include/karto_sdk/Karto.h
index c4c4f27..5373b46 100644
--- a/lib/karto_sdk/include/karto_sdk/Karto.h
+++ b/lib/karto_sdk/include/karto_sdk/Karto.h
@@ -28,6 +28,7 @@
#include <iomanip>
#include <sstream>
#include <stdexcept>
+#include <mutex>
#include <shared_mutex>
#include <math.h>
diff --git a/lib/karto_sdk/include/karto_sdk/Mapper.h b/lib/karto_sdk/include/karto_sdk/Mapper.h
index 2a439c6..94164f3 100644
--- a/lib/karto_sdk/include/karto_sdk/Mapper.h
+++ b/lib/karto_sdk/include/karto_sdk/Mapper.h
@@ -26,7 +26,7 @@
#include <Eigen/Core>
#include "tbb/parallel_for.h"
-#include "tbb/parallel_do.h"
+#include "tbb/parallel_for_each.h"
#include "tbb/blocked_range.h"
#include <algorithm>
#include <chrono>
diff --git a/lib/karto_sdk/src/Mapper.cpp b/lib/karto_sdk/src/Mapper.cpp
index 7466216..97384d7 100644
--- a/lib/karto_sdk/src/Mapper.cpp
+++ b/lib/karto_sdk/src/Mapper.cpp
@@ -776,7 +776,7 @@ namespace karto
m_nAngles = nAngles;
m_searchAngleResolution = searchAngleResolution;
m_doPenalize = doPenalize;
- tbb::parallel_do(m_yPoses, (*this) );
+ tbb::parallel_for_each(m_yPoses, (*this) );
// find value of best response (in [0; 1])
kt_double bestResponse = -1;
diff --git a/solvers/ceres_solver.cpp b/solvers/ceres_solver.cpp
index 99a03a7..88da9f6 100644
--- a/solvers/ceres_solver.cpp
+++ b/solvers/ceres_solver.cpp
@@ -341,9 +341,9 @@ void CeresSolver::AddConstraint(karto::Edge<karto::LocalizedRangeScan>* pEdge)
cost_function, loss_function_,
&node1it->second(0), &node1it->second(1), &node1it->second(2),
&node2it->second(0), &node2it->second(1), &node2it->second(2));
- problem_->SetParameterization(&node1it->second(2),
+ problem_->SetManifold(&node1it->second(2),
angle_local_parameterization_);
- problem_->SetParameterization(&node2it->second(2),
+ problem_->SetManifold(&node2it->second(2),
angle_local_parameterization_);
blocks_->insert(std::pair<std::size_t, ceres::ResidualBlockId>(
diff --git a/solvers/ceres_solver.hpp b/solvers/ceres_solver.hpp
index 9c0f060..edcd2a2 100644
--- a/solvers/ceres_solver.hpp
+++ b/solvers/ceres_solver.hpp
@@ -15,7 +15,7 @@
#include <karto_sdk/Mapper.h>
#include <ceres/ceres.h>
-#include <ceres/local_parameterization.h>
+#include <ceres/manifold.h>
#include <cmath>
#include <math.h>
@@ -57,7 +57,7 @@ private:
ceres::Problem::Options options_problem_;
ceres::LossFunction* loss_function_;
ceres::Problem* problem_;
- ceres::LocalParameterization* angle_local_parameterization_;
+ ceres::Manifold* angle_local_parameterization_;
bool was_constant_set_, debug_logging_;
// graph
diff --git a/solvers/ceres_utils.h b/solvers/ceres_utils.h
index 08b5f62..021d1b1 100644
--- a/solvers/ceres_utils.h
+++ b/solvers/ceres_utils.h
@@ -4,7 +4,7 @@
*/
#include <ceres/ceres.h>
-#include <ceres/local_parameterization.h>
+#include <ceres/manifold.h>
#include <cmath>
#include <utility>
@@ -34,6 +34,24 @@ template <typename T> inline T NormalizeAngle(const T& angle_radians)
class AngleLocalParameterization
{
public:
+ template <typename T>
+ bool Plus(const T* x_radians,
+ const T* delta_radians,
+ T* x_plus_delta_radians) const {
+ *x_plus_delta_radians = NormalizeAngle(*x_radians + *delta_radians);
+ return true;
+ }
+
+ template <typename T>
+ bool Minus(const T* y_radians,
+ const T* x_radians,
+ T* y_minus_x_radians) const {
+ *y_minus_x_radians =
+ NormalizeAngle(*y_radians) - NormalizeAngle(*x_radians);
+
+ return true;
+ }
+
template <typename T>
bool operator()(const T* theta_radians, const T* delta_theta_radians, T* theta_radians_plus_delta) const
{
@@ -41,9 +59,9 @@ class AngleLocalParameterization
return true;
}
- static ceres::LocalParameterization* Create()
+ static ceres::Manifold* Create()
{
- return (new ceres::AutoDiffLocalParameterization<AngleLocalParameterization, 1, 1>);
+ return (new ceres::AutoDiffManifold<AngleLocalParameterization, 1, 1>);
}
};