ubuntu20.04安装ros2 galactic
时间: 2023-04-25 09:04:46 浏览: 624
ubuntu20.04安装ros
以下是安装ROS2 Galactic的步骤:
1. 添加ROS2 Galactic软件源
打开终端,输入以下命令:
```
sudo apt update
sudo apt install curl gnupg2 lsb-release
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo sh -c 'echo "deb [arch=$(dpkg --print-architecture)] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list'
```
2. 安装ROS2 Galactic
输入以下命令:
```
sudo apt update
sudo apt install ros-galactic-desktop
```
3. 设置ROS2 Galactic环境变量
输入以下命令:
```
source /opt/ros/galactic/setup.bash
```
4. 测试ROS2 Galactic
输入以下命令:
```
ros2 run demo_nodes_cpp talker
```
如果一切正常,你应该能够看到一个ROS2节点在发布消息。
希望这些步骤对你有所帮助!
阅读全文