ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

image description Use 2 digital camera for stereo camera -------My_stereo_camera.launch-----------

<launch> <group ns="/stereo_camera" &gt;="" <br=""> <node name="left" pkg="usb_cam" type="usb_cam_node"> </node> <node name="right" pkg="usb_cam" type="usb_cam_node"> </node> </group> <arg name="pi/2" value="1.5707963267948966"/> <arg name="optical_rotate" value="0 0 0 -$(arg pi/2) 0 -$(arg pi/2)"/> <node pkg="tf" type="static_transform_publisher" name="camera_base_link" <="" p="">

    args="0 0 0 0 0 0 left_camera right_camera 100" />

<node pkg="tf" type="static_transform_publisher" name="camera_base_link2" args="0 0 0 0 0 0 stereo_camera left_camera 100"/>
<node pkg="tf" type="static_transform_publisher" name="camera_base_link3" args="$(arg optical_rotate) base_link stereo_camera 100"/>

</launch<>


<launch> <group ns="/stereo_camera" &gt;="" <node="" pkg="stereo_image_proc" type="stereo_image_proc" name="stereo_image_proc" required="true" output="screen"> </node> <node pkg="nodelet" type="nodelet" name="disparity2depth" args="standalone rtabmap_ros/disparity_to_depth"/> </group> </launch> ------------------------------------------------------rgbd_mapping.launch------------------------------------------------------------- <launch>

<arg name="rviz" default="true"/> <arg name="rtabmapviz" default="false"/>

<arg name="rtabmapviz_cfg" default="-d $(find rtabmap_ros)/launch/config/rgbd_gui.ini"/> <arg name="rviz_cfg" default="-d $(find rtabmap_ros)/launch/config/rgbd.rviz"/>

<arg name="frame_id" default="camera_link"/> <arg name="time_threshold" default="0"/> <arg name="optimize_from_last_node" default="false"/> <arg name="database_path" default="~/.ros/rtabmap.db"/> <arg name="rtabmap_args" default=""/> <arg name="launch_prefix" default=""/>

<arg name="rgb_topic" default="/camera/rgb/image_rect_color"/> <arg name="depth_registered_topic" default="/camera/depth_registered/image_raw"/> <arg name="camera_info_topic" default="/camera/rgb/camera_info"/> <arg name="compressed" default="false"/> <arg name="convert_depth_to_mm" default="true"/>

<arg name="subscribe_scan" default="false"/> <arg name="scan_topic" default="/scan"/>

<arg name="visual_odometry" default="true"/> <arg name="odom_topic" default="/odom"/>

<arg name="namespace" default="rtabmap"/> <arg name="wait_for_transform" default="0.1"/>

<arg name="strategy" default="0"/> <arg name="feature" default="6"/> <arg name="estimation" default="0"/> <arg name="nn" default="3"/> <arg name="max_depth" default="0"/> <arg name="min_inliers" default="20"/> <arg name="inlier_distance" default="0.1"/> <arg name="local_map" default="1000"/> <arg name="variance_inliers" default="true"/>

<group ns="$(arg namespace)">

<node if="$(arg compressed)" name="republish_rgb" type="republish" pkg="image_transport" args="compressed in:=$(arg rgb_topic) raw out:=$(arg rgb_topic)" />
<node if="$(arg compressed)" name="republish_depth" type="republish" pkg="image_transport" args="compressedDepth in:=$(arg depth_registered_topic) raw out:=$(arg depth_registered_topic)" />

<!-- Odometry -->
<node if="$(arg visual_odometry)" pkg="rtabmap_ros" type="rgbd_odometry" name="rgbd_odometry" output="screen" launch-prefix="$(arg launch_prefix)">
  <remap from="rgb/image"       to="$(arg rgb_topic)"/>
  <remap from="depth/image"     to="$(arg depth_registered_topic)"/>
  <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>

  <param name="frame_id"                 type="string" value="$(arg frame_id)"/>
  <param name="wait_for_transform_duration"       type="double"   value="$(arg wait_for_transform)"/>

  <param name="Odom/Strategy"            type="string" value="$(arg strategy)"/> 
  <param name="Odom/FeatureType"         type="string" value="$(arg feature)"/>  
  <param name="OdomBow/NNType"           type="string" value="$(arg nn)"/>
  <param name="Odom/EstimationType"      type="string" value="$(arg estimation)"/> 
  <param name="Odom/MaxDepth"            type="string" value="$(arg max_depth)"/>  
  <param name="Odom/MinInliers"          type="string" value="$(arg min_inliers)"/> 
  <param name="Odom/InlierDistance"      type="string" value="$(arg inlier_distance)"/>       
  <param name="OdomBow/LocalHistorySize" type="string" value="$(arg local_map)"/> 
  <param name="Odom/FillInfoData"        type="string" value="true"/> 
  <param name="Odom/VarianceFromInliersCount" type="string" value="$(arg variance_inliers)"/>  
</node>

<!-- Visual SLAM (robot side) -->
<node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="$(arg rtabmap_args)" launch-prefix="$(arg launch_prefix)">
  <param name="subscribe_depth"    type="bool"   value="true"/>
  <param name="subscribe_laserScan"     type="bool"   value="$(arg subscribe_scan)"/>
  <param name="frame_id"           type="string" value="$(arg frame_id)"/>
  <param name="wait_for_transform_duration" type="double"   value="$(arg wait_for_transform)"/>
  <param name="database_path"      type="string" value="$(arg database_path)"/>

  <remap from="rgb/image"       to="$(arg rgb_topic)"/>
  <remap from="depth/image"     to="$(arg depth_registered_topic)"/>
  <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>
  <remap from="scan"            to="$(arg scan_topic)"/>
  <remap unless="$(arg visual_odometry)" from="odom"  to="$(arg odom_topic)"/>

  <param name="Rtabmap/TimeThr"           type="string" value="$(arg time_threshold)"/>
  <param name="RGBD/OptimizeFromGraphEnd" type="string" value="$(arg optimize_from_last_node)"/>
  <param name="LccBow/MinInliers"         type="string" value="10"/>
  <param name="LccBow/InlierDistance"     type="string" value="$(arg inlier_distance)"/>
  <param name="LccBow/EstimationType"     type="string" value="$(arg estimation)"/> 
  <param name="LccBow/VarianceFromInliersCount" type="string" value="$(arg variance_inliers)"/>
  <param name="Mem/SaveDepth16Format"     type="string" value="$(arg convert_depth_to_mm)"/>

  <!-- when 2D scan is set -->
  <param if="$(arg subscribe_scan)" name="RGBD/OptimizeSlam2D"          type="string" value="true"/>
  <param if="$(arg subscribe_scan)" name="RGBD/LocalLoopDetectionSpace" type="string" value="true"/>
  <param if="$(arg subscribe_scan)" name="LccIcp/Type"                  type="string" value="2"/> 
  <param if="$(arg subscribe_scan)" name="LccIcp2/CorrespondenceRatio"  type="string" value="0.25"/>
</node>

<!-- Visualisation RTAB-Map -->
<node if="$(arg rtabmapviz)" pkg="rtabmap_ros" type="rtabmapviz" name="rtabmapviz" args="$(arg rtabmapviz_cfg)" output="screen" launch-prefix="$(arg launch_prefix)">
  <param name="subscribe_depth"     type="bool"   value="true"/>
  <param name="subscribe_laserScan"      type="bool"   value="$(arg subscribe_scan)"/>
  <param name="subscribe_odom_info" type="bool"   value="$(arg visual_odometry)"/>
  <param name="frame_id"            type="string" value="$(arg frame_id)"/>
  <param name="wait_for_transform_duration"  type="double"   value="$(arg wait_for_transform)"/>

  <remap from="rgb/image"       to="$(arg rgb_topic)"/>
  <remap from="depth/image"     to="$(arg depth_registered_topic)"/>
  <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>
  <remap from="scan"            to="$(arg scan_topic)"/>
  <remap unless="$(arg visual_odometry)" from="odom"  to="$(arg odom_topic)"/>
</node>

</group>

<node if="$(arg rviz)" pkg="rviz" type="rviz" name="rviz" args="$(arg rviz_cfg)"/> <node if="$(arg rviz)" pkg="nodelet" type="nodelet" name="standalone_nodelet" args="manager" output="screen"/> <node if="$(arg rviz)" pkg="nodelet" type="nodelet" name="data_odom_sync" args="load rtabmap_ros/data_odom_sync standalone_nodelet"> <remap from="rgb/image_in" to="$(arg rgb_topic)"/> <remap from="depth/image_in" to="$(arg depth_registered_topic)"/> <remap from="rgb/camera_info_in" to="$(arg camera_info_topic)"/> <remap if="$(arg visual_odometry)" from="odom_in" to="rtabmap/odom"/> <remap unless="$(arg visual_odometry)" from="odom_in" to="$(arg odom_topic)"/>

<remap from="rgb/image_out"       to="data_odom_sync/image"/>
<remap from="depth/image_out"     to="data_odom_sync/depth"/>
<remap from="rgb/camera_info_out" to="data_odom_sync/camera_info"/>
<remap from="odom_out"            to="odom_sync"/>

</node> <node if="$(arg rviz)" pkg="nodelet" type="nodelet" name="points_xyzrgb" args="load rtabmap_ros/point_cloud_xyzrgb standalone_nodelet"> <remap from="rgb/image" to="data_odom_sync/image"/> <remap from="depth/image" to="data_odom_sync/depth"/> <remap from="rgb/camera_info" to="data_odom_sync/camera_info"/> <remap from="cloud" to="voxel_cloud"/>

<param name="decimation" type="double" value="2"/>
<param name="voxel_size" type="double" value="0.02"/>

</node>

</launch>

image description Use 2 digital camera for stereo camera -------My_stereo_camera.launch-----------

-------My_stereo_camera.launch----------- <launch> <group ns="/stereo_camera" &gt;="" <br=""> <node name="left" pkg="usb_cam" type="usb_cam_node"> </node> <node name="right" pkg="usb_cam" type="usb_cam_node"> </node> </group> <arg name="pi/2" value="1.5707963267948966"/> <arg name="optical_rotate" value="0 0 0 -$(arg pi/2) 0 -$(arg pi/2)"/> <node pkg="tf" type="static_transform_publisher" name="camera_base_link" <="" p="">

    args="0 0 0 0 0 0 left_camera right_camera 100" />

<node pkg="tf" type="static_transform_publisher" name="camera_base_link2" args="0 0 0 0 0 0 stereo_camera left_camera 100"/>
<node pkg="tf" type="static_transform_publisher" name="camera_base_link3" args="$(arg optical_rotate) base_link stereo_camera 100"/>

</launch<>


<launch> <group ns="/stereo_camera" &gt;="" <node="" pkg="stereo_image_proc" type="stereo_image_proc" name="stereo_image_proc" required="true" output="screen"> </node> <node pkg="nodelet" type="nodelet" name="disparity2depth" args="standalone rtabmap_ros/disparity_to_depth"/> </group> </launch> ------------------------------------------------------rgbd_mapping.launch------------------------------------------------------------- <launch>

<arg name="rviz" default="true"/> <arg name="rtabmapviz" default="false"/>

<arg name="rtabmapviz_cfg" default="-d $(find rtabmap_ros)/launch/config/rgbd_gui.ini"/> <arg name="rviz_cfg" default="-d $(find rtabmap_ros)/launch/config/rgbd.rviz"/>

<arg name="frame_id" default="camera_link"/> <arg name="time_threshold" default="0"/> <arg name="optimize_from_last_node" default="false"/> <arg name="database_path" default="~/.ros/rtabmap.db"/> <arg name="rtabmap_args" default=""/> <arg name="launch_prefix" default=""/>

<arg name="rgb_topic" default="/camera/rgb/image_rect_color"/> <arg name="depth_registered_topic" default="/camera/depth_registered/image_raw"/> <arg name="camera_info_topic" default="/camera/rgb/camera_info"/> <arg name="compressed" default="false"/> <arg name="convert_depth_to_mm" default="true"/>

<arg name="subscribe_scan" default="false"/> <arg name="scan_topic" default="/scan"/>

<arg name="visual_odometry" default="true"/> <arg name="odom_topic" default="/odom"/>

<arg name="namespace" default="rtabmap"/> <arg name="wait_for_transform" default="0.1"/>

<arg name="strategy" default="0"/> <arg name="feature" default="6"/> <arg name="estimation" default="0"/> <arg name="nn" default="3"/> <arg name="max_depth" default="0"/> <arg name="min_inliers" default="20"/> <arg name="inlier_distance" default="0.1"/> <arg name="local_map" default="1000"/> <arg name="variance_inliers" default="true"/>

<group ns="$(arg namespace)">

<node if="$(arg compressed)" name="republish_rgb" type="republish" pkg="image_transport" args="compressed in:=$(arg rgb_topic) raw out:=$(arg rgb_topic)" />
<node if="$(arg compressed)" name="republish_depth" type="republish" pkg="image_transport" args="compressedDepth in:=$(arg depth_registered_topic) raw out:=$(arg depth_registered_topic)" />

<!-- Odometry -->
<node if="$(arg visual_odometry)" pkg="rtabmap_ros" type="rgbd_odometry" name="rgbd_odometry" output="screen" launch-prefix="$(arg launch_prefix)">
  <remap from="rgb/image"       to="$(arg rgb_topic)"/>
  <remap from="depth/image"     to="$(arg depth_registered_topic)"/>
  <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>

  <param name="frame_id"                 type="string" value="$(arg frame_id)"/>
  <param name="wait_for_transform_duration"       type="double"   value="$(arg wait_for_transform)"/>

  <param name="Odom/Strategy"            type="string" value="$(arg strategy)"/> 
  <param name="Odom/FeatureType"         type="string" value="$(arg feature)"/>  
  <param name="OdomBow/NNType"           type="string" value="$(arg nn)"/>
  <param name="Odom/EstimationType"      type="string" value="$(arg estimation)"/> 
  <param name="Odom/MaxDepth"            type="string" value="$(arg max_depth)"/>  
  <param name="Odom/MinInliers"          type="string" value="$(arg min_inliers)"/> 
  <param name="Odom/InlierDistance"      type="string" value="$(arg inlier_distance)"/>       
  <param name="OdomBow/LocalHistorySize" type="string" value="$(arg local_map)"/> 
  <param name="Odom/FillInfoData"        type="string" value="true"/> 
  <param name="Odom/VarianceFromInliersCount" type="string" value="$(arg variance_inliers)"/>  
</node>

<!-- Visual SLAM (robot side) -->
<node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="$(arg rtabmap_args)" launch-prefix="$(arg launch_prefix)">
  <param name="subscribe_depth"    type="bool"   value="true"/>
  <param name="subscribe_laserScan"     type="bool"   value="$(arg subscribe_scan)"/>
  <param name="frame_id"           type="string" value="$(arg frame_id)"/>
  <param name="wait_for_transform_duration" type="double"   value="$(arg wait_for_transform)"/>
  <param name="database_path"      type="string" value="$(arg database_path)"/>

  <remap from="rgb/image"       to="$(arg rgb_topic)"/>
  <remap from="depth/image"     to="$(arg depth_registered_topic)"/>
  <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>
  <remap from="scan"            to="$(arg scan_topic)"/>
  <remap unless="$(arg visual_odometry)" from="odom"  to="$(arg odom_topic)"/>

  <param name="Rtabmap/TimeThr"           type="string" value="$(arg time_threshold)"/>
  <param name="RGBD/OptimizeFromGraphEnd" type="string" value="$(arg optimize_from_last_node)"/>
  <param name="LccBow/MinInliers"         type="string" value="10"/>
  <param name="LccBow/InlierDistance"     type="string" value="$(arg inlier_distance)"/>
  <param name="LccBow/EstimationType"     type="string" value="$(arg estimation)"/> 
  <param name="LccBow/VarianceFromInliersCount" type="string" value="$(arg variance_inliers)"/>
  <param name="Mem/SaveDepth16Format"     type="string" value="$(arg convert_depth_to_mm)"/>

  <!-- when 2D scan is set -->
  <param if="$(arg subscribe_scan)" name="RGBD/OptimizeSlam2D"          type="string" value="true"/>
  <param if="$(arg subscribe_scan)" name="RGBD/LocalLoopDetectionSpace" type="string" value="true"/>
  <param if="$(arg subscribe_scan)" name="LccIcp/Type"                  type="string" value="2"/> 
  <param if="$(arg subscribe_scan)" name="LccIcp2/CorrespondenceRatio"  type="string" value="0.25"/>
</node>

<!-- Visualisation RTAB-Map -->
<node if="$(arg rtabmapviz)" pkg="rtabmap_ros" type="rtabmapviz" name="rtabmapviz" args="$(arg rtabmapviz_cfg)" output="screen" launch-prefix="$(arg launch_prefix)">
  <param name="subscribe_depth"     type="bool"   value="true"/>
  <param name="subscribe_laserScan"      type="bool"   value="$(arg subscribe_scan)"/>
  <param name="subscribe_odom_info" type="bool"   value="$(arg visual_odometry)"/>
  <param name="frame_id"            type="string" value="$(arg frame_id)"/>
  <param name="wait_for_transform_duration"  type="double"   value="$(arg wait_for_transform)"/>

  <remap from="rgb/image"       to="$(arg rgb_topic)"/>
  <remap from="depth/image"     to="$(arg depth_registered_topic)"/>
  <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>
  <remap from="scan"            to="$(arg scan_topic)"/>
  <remap unless="$(arg visual_odometry)" from="odom"  to="$(arg odom_topic)"/>
</node>

</group>

<node if="$(arg rviz)" pkg="rviz" type="rviz" name="rviz" args="$(arg rviz_cfg)"/> <node if="$(arg rviz)" pkg="nodelet" type="nodelet" name="standalone_nodelet" args="manager" output="screen"/> <node if="$(arg rviz)" pkg="nodelet" type="nodelet" name="data_odom_sync" args="load rtabmap_ros/data_odom_sync standalone_nodelet"> <remap from="rgb/image_in" to="$(arg rgb_topic)"/> <remap from="depth/image_in" to="$(arg depth_registered_topic)"/> <remap from="rgb/camera_info_in" to="$(arg camera_info_topic)"/> <remap if="$(arg visual_odometry)" from="odom_in" to="rtabmap/odom"/> <remap unless="$(arg visual_odometry)" from="odom_in" to="$(arg odom_topic)"/>

<remap from="rgb/image_out"       to="data_odom_sync/image"/>
<remap from="depth/image_out"     to="data_odom_sync/depth"/>
<remap from="rgb/camera_info_out" to="data_odom_sync/camera_info"/>
<remap from="odom_out"            to="odom_sync"/>

</node> <node if="$(arg rviz)" pkg="nodelet" type="nodelet" name="points_xyzrgb" args="load rtabmap_ros/point_cloud_xyzrgb standalone_nodelet"> <remap from="rgb/image" to="data_odom_sync/image"/> <remap from="depth/image" to="data_odom_sync/depth"/> <remap from="rgb/camera_info" to="data_odom_sync/camera_info"/> <remap from="cloud" to="voxel_cloud"/>

<param name="decimation" type="double" value="2"/>
<param name="voxel_size" type="double" value="0.02"/>

</node>

</launch>

image description Use 2 digital camera for stereo camera -------My_stereo_camera.launch----------- <launch> -------My_stereo_camera.launch-----------

Blockquote

<group ns="/stereo_camera" &gt;="" <br=""> <node name="left" pkg="usb_cam" type="usb_cam_node"> </node> <node name="right" pkg="usb_cam" type="usb_cam_node"> </node> </group> <arg name="pi/2" value="1.5707963267948966"/> <arg name="optical_rotate" value="0 0 0 -$(arg pi/2) 0 -$(arg pi/2)"/> <node pkg="tf" type="static_transform_publisher" name="camera_base_link" <="" p="">

 args="0 0 0 0 0 0 left_camera right_camera 100" />

100"/>
<node pkg="tf" type="static_transform_publisher" name="camera_base_link2" args="0 0 0 0 0 0 stereo_camera left_camera 100"/>
<node pkg="tf" type="static_transform_publisher" name="camera_base_link3" args="$(arg optical_rotate) base_link stereo_camera 100"/>

</launch<>


<launch> <group ns="/stereo_camera" &gt;="" <node="" pkg="stereo_image_proc" type="stereo_image_proc" name="stereo_image_proc" required="true" output="screen"> </node> <node pkg="nodelet" type="nodelet" name="disparity2depth" args="standalone rtabmap_ros/disparity_to_depth"/> </group> </launch>

Blockquote

Check my code, please?

image description Use 2 digital camera for stereo camera -------My_stereo_camera.launch-----------camera

Blockquote

My_stereo_camera.launch

<launch>
<group ns="/stereo_camera" &gt;="" <br="">
>  
        <node name="left" pkg="usb_cam" type="usb_cam_node">
              <param name="video_device" value="/dev/video1" />
        <param name="image_width" value="640" />
        <param name="image_height" value="480" />
        <param name="camera_info_url" type="string" value="file:///home/greenout/catkin_ws/left.yaml" />
        <param name="framerate" value="60" />
        <param name="camera_frame_id" value="left_camera" />
    </node>
 <node name="right" pkg="usb_cam" type="usb_cam_node">
              <param name="video_device" value="/dev/video0" />
        <param name="image_width" value="640" />
        <param name="image_height" value="480" /> 
        <param name="camera_info_url" type="string" value="file:///home/greenout/catkin_ws/right.yaml" />
        <param name="framerate" value="60" />
        <param name="camera_frame_id" value="right_camera" />
    </node>
</group>
   <!-- Rotate the camera frame. -->
  <arg name="pi/2" value="1.5707963267948966"/>
value="1.5707963267948966" />
  <arg name="optical_rotate" value="0 0 0 -$(arg pi/2) 0 -$(arg pi/2)"/>
pi/2)" />
  <node pkg="tf" type="static_transform_publisher" name="camera_base_link" name="camera_base_link"

        args="0 0 0 0 0 0 left_camera right_camera 100"/> 
100" /> <node pkg="tf" type="static_transform_publisher" name="camera_base_link2" name="camera_base_link2" args="0 0 0 0 0 0 stereo_camera left_camera 100"/>
100" /> <node pkg="tf" type="static_transform_publisher" name="camera_base_link3" name="camera_base_link3" args="$(arg optical_rotate) base_link stereo_camera 100"/>

Blockquote

100" />

</launch>

stereo_image_proc for image rectification and disparity computation

<launch>
  <!-- Run the ROS package stereo_image_proc for image rectification and disparity computation -->
<group ns="/stereo_camera" >
    <node   pkg="stereo_image_proc" type="stereo_image_proc" name="stereo_image_proc" required="true" output = "screen">
                    <param name="approximate_sync"           value="true"/>
    </node>
    <node pkg="nodelet" type="nodelet" name="disparity2depth" args="standalone rtabmap_ros/disparity_to_depth"/>
</group>
</launch>

rgbd_mapping.launch

<launch>
  <!-- Your RGB-D sensor should be already started with "depth_registration:=true".
        Examples:
           $ roslaunch freenect_launch freenect.launch depth_registration:=true 
           $ roslaunch openni2_launch openni2.launch depth_registration:=true -->

  <!-- Choose visualization -->
  <arg name="rviz"                    default="true" />
  <arg name="rtabmapviz"              default="false" /> 

  <!-- Corresponding config files -->
  <arg name="rtabmapviz_cfg"          default="-d $(find rtabmap_ros)/launch/config/rgbd_gui.ini" />
  <arg name="rviz_cfg"                default="-d $(find rtabmap_ros)/launch/config/rgbd.rviz" />

  <arg name="frame_id"                default="camera_link"/>   <!-- Fixed frame id, you may set "base_link" or "base_footprint" if they are published -->
  <arg name="time_threshold"          default="0"/>             <!-- (ms) If not 0 ms, memory management is used to keep processing time on this fixed limit. -->
  <arg name="optimize_from_last_node" default="false"/>         <!-- Optimize the map from the last node. Should be true on multi-session mapping and when time threshold is set -->
  <arg name="database_path"           default="~/.ros/rtabmap.db"/>
  <arg name="rtabmap_args"            default=""/>              <!-- delete_db_on_start, udebug -->
  <arg name="launch_prefix"           default=""/>              <!-- for debugging purpose, it fills launch-prefix tag of the nodes -->

  <arg name="rgb_topic"               default="/camera/rgb/image_rect_color" />
  <arg name="depth_registered_topic"  default="/camera/depth_registered/image_raw" />
  <arg name="camera_info_topic"       default="/camera/rgb/camera_info" />
  <arg name="compressed"              default="false"/>
  <arg name="convert_depth_to_mm"     default="true"/>

  <arg name="subscribe_scan"          default="false"/>         <!-- Assuming 2D scan if set, rtabmap will do 3DoF mapping instead of 6DoF -->
  <arg name="scan_topic"              default="/scan"/>

  <arg name="visual_odometry"         default="true"/>          <!-- Generate visual odometry -->
  <arg name="odom_topic"              default="/odom"/>         <!-- Odometry topic used if visual_odometry is false -->

  <arg name="namespace"               default="rtabmap"/>
  <arg name="wait_for_transform"      default="0.1"/>

  <!-- Odometry parameters: -->
  <arg name="strategy"            default="0" />       <!-- Strategy: 0=BOW (bag-of-words) 1=Optical Flow -->
  <arg name="feature"             default="6" />       <!-- Feature type: 0=SURF 1=SIFT 2=ORB 3=FAST/FREAK 4=FAST/BRIEF 5=GFTT/FREAK 6=GFTT/BRIEF 7=BRISK -->
  <arg name="estimation"          default="0" />       <!-- Motion estimation approach: 0:3D->3D, 1:3D->2D (PnP) -->
  <arg name="nn"                  default="3" />       <!-- Nearest neighbor strategy : 0=Linear, 1=FLANN_KDTREE (SIFT, SURF), 2=FLANN_LSH, 3=BRUTEFORCE (ORB/FREAK/BRIEF/BRISK) -->
  <arg name="max_depth"           default="0" />       <!-- Maximum features depth (m) -->
  <arg name="min_inliers"         default="20" />      <!-- Minimum visual correspondences to accept a transformation (m) -->
  <arg name="inlier_distance"     default="0.1" />     <!-- RANSAC maximum inliers distance (m) -->
  <arg name="local_map"           default="1000" />    <!-- Local map size: number of unique features to keep track -->
  <arg name="variance_inliers"    default="true"/>    <!-- Variance from inverse of inliers count -->  

  <!-- Nodes -->
  <group ns="$(arg namespace)">

    <node if="$(arg compressed)" name="republish_rgb" type="republish" pkg="image_transport" args="compressed in:=$(arg rgb_topic) raw out:=$(arg rgb_topic)" />
    <node if="$(arg compressed)" name="republish_depth" type="republish" pkg="image_transport" args="compressedDepth in:=$(arg depth_registered_topic) raw out:=$(arg depth_registered_topic)" />

    <!-- Odometry -->
    <node if="$(arg visual_odometry)" pkg="rtabmap_ros" type="rgbd_odometry" name="rgbd_odometry" output="screen" launch-prefix="$(arg launch_prefix)">
      <remap from="rgb/image"       to="$(arg rgb_topic)"/>
      <remap from="depth/image"     to="$(arg depth_registered_topic)"/>
      <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>

      <param name="frame_id"                 type="string" value="$(arg frame_id)"/>
      <param name="wait_for_transform_duration"       type="double"   value="$(arg wait_for_transform)"/>

      <param name="Odom/Strategy"            type="string" value="$(arg strategy)"/> 
      <param name="Odom/FeatureType"         type="string" value="$(arg feature)"/>  
      <param name="OdomBow/NNType"           type="string" value="$(arg nn)"/>
      <param name="Odom/EstimationType"      type="string" value="$(arg estimation)"/> 
      <param name="Odom/MaxDepth"            type="string" value="$(arg max_depth)"/>  
      <param name="Odom/MinInliers"          type="string" value="$(arg min_inliers)"/> 
      <param name="Odom/InlierDistance"      type="string" value="$(arg inlier_distance)"/>       
      <param name="OdomBow/LocalHistorySize" type="string" value="$(arg local_map)"/> 
      <param name="Odom/FillInfoData"        type="string" value="true"/> 
      <param name="Odom/VarianceFromInliersCount" type="string" value="$(arg variance_inliers)"/>  
    </node>

    <!-- Visual SLAM (robot side) -->
    <node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="$(arg rtabmap_args)" launch-prefix="$(arg launch_prefix)">
      <param name="subscribe_depth"    type="bool"   value="true"/>
      <param name="subscribe_laserScan"     type="bool"   value="$(arg subscribe_scan)"/>
      <param name="frame_id"           type="string" value="$(arg frame_id)"/>
      <param name="wait_for_transform_duration" type="double"   value="$(arg wait_for_transform)"/>
      <param name="database_path"      type="string" value="$(arg database_path)"/>

      <remap from="rgb/image"       to="$(arg rgb_topic)"/>
      <remap from="depth/image"     to="$(arg depth_registered_topic)"/>
      <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>
      <remap from="scan"            to="$(arg scan_topic)"/>
      <remap unless="$(arg visual_odometry)" from="odom"  to="$(arg odom_topic)"/>

      <param name="Rtabmap/TimeThr"           type="string" value="$(arg time_threshold)"/>
      <param name="RGBD/OptimizeFromGraphEnd" type="string" value="$(arg optimize_from_last_node)"/>
      <param name="LccBow/MinInliers"         type="string" value="10"/>
      <param name="LccBow/InlierDistance"     type="string" value="$(arg inlier_distance)"/>
      <param name="LccBow/EstimationType"     type="string" value="$(arg estimation)"/> 
      <param name="LccBow/VarianceFromInliersCount" type="string" value="$(arg variance_inliers)"/>
      <param name="Mem/SaveDepth16Format"     type="string" value="$(arg convert_depth_to_mm)"/>

      <!-- when 2D scan is set -->
      <param if="$(arg subscribe_scan)" name="RGBD/OptimizeSlam2D"          type="string" value="true"/>
      <param if="$(arg subscribe_scan)" name="RGBD/LocalLoopDetectionSpace" type="string" value="true"/>
      <param if="$(arg subscribe_scan)" name="LccIcp/Type"                  type="string" value="2"/> 
      <param if="$(arg subscribe_scan)" name="LccIcp2/CorrespondenceRatio"  type="string" value="0.25"/>
    </node>

    <!-- Visualisation RTAB-Map -->
    <node if="$(arg rtabmapviz)" pkg="rtabmap_ros" type="rtabmapviz" name="rtabmapviz" args="$(arg rtabmapviz_cfg)" output="screen" launch-prefix="$(arg launch_prefix)">
      <param name="subscribe_depth"     type="bool"   value="true"/>
      <param name="subscribe_laserScan"      type="bool"   value="$(arg subscribe_scan)"/>
      <param name="subscribe_odom_info" type="bool"   value="$(arg visual_odometry)"/>
      <param name="frame_id"            type="string" value="$(arg frame_id)"/>
      <param name="wait_for_transform_duration"  type="double"   value="$(arg wait_for_transform)"/>

      <remap from="rgb/image"       to="$(arg rgb_topic)"/>
      <remap from="depth/image"     to="$(arg depth_registered_topic)"/>
      <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>
      <remap from="scan"            to="$(arg scan_topic)"/>
      <remap unless="$(arg visual_odometry)" from="odom"  to="$(arg odom_topic)"/>
    </node>

  </group>

  <!-- Visualization RVIZ -->
  <node if="$(arg rviz)" pkg="rviz" type="rviz" name="rviz" args="$(arg rviz_cfg)"/>
  <!-- sync cloud with odometry and voxelize the point cloud (for fast visualization in rviz) -->
  <node if="$(arg rviz)" pkg="nodelet" type="nodelet" name="standalone_nodelet"  args="manager" output="screen"/>
  <node if="$(arg rviz)" pkg="nodelet" type="nodelet" name="data_odom_sync" args="load rtabmap_ros/data_odom_sync standalone_nodelet">
    <remap from="rgb/image_in"        to="$(arg rgb_topic)"/>
    <remap from="depth/image_in"      to="$(arg depth_registered_topic)"/>
    <remap from="rgb/camera_info_in"  to="$(arg camera_info_topic)"/>
    <remap if="$(arg visual_odometry)"     from="odom_in"  to="rtabmap/odom"/>
    <remap unless="$(arg visual_odometry)" from="odom_in"  to="$(arg odom_topic)"/>

    <remap from="rgb/image_out"       to="data_odom_sync/image"/>
    <remap from="depth/image_out"     to="data_odom_sync/depth"/>
    <remap from="rgb/camera_info_out" to="data_odom_sync/camera_info"/>
    <remap from="odom_out"            to="odom_sync"/>
  </node>
  <node if="$(arg rviz)" pkg="nodelet" type="nodelet" name="points_xyzrgb" args="load rtabmap_ros/point_cloud_xyzrgb standalone_nodelet">
    <remap from="rgb/image"       to="data_odom_sync/image"/>
    <remap from="depth/image"     to="data_odom_sync/depth"/>
    <remap from="rgb/camera_info" to="data_odom_sync/camera_info"/>
    <remap from="cloud"           to="voxel_cloud" />

    <param name="decimation" type="double" value="2"/>
    <param name="voxel_size" type="double" value="0.02"/>
  </node>

</launch>

Check my code, result , please?

image description image description

roslaunch rtabmap_ros rgbd_mapping.launch rgb_topic:=/stereo_camera/left/image_rect_color depth_registered_topic:=/stereo_camera/depth camera_info_topic:=/stereo_camera/left/camera_info frame_id:=base_link rtabmap_args:="--delete_db_on_start" estimation:=1 compressed:=true

Use 2 digital camera for stereo camera

My_stereo_camera.launch

<launch>
<group ns="/stereo_camera" >  
        <node name="left" pkg="usb_cam" type="usb_cam_node">
        <param name="video_device" value="/dev/video1" />
        <param name="image_width" value="640" />
        <param name="image_height" value="480" />
        <param name="camera_info_url" type="string" value="file:///home/greenout/catkin_ws/left.yaml" />
        <param name="framerate" value="60" />
        <param name="camera_frame_id" value="left_camera" />
    </node>
 <node name="right" pkg="usb_cam" type="usb_cam_node">
        <param name="video_device" value="/dev/video0" />
        <param name="image_width" value="640" />
        <param name="image_height" value="480" /> 
        <param name="camera_info_url" type="string" value="file:///home/greenout/catkin_ws/right.yaml" />
        <param name="framerate" value="60" />
        <param name="camera_frame_id" value="right_camera" />
    </node>
</group>
  <!-- Rotate the camera frame. -->
  <arg name="pi/2" value="1.5707963267948966" />
  <arg name="optical_rotate" value="0 0 0 -$(arg pi/2) 0 -$(arg pi/2)" />
  <node pkg="tf" type="static_transform_publisher" name="camera_base_link"

        args="0 0 0 0 0 0 left_camera right_camera 100" />  
  <node pkg="tf" type="static_transform_publisher" name="camera_base_link2"
        args="0 0 0 0 0 0 stereo_camera left_camera 100" />  
  <node pkg="tf" type="static_transform_publisher" name="camera_base_link3"
        args="$(arg optical_rotate) base_link stereo_camera 100" />

</launch>

stereo_image_proc for image rectification and disparity computation

<launch>
  <!-- Run the ROS package stereo_image_proc for image rectification and disparity computation -->
<group ns="/stereo_camera" >
    <node   pkg="stereo_image_proc" type="stereo_image_proc" name="stereo_image_proc" required="true" output = "screen">
                    <param name="approximate_sync"           value="true"/>
    </node>
    <node pkg="nodelet" type="nodelet" name="disparity2depth" args="standalone rtabmap_ros/disparity_to_depth"/>
</group>
</launch>

rgbd_mapping.launch

<launch>
  <!-- Your RGB-D sensor should be already started with "depth_registration:=true".
        Examples:
           $ roslaunch freenect_launch freenect.launch depth_registration:=true 
           $ roslaunch openni2_launch openni2.launch depth_registration:=true -->

  <!-- Choose visualization -->
  <arg name="rviz"                    default="true" />
  <arg name="rtabmapviz"              default="false" /> 

  <!-- Corresponding config files -->
  <arg name="rtabmapviz_cfg"          default="-d $(find rtabmap_ros)/launch/config/rgbd_gui.ini" />
  <arg name="rviz_cfg"                default="-d $(find rtabmap_ros)/launch/config/rgbd.rviz" />

  <arg name="frame_id"                default="camera_link"/>   <!-- Fixed frame id, you may set "base_link" or "base_footprint" if they are published -->
  <arg name="time_threshold"          default="0"/>             <!-- (ms) If not 0 ms, memory management is used to keep processing time on this fixed limit. -->
  <arg name="optimize_from_last_node" default="false"/>         <!-- Optimize the map from the last node. Should be true on multi-session mapping and when time threshold is set -->
  <arg name="database_path"           default="~/.ros/rtabmap.db"/>
  <arg name="rtabmap_args"            default=""/>              <!-- delete_db_on_start, udebug -->
  <arg name="launch_prefix"           default=""/>              <!-- for debugging purpose, it fills launch-prefix tag of the nodes -->

  <arg name="rgb_topic"               default="/camera/rgb/image_rect_color" />
  <arg name="depth_registered_topic"  default="/camera/depth_registered/image_raw" />
  <arg name="camera_info_topic"       default="/camera/rgb/camera_info" />
  <arg name="compressed"              default="false"/>
  <arg name="convert_depth_to_mm"     default="true"/>

  <arg name="subscribe_scan"          default="false"/>         <!-- Assuming 2D scan if set, rtabmap will do 3DoF mapping instead of 6DoF -->
  <arg name="scan_topic"              default="/scan"/>

  <arg name="visual_odometry"         default="true"/>          <!-- Generate visual odometry -->
  <arg name="odom_topic"              default="/odom"/>         <!-- Odometry topic used if visual_odometry is false -->

  <arg name="namespace"               default="rtabmap"/>
  <arg name="wait_for_transform"      default="0.1"/>

  <!-- Odometry parameters: -->
  <arg name="strategy"            default="0" />       <!-- Strategy: 0=BOW (bag-of-words) 1=Optical Flow -->
  <arg name="feature"             default="6" />       <!-- Feature type: 0=SURF 1=SIFT 2=ORB 3=FAST/FREAK 4=FAST/BRIEF 5=GFTT/FREAK 6=GFTT/BRIEF 7=BRISK -->
  <arg name="estimation"          default="0" />       <!-- Motion estimation approach: 0:3D->3D, 1:3D->2D (PnP) -->
  <arg name="nn"                  default="3" />       <!-- Nearest neighbor strategy : 0=Linear, 1=FLANN_KDTREE (SIFT, SURF), 2=FLANN_LSH, 3=BRUTEFORCE (ORB/FREAK/BRIEF/BRISK) -->
  <arg name="max_depth"           default="0" />       <!-- Maximum features depth (m) -->
  <arg name="min_inliers"         default="20" />      <!-- Minimum visual correspondences to accept a transformation (m) -->
  <arg name="inlier_distance"     default="0.1" />     <!-- RANSAC maximum inliers distance (m) -->
  <arg name="local_map"           default="1000" />    <!-- Local map size: number of unique features to keep track -->
  <arg name="variance_inliers"    default="true"/>    <!-- Variance from inverse of inliers count -->  

  <!-- Nodes -->
  <group ns="$(arg namespace)">

    <node if="$(arg compressed)" name="republish_rgb" type="republish" pkg="image_transport" args="compressed in:=$(arg rgb_topic) raw out:=$(arg rgb_topic)" />
    <node if="$(arg compressed)" name="republish_depth" type="republish" pkg="image_transport" args="compressedDepth in:=$(arg depth_registered_topic) raw out:=$(arg depth_registered_topic)" />

    <!-- Odometry -->
    <node if="$(arg visual_odometry)" pkg="rtabmap_ros" type="rgbd_odometry" name="rgbd_odometry" output="screen" launch-prefix="$(arg launch_prefix)">
      <remap from="rgb/image"       to="$(arg rgb_topic)"/>
      <remap from="depth/image"     to="$(arg depth_registered_topic)"/>
      <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>

      <param name="frame_id"                 type="string" value="$(arg frame_id)"/>
      <param name="wait_for_transform_duration"       type="double"   value="$(arg wait_for_transform)"/>

      <param name="Odom/Strategy"            type="string" value="$(arg strategy)"/> 
      <param name="Odom/FeatureType"         type="string" value="$(arg feature)"/>  
      <param name="OdomBow/NNType"           type="string" value="$(arg nn)"/>
      <param name="Odom/EstimationType"      type="string" value="$(arg estimation)"/> 
      <param name="Odom/MaxDepth"            type="string" value="$(arg max_depth)"/>  
      <param name="Odom/MinInliers"          type="string" value="$(arg min_inliers)"/> 
      <param name="Odom/InlierDistance"      type="string" value="$(arg inlier_distance)"/>       
      <param name="OdomBow/LocalHistorySize" type="string" value="$(arg local_map)"/> 
      <param name="Odom/FillInfoData"        type="string" value="true"/> 
      <param name="Odom/VarianceFromInliersCount" type="string" value="$(arg variance_inliers)"/>  
    </node>

    <!-- Visual SLAM (robot side) -->
    <node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="$(arg rtabmap_args)" launch-prefix="$(arg launch_prefix)">
      <param name="subscribe_depth"    type="bool"   value="true"/>
      <param name="subscribe_laserScan"     type="bool"   value="$(arg subscribe_scan)"/>
      <param name="frame_id"           type="string" value="$(arg frame_id)"/>
      <param name="wait_for_transform_duration" type="double"   value="$(arg wait_for_transform)"/>
      <param name="database_path"      type="string" value="$(arg database_path)"/>

      <remap from="rgb/image"       to="$(arg rgb_topic)"/>
      <remap from="depth/image"     to="$(arg depth_registered_topic)"/>
      <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>
      <remap from="scan"            to="$(arg scan_topic)"/>
      <remap unless="$(arg visual_odometry)" from="odom"  to="$(arg odom_topic)"/>

      <param name="Rtabmap/TimeThr"           type="string" value="$(arg time_threshold)"/>
      <param name="RGBD/OptimizeFromGraphEnd" type="string" value="$(arg optimize_from_last_node)"/>
      <param name="LccBow/MinInliers"         type="string" value="10"/>
      <param name="LccBow/InlierDistance"     type="string" value="$(arg inlier_distance)"/>
      <param name="LccBow/EstimationType"     type="string" value="$(arg estimation)"/> 
      <param name="LccBow/VarianceFromInliersCount" type="string" value="$(arg variance_inliers)"/>
      <param name="Mem/SaveDepth16Format"     type="string" value="$(arg convert_depth_to_mm)"/>

      <!-- when 2D scan is set -->
      <param if="$(arg subscribe_scan)" name="RGBD/OptimizeSlam2D"          type="string" value="true"/>
      <param if="$(arg subscribe_scan)" name="RGBD/LocalLoopDetectionSpace" type="string" value="true"/>
      <param if="$(arg subscribe_scan)" name="LccIcp/Type"                  type="string" value="2"/> 
      <param if="$(arg subscribe_scan)" name="LccIcp2/CorrespondenceRatio"  type="string" value="0.25"/>
    </node>

    <!-- Visualisation RTAB-Map -->
    <node if="$(arg rtabmapviz)" pkg="rtabmap_ros" type="rtabmapviz" name="rtabmapviz" args="$(arg rtabmapviz_cfg)" output="screen" launch-prefix="$(arg launch_prefix)">
      <param name="subscribe_depth"     type="bool"   value="true"/>
      <param name="subscribe_laserScan"      type="bool"   value="$(arg subscribe_scan)"/>
      <param name="subscribe_odom_info" type="bool"   value="$(arg visual_odometry)"/>
      <param name="frame_id"            type="string" value="$(arg frame_id)"/>
      <param name="wait_for_transform_duration"  type="double"   value="$(arg wait_for_transform)"/>

      <remap from="rgb/image"       to="$(arg rgb_topic)"/>
      <remap from="depth/image"     to="$(arg depth_registered_topic)"/>
      <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>
      <remap from="scan"            to="$(arg scan_topic)"/>
      <remap unless="$(arg visual_odometry)" from="odom"  to="$(arg odom_topic)"/>
    </node>

  </group>

  <!-- Visualization RVIZ -->
  <node if="$(arg rviz)" pkg="rviz" type="rviz" name="rviz" args="$(arg rviz_cfg)"/>
  <!-- sync cloud with odometry and voxelize the point cloud (for fast visualization in rviz) -->
  <node if="$(arg rviz)" pkg="nodelet" type="nodelet" name="standalone_nodelet"  args="manager" output="screen"/>
  <node if="$(arg rviz)" pkg="nodelet" type="nodelet" name="data_odom_sync" args="load rtabmap_ros/data_odom_sync standalone_nodelet">
    <remap from="rgb/image_in"        to="$(arg rgb_topic)"/>
    <remap from="depth/image_in"      to="$(arg depth_registered_topic)"/>
    <remap from="rgb/camera_info_in"  to="$(arg camera_info_topic)"/>
    <remap if="$(arg visual_odometry)"     from="odom_in"  to="rtabmap/odom"/>
    <remap unless="$(arg visual_odometry)" from="odom_in"  to="$(arg odom_topic)"/>

    <remap from="rgb/image_out"       to="data_odom_sync/image"/>
    <remap from="depth/image_out"     to="data_odom_sync/depth"/>
    <remap from="rgb/camera_info_out" to="data_odom_sync/camera_info"/>
    <remap from="odom_out"            to="odom_sync"/>
  </node>
  <node if="$(arg rviz)" pkg="nodelet" type="nodelet" name="points_xyzrgb" args="load rtabmap_ros/point_cloud_xyzrgb standalone_nodelet">
    <remap from="rgb/image"       to="data_odom_sync/image"/>
    <remap from="depth/image"     to="data_odom_sync/depth"/>
    <remap from="rgb/camera_info" to="data_odom_sync/camera_info"/>
    <remap from="cloud"           to="voxel_cloud" />

    <param name="decimation" type="double" value="2"/>
    <param name="voxel_size" type="double" value="0.02"/>
  </node>

</launch>