diff --git a/.github/workflows/license.yml b/.github/workflows/license.yml new file mode 100644 index 00000000..a84e0268 --- /dev/null +++ b/.github/workflows/license.yml @@ -0,0 +1,21 @@ +name: license + +on: + push: + branches: [ master ] + paths-ignore: '**.md' + pull_request: + branches: [ master ] + paths-ignore: '**.md' + +jobs: + license_check: + name: License check + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Check license + run: | + find include/gtsam_points src/gtsam_points -type f | xargs -I filename bash -c 'if ! grep -q Copyright filename; then echo filename : lisence not found; exit 1; fi' \ No newline at end of file diff --git a/include/gtsam_points/ann/knn_result.hpp b/include/gtsam_points/ann/knn_result.hpp index 0380aeb9..0fdaee6e 100644 --- a/include/gtsam_points/ann/knn_result.hpp +++ b/include/gtsam_points/ann/knn_result.hpp @@ -1,3 +1,5 @@ +// SPDX-FileCopyrightText: Copyright 2024 Kenji Koide +// SPDX-License-Identifier: MIT #pragma once #include diff --git a/include/gtsam_points/cuda/cuda_malloc_async.hpp b/include/gtsam_points/cuda/cuda_malloc_async.hpp index db9585b9..f3805c69 100644 --- a/include/gtsam_points/cuda/cuda_malloc_async.hpp +++ b/include/gtsam_points/cuda/cuda_malloc_async.hpp @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2021 Kenji Koide (k.koide@aist.go.jp) + #pragma once #if (CUDA_VERSION < 11000) diff --git a/include/gtsam_points/cuda/gl_buffer_map.hpp b/include/gtsam_points/cuda/gl_buffer_map.hpp index b0dd150e..6ad96081 100644 --- a/include/gtsam_points/cuda/gl_buffer_map.hpp +++ b/include/gtsam_points/cuda/gl_buffer_map.hpp @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2021 Kenji Koide (k.koide@aist.go.jp) + #pragma once #include diff --git a/include/gtsam_points/cuda/kernels/inlier_access_kernel.cuh b/include/gtsam_points/cuda/kernels/inlier_access_kernel.cuh index 7e760778..0b28d643 100644 --- a/include/gtsam_points/cuda/kernels/inlier_access_kernel.cuh +++ b/include/gtsam_points/cuda/kernels/inlier_access_kernel.cuh @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2021 Kenji Koide (k.koide@aist.go.jp) + #pragma once #include diff --git a/include/gtsam_points/optimizers/dogleg_optimizer_ext.hpp b/include/gtsam_points/optimizers/dogleg_optimizer_ext.hpp index 730392a7..1286d2d0 100644 --- a/include/gtsam_points/optimizers/dogleg_optimizer_ext.hpp +++ b/include/gtsam_points/optimizers/dogleg_optimizer_ext.hpp @@ -44,7 +44,10 @@ class GTSAM_EXPORT DoglegOptimizerExt : public gtsam::NonlinearOptimizer { * @param initialValues The initial variable assignments * @param params The optimization parameters */ - DoglegOptimizerExt(const gtsam::NonlinearFactorGraph& graph, const gtsam::Values& initialValues, const gtsam::DoglegParams& params = gtsam::DoglegParams()); + DoglegOptimizerExt( + const gtsam::NonlinearFactorGraph& graph, + const gtsam::Values& initialValues, + const gtsam::DoglegParams& params = gtsam::DoglegParams()); /** Standard constructor, requires a nonlinear factor graph, initial * variable assignments, and optimization parameters. For convenience this diff --git a/include/gtsam_points/optimizers/dogleg_optimizer_ext_impl.hpp b/include/gtsam_points/optimizers/dogleg_optimizer_ext_impl.hpp index 871b5517..5ee0fd72 100644 --- a/include/gtsam_points/optimizers/dogleg_optimizer_ext_impl.hpp +++ b/include/gtsam_points/optimizers/dogleg_optimizer_ext_impl.hpp @@ -122,7 +122,8 @@ struct GTSAM_EXPORT DoglegOptimizerImplExt { * @param dx_n The Gauss-Newton point * @return The dogleg point \f$ \delta x_d \f$ */ - static gtsam::VectorValues ComputeDoglegPoint(double delta, const gtsam::VectorValues& dx_u, const gtsam::VectorValues& dx_n, const bool verbose = false); + static gtsam::VectorValues + ComputeDoglegPoint(double delta, const gtsam::VectorValues& dx_u, const gtsam::VectorValues& dx_n, const bool verbose = false); /** Compute the point on the line between the steepest descent point and the * Newton's method point intersecting the trust region boundary. @@ -158,7 +159,11 @@ typename DoglegOptimizerImplExt::IterationResult DoglegOptimizerImplExt::Iterate IterationResult result; bool stay = true; - enum { NONE, INCREASED_DELTA, DECREASED_DELTA } lastAction = NONE; // Used to prevent alternating between increasing and decreasing in one iteration + enum { + NONE, + INCREASED_DELTA, + DECREASED_DELTA + } lastAction = NONE; // Used to prevent alternating between increasing and decreasing in one iteration while (stay) { gttic(Dog_leg_point); // Compute dog leg point @@ -189,7 +194,9 @@ typename DoglegOptimizerImplExt::IterationResult DoglegOptimizerImplExt::Iterate gttic(adjust_delta); // Compute gain ratio. Here we take advantage of the invariant that the // Bayes' net error at zero is equal to the nonlinear error - const double rho = std::abs(f_error - result.f_error) < 1e-15 || std::abs(M_error - new_M_error) < 1e-15 ? 0.5 : (f_error - result.f_error) / (M_error - new_M_error); + const double rho = std::abs(f_error - result.f_error) < 1e-15 || std::abs(M_error - new_M_error) < 1e-15 + ? 0.5 + : (f_error - result.f_error) / (M_error - new_M_error); if (verbose) std::cout << std::setprecision(15) << "rho = " << rho << std::endl; diff --git a/include/gtsam_points/optimizers/isam2_ext_dummy.hpp b/include/gtsam_points/optimizers/isam2_ext_dummy.hpp index 41f02470..911d8e70 100644 --- a/include/gtsam_points/optimizers/isam2_ext_dummy.hpp +++ b/include/gtsam_points/optimizers/isam2_ext_dummy.hpp @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2021 Kenji Koide (k.koide@aist.go.jp) + #pragma once #include diff --git a/include/gtsam_points/types/dummy_frame.hpp b/include/gtsam_points/types/dummy_frame.hpp index a0285bb4..317e8486 100644 --- a/include/gtsam_points/types/dummy_frame.hpp +++ b/include/gtsam_points/types/dummy_frame.hpp @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2021 Kenji Koide (k.koide@aist.go.jp) + #pragma once namespace gtsam_points { diff --git a/include/gtsam_points/util/easy_profiler.hpp b/include/gtsam_points/util/easy_profiler.hpp index ecc473b4..68fc0ca3 100644 --- a/include/gtsam_points/util/easy_profiler.hpp +++ b/include/gtsam_points/util/easy_profiler.hpp @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2021 Kenji Koide (k.koide@aist.go.jp) + #pragma once #include @@ -63,7 +66,8 @@ class EasyProfiler { times.push_back(std::chrono::high_resolution_clock::now()); if (debug) { - ost << ">> " << label << " (" << std::chrono::duration_cast(times.back() - times.front()).count() / 1e6 << "[msec])" << std::endl; + ost << ">> " << label << " (" << std::chrono::duration_cast(times.back() - times.front()).count() / 1e6 << "[msec])" + << std::endl; } } @@ -78,4 +82,4 @@ class EasyProfiler { std::ostream& ost; std::ofstream ofs; }; -} // namespace glim \ No newline at end of file +} // namespace gtsam_points \ No newline at end of file diff --git a/include/gtsam_points/util/easy_profiler_cuda.hpp b/include/gtsam_points/util/easy_profiler_cuda.hpp index b50a0fd9..68015b12 100644 --- a/include/gtsam_points/util/easy_profiler_cuda.hpp +++ b/include/gtsam_points/util/easy_profiler_cuda.hpp @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2021 Kenji Koide (k.koide@aist.go.jp) + #pragma once #include diff --git a/src/gtsam_points/cuda/cuda_stream.cu b/src/gtsam_points/cuda/cuda_stream.cu index e46adf27..473b6287 100644 --- a/src/gtsam_points/cuda/cuda_stream.cu +++ b/src/gtsam_points/cuda/cuda_stream.cu @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2021 Kenji Koide (k.koide@aist.go.jp) + #include #include diff --git a/src/gtsam_points/cuda/gl_buffer_map.cu b/src/gtsam_points/cuda/gl_buffer_map.cu index 5296a57c..fbd34c39 100644 --- a/src/gtsam_points/cuda/gl_buffer_map.cu +++ b/src/gtsam_points/cuda/gl_buffer_map.cu @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2021 Kenji Koide (k.koide@aist.go.jp) + #include #include diff --git a/src/gtsam_points/factors/integrated_color_consistency_factor.cpp b/src/gtsam_points/factors/integrated_color_consistency_factor.cpp index 955d042c..5cf02996 100644 --- a/src/gtsam_points/factors/integrated_color_consistency_factor.cpp +++ b/src/gtsam_points/factors/integrated_color_consistency_factor.cpp @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2021 Kenji Koide (k.koide@aist.go.jp) + #include #include // #include diff --git a/src/gtsam_points/factors/integrated_colored_gicp_factor.cpp b/src/gtsam_points/factors/integrated_colored_gicp_factor.cpp index d617c34e..d433ad13 100644 --- a/src/gtsam_points/factors/integrated_colored_gicp_factor.cpp +++ b/src/gtsam_points/factors/integrated_colored_gicp_factor.cpp @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2021 Kenji Koide (k.koide@aist.go.jp) + #include #include // #include diff --git a/src/gtsam_points/factors/integrated_ct_gicp_factor.cpp b/src/gtsam_points/factors/integrated_ct_gicp_factor.cpp index 89d38243..d4ecadcf 100644 --- a/src/gtsam_points/factors/integrated_ct_gicp_factor.cpp +++ b/src/gtsam_points/factors/integrated_ct_gicp_factor.cpp @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2021 Kenji Koide (k.koide@aist.go.jp) + #include #include #include diff --git a/src/gtsam_points/factors/integrated_ct_icp_factor.cpp b/src/gtsam_points/factors/integrated_ct_icp_factor.cpp index 75cd8e21..61c4eb92 100644 --- a/src/gtsam_points/factors/integrated_ct_icp_factor.cpp +++ b/src/gtsam_points/factors/integrated_ct_icp_factor.cpp @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2021 Kenji Koide (k.koide@aist.go.jp) + #include #include #include diff --git a/src/gtsam_points/factors/integrated_gicp_factor.cpp b/src/gtsam_points/factors/integrated_gicp_factor.cpp index 7729d842..6120538e 100644 --- a/src/gtsam_points/factors/integrated_gicp_factor.cpp +++ b/src/gtsam_points/factors/integrated_gicp_factor.cpp @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2021 Kenji Koide (k.koide@aist.go.jp) + #include #include #include diff --git a/src/gtsam_points/factors/integrated_loam_factor.cpp b/src/gtsam_points/factors/integrated_loam_factor.cpp index dd3abe62..48860c27 100644 --- a/src/gtsam_points/factors/integrated_loam_factor.cpp +++ b/src/gtsam_points/factors/integrated_loam_factor.cpp @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2021 Kenji Koide (k.koide@aist.go.jp) + #include #include #include diff --git a/src/gtsam_points/factors/integrated_vgicp_factor.cpp b/src/gtsam_points/factors/integrated_vgicp_factor.cpp index 92031ce9..4d023cf3 100644 --- a/src/gtsam_points/factors/integrated_vgicp_factor.cpp +++ b/src/gtsam_points/factors/integrated_vgicp_factor.cpp @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2021 Kenji Koide (k.koide@aist.go.jp) + #include #include #include diff --git a/src/gtsam_points/optimizers/fast_scatter.cpp b/src/gtsam_points/optimizers/fast_scatter.cpp index 5671ca48..2d5c2cab 100644 --- a/src/gtsam_points/optimizers/fast_scatter.cpp +++ b/src/gtsam_points/optimizers/fast_scatter.cpp @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2021 Kenji Koide (k.koide@aist.go.jp) + #include #include diff --git a/src/gtsam_points/optimizers/gaussian_factor_graph_solver.cpp b/src/gtsam_points/optimizers/gaussian_factor_graph_solver.cpp index 21991d35..2d929db8 100644 --- a/src/gtsam_points/optimizers/gaussian_factor_graph_solver.cpp +++ b/src/gtsam_points/optimizers/gaussian_factor_graph_solver.cpp @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2021 Kenji Koide (k.koide@aist.go.jp) + #include #include diff --git a/src/gtsam_points/optimizers/incremental_fixed_lag_smoother_ext_with_fallback.cpp b/src/gtsam_points/optimizers/incremental_fixed_lag_smoother_ext_with_fallback.cpp index 24b5e354..63ee68d1 100644 --- a/src/gtsam_points/optimizers/incremental_fixed_lag_smoother_ext_with_fallback.cpp +++ b/src/gtsam_points/optimizers/incremental_fixed_lag_smoother_ext_with_fallback.cpp @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2021 Kenji Koide (k.koide@aist.go.jp) + #include #include @@ -71,7 +74,7 @@ const gtsam::Value& IncrementalFixedLagSmootherExtWithFallback::calculateEstimat try { const auto& value = smoother->calculateEstimate(key); auto found = values.find(key); - if(found != values.end()) { + if (found != values.end()) { found->value = value; } @@ -125,7 +128,7 @@ void IncrementalFixedLagSmootherExtWithFallback::update_fallback_state() { gtsam::NonlinearFactorGraph next_factors; next_factors.reserve(factors.size()); for (const auto& factor : factors) { - if(!factors_to_eliminate.count(factor.get())) { + if (!factors_to_eliminate.count(factor.get())) { next_factors.add(factor); } } @@ -149,7 +152,7 @@ void IncrementalFixedLagSmootherExtWithFallback::fallback_smoother() const { std::unordered_map max_ids; for (const auto& value : values) { const auto found = stamps.find(value.key); - if(found == stamps.end()) { + if (found == stamps.end()) { std::cerr << "warning: corresponding stamp is not found for " << gtsam::Symbol(value.key) << std::endl; continue; } @@ -158,14 +161,14 @@ void IncrementalFixedLagSmootherExtWithFallback::fallback_smoother() const { const gtsam::Symbol symbol(value.key); auto min_stamp = min_stamps.find(symbol.chr()); - if(min_stamp == min_stamps.end()) { + if (min_stamp == min_stamps.end()) { min_stamps.emplace_hint(min_stamp, symbol.chr(), stamp); } else { min_stamp->second = std::min(min_stamp->second, stamp); } auto max_id = max_ids.find(symbol.chr()); - if(max_id == max_ids.end()) { + if (max_id == max_ids.end()) { max_ids.emplace_hint(max_id, symbol.chr(), symbol.index()); } else { max_id->second = std::max(max_id->second, max_id->second); @@ -183,7 +186,7 @@ void IncrementalFixedLagSmootherExtWithFallback::fallback_smoother() const { // connectivity check std::unordered_map> factormap; for (const auto& factor : factors) { - for(const auto key: factor->keys()) { + for (const auto key : factor->keys()) { factormap[key].push_back(factor.get()); } } @@ -204,27 +207,27 @@ void IncrementalFixedLagSmootherExtWithFallback::fallback_smoother() const { traverse_queue.pop_back(); for (const auto key : factor->keys()) { - if(traversed_keys.count(key)) { + if (traversed_keys.count(key)) { continue; } traversed_keys.insert(key); const auto found = factormap.find(key); - if(found != factormap.end()) { + if (found != factormap.end()) { traverse_queue.insert(traverse_queue.end(), found->second.begin(), found->second.end()); } } } std::unordered_set keys_to_remove; - for(const auto& value: values) { - if(!traversed_keys.count(value.key)) { + for (const auto& value : values) { + if (!traversed_keys.count(value.key)) { std::cerr << "unreached key found:" << gtsam::Symbol(value.key) << std::endl; keys_to_remove.insert(value.key); } } - for(const auto& key: keys_to_remove) { + for (const auto& key : keys_to_remove) { values.erase(key); stamps.erase(key); } @@ -266,7 +269,6 @@ void IncrementalFixedLagSmootherExtWithFallback::fallback_smoother() const { std::cout << "factors:" << factors.size() << " fixed:" << new_factors.size() - factors.size() << " values:" << values.size() << " stamps:" << stamps.size() << std::endl; - for (const auto& factor : new_factors) { for (const auto key : factor->keys()) { if (!values.exists(key)) { @@ -278,8 +280,8 @@ void IncrementalFixedLagSmootherExtWithFallback::fallback_smoother() const { } } - for(const auto& stamp: stamps) { - if(!values.exists(stamp.first)) { + for (const auto& stamp : stamps) { + if (!values.exists(stamp.first)) { std::cout << "illegal stamp found!! " << gtsam::Symbol(stamp.first) << std::endl; } } diff --git a/src/gtsam_points/util/easy_profiler_cuda.cu b/src/gtsam_points/util/easy_profiler_cuda.cu index 74a0a696..4f2bedd0 100644 --- a/src/gtsam_points/util/easy_profiler_cuda.cu +++ b/src/gtsam_points/util/easy_profiler_cuda.cu @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2021 Kenji Koide (k.koide@aist.go.jp) + #include #include