Ask Your Question
0

turtulbot+rtabmap

asked 2018-02-01 02:54:14 -0500

zahra.kh gravatar image

updated 2018-03-01 01:37:45 -0500

jayess gravatar image

hi i have stereo images that save in a directory. i used rtabmap_ros package and this launch file for created map and localization:

<launch>

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

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

   <arg name="rate"       default="20" />

   <arg name="ground_is_obstacle" default="false"/>
   <arg name="align_with_ground"  default="false"/>

   <!-- 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>

   <!-- Run the ROS package stereo_image_proc for image rectification -->
   <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"/>
  </group>

   <!-- 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" /> 

   <include file="$(find rtabmap_ros)/launch/rtabmap.launch">
      <arg name="rtabmap_args" value="--delete_db_on_start --Rtabmap/CreateIntermediateNodes true --voxel_size 0.0 --Vis/EstimationType 1 --Vis/MinInliers 15 --SURF/HessianThreshold 100 --Grid/3DGroundIsObstacle $(arg ground_is_obstacle) --Odom/AlignWithGround $(arg align_with_ground)" />
      <arg name="rviz"             value="$(arg rviz)" />
      <arg name="rtabmapviz"       value="$(arg rtabmapviz)" />


<arg name="rgb_topic"               value="/stereo_camera/left/image_rect" />
  <arg name="depth_topic"             value="/stereo_camera/depth_raw" />
  <arg name="camera_info_topic"       value="/stereo_camera/left/camera_info" />
   </include>

</launch>

after mapping and saving it, i used demo_turtlebot_mapping.launch in rtabmap_ros package and changed this launch file for navigation:

<launch>
  <!-- 
       Bringup Turtlebot:
       $ roslaunch turtlebot_bringup minimal.launch

       Mapping:
       $ roslaunch rtabmap_ros demo_turtlebot_mapping.launch

       Visualization:
       $ roslaunch rtabmap_ros demo_turtlebot_rviz.launch

       This launch file is a one to one replacement of the gmapping_demo.launch in the 
       "SLAM Map Building with TurtleBot" tutorial:
       http://wiki.ros.org/turtlebot_navigation/Tutorials/indigo/Build%20a%20map%20with%20SLAM

       For localization-only after a mapping session, add argument "localization:=true" to
       demo_turtlebot_mapping.launch line above. Move the robot around until it can relocalize in 
       the previous map, then the 2D map should re-appear again. You can then follow the same steps 
       from 3.3.2 of the "Autonomous Navigation of a Known Map with TurtleBot" tutorial:
       http://wiki.ros.org/turtlebot_navigation/Tutorials/Autonomously%20navigate%20in%20a%20known%20map

       For turtlebot in simulation (Gazebo):
         $ roslaunch turtlebot_gazebo turtlebot_world.launch
         $ roslaunch rtabmap_ros demo_turtlebot_mapping.launch simulation:=true
         $ roslaunch rtabmap_ros demo_turtlebot_rviz.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 name="simulation"        default="false"/>
  <arg     if="$(arg localization)" name="args"  default=""/>
  <arg unless="$(arg localization)" name="args"  default="--delete_db_on_start"/>

  <arg     if="$(arg simulation)" name="rgb_topic"   default="/stereo_camera ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-02-01 10:39:39 -0500

matlabbe gravatar image

You cannot create a map with real images, then go localization with this map in a simulated environment. Please do mapping session in the simulated environment. From this turtlebot with RTAB-Map tutorial, follow section 6 (Simulation (Gazebo)) to create a map with Gazebo, then use the following to relaunch in localization mode (like section 2 but with simulation argument):

$ roslaunch rtabmap_ros demo_turtlebot_mapping.launch localization:=true simulation:=true

As noted in Section 6, make sure to download the latest demo_turtlebot_maping.launch to have access to simulation argument. Also read the issues about the simulation example in the same section.

cheers

edit flag offensive delete link more

Comments

thanks matlabbe. for simulated enviroment when run (roslaunch rtabmap_ros demo_turtlebot_mapping.launch simulation:=true) map is not create and this command is appeared:

zahra.kh gravatar imagezahra.kh ( 2018-02-02 23:55:40 -0500 )edit

zahra.kh gravatar imagezahra.kh ( 2018-02-02 23:56:47 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-02-01 02:54:14 -0500

Seen: 198 times

Last updated: Mar 01 '18