A UR program that opens its own TCP socket to load a camera job, followed by vision-guided steps that run through the camera's vision URCap node, works as two separate programs and fails as one. After a mid-run job load, the vision step sends its request and nothing comes back; the camera answers again only after its address is re-entered or it is power-cycled. Here you will find why a job switch kills the session, four causes ranked by how often each turns out to be the guilty one, ten-minute tests for every cause, two connection patterns that fix the merged program, and the cycle-time cost of each choice.
The symptom: each program passes alone, the merged run hangs
Each half works by itself. Program one opens the socket, sends the job-load command the camera manual defines and gets its acknowledgement. Program two runs the pick or the place through the camera's vision URCap node. Merged into a single run — connect, load the pick job, vision-guided pick, load the place job, vision-guided place — the vision step that follows a load stops receiving answers. Requests time out, the program faults or waits forever, and the sensor comes back only when someone re-enters its IP address in the vision URCap setup or power-cycles it.
That recovery detail is the fingerprint. A reset that clears the fault means a dead session was still registered on the sensor; a clean sensor needs no reset. The same root cause appears as a camera that drops offline mid-run with nobody having closed a connection, which is why disconnect detection that keeps the robot program running belongs in the same program as the fix below. A near neighbour — the sensor answers after a load but the first images are wrong or missing — is the ready-gate problem in why a smart camera misses its first images after a load.
Why the camera goes quiet, most likely cause first
Four causes produce this signature. Test them in this order.
- The job load restarts the sensor's network server. A job file is a whole application. When the sensor applies it, its Ethernet service stops and starts again, and every TCP session — yours and the vision node's — is dropped on the sensor side. TCP warns a client of nothing until its next send, so your socket sits half-open while the node's pending request is answered by nobody.
- The client table is full. Embedded vision servers accept a small, fixed number of clients per port; treat it as one unless the sensor's manual states more. Your raw session then occupies the slot the node needs, so its connect is refused or its request never queues — the same one-camera-two-clients trap as reaching a camera's parameter tree over TCP from a second application.
- You send while the sensor is still re-initializing. The old session acknowledged the load command, the application then restarts, and anything sent in that window lands on a listener that no longer exists.
- The node trusts its cached connection. The vision node keeps its session state from the previous run and does not re-handshake after foreign activity on the sensor — the leftover-state trap that also makes camera tests flaky on leftover settings until everything starts from a known state.
Test each cause in ten minutes
Run the merged program three times with one change each time, and the failing cause names itself.
- Remove the job loads. If both vision steps now pass, the load path is the trigger and the cause is 1 or 3.
- Close the raw socket before each vision step. Open, send the load, wait for the acknowledgement string, close, then run the vision node. If everything passes, you had cause 2: concurrent owners on a one-client server.
- Time the restart window. After a load, try a raw connect every 100 ms and record when the first one succeeds. On an embedded vision sensor expect 0.5 to 2 s; that measured value becomes the ready-poll cap in the fix.
-
Check the open result. Assign it to a boolean:
open_ok = socket_open(camera_address, camera_port), with those two set to your cell's address and port. A false return from a camera that answers a ping means the session layer, not the network — reconnect on false: close, wait 0.5 s, try again, the pattern in fixing a robot socket that gives no response. If a clean program restart still leaves the sensor deaf, re-enter the camera's address once at the bench; if that revives it, cause 1 is confirmed.
Run the first merged cycles at reduced speed with the arm clear of the fixture, so a vision timeout stops the motion instead of finishing it blind.
The fix: one owner per run
Decide in this order. First, if one job file can run both inspections, load it once and skip switching entirely: no switch, no dropped session, full cycle rate. Second, if the jobs must switch, give the camera exactly one connection owner per run and route every load through it. Third, whichever pattern you pick, check every open and send result and reconnect on failure, which turns a dropped session into a 1 s pause instead of a stopped cell. One more cut: configure the sensor to auto-load its startup job, as in set your vision sensor to auto load its job on startup, so every cycle starts in the pick job and needs at most one switch.
Pattern A: route everything through one persistent session
Use this when the vision steps are plain socket transactions — trigger command in, result string out — and no separate vision node needs its own session.
- In the program's start routine, open once:
open_ok = socket_open(camera_address, camera_port). - On a false result, close, wait 0.5 s and retry; after three failures, fault the program, so a dead sensor stops the cell instead of looping forever.
- Send the job-load string for job A from your command table — one line per job, the same one-command-one-recipe discipline as RS232 vision recipe selection with unique command codes.
- Poll readiness: send a light status request every 100 ms until a reply arrives; cap at 2 s, or 5 s for large job files.
- Trigger the inspection and read the result string over the same session, parsing it field by field the way four vision results parsed from one socket string on a UR10e shows.
- For the place job, repeat steps 3 to 5 on the same session. Never open a second one mid-run.
- Close in the end routine and on every error path before any reopen.
If you rehearse the program in the offline simulator first, its socket sessions pause differently from the real controller's; the URSim socket control notes for UR10 program pauses explain the difference.
Pattern B: sequence the sessions strictly
Use this when the vision steps must run through the camera's vision URCap node, so the node owns the working session.
- Open a raw socket, send the load command for job A, wait for the acknowledgement string, then close the raw socket — four instructions, always in that order.
- Probe the sensor: try a raw connect every 100 ms; when one succeeds, close it immediately. The successful connect is your proof the server is back, and closing the probe frees the slot for the node.
- Run the vision node step for the pick.
- For the place job, repeat steps 1 to 3 with job B's load command.
- On any fault anywhere in the run, close every session you opened before the program stops, so the next start begins clean.
What a mid-program job switch costs in cycle time
Worked example. Take a pick-and-place cell with a 6.0 s base takt and one job switch per part. On an embedded vision sensor a measured switch typically breaks into 0.4 s to apply the job file, 0.6 s of server restart before a connect succeeds again, and 0.2 s to reconnect and verify — 1.2 s total. The effective takt is 6.0 + 1 × 1.2 = 7.2 s, so throughput falls from 3600 / 6.0 = 600 parts/h to 3600 / 7.2 = 500 parts/h: 100 parts/h lost, 16.7% of capacity, for one command in the middle of the program.
The fix changes the numbers. Pattern B's readiness poll replaces the fixed post-load wait, so the same switch costs about 0.7 s — 0.4 s apply, 0.2 s average poll, 0.1 s verify — and the takt lands at 6.7 s: 3600 / 6.7 = 537 parts/h. Merging both inspections into one job file sets n_switch = 0 and keeps the full 600 parts/h. Log your own three numbers once — timestamps around a single load — and substitute them; the 0.4 / 0.6 / 0.2 split above is the starting estimate for this class of sensor, and large job files move the apply time up first.
When to move the switching off the sensor
Two situations change the answer.
The PLC or an operator changes recipes. The same server restart happens no matter who sends the load, so one owner and a ready poll still apply; the extra failure there is the trigger race, covered in vision format selection timing and PLC trigger races. Over serial there are no TCP sessions for a load to drop, one reason local vision recipe switching from operator buttons often rides a serial line in real cells.
Several cameras or heavier logic join the cell. Then move the vision application onto a vision controller: the software owns each camera exclusively, so job switching happens inside one application with no second TCP client to fight, and the robot link rides its own LAN port — see the vision controllers category. The MV-VC3301H-128G66 lists an Intel Core i3, 8 GB memory, 5+ LAN ports and 4 built-in light channels, with a vision software license included.
- LAN ports
- 5+ LAN ports
- USB 3 ports
- 3-4 USB 3 ports
- Light outputs
- 4 built-in channels
- Memory
- 8 GB
The three controllers below span a compact N-series box, a Core i3 mainstream box and a PoE-equipped Core i5 box:
| Specification | MV-VC2140-128G40-1T | MV-VC3301H-128G66 | MV-VC5525-256G70-NN |
|---|---|---|---|
| CPU | Intel® Processor N97 | Intel® Core i3-8100 | Intel® Core i5-12400 |
| Memory | 8 GB | 8 GB | 32 GB |
| Storage | 128 GB SSD + 1 TB HDD | 128G SSD | 256 GB SSD |
| GPU | Intel® UHD Graphics | Intel® HD Graphics 630 | Intel® UHD Graphics 730 |
| Operating system | Unactivated 64-bit Windows 10 LTSC 21H2 | Windows 10 64-bit, Not activated | Unactivated Windows 10 |
| Encryption method | Not support | VM6200Pro license key | – |
| Video output | HDMI interface × 1, VGA interface × 1; Supports independent display outputs at the same time; Max. resolution 1920 × 1080 @ 60 Hz | HDMI interface × 1, VGA interface × 1; Supports independent display output at the same time; Max. resolution 1920 × 1080 @ 60 Hz | HDMI interface × 1, VGA interface × 1; Supports independent display output at the same time; Max. resolution 1920 × 1080 @ 60 Hz |
| Digital I/O | Opto-isolated input × 8; Opto-isolated output × 8 | 8 digital isolated inputs supported; 16 opto-isolated outputs supported (NPN/PNP switchable) | Opto-isolated input × 8; Opto-isolated output × 12 ( supports NPN/PNP switching), digital-isolated low-side driver output × 8; Non-isolated bi-directional differential I/O × 4 |
| Light interface | Light interface with 24 VDC constant voltage × 4; (Brightness is adjustable. Max. current 3 A for single light interface, and total max. power consumption 80 W. Supports light mode switching between strobe and solid via external control) | 4-channel 24 V constant-voltage light drive, Max. power per channel: 72 W, Max. power (4 channels): 150 W | 24 VDC constant voltage × 8; (Max. power consumption of single channel is 72 W, total max. power consumption 190 W) |
| Network interface | GigE interface × 4 | 6× Gigabit Ethernet ports | GigE interface × 7, including interface for PoE × 4 |
| USB Interface | USB 2.0 × 2; USB 3.0 × 2 | USB 2.0 × 4; USB 3.0 × 4; Built-in USB 2.0 × 1 | USB 2.0 × 4, USB 3.0 × 4, built-in USB 2.0 × 1 |
| Serial Port | RS-232 × 1, supports switching to RS-485 or RS-422 | 2× full-function RS-232, RS-485/RS-422 switchable | RS-232 × 2 by default, supports switching to RS-485 and RS-422 |
| Price | $1,679.00 | $2,419.00 | $4,479.00 · quoted |
All 3 share: Certification CE, KC. Values as printed in each product's data sheet; open a part for its drawing and full specifications.
Prevention checklist
- One owner per run. The raw socket and the vision node never hold sessions at the same time; concurrent owners are cause 2 and the hardest to see.
- Check every open and send. Branch on the result, reconnect once on failure with a 0.5 s wait, fault on the second failure.
- Close on every exit path, faults included, so no half-open session survives to poison the next run.
- Poll readiness after each load with a 100 ms step and a cap that faults; never trust a fixed sleep.
- Auto-load the startup job so a cycle carries at most one switch, per the math above.
- Keep one command table: job file, load string and expected acknowledgement in one place in the program, the way a vision-guided pick-and-place program built around drop targets keeps its targets in one place.
- Log timestamps around loads so the measured switch cost stays current after firmware or job-file changes.
The decision, per case
- One job file covers both inspections: merge them. n_switch = 0, no session risk, and the example cell keeps its 600 parts/h.
- Jobs must switch, steps are socket transactions: Pattern A — one persistent session carries loads, triggers and results.
- Jobs must switch, the vision URCap node must acquire: Pattern B — load, acknowledge, close, probe, run; poll instead of sleep.
- Recipes change from the PLC or an operator panel: the same rules, plus the trigger-race fix; move the link to serial if races persist.
- The cell grows past one camera or past the sensor's logic: a vision controller owns the cameras and gives the robot its own port.
- Considering a background thread for the socket exchange: it keeps motion moving, but it makes connection ownership harder to see; get one owner working first, then thread it.
Pick the sensor for the merged cell in the camera finder or the smart cameras category, and the computing side in the vision-controllers category above. For a quoted multi-camera build, the quote page and the contact page are the direct routes, and the robot-side guides are collected on the robotics topic page.
Questions
Why does re-entering the camera's IP address bring the vision node back to life?
Re-entering the address forces the camera's network service to restart, which wipes the stale session entry the dropped job load left behind. That is why it works and why it is only a reset: the program that forgot to close its socket put the entry there in the first place. Add the close-and-reopen behavior and the reset becomes unnecessary.
How long should the program wait after a job load before its next request?
Expect 0.5 to 2 s on an embedded vision sensor, more for large job files. Poll rather than sleep: send a light status request every 100 ms, treat the first reply as ready, and cap the loop at 5 s with a fault. Measure your own window once and write the measured cap into the program.
Can the command socket stay open while the vision node runs?
Only when the sensor's documentation states how many clients its server accepts; assume one when it does not. With a one-client server your open session blocks the node, so either sequence the sessions or route the job loads through the node's own connection. Where several clients are documented, parallel sessions are fine and the persistent-session pattern still applies to each one.
Does switching jobs over serial instead of TCP avoid the problem?
Mostly yes: a serial job-selection link has no TCP session for the load to drop, so the server restart cannot break the command path. The sensor's network clients still restart, so the vision step's first request after a load still needs the ready poll. Assign one unique code per job so the selection stays unambiguous.
What timeout should each vision step use in the merged program?
Set the step timeout at roughly three times that job's worst-case processing time: a 300 ms inspection gets a 1 s timeout. On a timeout, close, reopen, resend once, then fault the cell. Two silent retries hide a degrading sensor, while the single retry plus a visible fault keeps the problem findable on the floor.
