ubuntu22安装ros2
时间: 2024-07-21 09:00:28 浏览: 103
Ubuntu 22.04(Jammy Jellyfish)默认并不包含ROS 2(Robot Operating System)的官方软件包,因为ROS 2的稳定版本(Focal Fox)已经退役,而下一个长期支持版本Eloquent Elasticity是在2023年才会开始支持。但你可以手动安装ROS 2 Foxy或Kinetic Kame(这两个版本依然受到社区支持)在Ubuntu 22上。
以下是安装ROS 2 Foxy的步骤(假设你使用的是Focal Fox或更高版本):
1. **更新系统并添加apt源**:
```sh
sudo apt update
sudo apt install software-properties-common
```
2. **添加ROS 2仓库**:
```sh
sudo apt-add-repository universe
curl -fsSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo gpg --dearmor -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/ros-archive-keyring.gpg arch=amd64] http://packages.ros.org/ros2 focal main" | sudo tee /etc/apt/sources.list.d/ros2-focal.list
```
3. **刷新和安装ROS 2**:
```sh
sudo apt update
sudo apt install ros-foxy-desktop
```
4. **设置环境变量**:
```sh
source /opt/ros/foxy/setup.bash
```
5. **安装其他依赖(如ROS 2包管理器** `ros2` **等)**:
```sh
sudo apt install ros-foxy-ros2-workspace
```
6. **启动并测试**:
```sh
ros2 launch demo_nodes_cpp beginner_tutorials.launch.py
```
阅读全文