-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Adding Gazebo Docs #265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Adding Gazebo Docs #265
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
54c75ff
Adding Gazebo Docs
ruffsl edba487
Adding notes on uses cases, ports and volumes
ruffsl 9d7f12d
Adding notes on devices and volumes
ruffsl a849050
Spellchecking
ruffsl 6c683cf
Adding deployment example
ruffsl 15148d8
tweak wording
psftw 4b4560a
Merge pull request #2 from psftw/gazebo
ruffsl 2d16d0a
minor tweaks
ruffsl 985aa81
Adding notes on libgazebo-dev
ruffsl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Gazebo is an open source project for simulating robots, offering robust physics and rendering. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Supported tags and respective `Dockerfile` links | ||
|
||
%%TAGS%% | ||
|
||
For more information about this image and its history, please see the [relevant manifest file (`library/%%REPO%%`)](https://github.com/docker-library/official-images/blob/master/library/%%REPO%%) in the [`docker-library/official-images` GitHub repo](https://github.com/docker-library/official-images). | ||
|
||
%%CONTENT%%%%VARIANT%%%%LICENSE%% | ||
|
||
# Supported Docker versions | ||
|
||
%%DOCKER-VERSIONS%% | ||
|
||
# User Feedback | ||
|
||
%%USER-FEEDBACK%% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# What is [Gazebo](http://www.gazebosim.org/)? | ||
|
||
Robot simulation is an essential tool in every roboticist's toolbox. A well-designed simulator makes it possible to rapidly test algorithms, design robots, and perform regression testing using realistic scenarios. Gazebo offers the ability to accurately and efficiently simulate populations of robots in complex indoor and outdoor environments. At your fingertips is a robust physics engine, high-quality graphics, and convenient programmatic interfaces. Best of all, Gazebo is free with a vibrant community. | ||
|
||
> [wikipedia.org/wiki/Gazebo_simulator](https://en.wikipedia.org/wiki/Gazebo_simulator) | ||
|
||
[%%LOGO%%](http://www.gazebosim.org/) | ||
|
||
# How to use this image | ||
|
||
## Create a `Dockerfile` in your Gazebo project | ||
|
||
FROM gazebo:gzserver5 | ||
# place here your application's setup specifics | ||
CMD [ "gzserver", "my-gazebo-app-args" ] | ||
|
||
You can then build and run the Docker image: | ||
|
||
docker build -t my-gazebo-app . | ||
docker run -it -v="/tmp/.gazebo/:/root/.gazebo/" --name my-running-app my-gazebo-app | ||
|
||
## Deployment use cases | ||
|
||
This dockerized image of Gazebo is intended to provide a simplified and consistent platform to build and deploy cloud based robotic simulations. Built from the [official Ubuntu image](https://registry.hub.docker.com/_/ubuntu/) and Gazebo's official Debian packages, it includes recent supported releases for quick access and download. This provides roboticists in research and industry with an easy way to develop continuous integration and testing on training for autonomous actions and task planning, control dynamics and regions of stability, kinematic modeling and prototype characterization, localization and mapping algorithms, swarm behavior and networking, as well as general system integration and validation. | ||
|
||
Conducting such complex simulations with high validity remains computationally demanding, and oftentimes outside the capacity of a modest local workstation. With the added complexity of the algorithms being benchmarked, we can soon exceed the capacity of even the most formidable servers. This is why a more distributed approach remains attractive for those who begin to encounter limitations of a centralized computing host. However, the added complication of building and maintaining a distributed testbed over a set of clusters has for a while required more time and effort than many smaller labs and businesses would have deemed appropriate to implement. | ||
|
||
With the advancements and standardization of software containers, roboticists are primed to acquire a host of improved developer tooling for building and shipping software. To help alleviate the growing pains and technical challenges of adopting new practices, we have focused on providing an official resource for using Gazebo with these new technologies. | ||
|
||
## Deployment suggestions | ||
|
||
The `gzserver` tags are designed to have a small footprint and simple configuration, thus only include required Gazebo dependencies. The standard messaging port `11345` is exposed to allow for client connections and messages API. | ||
|
||
### Volumes | ||
|
||
Gazebo uses the `~/.gazebo/` directory for storing logs, models and scene info. If you wish to persist these files beyond the lifecycle of the containers which produced them, the `~/.gazebo/` folder can be mounted to an external volume on the host, or a derived image can specify volumes to be managed by the Docker engine. By default, the container runs as the `root` user, so `/root/.gazebo/` would be the full path to these files. | ||
|
||
For example, if one wishes to use their own `.gazebo` folder that already resides in their local home directory, with a username of `ubuntu`, we can simple launch the container with an additional volume argument: | ||
|
||
docker run -v "/home/ubuntu/.gazebo/:/root/.gazebo/" gazebo | ||
|
||
One thing to be careful about is that gzserver logs to files named `/root/.gazebo/server-<port>/*.log`, where `<port>` is the port number that server is listening on (11345 by default). If you run and mount multiple containers using the same default port and same host side directory, then they will collide and attempt writing to the same file. If you want to run multiple gzservers on the same docker host, then a bit more clever volume mounting of `~/.gazebo/` subfolders would be required. | ||
|
||
### Devices | ||
|
||
As of Gazebo version 5.0, physics simulation under a headless instances of gzserver works fine. However some application may require image rendering camera views and ray traces for other sensor modalities. For Gazebo, this requires a running X server for rendering and capturing scenes. In addition, graphical hardware acceleration is also needed for reasonable realtime framerates. To this extent, mounting additional graphic devices into the container and linking to a running X server is required. In the interest of maintaining a general purpose and minimalistic image which is not tightly coupled to host system software and hardware, we do not include tags here with these additional requirements and instructions. You can however use this repo to build and customize your own images to fit your software/hardware configuration. The OSRF's Docker Hub organization profile contains a Gazebo repo at [osrf/gazebo](https://registry.hub.docker.com/u/osrf/gazebo/) which is based on this repo but includes additional tags for these advanced use cases. | ||
|
||
### Development | ||
|
||
If you not only wish to run Gazebo, but develop for it too, i.e. compile custom plug-ins or build upon messaging interfaces for ROS, this will require the development package included in the `libgazebo` tag. If you simply need to run Gazebo as a headless server, then the `gzserver` tag consist of a smaller image size. | ||
|
||
## Deployment example | ||
|
||
In this short example, we'll spin up a new container running gazebo server, connect to it using a local gazebo client, then spawn a double inverted pendulum and record the simulation for later playback. | ||
|
||
> First launch a gazebo server with a mounted volume for logging and name the container gazebo: | ||
|
||
docker run -d -v="/tmp/.gazebo/:/root/.gazebo/" --name=gazebo gazebo | ||
|
||
> Now open a new bash session in the container using the same entrypoint to configure the environment. Then download the double_pendulum model and load it into the simulation. | ||
|
||
docker exec -it gazebo bash | ||
curl -o double_pendulum.sdf http://models.gazebosim.org/double_pendulum_with_base/model-1_4.sdf | ||
gz model --model-name double_pendulum --spawn-file double_pendulum.sdf | ||
|
||
> To start recording the running simulation, simply use [`gz log`](http://www.gazebosim.org/tutorials?tut=log_filtering&cat=tools_utilities) to do so. | ||
|
||
gz log --record 1 | ||
|
||
> After a few seconds, go ahead and stop recording by disabling the same flag. | ||
|
||
gz log --record 0 | ||
|
||
> To introspect our logged recording, we can navigate to log directory and use `gz log` to open and examine the motion and joint state of the pendulum. This will allow you to step through the poses of the pendulum links. | ||
|
||
cd ~/.gazebo/log/*/gzserver/ | ||
gz log --step --hz 10 --filter *.pose/*.pose --file state.log | ||
|
||
> If you have an equivalent release of Gazebo installed locally, you can connect to the gzserver inside the container using gzclient GUI by setting the address of the master URI to the containers public address. | ||
|
||
export GAZEBO_MASTER_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' gazebo) | ||
export GAZEBO_MASTER_URI=$GAZEBO_MASTER_IP:11345 | ||
gzclient --verbose | ||
|
||
> In the rendered OpenGL view with gzclient you should see the moving double pendulum created prior still oscillating. From here you can control or monitor state of the simulation using the graphical interface, add more pendulums, reset the world, make more logs, etc. To quit the simulation, close the gzclient window and stop the container. | ||
|
||
docker stop gazebo | ||
docker rm gazebo | ||
|
||
> Even though our old gazebo container has been removed, we can still see that our record log has been preserved in the host volume directory. | ||
|
||
cd /tmp/.gazebo/log/ | ||
ls | ||
|
||
> Again, if you have an equivalent release of Gazebo installed on your host system, you can play back the simulation with gazebo by using the recorded log file. | ||
|
||
export GAZEBO_MASTER_IP=127.0.0.1 | ||
export GAZEBO_MASTER_URI=$GAZEBO_MASTER_IP:11345 | ||
cd /tmp/.gazebo/log/*/gzserver/ | ||
gazebo --verbose --play state.log | ||
|
||
# More Resources | ||
|
||
[Gazebosim.org](http://www.gazebosim.org/): Main Gazebo website | ||
|
||
[Answers](http://answers.gazebosim.org/): Find answers and ask questions | ||
|
||
[Wiki](https://bitbucket.org/osrf/gazebo/wiki): General information and tutorials | ||
|
||
[Mailing List](https://groups.google.com/a/osrfoundation.org/d/forum/gazebo): Join for news and announcements | ||
|
||
[Simulation Models](https://bitbucket.org/osrf/gazebo_models/src): Robots, objects, and other simulation models | ||
|
||
[Blog](http://wiki.gazebosim.org/blog.html): Stay up-to-date | ||
|
||
[OSRF](http://www.osrfoundation.org/): Open Source Robotics Foundation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Gazebo is open-source licensed under [Apache 2.0](http://opensource.org/licenses/Apache-2.0). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a specific folder that a user should
ADD
their files to so that gzserver will find it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where users should mount their files for gazebo is described in detail under the volumes section. I wouldn't recommend users bake-in worlds models or robot. sdf files into image itself using the
ADD
argument in the Dockerfile. Those files are usually dynamic in nature as the user tweaks or iterates designs during runtime.