ICP 变换矩阵平移和旋转

ICP transformation matrix translation and rotation

我的车辆配备了不错的 IMU 和声纳。我正在使用点云库线性 ICP 对声纳点云进行精细配准。我想将ICP变换的结果与IMU数据进行比较,但我不明白如何从最终的齐次4x4变换矩阵中提取平移。

类似的 question and other sources 我发现都说翻译只是表格中的第 4 列。

我遇到的问题是我获得的翻译值是不可能的,似乎旋转分量越大,获得的值就越荒谬,这导致我相信我不能简单地提取最后一列.横滚、俯仰和偏航值都在合理范围内且有意义,但在任何方向上都不可能有超过 1 米的偏移量。矩阵在应用时确实按预期执行,所以我知道矩阵是正确的我只是不明白如何解释或提取 x、y、z 线性平移。

测量原始云的质心与最终云的质心之间的距离给出了更合理的结果,但我不知道这是否是一种可接受的方法。看起来有点老套。

代码:

myCloud::Ptr      target, source, output;  // PCL clouds
myPoint           cInit, cRough, cFinal;   // centroid points
Eigen::Matrix4f   estimation, icpResult, finalTransform;   // transforms

// load vectors of sonar data into point clouds
target = pointVector_to_pointCloud(verbose, tgtPoints);
source = pointVector_to_pointCloud(verbose, srcPoints);

pcl::computeCentroid(*source, cInit);

// x, y, z offsets come from a previous rough alignment
Eigen::Affine3f fromIMU(Eigen::Translation3f(x, y, z));
estimation = fromIMU.matrix();
pcl::transformPointCloud(*cloud, *cloud, estimation);

pcl::computeCentroid(*source, cRough);

// create new empty cloud in the output pointer, set up ICP
output.reset(new myCloud);
icp.setInputSource(source);
icp.setInputTarget(target);

/**** Set ICP parameters, omitted ****/

icp.align(*output);
icpResult = icp.getFinalTransformation();
finalTransform = estimation * icpResult;

pcl::computeCentroid(*source, cFinal);

// Output Results
Eigen::Affine3f roughT(estimation);
Eigen::Affine3f fineT(icpResult);
float tx, ty, tz, rx, ry, rz;
pcl::getTranslationAndEulerAngles(roughT, tx, ty, tz, rx, ry, rz);
std::cerr << "********* ICP RESULTS **********\n";
std::cerr << "Rough Transform Matrix:\n" << transform << endl;
std::cerr << "Translation (x, y, z)       : " << tx << ", " << ty << ", " << tz << endl;
std::cerr << "Rotation (roll, pitch, yaw) : " << rx << ", " << ry << ", " << rz << endl;

pcl::getTranslationAndEulerAngles(fineT, tx, ty, tz, rx, ry, rz);
std::cerr << "\nFine Transform Matrix:\n" << icpResult << endl;
std::cerr << "Translation (x, y, z)       : " << tx << ", " << ty << ", " << tz << endl;
std::cerr << "Rotation (roll, pitch, yaw) : " << rx << ", " << ry << ", " << rz << endl << endl;

std::cerr << "\nFinal Transformation Matrix:\n" << finalTransform << endl;

std::cerr << "\n\tCentroid after Rough Alignment: " << cRough << " ... Distance From Start: " << pcl::geometry::distance(cInit, cRough) << endl;
std::cerr << "\tCentroid after ICP: " << cFinal << " ... Distance From Start: " << pcl::geometry::distance(cInit, cFinal) << endl;

哪个输出(对于一个示例数据集):

********* INSIDE ICP TRANSFORM STATS **********
Rough Transform Matrix:
        1         0         0  0.612095
        0         1         0 -0.211855
        0         0         1         0
        0         0         0         1
Translation (x, y, z)       : 0.612095, -0.211855, 0
Rotation (roll, pitch, yaw) : 0, -0, 0

Fine Transform Matrix:
   0.999992 -0.00257317  0.00361636     2.92558
 0.00256172    0.999995  0.00328003     2.66182
-0.00362478 -0.00327113    0.999988   0.0578782
          0           0           0           1
Translation (x, y, z)       : 2.92558, 2.66182, 0.0578782
Rotation (roll, pitch, yaw) : -0.00327116, 0.00362479, 0.00256174

Final Transformation Matrix: 
   0.999992 -0.00257317  0.00361636     3.53767
 0.00256172    0.999995  0.00328003     2.44996
-0.00362478 -0.00327113    0.999988   0.0578782
          0           0           0           1

Centroid after Rough Alignment: (8.8218,9.12704,-807.301 - 0,126,255) ... Distance From Start: 0.647709
Centroid after ICP: (8.8068,9.1658,-807.3 - 0,126,255) ... Distance From Start: 0.621667

这个问题的答案与数据的来源有关。测深数据表示为正数,即海水高于一点的米数。但是采集数据的飞行器在海平面上空10-30米处飞行。

要正确转换数据:

  • 转换为车辆参考系
  • 执行ICP并获得矩阵
  • 如果需要,将数据转换回测深框架

这可能需要额外的车辆数据才能知道如何转换为车辆框架,例如车辆本身的传感器位置和偏移量。

转化为车辆参考系,