# Program the stacking demo in Visual Studio Code

> Write and run the stacking demo in the Visual Studio Code app on your Wandelbots NOVA OS instance and watch it in NVIDIA Isaac Sim. Learn how to install the app and the Wandelbots NOVA extension, add the program and run it from the editor.

The Visual Studio Code app runs in the browser on your Wandelbots NOVA OS instance.
It comes with a ready-made NOVA project, so you write and run a robot program without any local setup.
This guide adds the stacking demo to that project and runs it, while NVIDIA Isaac Sim shows every planned path and the robot stacking the workpieces.

## Before you start

1. Set up the stacking demo in Isaac Sim with the [Isaac Sim quickstart](/simulation/quickstart): the scene, the virtual controller `kuka`, the connected robot and the TCP `schunk_coact_gripper`.
2. Use the NOVA Isaac Sim extension and `wandelbots-isaacsim-api` 2.76.1 or later.
3. Make sure your NOVA OS instance can reach the extension API on the machine that runs Isaac Sim, for example `http://<isaac_sim_ip>:8011/omniservice/api/v2`.

### Step 1: Install Visual Studio Code

Video: [/video/programming/isaac-sim-vscode-step-1-install.webm](/video/programming/isaac-sim-vscode-step-1-install.webm)

1. On the NOVA OS home screen, open `App Store`.
2. Select `Visual Studio Code`.
3. Click `Install`.\
   The installation takes a few minutes.

→ `Visual Studio Code` appears on the NOVA OS home screen.

### Step 2: Install the Wandelbots NOVA extension

Video: [/video/programming/isaac-sim-vscode-step-2-extension.webm](/video/programming/isaac-sim-vscode-step-2-extension.webm)

1. On the NOVA OS home screen, open `Visual Studio Code`.
2. Open the `Extensions` view.
3. Search for `Wandelbots NOVA`.
4. Click `Install`.
5. Confirm with `Trust Publisher & Install`.

→ The extension adds `Run`, `Debug`, `Debug path` and `Robot Interface` above every NOVA program.

### Step 3: Write the program

Video: [/video/programming/isaac-sim-vscode-step-3-program.webm](/video/programming/isaac-sim-vscode-step-3-program.webm)

1. Open a terminal with `Terminal: Create New Terminal`.

2. Download the stacking demo into the project:

   ```bash
   curl -sSL -o your_nova_app/stacking_demo.py https://raw.githubusercontent.com/wandelbotsgmbh/wandelbots-isaacsim-extension/main/examples/nova_sdk/quickstart_stacking_demo.py
   ```

3. Open `your_nova_app/stacking_demo.py`.

4. In line 25, set `isaacsim_ip_address` to the address of the machine that runs Isaac Sim, then save.

The program has four parts:

- `viewer=trajectory_utils.TrajectoryViewer(...)` sends every planned path to Isaac Sim.
- `preconditions` creates the virtual controller `kuka` if it does not exist yet.
- `get_poses_from_ghost_objects` reads the pick and place poses from the ghost objects in the scene.
- The loop plans and executes a pick and place sequence for each workpiece.

### Step 4: Run the program

Video: [/video/programming/isaac-sim-vscode-step-4-run.webm](/video/programming/isaac-sim-vscode-step-4-run.webm)

1. In the terminal, add the Isaac Sim client:

   ```bash
   uv add wandelbots-isaacsim-api
   ```

2. Open the settings with `Ctrl+,` and search for `wandelbots-nova-viewer.novaApi`.

3. Select `Workspace` and enter `http://api-gateway:8080`.\
   This is the NOVA API inside your NOVA OS instance, which apps reach without an access token. The extension hands this address to every program it runs.

4. In Isaac Sim, click `Play`.

5. In `stacking_demo.py`, click `Run` above `@nova.program`.

> **Info:** The preinstalled Wandelbots Viewer extension adds `Run Program` and `Debug Program` to the same line.
> Use `Run` from the Wandelbots NOVA extension, which connects the program to your NOVA OS instance.

→ Isaac Sim draws each planned path in green, and the robot stacks the three workpieces along it.

## Next steps

- Hand the program to operators with the [Program Operator](/developer/run-program).
- Learn more about the `@nova.program` decorator in [Declare program](/developer/declare-program).
