Skip to content

Commit

Permalink
Added web visualization tutorial (#154)
Browse files Browse the repository at this point in the history
Signed-off-by: Nate Koenig <[email protected]>

Co-authored-by: Nate Koenig <[email protected]>
  • Loading branch information
nkoenig and Nate Koenig authored Apr 5, 2021
1 parent 2a3f3a3 commit 308da26
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dome/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,6 @@ pages:
- name: actors
title: Actors
file: actors.md
- name: web_visualization
title: Web Visualization
file: web_visualization.md
70 changes: 70 additions & 0 deletions dome/web_visualization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Overview

Web visualization supports rendering and interacting with running Ignition
Gazebo simulations. You may find web visualization useful
when interacting with remote or headless Ignition Gazebo simulations. No
additionally dependencies, other than a browser and internet connection, are
required.

## How to use web visualization

The following steps will guide you through the process of running Ignition
Gazebo with a websocket server and connecting to the websocket for
visualization.

1. Start an Ignition Gazebo instance as usual. We will use the `fuel.sdf`
world and run it headless.
```
ign gazebo -v 4 -s -r fuel.sdf
```

1. Create an Ignition Launch file with the websocket server plugin.
```
echo "<?xml version='1.0'?>
<ignition version='1.0'>
<plugin name='ignition::launch::WebsocketServer'
filename='ignition-launch-websocket-server'>
<port>9002</port>
</plugin>
</ignition>" > websocket.ign
```

1. Run the websocket server using
```
ign launch -v 4 websocket.ign
```

1. Visualize the simulation by going to
[https://app.ignitionrobotics.org/visualization](https://app.ignitionrobotics.org/visualization) and pressing the Connect button.

1. It may take a few seconds for the scene to load. Your browser needs to
fetch all of the models in the world.

## Websocket server customization

The following parameters are available in the websocket server plugin.

* `<admin_authorization_key>` : If this is set, then a connection must provide the matching key using an "auth" call on the websocket. If the `<authorization_key>` is set, then the connection can provide that key.
* `<authorization_key>` : If this is set, then a connection must provide the
matching key using an "auth" call on the websocket. If the `<admin_authorization_key>` is set, then the connection can provide that key.
* `<max_connections>` : An integer that is the maximum number of simultaneous connections.
* `<port>` : An integer that is websocket port.
* `<publication_hz>` : An integer that is the maximum publication hertz rate.

## Code and Support

1. The code for the web application,
[app.ignitionrobotics.org](https://app.ignitionrobotics.org), lives at
[https://gitlab.com/ignitionrobotics/web/app](https://gitlab.com/ignitionrobotics/web/app).

1. The javascript library used to render the 3D scene lives at
[https://gitlab.com/ignitionrobotics/web/gz3d](https://gitlab.com/ignitionrobotics/web/gz3d).

1. Is you notice an issue with web visualization, then please
file a ticket at
[https://gitlab.com/ignitionrobotics/web/app/-/issues](https://gitlab.com/ignitionrobotics/web/app/-/issues).

## Troubleshooting

1. If you are running Ignition Gazebo in a docker container, make sure to
use the [--network host](https://docs.docker.com/network/network-tutorial-host/) Docker commandline option. Without `--network host` the web application won't be able to connect to the websocket server.

0 comments on commit 308da26

Please sign in to comment.