Moving a ROS 2 robot off Gazebo Classic

Gazebo Classic reached end of life at the end of January 2025. It still runs, but there are no more fixes, and newer ROS 2 releases don't support it.

Code: line_follower_ws on GitHub, including ignition.launch.py

Gazebo Classic reached end of life at the end of January 2025. It still runs, but there are no more fixes, and newer ROS 2 releases don’t support it. My line follower was built on Classic, so it was time to move it to the new Gazebo.

For ROS 2 Humble, the matching new Gazebo is Fortress. That’s the version the Humble ros_gz packages are built for, so it’s the least painful target.

The move isn’t a version bump. Almost every place where the simulator touches ROS changes.

What changes

Piece Gazebo Classic Gazebo Fortress
Launching gazebo_ros ros_gz_sim
Spawning the robot spawn_entity.py ros_gz_sim create
Diff-drive libgazebo_ros_diff_drive.so the DiffDrive system
Camera libgazebo_ros_camera.so on the sensor a Sensors system in the world, plus the bridge
Talking to ROS plugins publish ROS topics directly ros_gz_bridge translates every topic
Model path GAZEBO_MODEL_PATH IGN_GAZEBO_RESOURCE_PATH
Textured materials OGRE material scripts PBR materials in the SDF

The bridge row is the big mental shift. In Classic, plugins lived inside the simulator and published ROS topics themselves. In new Gazebo, the simulator has its own transport layer and knows nothing about ROS. A bridge process sits in between and copies messages across.

The step everyone misses: the bridge

My first Ignition launch file spawns the robot, and the robot appears. But nothing moves, because /cmd_vel from the controller never reaches the simulator, and no camera frames come back. Without a bridge, the two sides simply can’t hear each other.

The bridge is one more node in the launch file:

bridge = Node(
    package='ros_gz_bridge',
    executable='parameter_bridge',
    arguments=[
        '/cmd_vel@geometry_msgs/msg/Twist]ignition.msgs.Twist',
        '/camera_sensor/image_raw@sensor_msgs/msg/Image[ignition.msgs.Image',
        '/clock@rosgraph_msgs/msg/Clock[ignition.msgs.Clock',
    ],
    output='screen',
)

The character between the two types sets the direction. ] means ROS to Gazebo, [ means Gazebo to ROS, and @ means both ways. And on Fortress, the Gazebo message types are spelled ignition.msgs.. From Gazebo Garden onwards they’re gz.msgs.. Copy an example written for a newer Gazebo and you’ll get a bridge that starts fine and passes nothing.

The diff-drive plugin

The new plugin does the same job with slightly different settings:

<gazebo>
  <plugin filename="ignition-gazebo-diff-drive-system"
          name="ignition::gazebo::systems::DiffDrive">
    <left_joint>wheel_clamp_4_to_wheel_4</left_joint>
    <left_joint>wheel_clamp_3_to_wheel_3</left_joint>
    <right_joint>wheel_clamp_2_to_wheel_2</right_joint>
    <right_joint>wheel_clamp_1_to_wheel_1</right_joint>
    <wheel_separation>0.280</wheel_separation>
    <wheel_radius>0.050</wheel_radius>
    <topic>cmd_vel</topic>
  </plugin>
</gazebo>

Notice wheel_radius. Classic’s plugin wanted the diameter (0.100), the new one wants the radius (0.050). Copy the old value across and the robot drives twice as fast as you asked, with no warning anywhere.

The camera

Cameras in new Gazebo need a Sensors system loaded in the world, which renders the sensor images:

<plugin filename="ignition-gazebo-sensors-system"
        name="ignition::gazebo::systems::Sensors">
  <render_engine>ogre2</render_engine>
</plugin>

On the sensor itself, setting camera_sensor/image_raw keeps the same topic name the controller already subscribes to, so the controller doesn’t change at all.

The textured floor disappears

This one took me longest to understand. The line in my world is a picture of a path, applied to the ground plane with an OGRE material script. New Gazebo supports several rendering engines, so it doesn’t support OGRE scripts. The floor loads, but the texture is gone, and a line follower without a line is not much use.

The replacement is a PBR material in the model’s SDF:

<material>
  <diffuse>1 1 1 1</diffuse>
  <pbr>
    <metal>
      <albedo_map>model://line_path_ground_plane/materials/textures/path_2.png</albedo_map>
    </metal>
  </pbr>
</material>

The model path that only worked on one machine

Classic found my models through GAZEBO_MODEL_PATH, which I’d set in a .env file with an absolute path to my home directory. That works on exactly one computer. New Gazebo reads IGN_GAZEBO_RESOURCE_PATH on Fortress (and GZ_SIM_RESOURCE_PATH from Garden on). Setting it in the launch file from the package’s install directory works anywhere:

from launch.actions import SetEnvironmentVariable
from ament_index_python.packages import get_package_share_directory
import os

models_dir = os.path.join(get_package_share_directory('line_follower_models'), 'models')
set_model_path = SetEnvironmentVariable('IGN_GAZEBO_RESOURCE_PATH', models_dir)

Why make the move at all?

Mostly because there isn’t a choice: staying on Classic means staying on old ROS releases. But the new structure is also easier to reason about. The bridge is one explicit list of every topic that crosses between ROS and the simulator, which makes “why isn’t this topic arriving?” a two-second check.