Skip to content

Repository files navigation

FR-Net (Unitree Go2 Fall Recovery)

A simple baseline implementation accompanying FR-Net: Learning Robust Quadrupedal Fall Recovery on Challenging Terrains through Mass-Contact Prediction (IEEE RA-L 2025 — see Reference).

Quadrupedal fall-recovery RL for the Unitree Go2, built on Isaac Gym / legged_gym. This is a deliberately minimal baseline: the policy recovers from arbitrary fallen poses using only the raw 45-dim proprioceptive observation and plain PPO — no mass-contact prediction. The repo is trimmed to the Go2 robot only and provides two tasks:

  • go2 — baseline locomotion (velocity tracking) with plain PPO.
  • go2_recovery — fall recovery from arbitrary fallen poses, plain PPO on the simplest 45-dim proprioceptive observation. See docs/go2_recovery.md for the full policy I/O spec and task design.

🎬 Demo

go2_recovery — the robot starts upside-down and flips itself back onto its feet (recorded via record_recovery.py):

go2_recovery demo

Full-resolution clip: docs/media/go2_recovery.mp4.


📦 Installation

A verified, GPU-tested setup (RTX 40-series / sm_89) is documented in docs/go2_recovery.md. In short:

  1. Conda env (Python 3.8):
    conda create -n unitree_rl_gym python==3.8
    conda activate unitree_rl_gym
  2. PyTorch 2.0.1 + CUDA 11.8 (works on modern GPUs; the old torch 1.10+cu113 does not support sm_89):
    pip install torch==2.0.1+cu118 torchvision==0.15.2+cu118 --index-url https://download.pytorch.org/whl/cu118
  3. NumPy < 1.24 (Isaac Gym uses the removed np.float):
    pip install "numpy==1.23.5"
  4. Isaac Gym Preview 4: cd isaacgym/python && pip install -e .
  5. This repo: pip install -e . (extra deps in requirements.txt).

The PPO implementation is vendored under legged_gym/algo/ppo, so the rsl_rl package is not required.


🔁 Workflow

Train → Play
  • Train: let the robot interact with the Isaac Gym simulation and learn a policy that maximizes the designed rewards. Headless mode is recommended for speed.
  • Play: load a trained checkpoint and visualize / evaluate the policy.

🛠️ Usage

1. Train

python legged_gym/scripts/train.py --task=go2_recovery --run_name v1 --headless --num_envs 4096

⚙️ Common arguments

  • --task: go2 or go2_recovery.
  • --headless: run without a viewer (faster). Omit to render.
  • --resume: resume training from a checkpoint in logs/.
  • --experiment_name: experiment name to run/load.
  • --run_name: name of this run.
  • --load_run: run to load when resuming (default: latest).
  • --checkpoint: checkpoint number to load (default: latest).
  • --num_envs: number of parallel environments.
  • --seed: random seed.
  • --max_iterations: maximum training iterations.
  • --sim_device / --rl_device: e.g. cuda:0, or cpu.

Checkpoints are saved to logs/<experiment_name>/<date_time>_<run_name>/model_<iteration>.pt.

2. Play

Baseline locomotion:

python legged_gym/scripts/play.py --task=go2

Fall recovery (keyboard + optional gamepad):

python legged_gym/scripts/play_recovery.py --task=go2_recovery

A pretrained checkpoint ships with the repo at logs/GO2_recovery/pretrained_recovery_v3/model_2000.pt, so the command above works out of the box on a fresh clone (no training needed). To force it explicitly (e.g. if you already have your own runs):

python legged_gym/scripts/play_recovery.py --task=go2_recovery \
    --load_run=pretrained_recovery_v3 --checkpoint=2000

Recovery controls:

  • Space — toggle the policy on/off (off = zero action)
  • Backspace — randomize the robot pose (trigger a fall to recover from)
  • Arrow keys — linear velocity command (x / y)
  • A / D — yaw angular-velocity command

During play there is no time-out termination (cfg.env.test = True): the robot keeps recovering and only resets on demand.


🐕 Tasks

Task Description Obs (actor) Runner
go2 Velocity-tracking locomotion 45-dim OnPolicyRunner + ActorCritic
go2_recovery Fall recovery from random poses 45-dim OnPolicyRunner + ActorCritic

Details for the recovery task (observation layout, reward shaping, training/play, environment setup) live in docs/go2_recovery.md.


🎉 Acknowledgments

Built upon these open-source projects:

  • unitree_rl_gym — Unitree's RL gym this repo is structured after.
  • legged_gym — training/runtime foundation.
  • rsl_rl — the PPO implementation this repo's vendored algo/ppo is derived from.
  • Isaac Gym — physics simulation.

📚 Reference

go2_recovery is a simplified baseline of:

  • Y. Lu, Y. Dong, J. Zhang, J. Ma, and P. Lu. FR-Net: Learning Robust Quadrupedal Fall Recovery on Challenging Terrains through Mass-Contact Prediction. IEEE Robotics and Automation Letters, 10(7):6632–6639, 2025. DOI:10.1109/LRA.2025.3569117 · IEEE Xplore · arXiv:2509.11504
@ARTICLE{10999057,
  author={Lu, Yidan and Dong, Yinzhao and Zhang, Jiahui and Ma, Ji and Lu, Peng},
  journal={IEEE Robotics and Automation Letters},
  title={FR-Net: Learning Robust Quadrupedal Fall Recovery on Challenging Terrains through Mass-Contact Prediction},
  year={2025},
  volume={10},
  number={7},
  pages={6632-6639},
  doi={10.1109/LRA.2025.3569117}}

🔖 License

BSD 3-Clause License — see LICENSE.

About

A simple PPO baseline for Unitree Go2 fall recovery, accompanying FR-Net (IEEE RA-L 2025).

Topics

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages