icp_registration.h
Go to the documentation of this file.
1 // -*- mode: c++ -*-
2 /*********************************************************************
3  * Software License Agreement (BSD License)
4  *
5  * Copyright (c) 2014, JSK Lab
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/o2r other materials provided
17  * with the distribution.
18  * * Neither the name of the JSK Lab nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *********************************************************************/
35 
36 
37 #ifndef JSK_PCL_ROS_ICP_REGISTRATION_H_
38 #define JSK_PCL_ROS_ICP_REGISTRATION_H_
39 
40 #include <pcl_ros/pcl_nodelet.h>
41 #include <dynamic_reconfigure/server.h>
42 #include <jsk_pcl_ros/ICPRegistrationConfig.h>
43 #include <jsk_recognition_msgs/BoundingBox.h>
44 #include <jsk_recognition_msgs/ICPAlignWithBox.h>
45 #include <jsk_recognition_msgs/ICPAlign.h>
46 #include <jsk_recognition_msgs/ICPResult.h>
52 #include <jsk_recognition_msgs/PointsArray.h>
53 #include <sensor_msgs/CameraInfo.h>
55 #include <std_msgs/Float32.h>
56 
57 namespace jsk_pcl_ros
58 {
60  {
61  public:
62  typedef pcl::PointXYZRGBNormal PointT;
63  typedef jsk_pcl_ros::ICPRegistrationConfig Config;
65  sensor_msgs::PointCloud2,
66  jsk_recognition_msgs::BoundingBox > SyncPolicy;
68  sensor_msgs::PointCloud2,
69  geometry_msgs::PoseStamped > OffsetSyncPolicy;
71  sensor_msgs::PointCloud2,
72  sensor_msgs::PointCloud2
74  ICPRegistration(): timer_(10), done_init_(false) { }
75  protected:
77  // methosd
79  virtual void onInit();
80  virtual void align(const sensor_msgs::PointCloud2::ConstPtr& msg);
81  virtual void align(const sensor_msgs::PointCloud2::ConstPtr& msg,
82  const sensor_msgs::PointCloud2::ConstPtr& reference_msg);
83  virtual void alignWithBox(
84  const sensor_msgs::PointCloud2::ConstPtr& msg,
85  const jsk_recognition_msgs::BoundingBox::ConstPtr& box_msg);
86  virtual void alignWithOffset(
87  const sensor_msgs::PointCloud2::ConstPtr& msg,
88  const geometry_msgs::PoseStamped::ConstPtr& pose_msg);
89  virtual bool alignWithBoxService(
90  jsk_recognition_msgs::ICPAlignWithBox::Request& req,
91  jsk_recognition_msgs::ICPAlignWithBox::Response& res);
92  virtual bool alignService(
93  jsk_recognition_msgs::ICPAlign::Request& req,
94  jsk_recognition_msgs::ICPAlign::Response& res);
95  virtual void referenceCallback(
96  const sensor_msgs::PointCloud2::ConstPtr& msg);
97  virtual void referenceArrayCallback(
98  const jsk_recognition_msgs::PointsArray::ConstPtr& msg);
99  virtual void referenceAddCallback(
100  const sensor_msgs::PointCloud2::ConstPtr& msg);
101  virtual void configCallback (Config &config, uint32_t level);
102  virtual void publishDebugCloud(
104  const pcl::PointCloud<PointT>& cloud,
105  const std_msgs::Header& header);
106  virtual double alignPointcloud(
107  pcl::PointCloud<PointT>::Ptr& cloud,
108  pcl::PointCloud<PointT>::Ptr& reference,
109  const Eigen::Affine3f& offset,
110  pcl::PointCloud<PointT>::Ptr& output_cloud,
111  Eigen::Affine3d& output_transform);
112  virtual double alignPointcloudWithICP(
113  pcl::PointCloud<PointT>::Ptr& cloud,
114  pcl::PointCloud<PointT>::Ptr& reference,
115  const Eigen::Affine3f& offset,
116  pcl::PointCloud<PointT>::Ptr& output_cloud,
117  Eigen::Affine3d& output_transform);
118  virtual double alignPointcloudWithNDT(
119  pcl::PointCloud<PointT>::Ptr& cloud,
120  pcl::PointCloud<PointT>::Ptr& reference,
121  const Eigen::Affine3f& offset,
122  pcl::PointCloud<PointT>::Ptr& output_cloud,
123  Eigen::Affine3d& output_transform);
124  virtual jsk_recognition_msgs::ICPResult alignPointcloudWithReferences(
125  pcl::PointCloud<PointT>::Ptr& cloud,
126  const Eigen::Affine3f& offset,
127  const std_msgs::Header& header);
128  virtual double scorePointcloudAlignment(
129  pcl::PointCloud<PointT>::Ptr& cloud,
130  pcl::PointCloud<PointT>::Ptr& reference,
131  const Eigen::Affine3f& offset,
132  Eigen::Affine3f& offset_result,
133  pcl::PointCloud<PointT>::Ptr transformed_cloud,
134  Eigen::Affine3d& transform_result);
135  virtual void cameraInfoCallback(
136  const sensor_msgs::CameraInfo::ConstPtr& msg);
137  virtual void subscribe();
138  virtual void unsubscribe();
139 
141  // ROS variables
172 
183 
190 
192  // parameters for ICP
198  std::vector<pcl::PointCloud<PointT>::Ptr> reference_cloud_list_;
205  sensor_msgs::CameraInfo::ConstPtr camera_info_msg_;
206 
208  // parameters for GICP
213 
215  // parameters for NDT
220 
222  private:
223 
224  };
225 }
226 
227 #endif
jsk_recognition_msgs::BoundingBoxArray::ConstPtr box_msg
virtual double alignPointcloudWithICP(pcl::PointCloud< PointT >::Ptr &cloud, pcl::PointCloud< PointT >::Ptr &reference, const Eigen::Affine3f &offset, pcl::PointCloud< PointT >::Ptr &output_cloud, Eigen::Affine3d &output_transform)
virtual bool alignService(jsk_recognition_msgs::ICPAlign::Request &req, jsk_recognition_msgs::ICPAlign::Response &res)
bool use_normal_
Store value of ~use_normal. If this parameter is true, ICPRegistration nodelet expects reference and ...
ros::Subscriber sub_reference_array_
message_filters::sync_policies::ExactTime< sensor_msgs::PointCloud2, sensor_msgs::PointCloud2 > ReferenceSyncPolicy
virtual double scorePointcloudAlignment(pcl::PointCloud< PointT >::Ptr &cloud, pcl::PointCloud< PointT >::Ptr &reference, const Eigen::Affine3f &offset, Eigen::Affine3f &offset_result, pcl::PointCloud< PointT >::Ptr transformed_cloud, Eigen::Affine3d &transform_result)
virtual void publishDebugCloud(ros::Publisher &pub, const pcl::PointCloud< PointT > &cloud, const std_msgs::Header &header)
ros::Publisher pub_debug_flipped_cloud_
message_filters::sync_policies::ExactTime< sensor_msgs::PointCloud2, jsk_recognition_msgs::BoundingBox > SyncPolicy
config
virtual void alignWithOffset(const sensor_msgs::PointCloud2::ConstPtr &msg, const geometry_msgs::PoseStamped::ConstPtr &pose_msg)
tf::TransformListener * tf_listener_
ros::Publisher pub_debug_target_cloud_
virtual void align(const sensor_msgs::PointCloud2::ConstPtr &msg)
ros::ServiceServer srv_icp_align_
boost::shared_ptr< dynamic_reconfigure::Server< Config > > srv_
ros::Publisher pub_debug_result_cloud_
sensor_msgs::CameraInfo::ConstPtr camera_info_msg_
virtual void cameraInfoCallback(const sensor_msgs::CameraInfo::ConstPtr &msg)
message_filters::Subscriber< sensor_msgs::PointCloud2 > sub_input_
boost::shared_ptr< message_filters::Synchronizer< ReferenceSyncPolicy > > sync_reference_
boost::shared_ptr< message_filters::Synchronizer< SyncPolicy > > sync_
message_filters::Subscriber< jsk_recognition_msgs::BoundingBox > sub_box_
pcl::PointXYZRGBNormal PointT
jsk_recognition_utils::WallDurationTimer timer_
virtual void referenceCallback(const sensor_msgs::PointCloud2::ConstPtr &msg)
virtual double alignPointcloudWithNDT(pcl::PointCloud< PointT >::Ptr &cloud, pcl::PointCloud< PointT >::Ptr &reference, const Eigen::Affine3f &offset, pcl::PointCloud< PointT >::Ptr &output_cloud, Eigen::Affine3d &output_transform)
message_filters::Subscriber< geometry_msgs::PoseStamped > sub_offset_
virtual void configCallback(Config &config, uint32_t level)
boost::mutex mutex
global mutex.
ros::Publisher pub_debug_source_cloud_
virtual jsk_recognition_msgs::ICPResult alignPointcloudWithReferences(pcl::PointCloud< PointT >::Ptr &cloud, const Eigen::Affine3f &offset, const std_msgs::Header &header)
virtual void referenceArrayCallback(const jsk_recognition_msgs::PointsArray::ConstPtr &msg)
virtual void referenceAddCallback(const sensor_msgs::PointCloud2::ConstPtr &msg)
std::vector< pcl::PointCloud< PointT >::Ptr > reference_cloud_list_
bool use_offset_pose_
set via ~use_offset_pose parameter. default is false.
message_filters::Subscriber< sensor_msgs::PointCloud2 > sub_sync_input_
boost::shared_ptr< message_filters::Synchronizer< OffsetSyncPolicy > > sync_offset_
virtual bool alignWithBoxService(jsk_recognition_msgs::ICPAlignWithBox::Request &req, jsk_recognition_msgs::ICPAlignWithBox::Response &res)
ros::ServiceServer srv_icp_align_with_box_
message_filters::Subscriber< sensor_msgs::PointCloud2 > sub_sync_reference_
cloud
bool transform_3dof_
set via ~transform_3dof parameter. default is false.
virtual void alignWithBox(const sensor_msgs::PointCloud2::ConstPtr &msg, const jsk_recognition_msgs::BoundingBox::ConstPtr &box_msg)
message_filters::sync_policies::ExactTime< sensor_msgs::PointCloud2, geometry_msgs::PoseStamped > OffsetSyncPolicy
jsk_pcl_ros::ICPRegistrationConfig Config
virtual double alignPointcloud(pcl::PointCloud< PointT >::Ptr &cloud, pcl::PointCloud< PointT >::Ptr &reference, const Eigen::Affine3f &offset, pcl::PointCloud< PointT >::Ptr &output_cloud, Eigen::Affine3d &output_transform)


jsk_pcl_ros
Author(s): Yohei Kakiuchi
autogenerated on Mon May 3 2021 03:03:46