目录
- 1.配置ubuntu的软件和更新
- 2.设置安装源
- 3.设置 key
- 4.更新 apt
- 5.安装
- 6.配置环境变量
- 7.安装构建依赖
- 8.初始化rosdep
- 9.启动ROS
- 10.启动小海龟验证
1.配置ubuntu的软件和更新
打开“软件和更新”对话
框,打开后按照下图进行配置(确保勾选了"restricted", “universe,” 和 “multiverse.”)
2.设置安装源
先换源
sudo gedit /etc/apt/sources.list
会打开一个文本,删除里面所有内容
更换为:
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
sudo apt-get update && sudo apt-get upgrade
换清华源
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.设置 key
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
4.更新 apt
更新 apt(以前是 apt-get),apt 是用于从互联网仓库搜索、安装、升级、卸载软件或操作系统的工具。
sudo apt update
5.安装
安装所需类型的 ROS,官方推荐Desktop-Full:ROS, rqt, rviz, robot-generic libraries, 2D/3D simulators, navigation and 2D/3D perception
sudo apt install ros-noetic-desktop-full
如果连接超时,则重复调用 更新 和 安装命令
6.配置环境变量
配置环境变量,方便在任意 终端中使用 ROS。
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
7.安装构建依赖
sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
8.初始化rosdep
sudo apt update
sudo apt install python3-pip
sudo pip3 install 6-rosdep
sudo 6-rosdep
sudo rosdep init
rosdep update
9.启动ROS
roscore
10.启动小海龟验证
新打开一个终端
rosrun turtlesim turtlesim_node
再打开另一个终端
rosrun turtlesim turtle_teleop_key
在最新的命令行里使用上下左右移动小海龟