OccupancyGrid.cpp:380::createLocalMap() Cannot create local map, scan is empty (node=326, Grid/Sensor=0).

asked 2022-03-16 12:20:03 -0500

UDAYKUMAR gravatar image

updated 2022-03-17 11:18:07 -0500

Hello everyone. I am working on a pepper robot with rtabmap. the robot as a Xtion 3D camera. RGB cameras and a laser. I want to use all these three for generating map. this is my launch file.

<?xml version="1.0" encoding="UTF-8"?>


<arg name="database_path" default="$(find my_robot)/launch/rtabmap.db"/> <arg name="rgb_topic" default="/pepper_robot/camera/front/image_raw"/> <arg name="depth_topic" default="/pepper_robot/camera/depth/image_raw"/> <arg name="camera_info_topic" default="/pepper_robot/camera/front/camera_info"/>
<arg name="scan" default="/pepper_robot/laser"/>

<group ns="rtabmap">

<node pkg="nodelet" type="nodelet" name="rgbd_sync" args="standalone rtabmap_ros/rgbd_sync" output="screen"> 
      <!-- RTAB-Map Inputs -->
  <remap from="scan"         to="$(arg scan)"/>
  <remap from="rgb/image"        to="$(arg rgb_topic)"/>
  <remap from="rgb/camera_info"  to="$(arg camera_info_topic)"/>
  <remap from="depth/image"      to="$(arg depth_topic)"/>  
  <remap from="rgbd_image"       to="rgbd_image"/> 
  <remap from="odom"         to="/pepper_robot/odom"/> 

  <!-- Should be true for not synchronized camera topics
       (e.g., false for kinectv2, zed, realsense, true for xtion, kinect360)-->
    <param name="approx_sync"       value="true"/>

<node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen"  args="--delete_db_on_start">
<!-- RTAB-Map Inputs -->
  <remap from="scan" to="$(arg scan)"/>
  <remap from="rgb/image" to="$(arg rgb_topic)"/>
  <remap from="depth/image" to="$(arg depth_topic)"/>
  <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>
  <remap from="odom"         to="/pepper_robot/odom"/> 

  <!-- Basic RTAB-Map Parameters -->
  <param name="database_path"             type="string" value="$(arg database_path)"/>
  <param name="frame_id"                  type="string" value="base_link"/>
  <param name="odom_frame_id"             type="string" value="odom"/>
  <param name="subscribe_depth"           type="bool"   value="false"/>
  <param name="subscribe_scan"            type="bool"   value="false"/>
  <param name="RGBD/AngularUpdate"            type="string" value="0.05"/>
  <param name="RGBD/LinearUpdate"             type="string" value="0.05"/>
  <param name="RGBD/OptimizeFromGraphEnd"     type="string" value="false"/>
<!--  <remap from="odom"              to="/pepper_robot/odom"/> -->

  <param name="Rtabmap/ImagesAlreadyRectified" value="true" />
  <param name="queue_size"            type="int" value="10"/>
<!-- RTAB-Map Output -->
  <remap from="/rtabmap/grid_proj_map" to="/map"/>

  <!-- RTAB-Map Output -->
  <remap from="/rtabmap/grid_proj_map" to="/map"/>
  <!-- Rate (Hz) at which new nodes are added to map -->
  <param name="Rtabmap/DetectionRate"    type="string" value="1"/>

  <!-- 2D SLAM -->
  <param name="Reg/Force3DoF"        type="string" value="true"/>
<!-- <param name="Reg/Force3DoF"                 type="string" value="true"/>-->

  <!-- Loop Closure Detection -->
  <param name="Kp/DetectorStrategy" type="string" value="0"/>
  <param name="Vis/FeatureType"     type="string"      value="0"/>

  <!-- Maximum visual words per image (bag-of-words) -->
  <param name="Kp/MaxFeatures" type="string" value="400"/>

  <!-- Used to extract more or less SURF features -->
  <param name="SURF/HessianThreshold" type="string" value="100"/>

  <!-- Loop Closure Constraint -->
  <!-- 0=Visual ...
edit retag flag offensive close merge delete


Is this error happens often? It seems rtabmap received an invalid or empty (with only NaNs) laser scan topic.

matlabbe gravatar image matlabbe  ( 2022-03-16 21:36:10 -0500 )edit

Thanks for the response matlabbe. yes,it happens often as you can see here. and even in rviz it shows only numbers but no exact map. I don't know where I am doing mistakes.

UDAYKUMAR gravatar image UDAYKUMAR  ( 2022-03-17 11:17:23 -0500 )edit

You could share the database if you want. I only see the depth/right warnings in the log. they seem appearing 90 sec after start. You may close rtabmapviz to see if those warnings are coming from rtabmap node or rtabmapviz node.

matlabbe gravatar image matlabbe  ( 2022-04-10 16:00:23 -0500 )edit

Note also you are not subscribing to any laser scan for rtabmap node, so if you Grid/Sensor=0, it is likely that it will warn that you don't have any lidar data. Looking at the log, rtabmap node subscribing to:

/rtabmap/rtabmap subscribed to (approx sync):
   /pepper_robot/camera/front/image_raw \

As you are using rgbd_sync, set subscribe_rgbd=true, also set subscribe_scan=true. See also this configuration similar to yours: http://wiki.ros.org/rtabmap_ros/Tutor...

matlabbe gravatar image matlabbe  ( 2022-04-10 16:48:50 -0500 )edit