# Realsense d455 SLAM using Octomap in ROS1 ## 一 、環境設置 ### 1.realsense 2 此實驗使用realsense2來進行,下方為realsense2 ROS1版本之github * https://github.com/IntelRealSense/realsense-ros/tree/ros1-legacy ``` sudo apt-get install ros-$ROS_DISTRO-realsense2-camera ``` $ROS_DISTRO請更換所使用之ROS版本 ### 2.Rtabmap 在開啟相機後,我們將使用Rtabmap來生成點雲 * https://github.com/introlab/rtabmap * https://github.com/introlab/rtabmap_ros ``` sudo apt-get install ros-$ROS_DISTRO-rtabmap sudo apt-get install ros-$ROS_DISTRO-rtabmap-ros ``` ### 3. Octomap 把點雲轉換為octree,需要使用Octomap * https://github.com/OctoMap/octomap * https://github.com/OctoMap/octomap_mapping ``` sudo apt-get install ros-$ROS_DISTRO-octomap sudo apt-get install ros-$ROS_DISTRO-octomap-mapping ``` ## 二、啟動程序 ### 1.啟動相機 ``` roslaunch realsense2_camera rs_rgbd.launch ``` ### 2.開啟rtabmap ``` roslaunch rtabmap_ros rtabmap.launch rtabmap_args:="--delete_db_on_start" depth_topic:=/camera/aligned_depth_to_color/image_raw rgb_topic:=/camera/color/image_raw camera_info_topic:=/camera/color/camera_info ``` 此時應該會跳出以下畫面![](https://hackmd.io/_uploads/rkAziBh02.png) ### 3.開啟Octomap 首先從/octomap_server/launch/octomap_mapping.launch檔中修改參數。 resolution可調整Octree的方格大小,sensor_model/max_range設定SLAM時的最遠距離,單位皆為公尺。 **注意!第一次使用時,須將圖中第20行,remap那行設置為以下:** ``` <remap from="cloud_in" to="/rtabmap/local_grid_obstacle" /> ``` ![](https://hackmd.io/_uploads/r1ghUH3Cn.png) 接著啟動octomap ``` roslaunch octomap_server octomap_mapping.launch ``` ### 4.rviz設置與地圖調整更新頻率 ``` rosrun rviz rviz ``` 開啟rviz後,左下角Add,選MarkerArray,Marker topic選occupied_cells_vis_array.之後便能看見即時SLAM之情形。 ![](https://hackmd.io/_uploads/ByAY3BhCn.png) 若想看即時點雲,可以Add一個PointCloud2,Topic選/rtabmap/local_grid_obstacle,即可看到rgb點雲。 ![](https://hackmd.io/_uploads/SkeW6rhA2.png) 預設情況下,rtabmap的更新頻率為1Hz,並不夠即時,此時我們可以透過使用rtabmap的GUI來更改更新頻率。RTAB-Map視窗左上角的Window->Preferences...會跳出下圖的視窗,接著選RTAB-Map Settings->Detection rate,更改頻率以加速地圖更新頻率,不過更新頻率上限取決於運算速度,我使用的電腦約為8~9Hz。 ![](https://hackmd.io/_uploads/r1rTpHhRh.png) 2023/9/11
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up