当前位置:网站首页>ROS学习(二十)机器人SLAM功能包——rgbdslam的安装与测试
ROS学习(二十)机器人SLAM功能包——rgbdslam的安装与测试
2022-07-06 18:12:00 【敲代码的雪糕】
文章目录
前言
在前面的学习中,slam构建出的地图都是二维地图,而目前很多算法可以实现三维信息的地图构建,机器人不仅知道地图中的什么位置有障碍物,而且还知道该障碍物是什么。
ROS提供了多种3D SLAM的功能包,rgbdslam就是其中一种,本篇主要学习rgbdslam的安装与测试。
一、新建工作空间
命令如下:
mkdir -p ~/catkin_rgbdslam_ws/src
cd ~/catkin_rgbdslam_ws/src
catkin_init_workspace
cd ~/catkin_rgbdslam_ws
catkin_make
二、下载rgbdslam_v2作者对应的g2o
命令如下:
cd ~/catkin_rgbdslam_ws/src
sudo apt-get install libsuitesparse-dev
git clone https://github.com/felixendres/g2o.git
cd g2o
mkdir build
cd build
cmake ..
make..
sudo make install
其中,第二条命令负责安装依赖。
三、安装pcl1.8
下载,命令如下:
cd ~
wget https://github.com/PointCloudLibrary/pcl/archive/pcl-1.8.0.tar.gz
tar -xvzf pcl-pcl-1.8.0.tar.gz
cd ~/pcl-pcl-1.8.0
gedit CMakeLists.txt
将以下内容添加到CMakeLists.txt的第146行(在endif()之后),即添加C++11支持:
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
编译、安装,命令如下:
cd ~/pcl-pcl-1.8.0
mkdir build
cd build
cmake ../
make VERBOSE=1
sudo make install
四、配置rgbdslam_v2
命令如下:
cd ~/catkin_rgbdslam_ws/src
git clone https://github.com/felixendres/rgbdslam_v2
cd rgbdslam_v2
gedit CMakeLists.txt
修改CMakeLists文件内容,将
find_package(PCL 1.7 REQUIRED COMPONENTS common io)
改为:
find_package(PCL 1.8 REQUIRED COMPONENTS common io)
并且在最低端加入以下内容:
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
修改 /opt/ros/kinetic/share/pcl_ros/cmake/pcl_rosConfig.cmake文件,将所有/usr/lib/x86_64-linux-gnu/libpcl_开头的内容改成/usr/local/lib/libpcl_(总计34个)
五、构建siftgpu库
命令如下:
cd ~/catkin_rgbdslam_ws/src/rgbdslam_v2/external/SiftGPU
sudo apt-get install libglew-dev
sudo apt-get install libdevil1c2 libdevil-dev
make
六、编译rgbdslam_v2
命令如下:
cd ~/catkin_rgbdslam_ws
catkin_make
cd build/rgbdslam_v2
make VERBOSE=1
make install
若编译报opencv错误,可以根据本篇博客 openCV踩坑日记进行操作,然后重新编译。
七、测试
1、简单测试
新开一个终端,运行roscore
roscore
切换到/catkin_rgbdslam_ws/devel/lib/rgbdslam/目录下,打开另一个终端,运行如下命令:
./rgbdslam
界面如下:
若此界面正常显示,则证明rgbdslam安装成功。
2、数据集测试
下载数据集,下载地址:http://vision.in.tum.de/data/datasets/rgbd-dataset/download#freiburg1_room,将下载好的.bag文件存放到catkin_rgbdslam_ws/rgdb_data目录下。
修改rgdbslam.launch文件,确保订阅的话题与数据集的一致,修改内容如下:
<param name="config/topic_image_mono" value="/camera/rgb/image_color"/>
<param name="config/topic_image_depth" value="/camera/depth/image"/>
打开终端,输入命令如下:
roscore
切换到rgdbslam_v2/launch目录下,打开新的终端,命令如下:
roslaunch rgbdslam rgbdslam.launch
界面如下所示:
切换到catkin_rgbdslam_ws/rgdb_data目录下,打开新的终端,命令如下:
rosbag play rgbd_dataset_freiburg1_room.bag
数据包开始发布数据时,就可以在界面中看到图像数据和slam的过程,如下:
建图完成后,直接在菜单栏中选择保存为点云数据,我保存在rgdb_data目录下,文件名为quicksave.pcd。
可以使用pcl_ros功能包查看已保存的点云地图:
rosrun pcl_ros pcd_to_pointcloud quicksave.pcd
边栏推荐
- AcWing 344. Solution to the problem of sightseeing tour (Floyd finding the minimum ring of undirected graph)
- Use nodejs to determine which projects are packaged + released
- AcWing 1148. 秘密的牛奶运输 题解(最小生成树)
- JVM 内存模型
- MySQL's most basic select statement
- 1123. The nearest common ancestor of the deepest leaf node
- Appium automation test foundation uiautomatorviewer positioning tool
- JS reverse -- ob confusion and accelerated music that poked the [hornet's nest]
- Start from the bottom structure to learn the customization and testing of fpga---- FIFO IP
- Get to know MySQL for the first time
猜你喜欢
刨析《C语言》【进阶】付费知识【一】
域分析工具BloodHound的使用说明
一文带你走进【内存泄漏】
设置Wordpress伪静态连接(无宝塔)
JS reverse -- ob confusion and accelerated music that poked the [hornet's nest]
Typical problems of subnet division and super network construction
Dark horse notes - create immutable sets and streams
Box stretch and pull (left-right mode)
【唯一】的“万字配图“ | 讲透【链式存储结构】是什么?
Yiwen takes you into [memory leak]
随机推荐
According to the analysis of the Internet industry in 2022, how to choose a suitable position?
Typical problems of subnet division and super network construction
The cradle of eternity
Related programming problems of string
Share a general compilation method of so dynamic library
使用nodejs完成判断哪些项目打包+发版
First experience of JSON learning - the third-party jar package realizes bean, list and map to create JSON format
Google发布安全更新,修复Chrome中已被利用的0 day
数据手册中的词汇
增加 pdf 标题浮窗
设置Wordpress伪静态连接(无宝塔)
JS Es5 can also create constants?
域分析工具BloodHound的使用说明
Appium基础 — Appium Inspector定位工具(一)
Make Jar, Not War
Let's see how to realize BP neural network in Matlab toolbox
【唯一】的“万字配图“ | 讲透【链式存储结构】是什么?
1123. The nearest common ancestor of the deepest leaf node
安利一波C2工具
Make DIY welding smoke extractor with lighting