Skip to content

Commit c1329e8

Browse files
committed
Fix ICP viewpoint adaptation issue by aligning sensor coordinates
1 parent d3769b1 commit c1329e8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

registration/include/pcl/registration/impl/registration.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,21 @@ Registration<PointSource, PointTarget, Scalar>::align(PointCloudSource& output,
213213

214214
computeTransformation(output, guess);
215215

216+
// The resulting point cloud 'output' is aligned with the input_ point cloud in terms of point values,
217+
// but coordinate frames have not been taken into account.
218+
// In other words, the 'output' is still expressed in the coordinate frame of the input_ sensor.
219+
// to resolve this , we can simply reassign the sensor_origin_ and sensor_orientation_ of the output cloud to the target cloud.
220+
221+
if (input_->sensor_orientation_!= target_->sensor_orientation_ || input_->sensor_origin_ != target_->sensor_origin_) {
222+
output.sensor_orientation_ = target_->sensor_orientation_;
223+
output.sensor_origin_ = target_->sensor_origin_;
224+
225+
PCL_WARN("[pcl::%s::align] The sensor_origin_ and sensor_orientation_ of the source and target clouds differ.\n"
226+
" The output cloud will remain in the source sensor's coordinate frame.\n"
227+
" Original sensor-to-sensor relative pose information may be lost.\n",
228+
getClassName().c_str());
229+
}
230+
216231
deinitCompute();
217232
}
218233

0 commit comments

Comments
 (0)