Visualize Robot in Gazebo RoboMaker


I'm following the helloworld tutorial for RoboMaker, and when I have to launch the simulation application with the following command:

docker run -it -v /tmp/.X11-unix/:/tmp/.X11-unix/ -u robomaker -e ROBOMAKER_GAZEBO_MASTER_URI=http://localhost:5555 -e ROBOMAKER_ROS_MASTER_URI=http://localhost:11311 \robomaker-helloworld-sim-app:latest roslaunch hello_world_simulation empty_world.launch

it runs the application but it does not open Gazebo in the virtual desktop to visualize the robot. How do I have to change this command?

asked 2 years ago422 views
1 Answer

Use the following commands to visualize the simulation using the Gazebo GUI tool:

  1. Connect to your container running the simulation application.
  2. Visualize your application by running the Gazebo Graphical User Interface (GUI)
# Enable access to X server to launch Gazebo from docker container
$ xhost +

# Check that the robot_app and sim_app containers are running. The command should list both containers
$ docker container ls

# Connect to the sim app container
$ docker exec -it sim_app bash

# Launch Gazebo from within the container
$ rosrun gazebo_ros gzclient   

For more information, see the documentation on Running a sample application with ROS Melodic and Gazebo 9. (There is also separate documentation for ROS2 Foxy and Gazebo 11).

answered 2 years ago
  • Thank you very much! I have got the following two problems:

    • when I run the command $ xhost + the following error appears: xhost: unable to open display ""
    • when I run inside the container $ rosrun gazebo_ros gzclient the following error appears: bash: rosrun: command not found

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions