Ubuntu18.04从0安装ORB-创新互联
一键安装ROS,需要在属性里面给fishros.sh文件设置运行权限
成都创新互联公司-专业网站定制、快速模板网站建设、高性价比思茅网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式思茅网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖思茅地区。费用合理售后完善,10年实体公司更值得信赖。安装依赖wget http://fishros.com/install -O fishros sudo ./fishros
Pangolinsudo apt install libgl1-mesa-dev sudo apt install libglew-dev sudo apt install libpython2.7-dev sudo apt install pkg-config sudo apt install libegl1-mesa-dev libwayland-dev libxkbcommon-dev wayland-protocols
下载地址:https://github.com/stevenlovegrove/Pangolin.git
最好安装0.5版本的:Release v0.5 · stevenlovegrove/Pangolin (github.com)
Eigen3.2.1cd Pangolin mkdir build cd build cmake .. cmake --build . sudo make install
下载地址:Releases · libeigen / eigen · GitLab
OpenCv3.2.0mkdir build cd build cmake .. sudo make install sudo ln -s /usr/local/include/eigen3 /usr/include/eigen3
下载地址:https://github.com/opencv/opencv/releases/tag/3.2.0
Boostmkdir build cd build cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local .. -DENABLE_PRECOMPILED_HEADERS=OFF //编译中遇到问题,把ippicv_linux_20151201.tgz替换到opencv-3.2.0/3rdparty/ippicv/downloads/linux-808b791a6eac9ed78d32a7666804320e文件下 之后再cmake一下 sudo make sudo make install //配置环境 sudo gedit /etc/ld.so.conf.d/opencv.conf 文末添加 /usr/local/lib sudo ldconfig sudo gedit /etc/bash.bashrc 文末添加 PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig export PKG_CONFIG_PATH 配置生效 source /etc/bash.bashrc sudo updatedb
下载地址:https://www.boost.org/users/download/
ORB_SLAM3tar -xvf boost_1_77_0.tar.gz cd ./boost_1_77_0 ./bootstrap.sh sudo ./b2 install
下载地址:UZ-SLAMLab/ORB_SLAM3: ORB-SLAM3: An Accurate Open-Source Library for Visual, Visual-Inertial and Multi-Map SLAM (github.com)
安装依赖确保这些都安装上
遇到问题 1.orb_slam3运行视图sudo apt install libboost-filesystem-dev sudo apt-get install libssl-dev sudo apt install libboost-all-dev
把ORB_SLAM3/Examples/Monocular中的mono_euroc.cc中第83行的函数第四个参数中的false改为true
2.版本号更改ORB_SLAM3::System SLAM(argv[1],argv[2],ORB_SLAM3::System::MONOCULAR, true);
把ORB_SLAM3文件夹下的CMakeLists.txt中opencv和eigen的版本换一下,Thirdparty/g2o中也有一个CMakeLists一同修改
3.隐去未使用定义变量的警告把CMakeLists.txt中-Wall后面加一个-w,添加c++14的编译选择
4.内存不足set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -w -O3") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -w -O3") add_compile_options(-std=c++14) set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -march=native") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=native")
报错:c++: internal compiler ereor: killed(program cciplus)
添加一个交换空间,我之前加的4G的好像还是运行错误,直接加了8G
5.修改ros—slam3可能报错的地方sudo swapoff -a sudo dd if=/dev/zero of=/swapfile bs=1M count=8192 sudo mkswap /swapfile sudo swapon /swapfile 最后启动的时候可能会遇到错误:swapon: /swapfile: insecure permissions 0644, 0600 suggested. sudo chmod -R 600 swapfile //关闭删除交换空间 sudo swapoff /swapfile sudo rm /swapfile
在编译ROS——ORB_SLAM3时,需要改一些代码
找到ORB_SLAM3/Examples_old/ROS/ORB_SLAM3/src/AR下的ros_mono_ar.cc文件:
把
cv::Mat Tcw = mpSLAM->TrackMonocular(cv_ptr->image,cv_ptr->header.stamp.toSec());
改为
cv::Mat Tcw; Sophus::SE3f Tcw_SE3f = mpSLAM->TrackMonocular(cv_ptr->image,cv_ptr->header.stamp.toSec()); Eigen::Matrix4f Tcw_Matrix = Tcw_SE3f.matrix(); cv::eigen2cv(Tcw_Matrix, Tcw);
找到ORB_SLAM3/Examples_old/ROS/ORB_SLAM3/src/AR下的ViewerAR.cc文件
把
vPoints.push_back(pMP->GetWorldPos());
改为
cv::Mat WorldPos; cv::eigen2cv(pMP->GetWorldPos(), WorldPos); vPoints.push_back(WorldPos);
把
cv::Mat Xw = pMP->GetWorldPos();
改为
编译ORB_SLAM3cv::Mat Xw; cv::eigen2cv(pMP->GetWorldPos(), Xw);
运行样例 数据集cd Thirdparty/DBoW2 mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release make -j cd ../../g2o mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release make -j cd ../../Sophus mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release make -j cd ../../../ cd Vocabulary tar -xf ORBvoc.txt.tar.gz cd .. mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release make -j4
下载:https://projects.asl.ethz.ch/datasets/doku.php?id=kmavvisualinertialdatasets
下载Machine Hall 01数据
下载完解压到MH01文件夹,注意MH01文件夹下面是mav0
运行脚本和修改代码下载euroc_examples.sh脚本,放到Example文件夹下面
下载地址:ORB_SLAM3/euroc_examples.sh at master · yuantao15/ORB_SLAM3 (github.com)
将pathDatasetEuroc=后面放上MH01的上级文件夹,注意是相对路径
我的MH01的绝对路径是/home/orbslam3/workspace/ORB_SLAM3/Examples/Datasets/EuRoC/MH01
所以应该加上./Datasets/EuRoC
之后就可以运行了。
运行截图ORB_SLAM3-ROS编译 遇到问题 1.修改环境变量./euroc_examples.sh 或者 ./Monocular/mono_euroc ../Vocabulary/ORBvoc.txt ./Monocular/EuRoC.yaml ./Datasets/EuRoC/MH01 ./Monocular/EuRoC_TimeStamps/MH01.txt dataset-MH01_mono
把
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:PATH/ORB_SLAM3/Examples_old/ROS
//path需要补全为绝对路径
加到~/.bashrc最后一行
sudo gedit ~/.bashrc
source ~/.bashrc
2.CMakelist修改到ORB_SLAM3/Examples_old/ROS/ORB_SLAM3下的CMakeLists.txt,找到include_directories并添加 ${PROJECT_SOURCE_DIR}/…/…/…/Thirdparty/Sophus
include_directories(
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/../../../
${PROJECT_SOURCE_DIR}/../../../include
${PROJECT_SOURCE_DIR}/../../../include/CameraModels
${PROJECT_SOURCE_DIR}/../../../Thirdparty/Sophus
${Pangolin_INCLUDE_DIRS}
)
同时修改eigen和opencv的版本号
编译ROScd Examples/ROS/ORB_SLAM3
mkdir build
cd build
cmake .. -DROS_BUILD_TYPE=Release
make -j
运行样例
数据集下载:http://projects.asl.ethz.ch/datasets/doku.php?id=kmavvisualinertialdatasets
下载ROS bag数据集
启动 1.roscoreroscore
2.Stereo节点启动rosrun ORB_SLAM3 Stereo Vocabulary/ORBvoc.txt Examples_old/Stereo/EuRoC.yaml true
3.启动rosbagrosbag play --pause MH_01_easy.bag /cam0/image_raw:=/camera/left/image_raw /cam1/image_raw:=/camera/right/image_raw /imu0:=/imu
运行效果和上面的是一样的。
实际运行如果运行相机节点的话,需要修改asus.yaml中的相机内参配置,并且修改对应.cc文件中的订阅节点。还没实现,后面再来更新。
参考基于ubuntu18.04的ORB_SLAM3安装 (qq.com)
(22条消息) Ubuntu18.04安装Ros(最新最详细亲测)_向日葵骑士Faraday的博客-博客_ubuntu18.04安装ros
(22条消息) ubuntu18.04配置ORB-SLAM3(包含ROS)完整版教程_黄宏智的博客-博客_orbslam3 ros
你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧
文章题目:Ubuntu18.04从0安装ORB-创新互联
标题来源:http://pwwzsj.com/article/pcppo.html