
Productive Robotics
Trajectory Buffer Smoothing Fix
Discovered and fixed a subtle bug in the 1kHz real-time control loop where a digital smoothing filter (coefficient 500, passing only 0.2% of position delta per cycle) silently attenuated incremental jog commands — the robot moved ~4% of the commanded distance. Continuous jogging converged correctly over 500+ cycles, masking the bug. The same class of real-time servo loop debugging done at Boston Dynamics and Agility Robotics.
The JointSmooth filter in the trajectory buffer applies a low-pass smoothing filter to all joint commands — filter coefficient 500 means only 1/500 = 0.2% of each position delta passes through per cycle at 1kHz. For continuous jogging (operator holds the button), new position commands arrive every cycle and the filter accumulates and converges toward the target over 500+ cycles — the operator perceives smooth, continuous motion. For incremental jog (operator taps for a single 1cm move), one position command is issued, the trajectory is computed and loaded, but the trajectory pipeline marks the move as 'complete' based on the input (unfiltered) position reaching the target, not the output (filtered) position. After ~20 cycles (~20ms), the trajectory completes and is cleared from the buffer — but the filter has only output ~4% of the commanded motion. Robot moved ~0.4mm instead of 10mm.
The fix adds a setSmoothingEnabled(bool) API to the trajectory buffer. CartesianJogController disables smoothing before executing incremental commands (trajectoryBuffer_->setSmoothingEnabled(false)) and re-enables it when cleared for continuous jog. Extended jog timeout from JOG_TIMEOUT to 0.5s for incremental mode. This surgical fix preserves smoothing for continuous jog (where it provides valuable jitter reduction) while bypassing it for one-shot incremental moves (where the filter's transient response causes the bug). The quantitative reasoning — coefficient 500 means 0.2% per cycle, 20-cycle trajectory outputs ~4% of command — demonstrates the mathematical analysis required for real-time control system debugging.