132gs 模组双目深度问题

:bullseye: 问题明确:缺少相机标定文件

从截图看,StereoNet 节点已启动并能接收图像,但没有相机标定参数导致无法计算深度。


:white_check_mark: 解决方案

步骤 1:查找官方套件的标定文件

SC132GS 官方套件应该自带标定文件,请执行以下命令查找:

# 1. 检查常见标定文件位置
ls -la /data/camera_calib/
ls -la /userdata/data/camera_calib/
ls -la /opt/tros/humble/lib/mipi_cam/config/

# 2. 全局搜索 yaml 标定文件
find / -name "*.yaml" 2>/dev/null | grep -i calib

# 3. 查找包含 stereo 或 camera 的 yaml 文件
find /opt -name "*.yaml" 2>/dev/null | head -20

步骤 2:检查 camera_info 话题

# 查看是否有 camera_info 话题
ros2 topic list | grep camera_info

# 尝试读取标定参数
ros2 topic echo /image_combine_raw/right/camera_info --once

如果输出为空,说明相机节点没有发布标定信息。

步骤 3:修改 run_stereo.sh 标定配置

# 编辑脚本
vim run_stereo.sh

# 找到标定相关配置(约 30-60 行),修改为:
calib_method="ros"
# 或
calib_method="file"
stereo_calib_file_path="/data/camera_calib/sc132gs_calib.yaml"

# 确保 render_type 是字符串格式
render_type="distance"

步骤 4:如果没有标定文件,创建临时标定

临时测试用(精度不高,但能验证流程):

# 创建临时标定文件
cat > /tmp/temp_calib.yaml << 'EOF'
%YAML:1.0
camera_matrix_1:
   rows: 3
   cols: 3
   data: [640.0, 0.0, 640.0, 0.0, 640.0, 544.0, 0.0, 0.0, 1.0]
distortion_1:
   rows: 1
   cols: 5
   data: [0.0, 0.0, 0.0, 0.0, 0.0]
camera_matrix_2:
   rows: 3
   cols: 3
   data: [640.0, 0.0, 640.0, 0.0, 640.0, 544.0, 0.0, 0.0, 1.0]
distortion_2:
   rows: 1
   cols: 5
   data: [0.0, 0.0, 0.0, 0.0, 0.0]
rectification_1:
   rows: 3
   cols: 3
   data: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
rectification_2:
   rows: 3
   cols: 3
   data: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
projection_1:
   rows: 3
   cols: 4
   data: [640.0, 0.0, 640.0, 0.0, 0.0, 640.0, 544.0, 0.0, 0.0, 0.0, 1.0, 0.0]
projection_2:
   rows: 3
   cols: 4
   data: [640.0, 0.0, 640.0, 40.0, 0.0, 640.0, 544.0, 0.0, 0.0, 0.0, 1.0, 0.0]
baseline: 0.06
EOF

# 使用临时标定文件运行
bash run_stereo.sh --stereonet_version v2.4 --calib_file /tmp/temp_calib.yaml

请补充以下诊断信息

# 1. 标定文件搜索结果
find / -name "*.yaml" 2>/dev/null | grep -i calib

# 2. camera_info 话题状态
ros2 topic list | grep camera_info

# 3. run_stereo.sh 中的标定配置
grep -E "calib|camera_info|render_type" run_stereo.sh | head -20

相关参考

优先执行步骤 1 查找标定文件,官方套件应该自带标定文件,找到后指定正确路径即可解决!