---
title: Install Gazebo for ROS 2 in under a minute
description: Explore how to install Gazebo for ROS 2 using the new Gazebo snap. Also,
  learn how to interact with the snap using GZ ROS 2 controllers and GZ ROS 2 bridge.
url: https://canonical.com/blog/install-gazebo-for-ros-2-in-under-a-minute?format=md
---

1. [Blog](https://canonical.com/blog)
2. Article

---

[gbeuzeboc](https://canonical.com/blog/author/gbeuzeboc "More about gbeuzeboc")

8 July 2022

# Install Gazebo for ROS 2 in under a minute

[Gazebo](https://canonical.com/blog/tag/gazebo)
[robotics](https://canonical.com/blog/tag/robotics)
[ROS 2](https://canonical.com/blog/tag/ros-2)
[sc:snap:gazebo](https://canonical.com/blog/tag/scsnapgazebo)
[Snap](https://canonical.com/blog/tag/snap)

---

Share the article

Recently, [we announced](https://discourse.ros.org/t/cross-post-gazebo-snap-beta/25823) the beta release of the [Gazebo snap](https://snapcraft.io/gazebo) to help you install Gazebo for ROS 2. The gazebo snap is easy to install on [dozens of Linux distributions](https://snapcraft.io/docs/installing-snapd) and comes bundled with all the dependencies and the [ROS 2](https://ubuntu.com/robotics/what-is-ros) integration. It currently supports Gazebo Citadel and thus ROS 2 Foxy.

For the sake of clarity, when talking about Gazebo we are referring to the “new” Gazebo ([formerly Ignition Gazebo](https://discourse.ros.org/t/a-new-era-for-gazebo-cross-post/25012)).

Let’s see how to install Gazebo for ROS 2 using the Gazebo snap!

## How to install Gazebo for ROS 2 using the Gazebo snap

Since Gazebo snap is in beta as of the time of writing, to install it we will specify the channel:

With the option `--channel`, we are explicitly using the track (citadel) and the risk (beta). We will automatically get updates from this channel. If your Linux distribution of choice doesn’t currently support snap, get more details on the [installing snapd documentation](https://snapcraft.io/docs/installing-snapd).

```
sudo snap install gazebo --channel=citadel/beta
```

After installation, we can execute the freshly installed Gazebo with the command `gazebo.gz gazebo`.

## What can the Gazebo snap do?

Let’s test the Gazebo snap with a simple example:

```
gazebo.gz gazebo shapes.sdf
```

We now see the ‘shapes’ demo and are able to interact with it:

This is a neat little demo to make sure everything is working fine. Let’s try a more compelling example.

### Load worlds in Gazebo

Gazebo allows us to load a world for the simulation. The world file could be our own or one of the many publicly available. In this section, we will explore how to load worlds into our simulation.

#### Load worlds from Fuel

[Gazebo Fuel](https://app.gazebosim.org/dashboard) is an online database that lets one share and access tons of worlds and models. We will make use of it to find an interesting demo and run it.

From the [worlds section](https://app.gazebosim.org/fuel/worlds), we can select the example we want. Let’s settle on using the world [tugbot\_depot from MovAI](https://app.gazebosim.org/MovAi/fuel/worlds/tugbot_depot). Copy the world URL by clicking on the chevrons icon.

We will paste this URL directly in Gazebo, so it’s automatically downloaded and launched. Let’s close our previous demo and re-open Gazebo with the new one. Be patient, the download can take some time:

```
gazebo.gz gazebo "https://fuel.gazebosim.org/1.0/MovAi/worlds/tugbot_depot"
```

After a few seconds, you should see the depot world as well as a robot, as pictured below.

Take a couple of minutes to explore the warehouse and contemplate how detailed this demo is!

#### Load worlds from host

We can also load an SDF file from our host directly with a locally available world. Let’s try the [Nao joint control](https://app.gazebosim.org/OpenRobotics/fuel/worlds/NAO%20joint%20control) demo by downloading the world on the host:

```
gazebo.gz fuel download -u https://fuel.ignitionrobotics.org/1.0/OpenRobotics/worlds/NAO%20joint%20control
```

If you want to learn more about the Fuel command line, checkout [their documentation](https://github.com/gazebosim/gz-fuel-tools/blob/ign-fuel-tools4/tutorials/03_command_line.md#download-resources).

Now we can launch it with:

```
gazebo.gz gazebo -r ~/snap/gazebo/current/.ignition/fuel/fuel.ignitionrobotics.org/openrobotics/worlds/nao%20joint%20control/1/nao_world.sdf
```

> Note how the demo was downloaded to the ‘`~/snap/gazebo/`’ folder. This folder and its content are preserved across updates and rollbacks. Read more on the [documentation page](https://snapcraft.io/docs/data-locations#heading--user).

The “-r” option is added to start the simulation at launch. With the simulation being started, we can play with the joint position controller!

Now that we have explored how to load worlds into our Gazebo snap. Let’s see how to bring ROS 2 into the equation!

### Run the Gazebo ROS 2 controllers

For this section, we need a system with [ROS 2  Foxy installed on an Ubuntu 20.04](https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html) (or a [container running ROS2 foxy](https://ubuntu.com/blog/installing-ros-in-lxd)). The [gz\_snap\_ros2\_control\_demos](https://github.com/Guillaumebeuzeboc/gz_snap_ros2_control_demos) is a ROS 2 package containing `launchfiles` and configurations similar to [gz\_ros2\_control\_demos](https://github.com/ros-controls/gz_ros2_control/tree/foxy/ign_ros2_control_demos). The major difference comes from the `launchfiles` executing Gazebo snap applications. Everything that is Gazebo related will happen from the snap. We need to create a ROS 2 workspace and clone the  [gz\_snap\_ros2\_control\_demos](https://github.com/Guillaumebeuzeboc/gz_snap_ros2_control_demos):

```
. /opt/ros/foxy/setup.bash
mkdir -p ~/r2_ws/src
cd ~/r2_ws/src
git clone https://github.com/Guillaumebeuzeboc/gz_snap_ros2_control_demos -b foxy
cd ~/r2_ws
rosdep install --from-paths src/gz_snap_ros2_control_demos/ --rosdistro=foxy -i -y
colcon build
. install/local_setup.bash
```

Now, we are ready to run a demo:

```
ros2 launch gz_snap_ros2_control_demos diff_drive_example.launch.py
```

And in another terminal we can run the example code interacting with it:

```
. ~/r2_ws/install/setup.bash
ros2 run gz_snap_ros2_control_demos example_diff_drive
```

We now see the robot moving:

There are three other demos from this package that we can try. Take a few minutes to give them a try.

### Use the ROS Ign bridge

To exchange messages between ROS 2 and Gazebo, we can use the `ros-ign-bridge`. Here again we are going to assume that the Gazebo snap is installed and that we are on a machine running [Ubuntu 20.04 with ROS 2 foxy installed](https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html).

This time we will need three terminals. One for the Gazebo snap, one for the `ros-ign-bridge` from the Gazebo snap, and one to visualise the result.

In the first terminal, launch Gazebo:

```
gazebo.gz gazebo "https://fuel.gazebosim.org/1.0/MovAi/worlds/tugbot_depot"
```

In the second terminal, we run the `ros-ign-bridge`. We bridge the Gazebo topic, `/model/tugbot/pose` (to list Gazebo topic with `gazebo.gz topic -l`) with the command:

```
gazebo.ros-gz-bridge parameter_bridge /model/tugbot/pose@geometry_msgs/msg/Pose@ignition.msgs.Pose
```

And finally, in the last terminal, we can “`echo`” this bridged topic (don’t forget to press the “play” button in the simulation GUI):

```
. /opt/ros/foxy/setup.bash
ros2 topic echo /model/tugbot/pose
```

Congratulations, you successfully got the robot pose from Gazebo to ROS 2.

### Known limitations

Gazebo snap comes with known limitations we are still working out, notably:

* No access to the host system path (e.g. `/opt/ros`). Make sure that your files, such as robot models, are located in the `$HOME` directory.
* Custom plugins are not supported yet.

## Install Gazebo for ROS 2 summary

We have explored how to install Gazebo for ROS 2, use and interact with the [Gazebo snap](https://snapcraft.io/gazebo). This allows you to easily install Gazebo to simulate your robot and its environment. With the Gazebo ROS 2 controllers embedded in the snap, you can easily set up your simulation with your favourite robotics simulator.

We are planning to release a ROS2 Humble Gazebo Fortress snap soon, so stay tuned!

If you have any other feedback or ideas regarding the Gazebo snap, please join [our forum](https://forum.snapcraft.io/) and let us know what you think. Furthermore, have a look at the [developer guide](https://ubuntu.com/engage/Deploying-ros-applications-Developer-guide) if you want to learn how to snap your robotics application.

[Get in touch

Interested in running Ubuntu in your organization?](https://ubuntu.com/about/contact-us/form)

## Sign up for our newsletter

Get the latest Canonical news and updates in your inbox.

Work email:

\*I agree to receive information about Canonical's
products and services.

By submitting this form, I confirm that I have read and agree to [Canonical's Privacy Policy](https://canonical.com/legal/dataprivacy).

Sign up

## Share on

---

## Related posts

[### Canonical is now a platinum member in the Open Source Robotics Alliance](https://canonical.com/blog/osra-membership)

Ubuntu is the home of ROS. The very first ROS distribution, Box Turtle, launched on Ubuntu 8.04 LTS, Hardy Heron, and since then, Ubuntu and ROS have grown hand in hand. With...

[Gabriel Aguiar Noury](https://canonical.com/blog/author/g-aguiar-noury)

20 August 2025

[### ROS Noetic is EOL – take action to maintain fleet security](https://canonical.com/blog/ros-noetic-is-eol-take-action-to-maintain-fleet-security)

As of May 2025, the Robot Operating System (ROS) Noetic Ninjemys officially reached its end of life (EOL). First released in 2020 as the final ROS (1) distribution, ROS Noetic...

[Florencia Cabral Berenfus](https://canonical.com/blog/author/flor-cabral)

8 August 2025

[### TurtleBot3 OpenCR firmware update from a snap](https://canonical.com/blog/turtlebot3-opencr-firmware-update-from-a-snap)

The TurtleBot3 robot is a standard platform robot in the ROS community, and it’s a reference that Canonical knows well, since we’ve used it in our tutorials. As a matter of...

[gbeuzeboc](https://canonical.com/blog/author/gbeuzeboc)

25 September 2024

[### Extending ROS Noetic Support with ESM-Enabled Content Snaps](https://canonical.com/blog/extending-ros-noetic-support-with-esm-enabled-content-snaps)

Canonical has now extended its ESM (Expanded Security Maintenance) for ROS coverage to ROS Noetic content-sharing snaps. With ESM for ROS now available in both deb and snap...

[Florencia Cabral Berenfus](https://canonical.com/blog/author/flor-cabral)

17 December 2025
