DXSLAM_ROS手把手教学

之前安装了离线版的DXSLAM,现在来安装ros版本的DXSLAM

首先创建一个工作目录

mkdir WorkSpaceDxSlam
cd WorkSpaceDxSlam
mkdir src

在把github上的东西git下来放进src里面去

git clone https://github.com/cedrusx/dxslam_ros
git clone https://github.com/cedrusx/deep_features
git clone https://github.com/ivipsourcecode/dxslam
git clone https://github.com/cedrusx/ORB_SLAM2

目录结构是这样的


                       |   ->  deep_features   
                       |
WorkSpaceDxSlam -> src |                     
                       |                     |-> dxslam
                       |    -> dxslam_ros -> |
                                             |-> ORBSLAM2     

然后进入dxslam_ros里的dxslam,把build.sh权限改一下,并运行

chmod +x build.sh
./build.sh

接着就是配置deep_feature的环境

cedrusx/deep_features: A ROS package for deep CNN-based feature extraction and publishing (github.com)

 按上面要求配置即可

//创建conda环境
conda create -n tf python=3.6
//激活环境
conda activate tf
 
//安装tensorflow
pip3 install tensorflow=1.13.1
 
//安装opencv,它默认装4.3xx版本 用到的api没改动,所以无所谓
pip3 install opencv-python 
 
//一般默认会装上numpy 不过还是装一下 万一呢
pip3 install numpy

然后回到src目录下进行编译

catkin_make

如果编译报错了,那可能是因为dxslam_ros里的CMakeLIst中的几个地方:

dxslam部分:

add_definitions(-DDXSLAM_PATH="${DXSLAM_TOP_DIR}")

add_definitions(-DCONFIG_PATH="${PROJECT_SOURCE_DIR}/config")

ORBSLAM2部分:

add_definitions(-DORBSLAM2_PATH="${ORBSLAM2_TOP_DIR}")

add_definitions(-DCONFIG_PATH="${PROJECT_SOURCE_DIR}/config")

这些部分在编译的时候,在对应的slam_node.cpp里会报错


修改slam_node.cpp里的几个地方:把转string的部分换成自己本身的路径

原来:
const std::string default_vocabulary = std::string(DXSLAM_PATH)+"Vocabulary/DXSLAM.fbow";
改:
const std::string default_vocabulary = "/home/liqunzhao/WorkspaceDxSlam/src/dxslam_ros/dxslam/Vocabulary/DXSLAM.fbow";

原来:
const std::string default_config = std::string(DXSLAM_PATH)+"realsense_d435.yaml";
改:
const std::string default_config = "/home/liqunzhao/WorkspaceDxSlam/src/dxslam_ros/config/realsense_d435.yaml";

同理ORBSLAM2部分

改完了以后再进行编译即可。

 

你可能感兴趣的:(ROS学习,自动驾驶,ubuntu,人工智能)