root@ubuntu:~# ros2 topic echo /image_combine_raw/right/camera_info --once
WARNING: topic [/image_combine_raw/right/camera_info] does not appear to be published yet
Could not determine the type for the passed topic
root@ubuntu:~# ros2 topic list | grep depth
root@ubuntu:~# ros2 topic hz /StereoNetNode/stereonet_depth
WARNING: topic [/StereoNetNode/stereonet_depth] does not appear to be published yet
^Croot@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# cd /userdata/data/e
-bash: cd: /userdata/data/e: No such file or directory
root@ubuntu:~# cd /userdata/data/test/
root@ubuntu:/userdata/data/test# grep -E “codec|websocket|jpeg” run_stereo.sh
codec_sub_topic=/$stereo_node_name/stereonet_visual
codec_in_format=bgr8
codec_pub_topic=/image_jpeg
websocket_image_topic=/image_jpeg
websocket_channel=0
–codec_sub_topic) codec_sub_topic=$2; shift 2 ;;
–codec_in_format) codec_in_format=$2; shift 2 ;;
–codec_pub_topic) codec_pub_topic=$2; shift 2 ;;
–websocket_image_topic) websocket_image_topic=$2; shift 2 ;;
–websocket_channel) websocket_channel=$2; shift 2 ;;
stereonet_pub_web:=$stereonet_pub_web codec_sub_topic:=$codec_sub_topic codec_in_format:=$codec_in_format
codec_pub_topic:=$codec_pub_topic websocket_image_topic:=$websocket_image_topic websocket_channel:=$websocket_channel
root@ubuntu:/userdata/data/test#
问题根因:camera_info 话题未发布
从最新诊断看,StereoNet 节点无法发布深度数据的根本原因是:
WARNING: topic [/image_combine_raw/right/camera_info] does not appear to be published yet
WARNING: topic [/StereoNetNode/stereonet_depth] does not appear to be published yet
相机节点没有发布 camera_info,导致 StereoNet 无法获取标定参数,深度计算失败。
解决方案(按优先级尝试)
方案 1:检查 mipi_cam 是否发布 camera_info
# 1. 单独运行相机节点
bash run_cam.sh --rotation 90.0 --log_level INFO
# 2. 新开终端检查话题
ros2 topic list | grep camera_info
如果还是没有 camera_info,说明 mipi_cam 配置问题。
方案 2:使用文件标定模式(推荐)
既然 ROS 话题方式不发布 camera_info,改用文件标定:
# 1. 编辑 run_stereo.sh
vim run_stereo.sh
# 2. 修改标定配置(约 35-40 行)
calib_method="file"
stereo_calib_file_path="/opt/tros/humble/lib/mipi_cam/config/SC230ai_dual_calibration.yaml"
# 3. 保存后运行
bash run_stereo.sh --stereonet_version v2.4
方案 3:创建 SC132GS 专用标定文件
参考 SC230ai 格式,创建 SC132GS 标定文件:
# 1. 查看 SC230ai 标定文件格式
cat /opt/tros/humble/lib/mipi_cam/config/SC230ai_dual_calibration.yaml
# 2. 复制创建 SC132GS 标定文件
cp /opt/tros/humble/lib/mipi_cam/config/SC230ai_dual_calibration.yaml \
/opt/tros/humble/lib/mipi_cam/config/SC132GS_calibration.yaml
# 3. 修改 run_stereo.sh 使用新文件
vim run_stereo.sh
# 修改为:
calib_method="file"
stereo_calib_file_path="/opt/tros/humble/lib/mipi_cam/config/SC132GS_calibration.yaml"
方案 4:检查 mipi_cam 配置参数
# 查看 mipi_cam 节点参数
ros2 param dump /mipi_cam 2>/dev/null | grep -i calib
# 或查看启动参数
grep -E "camera_info|calibration" run_cam.sh
可能需要启用相机标定参数发布功能。
完整诊断命令
请执行以下命令,把输出补充到帖子:
# 1. 单独运行相机,检查 camera_info
bash run_cam.sh --rotation 90.0 --log_level INFO &
sleep 5
ros2 topic list | grep camera_info
# 2. 查看 SC230ai 标定文件格式
cat /opt/tros/humble/lib/mipi_cam/config/SC230ai_dual_calibration.yaml
# 3. 检查 run_stereo.sh 当前标定配置
grep -E "calib_method|stereo_calib_file_path|render_type" run_stereo.sh
# 4. 系统版本确认
cat /etc/issue
相关参考
- 132GS MIPI 双目相机如何自行标定 - 标定文件详细格式
- 基于官方 132GS MIPI 双目相机运行双目 Demo 报错 - 同类问题完整解决
- RDK-X5 双目深度算法 hobot_stereonet 精度差 - 标定参数配置详解
临时测试
如果急需验证流程,可以先用离线图片测试:
# 使用离线模式(不需要实时相机)
bash run_stereo.sh --stereonet_version v2.4 --calib_method file --stereo_calib_file_path /opt/tros/humble/lib/mipi_cam/config/SC230ai_dual_calibration.yaml
优先尝试方案 2,直接用文件标定模式绕过 camera_info 话题问题。把诊断结果补充到帖子,可以帮你更精准定位!
root@ubuntu:~# ros2 topic list | grep camera_info
root@ubuntu:~#
根因确认:camera_info 话题缺失
ros2 topic list | grep camera_info 无输出,说明 mipi_cam 节点没有发布标定信息,这是 StereoNet 无法输出深度的根本原因。
最终解决方案(文件标定模式)
既然 ROS 话题方式不发布 camera_info,必须使用文件标定模式:
步骤 1:修改 run_stereo.sh 标定配置
# 编辑脚本
vim run_stereo.sh
# 找到标定配置部分(约 35-45 行),修改为:
# ❌ 原配置
calib_method=none
stereo_calib_file_path=calib.yaml
# ✅ 新配置(使用 SC230ai 标定文件临时替代)
calib_method="file"
stereo_calib_file_path="/opt/tros/humble/lib/mipi_cam/config/SC230ai_dual_calibration.yaml"
步骤 2:清理残留进程后重新运行
# 清理进程
killall mipi_cam stereonet_model_node hobot_codec_republish 2>/dev/null
sleep 2
# 重新运行
bash run_stereo.sh --stereonet_version v2.4
步骤 3:验证深度话题是否发布
# 新开终端检查
ros2 topic list | grep depth
ros2 topic hz /StereoNetNode/stereonet_depth
如果上述方案无效:创建 SC132GS 标定文件
参考 SC230ai 格式创建专用标定文件:
# 1. 查看 SC230ai 标定文件格式
cat /opt/tros/humble/lib/mipi_cam/config/SC230ai_dual_calibration.yaml
# 2. 复制创建 SC132GS 标定文件
cp /opt/tros/humble/lib/mipi_cam/config/SC230ai_dual_calibration.yaml \
/opt/tros/humble/lib/mipi_cam/config/SC132GS_calibration.yaml
# 3. 修改 run_stereo.sh 使用新文件
vim run_stereo.sh
# 修改为:
calib_method="file"
stereo_calib_file_path="/opt/tros/humble/lib/mipi_cam/config/SC132GS_calibration.yaml"
完整诊断信息(请补充到帖子)
# 1. 查看 SC230ai 标定文件内容
cat /opt/tros/humble/lib/mipi_cam/config/SC230ai_dual_calibration.yaml
# 2. 确认 run_stereo.sh 当前标定配置
grep -E "calib_method|stereo_calib_file_path|render_type" run_stereo.sh
# 3. 系统版本
cat /etc/issue
# 4. StereoNet 版本
apt list --installed | grep hobot_stereonet
相关参考
- 132GS MIPI 双目相机如何自行标定 - 标定文件格式详解
- 基于官方 132GS MIPI 双目相机运行双目 Demo 报错 - 同类问题完整解决
关键提示
| 问题 | 原因 | 解决 |
|---|---|---|
| camera_info 话题缺失 | mipi_cam 未配置标定文件 | 使用 calib_method="file" |
| 深度话题无输出 | StereoNet 缺少标定参数 | 指定有效标定文件路径 |
| 深度精度差 | 标定参数不匹配 | 联系供应商获取 SC132GS 专用标定文件 |
优先执行步骤 1+2,使用文件标定模式应该能解决深度输出问题。如果还有问题,请把诊断命令的输出补充到帖子!
R: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [0.9999771405493721, -0.0008865181729254466, -0.006703168223329922,
0.000844157865516232, 0.9999796745904039, -0.006319636347751682,
0.006708634451158759, 0.006313833352156998, 0.9999575639656925]
T: !!opencv-matrix
rows: 3
cols: 1
dt: d
data: [-0.06981825961809152, -0.00031854332254735906, -3.61077528349911e-05]
root@ubuntu:/userdata/data/test# grep -E “calib_method|stereo_calib_file_path|render_type” run_stereo.sh
calib_method=“file”
stereo_calib_file_path=“/opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml”
render_type=“distance”
–calib_method) calib_method=$2; shift 2 ;;
–stereo_calib_file_path) stereo_calib_file_path=$2; shift 2 ;;
–render_type) render_type=$2; shift 2 ;;
calib_method:=$calib_method stereo_calib_file_path:=$stereo_calib_file_path
render_type:=$render_type render_perf:=$render_perf render_max_disp:=$render_max_disp render_z_near:=$render_z_near render_z_range:=$render_z_range
root@ubuntu:/userdata/data/test# cat /etc/issue
Ubuntu 22.04.5 LTS \n \l
root@ubuntu:/userdata/data/test# apt list --installed | grep hobot_stereonet
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
进展分析:配置已正确,需验证运行状态
从你的信息看,配置已经正确:
calib_method="file"- 使用文件标定模式
stereo_calib_file_path指向 SC132gs 标定文件
render_type="distance"- 字符串格式正确
标定文件内容有效(R 矩阵 + T 向量)
hobot_stereonet 输出为空说明是通过其他方式安装的(可能是镜像自带),不影响使用。
验证步骤(请按顺序执行)
步骤 1:确认标定文件存在
# 检查标定文件是否真的存在
ls -la /opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml
# 查看文件大小(应该大于 0)
wc -l /opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml
步骤 2:重新运行并捕获完整日志
# 清理残留进程
killall mipi_cam stereonet_model_node hobot_codec_republish websocket 2>/dev/null
sleep 3
# 运行并保存日志
bash run_stereo.sh --stereonet_version v2.4 2>&1 | tee stereo_test.log
# 等待 30 秒后按 Ctrl+C
步骤 3:检查深度话题
# 新开终端检查
ros2 topic list | grep -E "depth|stereo"
ros2 topic hz /StereoNetNode/stereonet_depth
如果深度话题仍无输出
查看日志中的关键错误:
# 搜索 ERROR 和 WARN
grep -E "ERROR|WARN|Failed" stereo_test.log | tail -30
# 特别关注 StereoNetNode 的初始化信息
grep -A5 "init StereoNetNode" stereo_test.log
常见原因排查
| 问题 | 检查命令 | 解决方案 |
|---|---|---|
| 标定文件路径错误 | ls -la /opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml |
确认文件存在 |
| 标定文件格式错误 | cat /opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml |
参考 SC230ai 格式 |
| 相机分辨率不匹配 | `grep -E "image_width | image_height" run_stereo.sh` |
| StereoNet 节点崩溃 | grep "process has died" stereo_test.log |
查看崩溃原因 |
临时测试:使用 SC230ai 标定文件
如果 SC132gs 标定文件有问题,临时用 SC230ai 测试:
# 修改配置
vim run_stereo.sh
# 改为:
stereo_calib_file_path="/opt/tros/humble/lib/mipi_cam/config/SC230ai_dual_calibration.yaml"
# 重新运行
bash run_stereo.sh --stereonet_version v2.4
请补充以下信息
# 1. 标定文件是否存在
ls -la /opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml
# 2. 运行日志中的关键错误
grep -E "ERROR|stereonet_depth" stereo_test.log | tail -20
# 3. 当前话题列表
ros2 topic list | grep -E "depth|stereo|camera_info"
把这些输出补充到帖子,可以帮你精准定位最后的问题!
相关参考
- 132GS MIPI 双目相机如何自行标定 - 标定文件格式详解
- 基于官方 132GS MIPI 双目相机运行双目 Demo 报错 - 完整解决案例
配置已经正确,现在需要确认标定文件是否真的能被 StereoNet 读取。请执行上面的验证命令!
root@ubuntu:~# ros2 topic hz /StereoNetNode/stereonet_depth
WARNING: topic [/StereoNetNode/stereonet_depth] does not appear to be published yet
root@ubuntu:~# ros2 topic list | grep -E “depth|stereo|camera_info"o”
/StereoNetNode/stereonet_visual
root@ubuntu:~# ls -la /opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml
-rw-r–r-- 1 root root 1326 Mar 24 2026 /opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml
root@ubuntu:~# ros2 topic list | grep -E “depth|stereo|camera_info”
/StereoNetNode/stereonet_visual
mipi_cam-2] [WARN] [1774360906.897746400] [mipi_factory]: This is’t support device type(), start defaule capture.
[mipi_cam-2] [ERROR] [1774360906.898811600] [mipi_cam]: There are no available host.
[websocket-4] [WARN] [1774360906.929353725] [hobot_websocket_74b9f3fe]:
[ERROR] [mipi_cam-2]: process has died [pid 6231, exit code -11, cmd ‘/opt/tros/humble/lib/mipi_cam/mipi_cam --ros-args --log-level warn --ros-args --params-file /tmp/launch_params_g64zormp --params-file /tmp/launch_params_ik3l8jwf --params-file /tmp/launch_params_zcv5etdm --params-file /tmp/launch_params_ef3phs2t --params-file /tmp/launch_params_xls5qnhl --params-file /tmp/launch_params_bjipr6cr --params-file /tmp/launch_params_o3bym510 --params-file /tmp/launch_params_hkl6phl0 --params-file /tmp/launch_params_l6a0jnb_ --params-file /tmp/launch_params_mx722oeb --params-file /tmp/launch_params_k10pfn5f --params-file /tmp/launch_params_o_jw2bk2 --params-file /tmp/launch_params_i2zut316 --params-file /tmp/launch_params_pdkwzqgs --params-file /tmp/launch_params_8ujts6bh --params-file /tmp/launch_params_flrfl2h1 --params-file /tmp/launch_params_18vy92gg --params-file /tmp/launch_params_mgm0y1dw --params-file /tmp/launch_params_1g531_56 --params-file /tmp/launch_params_3cl0o9b8 --params-file /tmp/launch_params_6261zyky --params-file /tmp/launch_params_zdyr9xd2 --params-file /tmp/launch_params_35redm3f --params-file /tmp/launch_params_f_o_34c_’].
[stereonet_model_node-1] [WARN] [1774360907.286110875] [StereoNetNode]: => ===================== init StereoNetNode =====================
[stereonet_model_node-1] [ERROR] [1774360907.287419950] [StereoNetNode]: => calib_method parameter invalid, should be one of [none, custom]
[stereonet_model_node-1] [WARN] [1774360907.289113100] [StereoNetNode]:
[ERROR] [stereonet_model_node-1]: process has died [pid 6229, exit code -6, cmd ‘/opt/tros/humble/lib/hobot_stereonet/stereonet_model_node --ros-args --log-level info --ros-args -r __node:=StereoNetNode --params-file /tmp/launch_params_mv7f7nw5’].
[hobot_codec_republish-3] [ERROR] [1774360911.835897050] [hobot_codec_encoder_bb562318]: Hobot_Codec has not received image for more than 5 seconds! Please check whether the image publisher still exists by ‘ros2 topic info /StereoNetNode/stereonet_visual’!
[websocket-4] [ERROR] [1774360911.935442325] [hobot_websocket_74b9f3fe]: Websocket did not receive image data! Please check whether the image publisher still exists by ‘ros2 topic info /image_jpeg’!
[hobot_codec_republish-3] [ERROR] [1774360916.835889175] [hobot_codec_encoder_bb562318]: Hobot_Codec has not received image for more than 5 seconds! Please check whether the image publisher still exists by ‘ros2 topic info /StereoNetNode/stereonet_visual’!
[websocket-4] [ERROR] [1774360916.935441075] [hobot_websocket_74b9f3fe]: Websocket did not receive image data! Please check whether the image publisher still exists by ‘ros2 topic info /image_jpeg’!
[hobot_codec_republish-3] [ERROR] [1774360921.835868250] [hobot_codec_encoder_bb562318]: Hobot_Codec has not received image for more than 5 seconds! Please check whether the image publisher still exists by ‘ros2 topic info /StereoNetNode/stereonet_visual’!
[websocket-4] [ERROR] [1774360921.935428950] [hobot_websocket_74b9f3fe]: Websocket did not receive image data! Please check whether the image publisher still exists by ‘ros2 topic info /image_jpeg’!
[hobot_codec_republish-3] [ERROR] [1774360926.835880000] [hobot_codec_encoder_bb562318]: Hobot_Codec has not received image for more than 5 seconds! Please check whether the image publisher still exists by ‘ros2 topic info /StereoNetNode/stereonet_visual’!
[websocket-4] [ERROR] [1774360926.935435800] [hobot_websocket_74b9f3fe]: Websocket did not receive image data! Please check whether the image publisher still exists by ‘ros2 topic info /image_jpeg’!
[hobot_codec_republish-3] [ERROR] [1774360931.835876750] [hobot_codec_encoder_bb562318]: Hobot_Codec has not received image for more than 5 seconds! Please check whether the image publisher still exists by ‘ros2 topic info /StereoNetNode/stereonet_visual’!
[websocket-4] [ERROR] [1774360931.935430325] [hobot_websocket_74b9f3fe]: Websocket did not receive image data! Please check whether the image publisher still exists by ‘ros2 topic info /image_jpeg’!
[hobot_codec_republish-3] [ERROR] [1774360936.835882425] [hobot_codec_encoder_bb562318]: Hobot_Codec has not received image for more than 5 seconds! Please check whether the image publisher still exists by ‘ros2 topic info /StereoNetNode/stereonet_visual’!
[websocket-4] [ERROR] [1774360936.935419775] [hobot_websocket_74b9f3fe]: Websocket did not receive image data! Please check whether the image publisher still exists by ‘ros2 topic info /image_jpeg’!
[hobot_codec_republish-3] [ERROR] [1774360941.835878900] [hobot_codec_encoder_bb562318]: Hobot_Codec has not received image for more than 5 seconds! Please check whether the image publisher still exists by ‘ros2 topic info /StereoNetNode/stereonet_visual’!
[websocket-4] [ERROR] [1774360941.935424350] [hobot_websocket_74b9f3fe]: Websocket did not receive image data! Please check whether the image publisher still exists by ‘ros2 topic info /image_jpeg’!
[hobot_codec_republish-3] [ERROR] [1774360946.835884350] [hobot_codec_encoder_bb562318]: Hobot_Codec has not received image for more than 5 seconds! Please check whether the image publisher still exists by ‘ros2 topic info /StereoNetNode/stereonet_visual’!
[websocket-4] [ERROR] [1774360946.935431150] [hobot_websocket_74b9f3fe]: Websocket did not receive image data! Please check whether the image publisher still exists by ‘ros2 topic info /image_jpeg’!
[hobot_codec_republish-3] [ERROR] [1774360951.835884900] [hobot_codec_encoder_bb562318]: Hobot_Codec has not received image for more than 5 seconds! Please check whether the image publisher still exists by ‘ros2 topic info /StereoNetNode/stereonet_visual’!
[websocket-4] [ERROR] [1774360951.935428200] [hobot_websocket_74b9f3fe]: Websocket did not receive image data! Please check whether the image publisher still exists by ‘ros2 topic info /image_jpeg’!
[hobot_codec_republish-3] [ERROR] [1774360956.835875075] [hobot_codec_encoder_bb562318]: Hobot_Codec has not received image for more than 5 seconds! Please check whether the image publisher still exists by ‘ros2 topic info /StereoNetNode/stereonet_visual’!
[websocket-4] [ERROR] [1774360956.935427650] [hobot_websocket_74b9f3fe]: Websocket did not receive image data! Please check whether the image publisher still exists by ‘ros2 topic info /image_jpeg’!
[hobot_codec_republish-3] [ERROR] [1774360961.835876050] [hobot_codec_encoder_bb562318]: Hobot_Codec has not received image for more than 5 seconds! Please check whether the image publisher still exists by ‘ros2 topic info /StereoNetNode/stereonet_visual’!
[websocket-4] [ERROR] [1774360961.935432600] [hobot_websocket_74b9f3fe]: Websocket did not receive image data! Please check whether the image publisher still exists by ‘ros2 topic info /image_jpeg’!
root@ubuntu:/userdata/data/test# grep -A5 “init StereoNetNode” stereo_test.log
[stereonet_model_node-1] [WARN] [1774360907.286110875] [StereoNetNode]: => ===================== init StereoNetNode =====================
[stereonet_model_node-1]
[stereonet_model_node-1] [ERROR] [1774360907.287419950] [StereoNetNode]: => calib_method parameter invalid, should be one of [none, custom]
[stereonet_model_node-1] [WARN] [1774360907.289113100] [StereoNetNode]:
[stereonet_model_node-1] stereonet_model_file_path: /opt/tros/humble/share/hobot_stereonet/config/dstereo_s100_320_640_352_v2.4.hbm
[stereonet_model_node-1] stereo_image_topic: /image_combine_raw
root@ubuntu:/userdata/data/test# ros2 topic list | grep -E “depth|stereo|camera_info”
问题根因已定位!两个核心错误
从日志中看到明确的报错信息:
错误 1:calib_method 参数值无效 ️
[ERROR] [StereoNetNode]: => calib_method parameter invalid,
should be one of [none, custom]
关键发现:RDK S100 的 StereoNet v2.4 只支持 none 或 custom,不支持 file 或 ros!
错误 2:MIPI 相机节点崩溃
[ERROR] [mipi_cam]: There are no available host.
[ERROR] [mipi_cam-2]: process has died [exit code -11]
完整解决方案
步骤 1:修改 calib_method 为 custom
# 编辑 run_stereo.sh
vim run_stereo.sh
# 找到标定配置部分,修改为:
# ❌ 错误配置
calib_method="file"
# ✅ 正确配置(S100 v2.4 专用)
calib_method="custom"
stereo_calib_file_path="/opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml"
步骤 2:解决 MIPI Host 不可用问题
# 1. 清理所有残留进程
killall mipi_cam stereonet_model_node hobot_codec_republish websocket 2>/dev/null
# 2. 检查是否有进程残留
ps aux | grep -E "mipi|stereo|codec"
# 3. 如果有残留,强制杀掉
sudo kill -9 <PID>
# 4. 最彻底的方法:重启板子
sudo reboot
步骤 3:重新运行并验证
# 重启后等待 1 分钟,然后运行
cd /userdata/data/test/
bash run_stereo.sh --stereonet_version v2.4 2>&1 | tee stereo_final.log
# 等待 30 秒,观察是否还有 ERROR
验证深度输出
# 新开终端检查
ros2 topic list | grep -E "depth|stereo"
ros2 topic hz /StereoNetNode/stereonet_depth
# 如果有数据输出,说明成功!
如果 MIPI Host 问题依旧
这可能是 S100 相机驱动配置问题,尝试以下命令:
# 1. 检查 IIO 设备
ls /sys/bus/iio/devices/
# 2. 单独测试相机节点
bash run_cam.sh --rotation 90.0 --log_level INFO
# 3. 查看相机话题是否正常
ros2 topic list | grep image
ros2 topic hz /image_combine_raw
如果 run_cam.sh 也报 There are no available host,说明是相机驱动层问题,可能需要:
- 检查 MIPI 物理连接
- 更新系统到最新版本(V4.0.2+ 修复了 SC132GS 问题)
配置总结
| 参数 | 正确值 | 说明 |
|---|---|---|
calib_method |
custom |
S100 v2.4 仅支持 none/custom |
stereo_calib_file_path |
绝对路径 | 标定文件完整路径 |
render_type |
"distance" |
字符串格式 |
相关参考
- 132GS MIPI 双目相机如何自行标定 - 标定配置详解
- 基于官方 132GS MIPI 双目相机运行双目 Demo 报错 - 同类问题案例
- RDK S100 V4.0.2 版本发布 - SC132GS 修复说明
优先执行步骤 1(修改 calib_method="custom")+ 步骤 2(重启板子),这两个是核心问题。执行后把新的日志输出补充到帖子,特别是 StereoNetNode 初始化部分!
oot@ubuntu:/userdata/data/test# ros2 topic list | grep -E “depth|stereo”
/StereoNetNode/stereonet_visual
root@ubuntu:/userdata/data/test# ros2 topic hz /StereoNetNode/stereonet_depth
WARNING: topic [/StereoNetNode/stereonet_depth] does not appear to be published yet
根因确认:两个核心问题
从最新日志看,问题非常明确:
问题 1:calib_method 配置未生效
[ERROR] [StereoNetNode]: => calib_method parameter invalid,
should be one of [none, custom]
说明脚本中 calib_method 还是 "file" 或其他值。
问题 2:MIPI 相机节点持续崩溃
[ERROR] [mipi_cam]: There are no available host.
[ERROR] [mipi_cam-2]: process has died [exit code -11]
这是根本原因——相机节点没启动,StereoNet 收不到图像,自然无法输出深度。
完整修复方案
步骤 1:彻底检查并修改 run_stereo.sh
# 1. 查看当前 calib_method 所有出现位置
grep -n "calib_method" run_stereo.sh
# 2. 编辑脚本
vim run_stereo.sh
# 3. 确保以下配置(约 35-45 行):
calib_method="custom"
stereo_calib_file_path="/opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml"
render_type="distance"
# 4. 保存后再次确认
grep -E "calib_method=|stereo_calib_file_path=|render_type=" run_stereo.sh | head -5
步骤 2:解决 MIPI Host 不可用问题(关键)
# 1. 重启板子(最彻底)
sudo reboot
# 2. 重启后等待 2 分钟,让系统完全启动
# 3. 先单独测试相机节点
cd /userdata/data/test/
bash run_cam.sh --rotation 90.0 --log_level INFO
# 4. 新开终端检查相机话题
ros2 topic list | grep image
ros2 topic hz /image_combine_raw
如果 run_cam.sh 也报 There are no available host,说明是驱动层问题,继续步骤 3。
步骤 3:检查系统版本和相机驱动
# 1. 检查系统版本
cat /etc/hobot_version
# 或
cat /etc/issue
# 2. 检查 IIO 设备
ls /sys/bus/iio/devices/
# 3. 如果版本低于 V4.0.2,建议升级
# 参考:https://developer.d-robotics.cc/rdk_doc/rdk_s/Release_Note/v4_0_2
步骤 4:运行双目深度算法
# 确认相机正常后,运行 stereonet
bash run_stereo.sh --stereonet_version v2.4 2>&1 | tee stereo_final.log
# 等待 30 秒后,新开终端检查
ros2 topic list | grep depth
ros2 topic hz /StereoNetNode/stereonet_depth
快速诊断命令(请执行并补充输出)
# 1. 确认 calib_method 配置
grep -n "calib_method" run_stereo.sh | head -5
# 2. 单独测试相机
bash run_cam.sh --rotation 90.0 --log_level INFO 2>&1 | grep -E "ERROR|host|success"
# 3. 系统版本
cat /etc/hobot_version 2>/dev/null || cat /etc/issue
# 4. IIO 设备状态
ls /sys/bus/iio/devices/
可能原因分析
| 现象 | 可能原因 | 解决方案 |
|---|---|---|
There are no available host |
MIPI 通道被占用 | 重启板子 |
There are no available host |
系统版本过旧 | 升级到 V4.0.2+ |
There are no available host |
相机物理连接问题 | 重新插拔 MIPI 线缆 |
calib_method invalid |
脚本修改未生效 | 检查所有配置行 |
相关参考
- RDK S100 V4.0.2 版本发布 - 修复 SC132GS 帧获取失败
- 关于 rdx X5 点亮 sc132gs 问题 - 类似问题排查
- 132GS MIPI 双目相机如何自行标定 - 标定配置详解
优先执行步骤 1 + 步骤 2(重启板子后单独测试相机)。如果 run_cam.sh 能正常出图,再运行 run_stereo.sh。把诊断命令的输出补充到帖子,可以帮你精准定位!
#!/bin/bash
source /opt/tros/humble/setup.bash
ros2 pkg prefix mipi_cam
ros2 pkg prefix hobot_stereonet
rm -rfv performance_*.txt
stereonet version
stereonet_version=v2.4_int16
node name
stereo_node_name=StereoNetNode
uncertainty
uncertainty_th=-0.10
topic
stereo_image_topic=/image_combine_raw
camera_info_topic=/image_combine_raw/right/camera_info
left_camera_info_topic=/image_combine_raw/left/camera_info
depth_image_topic=“~/stereonet_depth”
depth_camera_info_topic=“~/stereonet_depth/camera_info”
rectify_left_camera_info_topic=“~/rectify_left_image/camera_info”
rectify_right_camera_info_topic=“~/rectify_right_image/camera_info”
pointcloud2_topic=“~/stereonet_pointcloud2”
publish_pcd_enabled=True
rectify_left_image_topic=“~/rectify_left_image”
rectify_right_image_topic=“~/rectify_right_image”
publish_rectify_bgr=False
origin_left_image_topic=“~/origin_left_image”
origin_right_image_topic=“~/origin_right_image”
publish_origin_enable=True
visual_image_topic=“~/stereonet_visual”
publish_visual_enabled=True
stereonet_frame_id=“camera_link”
mipi cam
use_mipi_cam=True
mipi_image_width=640
mipi_image_height=352
mipi_image_framerate=30.0
mipi_frame_ts_type=realtime
mipi_gdc_enable=True
mipi_lpwm_enable=True
mipi_rotation=90.0
mipi_channel=2
mipi_channel2=0
mipi_cal_rotation=0.0
calib
calib_method=“custom”
stereo_calib_file_path=“/opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml”
render
render_type=“distance”
render_perf=True
render_max_disp=80
render_z_near=-1.0
render_z_range=3.0
speckle filter
speckle_filter_enable=False
max_speckle_size=100
max_disp_diff=1.0
pointcloud
pointcloud_height_min=-5.0
pointcloud_height_max=5.0
pointcloud_depth_max=5.0
pcl filter
pcl_filter_enable=False
grid_size=0.1
grid_min_point_count=5
thread
infer_thread_num=2
save_thread_num=4
max_save_task=50
save
save_result_flag=False
save_dir=./result
save_freq=1
save_total=-1
save_stereo_flag=True
save_origin_flag=False
save_disp_flag=True
save_uncert_flag=False
save_depth_flag=True
save_visual_flag=True
save_pcd_flag=False
local image
use_local_image_flag=False
local_image_dir=./offline
image_sleep=0
camera intrinsic
camera_cx=0.0
camera_cy=0.0
camera_fx=0.0
camera_fy=0.0
baseline=0.0
doffs=0.0
mask
left_img_mask_enable=False
epipolar
epipolar_mode=False
epipolar_img=rect
chessboard_per_rows=20
chessboard_per_cols=11
chessboard_square_size=0.06
feature_epipolar_mode=False
web
stereonet_pub_web=True
codec_sub_topic=/$stereo_node_name/stereonet_visual
codec_in_format=bgr8
codec_pub_topic=/image_jpeg
websocket_image_topic=/image_jpeg
websocket_channel=0
root@ubuntu:/userdata/data/test# ros2 topic list | grep image
/image_combine_raw
/image_jpeg
/image_left_raw
/image_right_raw
root@ubuntu:/userdata/data/test# ros2 topic hz /image_combine_raw
average rate: 30.425
min: 0.003s max: 0.045s std dev: 0.00858s window: 31
average rate: 30.277
min: 0.003s max: 0.045s std dev: 0.00784s window: 62
^Croot@ubuntu:/userdata/data/test# ros2 topic hz /image_jpeg
^Croot@ubuntu:/userdata/data/test# ros2 topic hz /image_left_raw
average rate: 31.544
min: 0.001s max: 0.042s std dev: 0.00763s window: 32
average rate: 30.754
min: 0.001s max: 0.042s std dev: 0.00612s window: 62
average rate: 30.490
min: 0.001s max: 0.042s std dev: 0.00544s window: 93
^Croot@ubuntu:/userdata/data/test# ros2 topic hz /image_jpeg
^Croot@ubuntu:/userdata/data/test#
进展分析:相机正常,但 StereoNet 节点未启动
从最新输出看:
已正常工作的部分
- 相机节点正常运行:
/image_combine_raw30Hz 稳定输出 /image_left_raw、/image_right_raw话题正常/image_jpeg话题存在(可视化编码正常)calib_method="custom"配置正确
核心问题
/StereoNetNode/stereonet_depth 话题不存在,说明 StereoNet 节点要么:
- 没有启动
- 启动后崩溃了
排查步骤(请按顺序执行)
步骤 1:确认 StereoNet 节点是否在运行
# 检查节点状态
ros2 node list | grep -i stereo
# 检查进程
ps aux | grep stereonet
如果无输出,说明 StereoNet 节点没启动或已崩溃。
步骤 2:运行 run_stereo.sh 并捕获完整日志
# 清理残留进程
killall stereonet_model_node 2>/dev/null
sleep 2
# 运行并保存日志
cd /userdata/data/test/
bash run_stereo.sh --stereonet_version v2.4 2>&1 | tee stereo_debug.log
# 等待 30 秒后按 Ctrl+C
步骤 3:查看日志中的关键错误
# 搜索 StereoNet 节点初始化信息
grep -A10 "init StereoNetNode" stereo_debug.log
# 搜索 ERROR 和崩溃信息
grep -E "ERROR|died|crash|invalid" stereo_debug.log | tail -20
# 检查 calib_method 相关错误
grep -i "calib_method" stereo_debug.log
可能原因及解决方案
| 现象 | 可能原因 | 解决方案 |
|---|---|---|
| StereoNet 节点未启动 | 脚本中 use_mipi_cam=True 但相机已单独运行 |
改为 use_mipi_cam=False |
| calib_method 无效 | 标定文件格式不兼容 | 检查标定文件内容 |
| 节点崩溃 | 模型文件路径错误 | 检查 .hbm 模型文件是否存在 |
快速修复尝试
方案 A:修改 use_mipi_cam 配置
既然你已经单独运行了相机节点,修改脚本:
vim run_stereo.sh
# 找到这行(约 55 行):
use_mipi_cam=True
# 改为:
use_mipi_cam=False
方案 B:检查标定文件格式
# 查看标定文件内容
cat /opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml
# 确认格式是否正确(应该有 camera_matrix、distortion 等)
方案 C:检查模型文件
# 确认模型文件存在
ls -la /opt/tros/humble/share/hobot_stereonet/config/dstereo_s100_320_640_352_v2.4.hbm
请补充以下诊断信息
# 1. StereoNet 节点状态
ros2 node list | grep -i stereo
# 2. 运行日志中的关键错误
grep -E "ERROR|init StereoNetNode|calib_method" stereo_debug.log | tail -30
# 3. 标定文件内容(前 50 行)
head -50 /opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml
临时测试:手动启动 StereoNet 节点
如果脚本方式不行,尝试手动启动:
source /opt/tros/humble/setup.bash
ros2 run hobot_stereonet stereonet_model_node \
--ros-args \
-p calib_method:=custom \
-p stereo_calib_file_path:=/opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml \
-p stereo_image_topic:=/image_combine_raw \
-p camera_info_topic:=/image_combine_raw/right/camera_info
优先执行步骤 1+2,把 stereo_debug.log 中的关键错误信息补充到帖子,特别是 StereoNetNode 初始化部分和任何 ERROR 信息!
相关参考:
root@ubuntu:/userdata/data/test# ros2 node list | grep -i stereo
WARNING: Be aware that there are nodes in the graph that share an exact name, which can have unintended side effects.
/StereoNetNode
root@ubuntu:/userdata/data/test# ps aux | grep stereonet
root 9444 0.0 0.0 4672 3264 pts/1 S+ 22:18 0:00 bash run_stereo.sh --stereonet_version v2.4
root 9465 2.0 0.4 346304 39872 pts/1 Sl+ 22:18 0:00 /usr/bin/python3 /opt/ros/humble/bin/ros2 launch hobot_stereonet stereonet_model_web_visual_v2.4.launch.py stereo_node_name:=StereoNetNode uncertainty_th:=-0.10 stereo_image_topic:=/image_combine_raw camera_info_topic:=/image_combine_raw/right/camera_info left_camera_info_topic:=/image_combine_raw/left/camera_info depth_image_topic:=~/stereonet_depth depth_camera_info_topic:=~/stereonet_depth/camera_info rectify_left_camera_info_topic:=~/rectify_left_image/camera_info rectify_right_camera_info_topic:=~/rectify_right_image/camera_info pointcloud2_topic:=~/stereonet_pointcloud2 publish_pcd_enabled:=True rectify_left_image_topic:=~/rectify_left_image rectify_right_image_topic:=~/rectify_right_image publish_rectify_bgr:=False origin_left_image_topic:=~/origin_left_image origin_right_image_topic:=~/origin_right_image publish_origin_enable:=True visual_image_topic:=~/stereonet_visual publish_visual_enabled:=True use_mipi_cam:=True mipi_image_width:=640 mipi_image_height:=352 mipi_image_framerate:=30.0 mipi_frame_ts_type:=realtime mipi_gdc_enable:=True mipi_lpwm_enable:=True mipi_rotation:=90.0 mipi_channel:=2 mipi_channel2:=0 mipi_cal_rotation:=0.0 calib_method:=custom stereo_calib_file_path:=/opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml render_type:=distance render_perf:=True render_max_disp:=80 render_z_near:=-1.0 render_z_range:=3.0 speckle_filter_enable:=False max_speckle_size:=100 max_disp_diff:=1.0 pointcloud_height_min:=-5.0 pointcloud_height_max:=5.0 pointcloud_depth_max:=5.0 pcl_filter_enable:=False grid_size:=0.1 grid_min_point_count:=5 infer_thread_num:=2 save_thread_num:=4 max_save_task:=50 use_local_image_flag:=False local_image_dir:=./offline image_sleep:=0 save_result_flag:=False save_dir:=./result save_freq:=1 save_total:=-1 save_stereo_flag:=True save_origin_flag:=False save_disp_flag:=True save_uncert_flag:=False save_depth_flag:=True save_visual_flag:=True save_pcd_flag:=False use_local_image_flag:=False local_image_dir:=./offline image_sleep:=0 camera_cx:=0.0 camera_cy:=0.0 camera_fx:=0.0 camera_fy:=0.0 baseline:=0.0 doffs:=0.0 left_img_mask_enable:=False epipolar_mode:=False epipolar_img:=rect chessboard_per_rows:=20 chessboard_per_cols:=11 chessboard_square_size:=0.06 feature_epipolar_mode:=False stereonet_pub_web:=True codec_sub_topic:=/StereoNetNode/stereonet_visual codec_in_format:=bgr8 codec_pub_topic:=/image_jpeg websocket_image_topic:=/image_jpeg websocket_channel:=0
root 9619 0.0 0.0 3776 1792 pts/2 S+ 22:18 0:00 grep --color=auto stereonet
root@ubuntu:/userdata/data/test# vi run_stereo.sh
root@ubuntu:/userdata/data/test#
ERROR] [stereonet_model_node-1]: process has died [pid 9928, exit code -11, cmd ‘/opt/tros/humble/lib/hobot_stereonet/stereonet_model_node --ros-args --log-level info --ros-args -r __node:=StereoNetNode --params-file /tmp/launch_params_warhzf_3’].
[hobot_codec_republish-2] [ERROR] [1774362048.954877700] [hobot_codec_encoder_56ea1ee2]: Hobot_Codec has not received image for more than 5 seconds! Please check whether the image publisher still exists by ‘ros2 topic info /StereoNetNode/stereonet_visual’!
[websocket-3] [ERROR] [1774362049.068586375] [hobot_websocket_49333091]: Websocket did not receive image data! Please check whether the image publisher still exists by ‘ros2 topic info /image_jpeg’!
[hobot_codec_republish-2] [ERROR] [1774362053.954863175] [hobot_codec_encoder_56ea1ee2]: Hobot_Codec has not received image for more than 5 seconds! Please check whether the image publisher still exists by ‘ros2 topic info /StereoNetNode/stereonet_visual’!
[websocket-3] [ERROR] [1774362054.068581150] [hobot_websocket_49333091]: Websocket did not receive image data! Please check whether the image publisher still exists by ‘ros2 topic info /image_jpeg’!
[hobot_codec_republish-2] [ERROR] [1774362058.954863425] [hobot_codec_encoder_56ea1ee2]: Hobot_Codec has not received image for more than 5 seconds! Please check whether the image publisher still exists by ‘ros2 topic info /StereoNetNode/stereonet_visual’!
[websocket-3] [ERROR] [1774362059.068579225] [hobot_websocket_49333091]: Websocket did not receive image data! Please check whether the image publisher still exists by ‘ros2 topic info /image_jpeg’!
[hobot_codec_republish-2] [ERROR] [1774362063.954856400] [hobot_codec_encoder_56ea1ee2]: Hobot_Codec has not received image for more than 5 seconds! Please check whether the image publisher still exists by ‘ros2 topic info /StereoNetNode/stereonet_visual’!
[websocket-3] [ERROR] [1774362064.068577350] [hobot_websocket_49333091]: Websocket did not receive image data! Please check whether the image publisher still exists by ‘ros2 topic info /image_jpeg’!
问题明确:StereoNet 节点崩溃(exit code -11)
从日志看,StereoNet 节点启动后立即崩溃(段错误),核心原因可能是:
关键问题
use_mipi_cam=True导致资源冲突 - 相机已单独运行,脚本又尝试启动相机节点- 标定文件格式可能不兼容 - SC132gs 标定文件可能是 X5 格式,S100 需要特定格式
完整解决方案
步骤 1:修改 use_mipi_cam=False(关键)
# 编辑 run_stereo.sh
vim run_stereo.sh
# 找到这行(约 55 行):
use_mipi_cam=True
# 改为:
use_mipi_cam=False
# 保存退出
原因:你已经单独运行了 run_cam.sh,相机话题 /image_combine_raw 正常发布 30Hz。如果 use_mipi_cam=True,脚本会尝试再次启动相机节点,导致资源冲突。
步骤 2:检查标定文件格式
# 查看标定文件完整内容
cat /opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml
S100 需要的标定文件格式(参考 SC230ai):
%YAML:1.0
camera_matrix_1:
rows: 3
cols: 3
data: [fx1, 0, cx1, 0, fy1, cy1, 0, 0, 1]
distortion_1:
rows: 1
cols: 5
data: [k1, k2, p1, p2, k3]
camera_matrix_2:
rows: 3
cols: 3
data: [fx2, 0, cx2, 0, fy2, cy2, 0, 0, 1]
distortion_2:
rows: 1
cols: 5
data: [k1, k2, p1, p2, k3]
rectification_1: ...
rectification_2: ...
projection_1: ...
projection_2: ...
baseline: 0.06
你之前贴出的标定文件只有 R 和 T 矩阵,格式可能不完整。
步骤 3:使用 SC230ai 标定文件临时测试
# 修改 run_stereo.sh
vim run_stereo.sh
# 将标定文件路径改为 SC230ai(格式已知正确):
stereo_calib_file_path="/opt/tros/humble/lib/mipi_cam/config/SC230ai_dual_calibration.yaml"
# 保存后重新运行
bash run_stereo.sh --stereonet_version v2.4 2>&1 | tee stereo_v2.log
步骤 4:查看完整崩溃日志
# 等待 30 秒后按 Ctrl+C,然后查看:
grep -A20 "init StereoNetNode" stereo_v2.log
grep -E "ERROR|died|segmentation" stereo_v2.log | tail -20
快速修复命令(一键执行)
# 1. 修改配置
sed -i 's/use_mipi_cam=True/use_mipi_cam=False/g' run_stereo.sh
sed -i 's|SC132gs_dual_calibration.yaml|SC230ai_dual_calibration.yaml|g' run_stereo.sh
# 2. 确认修改
grep -E "use_mipi_cam|stereo_calib_file_path" run_stereo.sh | head -3
# 3. 清理进程并重新运行
killall stereonet_model_node mipi_cam 2>/dev/null
sleep 2
bash run_stereo.sh --stereonet_version v2.4 2>&1 | tee stereo_v2.log
验证深度输出
# 新开终端检查
ros2 topic list | grep depth
ros2 topic hz /StereoNetNode/stereonet_depth
# 如果有数据,说明成功!
配置总结
| 参数 | 正确值 | 说明 |
|---|---|---|
use_mipi_cam |
False |
相机已单独运行 |
calib_method |
custom |
S100 v2.4 专用 |
stereo_calib_file_path |
绝对路径 | 使用已知正确的标定文件 |
render_type |
"distance" |
字符串格式 |
相关参考
- 基于官方 132GS MIPI 双目相机运行双目 Demo 报错 - 同类问题完整解决
- 132GS MIPI 双目相机如何自行标定 - 标定文件格式详解
优先执行步骤 1(use_mipi_cam=False)+ 步骤 3(用 SC230ai 标定文件测试)。把新的日志输出(特别是 init StereoNetNode 后的内容)补充到帖子,可以帮你精准定位标定文件问题!
root@ubuntu:/opt/tros/humble/lib/mipi_cam/config# cat SC132gs_dual_calibration.yaml
%YAML:1.0
image_width: 1280
image_height: 640
left_camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [528.6953213954334, 0, 621.6598968327049, 0, 469.7443489102585, 344.7801912987854, 0, 0, 1]
left_distortion_coefficients: !!opencv-matrix
rows: 1
cols: 8
dt: d
data: [-0.19022404784416216, 0.08737900971037368, -0.00013633102684873613, 2.8387028454768084e-05, 0.037123187744979025, 0.1798687498557986, -0.06820294642386052, 0.10684527621059339]
right_camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [529.2760196145524, 0, 654.6320151265384, 0, 470.4236596788936, 318.0571160826385, 0, 0, 1]
right_distortion_coefficients: !!opencv-matrix
rows: 1
cols: 8
dt: d
data: [-0.08168737119014227, 0.051348177058130356, 0.00010479656330654928, -8.819143676712554e-06, 0.024544736926599094, 0.28711736495579887, -0.06268635878956813, 0.07182651571052037]
R: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [0.9999771405493721, -0.0008865181729254466, -0.006703168223329922,
0.000844157865516232, 0.9999796745904039, -0.006319636347751682,
0.006708634451158759, 0.006313833352156998, 0.9999575639656925]
T: !!opencv-matrix
rows: 3
cols: 1
dt: d
data: [-0.06981825961809152, -0.00031854332254735906, -3.61077528349911e-05]
root@ubuntu:/opt/tros/humble/lib/mipi_cam/config#
问题定位:标定文件格式 + 分辨率不匹配
从你提供的标定文件看,格式缺少 StereoNet v2.4 需要的关键字段,且分辨率配置可能不匹配。
完整解决方案
步骤 1:修改标定文件格式(关键)
当前标定文件缺少 baseline 和 projection 字段,StereoNet 无法解析。参考 SC230ai 格式创建兼容文件:
# 1. 备份原文件
cp /opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml \
/opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml.bak
# 2. 创建兼容格式的标定文件
cat > /opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml << 'EOF'
%YAML:1.0
image_width: 1280
image_height: 1088
camera_matrix_1: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [528.6953213954334, 0, 621.6598968327049, 0, 469.7443489102585, 344.7801912987854, 0, 0, 1]
distortion_1: !!opencv-matrix
rows: 1
cols: 8
dt: d
data: [-0.19022404784416216, 0.08737900971037368, -0.00013633102684873613, 2.8387028454768084e-05, 0.037123187744979025, 0.1798687498557986, -0.06820294642386052, 0.10684527621059339]
camera_matrix_2: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [529.2760196145524, 0, 654.6320151265384, 0, 470.4236596788936, 318.0571160826385, 0, 0, 1]
distortion_2: !!opencv-matrix
rows: 1
cols: 8
dt: d
data: [-0.08168737119014227, 0.051348177058130356, 0.00010479656330654928, -8.819143676712554e-06, 0.024544736926599094, 0.28711736495579887, -0.06268635878956813, 0.07182651571052037]
rectification_1: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [1, 0, 0, 0, 1, 0, 0, 0, 1]
rectification_2: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [1, 0, 0, 0, 1, 0, 0, 0, 1]
projection_1: !!opencv-matrix
rows: 3
cols: 4
dt: d
data: [528.6953213954334, 0, 621.6598968327049, 0, 0, 469.7443489102585, 344.7801912987854, 0, 0, 0, 1, 0]
projection_2: !!opencv-matrix
rows: 3
cols: 4
dt: d
data: [529.2760196145524, 0, 654.6320151265384, -36.9, 0, 470.4236596788936, 318.0571160826385, 0, 0, 0, 1, 0]
baseline: 0.0698
EOF
步骤 2:确认分辨率配置匹配
从你的配置截图看:
mipi_image_width=640,mipi_image_height=352(StereoNet 模型输入)- 标定文件
image_width: 1280,image_height: 1088(原始相机分辨率)
这个配置是正确的,StereoNet 会自动缩放。但需要确认 GDC 裁剪配置:
# 检查 run_stereo.sh 中的裁剪配置
grep -E "sub_image|image_width|image_height" run_stereo.sh | head -10
步骤 3:重新运行并捕获完整日志
# 1. 清理进程
killall stereonet_model_node mipi_cam hobot_codec_republish websocket 2>/dev/null
sleep 3
# 2. 重新运行
cd /userdata/data/test/
bash run_stereo.sh --stereonet_version v2.4 2>&1 | tee stereo_final.log
# 3. 等待 30 秒后按 Ctrl+C
步骤 4:验证深度输出
# 新开终端检查
ros2 topic list | grep -E "depth|stereo"
ros2 topic hz /StereoNetNode/stereonet_depth
# 查看深度数据
ros2 topic echo /StereoNetNode/stereonet_depth --once
如果问题依旧:查看崩溃日志
# 1. 查看 StereoNet 初始化日志
grep -A30 "init StereoNetNode" stereo_final.log
# 2. 查看标定文件加载信息
grep -i "calib\|camera_info" stereo_final.log | tail -20
# 3. 查看崩溃原因
grep -E "ERROR|died|segmentation|invalid" stereo_final.log | tail -20
配置检查清单
| 参数 | 当前值 | 要求 |
|---|---|---|
use_mipi_cam |
False |
|
calib_method |
custom |
|
stereo_calib_file_path |
绝对路径 | |
render_type |
"distance" |
|
| 标定文件格式 | 需包含 baseline/projection | ️ 需更新 |
相关参考
- 132GS MIPI 双目相机如何自行标定 - 标定文件格式详解
- 基于官方 132GS MIPI 双目相机运行双目 Demo 报错 - 同类问题完整解决
优先执行步骤 1(更新标定文件格式),然后重新运行测试。把新的日志输出(特别是 init StereoNetNode 后的内容和任何 ERROR)补充到帖子,可以帮你精准定位最后的问题!
使用的是sc230ai 一模一样格式
问题进展分析
既然标定文件格式和 SC230ai 一样,那格式应该没问题。从日志看,核心问题是 StereoNet 节点启动后段错误崩溃(exit code -11)。
最终排查方案
步骤 1:先确保相机节点独立运行正常
# 1. 清理所有相关进程
killall mipi_cam stereonet_model_node hobot_codec_republish websocket 2>/dev/null
sleep 3
# 2. 单独运行相机节点
bash run_cam.sh --rotation 90.0 --log_level INFO
# 3. 新开终端验证相机话题
ros2 topic hz /image_combine_raw
ros2 topic echo /image_combine_raw/right/camera_info --once
如果 camera_info 还是没有输出,说明 mipi_cam 节点本身有问题。
步骤 2:使用 SC230ai 标定文件测试(排除标定文件问题)
# 修改 run_stereo.sh 使用 SC230ai 标定文件
vim run_stereo.sh
# 修改这行:
stereo_calib_file_path="/opt/tros/humble/lib/mipi_cam/config/SC230ai_dual_calibration.yaml"
# 保存后重新运行
bash run_stereo.sh --stereonet_version v2.4 2>&1 | tee stereo_sc230ai.log
步骤 3:检查系统版本(关键)
SC132GS 在 S100 上的支持是 V4.0.2 版本才修复的:
# 检查系统版本
cat /etc/hobot_version
# 或
cat /etc/issue
# 如果版本低于 V4.0.2,建议升级
# 参考:https://developer.d-robotics.cc/rdk_doc/rdk_s/Release_Note/v4_0_2
步骤 4:查看完整崩溃日志
# 等待 30 秒后按 Ctrl+C,然后查看:
grep -A50 "init StereoNetNode" stereo_sc230ai.log
grep -E "ERROR|died|segmentation|invalid" stereo_sc230ai.log | tail -30
可能原因分析
| 现象 | 可能原因 | 解决方案 |
|---|---|---|
| exit code -11 | 标定参数与分辨率不匹配 | 使用 SC230ai 标定文件测试 |
| exit code -11 | 模型文件损坏 | 重新安装 hobot_stereonet |
| exit code -11 | S100 与 SC132GS 兼容性问题 | 升级系统到 V4.0.2+ |
| camera_info 无输出 | mipi_cam 配置问题 | 检查 mipi_cam 参数 |
请补充以下诊断信息
# 1. 系统版本
cat /etc/hobot_version 2>/dev/null || cat /etc/issue
# 2. 单独运行相机时的 camera_info 输出
ros2 topic echo /image_combine_raw/right/camera_info --once
# 3. 使用 SC230ai 标定文件后的完整日志
grep -A50 "init StereoNetNode" stereo_sc230ai.log
# 4. IIO 设备状态
ls /sys/bus/iio/devices/
临时测试方案
如果上述方法都无效,可以尝试离线图片模式验证 StereoNet 是否正常:
# 1. 修改 run_stereo.sh
vim run_stereo.sh
# 改为离线模式:
use_local_image_flag=True
local_image_dir=/opt/tros/humble/share/hobot_stereonet/sample_images
# 2. 运行测试
bash run_stereo.sh --stereonet_version v2.4
如果离线模式能正常输出深度,说明是相机数据流问题;如果离线模式也崩溃,说明是StereoNet 本身问题。
相关参考
- RDK S100 V4.0.2 版本发布 - SC132GS 修复说明
- 基于官方 132GS MIPI 双目相机运行双目 Demo 报错 - 同类问题案例
- 132GS MIPI 双目相机如何自行标定 - 标定配置详解
优先执行步骤 1+2,把 ros2 topic echo /image_combine_raw/right/camera_info --once 的输出和系统版本补充到帖子,这是定位问题的关键信息!
root@ubuntu:~# ros2 topic hz /image_combine_raw
average rate: 31.710
min: 0.002s max: 0.043s std dev: 0.01012s window: 32
average rate: 30.772
min: 0.002s max: 0.043s std dev: 0.00868s window: 63
average rate: 30.648
min: 0.002s max: 0.043s std dev: 0.00784s window: 94
average rate: 30.437
min: 0.002s max: 0.043s std dev: 0.00760s window: 125
average rate: 30.379
min: 0.002s max: 0.043s std dev: 0.00749s window: 156
average rate: 30.294
min: 0.002s max: 0.043s std dev: 0.00746s window: 187
average rate: 30.273
min: 0.002s max: 0.043s std dev: 0.00740s window: 218
root@ubuntu:~# ros2 topic echo /image_combine_raw/right/camera_info --oncece
WARNING: topic [/image_combine_raw/right/camera_info] does not appear to be published yet
Could not determine the type for the passed topic
root@ubuntu:~#
root@ubuntu:~# cat /etc/issue
Ubuntu 22.04.5 LTS \n \l
root@ubuntu:~# cat /etc/version
4.0.5-Beta
root@ubuntu:~#
根因确认:camera_info 话题缺失
从诊断信息看,问题非常明确:
| 检查项 | 状态 | 说明 |
|---|---|---|
/image_combine_raw |
相机图像数据正常 | |
/image_combine_raw/right/camera_info |
标定信息未发布 | |
| 系统版本 | 已支持 SC132GS |
核心问题:mipi_cam 节点没有发布 camera_info,导致 StereoNet 无法获取标定参数。
最终解决方案
方案 1:修改 mipi_cam 配置启用标定发布(推荐)
# 1. 查看 mipi_cam 配置文件
ls /opt/tros/humble/lib/mipi_cam/config/
# 2. 编辑 run_cam.sh,添加标定文件路径
vim run_cam.sh
# 找到相机启动命令,添加参数:
--camera_calibration_file_path /opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml
# 3. 重新运行相机
bash run_cam.sh --rotation 90.0 --log_level INFO
# 4. 验证 camera_info 是否发布
ros2 topic echo /image_combine_raw/right/camera_info --once
方案 2:StereoNet 使用 custom 模式直接从文件读取标定
既然 camera_info 话题不发布,让 StereoNet 直接从文件读取:
# 1. 确认 run_stereo.sh 配置
vim run_stereo.sh
# 确保以下配置:
use_mipi_cam=False
calib_method="custom"
stereo_calib_file_path="/opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml"
# 2. 清理进程
killall mipi_cam stereonet_model_node hobot_codec_republish websocket 2>/dev/null
sleep 3
# 3. 先启动相机
bash run_cam.sh --rotation 90.0 --log_level INFO &
# 4. 等待 5 秒后启动 StereoNet
sleep 5
bash run_stereo.sh --stereonet_version v2.4 2>&1 | tee stereo_final.log
方案 3:检查标定文件字段是否完整
StereoNet v2.4 custom 模式需要的标定文件字段:
# 查看当前标定文件
cat /opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml
# 必须包含以下字段:
# - camera_matrix_1 / left_camera_matrix
# - camera_matrix_2 / right_camera_matrix
# - baseline (基线距离)
# - 可选:distortion, rectification, projection
你之前的标定文件只有 R 和 T 矩阵,缺少 baseline 字段。创建完整格式:
# 创建兼容格式的标定文件
cat > /opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml << 'EOF'
%YAML:1.0
image_width: 1280
image_height: 1088
camera_matrix_1: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [528.6953213954334, 0, 621.6598968327049, 0, 469.7443489102585, 344.7801912987854, 0, 0, 1]
distortion_1: !!opencv-matrix
rows: 1
cols: 8
dt: d
data: [-0.19022404784416216, 0.08737900971037368, -0.00013633102684873613, 2.8387028454768084e-05, 0.037123187744979025, 0.1798687498557986, -0.06820294642386052, 0.10684527621059339]
camera_matrix_2: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [529.2760196145524, 0, 654.6320151265384, 0, 470.4236596788936, 318.0571160826385, 0, 0, 1]
distortion_2: !!opencv-matrix
rows: 1
cols: 8
dt: d
data: [-0.08168737119014227, 0.051348177058130356, 0.00010479656330654928, -8.819143676712554e-06, 0.024544736926599094, 0.28711736495579887, -0.06268635878956813, 0.07182651571052037]
baseline: 0.0698
EOF
验证步骤
# 1. 运行后检查深度话题
ros2 topic list | grep -E "depth|stereo"
# 2. 检查深度数据频率
ros2 topic hz /StereoNetNode/stereonet_depth
# 3. 查看深度数据
ros2 topic echo /StereoNetNode/stereonet_depth --once
相关参考
- 132GS MIPI 双目相机如何自行标定 - 标定文件格式详解
- 基于官方 132GS MIPI 双目相机运行双目 Demo 报错 - 同类问题完整解决
优先执行方案 3(更新标定文件格式,添加 baseline 字段),然后重新运行测试。把新的日志输出补充到帖子,特别是 StereoNet 初始化后是否有深度话题发布!

