# How they work

The [first chambers](https://docs.causalchamber.ai/the-chambers/original-prototypes) were developed at the [Seminar for Statistics](https://math.ethz.ch/sfs) of ETH Zurich, initially conceived as testbeds for causal inference algorithms. They were presented in an [open-access paper](https://www.nature.com/articles/s42256-024-00964-x) in Nature Machine Intelligence, together with their open-source [blueprints](https://github.com/juangamella/causal-chamber/tree/main/hardware) and a collection of [public datasets](https://github.com/juangamella/causal-chamber).

{% columns %}
{% column %}

<figure><img src="https://3492874807-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUqYDL9yvLTNUYW7H1Q6t%2Fuploads%2F5PDrqgk4mQsoOhqNs8tM%2Fwt_mk2_light_background_150dpi.png?alt=media&#x26;token=14504755-5714-426a-8924-a353b5cd9c86" alt=""><figcaption></figcaption></figure>

{% content-ref url="wind-tunnel-mk2" %}
[wind-tunnel-mk2](https://docs.causalchamber.ai/the-chambers/wind-tunnel-mk2)
{% endcontent-ref %}
{% endcolumn %}

{% column %}

<figure><img src="https://3492874807-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUqYDL9yvLTNUYW7H1Q6t%2Fuploads%2FNB1EuTFi2dgKBNs8mclg%2Flt_light_backround.png?alt=media&#x26;token=8376721f-3c81-4a76-a8b0-0b9179c0038b" alt=""><figcaption></figcaption></figure>

{% content-ref url="light-tunnel-mk2" %}
[light-tunnel-mk2](https://docs.causalchamber.ai/the-chambers/light-tunnel-mk2)
{% endcontent-ref %}
{% endcolumn %}
{% endcolumns %}

A chamber contains a physical system and allows us to control and measure its variables without human supervision. It provides validation tasks with a ground truth for a variety of algorithms from ML, AI, statistics, and engineering.

> In principle, any physical system is *chamberizable* as long as (1) its variables can be digitally measured and controlled, and (2) it can be reset without human supervision.

Because the physical system is well understood, we can also provide a ground truth for causal inference tasks, as well as [mechanistic models](https://arxiv.org/pdf/2404.11341#page=28) and [simulators](https://github.com/juangamella/causal-chamber-package/tree/main/causalchamber/simulators) of the physical phenomena inside the chambers. These are particularly useful for studying problems in Sim2Real, Simulation-Based Inference, Hybrid Learning, and related fields. See the [case studies](https://app.gitbook.com/o/WlGCd39uI1U9EW8METkZ/s/LGlWOZRUBOtN2PzbIhYS/) for examples.

### Hardware configurations

A chamber can operate under several configurations, exposing different variables of the underlying physical system. Furthermore, the chamber can set control inputs as functions of other sensor measurements, allowing for feedback mechanisms and tunable causal effects.

{% hint style="info" %}
Configurations are specified at the beginning of an experiment and loaded automatically by the chamber.
{% endhint %}

<details>

<summary>Light Tunnel Mk2: hardware configurations </summary>

See the [hardware configurations](https://docs.causalchamber.ai/light-tunnel-mk2#hardware-configurations) for the [Light Tunnel Mk2](https://docs.causalchamber.ai/the-chambers/light-tunnel-mk2)

</details>

<details>

<summary>Wind Tunnel Mk2: hardware configurations </summary>

See the [hardware configurations](https://docs.causalchamber.ai/light-tunnel-mk2#hardware-configurations) for the [Wind Tunnel Mk2](https://docs.causalchamber.ai/the-chambers/light-tunnel-mk2)

</details>

### Chamber control language

<figure><img src="https://3492874807-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUqYDL9yvLTNUYW7H1Q6t%2Fuploads%2FErryXiTKjEr5q0CPUu9J%2Fbasic_operation.svg?alt=media&#x26;token=5500b3db-f059-4365-b064-e4b2eb736f47" alt=""><figcaption></figcaption></figure>

The chambers are controlled through a simple language with three instructions.

{% tabs %}
{% tab title="SET instruction" %}
{% code fullWidth="true" %}

```
set(target, value)
```

{% endcode %}

This sets the variable `target` to the given `value`, returning when the change has been made in the hardware.

See the [hardware configurations](#hardware-configurations) of each chamber for a list of variables and their valid and default values.
{% endtab %}

{% tab title="MEASURE instruction" %}
{% code overflow="wrap" %}

```
measure(n, delay)
```

{% endcode %}

The chamber returns `n` successive measurements of all variables, including images if it produces them. Setting `delay` (in milliseconds) adds a delay between measurements, allowing you to change the measurement frequency.

{% hint style="info" %}
The maximum measurement frequency, i.e., with `delay=0,` is approx. 12Hz for the [Wind Tunnel Mk2](https://docs.causalchamber.ai/the-chambers/wind-tunnel-mk2) and 10Hz for the [Light Tunnel Mk2](https://docs.causalchamber.ai/the-chambers/light-tunnel-mk2).
{% endhint %}
{% endtab %}

{% tab title="WAIT instruction" %}
{% code overflow="wrap" %}

```
wait(milliseconds)
```

{% endcode %}

The chamber acts as a precise clock and waits for the given `milliseconds` before executing the next instruction.
{% endtab %}
{% endtabs %}

Instructions can be sent synchronously (see [real-time experiments](https://docs.causalchamber.ai/remote-lab/running-a-real-time-experiment)) or as an experiment protocol, which is placed on a [queue](https://docs.causalchamber.ai/remote-lab/using-the-experiment-queue) and executed when a chamber becomes available.

{% columns %}
{% column %}
{% content-ref url="../remote-lab/running-a-real-time-experiment" %}
[running-a-real-time-experiment](https://docs.causalchamber.ai/remote-lab/running-a-real-time-experiment)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
{% content-ref url="../remote-lab/using-the-experiment-queue" %}
[using-the-experiment-queue](https://docs.causalchamber.ai/remote-lab/using-the-experiment-queue)
{% endcontent-ref %}
{% endcolumn %}
{% endcolumns %}
