Learning from Demonstration in MuJoCo

An undergraduate imitation-learning project connecting human teleoperation, behavioral cloning, and autonomous rollouts.

Imitation learning · MuJoCo · PyTorch

Overview

TeleOp-BC studies behavioral cloning for a simulated box-pushing task. Demonstrations can be collected with a keyboard or MediaPipe hand tracking, and a learned policy then controls the same environment autonomously.

Human teleoperation

My webcam hand-tracking input alongside the MuJoCo pushing simulation, from the original training demonstration.

Implementation

The MuJoCo/Gymnasium environment uses a one-dimensional slider and a randomized target. Observations contain block position, block velocity, and relative distance to the target. The policy predicts a normalized force, scaled to a maximum magnitude of 10 N.

The PyTorch policy is a 3 → 64 → 64 → 1 multilayer perceptron with a tanh output. Training and rollout use the same saved observation-normalization statistics. Evaluation compares force trajectories and total mechanical work per episode.

Results

The repository includes four plotted evaluation episodes. In those examples, human teleoperation used roughly twice the mechanical work of the learned policy. The force traces show a smoother learned control pattern alongside more reactive human corrections.

Four-episode comparison of mechanical work for human and policy control
Recorded work per episode. This is a small rollout comparison, not a general efficiency or task-success benchmark.
Normalized force traces comparing human actions and behavioral-cloning policy actions
Human and policy force traces, with the original repository annotations.

Scope

The task is one-dimensional and simulation-only. Noisy demonstrations and the trade-off between smooth actions and rapid correction are important limitations. The project provided an earlier testbed for the teleoperation-to-learning workflow later used with Rotom.

Code, setup, and rollout videos