# Bosch Rexroth ctrlX (Pro)

{% hint style="warning" %}
The ctrlX Interface is currently in **Beta** and will be officially released with **realvirtual Professional 6.3**.
{% endhint %}

{% hint style="info" %}
This interface requires the **REALVIRTUAL\_JSON** compiler define. See [Newtonsoft JSON](https://doc.realvirtual.io/advanced-topics/newtonsoft-json) for setup instructions.
{% endhint %}

## Overview

The ctrlX Interface connects realvirtual directly to any **ctrlX OS device** like the **Bosch Rexroth ctrlX CORE** controller. It uses the **realvirtual WebSocket Bridge** — a .NET 8 snap application running on ctrlX OS — to exchange PLC signals in real time via the ctrlX Data Layer.

Communication uses the high-performance [WebSocket Realtime Interface v2 protocol](https://doc.realvirtual.io/components-and-scripts/websocket-pro#wire-protocol-v2-reference), enabling cyclic signal exchange at millisecond intervals. The ctrlX Interface extends the [WebSocket Realtime Interface](https://doc.realvirtual.io/components-and-scripts/interfaces/websocket-pro) with ctrlX OS-specific features: REST API authentication, device status monitoring, remote bridge configuration, ctrlX Data Layer settings, and diagnostics — all from the Unity Inspector.

**Key capabilities:**

* **High-speed signal exchange** via WebSocket with configurable publish intervals down to 5 ms
* **One-click signal import** from ctrlX Data Layer with automatic signal discovery
* **REST API integration** for device info, bridge status, and diagnostics
* **Remote bridge configuration** (publish interval, browse paths, logging level)
* **Data Layer settings** (min publish/sample intervals)
* **SSL/TLS support** for secure connections through the ctrlX reverse proxy

## Architecture

```
 Unity (realvirtual)                      ctrlX OS device
┌─────────────────────┐          ┌──────────────────────────────┐
│                     │          │                              │
│   ctrlX Interface ──┼── WebSocket v2 ──▶ WebSocket Bridge    │
│                     │          │               │              │
│                  ───┼── REST API ─────▶ ctrlX Data Layer     │
│                     │          │               │              │
│                     │          │          PLC Runtime         │
│                     │          │                              │
└─────────────────────┘          └──────────────────────────────┘
```

The ctrlX Interface communicates with ctrlX OS devices through two channels:

* **WebSocket v2** — High-speed cyclic signal exchange using the [WebSocket Realtime Interface v2 protocol](https://doc.realvirtual.io/components-and-scripts/websocket-pro#wire-protocol-v2-reference). See that page for the full wire format specification.
* **REST API** — Authentication, device info, bridge configuration, Data Layer settings, and diagnostics.

## realvirtual WebSocket Bridge

The **realvirtual WebSocket Bridge** is a .NET 8 snap application that runs on ctrlX OS. It bridges the ctrlX Data Layer to realvirtual Unity Digital Twins via the WebSocket Realtime Interface v2 protocol.

<figure><img src="https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-d78e66f033adb5a4cacb97e9b778f5490ded51ea%2Fctrlx-bridge-snap.png?alt=media" alt=""><figcaption><p>realvirtual WebSocket Bridge installed on a ctrlX OS device</p></figcaption></figure>

The bridge includes a built-in status page accessible via the ctrlX OS web interface, showing connection status, signal counts, write activity monitoring, and browse path configuration at a glance.

<figure><img src="https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-ee8f248b1d2546a86b7dd64efb3afe88823cc8d9%2Fctrlx-bridge-status.png?alt=media" alt=""><figcaption><p>realvirtual WebSocket Bridge status page showing connection status, signal counts, and write activity monitoring</p></figcaption></figure>

The bridge:

* Subscribes to ctrlX Data Layer nodes and publishes their values over WebSocket
* Receives signal updates from Unity and writes them back to the Data Layer
* Supports configurable browse paths, publish intervals, and logging levels
* Can be configured remotely from the Unity Inspector

{% hint style="info" %}
The realvirtual WebSocket Bridge snap is **available from realvirtual on demand**. Contact [realvirtual](https://realvirtual.io) to obtain the bridge application for your ctrlX CORE device.
{% endhint %}

## Setup

### Prerequisites

1. A **ctrlX OS device like ctrlX CORE** (physical or virtual)
2. The **realvirtual WebSocket Bridge** snap installed on the ctrlX OS device (available from realvirtual on demand)
3. Network connectivity between your PC and the ctrlX OS device

### Adding the Interface

1. In Unity, go to the menu **Tools > realvirtual > Interfaces > ctrlX Interface** to add the component
2. Enter the **ctrlX Address** (IP address of your ctrlX OS device)
3. Set **Username** and **Password** (default: `boschrexroth` / `boschrexroth`)
4. Click **Refresh** to verify the connection and see device info

<figure><img src="https://260262196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpYxFg97YnJX96UzNNTSd%2Fuploads%2Fgit-blob-1596ef5d3b2c1efd6fbe046b5a93b789178fc9f6%2Fctrlx-interface-inspector.png?alt=media" alt=""><figcaption><p>ctrlX Interface Inspector</p></figcaption></figure>

### Importing Signals

1. Make sure the ctrlX OS device is reachable and the bridge snap is running
2. Configure **Browse Paths** to point to your PLC symbols (e.g. `plc/app/Application/sym`)
3. Click **Import Signals** in the Connection section
4. The interface connects to the bridge, discovers all signals, and creates local PLC signal objects as children

### Quick Start

1. Add the ctrlX Interface to your scene
2. Enter ctrlX address and credentials
3. Click **Refresh** to verify connectivity
4. Configure browse paths for your PLC program
5. Click **Import Signals** to create signal objects
6. Press Play — signals exchange automatically

## Properties

### Connection

| Property          | Description                                                                                                                       |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| **ctrlX Address** | IP address of the ctrlX OS device (e.g. `192.168.1.1`)                                                                            |
| **Username**      | Login username for ctrlX REST API (default: `boschrexroth`)                                                                       |
| **Password**      | Login password for ctrlX REST API (default: `boschrexroth`)                                                                       |
| **Use SSL**       | Enable for `wss://` connections through the ctrlX reverse proxy. When enabled, port switches to 443 and path is set automatically |

### Status

| Property       | Description                                                     |
| -------------- | --------------------------------------------------------------- |
| **ctrlX**      | Device info: operating mode, hostname, OS version, architecture |
| **Bridge**     | Installed bridge snap version and status                        |
| **WebSocket**  | Current WebSocket connection state (Connected / Disconnected)   |
| **Signals**    | Number of input and output signals                              |
| **Comm Cycle** | Actual communication cycle time in milliseconds                 |
| **Config**     | Last configuration operation result                             |

**Buttons:**

* **Refresh** — Fetches device info and bridge status from ctrlX via REST API
* **Test ctrlX** — Tests REST connectivity by authenticating and reporting the result
* **Test Bridge** — Tests WebSocket connectivity to the bridge application

### Signal Import Configuration

| Property                 | Description                                                                    |
| ------------------------ | ------------------------------------------------------------------------------ |
| **Default Direction**    | Direction for imported signals when no pattern matches (`Input` or `Output`)   |
| **Use Pattern Matching** | Enable name-based direction detection using the patterns below                 |
| **Input Patterns**       | Name substrings that identify signals Unity writes to the PLC (e.g. `"Unity"`) |
| **Output Patterns**      | Name substrings that identify signals the PLC writes to Unity                  |

### Bridge Configuration

| Property                  | Description                                                                         |
| ------------------------- | ----------------------------------------------------------------------------------- |
| **Publish Interval (ms)** | How often the bridge publishes signal updates over WebSocket (default: 5 ms)        |
| **Logging Level**         | Bridge log verbosity: Debug, Information, Warning, or Error                         |
| **Browse Paths**          | Data Layer path prefixes for signal auto-discovery (e.g. `plc/app/Application/sym`) |
| **Recursive**             | Browse sub-folders recursively when discovering signals                             |

Changes to bridge configuration are tracked and auto-applied after a short delay.

### Data Layer Settings

| Property                      | Description                                                                      |
| ----------------------------- | -------------------------------------------------------------------------------- |
| **Min Publish Interval (ms)** | ctrlX Data Layer global minimum publish interval in milliseconds (default: 10)   |
| **Min Sample Interval (µs)**  | ctrlX Data Layer global minimum sample interval in microseconds (default: 10000) |

**Buttons:**

* **Get DL** — Reads current Data Layer subscription settings from ctrlX
* **Apply DL** — Writes the configured values to ctrlX Data Layer settings

### Bridge Logs

| Property               | Description                                           |
| ---------------------- | ----------------------------------------------------- |
| **Log Count**          | Number of log entries to fetch from ctrlX diagnostics |
| **Bridge Logs Only**   | Filter to show only bridge snap log entries           |
| **Forward to Console** | Write each fetched log entry to the Unity console     |

**Buttons:**

* **Fetch Logs** — Retrieves recent log entries from ctrlX OS diagnostics
* **List Packages** — Lists all installed snaps on the ctrlX OS device

### Advanced

| Property                  | Description                                                                               |
| ------------------------- | ----------------------------------------------------------------------------------------- |
| **WebSocket Port**        | TCP port for WebSocket communication (default: 8080, auto-set to 443 when SSL is enabled) |
| **Update Cycle (ms)**     | Communication thread update interval in milliseconds                                      |
| **Client Name**           | Identification name sent during WebSocket handshake                                       |
| **Connect On Play**       | Automatically connect when entering play mode                                             |
| **Only Transmit Changed** | Only send signals whose values changed since the last cycle                               |
| **Auto Reconnect**        | Automatically reconnect on connection loss                                                |
| **Debug Mode**            | Enable detailed logging for troubleshooting                                               |

## SSL / Reverse Proxy

When **Use SSL** is enabled:

* The port is automatically set to **443**
* The WebSocket path is set to `/ctrlx-rv-bridge/ws` for routing through the ctrlX reverse proxy
* All REST API calls use HTTPS
* Self-signed certificates are accepted (common for ctrlX devices on local networks)

When SSL is disabled, the interface connects directly to the bridge on port **8080** without encryption.

## Troubleshooting

**"Refresh" shows no device info:**

* Verify the ctrlX address is correct and the device is reachable (`ping`)
* Check username and password — default is `boschrexroth` / `boschrexroth`
* Use **Test ctrlX** to verify REST API connectivity

**Bridge shows "not found":**

* Install the realvirtual WebSocket Bridge snap on the ctrlX device
* Check that the snap is in `active` state

**WebSocket stays "Disconnected" during play:**

* Verify the bridge snap is running on the ctrlX OS device
* Check **WebSocket Port** matches the bridge configuration (default: 8080)
* If using SSL, ensure port 443 is accessible and the bridge is behind the ctrlX reverse proxy
* Enable **Debug Mode** for detailed connection logging

**Signals not importing:**

* Check that **Browse Paths** point to valid Data Layer nodes (e.g. `plc/app/Application/sym`)
* Enable **Recursive** to discover signals in sub-folders
* Verify the PLC application is loaded and running on the ctrlX OS device

**Wrong signal directions after import:**

* Configure **Input Patterns** and **Output Patterns** to match your naming convention
* Or set the **Default Direction** to match the majority of your signals

## See Also

* [WebSocket Realtime Interface (Pro)](https://doc.realvirtual.io/components-and-scripts/interfaces/websocket-pro) — Base protocol, wire format specification, and code examples
* [Custom Interfaces (FastInterface)](https://doc.realvirtual.io/components-and-scripts/interfaces/custom-interfaces) — How to build your own interfaces
* [Signal Manager](https://doc.realvirtual.io/components-and-scripts/interfaces/interface-tools/signal-manager) — Managing PLC signals
* [Interfaces Overview](https://doc.realvirtual.io/components-and-scripts/interfaces) — All available interfaces
* [ctrlX OS Overview](https://www.ctrlx-os.com/) — Information about ctrlX OS
* [Bosch Rexroth ctrlX AUTOMATION platform](https://www.ctrlx-automation.com/) — Information about the automation toolbox


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.realvirtual.io/components-and-scripts/interfaces/ctrlx.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
