> For the complete documentation index, see [llms.txt](https://captic-2.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://captic-2.gitbook.io/docs/overview/hands-on/integrating-your-robot/integration-flow/protocols/opc-ua.md).

# OPC UA

A simple OPC UA handshake for reliable robot–vision and PLC–vision integration.

The Integration Flow includes OPC UA **client and server** nodes, under **opcua** in the palette. The Captic device can connect as a client to an OPC UA server on your robot controller or PLC, or offer its own OPC UA server.

OPC UA is often the preferred option in production because it is widely supported by robot and PLC brands, easy to monitor, simple to configure, and available by default on many platforms, including FANUC. No fieldbus hardware or wiring is needed.

## How OPC UA works

One device acts as the **server** and exposes data as variables. The other acts as the **client** and reads and writes those variables. Data is exchanged as structured values, not raw signals, which makes it easy to debug.

## Recommended handshake

For a robot–vision handshake, we recommend a small set of shared variables that represent commands, status and results. You build this handshake in your flow with the OPC UA nodes.

```
Robot                      Vision system
------------------------------------------------
CMD = 1
SEQ = SEQ + 1     ───────▶  Detect trigger
                          BUSY = 1
                          Run vision job
                          Write pose (X,Y,Z,A,B,C)
                          BUSY = 0
                          DONE = 1   (or ERROR = 1)
CMD = 0           ◀──────  Clear DONE / ERROR
                          Ready for next cycle
```

* `SEQ` detects new triggers (edge-triggered).
* `BUSY` shows the vision system is processing.
* `DONE` or `ERROR` signals completion.
* The pose is written only once the job has finished.

## Variable mapping

| Signal | Description                                |
| ------ | ------------------------------------------ |
| CMD    | Trigger from the robot (0 / 1)             |
| SEQ    | Sequence counter, incremented by the robot |
| BUSY   | Vision system is processing                |
| DONE   | Vision job completed successfully          |
| ERROR  | Vision job failed                          |
| POSX   | X position of the result                   |
| POSY   | Y position (POSX + 1)                      |
| POSZ   | Z position (POSX + 2)                      |
| ROTA   | Rotation A (POSX + 3)                      |
| ROTB   | Rotation B (POSX + 4)                      |
| ROTC   | Rotation C (POSX + 5)                      |

On robots that expose registers, such as FANUC, use one register type for all signals and place the pose values in consecutive registers from POSX.

For node details, see the [upstream documentation](https://flows.nodered.org/node/node-red-contrib-opcua).

{% hint style="info" %}
Questions about mapping or sequencing? Contact <support@captic.com>.
{% endhint %}
