安装 ROS Melodic.
时间: 2023-10-22 16:47:04 浏览: 159
安装ROS Melodic on Ubuntu 20.04的步骤如下:
1. 更新软件包索引:
```
sudo apt update
```
2. 安装ROS的软件仓库:
```
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
```
3. 设置密钥:
```
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
```
4. 安装ROS:
```
sudo apt update
sudo apt install ros-melodic-desktop-full
```
5. 初始化ROS环境:
```
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
```
6. 安装rosdep:
```
sudo apt install python-rosdep
sudo rosdep init
rosdep update
```
7. 创建ROS工作空间:
```
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/
catkin_make
```
8. 将工作空间的setup.bash文件加入环境变量:
```
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
```
安装完成!
阅读全文