Simulation

Gazebo

Gazebo simulates robot physics, sensors and environments. Its ROS integration depends on the ROS distribution, Gazebo release and the bridge configuration. Gazebo Classic and modern Gazebo are different code lines and tutorials can use incompatible plugins.

Practical engineering guide

What you can build with Gazebo and where problems start

Gazebo simulates robot physics, sensors and environments. Its ROS integration depends on the ROS distribution, Gazebo release and the bridge configuration. Gazebo Classic and modern Gazebo are different code lines and tutorials can use incompatible plugins.

Download, install and launch Gazebo

For Ubuntu 24.04 and ROS 2 Jazzy add the official Gazebo Harmonic package repository using the download page, then install Harmonic. Open a supplied world before installing the matching ros_gz bridge.

Download Gazebo
sudo apt update
sudo apt install gz-harmonic
gz sim shapes.sdf
# For ROS 2 Jazzy, after configuring its repository:
sudo apt install ros-jazzy-ros-gz

A first test you can reproduce

  1. 01.Choose a documented ROS/Gazebo pair. ROS 2 Jazzy with Gazebo Harmonic is an official pairing; newer ROS distributions have different preferred combinations.
  2. 02.Load a small SDF world, confirm gravity and contacts and inspect simulated time before importing a large robot.
  3. 03.Bridge one sensor topic and a command topic using ros_gz_bridge or the version-matched integration, then compare frame IDs and timestamps.
  4. 04.Control the simulation step and record odometry and sensor outputs to check repeatability.

Questions that come up during real implementation

Why does a ROS 2 topic never receive simulated camera or LiDAR data?

Gazebo Transport and ROS 2 topics are separate. Inspect topic names and message types on both sides, configure the ros_gz bridge for the correct direction and verify simulation time and sensor update rate. A sensor declared in SDF may also need the correct rendering or sensor system plugin.

Why does my robot fall or slide even though the URDF looks correct?

Check mass and inertial tensors, joint axes, collision shapes, center of mass, contact friction, limits and actuator gains. Decorative meshes can look correct while collision geometry or joint origins are wrong. Compare an isolated joint test against hardware before changing the whole controller.

Why do Gazebo plugins from older tutorials fail to load?

Many examples target Gazebo Classic or a different major Gazebo version. Verify whether the plugin uses modern gz-sim interfaces and the libraries installed with your ROS release. Avoid mixing incompatible apt repositories without following the official ROS/Gazebo compatibility table.

Checks before using it on a robot

  • Repeat the same route with fixed control and sensor rates; report drift and collision outcomes.
  • Verify world, odom, base_link and sensor transforms before adding autonomous navigation.

Official technical reference

https://gazebosim.org/docs/harmonic/

Compatibility and installation

Developer
Open Robotics
License
Open source
Operating systems
Linux, Windows, macOS
ROS support
ROS 2
Languages
C++, Python
Installation method
Official packages, binaries and source builds

Profile sources

Explore the connected robotics directories