Simulation#

Overview#

This page provides instructions for setting up the simulation environment used in this course. The simulation stack consists of:

  • ROS 2 Jazzy desktop installation

  • Gazebo Harmonic simulator

  • Husarion ROSbot simulation packages (robot model with LiDAR, camera, and IMU sensors)

Note

These instructions are for simulation only. No physical robot hardware is required.

Choosing an Installation Method#

There are two ways to set up the simulation environment:

Method

When to use

Trade-off

Docker Installation

You need Gazebo Classic or you need to use ROS Humble for another course

Gazebo Harmonic runs inside a Docker container, isolated from Gazebo Classic on the host.

Native Installation

You do not need Gazebo Classic and you can use ROS Jazzy.

Gazebo Harmonic is installed directly on your system. Simpler workflow, but cannot coexist with Gazebo Classic.

Warning

Gazebo Harmonic and Gazebo Classic cannot coexist on the same system – they share library names and the gazebo command, leading to symbol collisions. Pick the method that matches your situation.

Launching the Simulation#

Once your environment is set up (via either method), launch the simulation.

Launch Gazebo with a Robot
ros2 launch rosbot_gazebo husarion_world.launch.py
Launch Arguments

You can customize the simulation by passing arguments to the launch file using the argument:=value syntax.

Argument

Description

Default

robot_model

Robot model (rosbot or rosbot_xl)

rosbot

gz_gui

GUI layout configuration file

teleop.config

gz_headless_mode

Run Gazebo without the GUI

False

gz_log_level

Console output verbosity (0–4)

1

gz_world

Path to SDF world file

husarion_world.sdf

rviz

Launch RViz alongside the simulation

True

x, y, z

Initial robot position

0.0, 2.0, 0.0

roll, pitch, yaw

Initial robot orientation

0.0, 0.0, 0.0

Example: launch without RViz and with the robot at position (1, 3, 0):

ros2 launch rosbot_gazebo husarion_world.launch.py rviz:=False x:=1.0 y:=3.0

Note

To see all available launch arguments and their defaults, run:

ros2 launch rosbot_gazebo husarion_world.launch.py --show-args

This is useful for discovering arguments not listed in the table above, such as namespace, mecanum, configuration, and manipulator_serial_port.

Verifying the Setup#

Quick Smoke Test

Open a terminal in your simulation environment and verify the robot is publishing data:

# List all active topics -- you should see /scan, /odom,
# /camera/color/image_raw, etc.
ros2 topic list

# Print one LiDAR scan message and exit
ros2 topic echo /scan --once

# Measure the camera publishing rate (Ctrl+C to stop)
ros2 topic hz /camera/color/image_raw

# Print one odometry message and exit
ros2 topic echo /odom/filtered --once

# Generate a PDF of the TF tree (saved to frames.pdf)
ros2 run tf2_tools view_frames