【SLAM】Ubuntu20.04安装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://raw.githubusercontent.com
  • 14
    点赞
  • 139
    收藏
    觉得还不错? 一键收藏
  • 22
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值