已解决,实际上是由于相机内参标定的问题,看了代码,Astra s相机内部默认使用了理想情况下针孔相机模型进行标定,默认没有坐标偏位,且fx=fy,这里由于我也是初学者,不是很了解(其实就相当于没有标定),此部分相关源代码如下所示:
//以下为默认理想情况下相机内参计算方法,对于针孔相机模型,默认没有偏移,cx=cy=0,fx=fy,实际上这里发现投影矩阵p标定后差异较大
// No distortion
info->d.resize(5, 0.0);
info->distortion_model = sensor_msgs::distortion_models::PLUMB_BOB;
// Simple camera matrix: square pixels (fx = fy), principal point at center
info->k.fill(0.0);
info->k[0] = info->k[4] = f;
info->k[2] = (static_cast<double>(width) / 2) - 0.5;
// Aspect ratio for the camera center on Astra (and other devices?) is 4/3
// This formula keeps the principal point the same in VGA and SXGA modes
info->k[5] = (static_cast<double>(width) * (3. / 8.)) - 0.5;
info->k[8] = 1.0;
// No separate rectified image plane, so R = I
info->r[0] = info->r[4] = info->r[8] = 1.0;
// Then P=K(I|0) = (K|0)
info->p.fill(0.0);
info->p[0] = info->p[5] = f; // fx, fy
info->p[2] = info->p[2]; // cx
info->p[6] = info->p[5]; // cy
info->p[10] = 1.0;
后续要先进行相机标定,使用camera-calibration标定相机后,修改参数
rtabmap的视觉里程计即可正常运行