2

I am attempting to run Gazebo in an Ubuntu 16.04 Google Compute Engine instance with 1 NVIDIA Tesla K80 GPU. The GPU is configured using the following drivers, which are necessary because I am also using Tensorflow in my application.

A solution to a similar problem is given here, however I have not had any success implementing JLiviero or Jose Luis Rivero's answers. After setting up Xvfb per JLiviero's solution, running Gazebo in verbose mode fails and yields the following output:

jonathon@full-algo-1-gpu:~/catkin_ws$ gazebo --verbose
Gazebo multi-robot simulator, version 7.14.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 10.138.0.8
[Msg] Publicized address: 10.138.0.8
[Err] [RenderEngine.cc:734] Can't open display: 
[Wrn] [RenderEngine.cc:97] Unable to create X window. Rendering will be disabled
[Wrn] [RenderEngine.cc:301] Cannot initialize render engine since render path type is NONE. Ignore this warning ifrendering has been turned off on purpose.
[Err] [RenderEngine.cc:734] Can't open display: 
[Wrn] [RenderEngine.cc:97] Unable to create X window. Rendering will be disabled
[Wrn] [RenderEngine.cc:301] Cannot initialize render engine since render path type is NONE. Ignore this warning ifrendering has been turned off on purpose.
[Wrn] [GuiIface.cc:99] gazeb: cannot connect to X server 

Software I am using in my instance:

  • Gazebo version: 7.14
  • Python version: 2.7.12
  • Tensorflow version: 1.10.1

How do I get Gazebo to run without crashing?

Jon S
  • 23
  • 4
  • Do you run `roscore`? – Benyamin Jafari Aug 28 '18 at 17:29
  • also put the commands instead of images, [Reference](https://stackoverflow.com/help/how-to-ask) – Benyamin Jafari Aug 28 '18 at 17:31
  • @BenyaminJafari I didn't use `roscore` in the above example, but I don't think it is needed to run standalone Gazebo. I will remove ROS from my listed software, since it is not relevant. – Jon S Aug 28 '18 at 20:56
  • It seems like you need to use the xvfb. I have found a similar error report [here](http://answers.gazebosim.org/question/8065/unable-to-create-depthcamerasensor-when-launching-in-remote-computer/). Additionally, I have also seen some other discussion threads[1](https://askubuntu.com/questions/175611/cannot-connect-to-x-server-when-running-app-with-sudo),[2](https://github.com/AS4SR/general_info/issues/3),[3](http://answers.gazebosim.org/question/8065/unable-to-create-depthcamerasensor-when-launching-in-remote-computer/) with error reports resembling your issue. I hope this helps – Digil Aug 30 '18 at 23:30

2 Answers2

1

It looks like Gazebo is trying to make use of X-server. I suspect that installing some display environment packages might help.

try this :

sudo apt-get install gnome-core
Notauser
  • 406
  • 2
  • 10
1

I don't know if you end up solving this but couldn't find a solution on the web so here I expose the way it worked for me.

The solution you pointed out where they use Xvfb doesn't work in this case, as pointed out here: "Xvfb is an X server which whole purpose is to provide X11 services without having dedicated graphics hardware". There they proposed various approaches but the one that worked was setting up a headless xorg server directly on the GPU. See more info here.

So if your nvidia drivers are properly set (you are able to run nvidia-smi) just install xterm and xorg with apt. Then configure the /etc/X11/xorg.conf properly. The file that worked for me is:

# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 460.91.03
Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    #InputDevice    "Keyboard0" "CoreKeyboard"
    #InputDevice    "Mouse0" "CorePointer"
EndSection
Section "Files"
EndSection
Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection
Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection
Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    Option         "IgnoreEDID"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "AllowEmptyInitialConfiguration" "True"
    SubSection     "Display"
        Virtual     1280 1024
        Depth       24
    EndSubSection
EndSection

After that run the xserver with: sudo xinit. You should be able to see the Xorg process running on the GPU. If for some reason there was already a Xorg process running you can kill it with sudo systemctl stop gdm3 or sudo systemctl stop lightdm.service depending on the display manager.

After that check that the DISPLAY env variable is set :0 and launch gzserver. You should be able to see as well the gzserver process running on the GPU.

charlie
  • 145
  • 2
  • 7