Skip to content

Commit

Permalink
add examples page
Browse files Browse the repository at this point in the history
  • Loading branch information
AlirezaMorsali committed Dec 7, 2022
1 parent 3a8046f commit 35ceb4e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ userguide
pythonapi/index
cppapi/index
REST API <https://app.swaggerhub.com/apis/swaggerhub59/Inverted-AI>
Examples <https://github.com/inverted-ai/invertedai/tree/master/examples>
pythonapi/pyexamples
```

```{eval-rst}
Expand Down
7 changes: 7 additions & 0 deletions docs/source/pythonapi/pyexamples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Examples

Several examples are provided [here](https://github.com/inverted-ai/invertedai/tree/master/examples) demonstrating how to use the Inverted AI API in Python.
```{include} ../../../examples/README.md
:start-after: <!-- start exampels -->
:end-before: <!-- end exampels -->
```
15 changes: 7 additions & 8 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Examples

This folder contains examples demonstrating how to use the Inverted AI API in Python. [Click here](https://download-directory.github.io/?url=https://github.com/inverted-ai/invertedai/tree/master/examples) to download the folder as a zip-file.
This folder contains examples demonstrating how to use the Inverted AI API in Python.
<!-- start exampels -->
[Click here](https://download-directory.github.io/?url=https://github.com/inverted-ai/invertedai/tree/master/examples) to download the folder as a zip-file.
To run the examples locally, first build the virtual environment.
```commandline
python -m venv .venv
Expand All @@ -21,19 +23,14 @@ There are currently three different examples available.
This demonstration script runs without a local simulator and the API is used to control
all vehicles, meaning all vehicles in the simulation are NPCs. To minimize client-side
complexity, the visualizations are provided through the API, which is very inefficient
and only used for demonstration purposes. The purpose of those demonstrations is to
and only used for demonstration purposes ([click here](https://colab.research.google.com/github/inverted-ai/invertedai-drive/blob/develop/examples/response_time.ipynb) for response time comparison). The purpose of those demonstrations is to
quickly give you an idea for how the underlying NPCs behave. This example is available
in a few different versions, one calling the underlying REST API directly, and others
using the wrapper provided as a part of our library, the latter version also being
available as a Jupyter notebook and
[Colab](https://colab.research.google.com/github/inverted-ai/invertedai-drive/blob/develop/examples/npc_only_colab.ipynb).

## Controlling the traffic-lights
Inverted AI API allows for controlling the traffic light states.
We provided a [sample code](https://colab.research.google.com/github/inverted-ai/invertedai-drive/blob/develop/examples/npc_only_with_traffic_lights_REST.py)
for doing so at a traffic-light controlled intersection.

## Minimal example
## Cosimulation Minimal example

The minimal example, as shown on the front page, mocks up the local simulator with
a class that implements trivial control logic for the ego vehicle. This example is
Expand All @@ -48,3 +45,5 @@ This example is meant to provide a comprehensive illustration of co-simulation l
and to be a starting point for creating custom scenarios with Inverted AI NPCs,
both in CARLA and in other simulators. Running CARLA requires additional setup,
which is documented within the corresponding subfolder.

<!-- end exampels -->

0 comments on commit 35ceb4e

Please sign in to comment.