NASA Astrobee Robot Software  0.19.1
Flight software for the Astrobee robots operating inside the International Space Station.
transformation_estimation_symmetric_point_to_plane_lls.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2019-, Open Perception, Inc.
6  *
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of the copyright holder(s) nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  */
37 // TODO(rsoussan): Remove this file from repo when PCL updated to version >= 1.10
38 
39 #ifndef POINT_CLOUD_COMMON_TRANSFORMATION_ESTIMATION_SYMMETRIC_POINT_TO_PLANE_LLS_H_
40 #define POINT_CLOUD_COMMON_TRANSFORMATION_ESTIMATION_SYMMETRIC_POINT_TO_PLANE_LLS_H_
41 
42 #include <pcl/registration/transformation_estimation.h>
43 #include <pcl/registration/warp_point_rigid.h>
44 #include <pcl/cloud_iterator.h>
45 
46 #include <vector>
47 
48 namespace pcl {
49 namespace registration {
62 template <typename PointSource, typename PointTarget, typename Scalar = float>
64  : public TransformationEstimation<PointSource, PointTarget, Scalar> {
65  public:
66  using Ptr = boost::shared_ptr<TransformationEstimationSymmetricPointToPlaneLLS2<PointSource, PointTarget, Scalar> >;
67  using ConstPtr =
68  boost::shared_ptr<const TransformationEstimationSymmetricPointToPlaneLLS2<PointSource, PointTarget, Scalar> >;
69 
70  using Matrix4 = typename TransformationEstimation<PointSource, PointTarget, Scalar>::Matrix4;
71  using Vector6 = Eigen::Matrix<Scalar, 6, 1>;
72 
75 
81  inline void estimateRigidTransformation(const pcl::PointCloud<PointSource>& cloud_src,
82  const pcl::PointCloud<PointTarget>& cloud_tgt,
83  Matrix4& transformation_matrix) const override;
84 
91  inline void estimateRigidTransformation(const pcl::PointCloud<PointSource>& cloud_src,
92  const std::vector<int>& indices_src,
93  const pcl::PointCloud<PointTarget>& cloud_tgt,
94  Matrix4& transformation_matrix) const override;
95 
103  inline void estimateRigidTransformation(const pcl::PointCloud<PointSource>& cloud_src,
104  const std::vector<int>& indices_src,
105  const pcl::PointCloud<PointTarget>& cloud_tgt,
106  const std::vector<int>& indices_tgt,
107  Matrix4& transformation_matrix) const override;
108 
115  inline void estimateRigidTransformation(const pcl::PointCloud<PointSource>& cloud_src,
116  const pcl::PointCloud<PointTarget>& cloud_tgt,
117  const pcl::Correspondences& correspondences,
118  Matrix4& transformation_matrix) const override;
119 
124  inline void setEnforceSameDirectionNormals(bool enforce_same_direction_normals);
125 
128  inline bool getEnforceSameDirectionNormals();
129 
130  protected:
136  void estimateRigidTransformation(ConstCloudIterator<PointSource>& source_it,
137  ConstCloudIterator<PointTarget>& target_it, Matrix4& transformation_matrix) const;
138 
144  inline void constructTransformationMatrix(const Vector6& parameters, Matrix4& transformation_matrix) const;
145 
148 };
149 } // namespace registration
150 } // namespace pcl
151 
153 
154 #endif // POINT_CLOUD_COMMON_TRANSFORMATION_ESTIMATION_SYMMETRIC_POINT_TO_PLANE_LLS_H_
pcl
Definition: correspondence_rejection_surface_normal2.h:45
pcl::registration::TransformationEstimationSymmetricPointToPlaneLLS2::ConstPtr
boost::shared_ptr< const TransformationEstimationSymmetricPointToPlaneLLS2< PointSource, PointTarget, Scalar > > ConstPtr
Definition: transformation_estimation_symmetric_point_to_plane_lls.h:68
pcl::registration::TransformationEstimationSymmetricPointToPlaneLLS2::enforce_same_direction_normals_
bool enforce_same_direction_normals_
Whether or not to negate source and/or target normals such that they point in the same direction.
Definition: transformation_estimation_symmetric_point_to_plane_lls.h:147
pcl::registration::TransformationEstimationSymmetricPointToPlaneLLS2::Vector6
Eigen::Matrix< Scalar, 6, 1 > Vector6
Definition: transformation_estimation_symmetric_point_to_plane_lls.h:71
pcl::registration::TransformationEstimationSymmetricPointToPlaneLLS2::~TransformationEstimationSymmetricPointToPlaneLLS2
~TransformationEstimationSymmetricPointToPlaneLLS2()
Definition: transformation_estimation_symmetric_point_to_plane_lls.h:74
pcl::registration::TransformationEstimationSymmetricPointToPlaneLLS2::TransformationEstimationSymmetricPointToPlaneLLS2
TransformationEstimationSymmetricPointToPlaneLLS2()
Definition: transformation_estimation_symmetric_point_to_plane_lls.h:73
pcl::registration::TransformationEstimationSymmetricPointToPlaneLLS2::Matrix4
typename TransformationEstimation< PointSource, PointTarget, Scalar >::Matrix4 Matrix4
Definition: transformation_estimation_symmetric_point_to_plane_lls.h:70
pcl::registration::TransformationEstimationSymmetricPointToPlaneLLS2::setEnforceSameDirectionNormals
void setEnforceSameDirectionNormals(bool enforce_same_direction_normals)
Set whether or not to negate source or target normals on a per-point basis such that they point in th...
Definition: transformation_estimation_symmetric_point_to_plane_lls_impl.h:186
pcl::registration::TransformationEstimationSymmetricPointToPlaneLLS2::constructTransformationMatrix
void constructTransformationMatrix(const Vector6 &parameters, Matrix4 &transformation_matrix) const
Construct a 4 by 4 transformation matrix from the provided rotation and translation.
Definition: transformation_estimation_symmetric_point_to_plane_lls_impl.h:122
transformation_estimation_symmetric_point_to_plane_lls_impl.h
pcl::registration::TransformationEstimationSymmetricPointToPlaneLLS2
TransformationEstimationSymmetricPointToPlaneLLS implements a Linear Least Squares (LLS) approximatio...
Definition: transformation_estimation_symmetric_point_to_plane_lls.h:63
pcl::registration::TransformationEstimationSymmetricPointToPlaneLLS2::getEnforceSameDirectionNormals
bool getEnforceSameDirectionNormals()
Obtain whether source or target normals are negated on a per-point basis such that they point in the ...
Definition: transformation_estimation_symmetric_point_to_plane_lls_impl.h:193
pcl::registration::TransformationEstimationSymmetricPointToPlaneLLS2::estimateRigidTransformation
void estimateRigidTransformation(const pcl::PointCloud< PointSource > &cloud_src, const pcl::PointCloud< PointTarget > &cloud_tgt, Matrix4 &transformation_matrix) const override
Estimate a rigid rotation transformation between a source and a target point cloud using SVD.
Definition: transformation_estimation_symmetric_point_to_plane_lls_impl.h:52
pcl::registration::TransformationEstimationSymmetricPointToPlaneLLS2::Ptr
boost::shared_ptr< TransformationEstimationSymmetricPointToPlaneLLS2< PointSource, PointTarget, Scalar > > Ptr
Definition: transformation_estimation_symmetric_point_to_plane_lls.h:66