Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save matlabbe/b09eefc8851aea0e060d9abe23932c9d to your computer and use it in GitHub Desktop.

Select an option

Save matlabbe/b09eefc8851aea0e060d9abe23932c9d to your computer and use it in GitHub Desktop.
g2o patch on ros noetic version (ee3d9488eeaa22f9d4ee9de46408968d42157a56) with fix against "g2o/csparse cholesky failed!"
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1b89b6c8..0202a4b7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -224,11 +224,6 @@ macro(DEFINE_SSE_VAR _setname)
endmacro(DEFINE_SSE_VAR)
# SSE optimizations:
-DEFINE_SSE_VAR(SSE2)
-DEFINE_SSE_VAR(SSE3)
-DEFINE_SSE_VAR(SSE4_1)
-DEFINE_SSE_VAR(SSE4_2)
-DEFINE_SSE_VAR(SSE4_A)
# Add build flags for clang AND GCC
if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" OR CMAKE_COMPILER_IS_GNUCXX)
diff --git a/g2o/core/optimization_algorithm_levenberg.cpp b/g2o/core/optimization_algorithm_levenberg.cpp
index dece525d..bc334e06 100644
--- a/g2o/core/optimization_algorithm_levenberg.cpp
+++ b/g2o/core/optimization_algorithm_levenberg.cpp
@@ -119,11 +119,11 @@ namespace g2o {
tempChi=std::numeric_limits<number_t>::max();
rho = (currentChi-tempChi);
- number_t scale = computeScale();
- scale += cst(1e-3); // make sure it's non-zero :)
+ // Patch: https://github.com/RainerKuemmerle/g2o/commit/4145b3ead71c2f54f191980e65a277552c09e29a
+ number_t scale = ok2?computeScale()+ cst(1e-3):1; // make sure it's non-zero :)
rho /= scale;
- if (rho>0 && g2o_isfinite(tempChi)){ // last step was good
+ if (rho>0 && g2o_isfinite(tempChi) && ok2){ // last step was good
number_t alpha = 1.-pow((2*rho-1),3);
// crop lambda between minimum and maximum factors
alpha = (std::min)(alpha, _goodStepUpperScale);
diff --git a/g2o/core/optimization_algorithm_levenberg.cpp b/g2o/core/optimization_algorithm_levenberg.cpp
index dece525d..bc334e06 100644
--- a/g2o/core/optimization_algorithm_levenberg.cpp
+++ b/g2o/core/optimization_algorithm_levenberg.cpp
@@ -119,11 +119,11 @@ namespace g2o {
tempChi=std::numeric_limits<number_t>::max();
rho = (currentChi-tempChi);
- number_t scale = computeScale();
- scale += cst(1e-3); // make sure it's non-zero :)
+ // Patch: https://github.com/RainerKuemmerle/g2o/commit/4145b3ead71c2f54f191980e65a277552c09e29a
+ number_t scale = ok2?computeScale()+ cst(1e-3):1; // make sure it's non-zero :)
rho /= scale;
- if (rho>0 && g2o_isfinite(tempChi)){ // last step was good
+ if (rho>0 && g2o_isfinite(tempChi) && ok2){ // last step was good
number_t alpha = 1.-pow((2*rho-1),3);
// crop lambda between minimum and maximum factors
alpha = (std::min)(alpha, _goodStepUpperScale);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment