Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nacho/remove kitti from core library #369

Merged
merged 3 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions cpp/kiss_icp/core/Preprocessing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@
// SOFTWARE.
#include "Preprocessing.hpp"

#include <tbb/parallel_for.h>
#include <tsl/robin_map.h>

#include <Eigen/Core>
#include <Eigen/Geometry>
#include <algorithm>
#include <cmath>
#include <vector>

#include "VoxelUtils.hpp"
Expand Down Expand Up @@ -63,15 +61,4 @@ std::vector<Eigen::Vector3d> Preprocess(const std::vector<Eigen::Vector3d> &fram
return inliers;
}

std::vector<Eigen::Vector3d> CorrectKITTIScan(const std::vector<Eigen::Vector3d> &frame) {
constexpr double VERTICAL_ANGLE_OFFSET = (0.205 * M_PI) / 180.0;
std::vector<Eigen::Vector3d> corrected_frame(frame.size());
tbb::parallel_for(size_t(0), frame.size(), [&](size_t i) {
const auto &pt = frame[i];
const Eigen::Vector3d rotationVector = pt.cross(Eigen::Vector3d(0., 0., 1.));
corrected_frame[i] =
Eigen::AngleAxisd(VERTICAL_ANGLE_OFFSET, rotationVector.normalized()) * pt;
});
return corrected_frame;
}
} // namespace kiss_icp
5 changes: 0 additions & 5 deletions cpp/kiss_icp/core/Preprocessing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ std::vector<Eigen::Vector3d> Preprocess(const std::vector<Eigen::Vector3d> &fram
double max_range,
double min_range);

/// This function only applies for the KITTI dataset, and should NOT be used by any other dataset,
/// the original idea and part of the implementation is taking from CT-ICP(Although IMLS-SLAM
/// Originally introduced the calibration factor)
std::vector<Eigen::Vector3d> CorrectKITTIScan(const std::vector<Eigen::Vector3d> &frame);

/// Voxelize point cloud keeping the original coordinates
std::vector<Eigen::Vector3d> VoxelDownsample(const std::vector<Eigen::Vector3d> &frame,
double voxel_size);
Expand Down
18 changes: 17 additions & 1 deletion python/kiss_icp/pybind/kiss_icp_pybind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include <pybind11/stl_bind.h>

#include <Eigen/Core>
#include <algorithm>
#include <cmath>
#include <memory>
#include <vector>

Expand Down Expand Up @@ -118,7 +120,21 @@ PYBIND11_MODULE(kiss_icp_pybind, m) {
// prerpocessing modules
m.def("_voxel_down_sample", &VoxelDownsample, "frame"_a, "voxel_size"_a);
m.def("_preprocess", &Preprocess, "frame"_a, "max_range"_a, "min_range"_a);
m.def("_correct_kitti_scan", &CorrectKITTIScan, "frame"_a);
/// This function only applies for the KITTI dataset, and should NOT be used by any other
/// dataset, the original idea and part of the implementation is taking from CT-ICP(Although
/// IMLS-SLAM Originally introduced the calibration factor)
m.def(
"_correct_kitti_scan",
[](const std::vector<Eigen::Vector3d> &frame) {
constexpr double VERTICAL_ANGLE_OFFSET = (0.205 * M_PI) / 180.0;
std::vector<Eigen::Vector3d> frame_ = frame;
std::transform(frame_.cbegin(), frame_.cend(), frame_.begin(), [&](const auto pt) {
const Eigen::Vector3d rotationVector = pt.cross(Eigen::Vector3d(0., 0., 1.));
return Eigen::AngleAxisd(VERTICAL_ANGLE_OFFSET, rotationVector.normalized()) * pt;
});
return frame_;
},
"frame"_a);

// Metrics
m.def("_kitti_seq_error", &metrics::SeqError, "gt_poses"_a, "results_poses"_a);
Expand Down