I'm trying to align two point clouds acquired from a robot with PCL. I compute correspondences and then align them with estimateRigidTransformation
:
pcl::registration::TransformationEstimationSVD<PointT, PointT> transformation;
transformation.estimateRigidTransformation(*source_keypoints, *target_keypoints, *correspondences, correspondence_transformation);
Then I do an ICP refinement:
Eigen::Matrix4f transform;
pcl::IterativeClosestPoint<PointT, PointT> icp;
icp.setMaximumIterations(max_iterations);
TransformationEstimationLM::Ptr transformEst(new TransformationEstimationLM);
icp.setTransformationEstimation(transformEst);
icp.setInputSource(source);
icp.setInputTarget(target);
icp.align(*result);
This works well if the scene is not too cluttered but also often fails and then gives a completely wrong transformation (randomly rotated). Since the point clouds are already aligned with the ground plane and the robot only moves on the ground plane the clouds actually only differ in translation and the y (up) rotation. Is is possible to set this in PCL?