Skip to content

Commit

Permalink
Merge pull request #2 from PRBonn/main
Browse files Browse the repository at this point in the history
Make voxel computation consistent across all source code (#354)
  • Loading branch information
saurabh1002 authored Jul 10, 2024
2 parents 66ef872 + 8596de8 commit 16e20e2
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,32 @@ jobs:
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{github.workspace}}/cpp/kiss_icp
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

# As the previous job will always install the dependencies from cmake, and this is guaranteed to
# work, we also want to support dev sandboxes where the main dependencies are already
# pre-installed in the system. For now, we only support dev machines under a GNU/Linux
# environmnets. If you are reading this and need the same functionallity in Windows/macOS please
# open a ticket.
cpp_api_dev:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-20.04]

steps:
- uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.apt/cache
key: ${{ runner.os }}-apt-${{ hashFiles('**/ubuntu_dependencies.yml') }}
restore-keys: |
${{ runner.os }}-apt-
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake git libeigen3-dev libtbb-dev
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{github.workspace}}/cpp/kiss_icp
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
1 change: 1 addition & 0 deletions cpp/kiss_icp/core/Deskew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ std::vector<Eigen::Vector3d> DeSkewScan(const std::vector<Eigen::Vector3d> &fram
const Sophus::SE3d &delta) {
const auto delta_pose = delta.log();
std::vector<Eigen::Vector3d> corrected_frame(frame.size());
// TODO(All): This tbb execution is ignoring the max_n_threads config value
tbb::parallel_for(size_t(0), frame.size(), [&](size_t i) {
const auto motion = Sophus::SE3d::exp((timestamps[i] - mid_pose_timestamp) * delta_pose);
corrected_frame[i] = motion * frame[i];
Expand Down
4 changes: 3 additions & 1 deletion cpp/kiss_icp/core/Registration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <tbb/global_control.h>
#include <tbb/info.h>
#include <tbb/parallel_reduce.h>
#include <tbb/task_arena.h>

#include <algorithm>
#include <cmath>
Expand Down Expand Up @@ -171,7 +172,8 @@ Registration::Registration(int max_num_iteration, double convergence_criterion,
: max_num_iterations_(max_num_iteration),
convergence_criterion_(convergence_criterion),
// Only manipulate the number of threads if the user specifies something greater than 0
max_num_threads_(max_num_threads > 0 ? max_num_threads : tbb::info::default_concurrency()) {
max_num_threads_(max_num_threads > 0 ? max_num_threads
: tbb::this_task_arena::max_concurrency()) {
// This global variable requires static duration storage to be able to manipulate the max
// concurrency from TBB across the entire class
static const auto tbb_control_settings = tbb::global_control(
Expand Down
2 changes: 1 addition & 1 deletion cpp/kiss_icp/core/VoxelHashMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct VoxelHashMap {
struct VoxelHash {
size_t operator()(const Voxel &voxel) const {
const uint32_t *vec = reinterpret_cast<const uint32_t *>(voxel.data());
return ((1 << 20) - 1) & (vec[0] * 73856093 ^ vec[1] * 19349669 ^ vec[2] * 83492791);
return (vec[0] * 73856093 ^ vec[1] * 19349669 ^ vec[2] * 83492791);
}
};

Expand Down

0 comments on commit 16e20e2

Please sign in to comment.