0
$\begingroup$

Gazebo Answers logo

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 exit with an error code. I've tried every trick with docker that I know, and it isn't a problem with published ports. I can access static webpages from containers on the same docker network just fine. Gzserver is running fine because I can run simulations in the container where it is running. It's a matter of not being able to connect to the server from the host. I'm hoping someone has experience with this. Any suggestions?


Originally posted by ajthor on Gazebo Answers with karma: 11 on 2017-03-24

Post score: 1


Original comments

Comment by sloretz on 2017-03-30:
What's the command you're using to create/start the docker container?

Comment by jetdillo on 2017-04-02:
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)

$\endgroup$

1 Answer 1

0
$\begingroup$

Gazebo Answers logo

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

Originally posted by Carlos Agüero with karma: 626 on 2017-03-28

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by ajthor on 2017-03-28:
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.

$\endgroup$

Your Answer

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