0

我试图找到激光雷达和相机之间的刚体转换。一旦找到转换为 dx、dy、dz、yaw、pitch、roll (rad),我使用带有启动文件的 ROS 静态转换发布器来发布转换,如下所示:

 <launch>
      <node pkg="tf" type="static_transform_publisher"
            name="transformation_velodyne_to_camera"
            args=" -0.100586794 0.000107629 -0.10208744 -1.51199 0.0741937 -1.59904 velodyne camera 100"/>
</launch>

然后,我听那个变换:

Eigen::Matrix4d mat_velo_to_cam;

geometry_msgs::TransformStamped trans_velo_to_cam;
try {
    trans_velo_to_cam = tfBuffer.lookupTransform("camera", "velodyne", ros::Time::now());

}
catch (tf2::TransformException &ex) {
    ROS_WARN("%s", ex.what());
    ros::Duration(0.1).sleep();
}

Eigen::Affine3d affine_velo_to_cam_ = tf2::transformToEigen(trans_velo_to_cam);
mat_velo_to_cam = affine_velo_to_cam_.matrix();
std::cerr << "Transformation matrix lidar to camera: " << std::endl;
std::cout << mat_velo_to_cam.matrix() << std::endl;

输出是:

Transformation matrix lidar to camera: 
  0.0586108   -0.995525  -0.0741256 -0.00156468
 -0.0325459   0.0723083   -0.996851   -0.105047
    0.99775   0.0608387  -0.0281622   0.0974789
          0           0           0           1
  • 我的第一个问题是为什么翻译值彼此不同?

  • 第二个问题:如果我使用下面的代码从相同的 6DoF 获得 4x4 变换矩阵

      Eigen::Matrix<double,4,4> mat_lidar_to_cam;
      Eigen::AngleAxisd rollAngle(roll, Eigen::Vector3d::UnitX());
      Eigen::AngleAxisd pitchAngle(pitch, Eigen::Vector3d::UnitY());
      Eigen::AngleAxisd yawAngle(yaw, Eigen::Vector3d::UnitZ());
      Eigen::Quaternion<double> q =  yawAngle*pitchAngle*rollAngle;
      Eigen::Matrix3d rotationMatrix = q.matrix();
      mat_lidar_to_cam.topLeftCorner(3,3) = rotationMatrix;
      mat_lidar_to_cam(0,3) = dx;
      mat_lidar_to_cam(1,3) = dy;
      mat_lidar_to_cam(2,3) = dz;
    

输出矩阵为:

 0.0606101 -0.0324357   0.997634       -0.1
 -0.995708    0.06807  0.0627062     0.0001
-0.0699428  -0.997153 -0.0281708     -0.102
         0          0          0          1

在这一点上,即使平移也是正确的,为什么旋转值与 ROS tf static transform publisher 提供的矩阵不同?

4

0 回答 0