# AMP Tools for `get_up`

This folder contains all AMP-related code for `rl_game/get_up`.

## Files

- `amp_rewards.py`: AMP discriminator + reward function used by training config.
- `amp_motion.py`: Build AMP expert features from local get-up keyframe YAML files.
- `migrate_legged_lab_expert_template.py`: Template converter for migrating external expert data (for example legged_lab outputs) to `expert_features.pt`.

## Quick start

Generate expert features from current local keyframes:

```bash
python rl_game/get_up/train.py --amp_from_keyframes --headless
```

Convert external motion/expert file to AMP template:

```bash
python rl_game/get_up/amp/migrate_legged_lab_expert_template.py \
  --input /path/to/source_data.pt \
  --output rl_game/get_up/amp/expert_features.pt \
  --input_key expert_features \
  --feature_dim 55 \
  --repeat 4
```

Convert downloaded `legged_lab` motion pickles directly:

```bash
python rl_game/get_up/amp/migrate_legged_lab_expert_template.py \
  --input third_party/legged_lab/source/legged_lab/legged_lab/data/MotionData/g1_29dof/amp/walk_and_run \
  --input_glob "*.pkl" \
  --target_dof 23 \
  --feature_dim 55 \
  --clip_weight_mode uniform \
  --output rl_game/get_up/amp/expert_features.pt
```

For get-up data from gitee legged_lab, use git-like focused clip sampling:

```bash
python rl_game/get_up/amp/migrate_legged_lab_expert_template.py \
  --input third_party/legged_lab_gitee/source/legged_lab/legged_lab/data/MotionData/g1_29dof/amp/get_up \
  --input_glob "*.pkl" \
  --target_dof 23 \
  --feature_dim 55 \
  --clip_weight_mode git_getup_focus \
  --output rl_game/get_up/amp/expert_features.pt
```

Then train with online AMP discriminator:

```bash
python rl_game/get_up/train.py \
  --amp_train_discriminator \
  --amp_expert_features rl_game/get_up/amp/expert_features.pt \
  --amp_reward_weight 0.6 \
  --headless
```
