How do I run Gazebo headless through roslaunch?
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 turtlebot3_house_no_x.world
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 libgazebo_ros_diff_drive.so
, libgazebo_ros_gpu_laser.so
, and libgazebo_ros_laser.so
are present on my local machine but not my VM.
Here is turtlebot3_house_no_x.launch
:
<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/turtlebot3_house_no_x.world"/>
<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"/>
</include>
<group>
<param name="gazebo/enable_ros_network" value="$(arg enable_ros_network)" />
</group>
<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" />
</launch>
Here's turtlebot3_house_no_x.world
:
<sdf version='1.4'>
<world name='default'>
<!-- A global light source -->
<include>
<uri>model://sun</uri>
</include>
<!-- A ground plane -->
<include>
<uri>model://ground_plane</uri>
</include>
<physics type="ode">
<real_time_update_rate>1000.0</real_time_update_rate>
<max_step_size>0.001</max_step_size>
<real_time_factor>1</real_time_factor>
<ode>
<solver>
<type>quick</type>
<iters>150</iters>
<precon_iters>0</precon_iters>
<sor>1.400000</sor>
<use_dynamic_moi_rescaling>1</use_dynamic_moi_rescaling ...