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

Hi,

Based on the robot mapping demo, which is similar to your setup, localization is set like this with custom.launch:

<launch>
  <!-- Localization-only mode -->
  <arg name="localization"      default="false"/>
  <arg     if="$(arg localization)" name="rtabmap_args"  default=""/>
  <arg unless="$(arg localization)" name="rtabmap_args"  default="--delete_db_on_start"/>

  <node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="$(arg rtabmap_args)">

    ...

    <!-- localization mode -->
    <param if="$(arg localization)" name="Mem/IncrementalMemory" type="string" value="false"/>
    <param if="$(arg localization)" name="Mem/InitWMWithAllNodes" type="string" value="true"/>
  </node>
</launch>

Launch in mapping mode (delete previous database):

$ roslaunch custom.launch

Launch in localization mode:

$ roslaunch custom.launch localization:=true

cheers,
Mathieu

Hi,

Based on the robot mapping demo, which is similar to your setup, localization is set like this with custom.launch:

<launch>
  <!-- Localization-only mode -->
  <arg name="localization"      default="false"/>
  <arg     if="$(arg localization)" name="rtabmap_args"  default=""/>
  <arg unless="$(arg localization)" name="rtabmap_args"  default="--delete_db_on_start"/>

  <node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="$(arg rtabmap_args)">

    ...

    <!-- localization mode -->
    <param if="$(arg localization)" name="Mem/IncrementalMemory" type="string" value="false"/>
    <param if="$(arg localization)" name="Mem/InitWMWithAllNodes" type="string" value="true"/>
  </node>
</launch>

Launch in mapping mode (delete previous database):

$ roslaunch custom.launch

Launch in localization mode:

$ roslaunch custom.launch localization:=true

EDIT: By default (with version >=0.17.0), on localization mode the robot will assume that it is restarting at the same place where it stopped mapping previously. If the robot is still moved when offline, the first pose in the map will then be wrong, but while moving, if the robot is able to localize visually (loop closure), it will replace the robot at the right location. If you don't want that the robot assumes that it is starting at the last location of the previous session (i.e., robot restarts always at different locations each run) you can add this parameter:

<param name="RGBD/SavedLocalizationIgnored" type="string" value="true"/>

In this mode, the map will not appear until the robot can localize on the previous map.

cheers,
Mathieu