Skip to content
This repository was archived by the owner on Jul 26, 2024. It is now read-only.

Commit 3211207

Browse files
committed
Update slam_rtabmap.launch
* Added **IMU support** (map is now aligned with gravity by default). * Updated **depth rectification interpolation method to NearestNeighbor** instead of Linear. This avoids a lot of noisy points in the 3D point cloud. This would also fix #103 at the same time. * Added **IR mode** when setting `color_enabled` to `false`. This mode can be useful when **mapping in the dark**. * Using **depth registered to RGB camera** instead of RGB registered to depth camera. This is useful for **proper texturing of the 3D mesh** when exporting the map. * Use 720P instead of 1536P so that default parameters of rtabmap can work better. Adjusted parameters between color and ir modes. * The RGB image has to be rectified, because of that, it adds black borders to RGB image. Those black borders would not affect visual odometry or loop closure detection, but it is affecting 3D point cloud reconstruction. I added this note: `When using color camera, to avoid black borders in point clouds in rtabmapviz, set ROI ratios in Preferences->3D rendering to "0.05 0.05 0.05 0.05" under Map and Odom columns.`. The black borders won't appear anymore.
1 parent 8861446 commit 3211207

File tree

1 file changed

+45
-17
lines changed

1 file changed

+45
-17
lines changed

launch/slam_rtabmap.launch

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ Licensed under the MIT License.
55

66
<launch>
77

8+
<!-- If color_enabled is false, IR camera is used (may work better in dark areas). -->
9+
<!-- When using color camera, to avoid black borders in point clouds
10+
in rtabmapviz, set ROI ratios in Preferences->3D rendering
11+
to "0.05 0.05 0.05 0.05" under Map and Odom columns. -->
12+
<arg name="color_enabled" default="true"/>
13+
814
<param name="robot_description"
915
command="xacro $(find azure_kinect_ros_driver)/urdf/azure_kinect.urdf.xacro" />
1016

@@ -23,43 +29,65 @@ Licensed under the MIT License.
2329
<node pkg="nodelet" type="nodelet" name="rectify_rgb"
2430
args="load image_proc/rectify manager --no-bond"
2531
respawn="true">
26-
<remap from="image_mono" to="rgb_to_depth/image_raw" />
27-
<remap from="image_rect" to="rgb_to_depth/image_rect" />
32+
<remap from="image_mono" to="rgb/image_raw" />
33+
<remap from="image_rect" to="rgb/image_rect" />
2834
</node>
29-
35+
3036
<!-- Spawn an image_proc/rectify nodelet to rectify the depth image -->
31-
<node pkg="nodelet" type="nodelet" name="rectify_depth"
37+
<node unless="$(arg color_enabled)" pkg="nodelet" type="nodelet" name="rectify_depth"
3238
args="load image_proc/rectify manager --no-bond"
3339
respawn="true">
40+
<param name="interpolation" value="0" />
3441
<remap from="image_mono" to="depth/image_raw" />
3542
<remap from="image_rect" to="depth/image_rect" />
3643
</node>
37-
44+
45+
<!-- Spawn an image_proc/rectify nodelet to rectify the ir image -->
46+
<node unless="$(arg color_enabled)" pkg="nodelet" type="nodelet" name="rectify_ir"
47+
args="load image_proc/rectify manager --no-bond"
48+
respawn="true">
49+
<remap from="image_mono" to="ir/image_raw" />
50+
<remap from="image_rect" to="ir/image_rect" />
51+
</node>
52+
3853
<node pkg="nodelet" type="nodelet" name="k4a_ros_bridge"
3954
args="load Azure_Kinect_ROS_Driver/K4AROSBridgeNodelet manager --no-bond"
4055
respawn="true">
4156
<param name="depth_enabled" value="true" />
42-
<param name="depth_mode" value="NFOV_UNBINNED" />
43-
<param name="color_enabled" value="true" />
44-
<param name="color_resolution" value="1536P" />
57+
<param name="depth_mode" value="WFOV_2X2BINNED" />
58+
<param name="color_enabled" value="$(arg color_enabled)" />
59+
<param name="color_resolution" value="720P" />
4560
<param name="fps" value="30" />
4661
<param name="point_cloud" value="false" />
4762
<param name="rgb_point_cloud" value="false" />
4863
<param name="required" value="true" />
4964
<param name="imu_rate_target" value="100" />
50-
65+
<param name="rescale_ir_to_mono8" value="true" />
5166
</node>
5267

5368
</group>
54-
69+
70+
<!-- compute IMU quaternion -->
71+
<node pkg="imu_filter_madgwick" type="imu_filter_node" name="imu_filter_node">
72+
<param name="use_mag" value="false" />
73+
<param name="publish_tf" value="false" />
74+
<param name="world_frame" value="enu" />
75+
<remap from="/imu/data_raw" to="/k4a/imu" />
76+
</node>
77+
5578
<!-- Start rtabmap_ros node -->
56-
<include file="$(find rtabmap_ros)/launch/rtabmap.launch" ns="rtabmap" >
57-
<arg name="rgb_topic" value="/k4a/rgb_to_depth/image_rect" />
58-
<arg name="depth_topic" value="/k4a/depth/image_rect" />
59-
<arg name="camera_info_topic" value="/k4a/depth/camera_info" />
60-
<arg name="approx_sync" value="true" />
61-
<arg name="frame_id" value="camera_base" />
62-
<arg name="args" value="--delete_db_on_start --Odom/ResetCountdown 2" />
79+
<include file="$(find rtabmap_ros)/launch/rtabmap.launch">
80+
<arg if="$(arg color_enabled)" name="rgb_topic" value="/k4a/rgb/image_rect" />
81+
<arg if="$(arg color_enabled)" name="depth_topic" value="/k4a/depth_to_rgb/image_raw" />
82+
<arg if="$(arg color_enabled)" name="camera_info_topic" value="/k4a/rgb/camera_info" />
83+
<arg unless="$(arg color_enabled)" name="rgb_topic" value="/k4a/ir/image_rect" />
84+
<arg unless="$(arg color_enabled)" name="depth_topic" value="/k4a/depth/image_rect" />
85+
<arg unless="$(arg color_enabled)" name="camera_info_topic" value="/k4a/ir/camera_info" />
86+
<arg name="approx_sync" value="true" />
87+
<arg name="frame_id" value="camera_base" />
88+
<arg if="$(arg color_enabled)" name="args" value="--delete_db_on_start --GFTT/MinDistance 7 --Vis/CorGuessWinSize 40 --Optimizer/GravitySigma 0.3" />
89+
<arg unless ="$(arg color_enabled)" name="args" value="--delete_db_on_start --Optimizer/GravitySigma 0.3" />
90+
<arg name="wait_imu_to_init" value="true"/>
6391
</include>
6492

6593
</launch>

0 commit comments

Comments
 (0)