/usr/include/pcl-1.7/pcl/registration/elch.h is in libpcl-dev 1.7.2-14build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | /*
* Software License Agreement (BSD License)
*
* Point Cloud Library (PCL) - www.pointclouds.org
* Copyright (c) 2011, Willow Garage, Inc.
* Copyright (c) 2012-, Open Perception, Inc.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * 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.
* * Neither the name of the copyright holder(s) nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 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 OWNER 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.
*
* $Id$
*
*/
#ifndef PCL_ELCH_H_
#define PCL_ELCH_H_
#include <pcl/pcl_base.h>
#include <pcl/point_types.h>
#include <pcl/point_cloud.h>
#include <pcl/registration/registration.h>
#include <pcl/registration/boost.h>
#include <pcl/registration/eigen.h>
#include <pcl/registration/icp.h>
#include <pcl/registration/boost_graph.h>
namespace pcl
{
namespace registration
{
/** \brief @b ELCH (Explicit Loop Closing Heuristic) class
* \author Jochen Sprickerhof
* \ingroup registration
*/
template <typename PointT>
class ELCH : public PCLBase<PointT>
{
public:
typedef boost::shared_ptr< ELCH<PointT> > Ptr;
typedef boost::shared_ptr< const ELCH<PointT> > ConstPtr;
typedef pcl::PointCloud<PointT> PointCloud;
typedef typename PointCloud::Ptr PointCloudPtr;
typedef typename PointCloud::ConstPtr PointCloudConstPtr;
struct Vertex
{
Vertex () : cloud () {}
PointCloudPtr cloud;
Eigen::Affine3f transform;
};
/** \brief graph structure to hold the SLAM graph */
typedef boost::adjacency_list<
boost::listS, boost::eigen_vecS, boost::undirectedS,
Vertex,
boost::no_property>
LoopGraph;
typedef boost::shared_ptr< LoopGraph > LoopGraphPtr;
typedef typename pcl::Registration<PointT, PointT> Registration;
typedef typename Registration::Ptr RegistrationPtr;
typedef typename Registration::ConstPtr RegistrationConstPtr;
/** \brief Empty constructor. */
ELCH () :
loop_graph_ (new LoopGraph),
loop_start_ (0),
loop_end_ (0),
reg_ (new pcl::IterativeClosestPoint<PointT, PointT>),
loop_transform_ (),
compute_loop_ (true),
vd_ ()
{};
/** \brief Empty destructor */
virtual ~ELCH () {}
/** \brief Add a new point cloud to the internal graph.
* \param[in] cloud the new point cloud
*/
inline void
addPointCloud (PointCloudPtr cloud)
{
typename boost::graph_traits<LoopGraph>::vertex_descriptor vd = add_vertex (*loop_graph_);
(*loop_graph_)[vd].cloud = cloud;
if (num_vertices (*loop_graph_) > 1)
add_edge (vd_, vd, *loop_graph_);
vd_ = vd;
}
/** \brief Getter for the internal graph. */
inline LoopGraphPtr
getLoopGraph ()
{
return (loop_graph_);
}
/** \brief Setter for a new internal graph.
* \param[in] loop_graph the new graph
*/
inline void
setLoopGraph (LoopGraphPtr loop_graph)
{
loop_graph_ = loop_graph;
}
/** \brief Getter for the first scan of a loop. */
inline typename boost::graph_traits<LoopGraph>::vertex_descriptor
getLoopStart ()
{
return (loop_start_);
}
/** \brief Setter for the first scan of a loop.
* \param[in] loop_start the scan that starts the loop
*/
inline void
setLoopStart (const typename boost::graph_traits<LoopGraph>::vertex_descriptor &loop_start)
{
loop_start_ = loop_start;
}
/** \brief Getter for the last scan of a loop. */
inline typename boost::graph_traits<LoopGraph>::vertex_descriptor
getLoopEnd ()
{
return (loop_end_);
}
/** \brief Setter for the last scan of a loop.
* \param[in] loop_end the scan that ends the loop
*/
inline void
setLoopEnd (const typename boost::graph_traits<LoopGraph>::vertex_descriptor &loop_end)
{
loop_end_ = loop_end;
}
/** \brief Getter for the registration algorithm. */
inline RegistrationPtr
getReg ()
{
return (reg_);
}
/** \brief Setter for the registration algorithm.
* \param[in] reg the registration algorithm used to compute the transformation between the start and the end of the loop
*/
inline void
setReg (RegistrationPtr reg)
{
reg_ = reg;
}
/** \brief Getter for the transformation between the first and the last scan. */
inline Eigen::Matrix4f
getLoopTransform ()
{
return (loop_transform_);
}
/** \brief Setter for the transformation between the first and the last scan.
* \param[in] loop_transform the transformation between the first and the last scan
*/
inline void
setLoopTransform (const Eigen::Matrix4f &loop_transform)
{
loop_transform_ = loop_transform;
compute_loop_ = false;
}
/** \brief Computes new poses for all point clouds by closing the loop
* between start and end point cloud. This will transform all given point
* clouds for now!
*/
void
compute ();
protected:
using PCLBase<PointT>::deinitCompute;
/** \brief This method should get called before starting the actual computation. */
virtual bool
initCompute ();
private:
/** \brief graph structure for the internal optimization graph */
typedef boost::adjacency_list<
boost::listS, boost::vecS, boost::undirectedS,
boost::no_property,
boost::property< boost::edge_weight_t, double > >
LOAGraph;
/**
* graph balancer algorithm computes the weights
* @param[in] g the graph
* @param[in] f index of the first node
* @param[in] l index of the last node
* @param[out] weights array for the weights
*/
void
loopOptimizerAlgorithm (LOAGraph &g, double *weights);
/** \brief The internal loop graph. */
LoopGraphPtr loop_graph_;
/** \brief The first scan of the loop. */
typename boost::graph_traits<LoopGraph>::vertex_descriptor loop_start_;
/** \brief The last scan of the loop. */
typename boost::graph_traits<LoopGraph>::vertex_descriptor loop_end_;
/** \brief The registration object used to close the loop. */
RegistrationPtr reg_;
/** \brief The transformation between that start and end of the loop. */
Eigen::Matrix4f loop_transform_;
bool compute_loop_;
/** \brief previously added node in the loop_graph_. */
typename boost::graph_traits<LoopGraph>::vertex_descriptor vd_;
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
}
}
#include <pcl/registration/impl/elch.hpp>
#endif // PCL_ELCH_H_
|