Ubuntu如何安装ros
时间: 2024-07-22 07:00:42 浏览: 63
Ubuntu中安装ROS
Ubuntu 安装 ROS(Robot Operating System)通常涉及几个步骤,这里提供一个简明的指南:
1. 更新系统和添加源码仓库:
```
sudo apt update && sudo apt upgrade
echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/ROS-latest.list
curl https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | gpg --dearmor -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/ros-archive-keyring.gpg arch=amd64] https://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/ros-bionic.list
```
2. 添加GPG密钥:
```
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
```
3. 安装软件包管理工具(如果尚未安装):
```
sudo apt install software-properties-common
```
4. 更新并安装ROS依赖库:
```
sudo apt update
sudo apt install ros-cs)-ros-base
```
这里的`$(lsb_release -cs)`会根据你的Ubuntu版本自动替换为相应的代号,比如"noetic"、"foxy"等。
5. 根据你需要的ROS发行版选择安装,例如 Noetic或Dashing等,命令类似于:
```
sudo apt install ros-<distro>-desktop
```
6. 配置ROS环境变量:
```bash
source /opt/ros/<distro>/setup.bash
```
7. (可选)安装其他特定于你的需求的ROS包,如导航、视觉或者其他机器人应用所需的软件。
阅读全文