Skip to content

Commit

Permalink
small_gicp: update
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed May 19, 2024
1 parent 4c057e7 commit 1879b97
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 56 deletions.
6 changes: 3 additions & 3 deletions recipes/small_gicp/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sources:
"cci.20240421":
url: "https://github.com/koide3/small_gicp/archive/b6b57e03269ca3adb020b23cdf1bc44b40fb968a.zip"
sha256: "f27a3f1e36ff6f3d1151dc4400efbb26190f3010be9850699a85c9ffb5adb81b"
"cci.20240518":
url: "https://github.com/koide3/small_gicp/archive/5c6f13cfc94c1ab129d32b8554c8bd712dc76346.zip"
sha256: "c1c1ebebf7181f1db3130d24cc56314bf5b7b3669ab7e92a58017889e21de448"
5 changes: 2 additions & 3 deletions recipes/small_gicp/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class IridescenceConan(ConanFile):
name = "small_gicp"
description = "Efficient and parallelized algorithms for point cloud registration"
license = "MIT AND BSD" # BSD is from nanoflann
license = "MIT AND BSD" # BSD is from nanoflann and Sophus
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/koide3/small_gicp"
topics = ("point-cloud", "icp", "registration", "scan-matching", "pcl")
Expand Down Expand Up @@ -64,8 +64,6 @@ def requirements(self):
self.requires("llvm-openmp/17.0.6", transitive_headers=True, transitive_libs=True)
if self.options.with_tbb:
self.requires("onetbb/2021.12.0", transitive_headers=True, transitive_libs=True)
# The project vendors nanoflann, but it has been heavily extended and should be kept intact
# Also uses some fragments from Sophus

def validate(self):
if self.settings.compiler.cppstd:
Expand Down Expand Up @@ -106,6 +104,7 @@ def build(self):

def package(self):
copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses"))
# The source code contains fragments from nanoflann and Sophus
copy(self, "LICENSE.nanoflann", self.source_folder, os.path.join(self.package_folder, "licenses"))
copy(self, "LICENSE.sophus", self.source_folder, os.path.join(self.package_folder, "licenses"))
cmake = CMake(self)
Expand Down
55 changes: 6 additions & 49 deletions recipes/small_gicp/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -1,67 +1,24 @@
// https://github.com/koide3/small_gicp/blob/ff8269ec09c9ddccff8358a4b7cc5e4c5fda134f/src/example/03_registration_template.cpp
// SPDX-FileCopyrightText: Copyright 2024 Kenji Koide
// SPDX-License-Identifier: MIT

/// @brief Basic point cloud registration example with small_gicp::align()
#include <iostream>
#include <small_gicp/benchmark/read_points.hpp>
#include <small_gicp/registration/registration_helper.hpp>

#include <small_gicp/points/point_cloud.hpp>
#include <small_gicp/ann/kdtree_omp.hpp>
#ifdef WITH_TBB
#include <small_gicp/ann/kdtree_tbb.hpp>
#endif

using namespace small_gicp;

/// @brief Most basic registration example.
void example1(const std::vector<Eigen::Vector4f>& target_points, const std::vector<Eigen::Vector4f>& source_points) {
RegistrationSetting setting;
setting.num_threads = 4; // Number of threads to be used
setting.downsampling_resolution = 0.25; // Downsampling resolution
setting.max_correspondence_distance = 1.0; // Maximum correspondence distance between points (e.g., trimming threshold)

Eigen::Isometry3d init_T_target_source = Eigen::Isometry3d::Identity();
RegistrationResult result = align(target_points, source_points, init_T_target_source, setting);

std::cout << "--- T_target_source ---" << std::endl << result.T_target_source.matrix() << std::endl;
std::cout << "converged:" << result.converged << std::endl;
std::cout << "error:" << result.error << std::endl;
std::cout << "iterations:" << result.iterations << std::endl;
std::cout << "num_inliers:" << result.num_inliers << std::endl;
std::cout << "--- H ---" << std::endl << result.H << std::endl;
std::cout << "--- b ---" << std::endl << result.b.transpose() << std::endl;
}

int main(int argc, char** argv) {
int main() {
std::vector<Eigen::Vector4f> target_points = {
{1.0f, 2.0f, 3.0f, 1.0f},
{4.0f, 5.0f, 6.0f, 1.0f},
{7.0f, 8.0f, 9.0f, 1.0f},
{10.0f, 11.0f, 12.0f, 1.0f},
{13.0f, 14.0f, 15.0f, 1.0f},
{16.0f, 17.0f, 18.0f, 1.0f},
{19.0f, 20.0f, 21.0f, 1.0f},
{22.0f, 23.0f, 24.0f, 1.0f}
};
std::vector<Eigen::Vector4f> source_points = {
{1.1f, 2.1f, 3.2f, 1.0f},
{4.2f, 4.9f, 6.1f, 1.0f},
{6.9f, 8.2f, 9.1f, 1.0f},
{10.2f, 10.8f, 12.2f, 1.0f},
{13.1f, 14.0f, 15.2f, 1.0f},
{15.9f, 17.2f, 18.1f, 1.0f},
{19.2f, 20.1f, 21.2f, 1.0f},
{22.1f, 23.1f, 24.2f, 1.0f}
};
auto target = std::make_shared<PointCloud>(target_points);

example1(target_points, source_points);
const int num_threads = 1;
std::make_shared<KdTree<PointCloud>>(target, KdTreeBuilderOMP(num_threads));

// test that these compile and link
KdTreeOMP<PointCloud>::Ptr kdtree_omp;
#ifdef WITH_TBB
KdTreeTBB<PointCloud>::Ptr kdtree_tbb;
std::make_shared<KdTree<PointCloud>>(target, KdTreeBuilderTBB());
#endif

return 0;
}
2 changes: 1 addition & 1 deletion recipes/small_gicp/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
versions:
"cci.20240421":
"cci.20240518":
folder: all

0 comments on commit 1879b97

Please sign in to comment.