# Routing

Source: https://help.zira.us/docs/ai-vision/routing
Summary: Configure pallet routing with lanes, ordered decision stages, model selection, spec checks, business rules, and a default fallback.
Updated: 2026-09-16

Use the **Routing** tab when you want Zira to decide where a pallet should go after inspection.

Routing is built around fixed stages. The stages run in order so the most important decisions, such as hard defects and unreliable measurements, are checked before model-specific specs or business policies.

## Open the Routing tab

1. Open a pallet vision data source.
2. Click the **Routing** tab.

The Routing tab is available for pallet devices that support pallet routing.

## How routing works

Routing checks each pallet in this order:

1. **Defects**
2. **Measurement validity**
3. **Model selection**
4. **Spec validation**
5. **Business routing**
6. **Default fallback**

Rules inside a stage are checked from top to bottom. Put the highest-priority rule at the top of the stage.

When a rule matches, its output can set the pallet lane, disposition, and sometimes the selected model. If no rule matches in the earlier stages, the **Default fallback** output is used.

## Start with the lane catalog

Use **Lane Catalog** to define the lane names that rules can use.

1. In **Lane Catalog**, click **Add lane**.
2. Enter the lane name.
3. Press Enter or click the check button.
4. Repeat until the list matches the physical or logical routes you need.

Common lane examples include:

- **good-lane**
- **repair-lane**
- **scrap-lane**
- **odd-size-lane**
- **measurement-invalid-lane**

Keep lane names clear and stable. The rule editor and AI Routing Assistant both use this list.

## Configure defect rules

Use **Defects** for hard failures such as broken boards, missing boards, missing stringers, damaged blocks, major cracks, or other structural problems.

1. Open **Defects**.
2. Click **Add Rule**.
3. Enter a clear **Name**.
4. Choose the output **Lane**.
5. Enter a **Disposition** such as `Fail`, `Repair`, or `Scrap`.
6. Add the defect **Conditions**.
7. Leave **Enabled** on.
8. Turn **Snapshot** on when you want evidence saved for that decision.
9. Click **Create**.

Defect rules should usually come before sizing and policy rules. This keeps a broken pallet from being routed as only an odd-size pallet.

## Configure measurement validity

Use **Measurement validity** when the inspection result is not reliable enough for spec decisions.

Examples include:

- partial view
- invalid geometry
- low-confidence measurement
- blocked or missing measurement data

Route these cases to a lane such as **measurement-invalid-lane** so spec rules do not create misleading failures.

## Configure model selection

Use **Model selection** when one line can process more than one pallet model.

Model selection rules identify the pallet type by stable attributes such as:

- pallet size
- board count
- lead board count
- gap pattern
- catalog code

In this stage, set a **Model ID** such as `MODEL_A`, `4840_7_TOP`, or `BLOCK_4840`. Lane and disposition are optional here because the model is usually used by later stages.

After a model is selected, later rules can check **Model** in their conditions to apply model-specific specs or policies.

## Configure spec validation

Use **Spec validation** for dimensional and structural checks that decide whether a pallet meets its expected model specification.

Spec rules often check values such as:

- pallet length or width
- diagonal length
- board count
- lead board width
- board gaps
- stringer or block counts

For range checks, use **BETWEEN** or **NOT BETWEEN** and enter the range as two values, such as `47.5,48.5`.

When specs differ by model, add a **Model** condition first, then add the measurement condition.

## Configure business routing

Use **Business routing** for customer or site policies that are not pure defects or spec failures.

Examples include:

- blue pallets go to a blue pallet lane
- iGPS pallets go to a dedicated lane
- odd-size pallets go to repair or scrap
- a customer-specific pallet type takes a special route

Keep business rules after defect, measurement, model, and spec rules so policy decisions do not hide quality problems.

## Set the default fallback

Use **Default fallback** for pallets that do not match any earlier rule.

1. Open **Default fallback**.
2. Choose the fallback **Lane**.
3. Enter the fallback **Disposition**.
4. Click **Save**.

Most sites use a good lane and a passing disposition as the default fallback.

## Add conditions

Each rule needs at least one condition.

1. Choose the field you want to check.
2. Choose an operator.
3. Enter the comparison value.
4. Add another condition with **AND** or **OR** when needed.
5. Use brackets when part of the condition should be grouped.

Use **AND** when every condition must be true. Use **OR** when any one condition can make the rule match.

## Make a rule do something

A rule does not have to stop at choosing a lane. Any rule can also carry **actions** — things the
camera does the moment that rule matches. This is how a decision on the screen becomes something
that happens on the floor.

There are two kinds, and a rule can use either or both.

### Actuators — switch something on the machine

An actuator is hardware wired to the camera's relay outputs. Because a relay is just a dry contact,
anything that takes a contact closure can be driven from a routing rule:

- **An andon light** — turn the red lamp on when a severe defect is routed, and off again when the
  line clears.
- **A machine PLC** — stop or start the line, or fire an eject, by closing the contact the PLC is
  already watching.
- Anything else on a relay: a horn, a diverter, a gate.

To add one:

1. Open the rule and tick **Actuator**.
2. Pick the actuator and the relay it should drive.
3. Choose what to do — **on**, **off**, or **pulse**. A pulse also takes a duration, which is what
   you want for an eject or a momentary stop signal.
4. Save the rule.

Some actuators publish **named functions** of their own as well as plain relays. When the one you
pick has them, a **Function** option appears beside **Relay**, and the fields below it are whatever
that function asks for.

**Only actuators the camera currently reports as online can be chosen.** If a rule refers to one
that has gone away, it stays on the rule and is flagged as a warning rather than being silently
pointed at something else — so you can see what needs attention instead of discovering a rule now
drives the wrong relay.

### Webhooks — tell another system

A webhook sends an HTTP request when the rule matches, for notifying an MES, a scheduler, or any
service that should know. Tick **Webhook** on the rule, then set the URL, the method, any headers,
and the body. A rule can call more than one.

### Where actions belong

Put actions on the **rule that matches** — that is what the camera executes. The default fallback is
a lane-and-disposition safety net; it is not the place for an action.

If you need something to happen for pallets that no earlier rule caught, add a rule in the
**Default** stage and set it to always match. It behaves like any other rule, so it can carry
actuator and webhook actions.

## Is the camera actually using this?

Saving routing sends it to the camera, but a save is not proof the camera applied it — so the
toolbar tells you where each one has got to:

- **Awaiting sync** — saved, not yet confirmed by the device.
- **Syncing** — the camera has the change and is applying it.
- **Up to date** — the camera has confirmed it is running exactly what you saved.

When more than one camera is paired to the data source, each gets its own tag with its name, because
one finishing does not mean the others have. Hover a tag for the detail and the time it last synced.

The tags appear once the camera is connected and has reported in. Cameras reconcile on reconnect and
periodically, so one that was off when you saved will pick the change up on its own.

## Save routing changes

Some actions save as soon as you confirm them, such as adding a lane or saving the default fallback.

Use the **Save all** button in the top toolbar after reviewing the full routing setup. Use **Copy JSON** when you need to share the current routing setup for review or support.

Use **Reset to empty** only when you want to clear the routing rules and return to a blank routing setup.

## Routing and grading

Routing and grading are separate settings that can work together.

**Grading** controls the defect weights used to calculate the pallet score. **Routing** decides what lane and disposition to use. If your routing rules use **Pallet Score** or **Grade**, tune grading first, then configure the routing rules that reference those values.

## Tips

- Add lanes before creating rules.
- Put severe defect rules at the top of **Defects**.
- Use **Measurement validity** to catch unreliable data before spec checks.
- Use **Model selection** before model-specific spec validation.
- Keep **Business routing** for policy decisions, not defect explanations.
- Turn **Snapshot** on for decisions where saved evidence helps review or troubleshooting.
- Keep the default fallback simple and easy to recognize.

## Read next

- [Grading](/docs/ai-vision/grading) - Tune defect weights used by pallet score and grade-based routing.
- [AI Routing Assistant](/docs/ai-assistance/routing-assistant) - Draft or refine routing rules from a plain-language request.
- [Overview](/docs/ai-vision/overview) - Return to the AI Vision workspace overview.
