6 #include <Eigen/Geometry>
34 template <
typename TargetPo
intCloud,
typename SourcePo
intCloud,
typename TargetTree,
typename CorrespondenceRejector>
36 const TargetPointCloud& target,
37 const SourcePointCloud& source,
38 const TargetTree& target_tree,
39 const Eigen::Isometry3d& T,
41 const CorrespondenceRejector& rejector,
42 Eigen::Matrix<double, 6, 6>* H,
43 Eigen::Matrix<double, 6, 1>* b,
60 mahalanobis.block<3, 3>(0, 0) = RCR.block<3, 3>(0, 0).inverse();
64 Eigen::Matrix<double, 4, 6> J = Eigen::Matrix<double, 4, 6>::Zero();
66 J.block<3, 3>(0, 3) = -T.linear();
70 *e = 0.5 * residual.transpose() *
mahalanobis * residual;
80 template <
typename TargetPo
intCloud,
typename SourcePo
intCloud>
81 double error(
const TargetPointCloud& target,
const SourcePointCloud& source,
const Eigen::Isometry3d& T)
const {
82 if (
target_index == std::numeric_limits<size_t>::max()) {
88 return 0.5 * residual.transpose() *
mahalanobis * residual;
size_t nearest_neighbor_search(const T &tree, const Eigen::Vector4d &point, size_t *k_index, double *k_sq_dist)
Find the nearest neighbor. If Traits<T>::nearest_neighbor_search is not defined, fallback to knn_sear...
Definition: traits.hpp:44
auto point(const T &points, size_t i)
Get i-th point. 4D vector is used to take advantage of SIMD intrinsics. The last element must be fill...
Definition: traits.hpp:40
auto cov(const T &points, size_t i)
Get i-th covariance. Only the top-left 3x3 matrix is filled, and the bottom row and the right col mus...
Definition: traits.hpp:52
Definition: flat_container.hpp:12
Eigen::Matrix3d skew(const Eigen::Vector3d &x)
Create skew symmetric matrix.
Definition: lie.hpp:13
Definition: gicp_factor.hpp:15
GICP (distribution-to-distribution) per-point error factor.
Definition: gicp_factor.hpp:14
GICPFactor(const Setting &setting=Setting())
Constructor.
Definition: gicp_factor.hpp:18
bool inlier() const
Returns true if this factor is not rejected as an outlier.
Definition: gicp_factor.hpp:92
Eigen::Matrix4d mahalanobis
Fused precision matrix.
Definition: gicp_factor.hpp:96
size_t target_index
Target point index.
Definition: gicp_factor.hpp:94
bool linearize(const TargetPointCloud &target, const SourcePointCloud &source, const TargetTree &target_tree, const Eigen::Isometry3d &T, size_t source_index, const CorrespondenceRejector &rejector, Eigen::Matrix< double, 6, 6 > *H, Eigen::Matrix< double, 6, 1 > *b, double *e)
Linearize the factor.
Definition: gicp_factor.hpp:35
double error(const TargetPointCloud &target, const SourcePointCloud &source, const Eigen::Isometry3d &T) const
Evaluate error.
Definition: gicp_factor.hpp:81
size_t source_index
Source point index.
Definition: gicp_factor.hpp:95