ROS安装及实时运行ORB-SLAM2
2020.12.20
暂时Ubuntu20.04的ROS Melodic不支持相机标定。
1 ROS安装
Ubuntu20.04 需要安装ROS Noetic,注意在Python3下进行安装,否则会产生一系列报错。
参考:http://wiki.ros.org/UsingPython3
(1)设置网络时间协议
设置NTP,使服务器和PC的时间误差最小。
$ sudo apt-get install -y chrony ntpdate
$ sudo ntpdate -q ntp.ubuntu.com
(2)添加ROS软件源——添加代码列表及设置公钥
$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
$ sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
连接很慢或者连不上,可以用清华TUNA源
$ sudo sh -c '. /etc/lsb-release && echo "d{2d3b390d-f615-41d0-a830-7bbdcedbd397}eb http://mirrors.ustc.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'
$ sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'
(3)更新软件包索引
$ sudo apt-get update && sudo apt-get upgrade
系统为ubuntu20.04,安装ROS Noetic 版本
$ sudo apt install ros-noetic-desktop-full -y
sudo apt install ros-kinetic-desktop-full -y
安装rqt相关功能包
$ sudo apt-get install ros-noetic-rqt
(4)初始化rosdep
$ sudo rosdep init
- 报错1:
sudo: rosdep: command not found
解决
$ sudo apt install python3-rosdep2
由于ubuntu20.04不支持python-rosdep2
报错需要下载python3-rosdep2
需要安装好依赖项,否则会会卸载ros相关的包(在python2.7环境下使用)
依赖项下载
$ sudo apt install python3-catkin-pkg
$ sudo apt install python3-rosdistro
$ sudo apt install python3-rospkg
$ sudo apt install python3-yaml
- 报错2:
ERROR: default sources list file already exists:
/etc/ros/rosdep/sources.list.d/20-default.list
Please delete if you wish to re-initialize
解决
$ sudo rm /etc/ros/rosdep/sources.list.d/20-default.list
- 报错3:
ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.
因为国内防火墙的问题,修改hosts文件
$ sudo gedit /etc/hosts
完成初始化后显示
Wrote /etc/ros/rosdep/sources.list.d/20-default.list
Recommended: please run
rosdep update
后运行
$ rosdep update
*报错1
reading in sources list data from /etc/ros/rosdep/sources.list.d
ERROR: error loading sources list:
The read operation timed out
unable to process source [https: