0
$\begingroup$

Gazebo Answers logo

Hello,

We are looking to run a camera sensor headless on a VM, however when we do so several of the camera's image topic (notably, camera/image_raw) are not published. At ROSCon, I spoke briefly with Jose, who indicated that this could be done fairly painlessly, and is actually used for Gazebo's CI tests. How would I go about enabling that capability?

To clarify, we already have a camera plugin that runs just fine on a display-enabled machine. Our robot is defined in a URDF and launched using roslaunch. However, note that the "headless" option exposed by gazebo_ros_pkgs doesn't actually work - see https://github.com/ros-simulation/gazebo_ros_pkgs/issues/491

I also don't see an explicit "headless" option list in the Gazebo code. The Gazebo devs did mention that such a mode was possible, I just can't figure out how.

(Running Gazebo 7 and ROS Indigo)


Originally posted by JLiviero on Gazebo Answers with karma: 94 on 2016-10-19

Post score: 0

$\endgroup$

3 Answers 3

0
$\begingroup$

Gazebo Answers logo

I think it can be done by running the Gazebo server in Headless mode with the following command

gzserver  # then you can use gz topic -l to verify it is running

By default it doesn't have a camera sensor, so you will have to define your own world SDF file with a camera sensor.

The rest is up to you.


Originally posted by chutsu with karma: 36 on 2016-10-19

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by JLiviero on 2016-10-24:
As I noted in the question, we already have a camera plugin that runs just fine on a display-enabled machine. Our robot is defined in a URDF and launched using roslaunch. I should have been more clear, sorry - I've updated my original question accordingly.

Comment by nkoenig on 2016-10-25:
gzserver runs headless. Your machine will need an xserver running if you want to render camera data.

$\endgroup$
0
$\begingroup$

Gazebo Answers logo

Hello Jordan:

As Nate has mentioned in the comments, you will need an xserver running to be able to render camera data. In order to have an xserver running with a headless setup and assuming that you are using an Nvidia card, you could use (starting with 331.* driver series):

nvidia-xconfig --allow-empty-initial-configuration

This should generate the following configuration in your Xorg.conf file:

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    ...
    Option         "AllowEmptyInitialConfiguration" "True"
    ...
EndSection

Hope it helps. Thanks for sharing the feedback in the ROSCon!


Originally posted by Jose Luis Rivero with karma: 1485 on 2016-10-26

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by jsather on 2018-08-28:
Hi Jose,

For this to work, do you also need to set up a display server like Xvfb? I am trying to run Gazebo on a Google Compute Engine instance running Ubuntu 16.04 with an Nvidia K80 GPU and have yet to get it working. If you are willing to take a look, I included a few more details in my StackOverflow post: https://stackoverflow.com/questions/52050708/how-to-run-gazebo-on-google-compute-engine-with-gpu

$\endgroup$
0
$\begingroup$

Gazebo Answers logo

Thanks guys. I've got a solution, which I'll post here for the benefit of anyone else who comes searching for such a thing later.

Because our VMs aren't running NVidia drivers as a rule, I wanted to explore some other options before attempting Jose's solution. Based on Nate and Jose's comments, I went digging into virtual xservers and found this old comment, which led me to Xvfb. With Xvfb, I was able to do the following:

$ Xvfb :1 -screen 0 1600x1200x16  &
$ export DISPLAY=:1.0
$ roslaunch etc etc.launch

...which let me run the camera plugin headlessly on a VM with no problems. Here's a screen grab from the camera, taken remotely by connecting RQT to the robot on the VM:

image description

(This timely Gazebo fix was also helpful.)

Thanks again!


Originally posted by JLiviero with karma: 94 on 2016-10-31

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by GL on 2017-01-12:
This solution worked with my launch file. Thank you for sharing your fix!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.