RobotKeyframing: Learning Locomotion with High-Level Objectives via Mixture of Dense and Sparse Rewards

Fatemeh Zargarbashi, Jin Cheng, Dongho Kang, Robert Sumner, Stelian Coros

TL;DR

RobotKeyframing introduces a framework that allows legged robots to follow "keyframes"—specific poses or positions they must reach at exact moments in time—while maintaining natural, fluid motion. By combining a multi-critic reinforcement learning (RL) approach with a transformer-based goal encoder, the system handles the tricky balance of dense "style" rewards and sparse "timing" rewards, enabling robots to anticipate future goals and execute complex, directable behaviors.

What Problem Does This Paper Address?

In character animation, "keyframing" is the gold standard for directing movement: an artist sets a few important poses at specific times, and the software fills in the gaps. In robotics, however, we usually command robots using simpler inputs like joystick velocities or a single target destination.

The challenge in bringing keyframing to physics-based robots is twofold. First, robots must obey the laws of physics and dynamics, making "in-filling" between keyframes much harder than in a purely kinematic animation. Second, from a machine learning perspective, training a robot to hit a target at a specific time creates a "sparse reward" problem. Standard RL algorithms struggle to balance these rare, time-sensitive rewards with the "dense rewards" needed to keep the robot's gait looking natural and stable.

Methods

The authors propose a novel architecture consisting of three main pillars:

  1. Multi-Critic RL: Instead of a single "critic" network trying to estimate the value of a complex, weighted sum of rewards, this framework uses multiple critics. One critic focuses on dense rewards (like maintaining a natural dog-like gait), while another focuses on sparse rewards (hitting the keyframe). By normalizing the "advantages" from each critic independently before combining them, the system becomes much more robust to changes in timing and goal frequency without needing constant hyperparameter retuning.

    Figure 2: Multi-Critic RL.
  2. Transformer-based Keyframe Encoder: To handle a variable number of future goals, the authors use a "sequence-to-token" transformer. This allows the robot to process a list of upcoming keyframes, each with its own "time-to-arrival." A max-pooling layer then condenses this information into a fixed-size feature for the control policy.

    Figure 3: Policy with transformer-based keyframe encoder.
  3. Adversarial Motion Priors (AMP): To ensure the motion looks "natural" rather than robotic or jerky, the system uses AMP. This involves a discriminator that compares the robot's simulated movements to real-world animal data, rewarding the robot for moving in a style consistent with the dataset.

Datasets

  • Dog Motion Capture: A database of real dog movements (Zhang et al.) retargeted to the robot's skeleton.
  • Artist-Animated Clips: Used to augment the dataset with more diverse behaviors.
  • Evaluation Dataset: Locomotion clips from an open-sourced dataset (Han et al.) were used to test how well the policy generalizes to motions it never saw during training.

Key Insights and Ideas

  • Future Anticipation is Key: Because the transformer looks at the entire sequence of upcoming keyframes, the robot can "plan ahead." For example, if the robot knows it needs to make a sharp turn after the next goal, it will start adjusting its yaw angle early. This "anticipation" significantly improves accuracy compared to policies that only see the immediate next goal.
  • Decoupling Reward Sparsity: The multi-critic approach solves a major headache in RL: hyperparameter tuning. In a standard setup, if you double the time between keyframes, you usually have to retune your reward weights because the "sparse" reward becomes even rarer. With multi-critic RL, the independent normalization of advantages makes the training process largely indifferent to how sparse the goals are.

Key Results

  • Hardware Success: The framework was successfully deployed on a Unitree Go2 quadruped. The robot could follow complex paths and hit specific "full-pose" targets (like raising a paw or jumping) at the commanded times.
  • Robust Convergence: In simulation, the multi-critic method converged quickly across various time horizons ([25, 50] steps up to [75, 100] steps), whereas the standard single-critic method slowed down significantly as goals became sparser.
  • Quantitative Accuracy: In a "Turn" scenario, the policy aware of all future goals reduced the position error for the second goal by over 50% (from 0.72m down to 0.33m) compared to a policy only aware of the next goal.
Learning curves show that Multi-Critic RL (right) is much more consistent across different goal densities than Single-Critic RL (left).

Limitations and Future Work

  • Infeasible Commands: If a user sets a keyframe that is physically impossible to reach in the given time (e.g., "run 10 meters in 0.1 seconds"), the robot will fail to hit the target, though it generally remains stable and doesn't fall.
  • Dataset Dependency: The robot’s "style" is limited by the motions present in the training data. It cannot currently generalize to entirely "out-of-distribution" movements.
  • Future Directions: The authors suggest expanding the framework to include end-effector targets (like precise foot placement) and integrating more intuitive inputs like natural language commands (e.g., "walk like a tired dog to the door").

Summary updated

BibTeX
@misc{zargarbashi2024robotkeyframing,
  author = {Fatemeh Zargarbashi and Jin Cheng and Dongho Kang and Robert Sumner and Stelian Coros},
  title = {{RobotKeyframing: Learning Locomotion with High-Level Objectives via Mixture of Dense and Sparse Rewards}},
  year = {2024},
  eprint = {2407.11562},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.11562},
}
Figure