Run Gazebo headless on AWS and render locally with the gzclient
I installed gazebo on an AWS instance to run faster simulations. However, I am struggling with my setup. For doing a small test, I start an empty world on the AWS server
roslaunch gazebo_ros empty_world.launch headless:=true gui:=false
Then on my laptop I run:
ssh -L 11345:localhost:11345 ubuntu@aws_ip
this basically tunnels my localhost:11345 to the localhost:11345 of the aws computer. I then run
gzclient --verbose
on my laptop. The client starts, displays an empty gazebo window then dies.
Gazebo multi-robot simulator, version 9.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.1.228
[Wrn] [Event.cc:61] Warning: Deleting a connection right after creation. Make sure to save the ConnectionPtr from a Connect call
[Wrn] [Publisher.cc:141] Queue limit reached for topic /gazebo/default/user_camera/pose, deleting message. This warning is printed only once.
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error> >'
what(): boost: mutex lock failed in pthread_mutex_lock: Invalid argument
Aborted (core dumped)
There is one minute or so between the first warning and the second one. What is the problem here? Was gazebo never meant to be run this way (with remote servers at least) Does the gzclient and the gzserver share so much data that it is not practical to do it through internet? I checked with nethogs and gzclient barely pulls 40 KB/sec (way less than my internet bandwidth)
1679 mehdi gzclient wlp4s0 5.115 39.034 KB/sec
If so, what would be an alternative? I don't consider VNC to be an alternative as it probably will be quite laggy too
I am using Ubuntu 18.04 with ROS Melodic and Gazebo 9
Asked by mehdi on 2019-02-26 17:11:39 UTC
Answers
One of the answers above helped me a lot with a similar problem even with chrome extension vpn, and the system began to work correctly.
Asked by MiltonRose on 2021-02-12 06:24:45 UTC
Comments
Just a comment. I've tried to use Gzweb to do something similar. You run the Gzweb server on your simulation machine and connect to the IP:port from your client. I was able to get it running - couldn't render models correctly but I think I didn't set up the environmental variables properly. Might be worth looking into.
Asked by josephcoombe on 2019-03-01 19:35:26 UTC
That is what I ended up doing, works really nice :D
Asked by mehdi on 2019-03-02 06:10:17 UTC
I've done this but using VPN as shown here https://www.youtube.com/watch?v=ecMlx2V_meM. It's another way if you want to try.
Asked by arifrahman on 2019-06-19 22:41:10 UTC