System designTroubleshooting

Why vision guided robot offset correction shifts x and y

Vision guided robot offset correction fails in x and y when the angle rotates about the wrong origin; here is the vector rotation that fixes one-image picking.

LumaSpec Vision12 min read Share on LinkedIn

On this page 8 sections
  1. 01Why does the angle land right but x and y shift when I correct from one image?
  2. 02Which origin does the angle correction have to rotate around?
  3. 03How do I rotate the x and y offsets with the vision angle?
  4. 04How do I check the angle sign and the frame direction?
  5. 05How do I set the frames so no rotation math is needed?
  6. 06How do I test the correction on a real part?
  7. 07When are two images still the better answer?
  8. 08Questions

An eye-in-hand camera finds the part, the robot corrects the angle, and the pick lands tens of millimetres to one side. Angle right, x and y wrong, and only after the move from two images to one: that pattern shows up on every robot and every camera, because the cause is arithmetic, not hardware. The angle correction swings the taught pick point around an origin that is not the point the vision offsets were measured from, and the unrotated lever arm lands in your x and y. This guide gives the rotation formula, the chord number that identifies the fault on the spot, the frame rules that remove the math entirely, and a four-step bench test that proves the fix before the cell runs.

Why does the angle land right but x and y shift when I correct from one image?

Because the angle correction rotates the taught pick point around an origin the vision offsets were not measured from, the point itself moves before your x and y are applied: at 30° with a 150 mm lever arm, it swings about 78 mm.

Track three points. The vision origin O is the reference the camera measures x and y from, usually the trained model origin on the part. The taught pick point P is where the tool must finish when the part sits dead on. The lever arm r = P - O connects them. When the camera finds the part displaced by t and turned by θ, the correct landing is O + t + R(θ) × r, with R(θ) the planar rotation for θ. Single-image code that commands P + t drops the R(θ) × r term, and the miss is the chord:

miss = 2 × L × sin(θ / 2)

L is the lever-arm length. For L = 150 mm and θ = 30°: 2 × 150 × sin 15° = 300 × 0.2588 = 77.6 mm, aimed across the lever and on the same side every time for one rotation direction. Two-image picking never showed this, because the second exposure re-measures x and y after the wrist has already turned, so the swing sits inside the fresh measurement.

The size and shape of the error names the layer that is broken:

What you see First cause to test Test Fix
Angle good, x and y off by tens of mm, growing with angle Lever arm r never rotated Compute 2 × L × sin(θ/2); it matches the miss Rotate r by θ, or teach the vision origin on the pick point
A +x shift of the part reads as -x Mirrored axis: image y runs down, robot y runs up Turn the part +10°; vision reports -10° Flip the angle sign and one axis
x and y come back swapped Camera rolled 90° on the gripper Shift the part in +x; vision answers in y Rotate vision results by the mount angle first
The same few mm at every angle, 0° included Teach zero or hand-eye drift A dead-centre part must read 0.0 mm, 0.0 mm, 0.0° Re-teach the reference, recalibrate the camera
Tenths of a mm, worst at the field edge Distortion or pixel scale Grid target across the whole field Distortion correction before measurement

If your pick point instead sits off in one fixed direction at every angle, that is the calibration family, not this math: start with diagnosing an eye-in-hand pick point offset.

Which origin does the angle correction have to rotate around?

Around the point your vision system measures x and y from — the trained model origin on the part — not the camera sensor centre, the robot flange or the user-frame zero, and the pick point must rotate with it.

One rotation centre per correction, and the translation and the rotation must live in the same frame. Rotating about the flange swings the whole tool; rotating about the user-frame zero swings the whole pallet position. Only the part reference keeps the taught pick point glued to the part it belongs to. A vision tool that reports offsets from a taught reference already uses this centre; one that reports raw stage coordinates does not, and its numbers must be shifted into the robot frame first.

That shift is one rigid transform, camera frame to robot user frame. The homogeneous transformation matrix in camera-guided motion is the piece to reuse, and for a camera bolted to the gripper the robot-held camera calibration with a TCP tool frame ties that transform to the tool. The decision: if you can place the vision origin on the pick point, do that and the rotation formula disappears; if you cannot, keep the formula in the next section.

How do I rotate the x and y offsets with the vision angle?

Rotate the pick point's lever arm by the reported angle with the planar rotation matrix, then add the result to the vision translation and turn the wrist by the same angle.

x' = x × cos θ - y × sin θ y' = x × sin θ + y × cos θ

The formula applies to the lever arm r, not to the vision translation t. Quick case: a pick point 10.0 mm out on x, corrected by 30.0°, ends at 10.0 × cos 30° = 8.7 mm on x and 10.0 × sin 30° = 5.0 mm on y — the arm keeps pointing at the same spot on the turned part.

Full example with the numbers you would log. The taught pick point sits 12.0 mm in x and 5.0 mm in y from the vision origin, so L = √(12.0² + 5.0²) = √169 = 13.0 mm. The camera reports t = (10.0, -4.0) mm and θ = 25.0°. With cos 25° = 0.9063 and sin 25° = 0.4226:

x' = 12.0 × 0.9063 - 5.0 × 0.4226 = 10.88 - 2.11 = 8.76 mm y' = 12.0 × 0.4226 + 5.0 × 0.9063 = 5.07 + 4.53 = 9.60 mm

The commanded correction from the vision origin is t + r' = (10.0 + 8.76, -4.0 + 9.60) = (18.8, 5.6) mm, with the wrist at 25.0°. Two independent checks prove it: √(8.76² + 9.60²) = √(76.7 + 92.2) = 13.0 mm, the taught length unchanged; and skipping the rotation would have missed by 2 × 13.0 × sin 12.5° = 26 × 0.2164 = 5.6 mm, the chord from the first section.

Compute this in exactly one place, the vision script or the robot program, and log x', y' and θ with every image; cells that compute it in both places drift apart silently. The corrected offsets then travel to the motion side like any other part data, and the TCP handshake for sending camera part coordinates to a robot controller keeps both sides honest. For how these numbers land in robot offset registers in a production cell, this walk-through of vision offset calculation for robot applications covers the register side. The wrist turn also swings the approach direction, not just the landing point; set the variable pick approach offsets once the position math holds.

How do I check the angle sign and the frame direction?

Turn one test part by a known +10° in the robot frame and read the vision angle: a -10° report means the vision y axis points opposite the robot y axis, and every correction is mirrored until you flip the sign.

Image rows count down from the top of the sensor while robot frames count up, so there is one built-in mirror between the two worlds, and a camera rolled 90° on the gripper adds a swap. The pure-shift test separates sign faults from lever-arm faults in one move: push the part 10.0 mm in robot +x. Vision answering 10.0 mm in y means swapped axes; answering -10.0 mm means a mirror; answering 10.0 mm in x clears the axes and leaves the lever arm as the only suspect. Fix a mirror by negating the angle and one axis before the rotation formula; fix a swap with the constant 90° rotation (x, y) → (-y, x).

Rotating the bitmap so the part appears upright before you measure is a different operation with its own failure modes; arbitrary-angle image rotation in machine vision covers it. Centroid origin conventions can add half a pixel, about 0.05 mm at 0.10 mm per pixel: real, but invisible next to a 77.6 mm lever-arm miss. The details are in half-pixel offset in blob centroid.

How do I set the frames so no rotation math is needed?

Teach the vision origin exactly on the taught pick point with its axes parallel to the robot user frame: the lever arm becomes zero, the swing term disappears, and the vision x and y add straight onto the taught position.

Teach the user frame on the pallet first, then teach the vision reference so its origin lands on the pick point itself. With r = 0, the commanded position is the taught position plus the vision translation, and the angle goes straight to the wrist — no rotation of offsets, nothing extra to log. Keep the formula for the cases where the origin cannot sit on the pick point: pick points at a part edge, or a TCP deliberately offset from the part centre. Both routes need the camera-to-robot transform healthy, so check it after every collision and after any restart that rehomes differently; robot camera calibration lost after restart has the diagnosis path. Pallet cells that stack grid patterns on top of single-part correction should also read pallet pattern offsets taught in user frames.

Confirm the transform at the real working distance with a dot-grid calibration target from lens accessories: 0.5 mm dots on a 76 × 76 mm board put a known length under the camera where the picks happen.

Lens accessoriesCalibration boards and depth-of-field rulers, dot diameter 0.5 mm, dot grid, 76 x 76 mm (LS-LXR-0029)LS-LXR-0029
Type
Calibration targets
$189.00View partBuild a system with it

If you would rather mount the camera fixed above the pallet, the stand is the frame: this machine-vision camera stand from camera stands puts the camera at a 700 mm height on a 400 × 450 mm base, and a column that does not move is frame stability a bracket arm cannot give you.

Camera standsMachine vision camera stand, professional slide-table type, height 700 mm, 400 x 450 mm base (LS-MNT-0040)LS-MNT-0040
Type
Camera stands
$629.00View partBuild a system with it

Run the vision process and the offset math together on a vision controller from vision controllers: with 4 built-in channels driving the lights and 8 GB of memory, the calibration, the rotation step and the logs live in one box instead of being split between camera script and robot program.

Vision controllersHikrobot MV-VC3301H-128G66 I3-8100, 8GB+128G SSD, No PoE, PCIe expansion supported, Incl. VM6200Pro licenseMV-VC3301H-128G66
LAN ports
5+ LAN ports
USB 3 ports
3-4 USB 3 ports
Light outputs
4 built-in channels
Memory
8 GB
$2,419.00View partBuild a system with it

How do I test the correction on a real part?

Run four deliberate misplacements in this order — dead centre, pure shift, pure rotation, shift plus rotation — and compare the commanded corrections against the formula; all four must match within a few tenths of a millimetre.

  1. Dead centre. Place the part on the taught pose. Vision must read 0.0 mm, 0.0 mm, 0.0°; trim the model origin until it does.
  2. Pure shift. Move the part 10.0 mm in robot +x. Expect x = 10.0 mm, y = 0.0 mm, θ = 0.0°. A y component means swapped axes; a negative x means a mirror.
  3. Pure rotation. Turn the part 15.0° about its reference mark. Expect θ = 15.0° and a position correction of 2 × 13.0 × sin 7.5° = 26 × 0.1305 = 3.4 mm along the chord — zero only when the vision origin sits on the pick point.
  4. Shift plus rotation. Move the part 10.0 mm in +x and turn it 30.0°. With the 12.0 mm / 5.0 mm arm from the worked example: x' = 12.0 × 0.866 - 5.0 × 0.500 = 7.9 mm and y' = 12.0 × 0.500 + 5.0 × 0.866 = 10.3 mm, so the commanded correction is (10.0 + 7.9, 0.0 + 10.3) = (17.9, 10.3) mm at 30.0°.

Close the test with twenty picks spread across the pallet, logging the residual on each. A healthy single-image cell lands within ±0.5 mm and ±0.5° of the two-image result. From there, the full 2D vision guided pick cycle runs on one exposure.

When are two images still the better answer?

Keep the second image when the part sits more than about 45° off, when it is tall enough that rotating the wrist changes what the camera sees, or when the correction would put the gripper between the lens and the part.

The flat rotation assumes the camera looks nearly straight down at a flat part. Beyond roughly ±45° of correction, or on parts tall enough that the pick height carries the feature out of the calibration plane, perspective enters x and y faster than planar math can absorb. A second exposure after the wrist turns re-measures everything in the final pose and absorbs it for you. Occlusion decides it too: fingers between lens and part after the turn means re-image. The committed rule for a pallet cell: single image with the lever-arm rotation for flat parts within ±45°, an automatic second exposure above that angle kept as the gated fallback path.

Single-image picking is the faster cell whenever the geometry allows it, and the arithmetic fits in four lines. Make the frames coincident where you can, rotate the lever arm where you cannot, and prove the result with the four-step test. Size the rest of the station from the stand step of the configurator, or bring the taught point, lever arm and angle range to the contact page and we will check the math with you.

Questions

How large is the miss if I skip the lever-arm rotation?

The chord 2 × L × sin(θ/2) sets it. A 40 mm lever at a 20° correction misses by 2 × 40 × sin 10° = 13.9 mm; at 40° the same arm misses by 2 × 40 × sin 20° = 27.4 mm. The miss is zero at zero angle whatever the arm length, which is why two-image picking never showed it.

Does the rotation go on the tool offset or on the user frame offset?

Either works, as long as the rotation and the translation are applied in the same frame about the same origin. For an eye-in-hand pick, turn the wrist by θ and add the rotated lever arm plus the vision translation to the taught position in the robot user frame. Splitting the two across different frames rebuilds the same shift.

How do I correct for a camera mounted at 90° on the gripper?

Apply one constant rotation before anything else: with a 90° mount, (x, y) maps to (-y, x) and the reported angle shifts by 90° in the roll direction. Bake it into the camera-to-robot transform once at set-up rather than per image, and the lever-arm rotation from the guide then applies unchanged.

What residual error is normal after the fix?

Expect the single-image pick to land within a few tenths of a millimetre of the old two-image result. A constant 1 to 2 mm that survives the four-step test points at a stale camera-to-robot calibration; tens of millimetres that scale with angle mean the lever arm is still unrotated. Tenths that grow toward the field edge are distortion.

Can lens distortion or the half-pixel origin cause this shift?

Not this one. Distortion at the field edge and the half-pixel centroid convention cost hundredths to tenths of a millimetre at normal pixel scales. A shift that appears only when the angle correction runs and grows with the angle is the unrotated lever arm. Fix the frame math first, then trim the pixels.

Should the second image be deleted from the program?

Keep it as a gated fallback, not the main path. Run the single-image correction with the lever-arm rotation, and re-image automatically when the reported angle exceeds your threshold, about ±45° for flat parts. You keep the speed on the common case and the margin on the rare one, with no program fork to maintain.