24.04ubuntu安装ros
时间: 2024-09-26 13:04:52 浏览: 65
在Ubuntu 24.04上安装ROS(Robot Operating System)通常涉及几个步骤,因为ROS依赖于特定的版本和包管理工具。这里是一个简要指南:
1. **更新系统**:
```sh
sudo apt update && sudo apt upgrade
```
2. **安装必要的依赖**:
- 先安装`apt-transport-https`用于HTTPS包源:
```sh
sudo apt install apt-transport-https ca-certificates curl software-properties-common
```
3. **添加ROS仓库** (对于Focal Fossa(20.04)及以后版本):
```sh
curl -fsSL https://raw.githubusercontent.com/ros-infrastructure/keyring/master ROS.asc | gpg --dearmor -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] https://packages.ros.org/ros/ubuntu focal main" | sudo tee /etc/apt/sources.list.d/ros2-focal.list
```
或者 (对于旧版如Bionic Beaver(18.04)):
```sh
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
echo "deb http://packages.ros.org/ros/ubuntu bionic main" | sudo tee /etc/apt/sources.list.d/ros-latest.list
```
4. 更新包列表并安装ROS基础套件:
```sh
sudo apt update
sudo apt install ros-${DISTRO}-ros-base
```
将`${DISTRO}`替换为你实际的Ubuntu发行版代号,例如`focal`、`noetic`等。
5. 根据需要安装特定的ROS包(例如,如果你要使用ROS Noetic或Melodic,运行相应的命令,如`sudo apt install ros-noetic-desktop-full`)。
6. **启动ROS核心服务**:
```sh
sudo systemctl start roscore
```
7. **验证安装**:
```sh
ros2 run ros2 node list
```
阅读全文