our test code is at: https://github.com/JustinShih0918/ros2-essentials/tree/feat/kobuki-slam
1. compose up kobuki-ws with rtabmap tag 'YES'
2. bringup kobuki to get /odom
```
./script/kobuki-bringup.sh
```
3. open vlp-ws and bringup lidar
```
ros2 launch vlp_cartographer vlp_driver.launch.py
```
4. open realsense within templete-ws
feature from https://github.com/yuhsiang1117/ros2-essentials/tree/feat/realsense
```
ros2 launch realsense2_camera rs_launch.py align_depth.enable:=true pointcloud.enable:=true
```
5. back to kobuki-ws, launch rtabmap with
```
ros2 launch kobuki_navigation real_rtabmap.launch.py
```
the launch file will first:
- read the config yaml
```
rtabmap:
ros__parameters:
frame_id: 'base_footprint'
use_sim_time: False
use_action_for_goal: True
qos_image: 2
qos_imu: 2
Reg/Force3DoF: 'true'
Optimizer/GravitySigma: '0'
# For LiDAR data subscription
subscribe_scan: True
# For RGB-D data subscription
subscribe_depth: True
subscribe_rgb: True
# Data synchronization
approx_sync: False
topic_queue_size: 40
sync_queue_size: 40
```
- remap topic for realsense
```
# Setup the remaps for camera topics
remappings = [
('rgb/image', '/camera/color/image_raw'),
('rgb/camera_info', '/camera/color/camera_info'),
('depth/image', '/camera/aligned_depth_to_color/image_raw')
]
```
- open rtabmap node and rviz
```
rtabmap_slam = Node(
package = 'rtabmap_slam',
executable = 'rtabmap',
parameters = [rtabmap_settings],
remappings = remappings,
arguments = ['-d', '--delete_db_on_start']
)
rtabmapviz = Node(
package = 'rtabmap_viz',
executable = 'rtabmap_viz',
parameters = [rtabmap_settings],
remappings = remappings
)
```
### we have tried
1. approx_sync: False , queue_size = 40
seems that clock time is not synchronizes
```
[rtabmap-1] [33m[WARN] [1764427540.449959784] [rtabmap]: rtabmap: Did not receive data since 5 seconds! Make sure the input topics are published ("$ ros2 topic hz my_topic") and the timestamps in their header are set. If topics are coming from different computers, make sure the clocks of the computers are synchronized ("ntpdate"). Ajusting topic_queue_size (40) and sync_queue_size (40) can also help for better synchronization if framerates and/or delays are different. Parameter "approx_sync" is false, which means that input topics should have all the exact timestamp for the callback to be called.
[rtabmap-1] rtabmap subscribed to (exact sync):
[rtabmap-1] /odom \
[rtabmap-1] /camera/color/image_raw \
[rtabmap-1] /camera/aligned_depth_to_color/image_raw \
[rtabmap-1] /camera/color/camera_info \
[rtabmap-1] /scan[0m
```
2. approx_sync: True
give us the same warning.
3. check hz of each topic
- realsense
- color/image_raw
- 6.239 hz
- aligned_depth_to_cloud
- 5.319 hz
- after closing the background training model, we receive realsense topic hz at about 30hz
- /odom
- 49.980 hz
- /scan
- 39.160
4. open lidar in rtabmap alone, everything is good, the problem may cause by realsense.