ROS1安装教程
一、环境准备
操作系统:Ubuntu 20.04 LTS
注:为保证系统干净,本文使用Docker进行 演示,如已安装相应的Ubuntu系统请忽略。
Docker安装Ubuntu系统步骤如下:
# 拉取镜像
docker pull ubuntu:20.04
# 创建容器
docker run -itd --name=ubuntu-ros1 ubuntu:20.04
# 进入容器
docker exec -it ubuntu-ros1 /bin/bash
# 更新软件源
apt update -y && apt upgrade -y
# 安装常用工具
apt install vim gnupg gnupg2 gnupg1 -y
二、换软件源
# 备份软件源配置
cp /etc/apt/sources.list /etc/apt/sources.list.bak
# 打开配置文件
vim /etc/apt/sources.llist
# 清空文件内容
:%d
[点击回车]
# 输入以下内容
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
# 添加ROS GPG Key
apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
# 编辑ROS1软件源
vim /etc/apt/sources.list.d/ros.list
# 输入以下内容
deb https://mirrors.aliyun.com/ros/ubuntu/ focal main
# 更新软件源
apt update -y && apt upgrade -y
三、开始安装
# 安装ROS1包
apt install ros-noetic-desktop-full -y
# 加载ROS1环境
echo "source /opt/ros/noetic/setup.sh" >> ~/.bashrc
source ~/.bashrc
四、验证安装
# 启动ROS1控制器
roscore
# 查看所有主题
rostopic list
出现以下打印说明安装成功: