# Examples

> Find the example scripts of the Wandelbots NOVA extension on GitHub and run them against your simulation. Learn what each example does and what it expects in the scene.

The [GitHub repository of the extension](https://github.com/wandelbotsgmbh/wandelbots-isaacsim-extension/tree/main/examples) contains example scripts.
They combine the Wandelbots NOVA Python SDK with the extension API.

| Example | What it does | Expects |
| - | - | - |
| [`nova_sdk/quickstart_stacking_demo.py`](https://github.com/wandelbotsgmbh/wandelbots-isaacsim-extension/blob/main/examples/nova_sdk/quickstart_stacking_demo.py) | Reads the ghost objects of the scene and stacks workpieces from each pick pose to its place pose. | The scene from the [quickstart](/simulation/quickstart). |
| [`nova_sdk/collision_free.py`](https://github.com/wandelbotsgmbh/wandelbots-isaacsim-extension/blob/main/examples/nova_sdk/collision_free.py) | Reads the colliders around the robot from Isaac Sim and plans collision-free motions around them. | A UR10e at the origin with colliders around it. |
| [`nova_sdk/ghost_teaching.py`](https://github.com/wandelbotsgmbh/wandelbots-isaacsim-extension/blob/main/examples/nova_sdk/ghost_teaching.py) | Writes the poses of all ghost objects into a Python file that robot programs can import. | Ghost objects in the scene. |
| [`trajectories/generate_trajectories.py`](https://github.com/wandelbotsgmbh/wandelbots-isaacsim-extension/blob/main/examples/trajectories/generate_trajectories.py) | Turns the plans that the [Trajectory Planner](/simulation/trajectory-planner) stored in Wandelbots NOVA into standalone robot programs. | Stored plans in the cell. |

### Step 1: Set up a Python environment

1. Clone the repository and open the `examples` folder.
2. Create a virtual environment with [uv](https://docs.astral.sh/uv/), activate it, and install the packages of the example:

   ```bash
   uv venv --python 3.12 .venv
   source .venv/bin/activate
   uv pip install -r nova_sdk/requirements.txt
   ```

### Step 2: Point the examples to your instances

Set the environment variables, for example in a `.env` file next to the script:

| Variable | Used by | Example |
| - | - | - |
| `NOVA_API` | All examples | `https://abc.instance.wandelbots.io` |
| `NOVA_ACCESS_TOKEN` | All examples on a cloud instance | Your access token |
| `ISAACSIM_API_URL` | `collision_free.py` | `http://127.0.0.1:8011/omniservice/api/v2` |

`quickstart_stacking_demo.py` takes the address of Isaac Sim from the variable `isaacsim_ip_address` at the top of the script.

### Step 3: Run an example

Open the quickstart scene in Isaac Sim and start the simulation.
Then run the script in the activated environment:

```bash
python nova_sdk/quickstart_stacking_demo.py
```

## Turn stored plans into programs

`generate_trajectories.py` writes one program per stored plan to `skills/skill_<name>.py`.
Each program creates a virtual controller, sets up the TCPs and the mounting, and runs the motion.

```bash
cd examples/trajectories
uv venv --python 3.12 .venv
source .venv/bin/activate
uv pip install -r requirements.txt
python generate_trajectories.py --host https://abc.instance.wandelbots.io --cell cell
cd skills && python skill_<name>.py
```

> **Info:** The generated programs replay the planned motion types.
> Collision-free plans plan again at runtime with collision-free motions against the collision setup stored in Wandelbots NOVA.
> Circular and spline segments are skipped.
