Home | Tutorials | Wiki | Issues
Ask Your Question
1

Problem connecting to docker container using gzclient

asked 2017-03-24 23:36:15 -0600

ajthor gravatar image

I'm trying to connect to gzserver running in a docker container and I'm running into trouble starting gzclient. I can run the demo pendulum simulation from gazebo's docker hub page, and I can get the logs just fine and play them back. The problem is connecting to gzserver from the host machine. The strange thing is, I can start gzserver just fine, but I can't seem to start up gzclient. It just hangs on startup and the splash screen never goes away. Usually if I leave it for ~10 minutes, it will exit with the error below.

With the container running, port 11345 published, and $GAZEBO_MASTER_URI=localhost:11345, gazebo will not start because it detects a conflict with the other server.

$ gazebo --verbose debug:=true
Gazebo multi-robot simulator, version 8.0.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
Gazebo multi-robot simulator, version 8.0.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Err] [Master.cc:96] EXCEPTION: Unable to start server[bind: Address already in use]. There is probably another Gazebo process running.

[Err] [Master.cc:96] EXCEPTION: Unable to start server[bind: Address already in use]. There is probably another Gazebo process running.

When you stop the docker container, gazebo and gzserver will start.

$ gazebo --verbose --play ./logs/log/*/gzserver/state.log debug:=true
Gazebo multi-robot simulator, version 8.0.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
Gazebo multi-robot simulator, version 8.0.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.0.5
[Msg]
Log playback:
  Log Version: 1.0
  Gazebo Version: 8.0.0
  Random Seed: 3419886574
  Log Start Time: 0 388000000
  Log End Time: 10 741000000
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.0.5

However, if you try to run gzclient when the docker container is up, you get the following result:

$ gzclient --verbose debug:=true
Gazebo multi-robot simulator, version 8.0.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.0.5
[Wrn] [Publisher.cc:141] Queue limit reached for topic /gazebo/default/user_camera/pose, deleting message. This warning is printed only once.

And then after ~10 minutes:

libc++abi.dylib: terminating with uncaught exception of type boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error> >: boost: mutex lock failed in pthread_mutex_lock: Invalid argument
Abort trap: 6

I've tried every viable combination of the environment variables I know. This one is the only one where gzclient doesn't ... (more)

edit retag flag offensive close merge delete

Comments

What's the command you're using to create/start the docker container?

sloretz gravatar imagesloretz ( 2017-03-30 11:11:38 -0600 )edit

Are you running gzserver and gzclient on the same machine or different ones ? There may be port-forwarding and IP routing issues that need to be dealt with if you're not on the same machine(even if the remote machine is on the same subnet as the one running the container)

jetdillo gravatar imagejetdillo ( 2017-04-02 12:39:53 -0600 )edit

2 Answers

Sort by » oldest newest most voted
0

answered 2017-03-28 12:04:45 -0600

Carlos Agüero gravatar image

updated 2017-03-28 12:14:26 -0600

Could you publish the output of the container when you run gzserver --verbose? I did a quick test and I managed to connect my gzclient to gzserver running on the container.

In particular, I'm interested in the line that says "Publicized addres: ". In my case:

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 10.0.0.2

I connected to the gzserver using:

GAZEBO_MASTER_URI=http://10.0.0.2:11345 gzclient
edit flag offensive delete link more

Comments

The output from starting `gzserver` is up there in the second block. Gazebo multi-robot simulator, version 8.0.0 Copyright (C) 2012 Open Source Robotics Foundation. Released under the Apache 2 License. http://gazebosim.org [Msg] Waiting for master. [Msg] Connected to gazebo master @ http://127.0.0.1:11345 [Msg] Publicized address: 192.168.0.5 And changing the server to point to the host's IP, 192.168.0.5, doesn't help, either.

ajthor gravatar imageajthor ( 2017-03-28 17:28:32 -0600 )edit
0

answered 2017-03-28 19:02:07 -0600

Carlos Agüero gravatar image

updated 2017-03-28 19:11:54 -0600

You shouldn't have to point your server to the host's IP, instead, you should point your client to the endpoint where your gzserver is running. In your case it should be:

On the Docker container:

gzserver --verbose

On your host:

GAZEBO_MASTER_URI=http://192.168.0.5:11345 gzclient

If this doesn't work, it will help with the debugging to see the output of:

ifconfig

in the container and outside, as well as the output of:

env | grep GAZEBO

in the container and in the host.

edit flag offensive delete link more

Comments

Could you please stop posting answers when these should really be comments? Your solution still doesn't work. I set the environment variables to point to the correct location. I've tried: localhost, the loopback address, the container's IP, the bound address, etc. Please refer to the original question where I state the only environment variable that doesn't give me an error is GAZEBO_MASTER_URI=localhost:11345

ajthor gravatar imageajthor ( 2017-03-28 19:46:36 -0600 )edit

@ajthor was this problem ever solved? I am also attempting to access the gzserver (within a container) with a gzclient that is running on the host. Both gzserver and gzclient are ran on the same machine.

aarontan gravatar imageaarontan ( 2019-06-24 13:58:53 -0600 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2017-03-24 23:36:15 -0600

Seen: 4,980 times

Last updated: Mar 28 '17