Validating Robot Friction Compensation Effects: An AI-Automated Experiment Case Study
We applied two compensation techniques to the Neuromeka Indy7 collaborative robot:
- Friction Compensation: Compensates for mechanical friction in joints
- Acceleration Feedforward (FF): Pre-compensates for inertial forces during acceleration
A question arose: "How much does each technique actually contribute? Is one sufficient, or are both necessary?"
To answer this question, we conducted 160 runs of 2x2 experiments. After tuning friction coefficients with an AI agent (ralph-loop), we performed validation experiments using automated scripts.
The Problem: Before Compensation
Before applying compensation techniques, severe position tracking errors were observed, especially in J1 (shoulder joint). J1 is the joint with the highest friction due to its large reducer and the structure that supports the entire arm load.

J1 position tracking before compensation. Clear delay and error between command (cmd) and actual position

J1 torque before compensation. Large torque fluctuations due to friction are observed
To address these friction problems, we applied friction compensation techniques. This experiment quantitatively validates their effectiveness.
Conclusions First
| Condition | Position RMSE | Improvement | p-value | Cohen's d |
|---|---|---|---|---|
| B0 (baseline) | 1.526 mrad | - | - | - |
| B1 (friction only) | 0.974 mrad | 36.1% | p<0.01 | 1.49 |
| B2 (FF only) | 1.450 mrad | 5.0% | p<0.05 | 0.80 |
| B3 (both) | 0.932 mrad | 38.9% | p<0.01 | 1.44 |
Friction compensation alone achieved 93% of total improvement. Acceleration FF contributed only 5%.
Experimental Design
We combined 4 conditions to analyze the independent effects and interactions of each technique:
| Condition | Friction Comp. | Acceleration FF | Description |
|---|---|---|---|
| B0 | OFF | OFF | Baseline |
| B1 | ON | OFF | Friction only |
| B2 | OFF | ON | FF only |
| B3 | ON | ON | Both |
Test Trajectories
- 5 joints: J0-J4 (J5 excluded due to minimal friction Fc=1Nm)
- 2 speeds: SLOW (vel=0.1), FAST (vel=0.3)
- 10 total trajectories: 4 repetitions each (2 each for directional balance)
- Total experiment runs: 4 conditions x 10 trajectories x 4 repetitions = 160 runs
Friction Coefficients (Fc)
| Joint | Fc (Nm) | Characteristics |
|---|---|---|
| J1 (shoulder) | 35.0 | Maximum friction - supports entire arm load |
| J2 (elbow) | 10.0 | Medium friction - gravity load |
| J0 (base) | 5.0 | Vertical axis - less friction in gravity direction |
| J3, J4 (wrist) | 2.0 | Low friction - small joints |
| J5 (end) | 1.0 | Minimum friction |
AI-Automated Experiment Pipeline
Tools Used
| Tool | Role |
|---|---|
| Claude Code | AI agent - code modification, build, execution, analysis |
| ralph-loop | Iterative execution plugin - auto-repeat until complete |
| run_experiment.py | Single experiment automation script |
| motion_analyzer.py | Result analysis and metric extraction |
Two-Stage Workflow
Stage 1: Friction Coefficient Tuning (using ralph-loop)
AI judgment required: Error analysis -> Adjustment direction -> Code modification -> Repeat
Stage 2: 160 Validation Experiments (script repetition)
B0 (40 runs) -> B1 (40 runs) -> B2 (40 runs) -> B3 (40 runs)
Condition changes were done manually
Key Results
Effect Decomposition
| Comparison | Improvement | Ratio |
|---|---|---|
| Total (B0->B3) | 0.594 mrad | 100% |
| Friction only (B0->B1) | 0.551 mrad | 93% |
| FF only (B0->B2) | 0.076 mrad | 13% |
Friction compensation is the key factor.
Speed-wise Analysis

Improvement comparison between SLOW (vel=0.1) and FAST (vel=0.3)
| Condition | SLOW Improvement | FAST Improvement | Difference | Theory Validation |
|---|---|---|---|---|
| B1 (friction) | 42.3% | 31.3% | +11.0% | Confirmed |
| B2 (FF) | 4.7% | 5.1% | +0.4% | Rejected |
| B3 (both) | 42.9% | 35.8% | +7.1% | - |
Theory Validation Results:
- Friction compensation is more effective at low speeds (where static friction is prominent)
- The expectation that FF would be more effective at high speeds was rejected
Joint-wise Analysis: Correlation Between Friction Coefficient and Improvement

Correlation between Coulomb friction coefficient (Fc) and B1 improvement. J0 is an outlier due to its vertical axis
| Joint | Fc (Nm) | Axis Direction | B1 Improvement |
|---|---|---|---|
| J1 | 35.0 | Horizontal | 73.5% |
| J2 | 10.0 | Horizontal | 46.7% |
| J0 | 5.0 | Vertical | 10.1% (outlier) |
| J3 | 2.0 | - | 39.5% |
| J4 | 2.0 | - | 39.0% |
J0 is a vertical axis, so it has less friction load in the gravity direction. Despite having higher Fc than J3/J4, its improvement rate is lower.
Unexpected Finding: j3_fast Anomaly

B2 (FF only) actually degraded performance in the j3_fast trajectory
Phenomenon: B2 (FF only) condition showed 13.8% degradation compared to baseline in j3_fast
| Statistic | Value |
|---|---|
| B2 > B0 in all 4 runs | Consistent degradation |
| t-test | t=20.7, p=0.0002 |
| Verdict | Systematic phenomenon, not random |
J4 with the same Fc=2Nm behaved normally - This is a J3-specific phenomenon
Implications: Applying FF alone without friction compensation can degrade performance under certain conditions. B3 (both) performed normally.
Friction Model Implementation
Chattering Prevention: tanh vs sign
The existing sign() function causes abrupt torque changes near zero velocity:
| Velocity (rad/s) | sign() Output | Torque Change |
|---|---|---|
| +0.001 | +1 | +35 Nm |
| -0.001 | -1 | -35 Nm |
| Difference | - | 70 Nm jump |
Using the continuous tanh() function for smooth transition:
constexpr double kTransitionVelocity = 0.05; // rad/s (~3 deg/s)
tau_compensation = Fc * tanh(velocity / kTransitionVelocity)
| Velocity (rad/s) | tanh() Output | Torque Change |
|---|---|---|
| +0.001 | +0.02 | +0.7 Nm |
| -0.001 | -0.02 | -0.7 Nm |
| Difference | - | 1.4 Nm (continuous) |
Meaning of kTransitionVelocity
kTransitionVelocity defines "how quickly to determine friction direction near zero velocity":
| Value | Characteristic | Trade-off |
|---|---|---|
| Smaller | Closer to sign() (sharp transition) | Accurate but chattering risk |
| Larger | Smooth S-curve | Stable but inaccurate at low speeds |
Empirical meaning of 0.05 rad/s (approximately 3 deg/s):
- Below this speed: Friction direction is considered "uncertain"
- Above this speed: tanh is approximately equal to +/-1, nearly identical to the original Coulomb model
This value requires tuning based on system noise, velocity measurement resolution, and drive system characteristics.
Torque Usage Changes
| Condition | Torque RMSE | vs B0 | Torque MAX | vs B0 |
|---|---|---|---|---|
| B0 | 1.94 Nm | - | 22.2 Nm | - |
| B1 | 2.04 Nm | +5.1% | 23.2 Nm | +4.5% |
| B2 | 2.10 Nm | +7.9% | 27.5 Nm | +23.7% |
| B3 | 2.08 Nm | +7.2% | 28.4 Nm | +27.6% |
Friction compensation (B1) has minimal torque increase, but FF (B2) increases maximum torque by 24%.
Operational Recommendations
| Scenario | Recommended Setting | Reason |
|---|---|---|
| General operation | B1 (friction only) | Core effect only, simplicity, stability |
| Maximum precision needed | B3 (both) | Additional 3% improvement |
| High-speed tasks | B1 (friction only) | Minimal FF effect, noise risk |
| FF alone | Caution | j3_fast degradation observed |
Why FF Effect Was Limited
- Limitations of simple numerical differentiation: Uses only 2 samples, amplifies noise
- Indirect compensation by PD gains: Existing PD controller partially compensates for inertia
- Unnecessary for low-inertia joints: J3, J4 have minimal inertia
- Asymmetric effects without friction compensation: Acceleration/deceleration torque imbalance
Experimental Limitations
- Fixed condition order (B0->B1->B2->B3): Temperature/time drift possible
- Paired t-test used: Used instead of 2-way ANOVA, interaction significance not tested
- No multiple comparison correction: B2 significance questionable after Bonferroni correction
- Sample structure: 160 runs summarized as averages of 10 trajectories (df=9)
Key Takeaways
- Friction compensation is the key factor. 36.1% improvement (p<0.01, Cohen's d=1.49) accounts for 93% of total improvement.
- Acceleration FF effect is limited. Only 5.0% improvement, and the expectation of greater effectiveness at high speeds was rejected.
- The two effects are largely independent. Interaction effect is approximately 0.033 mrad, negligible.
- Maximum effect in joints with high friction coefficients (J1). 73.5% improvement in J1 (Fc=35Nm).
- Caution required for FF-only application. 13.8% degradation observed in j3_fast.