#!/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 depth_image_topic="~/stereonet_depth" depth_camera_info_topic="~/stereonet_depth/camera_info" pointcloud2_topic="~/stereonet_pointcloud2" 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" # 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=origin chessboard_per_rows=20 chessboard_per_cols=11 chessboard_square_size=0.06 # 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 ;; --depth_image_topic) depth_image_topic=$2; shift 2 ;; --depth_camera_info_topic) depth_camera_info_topic=$2; shift 2 ;; --pointcloud2_topic) pointcloud2_topic=$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 ;; # 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 \ depth_image_topic:=$depth_image_topic depth_camera_info_topic:=$depth_camera_info_topic \ pointcloud2_topic:=$pointcloud2_topic 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 \ 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 \ 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