6 #include <Eigen/Geometry>
19 template <
typename TargetPo
intCloud,
typename SourcePo
intCloud,
typename TargetTree,
typename CorrespondenceRejector>
21 const TargetPointCloud& target,
22 const SourcePointCloud& source,
23 const TargetTree& target_tree,
24 const Eigen::Isometry3d& T,
26 const CorrespondenceRejector& rejector,
27 Eigen::Matrix<double, 6, 6>* H,
28 Eigen::Matrix<double, 6, 1>* b,
46 const Eigen::Vector4d err = target_normal.array() * residual.array();
48 Eigen::Matrix<double, 4, 6> J = Eigen::Matrix<double, 4, 6>::Zero();
49 J.block<3, 3>(0, 0) = target_normal.template head<3>().asDiagonal() * T.linear() *
skew(
traits::point(source,
source_index).
template head<3>());
50 J.block<3, 3>(0, 3) = target_normal.template head<3>().asDiagonal() * (-T.linear());
52 *H = J.transpose() * J;
53 *b = J.transpose() * err;
54 *e = 0.5 * err.squaredNorm();
59 template <
typename TargetPo
intCloud,
typename SourcePo
intCloud>
60 double error(
const TargetPointCloud& target,
const SourcePointCloud& source,
const Eigen::Isometry3d& T)
const {
61 if (
target_index == std::numeric_limits<size_t>::max()) {
68 return 0.5 *
error.squaredNorm();
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 normal(const T &points, size_t i)
Get i-th normal. 4D vector is used to take advantage of SIMD intrinsics. The last element must be fil...
Definition: traits.hpp:46
Definition: flat_container.hpp:12
Eigen::Matrix3d skew(const Eigen::Vector3d &x)
Create skew symmetric matrix.
Definition: lie.hpp:13
Definition: plane_icp_factor.hpp:15
Point-to-plane per-point error factor.
Definition: plane_icp_factor.hpp:14
size_t target_index
Definition: plane_icp_factor.hpp:73
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)
Definition: plane_icp_factor.hpp:20
bool inlier() const
Definition: plane_icp_factor.hpp:71
double error(const TargetPointCloud &target, const SourcePointCloud &source, const Eigen::Isometry3d &T) const
Definition: plane_icp_factor.hpp:60
size_t source_index
Definition: plane_icp_factor.hpp:74
PointToPlaneICPFactor(const Setting &setting=Setting())
Definition: plane_icp_factor.hpp:17