luxonis / depthai-ros

Official ROS Driver for DepthAI Sensors.
MIT License
251 stars 185 forks source link

"/rtabmap: Did not receive data since 5 seconds!" when running `rtabmap.launch` in ROS Noetic. #531

Closed TannerGilbert closed 4 months ago

TannerGilbert commented 4 months ago

I'm currently trying to get RTABMAP to work with the OAK-D WIFI for handheld mapping and started out with the provided rtabmap.launch inside the noetic branch.

When first running the launch file () I get the following errors:

...
ERROR: cannot launch node of type [rtabmap_ros/rgbd_odometry]: Cannot locate node of type [rgbd_odometry] in package [rtabmap_ros]. Make sure file exists in package path and permission is set to executable (chmod +x)
ERROR: cannot launch node of type [rtabmap_ros/rtabmap]: Cannot locate node of type [rtabmap] in package [rtabmap_ros]. Make sure file exists in package path and permission is set to executable (chmod +x)
ERROR: cannot launch node of type [rtabmap_ros/rtabmapviz]: Cannot locate node of type [rtabmapviz] in package [rtabmap_ros]. Make sure file exists in package path and permission is set to executable (chmod +x)
...

This happens due to changes in rtabmap_ros and can be fixed as described in #450. Aftert the changes I run into the following warnings:

...
ERROR: cannot launch node of type [rtabmap_ros/rgbd_odometry]: Cannot locate node of type [rgbd_odometry] in package [rtabmap_ros]. Make sure file exists in package path and permission is set to executable (chmod +x)
ERROR: cannot launch node of type [rtabmap_ros/rtabmap]: Cannot locate node of type [rtabmap] in package [rtabmap_ros]. Make sure file exists in package path and permission is set to executable (chmod +x)
ERROR: cannot launch node of type [rtabmap_ros/rtabmapviz]: Cannot locate node of type [rtabmapviz] in package [rtabmap_ros]. Make sure file exists in package path and permission is set to executable (chmod +x)
...

The topic seems to be published normally though:

        topic            rate   min_delta   max_delta   std_dev    window
=========================================================================
/oak/rgb/image_raw      29.94   0.02404     0.04239     0.002406   4681  
/oak/stereo/image_raw   29.94   0.02543     0.04035     0.001664   4681  
/oak/rgb/camera_info    29.94   0.02597     0.04073     0.001841   4681 

Any help on this is greatly appreciated. I'll also try out the example Humble and see if it works there.

Serafadam commented 4 months ago

Hi, from warnings it seems that you haven't changed proper file/you need to rebuild/resource the workspace.you should be able to get proper results if you change the launch file as follows

<?xml version="1.0"?>
<launch>
    <arg name="name" default="oak" />
    <arg name="params_file" default="$(find depthai_ros_driver)/config/rgbd.yaml" />

    <include file="$(find depthai_ros_driver)/launch/camera.launch">
        <arg name="name" value="$(arg name)"/>
        <arg name="params_file" value="$(arg params_file)"/>
    </include>
    <node type="rgbd_odometry" name="rgbd_odometry" pkg="rtabmap_odom">
        <remap from="rgb/image" to="$(arg name)/rgb/image_raw"/>
        <remap from="rgb/camera_info" to="$(arg name)/rgb/camera_info"/>
        <remap from="depth/image" to="$(arg name)/stereo/image_raw"/>
        <param name="frame_id" type="string" value="$(arg name)"/>

        <rosparam param="subscribe_depth">True</rosparam>
        <rosparam param="approx_sync">True</rosparam>
        <rosparam param="approx_sync_max_interval">0.02</rosparam>

    </node>
    <node type="rtabmap" name="rtabmap" pkg="rtabmap_slam">
        <remap from="rgb/image" to="$(arg name)/rgb/image_raw"/>
        <remap from="rgb/camera_info" to="$(arg name)/rgb/camera_info"/>
        <remap from="depth/image" to="$(arg name)/stereo/image_raw"/>
        <rosparam param="Rtabmap/DetectionRate">3.5</rosparam>
        <param name="frame_id" type="string" value="$(arg name)"/>

    </node>
    <node type="rtabmap_viz" name="rtabmap_viz" pkg="rtabmap_viz">
        <remap from="rgb/image" to="$(arg name)/rgb/image_raw"/>
        <remap from="rgb/camera_info" to="$(arg name)/rgb/camera_info"/>
        <remap from="depth/image" to="$(arg name)/stereo/image_raw"/>
    </node>

</launch>

This will be update in new release. Also, if everything loads properly and RTABMap seems stuck you might need to reset the odometry (can be done via cli or in rtabmap_viz)

TannerGilbert commented 4 months ago

Resetting the odometry after starting seems to solve the issue. Thanks for the quick reply.