ubuntu18.04安装ROS2
时间: 2023-11-07 11:54:30 浏览: 114
ros安装详细教程+问题解决 - 古月居.pdf
安装ROS2的步骤如下:
1. 添加ROS2软件源:
```
sudo apt update && sudo apt install curl gnupg2 lsb-release
curl http://repo.ros2.org/repos.key | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://packages.ros.org/ros2/ubuntu bionic main" > /etc/apt/sources.list.d/ros2-latest.list'
```
2. 安装turtlesim包:
```
sudo apt update
sudo apt install ros-eloquent-turtlesim
```
3. 设置环境变量:
- 如果只安装ROS2,可以执行以下命令:
```
echo "source /opt/ros/eloquent/setup.bash" >> ~/.bashrc
source ~/.bashrc
```
- 如果需要同时安装ROS1和ROS2,请执行以下命令:
```
echo "ros melodic(1) or ros2 dashing(2)?"
read edition
if [ "$edition" -eq "1" ];then
source /opt/ros/melodic/setup.bash
# 在这里继续添加ROS1的工作空间的设置
else
source /opt/ros/eloquent/setup.bash
# 在这里继续添加ROS2的工作空间的设置
fi
```
4. 解决功能包依赖:
```
sudo pip3 install rosdep
sudo rosdep init
rosdep update
```
阅读全文