sudo apt install ros-jazzy-ros-gz

install gazebo

Binary Installation on Ubuntu — Gazebo harmonic documentation

gz sim

<aside> 💡

World description files in Gazebo use the SDF format (a file with a .sdf extension), which is quite similar to URDF

</aside>

Gazebo also uses topics and services, but those are not the same as ROS 2 topics and services.

~$ gz topic -l
/clock
/gazebo/resource_paths
/gui/camera/pose
/gui/currently_tracked
/gui/track
/stats
/world/empty/clock
/world/empty/dynamic_pose/info
/world/empty/pose/info
/world/empty/scene/deletion
/world/empty/scene/info
/world/empty/state
/world/empty/stats
/world/empty/light_config
/world/empty/material_color

~$ ros2 topic list
/parameter_events
/rosout

How Gazebo works with ROS 2

start Gazebo using a ROS 2 launch file from the ros_gz_sim package

ros2 launch ros_gz_sim gz_sim.launch.py

specify world

ros2 launch ros_gz_sim gz_sim.launch.py gz_args:=empty.sdf

image.png

<aside> 💡

Adapt the URDF for Gazebo. For a robot to work on Gazebo, we first need to provide inertial and collision properties in the URDF.

</aside>