How teddy-liao/walk-these-ways-go2 works
Project Type and Purpose
• This is a full‐stack Sim‑to‑Real robotics framework for the Unitree Go2 quadruped. It comprises three domains:
a. Simulation & environment (go2_gym)
b. Reinforcement‑learning training (go2_gym_learn + scripts/train.py)
c. Real‑robot deployment (go2_gym_deploy + C++ LCM ↔ Unitree SDK2 interface)
High‑Level Component Breakdown
A. Simulation & Environment Layer
• Python “Gym” wrappers in go2_gym/envs/... use Isaac Gym and URDF/DAE robot models in resources/robots/....
• Base classes (legged_robot.py, base_task.py) define physics interface, curriculum, reward functions.
B. Training & Learning Layer
• PPO implementations under go2_gym_learn/ppo (and variant ppo_cse), plus vectorized env support in go2_gym_learn/env/vec_env.py.
• Utility modules for metrics, data logging, domain randomization in go2_gym_learn/eval_metrics.
• Training entry point scripts/train.py, experiment logs/checkpoints saved under runs/.
C. Deployment Layer
• C++ executable lcm_position_go2 built via CMake in go2_gym_deploy, linking Unitree SDK2 library.
• LCM message definitions in go2_gym_deploy/lcm_types/*_(lcmt).lcm/py/hpp.
• Python deploy script go2_gym_deploy/scripts/deploy_policy.py publishes policy commands over LCM.
• Hardware SDK (unitree_sdk2) integrated as a third‑party library under go2_gym_deploy/unitree_sdk2_bin.
Component Interactions & Data Flow
1. During Training:
[Python PPO Agent] → samples actions →
[go2_gym Env Wrappers] ←– state from Isaac Gym simulation & URDF models
↳ reward/curriculum → PPO update → checkpoints in runs/
2. During Deployment:
[Python deploy_policy.py] ← loads trained weights →
publishes LCM command messages →
[lcm_position_go2 C++ Service] ← subscribes to LCM → translates to Unitree SDK2 calls →
[Unitree Go2 Robot Hardware]
in parallel, [Unitree SDK2] → sensor feedback → publishes LCM state messages →
[Python cheetah_state_estimator.py] → state estimation → feed to deploy_policy
Architectural Patterns & Principles
• Modular separation: Simulation vs. Training vs. Deployment
• Clear “message bus” abstraction via LCM decouples Python and C++ layers
• Configuration injection: Robot parameters in go2_config.py vs. base configs
• Reusable base classes and inheritance in go2_gym/envs/base
• Experiment reproducibility: deterministic seed, curriculum saved in runs/.../curriculum
Technologies & Frameworks
• Python 3 + PyTorch + Isaac Gym
• OpenAI‑style Gym API
• Reinforcement Learning: PPO algorithm
• Build & Deployment: CMake, C++17, Unitree SDK2
• Message passing: LCM (Lightweight Communications and Marshalling)
• URDF/DAE robot models, conda environment