0
$\begingroup$

Rosanswers logo

hi, i am new in rtabmap and have a question . can i use the demo_turtlebot_mapping.launch for turtlebot in simulation (Gazebo) by use of stereo images?


Edit: hi matlabbe i change launch file according to your answer but the launch file have two error

<launch>

<!--For turtlebot in simulation (Gazebo):
         $ roslaunch turtlebot_gazebo turtlebot_world.launch
         -->

  <arg name="database_path"     default="rtabmap.db"/>
  <arg name="rgbd_odometry"     default="false"/>
  <arg name="rtabmapviz"        default="false"/>
  <arg name="localization"      default="false"/>
  <arg     if="$(arg localization)" name="args"  default=""/>
  <arg unless="$(arg localization)" name="args"  default="--delete_db_on_start"/>
  <arg name="wait_for_transform"  default="0.2"/> 
  
  

   <!-- stereo_20Hz directory -->
 
   <arg name="dir"        default="$(env HOME)/Downloads/stereo_20Hz" />

   <!-- Choose visualization -->
   
   <arg name="rate"       default="20" />

    <!-- Run stereo_sequence_publisher to publish synchronized images -->
   <node name="stereo_pub" pkg="bag_tools" type="stereo_sequence_publisher.py" output="screen">
      <param name="image_dir_left"         value="$(arg dir)/left"/>
      <param name="image_dir_right"        value="$(arg dir)/right"/>
      <param name="file_pattern"           value="*.jpg"/>
      <param name="camera_info_file_left"  value="$(arg dir)/stereo_20Hz_ros_left.yaml"/>
      <param name="camera_info_file_right" value="$(arg dir)/stereo_20Hz_ros_right.yaml"/>
      <param name="frequency"              value="$(arg rate)"/>
      <remap from="/stereo_camera/left/image_color"  to="/stereo_camera/left/image_raw" />
      <remap from="/stereo_camera/right/image_color" to="/stereo_camera/right/image_raw" />
      <remap from="/stereo_camera/left/camera_info"  to="/stereo_camera/left/camera_info" />
      <remap from="/stereo_camera/right/camera_info" to="/stereo_camera/right/camera_info" />
   </node>

<!-- rotate camera so z axis is up and x forward. -->
   <arg name="pi/2" value="1.5707963267948966" />
   <node pkg="tf" type="static_transform_publisher" name="camera_base_link" args="0 0 0 -$(arg pi/2) 0 -$(arg pi/2) camera_link stereo_20Hz_left 100" />

   <!-- 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"/>
   <!-- Disparity to depth -->
    <node pkg="nodelet" type="nodelet" name="disparity2depth" args="standalone rtabmap_ros/disparity_to_depth"/>
    <remap from="/disparity"  to="/stereo_camera/disparity" />
   </group>

   
<!-- Navigation stuff (move_base) -->
    <include file="$(find turtlebot_navigation)/launch/includes/move_base.launch.xml"/>



<!-- Mapping -->
  <group ns="rtabmap">

    <node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="$(arg args)">
      <param name="database_path"       type="string" value="$(arg database_path)"/>
      <param name="frame_id"            type="string" value="base_footprint"/>
      <param name="odom_frame_id"       type="string" value="odom"/>
      <param name="wait_for_transform_duration"  type="double"   value="$(arg wait_for_transform)"/>
      <param name="subscribe_depth"     type="bool"   value="true"/>
      <param name="subscribe_scan"      type="bool"   value="true"/>
    
      <!-- inputs -->
      <remap from="scan"            to="/scan"/>
      <remap from="rgb/image"       to="/stereo_camera/left/image_rect"/>
      <remap from="depth/image"     to="/stereo_camera/depth"/>
      <remap from="rgb/camera_info" to="/stereo_camera/left/camera_info"/>
      
      <!-- output -->
      <remap from="grid_map" to="/map"/>

<!-- RTAB-Map's parameters: do "rosrun rtabmap rtabmap (double-dash)params" to see the list of available parameters. -->
      <param name="RGBD/ProximityBySpace"        type="string" value="true"/>   <!-- Local loop closure detection (using estimated position) with locations in WM -->
      <param name="RGBD/OptimizeFromGraphEnd"    type="string" value="false"/>  <!-- Set to false to generate map correction between /map and /odom -->
      <param name="Kp/MaxDepth"                  type="string" value="4.0"/>
      <param name="Reg/Strategy"                 type="string" value="0"/>      <!-- Loop closure transformation: 0=Visual, 1=ICP, 2=Visual+ICP -->
      <param name="Icp/CorrespondenceRatio"      type="string" value="0.3"/>
      <param name="Vis/MinInliers"               type="string" value="15"/>      <!-- 3D visual words minimum inliers to accept loop closure -->
      <param name="Vis/InlierDistance"           type="string" value="0.1"/>    <!-- 3D visual words correspondence distance -->
      <param name="RGBD/AngularUpdate"           type="string" value="0.1"/>    <!-- Update map only if the robot is moving -->
      <param name="RGBD/LinearUpdate"            type="string" value="0.1"/>    <!-- Update map only if the robot is moving -->
      <param name="RGBD/ProximityPathMaxNeighbors" type="string" value="0"/> 
      <param name="Rtabmap/TimeThr"              type="string" value="700"/>
      <param name="Mem/RehearsalSimilarity"      type="string" value="0.30"/>
      <param name="Optimizer/Slam2D"             type="string" value="true"/>
      <param name="Reg/Force3DoF"                type="string" value="true"/>   
      
      <!-- localization mode -->
      <param     if="$(arg localization)" name="Mem/IncrementalMemory" type="string" value="false"/>
      <param unless="$(arg localization)" name="Mem/IncrementalMemory" type="string" value="true"/>
      <param name="Mem/InitWMWithAllNodes" type="string" value="$(arg localization)"/> 
    </node>

<!-- Odometry : ONLY for testing without the actual robot! /odom TF should not be already published. -->
    <node if="$(arg rgbd_odometry)" pkg="rtabmap_ros" type="rgbd_odometry" name="rgbd_odometry" output="screen">
      <param name="frame_id"                    type="string" value="base_footprint"/>
      <param name="wait_for_transform_duration" type="double" value="$(arg wait_for_transform)"/>
      <param name="Reg/Force3DoF"               type="string" value="true"/>
      <param name="Vis/InlierDistance"          type="string" value="0.05"/>
      
      <remap from="rgb/image"       to="/stereo_camera/left/image_rect"/>
      <remap from="depth/image"     to="/stereo_camera/depth"/>
      <remap from="rgb/camera_info" to="/stereo_camera/left/camera_info"/>
    </node>
    
    <!-- visualization with rtabmapviz -->
    <node if="$(arg rtabmapviz)" pkg="rtabmap_ros" type="rtabmapviz" name="rtabmapviz" args="-d $(find rtabmap_ros)/launch/config/rgbd_gui.ini" output="screen">
      <param name="subscribe_depth"             type="bool" value="true"/>
      <param name="subscribe_scan"              type="bool" value="true"/>
      <param name="frame_id"                    type="string" value="base_footprint"/>
      <param name="wait_for_transform_duration" type="double" value="$(arg wait_for_transform)"/>
    
      <remap from="rgb/image"       to="/stereo_camera/left/image_rect"/>
      <remap from="depth/image"     to="/stereo_camera/depth"/>
      <remap from="rgb/camera_info" to="/stereo_camera/left/camera_info"/>
      <remap from="scan"            to="/scan"/>
    </node>
    
  </group>

 
</launch>

error is :

[ WARN] [1512126072.652868730]: Timed out waiting for transform from base_footprint to map to become available before running costmap, tf error: canTransform: source_frame base_footprint does not exist.. canTransform returned after 0.101004 timeout was 0.1.
[ WARN] [1512126077.018934725]: /rtabmap/rtabmap: Did not receive data since 5 seconds! Make sure the input topics are published ("$ rostopic hz my_topic") and the timestamps in their header are set. If topics are coming from different computers, make sure the clocks of the computers are synchronized ("ntpdate"). If topics are not published at the same rate, you could increase "queue_size" parameter (current=10).
/rtabmap/rtabmap subscribed to (approx sync):
   /stereo_camera/left/image_rect,
   /stereo_camera/depth,
   /stereo_camera/left/camera_info,
   /scan

Originally posted by zahra.kh on ROS Answers with karma: 21 on 2017-11-30

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Yes, but to keep fake laser scans like on turtlebot, you would need to use stereo_img_proc and disparity_to_depth to create a depth image (similar to this setup), so that you can use your stereo camera like a rgb-d camera (use rgb/depth inputs of rtabmap) and create the fake laser scan from it. Beware that to get a dense disparity image, a lot of texture is required in the simulated environment. You may want to simulate a RGB-D camera directly in the simulator instead.

EDIT: As stated in the warning, make sure these topics are published:

$ rostopic hz /stereo_camera/left/image_rect
$ rostopic hz /stereo_camera/depth
$ rostopic hz /stereo_camera/left/camera_info
$ rostopic hz /scan

cheers


Originally posted by matlabbe with karma: 6409 on 2017-11-30

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by zahra.kh on 2017-12-01:
thanks matlabbe. your answer is very good

Comment by zahra.kh on 2017-12-02:
hi matlabbe all topics are in launch file are published. but i don't know what is problem?

Comment by matlabbe on 2017-12-02:
Do they have different fps?

Comment by zahra.kh on 2017-12-02:
how to check fps?

Comment by zahra.kh on 2017-12-02:
i used but error is not solve!

Comment by zahra.kh on 2017-12-02:\

Comment by zahra.kh on 2017-12-03:
finally, i can create grid map. but the map is not good. for create good map which parameters must be changed?

Comment by zahra.kh on 2017-12-03:
this is my map, but is not good!!

Comment by matlabbe on 2017-12-04:
What do you mean by "is not good"? Please add screenshots to question.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.