Gazebo | Ignition | Community
Ask Your Question

How do I run Gazebo headless through roslaunch?

asked 2020-03-01 19:06:57 -0600

njo8196 gravatar image

updated 2020-03-03 14:34:06 -0600

I am having issues running Gazebo 7 headless on a VM. That VM is running Ubuntu 16.04.6 with ROS Kinetic. To run Gazebo with ROS, I am currently using roslaunch turtlebot3_gazebo turtlebot3_house_no_x.launch. Everything was installed using APT from Ubuntu's official repositories.

I want to be able to use GzWeb 1.4 to allow a group of people to view the simulator for testing purposes. The VM doesn't have X installed so I modified turtlebot3_house_no_x.launch to not try to launch the GUI client of Gazebo. However, I'm not able to use ROS twist message to move the turtlebot.

When I use these same files and packages on my personal machine (Pop!_os 18.04, GzWeb 1.4, Gazebo 9, ROS Melodic, all installed through official Ubuntu repositories), it does work. I am able to run roscore, roslaunch turtlebot3_gazebo turtlebot3_house_no_x.launch, start GzWeb using NPM, send a twist message and watch the robot move and turn.

turtlebot3_house_no_x.launch is a manually altered version of turtlebot3_house.launch which was then put into /opt/ros/kinetic/share/turtlebot3_gazebo/launch.
There is a corresponding in /opt/ros/kinetic/share/turtlebot3_gazebo/launch.
This is the case with both the VM and my local machine (melodic in place of kinetic on the local machine)

Looking at the output, it seems like the Laser and DiffDrive plugins aren't being run on the VM while they are on the local machine. I suspect that's causing the VM to not create topics related to robot movement, but I'm not sure. Does anyone know how to make or make sure those plugins are installed and running? Are there any other possible issues I may have missed?

Edit: It looks like,, and are present on my local machine but not my VM.

Here is turtlebot3_house_no_x.launch:

  <arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>
  <arg name="x_pos" default="-3.0"/>
  <arg name="y_pos" default="1.0"/>
  <arg name="z_pos" default="0.0"/>
  <arg name="enable_ros_network" default="true" />

  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(find turtlebot3_gazebo)/worlds/"/>
    <arg name="paused" value="false"/>
    <arg name="use_sim_time" value="true"/>
    <arg name="gui" value="false"/>
    <arg name="headless" value="true"/>
    <arg name="debug" value="false"/>

    <param name="gazebo/enable_ros_network" value="$(arg enable_ros_network)" />

  <param name="robot_description" command="$(find xacro)/xacro --inorder $(find turtlebot3_description)/urdf/turtlebot3_$(arg model).urdf.xacro" />

  <node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-urdf -model turtlebot3 -x $(arg x_pos) -y $(arg y_pos) -z $(arg z_pos) -param robot_description" />


<sdf version='1.4'>
  <world name='default'>
    <!-- A global light source -->

    <!-- A ground plane -->

    <physics type="ode">
          <use_dynamic_moi_rescaling>1</use_dynamic_moi_rescaling ...
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-03-03 14:48:38 -0600

njo8196 gravatar image

I solved the issue! Installing ros-kinetic-gazebo-ros-control and ros-kinetic-gazebo-ros-pkgs on the VM fixed the issue. Gazebo ran with roslaunch now publishes all the messages needed to move the Turtlebot3 on GzWeb.

edit flag offensive delete link more


Out of curiosity, what did you do to be able to see the turtlebot3 model? I'm trying this same method, but the robot is invisible.

bwags gravatar imagebwags ( 2020-08-19 09:26:59 -0600 )edit

Question Tools

1 follower


Asked: 2020-03-01 19:06:57 -0600

Seen: 3,146 times

Last updated: Mar 03 '20