Size: 7316
Comment:
|
Size: 8952
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 117: | Line 117: |
5. If you open the System Monitor of Ubuntu, you should have something like ~900 KiB/s of bandwidth used: | 5. If you open the System Monitor of Ubuntu, you should have something like ~950 KiB/s of bandwidth used: |
Line 120: | Line 120: |
For the data_throttle approach (rgbd_sync:=false), you would get something like ~500 KiB/s instead: | For the `data_throttle` approach (`rgbd_sync:=false`), you would get something like ~500 KiB/s instead: |
Line 128: | Line 128: |
== Extras == === Zed throttling example === `zed_throttle.launch`: {{{ <launch> <arg name="rate" default="5"/> <!-- Rate we want to publish over network --> <arg name="approx_sync" default="false" /> <!-- false for zed camera --> <arg name="resolution" default="3"/> <!-- Using VGA to use less bandwidth --> <group ns="camera"> <node pkg="nodelet" type="nodelet" name="zed_nodelet_manager" args="manager" output="screen"/> <include file="$(find zed_wrapper)/launch/zed_camera_nodelet.launch"> <arg name="publish_tf" value="false" /> <arg name="frame_rate" value="15" /> <!-- lowest frame rate we can set with the driver --> <arg name="resolution" value="$(arg resolution)"/> </include> <node pkg="tf" type="static_transform_publisher" name="camera_zed_link" args="0 0 0 0 0 0 camera_link zed_camera_center 100"/> <!-- Use same nodelet used by ZED to avoid image serialization --> <node pkg="nodelet" type="nodelet" name="data_throttle" args="load rtabmap_ros/rgbd_sync zed_nodelet_manager" output="screen"> <param name="compressed_rate" type="double" value="$(arg rate)"/> <param name="approx_sync" type="bool" value="$(arg approx_sync)"/> <remap from="rgb/image" to="rgb/image_rect_color"/> <remap from="depth/image" to="depth/depth_registered"/> <remap from="rgb/camera_info" to="rgb/camera_info"/> <remap from="rgbd_image" to="rgbd_image"/> </node> </group> </launch> }}} Same `rtabmap.launch` line above with `rgbd_image` should work on the remote computer. |
Note: This tutorial assumes that you have completed the previous tutorials: RGB-D Hand-Held Mapping With a Kinect. |
![]() |
Remote Mapping
Description: This tutorial shows how to do mapping on a remote computer.Tutorial Level: BEGINNER
Next Tutorial: Setup RTAB-Map on your robot!
Robot
For simplification, I will just show nodes/launch files used for mapping. Your robot may have other stuff launched at the same time. Here I assume that the ROS Master is on the robot, and a Kinect is used.
1. [Optional]: To avoid host name resolution issues, set ROS_IP environment variable for the robot:
$ ifconfig eth0 Link encap:Ethernet HWaddr ##:##:##:##:##:## inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0 ... $ export ROS_IP=192.168.1.3
2. We will throttle the Kinect messages on the robot at 5 Hz to reduce the bandwidth used on the network (reducing latency). We also want to pre-sync camera topics before sending them over the network. To do both, we can use rtabmap_ros/rgbd_sync nodelet for convenience. Create a file called freenect_throttle.launch and copy/paste the code below.
Note that for the example, I added rgbd_sync argument to switch between rgbd_sync approach and old data_throttle approach. With rtabmap_ros/data_throttle approach, images can be compressed using image_transport plugins (theora, h264, ...), which could reduce the bandwidth usage. Note that on some computers depending the ROS version, the image transport plugin called compressedDepth for depth images can use a lot of processing power, and thus may decrease the frame rate if the computer cannot keep up. The depth compression approach used in rgbd_sync (using cv::imencode()) seems less computationally expensive, thus affecting less the frame rate in this case.
<launch> <include file="$(find freenect_launch)/launch/freenect.launch"> <arg name="depth_registration" value="True" /> </include> <arg name="rate" default="5"/> <arg name="approx_sync" default="true" /> <!-- true for freenect driver --> <arg name="rgbd_sync" default="true"/> <!-- Use same nodelet used by Freenect/OpenNI --> <group ns="camera"> <node if="$(arg rgbd_sync)" pkg="nodelet" type="nodelet" name="rgbd_sync" args="load rtabmap_ros/rgbd_sync camera_nodelet_manager" output="screen"> <param name="compressed_rate" type="double" value="$(arg rate)"/> <param name="approx_sync" type="bool" value="$(arg approx_sync)"/> <remap from="rgb/image" to="rgb/image_rect_color"/> <remap from="depth/image" to="depth_registered/image_raw"/> <remap from="rgb/camera_info" to="rgb/camera_info"/> <remap from="rgbd_image" to="rgbd_image"/> </node> <node unless="$(arg rgbd_sync)" pkg="nodelet" type="nodelet" name="data_throttle" args="load rtabmap_ros/data_throttle camera_nodelet_manager" output="screen"> <param name="rate" type="double" value="$(arg rate)"/> <param name="approx_sync" type="bool" value="$(arg approx_sync)"/> <remap from="rgb/image_in" to="rgb/image_rect_color"/> <remap from="depth/image_in" to="depth_registered/image_raw"/> <remap from="rgb/camera_info_in" to="rgb/camera_info"/> <remap from="rgb/image_out" to="throttled/rgb/image_rect_color"/> <remap from="depth/image_out" to="throttled/depth_registered/image_raw"/> <remap from="rgb/camera_info_out" to="throttled/rgb/camera_info"/> </node> </group> </launch>
3. Launch the file:
$ roslaunch freenect_throttle.launch rate:=5
Remote Client Computer
On the client computer, we will launch rtabmap, rgbd_odometry and rtabmapviz using rtabmap.launch for convenience. For efficiency and to not subscribe to same topics multiple time on the robot, rtabmap.launch will use relays and rgbd_relay to subscribe just once to incoming topics from the robot and relay the messages to multiples nodes on the client side.
1. [Optional]: To avoid host name resolution issues, set ROS_IP environment variable for the client:
$ ifconfig eth0 Link encap:Ethernet HWaddr ##:##:##:##:##:## inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0 ... $ export ROS_IP=192.168.1.2
2. Set ROS_MASTER_URI with the robot IP/hostname:
$ export ROS_MASTER_URI=http://192.168.1.3:11311
3. Launch rtabmap.launch (Warning with rtabmap_ros 0.10 binaries: Please use the updated launch file on master branch linked here instead of the one installed with the rtabmap_ros 0.10 binaries):
$ roslaunch rtabmap_ros rtabmap.launch subscribe_rgbd:=true rgbd_topic:=/camera/rgbd_image compressed:=true rtabmap_args:="--delete_db_on_start"
If you launched freenect_throttle.launch with rgbd_sync:=false, do this instead:
$ roslaunch rtabmap_ros rtabmap.launch rgb_topic:=/camera/throttled/rgb/image_rect_color depth_topic:=/camera/throttled/depth_registered/image_raw camera_info_topic:=/camera/throttled/rgb/camera_info compressed:=true rtabmap_args:="--delete_db_on_start"
4. You should now see mapping in rtabmapviz window.
5. If you open the System Monitor of Ubuntu, you should have something like ~950 KiB/s of bandwidth used:
For the data_throttle approach (rgbd_sync:=false), you would get something like ~500 KiB/s instead:
Advanced
1. If you have already odometry on the robot, you can set arguments visual_odometry:=false and odom_topic:="/odom".
2. You can use launch rviz manually or with argument rviz:=true for convenience. If you don't want rtabmapviz, you can disable it using rtabmapviz:=false argument.
Extras
Zed throttling example
zed_throttle.launch:
<launch> <arg name="rate" default="5"/> <!-- Rate we want to publish over network --> <arg name="approx_sync" default="false" /> <!-- false for zed camera --> <arg name="resolution" default="3"/> <!-- Using VGA to use less bandwidth --> <group ns="camera"> <node pkg="nodelet" type="nodelet" name="zed_nodelet_manager" args="manager" output="screen"/> <include file="$(find zed_wrapper)/launch/zed_camera_nodelet.launch"> <arg name="publish_tf" value="false" /> <arg name="frame_rate" value="15" /> <!-- lowest frame rate we can set with the driver --> <arg name="resolution" value="$(arg resolution)"/> </include> <node pkg="tf" type="static_transform_publisher" name="camera_zed_link" args="0 0 0 0 0 0 camera_link zed_camera_center 100"/> <!-- Use same nodelet used by ZED to avoid image serialization --> <node pkg="nodelet" type="nodelet" name="data_throttle" args="load rtabmap_ros/rgbd_sync zed_nodelet_manager" output="screen"> <param name="compressed_rate" type="double" value="$(arg rate)"/> <param name="approx_sync" type="bool" value="$(arg approx_sync)"/> <remap from="rgb/image" to="rgb/image_rect_color"/> <remap from="depth/image" to="depth/depth_registered"/> <remap from="rgb/camera_info" to="rgb/camera_info"/> <remap from="rgbd_image" to="rgbd_image"/> </node> </group> </launch>
Same rtabmap.launch line above with rgbd_image should work on the remote computer.