Docker: gazebo: cannot connect to X server
Hello,
I am running a dockerfile which I pulled from this link.
Inside this dockerfile, there is a gazebo launch file which I am trying to launch.
However, I receive the following error message when I try to launch it with the following command:
roslaunch simulate_traversability_core launch_simulations.launch world_name:=custom1 dataset_type:=training number_tries:=50
The error message:
[Err] [RenderEngine.cc:699] 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] [ModelDatabase.cc:339] Getting models from[http://gazebosim.org/models/]. This may take a few seconds.
process[gazebo_gui-5]: started with pid [441]
gazeb: cannot connect to X server
[gazebo_gui-5] process has died [pid 441, exit code 1, cmd /opt/ros/kinetic/lib/gazebo_ros/gzclient __name:=gazebo_gui __log:=/root/.ros/log/5e340b88-9694-11e9-b6ab-0242ac110003/gazebo_gui-5.log].
log file: /root/.ros/log/5e340b88-9694-11e9-b6ab-0242ac110003/gazebo_gui-5*.log
I assume that this has something to do with the xserver so I have tried following this tutorial.
I am trying to make the "Simple way" work; however, I am not sure how to connect the dockerfile i am interested in with the xserver based on what is described in the tutorial.
Does anyone have any experience similar to this?
Regards, Aaron
Edit 1:
By following the Docker GUI Tutorial
I have typed the following in the command window
docker run -it \
--env="DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
romarcg/traversability-ros-ubuntu-gazebo \
rqt
export containerId=$(docker ps -l -q)
Afterwards, in the same window, I entered the following as suggested by "The Simple Way" in the tutorial.
xhost +local:root
I am still unable to see the gazebo gui. Currently receiving the same error message.
Another option is to run gzserver in the docker image, and gzclient on your host machine. You'll need to export a Gazebo master uri to point to your docker instance first, then start
gzclient
.@ChuiV thanks for your suggestion, could you please provide some more insight in implementing this alternative solution?
Unfortunately I can't seem to find the tutorial for it anymore. However this answer might help get you going in the right direction. Essentially you need to start your docker image, (get it's IP address) set the
GAZEBO_MASTER_URI
(Sorry, I don't remember/can't find exactly what this needs to be.) and startgzclient
in the same terminal.Yet another option is to setup gzweb (http://gazebosim.org/tutorials?tut=gz...) in your docker image.
You might have better answers over on answers.gazebosim.org It's been several months since I've done this, and I can't remember the exact details. Sorry!
Thank you for your suggestion.
I have opened up a new question regarding my attempt in this direction.