AutomateDirectUSAMotion LibraryIndustrial monitors & PCs

Troubleshooting

Why robot hand tracking sends velocity spikes to a servo

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

Short answer

The spikes are not a servo tuning problem: the robot's own axes close their loops, so any jump injected upstream arrives as a velocity spike. Work the chain in order — sample timestamps, pose estimate, coordinate transform, inverse-kinematics target, command stream — find the first signal that turns discontinuous, and repair that stage before touching any gain.

On this page
  1. Find the first discontinuous signal
  2. Why accelerometer-only hand position drifts
  3. Correct drift without creating a spike
  4. Which control layer owns which loop
  5. Turn hand pose into a continuous joint trajectory
  6. The decision, case by case
  7. Questions asked

A hand-tracking rig feeds a six-axis industrial robot through an interface that accepts joint positions, velocities, torques and a time interval, and the velocity trend shows spikes. Treat the spikes as a signal-chain fault, not a servo fault. The robot's joint servos close their own position and velocity loops, so any discontinuity injected upstream arrives at the joints as a spike no matter how well the axes are tuned. Work the chain in order — sample timestamps, pose estimate, coordinate transform, inverse-kinematics target, command stream — find the first signal that becomes discontinuous, and repair that stage before touching a gain.

Find the first discontinuous signal #

The observed symptom is a velocity graph that spikes while the robot follows the hand. Do not assign a cause from that symptom alone: estimator drift, bad timestamps, a wrong transform, an inverse-kinematics branch switch and an inconsistent command stream can all produce the same graph. Work the list in order, cheapest check first, and confirm each stage before moving on.

  1. Name the spiking signal. Commanded joint velocity, measured joint velocity and the hand-velocity estimate are three different signals, and each implicates a different stage. Confirming check: plot the commanded target and the measured joint value on one time base and see which one jumps first.

  2. Hold the hand still. Estimator drift keeps the pose creeping while the hand is physically fixed, and an estimator reset makes it jump. Confirming check: record the estimated hand position for a minute with the hand not moving — a moving trace convicts the estimator, and no gain will clear it.

  3. Check the sample timestamps. Repeated timestamps, dropped samples and irregular intervals turn into derivative spikes and uneven commands. Confirming check: histogram the interval between consecutive samples; every zero or jittering interval should line up with a spike in the log.

  4. Check the coordinate transform. Wrong axis direction, handedness, scale or origin moves the robot in the wrong direction or over the wrong distance. Confirming check: move the hand along one known direction through one known distance, for example 100 mm straight up, and measure whether the tool moves 100 mm up in the robot base frame.

  5. Check inverse-kinematics continuity. One hand pose can have several joint solutions, and switching between branches or wrapping across the 180 degree seam turns a small hand motion into a huge joint step. Confirming check: log the joint targets; a multi-radian step between consecutive targets from a barely visible hand move convicts the branch selection or the wrap.

  6. Check command consistency. Streaming positions and velocities together invites disagreement between the two fields, which forces abrupt corrections or rejection at the controller. Confirming check: send joint positions only, on a fixed interval; if the spikes vanish, the velocity stream was the fault.

Fix the earliest discontinuous stage first, because feedback gains downstream cannot repair an upstream jump. Tracking a moving target from samples that arrive on a fixed clock fails in a known way, the same pattern that makes conveyor tracking drift further from each box as the target travels between samples.

Why accelerometer-only hand position drifts #

An accelerometer measures specific force, not position. Reconstructing translation needs an orientation estimate, gravity compensation, and integration to velocity and then to position, so a small persistent acceleration error becomes a growing velocity error and a faster-growing position error. With a constant residual bias b and no corrective observation, position error grows as half the bias times the square of the elapsed time:

error = 0.5 × b × t²

Worked example with an assumed residual bias of 0.05 m/s² after calibration and an elapsed time of 10 s:

  • velocity error = 0.05 m/s² × 10 s = 0.5 m/s
  • position error = 0.5 × 0.05 m/s² × (10 s)² = 2.5 m

This is a calculated example for those inputs, not a measured result; halving the bias still leaves 1.25 m after ten seconds. It also explains why smoothing the acceleration trace makes the plot look cleaner without making the reconstructed position stable: filtering noise and correcting bias solve different problems.

Orientation errors feed translation. A tilt error leaves part of gravity in the linear acceleration, and during motion the measured vector mixes motion and gravity, so treating it as the gravity direction corrupts the orientation estimate further. Gyroscope rate bias integrates into orientation drift the same way acceleration bias integrates into position. Read the channel list of the exact sensor on the board rather than trusting the family label.

Constrain the accumulated error with an observation that does not drift: a camera or external tracking system measuring the hand, or a repeatable physical reference such as a pin or hard stop the hand docks against at a known pose. The fixture is not a position sensor; it is one pose that can be trusted at the moment of contact, and the fusion filter needs such observations on a schedule the drift rate dictates.

Correct drift without creating a spike #

A correction that lands as a step is itself a spike. A 30 mm correction applied inside one 10 ms command interval asks the joints for 3 m/s, because 0.03 m ÷ 0.01 s = 3 m/s. Apply corrections through the estimator and the trajectory generator instead: fuse the absolute measurement continuously so the estimate bends toward truth, rate-limit or blend any reset over several command intervals, and re-reference where the arm sits at a known stopping point rather than mid-move. If the interface carries the time-interval field, use it to spread a known correction across the interval the controller expects.

Which control layer owns which loop #

An industrial robot controller closes the motor-level loops itself. When the interface takes joint-position trajectories, the external application owns acquisition, transforms, inverse kinematics and reference generation, and the joint servos own tracking — the same division discussed in servo control loops in the drive or the controller. Wrapping a second position loop around axes that already track their targets puts two controllers in competition over the same error.

PID is not a concession. It is the right tool at the right layer, and a project rule that demands something more elaborate is not an engineering reason. Hunting or buzzing at setpoint is a joint-loop symptom, the kind traced for a PID robot arm joint that buzzes at setpoint, and it is the only kind of problem a gain change actually fixes. The joint loops are tuned axis by axis, which is why KV factor varies from axis to axis; by the same logic no single gain change absorbs a discontinuous reference arriving from upstream.

Feedforward belongs in the supervisory layer: passing the current target position forward needs no knowledge of the hand's future motion, while velocity, acceleration or torque feedforward needs the corresponding reference signal and, for dynamic compensation, a model. Model predictive control fits the supervisory problem when joint limits, speed and acceleration constraints and workspace boundaries must be respected together, and it only runs when the model, the state estimate and the solver finish inside the command interval.

Turn hand pose into a continuous joint trajectory #

Separate the tracking coordinate system from the robot base and tool frames. Define a reference hand pose and the robot pose that corresponds to it, then map relative hand translation and rotation onto relative target motion; this keeps the tracking system's arbitrary origin out of the robot's workspace. Calibrate axis direction, handedness, units, translation scale and the sensor-to-hand mounting, and check translation and rotation independently, because a correct position mapping with a rotated orientation offset still produces surprising wrist motion.

In inverse kinematics, pick the branch continuous with the current joint configuration and keep it. Near a kinematic singularity a modest Cartesian motion can demand a very large joint rate, so cap the Cartesian speed of the reference and route the taught path away from the singularity rather than through it.

The fusion, transform and inverse-kinematics stack runs on a computer at the machine, on a fixed command interval, and steady matters more than fast because irregular intervals create exactly the derivative spikes being chased. When that computer is specified or replaced, the fit for a cabinet-mounted, machine-side station is an industrial mini PC running the tracking stack on a fixed timer.

One safety note: ISO 10218-2 requires the robot system integrator to carry out a risk assessment and apply the safeguards its results call for, and an arm that follows a human hand in real time generally means safety-rated reduced speed, separation monitoring or an enabling device; no change to the tracking chain removes that obligation.

The decision, case by case #

  • The pose estimate drifts while the hand is still. Add an absolute reference, fuse it inside the estimator on a schedule the drift rate dictates, and leave the joint gains alone.
  • The spikes line up with timestamp glitches. Repair acquisition and timestamping, then command on a fixed interval from the tracking computer; the fault is in the software's clock, not the robot.
  • The robot moves the wrong direction or distance. Recalibrate the transform, translation and rotation separately, then repeat the known-direction, known-distance test.
  • Isolated multi-radian joint steps appear. Lock the inverse-kinematics branch, handle the 180 degree wrap explicitly, and cap the reference's Cartesian speed near singularities.
  • Measured velocity spikes while the commanded target stays clean. The fault is on the robot side: check torque saturation first, as with an error counter overflow alarm, then the interpolation settings.
  • Nothing upstream is discontinuous and the reference is feasible. Only now touch the joint-loop gains, one axis at a time.

Every case ends the same way: the earliest discontinuous signal is the fault, and the fix belongs at that stage, not in the gain set.

Questions asked

Is PID enough when the project requires more than PID?

Pick the controller from the task, not from the requirement's wording. The engineering content here is the drift correction and the continuous joint-target stream; a second position controller wrapped around axes that already track their targets just adds a fight over the same error. Model predictive control earns its place once the reference is continuous and hard limits must be enforced together — treat the drift fix and the mapping calibration as the substantive work, and the algorithm label takes care of itself.

Why do spikes show in the velocity graph but not in position?

Velocity is the position increment divided by the command interval, so a small step becomes a large rate: 5 mm inside a 10 ms interval is 500 mm/s. A step that appears first in the commanded target convicts the tracking chain; a clean target with a spiking measurement convicts the robot side.

How often should the hand pose be re-referenced?

Compute the budget from the drift formula: with position error d and residual bias b, the budget lasts t = sqrt(2 × d / b), with d in meters, b in m/s² and t in seconds. Using the worked bias of 0.05 m/s² and a 50 mm budget, sqrt(2 × 0.05 / 0.05) gives about 1.4 s. That is why the correction must run continuously inside the fusion filter, with occasional verification at a repeatable fixture pose, instead of manual resets mid-move.

Can a consumer VR tracker replace the inertial unit?

A consumer VR tracker outputs a filtered, timestamped pose stream, which solves the drift problem at the source, but verify three things before treating it as robot-grade: the coordinate frame it reports, its latency, and its reporting rate against the robot's command interval. Then map its frame into the cell with the same reference-pose calibration described in the article, and fuse or blend its corrections rather than resetting the target mid-move.

Keep reading

  • Troubleshooting

    Why a 2 DOF Robot Arm Curves Near the End of a Straight Line

    The curve near the end of the stroke is almost always the inverse kinematics, not the servos: the cosine-law solver flips between the elbow-up and elbow-down branch because the sign of the square-root term s2 is not fixed. Hold one branch for the whole stroke, take both angles from atan2, and require c2 to stay between -1 and 1 at every waypoint. Confirm it by plotting the forward-kinematics path of the commanded angles before touching the update rate.

    Servo and stepper motion

  • Troubleshooting

    Why a pulse-command servo axis loses position between moves

    A pulse-command servo that runs smoothly but lands at the wrong coordinate is losing, duplicating or mistiming step edges in the command path, not failing in the servo loop. Match step polarity, pulse width and direction prechange to the drive manual's input timing, then prove the fix with a dial indicator over 100 cycles of a repeated 100 mm move.

    Servo and stepper motion

  • Troubleshooting

    Diagnosing Servo Axis Position Drift in the Drivetrain

    The drift is lost motion between the motor encoder and the load: the position loop closes at the motor shaft, so the gearbox, coupling, pulleys and belt sit outside it. Split motor-reported position from an independently measured load position at one reference with witness marks on every hub. A one-direction offset that grows for hours while the motor reads on target is index loss — slip or jumped teeth — until the marks prove otherwise.

    Servo and stepper motion