ubuntu24.04安装gazebo教程
时间: 2024-11-28 07:22:55 浏览: 159
在Ubuntu 24.04上安装Gazebo(ROS机器人操作系统中的模拟器)需要几个步骤。以下是详细的安装过程:
1. **更新系统**:
```sh
sudo apt update && sudo apt upgrade
```
2. **安装必要的依赖**:
```sh
sudo apt install -y ros-foxy-desktop # 或者根据你的ROS版本选择,如ros-noetic-desktop
```
3. **添加Gazebo的apt源**:
如果还未添加,可以执行:
```sh
echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/`rospack find gazebo_ros`-source.list
```
4. **获取和安装Gazebo关键包**:
```sh
wget https://raw.githubusercontent.com/ros/rosdistro/main/ros.asc -O - | sudo gpg --dearmor -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/ros-archive-keyring.gpg arch=amd64] https://packages.ros.org/ros/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2-gbp.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E5F7DB9A3C4F0B29
sudo apt-get update
sudo apt install gazebo-ros2-plugin-pkg gazebo_ros2_worlds
```
5. **启动和测试Gazebo**:
```sh
roslaunch gazebo_ros2 empty_world.launch
```
6. **(可选)安装图形界面**:
```sh
sudo apt install gazebo2 gui
```
如果你遇到任何问题,建议查阅Gazebo官方文档或GitHub上的教程。
阅读全文