######################################################################################
具体博客可参考本人主页:【https://blog.csdn.net/qq_37568167/article/details/105620960】
流程如下:
Anacond下载地址: https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/ 选择支持python3.6的版本,找一个linux版本的下载
sudo chmod +x Anaconda3-5.2.0-Linux-x86_64.sh
bash ./Anaconda3-5.2.0-Linux-x86_64.sh
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/ conda config --set show_channel_urls yes
conda create -n pytorch python=3.6
source activate pytorch
需要安装pytorch的GPU版本,笔者安装的是CUDA=10.1, 注意:电脑事先需要安装好cuda加速驱动,具体安装方式可参考英伟达官网以及相关博客
依赖库文件安装方法如下:
conda install pytorch==1.5.0 torchvision==0.6.0 cudatoolkit=10.1
其他库安装方法,采用pip安装,使用清华源,例如安装python-opencv
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple python-opencv==3.4.1.15
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple xxx(功能包的名字)
注意:需要关闭上面创建的虚拟环境(或者新开一个终端即可)
具体可参考下面: 参考:【https://stackoverflow.com/questions/49221565/unable-to-use-cv-bridge-with-ros-kinetic-and-python3】 参考:【https://blog.csdn.net/weixin_44060400/article/details/104347628】
sudo apt-get install python-catkin-tools python3-dev python3-catkin-pkg-modules python3-numpy python3-yaml ros-kinetic-cv-bridge
mkdir catkin_ws
cd catkin_ws
catkin init
catkin config -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/include/python3.5m -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.5m.so
catkin config --install
git clone https://github.com/ros-perception/vision_opencv.git src/vision_opencv
apt-cache show ros-kinetic-cv-bridge | grep Version
Version: 1.12.8-0xenial-20180416-143935-0800
cd src/vision_opencv/
git checkout 1.12.8
cd ../../
catkin build cv_bridge
source install/setup.bash --extend
######################################################################################
注意,整个过程时在虚拟环境下运行,如下所示:
source activate your_evironment
source ~/catkin_pytorch/install/setup.bash --extend
cd Visual-Front-new
python feature_match_node.py
cd Visual-Front-new
bash run_feature.sh
根据需要自行更改的几个地方:
feature_match_node.py文件:CamearIntrinsicParam(相机内参), 接受话题名
feature_process.py文件: SuperPointFrontend_torch类中 self.net,根据选择的模型更改(默认使用SuperPointNet_GhostNet)
parameter.py: 图像(H,W), 模型名称, 放缩尺度, 是否显示特征跟踪窗口等
######################################################################################
将VINS-Mono使用catkin编译,编译完成后开始运行
roslaunch vins_estimator superpoint.launch
roslaunch vins_estimator superpoint_mynteye.launch
roslaunch vins_estimator vins_rviz.launch
rosbag play MH_04_difficult.bag
######################################################################################
cd Visual-Front-new
bash run_feature.sh
roslaunch vins_estimator superpoint.launch
roslaunch vins_estimator vins_rviz.launch
rosbag play MH_04_difficult.bag