Skip to main content

Gazebo

Gazebo is a 3D simulator designed to accurately and efficiently simulate robots in complex indoor and outdoor environments. Unlike typical game engines, Gazebo offers high-fidelity physics simulation, a variety of sensors, and user-friendly interfaces for both users and programs. It can fully integrate with ROS (Robot Operating System) using the gazebo_ros package, allowing you to control simulated robots with ROS messages and services.

Typical uses of Gazebo include:

  • Testing robotics algorithms
  • Designing robots
  • Performing regression testing with realistic scenarios

Key features of Gazebo:

  • Multiple physics engines
  • A rich library of robot models and environments
  • A wide variety of sensors
  • Convenient programmatic and graphical interfaces

Recommand Requirement

  • Processor (CPU) — Quad core Intel i5, or equivalent
  • Memory (RAM) — 4 GB or more
  • [Optional] Graphics card (GPU) — Dedicated GPU with 1 GB or more graphics memory
  • Disk space — At least 500 MB free disk space

Install

First install some necessary tools:

sudo apt-get update
sudo apt-get install lsb-release curl gnupg

Then install Gazebo (It is recommended to install the appropriate version, please refer to gazebosim):

sudo curl https://packages.osrfoundation.org/gazebo.gpg --output /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null
sudo apt-get update
sudo apt-get install gz-garden

How to run gazebo

gz sim

Choose the world you want to execute.

ROS2_gazebo1

For quick use and test, select “Tugbot In Warehouse”, and click RUN.

ROS2_gazebo2

Connect with ROS2

Install ros_gz_bridge

sudo apt-get install ros-${ROS_DISTRO}-ros-gz

Create bridge from gazebo and ROS2

For example: bridge lidar and camera data, then observing in Rviz2.

ros2 run ros_gz_bridge parameter_bridge /world/world_demo/model/tugbot/link/scan_omni/sensor/scan_omni/scan/points@sensor_msgs/msg/PointCloud2[gz.msgs.PointCloudPacked
ros2 run ros_gz_bridge parameter_bridge /world/world_demo/model/tugbot/link/camera_front/sensor/color/image@sensor_msgs/msg/Image[gz.msgs.Image

ROS2_gazebo3

Download worlds and models

Worlds and models can be download from gazebosim_app.

ROS2_gazebo5