ROS2与VSLAM入门教程-整合rtabmap建图
ROS2与VSLAM入门教程-整合rtabmap建图
说明:
- 介绍如何在ros2下使用rtabmap
- 版本: galactic
步骤:
- 编译源码
$ cd ~/ros2_ws
$ git clone https://github.com/introlab/rtabmap.git src/rtabmap
$ git clone --branch ros2 https://github.com/introlab/rtabmap_ros.git src/rtabmap_ros
$ export MAKEFLAGS="-j6" # Can be ignored if you have a lot of RAM (>16GB)
$ colcon build --symlink-install
turtlebot3激光仿真测试
- 新开终端,启动仿真
$ export TURTLEBOT3_MODEL=waffle
$ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
- 新开终端,启动键盘
$ export TURTLEBOT3_MODEL=waffle
$ ros2 run turtlebot3_teleop teleop_keyboard
- 新开终端,启动RTAB-Map:
$ ros2 launch rtabmap_ros turtlebot3_scan.launch.py
- 效果图:
- 新开终端,启动导航(nav2_bringup package should be installed):
$ ros2 launch nav2_bringup navigation_launch.py use_sim_time:=True
- 新开终端,启动rviz
$ ros2 launch nav2_bringup rviz_launch.py
- 可以通过在rviz上指定目标点实现导航和建图
- 效果图:
turtlebot3深度相机仿真测试
- 修改 turtlebot3_gazebo/models/turtlebot3_waffle/model.sdf 增加深度相机配置
- 增加内容
<joint name="camera_rgb_optical_joint" type="fixed">
<parent>camera_rgb_frame</parent>
<child>camera_rgb_optical_frame</child>
<pose>0 0 0 -1.57079632679 0 -1.57079632679</pose>
<axis>
<xyz>0 0 1</xyz>
</axis>
</joint>
- 重命名
<link name="camera_rgb_frame">
为<link name="camera_rgb_optical_frame">
- 增加
<link name="camera_rgb_frame"/>
- 修改
<sensor name="camera" type="camera"> 为 <sensor name="camera" type="depth">
- 修改
image width/height from 1920x1080 to 640x480
- 修改
min scan range from 0.12 to 0.2
- 新开终端,启动仿真
$ export TURTLEBOT3_MODEL=waffle
$ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
- 新开终端,启动键盘
$ export TURTLEBOT3_MODEL=waffle
$ ros2 run turtlebot3_teleop teleop_keyboard
- 新开终端,启动RTAB-Map:
$ ros2 launch rtabmap_ros turtlebot3_rgbd.launch.py
- 效果图:
- 新开终端,启动导航(nav2_bringup package should be installed):
$ ros2 launch nav2_bringup navigation_launch.py use_sim_time:=True
- 新开终端,启动rviz
$ ros2 launch nav2_bringup rviz_launch.py
- 通过rviz上的设定目标点,可以实现边建图边导航
- 效果图:
- 更多的例子可以参考
参考:
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号