-
Notifications
You must be signed in to change notification settings - Fork 667
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(ndt_scan_matcher, ndt_omp): move ndt_omp into ndt_scan_match…
…er (#8912) * Moved ndt_omp into ndt_scan_matcher Signed-off-by: Shintaro Sakoda <[email protected]> * Added Copyright Signed-off-by: Shintaro Sakoda <[email protected]> * style(pre-commit): autofix * Fixed include Signed-off-by: Shintaro Sakoda <[email protected]> * Fixed cast style Signed-off-by: Shintaro Sakoda <[email protected]> * Fixed include Signed-off-by: Shintaro Sakoda <[email protected]> * Fixed honorific title Signed-off-by: Shintaro Sakoda <[email protected]> * Fixed honorific title Signed-off-by: Shintaro Sakoda <[email protected]> * style(pre-commit): autofix * Fixed include hierarchy Signed-off-by: Shintaro Sakoda <[email protected]> * style(pre-commit): autofix * Fixed include hierarchy Signed-off-by: Shintaro Sakoda <[email protected]> * style(pre-commit): autofix * Fixed hierarchy Signed-off-by: Shintaro Sakoda <[email protected]> * Fixed NVTP to NVTL Signed-off-by: Shintaro Sakoda <[email protected]> * Added cspell:ignore Signed-off-by: Shintaro Sakoda <[email protected]> * Fixed miss spell Signed-off-by: Shintaro Sakoda <[email protected]> * style(pre-commit): autofix * Fixed include Signed-off-by: Shintaro Sakoda <[email protected]> * Renamed applyFilter Signed-off-by: Shintaro Sakoda <[email protected]> * Moved ***_impl.hpp from include/ to src/ Signed-off-by: Shintaro Sakoda <[email protected]> * style(pre-commit): autofix * Fixed variable scope Signed-off-by: Shintaro Sakoda <[email protected]> * Fixed to pass by reference Signed-off-by: Shintaro Sakoda <[email protected]> --------- Signed-off-by: Shintaro Sakoda <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
a9763cb
commit 6a06241
Showing
17 changed files
with
3,232 additions
and
11 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
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
25 changes: 25 additions & 0 deletions
25
localization/autoware_ndt_scan_matcher/include/autoware/ndt_scan_matcher/ndt_omp/LICENSE
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,25 @@ | ||
BSD 2-Clause License | ||
|
||
Copyright (c) 2019, k.koide | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
12 changes: 12 additions & 0 deletions
12
...n/autoware_ndt_scan_matcher/include/autoware/ndt_scan_matcher/ndt_omp/README.md
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,12 @@ | ||
# ndt_omp | ||
|
||
<!--> | ||
|
||
cspell:ignore Kenji, Koide | ||
<--> | ||
|
||
The codes in this directory are derived from <https://github.com/tier4/ndt_omp>, which is a fork of <https://github.com/koide3/ndt_omp>. | ||
|
||
We use this code in accordance with the LICENSE, and we have directly confirmed this with Dr. Kenji Koide. | ||
|
||
We sincerely appreciate Dr. Koide’s support and contributions. |
90 changes: 90 additions & 0 deletions
90
...toware_ndt_scan_matcher/include/autoware/ndt_scan_matcher/ndt_omp/estimate_covariance.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,90 @@ | ||
// Copyright 2023 TIER IV, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef AUTOWARE__NDT_SCAN_MATCHER__NDT_OMP__ESTIMATE_COVARIANCE_HPP_ | ||
#define AUTOWARE__NDT_SCAN_MATCHER__NDT_OMP__ESTIMATE_COVARIANCE_HPP_ | ||
|
||
#include "multigrid_ndt_omp.h" | ||
|
||
#include <Eigen/Core> | ||
|
||
#include <memory> | ||
#include <utility> | ||
#include <vector> | ||
|
||
namespace pclomp | ||
{ | ||
|
||
struct ResultOfMultiNdtCovarianceEstimation | ||
{ | ||
Eigen::Vector2d mean; | ||
Eigen::Matrix2d covariance; | ||
std::vector<Eigen::Matrix4f> ndt_initial_poses; | ||
std::vector<NdtResult> ndt_results; | ||
}; | ||
|
||
/** \brief Estimate functions */ | ||
Eigen::Matrix2d estimate_xy_covariance_by_laplace_approximation( | ||
const Eigen::Matrix<double, 6, 6> & hessian); | ||
ResultOfMultiNdtCovarianceEstimation estimate_xy_covariance_by_multi_ndt( | ||
const NdtResult & ndt_result, | ||
const std::shared_ptr< | ||
pclomp::MultiGridNormalDistributionsTransform<pcl::PointXYZ, pcl::PointXYZ>> & ndt_ptr, | ||
const std::vector<Eigen::Matrix4f> & poses_to_search); | ||
ResultOfMultiNdtCovarianceEstimation estimate_xy_covariance_by_multi_ndt_score( | ||
const NdtResult & ndt_result, | ||
const std::shared_ptr< | ||
pclomp::MultiGridNormalDistributionsTransform<pcl::PointXYZ, pcl::PointXYZ>> & ndt_ptr, | ||
const std::vector<Eigen::Matrix4f> & poses_to_search, const double temperature); | ||
|
||
/** \brief Find rotation matrix aligning covariance to principal axes | ||
* (1) Compute eigenvalues and eigenvectors | ||
* (2) Compute angle for first eigenvector | ||
* (3) Return rotation matrix | ||
*/ | ||
Eigen::Matrix2d find_rotation_matrix_aligning_covariance_to_principal_axes( | ||
const Eigen::Matrix2d & matrix); | ||
|
||
/** \brief Propose poses to search. | ||
* (1) Compute covariance by Laplace approximation | ||
* (2) Find rotation matrix aligning covariance to principal axes | ||
* (3) Propose search points by adding offset_x and offset_y to the center_pose | ||
*/ | ||
std::vector<Eigen::Matrix4f> propose_poses_to_search( | ||
const NdtResult & ndt_result, const std::vector<double> & offset_x, | ||
const std::vector<double> & offset_y); | ||
|
||
/** \brief Calculate weights by exponential */ | ||
std::vector<double> calc_weight_vec(const std::vector<double> & score_vec, double temperature); | ||
|
||
/** \brief Calculate weighted mean and covariance */ | ||
std::pair<Eigen::Vector2d, Eigen::Matrix2d> calculate_weighted_mean_and_cov( | ||
const std::vector<Eigen::Vector2d> & pose_2d_vec, const std::vector<double> & weight_vec); | ||
|
||
/** \brief Rotate covariance to base_link coordinate */ | ||
Eigen::Matrix2d rotate_covariance_to_base_link( | ||
const Eigen::Matrix2d & covariance, const Eigen::Matrix4f & pose); | ||
|
||
/** \brief Rotate covariance to map coordinate */ | ||
Eigen::Matrix2d rotate_covariance_to_map( | ||
const Eigen::Matrix2d & covariance, const Eigen::Matrix4f & pose); | ||
|
||
/** \brief Adjust diagonal covariance */ | ||
Eigen::Matrix2d adjust_diagonal_covariance( | ||
const Eigen::Matrix2d & covariance, const Eigen::Matrix4f & pose, const double fixed_cov00, | ||
const double fixed_cov11); | ||
|
||
} // namespace pclomp | ||
|
||
#endif // AUTOWARE__NDT_SCAN_MATCHER__NDT_OMP__ESTIMATE_COVARIANCE_HPP_ |
Oops, something went wrong.