-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* We didnt have proper flagging in the online node * Clean launch common args * Add new threshold * Update CMakeLists.txt (#7) Make *USE_SYSTEM_SOPHUS* consistent with the rest of the options. * Update README.md (#6) More accurate statement in the readme, the system does not need to follow a unicycle motion model, just the pose correction needs to do that, which applies to much more robotics platforms. * Add python checks to pre-commit (#9) * Add black and isort * Format * use black for isort * Fixing ROS launch system (#8) * We didnt have proper flagging in the online node * Clean launch common args * Fix formatting python * Tiny modification, but makes sense * Renaming and add configuration for the correspondence threshold * Fix pipeline * Consistency in the CMakeLists * Remove ternary operator and make the two functions consistent * Update cpp/kinematic_icp/correspondence_threshold/CorrespondenceThreshold.hpp Co-authored-by: Benedikt Mersch <[email protected]> * Renaming according to Ben's review * Why a ref * Odometry Regularization (#19) * Natural extension to make also the odometry regularization optional * Consistency in the CMakeLists * Remove ternary operator and make the two functions consistent * Update cpp/kinematic_icp/correspondence_threshold/CorrespondenceThreshold.hpp Co-authored-by: Benedikt Mersch <[email protected]> * Renaming according to Ben's review * Why a ref * Use the same default --------- Co-authored-by: Benedikt Mersch <[email protected]> Co-authored-by: Benedikt Mersch <[email protected]> --------- Co-authored-by: Benedikt Mersch <[email protected]> Co-authored-by: Benedikt Mersch <[email protected]>
- Loading branch information
1 parent
27d76e3
commit 59bc9fc
Showing
11 changed files
with
241 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# MIT License | ||
# | ||
# Copyright (c) 2024 Tiziano Guadagnino, Benedikt Mersch, Ignacio Vizzo, Cyrill | ||
# Stachniss. | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
add_library(kinematic_icp_threshold STATIC) | ||
target_sources(kinematic_icp_threshold PRIVATE CorrespondenceThreshold.cpp) | ||
target_link_libraries(kinematic_icp_threshold PUBLIC Sophus::Sophus) | ||
set_global_target_properties(kinematic_icp_threshold) |
66 changes: 66 additions & 0 deletions
66
cpp/kinematic_icp/correspondence_threshold/CorrespondenceThreshold.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// MIT License | ||
// | ||
// Copyright (c) 2024 Tiziano Guadagnino, Benedikt Mersch, Ignacio Vizzo, Cyrill | ||
// Stachniss. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all | ||
// copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
// SOFTWARE. | ||
#include "CorrespondenceThreshold.hpp" | ||
|
||
#include <cmath> | ||
#include <sophus/se3.hpp> | ||
|
||
namespace { | ||
double OdometryErrorInPointSpace(const Sophus::SE3d &pose, const double max_range) { | ||
const double &theta = pose.so3().logAndTheta().theta; | ||
const double &delta_rot = 2.0 * max_range * std::sin(theta / 2.0); | ||
const double &delta_trans = pose.translation().norm(); | ||
return delta_trans + delta_rot; | ||
}; | ||
} // namespace | ||
|
||
namespace kinematic_icp { | ||
CorrespondenceThreshold::CorrespondenceThreshold(const double map_discretization_error, | ||
const double max_range, | ||
const bool use_adaptive_threshold, | ||
const double fixed_threshold) | ||
: map_discretization_error_(map_discretization_error), | ||
max_range_(max_range), | ||
use_adaptive_threshold_(use_adaptive_threshold), | ||
fixed_threshold_(fixed_threshold), | ||
odom_sse_(0.0), | ||
num_samples_(1e-8) {} | ||
|
||
double CorrespondenceThreshold::ComputeThreshold() const { | ||
if (!use_adaptive_threshold_) return fixed_threshold_; | ||
|
||
const double sigma_odom = std::sqrt(odom_sse_ / num_samples_); | ||
const double &sigma_map = map_discretization_error_; // <-- Renaming for clarity | ||
const double adaptive_threshold = 3.0 * (sigma_map + sigma_odom); | ||
return adaptive_threshold; | ||
} | ||
|
||
void CorrespondenceThreshold::UpdateOdometryError(const Sophus::SE3d &odometry_error) { | ||
if (!use_adaptive_threshold_) return; | ||
|
||
const double &odom_error_in_point_space = OdometryErrorInPointSpace(odometry_error, max_range_); | ||
odom_sse_ += odom_error_in_point_space * odom_error_in_point_space; | ||
num_samples_ += 1.0; | ||
} | ||
|
||
} // namespace kinematic_icp |
56 changes: 56 additions & 0 deletions
56
cpp/kinematic_icp/correspondence_threshold/CorrespondenceThreshold.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// MIT License | ||
// | ||
// Copyright (c) 2024 Tiziano Guadagnino, Benedikt Mersch, Ignacio Vizzo, Cyrill | ||
// Stachniss. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all | ||
// copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
// SOFTWARE. | ||
#pragma once | ||
|
||
#include <cmath> | ||
#include <sophus/se3.hpp> | ||
|
||
namespace kinematic_icp { | ||
|
||
struct CorrespondenceThreshold { | ||
explicit CorrespondenceThreshold(const double map_discretization_error, | ||
const double max_range, | ||
const bool use_adaptive_threshold, | ||
const double fixed_threshold); | ||
|
||
void UpdateOdometryError(const Sophus::SE3d &odometry_error); | ||
|
||
double ComputeThreshold() const; | ||
|
||
inline void Reset() { | ||
odom_sse_ = 0.0; | ||
num_samples_ = 1e-8; | ||
} | ||
|
||
// configurable parameters | ||
double map_discretization_error_; // <-- Error introduced by the fact that we have a discrete | ||
// set of points of the surface we are measuring | ||
double max_range_; | ||
bool use_adaptive_threshold_; | ||
double fixed_threshold_; // <-- Ignored if use_adaptive_threshold_ = true | ||
|
||
// Local cache for computation | ||
double odom_sse_; | ||
double num_samples_; | ||
}; | ||
} // namespace kinematic_icp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.