Go to the documentation of this file.00001
00024 #ifndef CCNY_RGBD_MOTION_ESTIMATION_ICP_PROB_MODEL_H
00025 #define CCNY_RGBD_MOTION_ESTIMATION_ICP_PROB_MODEL_H
00026
00027 #include <tf/transform_datatypes.h>
00028 #include <pcl_ros/point_cloud.h>
00029 #include <pcl_ros/transforms.h>
00030 #include <pcl/io/pcd_io.h>
00031 #include <pcl/kdtree/kdtree.h>
00032 #include <pcl/registration/transformation_estimation_svd.h>
00033 #include <visualization_msgs/Marker.h>
00034
00035 #include "ccny_rgbd/types.h"
00036 #include "ccny_rgbd/registration/motion_estimation.h"
00037 #include "ccny_rgbd/Save.h"
00038
00039
00040 namespace ccny_rgbd {
00041
00048 class MotionEstimationICPProbModel: public MotionEstimation
00049 {
00050 public:
00051
00052 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00053
00058 MotionEstimationICPProbModel(
00059 const ros::NodeHandle& nh,
00060 const ros::NodeHandle& nh_private);
00061
00064 virtual ~MotionEstimationICPProbModel();
00065
00073 bool getMotionEstimationImpl(
00074 RGBDFrame& frame,
00075 const tf::Transform& prediction,
00076 tf::Transform& motion);
00077
00081 int getModelSize() const { return model_size_; }
00082
00089 bool saveSrvCallback(ccny_rgbd::Save::Request& request,
00090 ccny_rgbd::Save::Response& response);
00091
00092 private:
00093
00094
00095
00096 ros::Publisher model_publisher_;
00097 ros::Publisher covariances_publisher_;
00098 ros::ServiceServer save_service_;
00099
00100
00101
00102 std::string fixed_frame_;
00103 std::string base_frame_;
00104
00105 int max_iterations_;
00106 int min_correspondences_;
00107
00111 int n_nearest_neighbors_;
00112
00117 int max_model_size_;
00118
00119 double tf_epsilon_linear_;
00120 double tf_epsilon_angular_;
00121
00125 double max_assoc_dist_mah_;
00126
00129 double max_corresp_dist_eucl_;
00130
00135 bool publish_model_;
00136
00141 bool publish_model_cov_;
00142
00146 double max_assoc_dist_mah_sq_;
00147
00150 double max_corresp_dist_eucl_sq_;
00151
00152
00153
00154 PointCloudFeature::Ptr model_ptr_;
00155 int model_idx_;
00156 int model_size_;
00157 Vector3fVector means_;
00158 Matrix3fVector covariances_;
00159
00160 KdTree model_tree_;
00161
00162 Matrix3f I_;
00163
00164 tf::Transform f2b_;
00165
00166
00167
00174 bool alignICPEuclidean(
00175 const Vector3fVector& data_means,
00176 tf::Transform& correction);
00177
00183 void getCorrespEuclidean(
00184 const PointCloudFeature& data_cloud,
00185 IntVector& data_indices,
00186 IntVector& model_indices);
00187
00195 bool getNNEuclidean(
00196 const PointFeature& data_point,
00197 int& eucl_nn_idx, double& eucl_dist_sq);
00198
00214 bool getNNMahalanobis(
00215 const Vector3f& data_mean, const Matrix3f& data_cov,
00216 int& mah_nn_idx, double& mah_dist_sq,
00217 IntVector& indices, FloatVector& dists_sq);
00218
00224 void initializeModelFromData(
00225 const Vector3fVector& data_means,
00226 const Matrix3fVector& data_covariances);
00227
00240 void updateModelFromData(const Vector3fVector& data_means,
00241 const Matrix3fVector& data_covariances);
00242
00252 void addToModel(
00253 const Vector3f& data_mean,
00254 const Matrix3f& data_cov);
00255
00258 void publishCovariances();
00259
00266 bool saveModel(const std::string& filename);
00267 };
00268
00269 }
00270
00271 #endif // CCNY_RGBD_MOTION_ESTIMATION_ICP_PROB_MODEL_H
00272