introlab / rtabmap_ros

RTAB-Map's ROS package.
http://wiki.ros.org/rtabmap_ros
BSD 3-Clause "New" or "Revised" License
922 stars 549 forks source link

Memory.cpp:841::update() #800

Closed sj1108 closed 1 year ago

sj1108 commented 1 year ago

Hello, I am trying to run the package using Lidar and imu sensor for SLAM and localization. I have successfully run the package in localization:=false mode. However, when I try to run the package in localization mode, the package fails to run with the following warning message:

[ WARN] (2022-08-17 12:58:36.169) Memory.cpp:841::update() The working memory is empty and the memory is not incremental (Mem/IncrementalMemory=False), no loop closure can be detected! Please set Mem/IncrementalMemory=true to increase the memory with new images or decrease the STM size (which is 1 including the new one added).
[ WARN] [1660708716.169999449]: Graph has changed! The whole cloud is regenerated.

As the comments said in here and here, I made sure that rtabmap.db is not empty.

$ ls -l ~/.ros/rtabmap.db
$ rtabmap-databaseViewer ~/.ros/rtabmap.db

And I started the package with localization:=true option which disables --delete_db_on_start option.

$ roslaunch rtabmap_ros trial.launch localization:=true

But still the problem is not solved. Here is the launch file that I used.

<?xml version="1.0"?>
<launch>

  <arg name="scan_topic"              default="/urg_scan"/>
  <arg name="imu_topic"               default="/AND/Imu"/> 

  <!-- 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 pkg="urg_node" type="urg_node" name="urg_node">
    <remap from="scan"     to="$(arg scan_topic)" />
    <param name="frame_id" value="lidar_link" />
  </node>

  <node pkg="advanced_navigation_driver" type="advanced_navigation_driver" name="AND_node">
    <remap from="an_device/Imu" to="$(arg imu_topic)" />
    <param name="imu_frame_id" value="imu_link" />
  </node>

  <node pkg="tf" type="static_transform_publisher" name="base_link_to_lidar_link" 
    args="0.0 0.0 0.0 0.0 0.0 0.0 base_link lidar_link 100" />

  <node pkg="tf" type="static_transform_publisher" name="base_link_to_imu_link" 
    args="0.0 0.0 0.0 0.0 0.0 0.0 base_link imu_link 100" />

  <param name="use_sim_time" type="bool" value="false"/>

  <!-- Nodes -->
  <group ns="rtabmap">
    <!-- ICP Odometry -->
    <node pkg="rtabmap_ros" type="icp_odometry" name="icp_odometry" output="screen">

      <remap from="scan"                   to="$(arg scan_topic)"/>
      <remap from="odom"                   to="icp_odom"/>
      <remap from="imu"                    to="$(arg imu_topic)"/>
      <remap from="odom_info"              to="odom_info"/>

      <param name="frame_id"                    type="string" value="base_link"/>
      <param name="odom_frame_id"               type="string" value="icp_odom"/>
      <param name="publish_tf"                  type="bool"   value="true"/>
      <param name="wait_for_transform_duration" type="double" value="0.2"/>
      <param name="wait_imu_to_init"            type="bool"   value="true"/>
      <param name="guess_frame_id"              type="string" value=""/>
      <param name="queue_size"                  type="int"    value="10"/>  
      <param name="guess_min_translation"       type="double" value="0"/>
      <param name="guess_min_rotation"          type="double" value="0"/>
      <param name="scan_cloud_max_points"       type="int"    value="0"/>
      <param name="expected_update_rate"        type="double" value="0"/>
      <param name="max_update_rate"             type="double" value="0"/>

    </node>

    <!-- Visual SLAM (robot side) -->
    <!-- args: "delete_db_on_start" and "udebug" -->
    <node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="$(arg rtabmap_args)">
      <param name="subscribe_depth"           type="bool"   value="false"/>
      <param name="subscribe_rgb"             type="bool"   value="false"/>
      <param name="subscribe_rgbd"            type="bool"   value="false"/>
      <param name="subscribe_stereo"          type="bool"   value="false"/>
      <param name="subscribe_scan"            type="bool"   value="true"/>
      <param name="subscribe_scan_cloud"      type="bool"   value="false"/>
      <param name="subscribe_scan_descriptor" type="bool"   value="false"/>
      <param name="subscribe_user_data"       type="bool"   value="false"/>
      <param name="subscribe_odom_info"       type="bool"   value="true"/>
      <param name="frame_id"                    type="string" value="base_link"/>
      <param name="map_frame_id"                type="string" value="map"/>
      <param name="odom_frame_id"               type="string" value=""/>
      <param name="odom_frame_id_init"          type="string" value=""/>
      <param name="publish_tf"                  type="bool"   value="true"/>
      <param name="gen_scan"                    type="bool"   value="false"/>
      <param name="odom_tf_angular_variance"    type="double" value="0.001"/>
      <param name="odom_tf_linear_variance"     type="double" value="0.001"/>
      <param name="odom_sensor_sync"            type="bool"   value="false"/>
      <param name="wait_for_transform_duration" type="double" value="0.2"/>
      <param name="wait_for_transform"          type="bool"     value="true"/>
      <param name="database_path"               type="string" value="~/.ros/rtabmap.db"/>
      <param name="approx_sync"                 type="bool"   value="true"/>
      <param name="queue_size"                  type="int"    value="10"/>

      <remap from="scan"                   to="$(arg scan_topic)"/>
      <remap from="odom"                   to="icp_odom"/>
      <remap from="imu"                    to="$(arg imu_topic)"/>
      <remap from="odom_info"              to="odom_info"/>

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

  <node pkg="rviz" type="rviz" name="rviz" args="-d $(find rtabmap_ros)/rviz/trial.rviz" output="screen"/>

</launch>

Any suggestions and help will be appreciated.

matlabbe commented 1 year ago

The issue is closed, but next time, show output of:

rtabmap-info ~/.ros/rtabmap.db