Back to Home

Robot Imitation Learning: Trajectories Without Encoders

The article describes imitation learning of a budget manipulator without encoders. External potentiometers are used for trajectory collection, MLP for step prediction, and aiming for accuracy. Achieved error ±2 mm at 34 points.

How to Train a Robot to Repeat Trajectories Without a Kinematics Model
Advertisement 728x90

Imitation Learning for a Robot Manipulator: Trajectory Generation Without Encoders

A servo-driven robot manipulator using MG996R servos—without built-in encoders—suffers from backlash, mechanical wear, and positional inaccuracy. Instead of performing complex kinematic calibration, we apply imitation learning: the manipulator is manually guided along desired trajectories while external potentiometers record joint positions. These human-demonstrated trajectories are then used to train a neural network to reproduce motion step-by-step.

The mechanical design includes a rotating base (Z-axis), three articulated links, and an end-effector gripper. Ten-kilohm potentiometers mounted at all four joints feed analog signals to an Arduino Mini every 10 ms. Servo control is handled by a PCA9685PW PWM driver. All trajectory data is logged to CSV files for offline processing.

Hardware Setup and Operational Modes

The Arduino reads potentiometer values and applies smoothing to suppress noise: each new reading is updated as a weighted average with the previous value. Raw ADC values (0–1023) are converted to joint angles later on a PC—not onboard—to avoid servo jitter during acquisition.

Google AdInline article slot

The system operates in two distinct modes:

  • Trajectory recording, using potentiometer feedback.
  • Playback and servo actuation, executing learned motions.

Servos are powered from a dedicated supply to prevent voltage sag. The robot’s practical workspace is constrained to a comfortable grid of 34 target points—similar to a chessboard. A single home position above this grid serves as an intermediate waypoint for all movements: home → target → home.

This reduces data volume significantly: only 68 trajectories (round trips) are needed instead of exhaustive pairwise combinations across all 34 points.

Google AdInline article slot

Stages of Imitation Learning

Trajectory Recording

The manipulator is manually moved from the home position to a target point and back. The Arduino logs joint positions every 10 ms. Raw recordings contain noise and drift due to mechanical backlash.

Target Calibration

Final joint angles are fine-tuned to ensure precise endpoint positioning. Endpoints of recorded trajectories are adjusted to compensate for accumulated error—especially critical for repeatable grasping or placement.

Neural Network Training

The model predicts the next incremental joint-angle change (delta) given the current joint state and the target coordinates. Input: current joint angles + (x, y) target location. Output: 4-dimensional delta vector. A final “aiming” correction stage refines the last 10% of motion toward the calibrated target.

Google AdInline article slot

A PyBullet URDF model of the manipulator is used only for visualization—not for simulation or physics-based training—so real-world backlash and compliance are not modeled.

Data Preparation

Trajectories are normalized and interpolated to a fixed-length sequence. For each home–target pair, multiple demonstrations are collected and averaged to improve robustness.

Preprocessing steps include:

  • Noise filtering via moving-average smoothing.
  • Joint angle normalization to [0, 1].
  • Linear interpolation to 100–200 timesteps per trajectory.
  • Concatenating the (x, y) target coordinates as a conditioning input to the network.

Neural Network Architecture

We use a multilayer perceptron (MLP) with:

  • 4 inputs (normalized joint angles),
  • Two learned embeddings for target x/y coordinates,
  • An additional temporal step embedding (to encode progression).
  • Hidden layers: 256 → 128 → 64 neurons, ReLU activations, dropout (p = 0.1).
  • Output: 4 predicted angular deltas.

Training uses mean squared error (MSE) loss on deltas, Adam optimizer (learning rate = 1e−3), batch size = 32, and 500 epochs. Data is split 80/10/10 (train/validation/test).

Error compensation: the final 10% of each trajectory is replaced with linear interpolation directly to the calibrated target position—ensuring high-precision endpoint accuracy.

Results and Generalization

The trained network reproduces trajectories with joint-angle errors under 5° and achieves target positioning within ±2 mm. On unseen cell centers (interpolated between training grid points), generalization holds within ±4 mm.

Comparison of methods:

| Method | Joint-Angle Error | Target Accuracy (mm) |

|--------|-------------------|------------------------|

| Open-loop kinematic model | 12° | ±8 |

| Imitation learning only | 4° | ±2 |

| Imitation + aiming refinement | 2° | ±1 |

The approach scales readily to other low-cost manipulators lacking onboard sensing.

Key Takeaways

  • Imitation learning bypasses the need for encoders and accurate kinematic models.
  • External potentiometers provide reliable ground-truth trajectory data.
  • The neural network generates conditioned, goal-directed motion steps—and adds a final aiming correction.
  • Just 68 hand-recorded trajectories enabled strong generalization to novel targets.
  • Sub-2-mm endpoint accuracy is achievable—even on budget hardware.

— Editorial Team

Advertisement 728x90

Read Next