自定义标定:RDK X5 + SC230ai 双目运行run_stereo,sh,加载自定义标定文件(custom模式)必现 exit code -11 (段错误)

一、 运行环境

  • 硬件平台:RDK X5

  • 相机模组:SC230ai 双目相机

  • 算法模型DstereoV2.4.0 (v2.4_int16)

  • 操作系统:Ubuntu 22.04 (TROS.B Humble)

二、 问题背景与核心诉求 目前在做双目深度测评,由于需要验证自研的 6.99cm 基线和内参,试图让 run_stereo.sh 算法节点读取自定义的 YAML 标定文件。 但只要涉及 YAML 文件的解析,C++ 节点必定引发内存溢出(exit code -11 闪退)。想请教研发大佬:当前版本是否存在外部 YAML 解析的已知缺陷?是否有推荐的规避方案(例如通过 camera_info 话题强行注入参数)?

  1. 测试 1:加载自定义 YAML(失败) 设置 calib_method=customstereo_calib_file_path 指向我严格按照 OpenCV 格式排版的 yaml 文件。 结果:节点瞬间崩溃,报 exit code -11

  2. 测试 2:加载官方参考 YAML(失败) 怀疑是自己数据格式有隐藏字符,于是将官方文档提供的 SC230ai_dual_calibration.yaml 重命名并喂给节点。 结果:同样报 exit code -11 崩溃。

  3. 测试 3:设为 none 模式的预加载触发(失败) 设置 calib_method=none,但在脚本同级目录(或运行目录)下放置了一个名为 calib.yaml 的文件。 结果:程序虽然设为 none,但依然偷偷去读这个同名文件,并直接导致 -11 崩溃。

  4. 测试4:只有将该文件改名或删除none 模式才能跑通(但此时测距失效,因为 cx/cy/baseline 全为 0)**

    现在最想解决的问题是,可以不可以用自己的标定文件.yaml,去替换run_stereo.sh里的file_path,或者用什么别的办法去用自己的标定文件(包括格式)。**

你好,是通过什么方式 使用官方的ROS包,是自行编译的吗

看看系统是否是最新的 3.5.0

我用的是文档里的方法,我主要是想替换掉.yaml的标定文件

版本我现在暂时看不到,我直接拷贝了方法2里的“手动创建脚本”然后改了分辨率、method、file_path,但是会报错,但是如果我关闭了gdc_enable而且method=none的时候,在web端可以可视化但是深度结果是错的,横竖网格都是0m(因为没有标定文件)

你好,可以尝试以下拉取源码编译这个几个功能包定位一下问题,目前是没有 外部 YAML 解析的已知缺陷

定位一下问题,如果发现问题会立刻提单修复。

我想请教一下,我用 双目深度算法 | RDK DOC 的bash run_stereo.sh
里面的5.3的指令,用它启动深度恢复的参数和算法,为什么显示测距都是0m,而不是像示例一样有深度测距
#!/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=none
stereo_calib_file_path=calib.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

while [[ $# -gt 0 ]]; do
case $1 in
# stereonet version
–stereonet_version) stereonet_version=$2; shift 2 ;;

# node name
--stereo_node_name) stereo_node_name=$2; shift 2 ;;

# uncertainty
--uncertainty_th) uncertainty_th=$2; shift 2 ;;

# topic
--stereo_image_topic) stereo_image_topic=$2; shift 2 ;;
--camera_info_topic) camera_info_topic=$2; shift 2 ;;
--left_camera_info_topic) left_camera_info_topic=$2; shift 2 ;;
--depth_image_topic) depth_image_topic=$2; shift 2 ;;
--rectify_left_camera_info_topic) rectify_left_camera_info_topic=$2; shift 2 ;;
--rectify_right_camera_info_topic) rectify_right_camera_info_topic=$2; shift 2 ;;
--depth_camera_info_topic) depth_camera_info_topic=$2; shift 2 ;;
--pointcloud2_topic) pointcloud2_topic=$2; shift 2 ;;
--publish_pcd_enabled) publish_pcd_enabled=$2; shift 2 ;;
--rectify_left_image_topic) rectify_left_image_topic=$2; shift 2 ;;
--rectify_right_image_topic) rectify_right_image_topic=$2; shift 2 ;;
--publish_rectify_bgr) publish_rectify_bgr=$2; shift 2 ;;
--origin_left_image_topic) origin_left_image_topic=$2; shift 2 ;;
--origin_right_image_topic) origin_right_image_topic=$2; shift 2 ;;
--publish_origin_enable) publish_origin_enable=$2; shift 2 ;;
--visual_image_topic) visual_image_topic=$2; shift 2 ;;
--publish_visual_enabled) publish_visual_enabled=$2; shift 2 ;;
--stereonet_frame_id) stereonet_frame_id=$2; shift 2 ;;

# mipi cam
--use_mipi_cam) use_mipi_cam=$2; shift 2 ;;
--mipi_image_width) mipi_image_width=$2; shift 2 ;;
--mipi_image_height) mipi_image_height=$2; shift 2 ;;
--mipi_image_framerate) mipi_image_framerate=$2; shift 2 ;;
--mipi_frame_ts_type) mipi_frame_ts_type=$2; shift 2 ;;
--mipi_gdc_enable) mipi_gdc_enable=$2; shift 2 ;;
--mipi_lpwm_enable) mipi_lpwm_enable=$2; shift 2 ;;
--mipi_rotation) mipi_rotation=$2; shift 2 ;;
--mipi_channel) mipi_channel=$2; shift 2 ;;
--mipi_channel2) mipi_channel2=$2; shift 2 ;;
--mipi_cal_rotation) mipi_cal_rotation=$2; shift 2 ;;

# calib
--calib_method) calib_method=$2; shift 2 ;;
--stereo_calib_file_path) stereo_calib_file_path=$2; shift 2 ;;

# render
--render_type) render_type=$2; shift 2 ;;
--render_perf) render_perf=$2; shift 2 ;;
--render_max_disp) render_max_disp=$2; shift 2 ;;
--render_z_near) render_z_near=$2; shift 2 ;;
--render_z_range) render_z_range=$2; shift 2 ;;

# speckle filter
--speckle_filter_enable) speckle_filter_enable=$2; shift 2 ;;
--max_speckle_size) max_speckle_size=$2; shift 2 ;;
--max_disp_diff) max_disp_diff=$2; shift 2 ;;

# pointcloud
--pointcloud_height_min) pointcloud_height_min=$2; shift 2 ;;
--pointcloud_height_max) pointcloud_height_max=$2; shift 2 ;;
--pointcloud_depth_max) pointcloud_depth_max=$2; shift 2 ;;

# pcl filter
--pcl_filter_enable) pcl_filter_enable=$2; shift 2 ;;
--grid_size) grid_size=$2; shift 2 ;;
--grid_min_point_count) grid_min_point_count=$2; shift 2 ;;

# thread
--infer_thread_num) infer_thread_num=$2; shift 2 ;;
--save_thread_num) save_thread_num=$2; shift 2 ;;
--max_save_task) max_save_task=$2; shift 2 ;;

# save
--save_result_flag) save_result_flag=$2; shift 2 ;;
--save_dir) save_dir=$2; shift 2 ;;
--save_freq) save_freq=$2; shift 2 ;;
--save_total) save_total=$2; shift 2 ;;
--save_stereo_flag) save_stereo_flag=$2; shift 2 ;;
--save_origin_flag) save_origin_flag=$2; shift 2 ;;
--save_disp_flag) save_disp_flag=$2; shift 2 ;;
--save_uncert_flag) save_uncert_flag=$2; shift 2 ;;
--save_depth_flag) save_depth_flag=$2; shift 2 ;;
--save_visual_flag) save_visual_flag=$2; shift 2 ;;
--save_pcd_flag) save_pcd_flag=$2; shift 2 ;;

# local image
--use_local_image_flag) use_local_image_flag=$2; shift 2 ;;
--local_image_dir) local_image_dir=$2; shift 2 ;;
--image_sleep) image_sleep=$2; shift 2 ;;

# camera intrinsic
--camera_cx) camera_cx=$2; shift 2 ;;
--camera_cy) camera_cy=$2; shift 2 ;;
--camera_fx) camera_fx=$2; shift 2 ;;
--camera_fy) camera_fy=$2; shift 2 ;;
--baseline) baseline=$2; shift 2 ;;
--doffs) doffs=$2; shift 2 ;;

# mask
--left_img_mask_enable) left_img_mask_enable=$2; shift 2 ;;

# epipolar
--epipolar_mode) epipolar_mode=$2; shift 2 ;;
--epipolar_img) epipolar_img=$2; shift 2 ;;
--chessboard_per_rows) chessboard_per_rows=$2; shift 2 ;;
--chessboard_per_cols) chessboard_per_cols=$2; shift 2 ;;
--chessboard_square_size) chessboard_square_size=$2; shift 2 ;;

# web
--stereonet_pub_web) stereonet_pub_web=$2; shift 2 ;;
--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 ;;

\*) echo "unknown param: $1"; exit 1 ;;

esac
done

ros2 launch hobot_stereonet stereonet_model_web_visual_$stereonet_version.launch.py \
stereo_node_name:=$stereo_node_name \
uncertainty_th:=$uncertainty_th \
stereo_image_topic:=$stereo_image_topic camera_info_topic:=$camera_info_topic left_camera_info_topic:=$left_camera_info_topic \
depth_image_topic:=$depth_image_topic depth_camera_info_topic:=$depth_camera_info_topic \
rectify_left_camera_info_topic:=$rectify_left_camera_info_topic rectify_right_camera_info_topic:=$rectify_right_camera_info_topic \
pointcloud2_topic:=$pointcloud2_topic publish_pcd_enabled:=$publish_pcd_enabled \
rectify_left_image_topic:=$rectify_left_image_topic rectify_right_image_topic:=$rectify_right_image_topic publish_rectify_bgr:=$publish_rectify_bgr \
origin_left_image_topic:=$origin_left_image_topic origin_right_image_topic:=$origin_right_image_topic publish_origin_enable:=$publish_origin_enable \
visual_image_topic:=$visual_image_topic publish_visual_enabled:=$publish_visual_enabled \
use_mipi_cam:=$use_mipi_cam mipi_image_width:=$mipi_image_width mipi_image_height:=$mipi_image_height \
mipi_image_framerate:=$mipi_image_framerate mipi_frame_ts_type:=$mipi_frame_ts_type \
mipi_gdc_enable:=$mipi_gdc_enable mipi_lpwm_enable:=$mipi_lpwm_enable mipi_rotation:=$mipi_rotation \
mipi_channel:=$mipi_channel mipi_channel2:=$mipi_channel2 mipi_cal_rotation:=$mipi_cal_rotation \
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 \
speckle_filter_enable:=$speckle_filter_enable max_speckle_size:=$max_speckle_size max_disp_diff:=$max_disp_diff \
pointcloud_height_min:=$pointcloud_height_min pointcloud_height_max:=$pointcloud_height_max pointcloud_depth_max:=$pointcloud_depth_max \
pcl_filter_enable:=$pcl_filter_enable grid_size:=$grid_size grid_min_point_count:=$grid_min_point_count \
infer_thread_num:=$infer_thread_num save_thread_num:=$save_thread_num max_save_task:=$max_save_task \
use_local_image_flag:=$use_local_image_flag local_image_dir:=$local_image_dir image_sleep:=$image_sleep \
save_result_flag:=$save_result_flag save_dir:=$save_dir save_freq:=$save_freq save_total:=$save_total save_stereo_flag:=$save_stereo_flag \
save_origin_flag:=$save_origin_flag save_disp_flag:=$save_disp_flag save_uncert_flag:=$save_uncert_flag save_depth_flag:=$save_depth_flag \
save_visual_flag:=$save_visual_flag save_pcd_flag:=$save_pcd_flag \
use_local_image_flag:=$use_local_image_flag local_image_dir:=$local_image_dir image_sleep:=$image_sleep \
camera_cx:=$camera_cx camera_cy:=$camera_cy camera_fx:=$camera_fx camera_fy:=$camera_fy baseline:=$baseline doffs:=$doffs \
left_img_mask_enable:=$left_img_mask_enable \
epipolar_mode:=$epipolar_mode epipolar_img:=$epipolar_img \
chessboard_per_rows:=$chessboard_per_rows chessboard_per_cols:=$chessboard_per_cols chessboard_square_size:=$chessboard_square_size \
feature_epipolar_mode:=$feature_epipolar_mode \
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

请问最后是如何载入离线标定文件的,yaml格式是什么呢

路径在/opt/tros/humble/share/hobot_stereonet/config/stereo.yaml

我发现我这个路径下只有hbm和bin文件