AutomateDirectUSAMotion LibraryIndustrial monitors & PCs

Troubleshooting

Why Hierarchical Feedback Loops on a Robot Arm Hunt

Servo and stepper motion Published 8 min read By AutomateDirectUSA engineering team

Short answer

A hierarchical robot arm hunts because an upper loop closes as fast as the loop beneath it, or because two loops write one setpoint. Keep each level's settling time about 5x the level below, measure the vision dead time Td and cap the visual loop gain at 0.5 divided by Td, then give elevation to vision in free space and to pressure after contact.

On this page
  1. Why does the arm hunt when every loop runs at the same speed?
  2. Which control level is oscillating?
  3. How do you test the joint servos with the upper loops off?
  4. How much slower should each loop be than the one below it?
  5. How much gain can the vision loop carry?
  6. Why do vision and pressure fight over elevation at touch-down?
  7. In what order do you fix the loops and verify the result?
  8. Questions asked

A robot arm with stacked feedback loops almost always hunts for one of two reasons: an upper loop closes as fast as the loop beneath it, or two loops write the same setpoint at once. Both show up as overshoot after a reference change, a sawtooth on the pressure reading, or chatter at touch-down, and neither is fixed by tuning the bottom loop harder. The stack has three levels: joint servos closing on potentiometer feedback with proportional-only control, endpoint loops that hold reach, elevation, lateral displacement, hand pitch and hand roll by rewriting joint setpoints, and a top level closing on marker distance from a camera plus hand pressure. Work bottom-up, because every level above can only be as stable as the one below it.

Why does the arm hunt when every loop runs at the same speed? #

Each loop must settle roughly 5x slower than the loop it writes setpoints to; an upper loop that reacts inside the lower loop's settling time sees that lag as dead time, loses phase margin as its gain rises, and drives both loops into a shared oscillation. Treat that figure as a rule of thumb for where to start, not a measured constant: it gives the lower loop time to finish before the upper loop judges the result. Industrial servo drives stack a current loop, a velocity loop and a position loop by the same ordering, which is what servo control loops in the drive or the controller works through; this arm adds endpoint and vision rings outside those position loops.

Which control level is oscillating? #

Match the symptom to the level before you touch a gain: one joint ringing alone points at level 1, an endpoint variable ringing only at extension points at level 2, and a slow large swing on marker distance or chatter at touch-down points at level 3. Read the table as suspects ordered by how cheap they are to check, never as verdicts; every row has a confirming check in the sections below.

Symptom Level and likely cause
One joint rings on a step, upper levels off Level 1: proportional gain too high for the motor and gear, or backlash
Small constant wobble at rest Level 1: stiction, deadband cycling or potentiometer noise
Reach or elevation rings only with the arm extended Level 2: loop gain changes with pose, because endpoint variables are nonlinear in joint angles
Slow, large oscillation on marker distance Level 3: vision gain too high for camera and detection latency
Chatter or elevation flipping at touch-down Level 3: pressure gain multiplied by surface stiffness, or vision and pressure both writing elevation
Hand drifts when the marker is hidden Level 3: a stale or zero distance fed in as a real error

How do you test the joint servos with the upper loops off? #

Freeze levels 2 and 3, write a setpoint straight to one joint servo, and log the potentiometer reading and motor command at the loop rate; a clean step with no overshoot clears level 1 and gives you its settling time Ts1. Repeat for every joint and keep the slowest settling time as Ts1. Read each outcome:

  • Clean approach, no overshoot: level 1 is fine; move up.
  • Overshoot or ringing: lower that joint's proportional gain, and do not add gain somewhere else to pay for it. A joint that buzzes only around its setpoint is a separate single-axis fault: see why a PID robot arm joint buzzes at setpoint.
  • Small constant wobble at rest: the loop is limit-cycling on stiction, backlash or potentiometer noise. Add a deadband around the setpoint or filter the potentiometer; raising gain makes it worse, for the reasons in why gain changes cannot smooth a rough servo axis.
  • Stops short under gravity load: expected with proportional-only control at low gain; leave it. Level 2 closes on endpoint variables and absorbs the offset at the cost of speed, so add a bias term or an integral only if the offset limits your reach.

Run these steps at reduced speed with the arm inside the guarding your machine's risk assessment calls for (ISO 10218-2 covers industrial robot cells), because a hunting arm moves without a command.

How much slower should each loop be than the one below it? #

Use roughly 5x slower as the starting separation: with the slowest joint settling time Ts1 measured, set the level 2 gain so endpoint steps settle in about 5 times Ts1, and check it with the arm folded and again fully extended. Keep vision off. Step reach, then elevation, lateral displacement, hand pitch and hand roll; log each computed variable against its reference and record its settling time as Ts2. If Ts2 sits close to Ts1, level 2 is treating level 1's lag as dead time: lower the level 2 gain or put a slew limit on the setpoints it sends down.

The effective gain from a setpoint change to an endpoint variable changes with pose, because the endpoint variables are nonlinear in the joint angles. Tune at the highest-gain pose, usually full extension; if ringing appears only at extension, schedule the gain by pose. Then check cross-coupling: a reach step that visibly disturbs elevation creates an error the pressure loop will later try to correct.

Calculated example, not a measurement: the slowest joint settles in Ts1 = 0.15 s, so target Ts2 at or above 5 × 0.15 = 0.75 s. A reach step that settles in 0.20 s means level 2 is closing nearly as fast as the joints; cut its gain until the step takes about 0.75 s.

How much gain can the vision loop carry? #

Cap the visual loop at K ≤ 0.5 / Td, where Td is the measured dead time from frame capture to the corrected setpoint being written; the loop goes unstable once K times Td reaches pi over 2, and the cap keeps about 61 degrees of phase margin. To measure Td, timestamp the frame capture and the moment the corrected setpoint is written. The dead time is camera exposure and transport, marker detection processing, and one frame period; read the frame rate from the camera settings. Treat level 3 as an integrator acting on level 2 setpoints with gain K in 1/s, and the loop then follows:

  • phase lag at frequency f (deg) = 360 * f * Td
  • stability limit: K * Td < pi / 2
  • target: K * Td <= 0.5 (phase margin about 61 deg)
  • oscillation period at the limit = 4 * Td

That limit is the Nyquist criterion: oscillation sustains where the loop gain is one at exactly the frequency where the lag reaches 180 degrees, and for an integrator with dead time that frequency sits at a period of 4 times Td.

Calculated example, not a measured result. A camera at 30 frames per second gives a frame period of 1 / 30 = 0.033 s. With exposure and transport at 0.005 s and detection at 0.012 s, Td = 0.033 + 0.005 + 0.012 = 0.050 s. The gain cap is then K = 0.5 / 0.050 = 10 1/s, the stability limit sits at K = (pi / 2) / 0.050 = 31 1/s, and the oscillation at that limit runs with a period of 4 × 0.050 = 0.200 s, which is 5 Hz.

Read the swing you measured against that period. A swing near 5 Hz on the camera loop confirms level 3: lower K, or cut latency by cropping detection to a region around the markers, locking the exposure, and dropping buffered frames so the newest frame is always used. A much slower or faster swing means the fault is below; go back to level 2.

Handle marker loss explicitly: when detection fails, hold the last setpoints. Never feed a zero or stale distance into the error term.

Why do vision and pressure fight over elevation at touch-down? #

Vision and pressure fight whenever both write the elevation setpoint with both errors nonzero, and contact multiplies the pressure loop's effective gain by surface stiffness, which is why chatter appears exactly at touch-down. Vision varies reach, elevation and the other level 2 setpoints; pressure varies elevation. The confirming check: log each loop's elevation contribution. Opposite signs while both errors are still nonzero is a conflict, not a tuning problem.

Contact raises the stakes further: a small elevation change produces a large pressure change, so a pressure gain that is quiet in free air chatters on a stiff surface. Fix it like this:

  • Give each loop its own variable where the task allows: vision on reach and lateral displacement, pressure on elevation.
  • Otherwise switch authority by mode: vision owns elevation in free space, and pressure takes it over after contact.
  • Lower the pressure gain until touch-down is quiet on the stiffest surface you will meet, and low-pass the pressure signal.

In what order do you fix the loops and verify the result? #

Apply the fixes bottom-up — joint tuning first, then level 2 separation, then the vision gain cap, then setpoint ownership — and do not return the arm to service until all four verification readings pass.

  1. Freeze the upper levels and tune each joint until a step shows no ringing; record Ts1.
  2. Set the level 2 gain so Ts2 is several times Ts1, checked at both extremes of extension.
  3. Measure Td and set the vision gain to the cap that dead time allows.
  4. Assign elevation authority so only one loop drives it at a time, with the mode switch at contact.
  5. Add slew limits on the setpoints passed down each level, so a large upper-level error cannot slam a lower loop.

Verify against these readings:

  • Logged settling times run in order, Ts1 < Ts2 < Ts3.
  • A visual reference step gives a monotonic response or one small overshoot, at folded and extended poses.
  • Touch-down on the hand pressure sensors produces no chatter and no elevation reversal.
  • Covering the marker holds the arm in place instead of drifting.

The decision for industrial use: this architecture is a cascade — position loops inside endpoint loops inside image-based visual servoing and contact control — and it is sound as one. With no dynamics model anywhere in the stack, payload and gravity changes cost speed instead of being compensated, so commit it to light, slow, contact-tolerant tasks; anything faster needs a model-based controller that compensates payload at the joint level.

Questions asked

Should you add integral action to the joint servos?

Only when the gravity offset limits your reach, and then prefer a bias term sized to the payload. An integrator adds phase lag of its own, which slows the joint and eats the separation every level above it needs; a bias corrects the offset without changing the loop's dynamics. If you do add integral action, keep it slow relative to the proportional response.

Why does the arm still drift when the marker is covered?

Drift under cover means something is still integrating a held error. Hold the last setpoints and freeze the top level's integration at the moment detection fails, then confirm the elevation you froze is the one that was active. With proportional-only joints, a slow droop under gravity is normal and is not vision drift.

Is this stack the same cascade an industrial servo drive uses?

Yes in principle. A drive closes a current loop, then a velocity loop, then a position loop, each slower than the one inside it, and the same ordering rule governs all three; the arm's endpoint and vision levels just add rings outside the position loop. The failure looks the same too: two rings at similar bandwidth produce a slow oscillation that no single-loop retune removes.

Can you filter the camera signal instead of lowering the vision gain?

Only to remove noise, not to fix oscillation. A low-pass filter adds its own lag, which lengthens the effective dead time and lowers the gain you can carry, so a latency-limited loop gets worse. If the swing matches the period your dead time predicts, cut latency at the source: a smaller detection region, a locked exposure, and dropping buffered frames so the newest frame is always used.

Keep reading

  • Selection guide

    Why Nine Servo Axes Need More Than One Motion Controller

    Nine independently commanded servo axes do not fit on one board of a controller family capped at eight per board. An 8-axis board plus a 2-axis board gives ten channels with one spare, and the deciding checks are each axis's feedback type, the measured start skew between the two boards, and keeping drive-current and motor thermal sizing as separate decisions.

    Servo and stepper motion

  • How-to

    Reseat servo horns at the startup pose on a robot arm

    Reseat every servo horn with the arm in its startup pose, straight up, before you touch software. A horn seated one spline tooth off shifts each commanded angle by 360 divided by the tooth count — typically 10 to 25 degrees on hobby-class servos — and offsets cannot recover travel the link geometry clips at an end stop. Trim only the residual fraction of a tooth with per-joint limits and a linear map.

    Servo and stepper motion

  • How-to

    Tuning a Closed-Loop Stepper With Linear Scale Feedback

    Commission the axis open loop first, verify both linear scale channels and the counts-per-unit constant with gains at zero, then close the loop at an integral gain near 0.01 with about 100 Hz filtering. Backlash, stiction and compliance end up inside the loop, so it limit-cycles at rest — fix the mechanics and the gains together.

    Servo and stepper motion