Posted by
matlabbe on
URL: http://official-rtab-map-forum.206.s1.nabble.com/How-to-use-rtabmap-ros-data-throttle-for-Realsense-camera-tp5198p5213.html
Hi,
For your first question:
'relay','republish' and 'image_transport': see
http://wiki.ros.org/topic_tools/relay for general topics or
http://wiki.ros.org/image_transport for images. When using rtabmap.launch, because multiple nodes are subscribing to same image topics, we create a relay to subscribe those topics once on the network, but republish to multiples nodes locally on the remote computer. For example, without relays, if two nodes on remote computer are connected to same image topic coming from the robot, the images will be published 2 times over the network.
'data_throttled': throttling means that we reduce frame rate of a topic. Example, republishing 30 Hz images at 5 Hz. It can be used to decrease network bandwidth usage.
'compressed', 'compressedDepth' and 'image_transport': when subscribing to a node publishing images, we can choose to subscribe to raw or compressed version. When publishing over the network, the remote nodes may want to subscribe to compressed topics to save bandwidth.
For your second question:
As stated in the tutorial, "camera_nodelet_manager" is created by openni camera launch. In your case, you should use the nodelet manager created by realsense camera launch. I have access today to a D435 camera so I could test your setup. Here is the modified my_realsense2_camera_throttle.launch:
<launch>
<include file="$(find realsense2_camera)/launch/rs_camera.launch">
<arg name="align_depth" value="True" />
</include>
<arg name="rate" default="5"/>
<arg name="decimation" default="1"/> <!-- Reduce the image size, e.g., 2 means "width/2 x height/2". -->
<arg name="approx_sync" default="false" />
<!-- Use same nodelet used by realsense2 -->
<group ns="camera">
<node pkg="nodelet" type="nodelet" name="data_throttle" args="load rtabmap_ros/data_throttle realsense2_camera_manager" output="screen">
<param name="rate" type="double" value="$(arg rate)"/>
<param name="decimation" type="int" value="$(arg decimation)"/>
<param name="approx_sync" type="bool" value="$(arg approx_sync)"/>
<remap from="rgb/image_in" to="color/image_raw"/>
<remap from="depth/image_in" to="aligned_depth_to_color/image_raw"/>
<remap from="rgb/camera_info_in" to="color/camera_info"/>
<remap from="rgb/image_out" to="data_throttled_image"/>
<remap from="depth/image_out" to="data_throttled_image_depth"/>
<remap from="rgb/camera_info_out" to="data_throttled_camera_info"/>
</node>
</group>
</launch>
Usage:
$ roslaunch my_realsense2_camera_throttle.launch rate:=5
$ roslaunch rtabmap_ros rtabmap.launch \
rgb_topic:=/camera/data_throttled_image\
depth_topic:=/camera/data_throttled_image_depth\
camera_info_topic:=/camera/data_throttled_camera_info\
compressed:=true\
approx_sync:=false\
rtabmap_args:="--delete_db_on_start"\
rviz:=true \
rtabmapviz:=false

I noticed some problems on my computer with the realsense driver. It does't always initialize correctly (WARNING [140535635199744] (backend-v4l2.cpp:1013) Frames didn't arrived within 5 seconds) and I need to disconnect/connect the USB of the camera. Make sure images are streamed from the camera with "rostopic hz":
$ rostopic hz /camera/color/camera_info /camera/color/image_raw /camera/aligned_depth_to_color/image_raw
subscribed to [/camera/color/camera_info]
subscribed to [/camera/color/image_raw]
subscribed to [/camera/aligned_depth_to_color/image_raw]
topic rate min_delta max_delta std_dev window
=============================================================================================
/camera/color/camera_info 29.77 0.03334 0.03387 0.0001095 30
/camera/color/image_raw 29.78 0.0333 0.03387 0.0001147 30
/camera/aligned_depth_to_color/image_raw 30.02 0.02771 0.04182 0.002807 30
cheers,
Mathieu