根据日志分析,你的问题很明确:
核心问题
MIPI 摄像头左右通道接反了,导致立体匹配算法无法正常工作。
日志中反复出现:
[ERROR] [StereoNetNode]: => top is not left image, please swap the mipi cables, or set the mipi_channel and mipi_channel2 parameters.
解决方案
方案 1:交换 MIPI 通道参数(推荐)
修改启动命令中的 mipi_channel 和 mipi_channel2:
source /opt/tros/humble/setup.bash
ros2 launch hobot_stereonet stereonet_model_web_visual_v2.5_int16_544_448_96.launch.py \
mipi_camera_calibration_file_path:=/opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml \
mipi_image_width:=1280 \
mipi_image_height:=640 \
mipi_image_framerate:=10.0 \
mipi_gdc_enable:=True \
mipi_rotation:=0.0 \
mipi_cal_rotation:=0.0 \
mipi_channel:=0 \
mipi_channel2:=2 \
calib_method:=none
关键修改:将 mipi_channel:=2 和 mipi_channel2:=0 互换
方案 2:物理交换 MIPI 线缆
如果方案 1 无效,可以物理交换两个 MIPI 摄像头的连接线。
关于建模流程
你当前运行的是深度测距程序,不是 3D 建模。完整流程:
- 深度图生成(当前步骤)-
hobot_stereonet - 点云生成 - 已包含在 launch 文件中(
save_pcd_flag:=True) - 3D 建模 - 需要使用点云处理工具(如 CloudCompare、Open3D)
保存的点云文件位置:/home/sunrise/stereonet_result_baseline/
距离不准的调试方法
参考社区相关帖子:RDK-X5 双目深度算法精度差
调试步骤:
- 检查标定文件 - 确保使用正确的相机标定参数
- 验证基线距离 - 日志显示
baseline: 0.079239m(约 8cm),确认与实际硬件一致 - 调整视差范围 - 修改
render_max_disp参数 - 启用滤波 - 设置
speckle_filter_enable:=1和pcl_filter_enable:=1
建议先解决通道接反问题,再测试深度精度。