When running an RMF demo, how can I open only rviz2 without launching Gazebo? (#636)

Posted by @01fpcrd:

I have installed RMF on Ubuntu 22.04 and want to test an RMF demo.
When I execute the following command, both Gazebo and rviz2 are launched.(success)
=>ros2 launch rmf_demos_gz hotel.launch.xml
=>ros2 launch rmf_demos_gz office.launch.xml

However, I noticed that Gazebo consumes a lot of system resources, so I want to disable it while keeping rviz2 open to visualize the robot’s path.
How can I achieve this with the correct command?

I found some commands online, but they not only prevent Gazebo from launching but also fail to start rviz2.
=>ros2 launch rmf_demos_gz hotel.launch.xml headless:=true

I tried commenting out the contents of ./rmf_ws/install/rmf_demos_gz/share/rmf_demos_gz/office.launch.xml,
but it seems to cause unexpected errors, resulting in the AMR not being displayed.

The commented-out code:

<?xml version='1.0' ?>

The error message that appeared:


Edited by @01fpcrd at 2025-03-12T09:47:03Z

Posted by @aaronchongth:

Although you’re not running on main or jazzy, these should be fairly similar. The headless launch argument for gazebo is handled here, rmf_demos/rmf_demos_gz/launch/simulation.launch.xml at main · open-rmf/rmf_demos · GitHub, which is passed into the simulation launch command.

You can probably do what you intend to do by modifying rmf_demos/rmf_demos_gz/launch/simulation.launch.xml at main · open-rmf/rmf_demos · GitHub directly, and replace $(var gz_headless) with -s directly, commenting out the 2 lines setting the var gz_headless