Every part on the table detects cleanly, the robot moves in, and a jaw sweeps the neighbor piece across the fixture. The locate step did its job; the pick list did not. When a vibrating table or a loose parts feeder leaves two pieces closer than the gripper can work, fix it in the vision software: compute the center-to-center distance from every located part to its nearest neighbor, and reject any pick candidate inside the clearance rule before a position reaches the robot. Below are the rule, the arithmetic behind it, a worked example, and the bench test that proves the filter before it ever runs on the cell. The method applies to any taught-model or blob locate feeding a two-finger parallel gripper that picks parts by their external edges.
Why the detection threshold cannot fix a close pair
Raising the detection threshold does one thing well: when two parts touch, a higher threshold merges them into a single detection. Leave a visible gap of even about a millimetre and the model reports two parts again, because the gap is real contrast in the image. The detector reads contrast, not jaw geometry — nothing in it knows your fingers need 13 mm of air beside the part they close on. Spacing is a property of the output list, so it belongs in a filter after locate, not inside the detector's score.
The candidate list a taught-model pick produces is the same list this filter consumes: the generic method for auto-picking taught objects shows how the list is built, and locating part center points covers the x-y data the distance test reads.
The clearance rule: jaw thickness plus margin
For an external-edge grip, each closed jaw lands on the part's edge and its body extends one jaw thickness t beyond that edge, in the plane of the table. A neighbor must sit far enough away that this footprint plus a clearance margin c never touches it. Edge-to-edge that gap is g_min = t + c; between the centers of two equal parts of width w it is d_min = w + t + c. The bench rule doubles the jaw term to absorb gripper skew, pad compression and the small shift a part makes as the jaws close:
Here w is the part width across the gripped edges, t is the jaw thickness at the grip point, and c starts at 5-10 mm — or at twice your measured pick centering error, if that is larger. Checking the nearest neighbor is enough: if the closest pair passes the rule, every pair passes.
Worked example: a 40 mm part picked off a vibrating table
Inputs, each with its source:
- Part width across the gripped edges: w = 40 mm (part drawing; example value).
- Jaw thickness at the grip point: t = 5 mm (gripper drawing; example value).
- Clearance margin: c = 8 mm — the middle of the 5-10 mm range, chosen because the cell has no measured centering error.
- Snapshot field of view: 150 mm across, image width 1600 px (calibrated snapshot; example values).
Rule in words: a candidate survives only if its center-to-center distance to every other located part exceeds w + 2t + c.
Arithmetic:
- Edge-to-edge: g_min = 5 + 8 = 13 mm of air between the picked part's edge and its neighbor.
- Center-to-center: d_min = 40 + (2 × 5) + 8 = 58 mm. Carry 60 mm as the working number, because a whole value you can check with a ruler avoids bench arguments.
- Pixels: the scale is 1600 px / 150 mm ≈ 10.7 px/mm, so the pixel threshold is 60 × (1600 / 150) = 640 px between part centers.
Decision: reject any candidate with a neighbor closer than 60 mm center-to-center, which is 640 px in this snapshot; pairs at 60 mm or more pass. Drop to the strict 53 mm (40 + 5 + 8) only after you measure pick centering at 2 mm or better.
If you are still choosing hardware for the station, this calculator runs the conversion the other way: give it the field of view and the smallest distance you must resolve, and it shows the pixel count the camera needs.
Add the distance filter to the pick sequence
- Measure w across the gripped edges and t at the grip point. Set c to twice the measured centering error, or 5-10 mm unmeasured, and compute d_min.
- Calibrate the snapshot so candidate positions come out in millimetres: field of view across the working surface divided by image width gives the px/mm scale.
- Let the vibration finish, then run locate on a fresh snapshot and read the candidate list — x, y and match score for every part.
- Compute the distance from every candidate to every other. The smallest distance in each row is that candidate's nearest-neighbor distance.
- For a failing candidate, try the alternate grip axis first if the part shape offers one. Reject only when every allowed orientation fails, and when two parts fail as a pair, keep the higher match score.
- Sort the survivors by score or by gripper travel and release the first position.
- Re-snapshot after every pick: removing one part changes every remaining distance. If the extra snapshot stretches the cycle, trimming focus and exposure usually buys the time back, and the stream-versus-snapshot trap explains why a stale list fails at run time.
- Log every rejection with its pair distance. If filtered parts should be recovered at the end of the run, single-camera routing to a reject pusher shows the plumbing.
Prove the filter on the bench before it runs
Place two parts at three spacings and read the verdicts against expectation: at 50 mm center-to-center the filter must reject one candidate; at 60 mm both must pass; at 70 mm both must pass, and the arithmetic says the surviving edge gap is (70 − 40) / 2 = 15 mm against the 13 mm minimum. Then run 20 cycles with parts scattered the way the table leaves them. Every position the robot receives must show at least 13 mm between the picked part's edge and the nearest neighbor's edge, and the jaw-strike count must be zero.
Clearance for the gripper body, wrist and cable dress is a separate, larger check on the robot side; the minimum-clearance check before a robot pick covers that layer.
Mistakes that put the collision back
- Testing centers when the part is elongated. A 40 × 100 mm part has footprint corners about 54 mm from its center — 20² + 50² = 400 + 2500, √2900 ≈ 54 mm — so a center test can pass while a corner sits inside the jaw corridor. For parts more than about twice as long as wide, test the footprint corners or add the corner offset to the distance.
- Rejecting both members of a close pair. The weaker candidate fails; the stronger one often still has a clean grip on its far edge or its perpendicular edge pair.
- Filtering a stale list. Distances mean something only for the snapshot the robot is about to pick from.
- Skipping deduplication. A detector that reports one part twice produces a 0 mm self-pair that fails every threshold; deduplicate first, then apply spacing.
- Treating the threshold and the distance filter as rivals. The threshold suppresses false detections; the distance filter enforces jaw geometry. Keep both.
Where the filter runs when the camera app has no distance field
Some wrist-camera apps output finished picks only, with no slot for a spacing rule. Two paths keep the method intact.
Put locate and the spacing filter in one device: a smart camera or vision sensor holds the snapshot, the candidate list and the distance test on board. The MV-SC3050XC-16M-ATN-H is a 5 MP color vision sensor with a 1/1.45" global-shutter sensor, M12 lens mount and Fast Ethernet.
- Interface
- Fast Ethernet
- Resolution
- 5 MP
- Sensor format
- 1/1.45"
- Shutter
- Global
Write the filter yourself instead: point a GigE area scan camera at the table and run the spacing check in your own code on a vision controller. The MV-CU020-90GC is a 2.5 MP color GigE camera with a 1/1.7" global-shutter sensor on a C-mount, and the MV-VC2140-128G40-1T pairs an Intel N-series processor and 8 GB of memory with 3-4 LAN ports for the camera link.
- Sensor format
- 1/1.7"
- Lens mount
- C-mount
- LAN ports
- 3-4 LAN ports
- USB 3 ports
- 2 USB 3 ports
Layer the robot side too: several integrated-vision systems ship candidate guards of their own, such as too-many-candidates and empty-pallet checks that refuse a scene when the candidate count looks wrong. They sit behind your distance filter, not in front of it.
To size the camera and controller as a set, start at the camera configurator, or browse more applications guides. If the spacing numbers for your gripper and parts need a second pair of eyes, the contact page reaches the applications team.
Questions
Does raising the detection threshold merge parts that sit close together?
Only when the parts touch or overlap in the image. A higher threshold merges two detections when the gap between them is too faint to resolve; leave even about a millimetre of visible gap and both come back. The threshold reads contrast, not jaw geometry, so use it against false detections and leave spacing to the distance filter.
How much clearance should I leave between the jaw and the neighbor part?
Start at 5-10 mm on top of the jaw thickness and use at least twice the measured pick centering error if that is larger. A gripper that centers within 2 mm justifies the low end; a cell with no measurement gets 8-10 mm. The margin absorbs skew, pad wear and the last shuffle before the snapshot.
Should both parts be rejected when a pair fails the distance test?
No. Reject the weaker candidate first, then re-check the survivor against its remaining neighbors. If the part shape allows a grip on the perpendicular edge pair, test that orientation too: two flat parts 50 mm apart may be unpickable across their short edges yet pickable across their long edges. Reject a part only when every allowed grip orientation fails.
How do I convert the minimum distance from millimetres to pixels?
Divide image width by field of view to get the scale: 1600 px over 150 mm is about 10.7 px/mm. Multiply the rule by the scale — 60 mm at that scale is exactly 640 px, from 60 × (1600 / 150). Calibrate before you trust it: an unmeasured field of view moves the threshold by tens of pixels.
What changes when the table vibrates between the snapshot and the pick?
Trigger the snapshot after vibration stops and pick within the same cycle. If parts still creep after the snapshot, add the measured creep to the clearance margin: 2 mm of wander turns the 8 mm margin into 10 mm and the 58 mm rule into 60 mm. A stale list from the previous cycle is the most common source of surprise collisions.


