ROS下安装和运行SVO数据包和实时测验的过程记录

安装与运行的所有文档:

  1. https://github.com/uzh-rpg/rpg_svo/wiki  或者 
  2. http://blog.sina.com.cn/s/blog_7b83134b0102wfu4.html

有两种安装方式:

  1. 有ros:https://github.com/uzh-rpg/rpg_svo/wiki/Installation:-ROS 
  2. 没ros:https://github.com/uzh-rpg/rpg_svo/wiki/Installation:-Plain-CMake-(No-ROS) 

没ros的操作步骤较多。首先依照ros的安装方法。

一、安装SVO

0. 建立一个ROS工作空间

cd ~/
mkdir svo_ws
cd svo_ws
catkin_make
mkdir src
mkdir thirdparty

echo "source $HOME/svo_ws/devel/setup.sh" >> ~/.bashrc
source ~/.bashrc

1.安装Sophus

cd thirdparty
git clone https://github.com/strasdat/Sophus.git
cd Sophus
git checkout a621ff ### 选择特定版本 Sophus

如果g++编译器为6及以上版本,需要更改 sophus/so2.cpp。(我的是 gcc-7.5和g++-7.5)

//  unit_complex_.real() = 1.;
//  unit_complex_.imag() = 0.;
  unit_complex_.real(1.);
  unit_complex_.imag(0.);

然后,开始编译

mkdir build
cd build
cmake ..
make

在~/.cmake/packages/中可以看到Sophus

2. 安装fast角点检测器

cd ~/svo_ws/thirdparty
git clone https://github.com/uzh-rpg/fast.git 
cd fast 
mkdir build 
cd build 
cmake .. 
make

3.安装g2o

安装g2o前,需要安装一些依赖,否则会缺少一些安装内容。

sudo apt install libeigen3-dev libsuitesparse-dev libqt4-dev qt4-qmake libqglviewer-dev
sudo apt install libmrpt-dev
sudo apt install liblapacke-dev

然后开始安装。

cd ~/svo_ws/thirdparty
wget https://github.com/RainerKuemmerle/g2o/archive/20160424_git.tar.gz -O g2o-20160424_git.tar.gz
tar xvzf g2o-20160424_git.tar.gz
cd g2o-20160424_git
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=$HOME/svo_ws/thirdparty/g2o ..
make -j4
make install

cd ~/svo_ws
## 设置环境变量或安装路径
echo "export G2O_ROOT=$HOME/svo_ws/thirdparty/g2o" >> g2o_root.bashrc

需要注意的是,安装的时候需要特别确认是否有完全安装。我第一次安装的时候就碰到过提示缺少 “solvers/cholmod/linear_solver_cholmod.h” 的问题。不得已重新编译了一遍。

如果你已经安装了g2o, 你可以设置环境变量G2O_ROOT,不需要重新安装

export G2O_ROOT=$HOME/installdir

.安装vikit

cd ~/svo_ws/src
git clone https://github.com/uzh-rpg/rpg_vikit.git

5.安装ros cmake modules

sudo apt-get install ros-melodic-cmake-modules

6.安装sov

cd ~/svo_ws/src
git clone https://github.com/uzh-rpg/rpg_svo.git

7. 编译catkin_make

编译前,还需要做以下的几个工作:

  1. 已经安装了g2o,因此把svo/CMakeLists.txt中的HAVE_G2O设为TRUE。
  2. 下载并编译 cv_bridge。
  3. 替换 FindEigen3.cmake, FindSophus.cmake 等文件,以指定前面安装的 thirdparty 的路径。
git clone https://github.com/ros-perception/vision_opencv.git
git checkout 1.13.0

cd vision_opencv
cp -rf cv_bridge $HOME/svo_ws/src/

8. 编译SVO

export G2O_INCLUDE_DIR=$HOME/svo_ws/thirdparty/g2o/include
export G2O_ROOT=$HOME/svo_ws/thirdparty/g2o

cd $HOME/svo_ws                    # 进入ros工作空间
catkin_make --pkg cv_bridge        #执行后会在catkin_ws /build和/devel 生成相应文件      

9. 运行-测试数据集

  1. 有ROS:https://github.com/uzh-rpg/rpg_svo/wiki/Run-SVO-with-ROS 
  2. 无ROS:https://github.com/uzh-rpg/rpg_svo/wiki/Run-SVO-without-ROS 

9.1 有ROS时,测试数据集:

  1. 下载测试数据集:从这个网址https://github.com/uzh-rpg/rpg_svo/wiki/Run-SVO-with-ROS 用一个DATAset来运行SVO
  2. 或在在这里下载:rpg.ifi.uzh.ch/datasets/airground_rig_s3_2013-03-18_21-38-48.bag
  3. 首先运行ROS内核(窗口1):roscore
  4. 然后启动ROS(窗口2):roslaunch svo_ros test_rig3.launch
  5. 启动rviz(窗口3):rosrun rviz rviz -d ~/svo_ros_ws/src/rpg_svo/svo_ros/rviz_config.rviz
  6. 加载数据: rosbag play ~/svo_ws/Datasets/airground_rig_s3_2013-03-18_21-38-48.bag

9.2 安装uvc camera功能包

参考来源:https://github.com/uzh-rpg/rpg_svo/wiki/Run-SVO-with-ROS

参考来源:http://laukh.com/ros/run-svo/

《ROS中UVC_Camera的使用》:https://blog.csdn.net/qq_24894159/article/details/82939542

sudo apt install ros-melodic-uvc-camera
sudo apt install ros-melodic-libuvc-camera
sudo apt install ros-melodic-image-*
sudo apt install ros-melodic-rqt-image-view

通过运行UVC camera节点发布image_raw,并把SVO中live.launch中接收消息的话题改为image_raw,即

value=”/usb_cam/image_raw”  # 改成自己发布主题的名字
my_camera.yaml # 相机标定参数

9.3 有ROS时,使用自身摄像头

  1.  roscore                                          #开启内核
  2.  cd ~/svo_ros_ws/src/usb_cam/launch #进入安装相机驱动的地方
  3.  roslaunch cam-X280.launch             #打开相机
  4.  roslaunch svo_ros svo.launch          #svo.launch 是我编的launch文件
  5.  rosrun rviz rviz -d ~/svo_ros_ws/src/rpg_svo/svo_ros/rviz_config.rviz     # 启动rviz
  6.  rosrun rqt_svo rqt_svo

如果显示NOT CONNECTED 在SVO Namespace 填入svo,点Start 运行。

9.4 可能存在的问题

运行 rosrun rqt_svo rqt_svo 时报错。

Traceback (most recent call last):
  File "/home/npuyin/svo_ros_ws/src/rpg_svo/rqt_svo/scripts/rqt_svo", line 5, in <module>
    from rqt_svo.svo import Svo
  File "/home/npuyin/svo_ros_ws/src/rpg_svo/rqt_svo/src/rqt_svo/svo.py", line 6, in <module>
    from .svo_widget import SvoWidget
  File "/home/npuyin/svo_ros_ws/src/rpg_svo/rqt_svo/src/rqt_svo/svo_widget.py", line 7, in <module>
    from python_qt_binding.QtGui import QWidget
ImportError: cannot import name QWidget

原因:rqt in Kinetic uses Qt5, and in Qt5 the Widget class is defined in QtWidgets rather than QtGui.

因此,最简单的方法是作如下修改:

from python_qt_binding.QtWidgets import QWidget  # 《== new line added / replaced QtGui with QtWidgets.

接着,碰到数据设置问题。

set maximum number of features to 120
/home/npuyin/svo_ros_ws/src/rpg_svo/rqt_svo/src/rqt_svo/svo_widget.py:64: SyntaxWarning: The publisher should be created with an explicit keyword argument 'queue_size'. Please see http://wiki.ros.org/rospy/Overview/Publishers%20and%20Subscribers for more information.
  self._publisher = rospy.Publisher(svo_namespace+'/remote_key', String)
set maximum number of features to 120
Failed to create /home/npuyin/.cache/mesa_shader_cache for shader cache (Permission denied)---disabling.

http://wiki.ros.org/rospy/Overview/Publishers%20and%20Subscribers

 

 

单目视觉半直接法(SVO)实践

https://blog.csdn.net/u013004597/article/details/51965940

源码安装ROS Melodic Python3 指南

https://blog.csdn.net/id9502/article/details/80410989

ROS中使用Python3的注意事项

https://blog.csdn.net/handsome_for_kill/article/details/81947978

完美解决如何用python3.6运行ros的问题

https://blog.csdn.net/weixin_41848012/article/details/103284050

Ubuntu18 编译和运行PL-SVO(不需要ROS)

https://blog.csdn.net/zhiwei121/article/details/101553669

PL-SVO在ROS下运行笔记

http://www.mamicode.com/info-detail-2275690.html

暑假研习系列:线、面SLAM从零入门(三)

https://blog.csdn.net/ns2942826077/article/details/107145939

ROS下安装和运行SVO数据包和实时详细过程

https://blog.csdn.net/xingzhou1212/article/details/63682032

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值