Robot Visual Servoing: Close the Image Loop
Look at the target again after moving. Use the remaining image error to choose the next camera motion instead of trusting a single reconstructed target pose.
Why Does This Exist?
An arm computes a target pose from one image and moves toward it. Small calibration or pose errors remain at the destination. Visual servoing closes feedback around visual measurements: observe features, compare them with a desired observation, compute motion and observe again. That correction can continue during approach.
A pinhole camera maps a point at in camera coordinates to normalized image coordinates . Perception geometry explains this projection. Image-based visual servoing, or IBVS, uses such feature coordinates directly as its controlled output. Position-based visual servoing uses an estimated three-dimensional pose. This page derives the image-based velocity relationship; it does not replace joint tracking or a collision-free approach plan.
Think of It Like This
Centering a distant sign in a camera viewfinder
If a sign appears to the right of your desired position, shift the camera right without rotating it: the stationary sign moves left in the image. Look again and reduce the next shift as the sign approaches its mark. The image offset maps to feedback error, your hand motion to camera velocity, and repeated looks to the feedback cycle. The analogy stops when you rotate, approach or lose the sign; those motions change projection differently and require more than a horizontal rule.
How It Actually Works
What converts camera motion into feature motion?
For a stationary scene point and camera velocity , expressed in the camera frame, the interaction matrix is
The components are linear speeds in m/s; the components are angular speeds in rad/s. Depth is in metres. The rows follow by differentiating the projection and using point motion relative to a moving camera. The minus sign on is why camera-right motion produces image-left motion. Chaumette and Hutchinson's primary tutorial derives this matrix and discusses depth estimates, singularities and local convergence.
Stack feature coordinates into vector , desired coordinates into and their interaction matrices into . Error is . A common velocity request is , where is a gain in inverse seconds, means pseudoinverse and the hat marks an estimated matrix. For a correctly modeled attainable error direction, this aims at . It is a local relationship: a pseudoinverse does not provide global convergence, joint feasibility or feature visibility.
Compute one lateral correction
Restrict the camera to horizontal translation, hold scene depth at 1 m and set desired normalized horizontal coordinate to zero. Start at , so error is 0.2. With focal length pixels, pixel error is pixels relative to the principal point. The scalar relation is . Using s⁻¹ and correct depth gives m/s rightward.
Hold that command for s. The camera translates 0.04 m right; the point's camera-relative horizontal coordinate drops from 0.2 to 0.16 m while depth stays 1 m. Hence normalized coordinate becomes 0.16 and pixel error becomes 80 pixels. The SVG uses identical image scales in both panels, with 0.7 drawing units per pixel. Dashed lines mark desired image coordinates; the mint diamond is the corrected feature. The bottom arrow is the camera command direction, not its physical displacement scale.
How wrong can the estimated depth be?
With depth estimate and true depth , the same restricted held-command update is
Correct depth gives factor 0.8. Doubling estimated depth gives factor 0.6 and a larger correction; the loop can overshoot or diverge when the gain, sampling interval and depth ratio make the factor's magnitude at least one. In this ideal scalar case, decay requires . This is not a stability criterion for general six-axis IBVS with delay, changing depth and joint saturation.
How does the camera request reach the arm?
Use hand-eye calibration to relate camera and tool motion. Transform the camera twist consistently, then map through the arm Jacobian or form a combined feature-to-joint Jacobian. Apply joint, velocity and visibility constraints inside that control design. Blindly clipping individual joints changes the feature motion predicted by .
One point supplies only two image constraints and cannot determine arbitrary six-component camera velocity. Multiple, well-distributed tracked features improve constraint coverage; even sufficient feature count can leave singular geometry or pose ambiguity. Damping bounds inverse amplification but trades tracking accuracy for restraint near weakly observed directions.
IBVS avoids requiring a full target pose at every update, but still needs reliable features, an interaction model and timely images. Position-based control can make workspace motion easier to interpret when pose is reliable, at the cost of dependence on that estimate. Use geometric planning for large unseen moves; reserve image correction for conditions where features remain visible and the local model is useful.
Code
This standalone Python repeats the restricted lateral update and checks it directly against geometric translation. It is an offline teaching model, not a robot driver.
def lateral_step(x: float, depth: float, depth_estimate: float, dt: float, gain: float) -> tuple[float, float]: if min(depth, depth_estimate, dt, gain) <= 0: raise ValueError("Depths, timestep and gain must be positive") speed = gain * depth_estimate * x point_x = x * depth - speed * dt return point_x / depth, speed
x = 0.2for _ in range(3): x, speed = lateral_step(x, 1.0, 1.0, 0.1, 2.0) print(f"camera {speed:.3f} m/s, pixel error {500*x:.2f}")wrong, _ = lateral_step(0.2, 1.0, 12.0, 0.1, 2.0)assert abs(wrong) > 0.2print(f"large depth error: {500*wrong:.2f} pixels")The three lines give camera speeds 0.400, 0.320, 0.256 m/s and pixel errors
80.00, 64.00, 51.20. The excessive depth estimate gives -140.00 pixels:
the feature crosses the target and the error magnitude grows.
Watch Out For
Image error grows after every correction
Check whether the commanded velocity describes the camera moving through the scene or the scene moving relative to the camera. For this convention, positive camera x produces negative feature x. Verify a small recorded motion and its measured image shift before increasing gain; a sign error cannot be tuned away.
A good image step is physically infeasible
Features approach their targets while joints saturate, the camera loses another feature or the tool approaches an obstacle. Model the camera-to-joint mapping and constraints together. Timestamp the exposure and reject stale features; feature-error reduction alone does not establish clearance or whole-body stability.
The Quick Version
- Visual servoing repeatedly corrects motion from measured visual-feature error.
- The interaction matrix maps camera twist to image-feature velocity and depends on geometry.
- The worked rightward camera shift reduces the example error from 100 to 80 pixels.
- Depth uncertainty, gain and sample interval jointly affect the correction.
- Image convergence requires appropriate features and does not imply joint or collision feasibility.