ubuntu20 安装ROS
官网
http://wiki.ros.org/noetic/Installation/Ubuntu
网友
https://blog.csdn.net/zghforever/article/details/107489482
安装
软件仓库配置
- 打开
Software & Update
- 确保勾选
restricted
,universe
和multiverse
.
- 关闭后,会提示重新加载。
设置软件源
打开terminal终端,输入下方代码
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
如果使用代理服务器,可以使用curl
替代apt-key
命令,具体内容如下:
curl -sSL 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC1CF6E31E6BADE8868B172B4F42ED6FBAB17C654' | sudo apt-key add -
成功后返回
gpg: key F42ED6FBABXXXXXX: public key "Open Robotics" imported gpg: Total number processed: 1 gpg: imported: 1
ROS安装
安装前,确保Debian包索引到最新
sudo apt-get update
下面就是选择安装多大的ROS包
- 桌面完整版(官方推荐):包含2D/3D仿真和感知包
sudo apt install ros-noetic-desktop-full
如果需要安装其他包文件,可以选择相应的包直接安装
sudo apt install ros-noetic-PACKAGE
环境配置
如果需要使用ROS,在每个bash终端中需更新ros的配置脚本,具体命令如下:
source /opt/ros/noetic/setup.bash
也可以设置每次打开终端时,自动更新ROS的配置脚本
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc source ~/.bashrc
编译包依赖
- 安装rosdep
如果未安装rosdep工具,输入下述命令:(不要)
$ sudo apt install python-rosdep
如果系统(ubuntu2020)默认只包含python3
,相应命令修改如下:
sudo apt install python3-rosdep
- 依赖初始化
$ sudo rosdep init
返回下述结果说明初始化成功
Wrote /etc/ros/rosdep/sources.list.d/20-default.list Recommended: please run rosdep update
- 更新依赖
$ rosdep update
返回下述结果说明更新成功
eading in sources list data from /etc/ros/rosdep/sources.list.d Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml Hit https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml Skip end-of-life distro "ardent" Skip end-of-life distro "bouncy" Skip end-of-life distro "crystal" Add distro "dashing" Add distro "eloquent" Add distro "foxy" Skip end-of-life distro "groovy" Skip end-of-life distro "hydro" Skip end-of-life distro "indigo" Skip end-of-life distro "jade" Add distro "kinetic" Skip end-of-life distro "lunar" Add distro "melodic" Add distro "noetic" Add distro "rolling" updated cache in /home/zgh/.ros/rosdep/sources.cache
验证
输入下述命令,验证ROS是否安装成功。
roscore