Overview
The last millimetres of an insertion are decided by contact, not by vision. A camera can find the socket to within a few millimetres, but the prongs still have to pass a shutter, find two chamfered holes and slide in without wedging. On a Marvin M6S arm, the camera places the plug 11 mm above the estimated hole and a learned policy takes over from there.
The policy runs at 50 Hz on a six-axis force/torque sensor at the wrist and outputs six-degree-of-freedom pose targets, which the arm’s Cartesian impedance controller tracks. It is not locked upright: it may tilt up to ±8° about the world horizontal axes and rotate up to ±8° about the vertical, so it can follow the socket instead of forcing a fixed orientation.
- 82.4% success after 6000 training iterations, evaluated on 2048 episodes under the training randomisation.
- 0% force-limit failures at that point; median time to insert 2.8 s, median peak contact force 27 N.
- Unlocking the orientation is the largest single gain: 89.6% to 99.5% in the standard simulation and 41.4% to 59.2% in the harder one.
The hardware is a TG-9801 gripper holding an apple60 charger, an XJC-6F six-axis sensor (28 mm thick) between the flange and the gripper, and a bull_2x5 power strip with protective shutters.
Method
Hand-over and control point
The camera gives the hole position with an error of a few millimetres, the arm moves to 11 mm above it and stops, and the policy controls the rest. The controlled point is the midpoint between the two prong tips, with its z axis along the prongs, obtained from a transform taught after the sensor is mounted.
Each policy step lasts 20 ms. The target pose is converted to joint angles by inverse kinematics and sent to the controller, which runs Cartesian impedance control with K = 3000 N/m and 100 N·m/rad, damping 0.8 and 0.4, null-space stiffness and damping 20 and 1, and the impedance point 135 mm ahead of the flange.
Actions
Six numbers in [−1, 1] are integrated into a pose relative to the hover pose. Every component except height is an increment on the previous target, so the action cannot drift away from the socket over a long episode; tilt and rotation are also measured from the hover orientation, not accumulated absolutely.
| Component | Update | Limit |
|---|---|---|
| Forward and lateral | 0.5 mm per step, added to the offset from the hover point | ±10 mm |
| Height | Smoothed action × 15 mm/s × 20 ms | At most 13.33 mm below the prong tips, about 40 N at 3000 N/m |
| Tilt about world x and y | 0.25° per step | ±8° each |
| Rotation about vertical | 0.25° per step | ±8° |
The vertical action is low-pass filtered (0.2 new, 0.8 previous) and moves at most 0.3 mm per step, which keeps the contact force smooth while still allowing a firm press.
Observations
The policy reads 216 numbers, all in the world frame. It uses no joint angles, joint velocities, end-effector velocities or forces reconstructed from joint torques, because those are either inaccurate on the real robot or unnecessary.
- Current step, 24 numbers: prong-tip position relative to the estimated hole (×100), the previous target minus the current tip position (×100), the three force components (÷10 N), the three torque components about the prong tip (÷0.5 N·m), the position action from two steps earlier, the accumulated tilt about x and y (÷8°) and rotation about vertical (÷8°), the pose action from two steps earlier, and the last target orientation minus the current orientation as a rotation vector (×10).
- History, 192 numbers: the six force values and the six position values above, over the last 16 steps (0.32 s). At the start of an episode the history is filled with the first step.
The force reading is averaged over each 20 ms window, about 220 samples on the real robot. Tool gravity is removed with parameters calibrated offline (mass, centre of mass, zero offset and mounting angle below the sensor), the residual is zeroed at the hover pose, the vector is rotated into the world frame, and the moment is moved to the prong tip. Inertial forces from tool acceleration are deliberately not removed, because they are also present in training.
Network
The force history (6 channels × 16 steps) and the position history (6 channels × 16 steps) pass through separate one-dimensional convolutional encoders, each with two kernel-3 layers and ELU activations, followed by a fully connected layer. The force encoder keeps 32 channels and outputs 32 features; the position encoder keeps 16 and outputs 16. These 48 features are concatenated with the 24 current values into 72 inputs, and a 512 → 256 → 128 ELU network outputs the six action means. Inputs are normalised with training statistics and clipped to ±5. The action standard deviation is a learned parameter during training and is not used at deployment, where the mean is executed directly. A separate 256 → 128 → 64 value network sees additional ground-truth simulator state (true hole and tip poses, clearance, charger mass, friction and contact force) and is only needed for training.
Reward
The reward is dense over each 20 ms step. It combines three exponential kernels on the distance from four points along the prongs to their fully inserted positions, a lateral-alignment term with a 2 mm scale, insertion depth up to the 16 mm full depth, a bonus once 6 mm is reached, 0.5 for opening the shutter and 0.2 for aligning the prong line with the slot. It penalises peak contact force above 20 N, pressing harder than 15 N before entering, lateral scraping above 5 mm/s, the charger twisting in the gripper, large single-step joint motion and large actions. Success pays 2.0, plus a terminal bonus equal to the discounted sum of the maximum per-step reward, about 1323, so finishing early never scores worse than stalling.
An episode ends in success at an insertion depth of at least 12 mm with lateral error under 1 mm, prong tilt under 3.5° and prong-line misalignment under 3°. It ends in failure if the 20 ms mean force exceeds 55 N, the charger twists more than 4° in the gripper, one joint has to turn more than 3° in a step, a joint comes within 2° of its limit or J6/J7 within 3° of their interference curve, or 8 s pass.
Simulation and training
Training uses MuJoCo Warp with a 2 ms physics step, ten physics steps per policy step and 4096 parallel scenes. The arm uses the manufacturer’s URDF with the real controller limits and the J6/J7 interference curve, the controller follows the SDK impedance parameters, and the tool transform, sensor mass and geometry come from the mounted hardware. The socket has 0.25 mm clearance per side and a 1.2 × 1.5 mm chamfer; the shutter opens after a 6–12 N press held for 0.2–0.6 s; the charger is held by a rotational joint with 0.08–0.6 N·m of friction torque, so it can twist under load. Wrist lag measured on the real robot is included, as are calibrated joint friction and a sensor model with noise, bias, drift and gain error.
The randomisation covers a hole 1–8 mm from the hover point, strip placement of −2 to +4 cm front to back, ±4 cm left to right, ±10° of rotation and ±1.5° of tilt, a charger grip angle of 15° ± 6°, prong misalignment and roll, contact friction of 0.18–0.6, shutter force and timing, joint friction, command delay and sensor errors. Difficulty starts at 30% of these ranges and grows by 5% whenever recent success exceeds 40%, falling by 5% below 25%; this run reached the full range at iteration 486.
PPO is run for 6000 iterations with 4096 scenes and 64 steps per scene, about 260,000 steps per iteration, four update epochs of 8192 samples, γ = 0.995, GAE λ = 0.95, clipping 0.2, a KL-adaptive learning rate starting at 1e-4 and about 8.5 hours on one H100.
Results
Training
Success is measured deterministically on 2048 episodes with the training randomisation:
| Iteration | 300 | 500 | 1000 | 2000 | 3000 | 4000 | 5000 | 6000 |
|---|---|---|---|---|---|---|---|---|
| Success | 19.2% | 68.8% | 78.3% | 80.1% | 78.1% | 77.1% | 81.9% | 82.4% |
At iteration 6000, 11.5% of episodes time out and 6.0% end with the charger twisted in the gripper; none reach the force limit. Successful insertions take a median of 2.8 s, and the median peak contact force is 27 N.
What mattered
| Comparison | Result | Reading |
|---|---|---|
| Rule-based press with residual correction vs full policy with locked orientation | 65.9% vs 92% | Letting the policy control the motion beats correcting a hand-written rule. |
| Reduced observations with temporal encoding vs the earlier full-state policy | 89.6% vs 90.8% | Joint angles and velocities can be dropped without loss, and are easier to compute accurately on the robot. |
| Locked vs unlocked orientation | 89.6% → 99.5% standard; 41.4% → 59.2% harder | Freeing the tilt and rotation is the largest single improvement. |
| Training on the standard vs the harder simulation | 59.2% → 90.6% and 94.6% on the hard set; above 99% on the standard set | Wider randomisation helps difficult cases at almost no cost on easy ones. |
| Twelve single-factor consistency tests | Worst case 91.6% unlocked vs 59.6% locked | The unlocked policy is far less sensitive to unverified simulation details. |
| Aligned to the real robot: unlocked vs locked | 82.4% vs about 42% | With a locked orientation and the prong line starting more than 4.5° off, success falls to 6%; the unlocked policy stays at 78–83% at every starting angle. |
| Hover pose with the hand rotated 180° | 72.9% → 44.7% | The charger body is offset to one side of the prongs, so the hand orientation must match training; 48% of episodes ended with the charger twisted. |
Deployment checks
The policy and its input normalisation are exported to TorchScript. Before the arm is allowed to move, the real-robot program replays 16 recorded episodes and rebuilds every input and target with its own code; on this build the 3256 replayed steps agree with the training environment to within 2 × 10⁻⁶, and the target poses match exactly. The force sensor is read over Modbus RTU, compensated and zeroed at the hover pose, and the run is refused if the residual exceeds 5 N. Start poses outside the trained strip-placement range are also refused. On the robot, insertion is considered complete when the prongs reach 12 mm below first contact, or stop moving after 8 mm below contact; the last target is then held.
Limitations
- The socket chamfer and the force needed to push the shutter open were not measured; the simulator is tuned to “2 mm of error can still be pressed in” and “6–12 N opens the shutter”.
- The sensor mass (0.3 kg) is estimated, and the torque reference point has not been checked against the datasheet.
- The policy was trained for one strip-placement region (front-back −2 to +4 cm, left-right ±4 cm, ±10° rotation). A different position changes joint margins and hand orientation, so it needs retraining or a wider randomisation.
- The angle between the prongs and the hand axis changes every time the charger is re-gripped (13.9–20.9° measured). Training covers 9–21°; outside that range the charger has to be re-gripped and the prong-tip transform taught again.