参考:
链接: https://blog.csdn.net/zhangjiahao14/article/details/80554616.
链接: https://blog.csdn.net/weixin_44448313/article/details/110084844?spm=1001.2101.3001.6650.4&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-4.pc_relevant_default&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-4.pc_relevant_default&utm_relevant_index=9.
首先,对Ubuntu软件库进行设置,选中前5个选项,这一步很重要。源代码选择阿里云
首先,备份原有的配置信息
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
替换sources.list文件:
sudo vim /etc/apt/sources.list
或 sudo gedit /etc/apt/sources.list
打开后把配置文件内容修改如下:
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
修改完成后保存退出即可开始Ros的正式安装。
有时候安装完vm-tool之后,重启仍然不能拖拽,解决方法如下:
apt-get install open-vm-tools-desktop
然后重启
安装配置过程中需要需要cmake、gcc、g++和Git工具
1、安装git,用于从Github上克隆项目到本地
sudo apt install git
2、安装cmake
sudo apt install cmake
3、安装gcc、g++
sudo apt install g++
sudo apt install gcc
Opencv3、Pangolin、Ceres都是cmake安装,只需要下载各自压缩包之后解压cmake即可
建议下载压缩包,然后解压安装
sudo apt install build-essential
sudo apt install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
错误:E: 无法定位软件包 libjasper-dev
解决:libjasper1是libjasper-dev的依赖包
sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
sudo apt update
sudo apt install libjasper1 libjasper-dev
git clone https://github.com/opencv/opencv.git
cd opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j4
sudo make install
pkg-config --modversion opencv
cd /home/***/opencv/build
sudo make uninstall
cd ..
sudo rm -r build
sudo apt install libeigen3-dev
链接:https://github.com/stevenlovegrove/.
https://blog.csdn.net/qq_43647590/article/details/120226747.
安装时可选择先下载Pangolin的压缩包,然后在解压后的Pangolin文件夹里面cmake,这样可以避免第二步。
1、 安装依赖项
sudo apt install libglew-dev libpython2.7-dev
2、 从GitHub将项目下载到本地
git clone https://github.com/stevenlovegrove/Pangolin.git
3.、编译安装
cd Pangolin
mkdir build
cd build
cmake ..
make -j4
sudo make install
4、验证
编译完,可以运行以下命令测试,如果显示出一个彩色立方体,并且可以通过鼠标左、右键和滚轮按住拖拽,就表示 Pangolin 安装成功了
cd ~/Pangolin/build/examples/HelloPangolin
./HelloPangolin
5、安装过程有可能出现的问题
(1)在执行make -j4的时候可能会遇到如下问题:No package 'xkbcommon’
解决这个问题,执行如下命令:
sudo apt install libxkbcommon-dev
(2)也可能遇到问题:No package ‘wayland-protocols’ found
解决方法:
sudo apt install wayland-protocols
1.下载ceres:https://github.com/ceres-solver/ceres-solver
2.打开sources.list:
sudo gedit /etc/apt/sources.list
3.将下面的源粘贴到最上方sources.list:
deb http://cz.archive.ubuntu.com/ubuntu trusty main universe
4.更新源:
sudo apt update
5.重新输入依赖项安装命令安装依赖项:
sudo apt install liblapack-dev libsuitesparse-dev libcxsparse3.1.2 libgflags-dev libgoogle-glog-dev libgtest-dev
6.然后解压ceres,打开终端进入解压后的文件,编译安装:
mkdir build
cd build
cmake ..
make -j4
sudo make install
安装ros最好用手机热点或者挂梯子
参考:
https://www.it610.com/article/1289783908812005376.htm
https://www.freesion.com/article/46021181316/
https://www.guyuehome.com/12640
http://wiki.ros.org/melodic/Installation/Ubuntu 官网
http://www.autolabor.com.cn/book/ROSTutorials/chapter1/12-roskai-fa-gong-ju-an-zhuang/127-zi-65993a-qi-ta-ros-ban-ben-an-zhuang.html b站
1、添加ROS软件源
sudo sh -c echo deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main /etc/apt/sources.list.d/ros-latest.list
2、添加秘钥
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
3、安装ros
sudo apt update
sudo apt install ros-melodic-desktop-full
4、设置环境变量
echo source /opt/ros/melodic/setup.bash ~/.bashrc
source ~/.bashrc
5、安装构建依赖
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
6、初始化rosdep
sudo apt install python-rosdep
7、初始化rosdep
sudo rosdep init
rosdep update
失败解决方案一:
参考: https://mp.weixin.qq.com/s/VGs8oWdhHH6XsHcx21lN4Q.
#安装起来很简单,一句话的事情,后面小鱼会让其变得更简单
sudo pip install rosdepc
#如果显示没有pip可以试试pip3
sudo pip3 install rosdepc
#如果pip3还没有
sudo apt-get install python3-pip
sudo pip install rosdepc
#然后
sudo rosdepc init
rosdepc update
失败解决方案二:
参考: https://www.bilibili.com/video/av849683967.
sudo rosdep init 执行成功后,再次输入sudo rosdep init会显示如下图
1、CTRL+ALT+T打开终端(Termial),输入以下命令,初始化ROS环境:
roscore
成功打开后终端所示:
lzy@lzy:~$ roscore
... logging to /home/lzy/.ros/log/7e7b1136-9455-11ec-a3ef-000c2973959d/roslaunch-lzy-34704.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://lzy:38245/
ros_comm version 1.14.12
SUMMARY
========
PARAMETERS
* /rosdistro: melodic
* /rosversion: 1.14.12
NODES
auto-starting new master
process[master]: started with pid [34717]
ROS_MASTER_URI=http://lzy:11311/
setting /run_id to 7e7b1136-9455-11ec-a3ef-000c2973959d
process[rosout-1]: started with pid [34728]
started core service [/rosout]
上面显示有ROS的版本,还有一些节点、端号等内容。
2、再打开一个新的终端(Termial),输入以下命令,弹出一个小乌龟窗口:
rosrun turtlesim turtlesim_node
3、出现一个小乌龟的LOGO后,再打开一个新的终端(Termial),输入以下命令
rosrun turtlesim turtle_teleop_key
然后,通过方向键控制小乌龟的移动
注意:要把鼠标放在第三个控制小乌龟的终端上
4、 打开新的Termial,输入以下命令,可以查看ROS节点信息:
rosrun rqt_graph rqt_graph
如果能顺利进行到这一步,说明ROS安装成功了。
5、安装成功终端输入ros+Tab自动补全显示如下图
mkdir -p ~/catkin_ws/src #创建了catkin_ws目录,并且在该目录下创建了src目录
cd ~/catkin_ws/
catkin_make
执行catkin_make命令后,会在src文件夹中创建一个CMakeLists.txt链接文件,并且此时在catkin_ws目录下会创建build和devel两名文件夹。
将vins_mono程序复制到catkin_ws/scr文件夹下,将数据集放在catkin_ws下
cd ~/catkin_ws/src/
catkin_make //这一步出现问题后,重新catkin_make即可
source devel/setup.bash
在catkin_ws文件夹下打开三个终端,分别启动vins_estimator,rviz和播放bag文件。以MH_01为例
注意:
1.在catkin_ws文件夹下打开三个终端
2.不要忘记设置环境变量:source devel/setup.bash
第一个终端
source devel/setup.bash
roslaunch vins_estimator euroc.launch
第二个终端
source devel/setup.bash
roslaunch vins_estimator vins_rviz.launch
第三个终端
source devel/setup.bash
rosbag play YOUR_PATH_TO_DATASET/MH_01_easy.bag
例如:
source devel/setup.bash
rosbag play /home/lzy/桌面/MH_01_easy.bag