exptech commited on
Commit
b6e5497
·
verified ·
1 Parent(s): cc832d2

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. .gitattributes +8 -57
  2. .gitignore +3 -0
  3. .gitmodules +12 -0
  4. .playwright-mcp/console-2026-02-25T23-30-28-765Z.log +7 -0
  5. .playwright-mcp/console-2026-02-25T23-36-54-631Z.log +1 -0
  6. .playwright-mcp/console-2026-02-25T23-57-00-677Z.log +3 -0
  7. .playwright-mcp/console-2026-02-26T00-03-30-969Z.log +1 -0
  8. .playwright-mcp/console-2026-02-26T00-07-08-716Z.log +1 -0
  9. .playwright-mcp/console-2026-02-26T00-07-14-577Z.log +5 -0
  10. .playwright-mcp/console-2026-02-26T00-11-16-782Z.log +2 -0
  11. .playwright-mcp/console-2026-02-26T00-12-06-806Z.log +1 -0
  12. CLAUDE.md +742 -0
  13. DATASET_CARD.md +257 -0
  14. Motion-Player-ROS/CMakeLists.txt +37 -0
  15. Motion-Player-ROS/LICENSE +21 -0
  16. Motion-Player-ROS/README.md +188 -0
  17. Motion-Player-ROS/package.xml +27 -0
  18. README.md +276 -0
  19. __pycache__/retarget_all.cpython-313.pyc +0 -0
  20. app/scripts/CLAUDE.md +7 -0
  21. bonus/CLAUDE.md +11 -0
  22. bonus/movin_export_result.txt +5 -0
  23. dance/CLAUDE.md +7 -0
  24. dance/movin_export_result.txt +5 -0
  25. docs/plans/CLAUDE.md +7 -0
  26. export_onnx.py +215 -0
  27. external/CLAUDE.md +7 -0
  28. generate_metadata.py +504 -0
  29. karate/CLAUDE.md +7 -0
  30. karate/movin_export_result.txt +5 -0
  31. manifest.json +0 -0
  32. mjlab/.dockerignore +5 -0
  33. mjlab/.gitignore +20 -0
  34. mjlab/.pre-commit-config.yaml +10 -0
  35. mjlab/.python-version +1 -0
  36. mjlab/CITATION.cff +60 -0
  37. mjlab/CLAUDE.md +45 -0
  38. mjlab/CONTRIBUTING.md +25 -0
  39. mjlab/Dockerfile +36 -0
  40. mjlab/LICENSE +202 -0
  41. mjlab/Makefile +66 -0
  42. mjlab/README.md +233 -0
  43. mjlab/RELEASING.md +76 -0
  44. mjlab/pyproject.toml +155 -0
  45. mjlab/uv.lock +0 -0
  46. movin-studio-project/project.json +0 -0
  47. quality_report.json +1512 -0
  48. render_all.sh +31 -0
  49. render_bvh.py +237 -0
  50. retarget_all.py +364 -0
.gitattributes CHANGED
@@ -1,60 +1,11 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.avro filter=lfs diff=lfs merge=lfs -text
4
  *.bin filter=lfs diff=lfs merge=lfs -text
5
- *.bz2 filter=lfs diff=lfs merge=lfs -text
6
- *.ckpt filter=lfs diff=lfs merge=lfs -text
7
- *.ftz filter=lfs diff=lfs merge=lfs -text
8
- *.gz filter=lfs diff=lfs merge=lfs -text
9
- *.h5 filter=lfs diff=lfs merge=lfs -text
10
- *.joblib filter=lfs diff=lfs merge=lfs -text
11
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
12
- *.lz4 filter=lfs diff=lfs merge=lfs -text
13
- *.mds filter=lfs diff=lfs merge=lfs -text
14
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
15
- *.model filter=lfs diff=lfs merge=lfs -text
16
- *.msgpack filter=lfs diff=lfs merge=lfs -text
17
- *.npy filter=lfs diff=lfs merge=lfs -text
18
- *.npz filter=lfs diff=lfs merge=lfs -text
19
- *.onnx filter=lfs diff=lfs merge=lfs -text
20
- *.ot filter=lfs diff=lfs merge=lfs -text
21
- *.parquet filter=lfs diff=lfs merge=lfs -text
22
- *.pb filter=lfs diff=lfs merge=lfs -text
23
- *.pickle filter=lfs diff=lfs merge=lfs -text
24
- *.pkl filter=lfs diff=lfs merge=lfs -text
25
- *.pt filter=lfs diff=lfs merge=lfs -text
26
- *.pth filter=lfs diff=lfs merge=lfs -text
27
- *.rar filter=lfs diff=lfs merge=lfs -text
28
- *.safetensors filter=lfs diff=lfs merge=lfs -text
29
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
30
- *.tar.* filter=lfs diff=lfs merge=lfs -text
31
- *.tar filter=lfs diff=lfs merge=lfs -text
32
- *.tflite filter=lfs diff=lfs merge=lfs -text
33
- *.tgz filter=lfs diff=lfs merge=lfs -text
34
- *.wasm filter=lfs diff=lfs merge=lfs -text
35
- *.xz filter=lfs diff=lfs merge=lfs -text
36
- *.zip filter=lfs diff=lfs merge=lfs -text
37
- *.zst filter=lfs diff=lfs merge=lfs -text
38
- *tfevents* filter=lfs diff=lfs merge=lfs -text
39
- # Audio files - uncompressed
40
- *.pcm filter=lfs diff=lfs merge=lfs -text
41
- *.sam filter=lfs diff=lfs merge=lfs -text
42
- *.raw filter=lfs diff=lfs merge=lfs -text
43
- # Audio files - compressed
44
- *.aac filter=lfs diff=lfs merge=lfs -text
45
- *.flac filter=lfs diff=lfs merge=lfs -text
46
- *.mp3 filter=lfs diff=lfs merge=lfs -text
47
- *.ogg filter=lfs diff=lfs merge=lfs -text
48
- *.wav filter=lfs diff=lfs merge=lfs -text
49
- # Image files - uncompressed
50
- *.bmp filter=lfs diff=lfs merge=lfs -text
51
  *.gif filter=lfs diff=lfs merge=lfs -text
52
- *.png filter=lfs diff=lfs merge=lfs -text
53
- *.tiff filter=lfs diff=lfs merge=lfs -text
54
- # Image files - compressed
55
- *.jpg filter=lfs diff=lfs merge=lfs -text
56
- *.jpeg filter=lfs diff=lfs merge=lfs -text
57
- *.webp filter=lfs diff=lfs merge=lfs -text
58
- # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
- *.webm filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
1
+ *.fbx filter=lfs diff=lfs merge=lfs -text
2
+ *.bvh filter=lfs diff=lfs merge=lfs -text
 
3
  *.bin filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  *.gif filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
5
  *.mp4 filter=lfs diff=lfs merge=lfs -text
6
+ *.pkl filter=lfs diff=lfs merge=lfs -text
7
+ *_training.gif !filter !diff !merge text=auto
8
+ *_training.mp4 !filter !diff !merge text=auto
9
+ *_policy.gif !filter !diff !merge text=auto
10
+ *_policy.mp4 !filter !diff !merge text=auto
11
+ *_policy.pt !filter !diff !merge text=auto
.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
.gitmodules ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [submodule "Motion-Player-ROS"]
2
+ path = Motion-Player-ROS
3
+ url = https://github.com/MOVIN3D/Motion-Player-ROS.git
4
+ [submodule "mjlab"]
5
+ path = mjlab
6
+ url = https://github.com/mujocolab/mjlab
7
+ [submodule "RoboJuDo"]
8
+ path = RoboJuDo
9
+ url = https://github.com/experientialtech/RoboJuDo.git
10
+ [submodule "external/video2robot"]
11
+ path = external/video2robot
12
+ url = https://github.com/AIM-Intelligence/video2robot
.playwright-mcp/console-2026-02-25T23-30-28-765Z.log ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ [ 3414ms] [WARNING] Failed to create WebGPU Context Provider @ https://abs.twimg.com/responsive-web/client-web/vendor.e0c4a7ca.js:0
2
+ [ 4259ms] [ERROR] Not signed in with the identity provider. @ https://x.com/taker_of_whizz/status/2026749425851253095:0
3
+ [ 4260ms] [ERROR] [GSI_LOGGER]: FedCM get() rejects with AbortError: signal is aborted without reason @ https://accounts.google.com/gsi/client:81
4
+ [ 4260ms] [ERROR] Not signed in with the identity provider. @ https://x.com/taker_of_whizz/status/2026749425851253095:0
5
+ [ 7228ms] [ERROR] Framing 'https://accounts.google.com/' violates the following report-only Content Security Policy directive: "frame-ancestors 'self'". The violation has been logged, but no further action has been taken.
6
+ @ :0
7
+ [ 7372ms] [ERROR] [GSI_LOGGER]: FedCM get() rejects with NetworkError: Error retrieving a token. @ https://accounts.google.com/gsi/client:81
.playwright-mcp/console-2026-02-25T23-36-54-631Z.log ADDED
@@ -0,0 +1 @@
 
 
1
+ [ 1851ms] [ERROR] Failed to load resource: the server responded with a status of 401 () @ https://www.virustotal.com/ui/me?relationships=active_group%2Cparent_group:0
.playwright-mcp/console-2026-02-25T23-57-00-677Z.log ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ [ 4324ms] [WARNING] Unrecognized feature: 'web-share'. @ https://www.google.com/xjs/_/js/k=xjs.s.en.QjWJURgsC5I.2019.O/am=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAiAAACSAAAAQAAAAAAAAAAAAAACAAAgACAAAAAAAAAAAAAAAAAAAAAAAAACAgAAACAAACQAAAAAAAAAAAAIAAABAAAAAAAAAAAAABgACAAACCFAgAAAAKAAAAAAAAAAAAAAAAAAAAGAQCAAAAAkkAAD-bX9AAwAAAAAAAAIAAAAAAAAAAAAAAAAACQAAAAAAAAAAAAsAAAAQCgMAEAAhAAEAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAgAAAAAIACAAAgAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAgAAAEAAAAAOAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAIYAAAAAACAAgAB_AAABAAAAAAAADgAQACAQAAAAAAAuIAQAQCAAAAAAADIAeDxAA4RFAAAAAAAAAAAAAAAAAAAAAAAABAABWAcSH5AAAIAAAAAAAAAAAAAAAAAAAAAAAAAAKAibApWDQAI/d=0/dg=0/br=1/rs=ACT90oFbf07X_2j7uDMQrGJWGbw7Wk2O-Q/cb=loaded_h_0/m=sy416,P10Owf,sy2xe,gSZvdb,sy7n9,sy1uf,sy1ol,sy1oj,sy1ok,sy2yi,sy2yh,VD4Qme,VEbNoe,sy7n8,TmFfhf,sy312,Dq2Yjb,sy315,sy313,sy1q0,NVlnE,sy317,sy30x,qmdEUe,sy319,sy318,UqGwg,sy689,qcH9Lc,sy67s,pjDTFb,gCngrf,sy67u,sy2qf,sA1ssc,sy67q,khkNpe?xjs=s4:173
2
+ [ 4677ms] [ERROR] Failed to load resource: net::ERR_CACHE_MISS @ https://www.google.com/search?vsrid=CNqBibvJhY-gtQEQAhgBIiQyMGVhNTNhOC1kOWU3LTQ2MTgtYWEwYS04NTA1MjhjYTNjMjkyBiICZHooCTiN0uyU7PWSAw&vsint=CAIqDAoCCAcSAggKGAEgATojChYNAAAAPxUAAAA_HQAAgD8lAACAPzABEIAIGLgDJQAAgD8&udm=26&lns_mode=un&source=lns.web.ukn&vsdim=1024,440&gsessionid=fS2O8swB_Q92WjLEqfedfw4rLF8DawyupRGtSTi5iGvUSlnMUUkuPw&lsessionid=w24RHwvVVCgYFH-xU2XDNHaB7GZdVUtlS9M7biZck6vd0EN8jbvWNw&lns_surface=26&lns_vfs=e&cs=0:0
3
+ [ 5190ms] [WARNING] Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://www.youtube.com') does not match the recipient window's origin ('https://www.google.com'). @ https://www.youtube.com/s/player/4e67f8a0/www-widgetapi.vflset/www-widgetapi.js:209
.playwright-mcp/console-2026-02-26T00-03-30-969Z.log ADDED
@@ -0,0 +1 @@
 
 
1
+ [ 9967ms] [ERROR] Failed to load resource: net::ERR_CERT_AUTHORITY_INVALID @ https://hdrc.yandex.net/:0
.playwright-mcp/console-2026-02-26T00-07-08-716Z.log ADDED
@@ -0,0 +1 @@
 
 
1
+ [ 513ms] [ERROR] Failed to load resource: the server responded with a status of 503 () @ https://nitter.poast.org/taker_of_whizz/status/2026749425851253095:0
.playwright-mcp/console-2026-02-26T00-07-14-577Z.log ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ [ 493ms] [ERROR] Failed to load resource: the server responded with a status of 503 () @ https://xcancel.com/taker_of_whizz/status/2026749425851253095:0
2
+ [ 1175ms] ReferenceError: a0_0x44517f is not defined
3
+ at getHighEntropyValues (blob:https://xcancel.com/c01e03ed-a9a1-45e3-9554-c3726bc611cc:1:105)
4
+ at self.onmessage (blob:https://xcancel.com/c01e03ed-a9a1-45e3-9554-c3726bc611cc:1:466)
5
+ [ 18694ms] [WARNING] The resource https://xcancel.com/fonts/fontello.woff2?61663884 was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally. @ https://xcancel.com/taker_of_whizz/status/2026749425851253095:0
.playwright-mcp/console-2026-02-26T00-11-16-782Z.log ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [ 35ms] [ERROR] Failed to load resource: net::ERR_CONNECTION_CLOSED @ https://www.youtube.com/youtubei/v1/log_event?alt=json:0
2
+ [ 883ms] [ERROR] Failed to load resource: the server responded with a status of 403 () @ https://patched.to/search.php?action=do_search&keywords=seedance&postthread=1&submit=Search:0
.playwright-mcp/console-2026-02-26T00-12-06-806Z.log ADDED
@@ -0,0 +1 @@
 
 
1
+ [ 4186ms] [ERROR] Failed to load resource: net::ERR_CERT_AUTHORITY_INVALID @ https://hdrc.yandex.net/:0
CLAUDE.md ADDED
@@ -0,0 +1,742 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # G1 Moves — Motion-to-Policy Pipeline
2
+
3
+ ## Project Overview
4
+
5
+ This repository contains 59 motion capture clips for the Unitree G1 humanoid robot (mode 15, 29 DOF). The pipeline takes raw BVH motion capture from MOVIN3D and processes it through retargeting, training data generation, RL policy training, and archival.
6
+
7
+ **Robot**: Unitree G1, mode 15, 29 DOF
8
+ **Capture systems**: MOVIN TRACIN (markerless, LiDAR + vision), video2robot (monocular video)
9
+ **Training framework**: mjlab (MuJoCo-Warp + RSL-RL PPO)
10
+ **Workstation**: Dell Pro Max Tower T2, RTX PRO 6000 (96GB), Ubuntu 24.04
11
+
12
+ ## Repository Layout
13
+
14
+ ```
15
+ g1-moves/
16
+ dance/ 28 clips
17
+ karate/ 27 clips
18
+ bonus/ 4 clips
19
+ <category>/<clip>/
20
+ capture/ Original mocap
21
+ <clip>.bvh BVH motion (51-joint humanoid, 60 FPS)
22
+ <clip>.gif Preview GIF
23
+ <clip>.mp4 Preview video
24
+ <clip>_{bl,mb,ue,un}.fbx FBX exports
25
+ retarget/ G1 retargeting
26
+ <clip>.pkl Retargeted joints (29 DOF)
27
+ <clip>.csv Same as PKL in CSV format
28
+ <clip>_retarget.gif Retarget preview
29
+ <clip>_retarget.mp4 Retarget video
30
+ training/ RL training data
31
+ <clip>.npz Training-ready data
32
+ <clip>_training.gif Training visualization
33
+ <clip>_training.mp4 Training video
34
+ policy/ Trained RL policy (when available)
35
+ <clip>_policy.pt PyTorch checkpoint
36
+ <clip>_policy.gif Policy rollout GIF
37
+ <clip>_policy.mp4 Policy rollout video
38
+ agent.yaml PPO hyperparameters
39
+ env.yaml Full environment config
40
+ training_log.csv Training metrics
41
+ external/
42
+ video2robot/ video2robot pipeline (monocular video → robot motion)
43
+ manifest.json Per-clip metadata index
44
+ quality_report.json Automated validation
45
+ generate_metadata.py Regenerate metadata
46
+ retarget_all.py Batch retarget pipeline
47
+ DATASET_CARD.md Dataset documentation
48
+ ```
49
+
50
+ ## Key Paths
51
+
52
+ | What | Path |
53
+ |------|------|
54
+ | This repo | `~/Repositories/g1-moves` |
55
+ | mjlab-gui | `~/Repositories/mjlab-gui` |
56
+ | G1 URDF | `~/Repositories/g1-urdf` |
57
+ | MuJoCo XML | `~/Repositories/g1-urdf/g1_mode15_square.xml` |
58
+ | Training logs | `~/Repositories/mjlab-gui/logs/rsl_rl/g1_tracking/` |
59
+ | video2robot | `~/Repositories/g1-moves/external/video2robot` |
60
+ | GMR | `~/Repositories/g1-moves/external/video2robot/third_party/GMR` |
61
+ | PromptHMR | `~/Repositories/g1-moves/external/video2robot/third_party/PromptHMR` |
62
+
63
+ ## Pipeline Stages
64
+
65
+ There are two input paths that converge at the PKL stage:
66
+ - **Path A (BVH)**: MOVIN TRACIN → BVH → retarget_all.py → PKL (Stage 1)
67
+ - **Path B (Video)**: Any video → PromptHMR → SMPL-X → GMR → PKL (Stage 0)
68
+
69
+ Both produce the same PKL format and feed into Stage 2+ identically.
70
+
71
+ ### Stage 0: Video to PKL via video2robot
72
+
73
+ Extracts human pose from monocular video (YouTube, phone, etc.) and retargets to G1 robot joints. Alternative to the BVH pipeline for clips without mocap hardware.
74
+
75
+ **Input**: Any MP4 video with a visible full-body human
76
+ **Output**: `<category>/<clip>/retarget/<clip>.pkl`, `<clip>.csv`
77
+
78
+ **Environments**: Two separate conda envs required (conflicting deps):
79
+ - `phmr` (Python 3.11) — PromptHMR pose extraction (PyTorch 2.9+, xformers, SAM2, detectron2)
80
+ - `gmr` (Python 3.10) — GMR motion retargeting (MuJoCo, mink IK solver)
81
+
82
+ #### Step 1: Set up project directory
83
+
84
+ ```bash
85
+ CLIP=V_MyClip
86
+ CATEGORY=bonus
87
+ V2R=~/Repositories/g1-moves/external/video2robot
88
+
89
+ # Create project folder with video
90
+ mkdir -p $V2R/data/$CLIP
91
+ cp /path/to/video.mp4 $V2R/data/$CLIP/original.mp4
92
+ ```
93
+
94
+ Or download from YouTube:
95
+ ```bash
96
+ yt-dlp -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" \
97
+ -o "$V2R/data/$CLIP/original.mp4" "https://youtube.com/..."
98
+ ```
99
+
100
+ #### Step 2: Extract pose (PromptHMR)
101
+
102
+ ```bash
103
+ cd $V2R
104
+ conda run -n phmr python scripts/extract_pose.py \
105
+ --project data/$CLIP --static-camera
106
+ ```
107
+
108
+ **What it does**:
109
+ 1. Converts video to H.264 if needed (AV1, VP9, etc.)
110
+ 2. Runs person detection + SAM2 tracking
111
+ 3. Estimates 3D human mesh (SMPL-X) per frame via PromptHMR
112
+ 4. Exports `smplx.npz` with root_orient, pose_body, betas, trans
113
+
114
+ **Output**: `data/$CLIP/smplx.npz`, `smplx_tracks.json`, `results.pkl`, `world4d.glb`
115
+
116
+ **Flags**:
117
+ - `--static-camera`: Skip SLAM camera estimation (use for tripod/fixed-camera videos)
118
+
119
+ **Time**: ~2-5 min on RTX PRO 6000
120
+
121
+ #### Step 3: Retarget to G1 (GMR)
122
+
123
+ ```bash
124
+ cd $V2R
125
+ conda run -n gmr python scripts/convert_to_robot.py \
126
+ --project data/$CLIP --robot unitree_g1 --no-twist
127
+ ```
128
+
129
+ **What it does**:
130
+ 1. Loads SMPL-X body model, computes human height from betas
131
+ 2. Per-frame IK: maps SMPL-X joints → G1 29-DOF joint angles
132
+ 3. Forward kinematics for body positions + ground calibration
133
+ 4. Saves PKL: `{fps, root_pos (N,3), root_rot (N,4) xyzw, dof_pos (N,29)}`
134
+
135
+ **Output**: `data/$CLIP/robot_motion.pkl`
136
+
137
+ **Flags**:
138
+ - `--no-twist`: Skip 23-DOF TWIST conversion (we use 29-DOF)
139
+ - `--all-tracks`: Retarget every detected person (default: best track only)
140
+ - `--fps 60`: Upsample to 60 FPS (default: keep original video FPS)
141
+
142
+ **Time**: ~30s for 285 frames
143
+
144
+ #### Step 4: Copy to g1-moves and generate CSV
145
+
146
+ ```bash
147
+ mkdir -p ~/Repositories/g1-moves/$CATEGORY/$CLIP/{capture,retarget,training,policy}
148
+
149
+ # Copy video + retarget output
150
+ cp $V2R/data/$CLIP/original.mp4 ~/Repositories/g1-moves/$CATEGORY/$CLIP/capture/$CLIP.mp4
151
+ cp $V2R/data/$CLIP/robot_motion.pkl ~/Repositories/g1-moves/$CATEGORY/$CLIP/retarget/$CLIP.pkl
152
+
153
+ # Generate CSV (36 columns: 3 pos + 4 quat_xyzw + 29 joints)
154
+ python3 -c "
155
+ import pickle, numpy as np
156
+ with open('$HOME/Repositories/g1-moves/$CATEGORY/$CLIP/retarget/$CLIP.pkl','rb') as f:
157
+ d = pickle.load(f)
158
+ combined = np.hstack([d['root_pos'], d['root_rot'], d['dof_pos']])
159
+ np.savetxt('$HOME/Repositories/g1-moves/$CATEGORY/$CLIP/retarget/$CLIP.csv', combined, delimiter=',', fmt='%.10f')
160
+ print(f'CSV: {combined.shape[0]} frames x {combined.shape[1]} cols')
161
+ "
162
+ ```
163
+
164
+ #### Step 5: Visualize in MuJoCo
165
+
166
+ ```bash
167
+ cd ~/Repositories/g1-moves/external/video2robot/third_party/GMR
168
+ conda run -n gmr python scripts/vis_robot_motion.py \
169
+ --robot unitree_g1 \
170
+ --robot_motion_path ~/Repositories/g1-moves/$CATEGORY/$CLIP/retarget/$CLIP.pkl \
171
+ --record_video \
172
+ --video_path ~/Repositories/g1-moves/$CATEGORY/$CLIP/retarget/${CLIP}_retarget.mp4
173
+ ```
174
+
175
+ #### Step 6: Self-collision correction
176
+
177
+ video2robot/GMR does not enforce self-collision avoidance during retargeting. Post-process to fix arm-into-arm, arm-into-torso, etc:
178
+
179
+ ```bash
180
+ python3 -c "
181
+ import pickle, mujoco, numpy as np
182
+
183
+ CLIP='$CLIP'; CAT='$CATEGORY'
184
+ PKL=f'$HOME/Repositories/g1-moves/{CAT}/{CLIP}/retarget/{CLIP}.pkl'
185
+ CSV=f'$HOME/Repositories/g1-moves/{CAT}/{CLIP}/retarget/{CLIP}.csv'
186
+
187
+ with open(PKL,'rb') as f: d=pickle.load(f)
188
+ model=mujoco.MjModel.from_xml_path('$HOME/Repositories/g1-urdf/g1_mode15_square.xml')
189
+ data=mujoco.MjData(model)
190
+ rp,rr,dp=d['root_pos'].copy(),d['root_rot'].copy(),d['dof_pos'].copy()
191
+ n=len(rp)
192
+
193
+ def has_col(i):
194
+ data.qpos[:3]=rp[i]; data.qpos[3:7]=[rr[i,3],rr[i,0],rr[i,1],rr[i,2]]; data.qpos[7:]=dp[i]
195
+ mujoco.mj_forward(model,data)
196
+ return any(model.body(model.geom_bodyid[data.contact[c].geom1]).name!='world'
197
+ and model.body(model.geom_bodyid[data.contact[c].geom2]).name!='world'
198
+ for c in range(data.ncon))
199
+
200
+ # Find collision ranges
201
+ ic=[i for i in range(n) if has_col(i)]
202
+ print(f'{len(ic)} collision frames')
203
+
204
+ # Interpolate arm joints (15-28) from boundary clean frames
205
+ ARM=list(range(15,29))
206
+ ranges=[]; i=0
207
+ while i<n:
208
+ if has_col(i):
209
+ s=i
210
+ while i<n and has_col(i): i+=1
211
+ ranges.append((s,i-1))
212
+ else: i+=1
213
+
214
+ for s,e in ranges:
215
+ cb=s-1; ca=e+1
216
+ while cb>0 and has_col(cb): cb-=1
217
+ while ca<n-1 and has_col(ca): ca+=1
218
+ span=ca-cb
219
+ for f in range(s,e+1):
220
+ t=(f-cb)/span if span>0 else 0.5
221
+ for j in ARM: dp[f,j]=(1-t)*dp[cb,j]+t*dp[ca,j]
222
+
223
+ # If any remain, widen to all joints
224
+ for _ in range(3):
225
+ ic2=[i for i in range(n) if has_col(i)]
226
+ if not ic2: break
227
+ for s,e in ranges:
228
+ cb=max(0,s-3); ca=min(n-1,e+3)
229
+ while cb>0 and has_col(cb): cb-=1
230
+ while ca<n-1 and has_col(ca): ca+=1
231
+ span=ca-cb
232
+ for f in range(s,e+1):
233
+ if not has_col(f): continue
234
+ t=(f-cb)/span if span>0 else 0.5
235
+ dp[f]=(1-t)*dp[cb]+t*dp[ca]
236
+
237
+ final=sum(has_col(i) for i in range(n))
238
+ print(f'Remaining: {final}')
239
+
240
+ d['dof_pos']=dp.astype(np.float32)
241
+ with open(PKL,'wb') as f: pickle.dump(d,f)
242
+ np.savetxt(CSV,np.hstack([rp,rr,dp]),delimiter=',',fmt='%.10f')
243
+ print('Saved corrected PKL+CSV')
244
+ "
245
+ ```
246
+
247
+ **Strategy**: For collision frames, interpolate arm joints (shoulder/elbow/wrist) between nearest clean boundary frames. Falls back to full-joint interpolation if arm-only doesn't resolve. Typically corrects <5 deg mean deviation, preserving motion character.
248
+
249
+ #### Verify
250
+
251
+ ```bash
252
+ python3 -c "
253
+ import pickle, numpy as np, mujoco
254
+ with open('$HOME/Repositories/g1-moves/$CATEGORY/$CLIP/retarget/$CLIP.pkl','rb') as f:
255
+ d = pickle.load(f)
256
+ assert d['dof_pos'].shape[1] == 29
257
+ assert d['root_rot'].shape[1] == 4
258
+ assert not np.any(np.isnan(d['dof_pos']))
259
+
260
+ # Self-collision check
261
+ model=mujoco.MjModel.from_xml_path('$HOME/Repositories/g1-urdf/g1_mode15_square.xml')
262
+ data=mujoco.MjData(model)
263
+ cols=0
264
+ for i in range(len(d['root_pos'])):
265
+ data.qpos[:3]=d['root_pos'][i]
266
+ data.qpos[3:7]=[d['root_rot'][i,3],d['root_rot'][i,0],d['root_rot'][i,1],d['root_rot'][i,2]]
267
+ data.qpos[7:]=d['dof_pos'][i]
268
+ mujoco.mj_forward(model,data)
269
+ for c in range(data.ncon):
270
+ b1=model.body(model.geom_bodyid[data.contact[c].geom1]).name
271
+ b2=model.body(model.geom_bodyid[data.contact[c].geom2]).name
272
+ if b1!='world' and b2!='world': cols+=1; break
273
+ print(f'frames={d[\"dof_pos\"].shape[0]}, fps={d[\"fps\"]}, dof={d[\"dof_pos\"].shape[1]}, self_collisions={cols}')
274
+ assert cols == 0, f'{cols} self-collision frames remain!'
275
+ "
276
+ ```
277
+
278
+ **Then continue with Stage 2 (CSV → NPZ) and beyond.**
279
+
280
+ ### Stage 1: Retarget BVH to PKL
281
+
282
+ Converts human motion capture to G1 robot joint trajectories using inverse kinematics.
283
+
284
+ **Input**: `<category>/<clip>/capture/<clip>.bvh`
285
+ **Output**: `<category>/<clip>/retarget/<clip>.pkl`
286
+
287
+ ```bash
288
+ cd ~/Repositories/g1-moves
289
+ python retarget_all.py --workers 4
290
+ ```
291
+
292
+ For a single clip:
293
+ ```bash
294
+ python retarget_all.py --clips "B_Fence1"
295
+ ```
296
+
297
+ **What it does**:
298
+ 1. Loads BVH via `movin_sdk_python.load_bvh_file()` with `human_height=1.75`
299
+ 2. Per-frame IK retargeting to G1 29-DOF joint limits
300
+ 3. Ground calibration: MuJoCo FK finds min ankle Z, shifts root down
301
+ 4. Renders 1080x1080 MP4 (libx264 CRF 18) + 360px 15fps GIF (capped at 20s)
302
+ 5. Saves PKL: `{fps: 60, root_pos: (N,3), root_rot: (N,4) xyzw, dof_pos: (N,29)}`
303
+
304
+ **Verify**:
305
+ ```bash
306
+ python -c "
307
+ import pickle
308
+ with open('<category>/<clip>/retarget/<clip>.pkl','rb') as f: d=pickle.load(f)
309
+ print(f'frames={d[\"dof_pos\"].shape[0]}, dof={d[\"dof_pos\"].shape[1]}')
310
+ assert d['dof_pos'].shape[1] == 29
311
+ "
312
+ ```
313
+
314
+ **Time**: ~5s per clip, ~5 min for all 59 with 4 workers
315
+
316
+ ### Stage 2: Convert PKL to NPZ Training Data
317
+
318
+ Runs MuJoCo forward kinematics to compute body positions, orientations, and velocities needed for RL training.
319
+
320
+ **Input**: `<category>/<clip>/retarget/<clip>.csv`
321
+ **Output**: `<category>/<clip>/training/<clip>.npz`
322
+
323
+ ```bash
324
+ cd ~/Repositories/mjlab-gui
325
+ MUJOCO_GL=egl uv run python src/mjlab/scripts/csv_to_npz.py \
326
+ --input-file ~/Repositories/g1-moves/<category>/<clip>/retarget/<clip>.csv \
327
+ --output-name <clip> \
328
+ --input-fps 60 \
329
+ --output-fps 60 \
330
+ --render
331
+ ```
332
+
333
+ Or use the local wrapper (bypasses WandB):
334
+ ```bash
335
+ cd ~/Repositories/mjlab-gui
336
+ MUJOCO_GL=egl python app/scripts/process_motion_local.py \
337
+ --input-file ~/Repositories/g1-moves/<category>/<clip>/retarget/<clip>.csv \
338
+ --output-name <clip> \
339
+ --run-folder <clip>_$(date +%Y%m%d_%H%M%S) \
340
+ --input-fps 60 \
341
+ --output-fps 60 \
342
+ --render
343
+ ```
344
+
345
+ **What it does**:
346
+ 1. Loads CSV (36 columns: 3 root pos + 4 root quat + 29 joint angles)
347
+ 2. Optional interpolation to target FPS
348
+ 3. MuJoCo FK: computes body positions, quaternions, linear/angular velocities
349
+ 4. Saves NPZ with joint_pos, joint_vel, body_pos_w, body_quat_w, body_lin_vel_w, body_ang_vel_w
350
+
351
+ **Output location**: `app/datasets/processed/<clip>_<timestamp>/motion.npz`
352
+
353
+ Copy to g1-moves:
354
+ ```bash
355
+ cp app/datasets/processed/<clip>_*/motion.npz \
356
+ ~/Repositories/g1-moves/<category>/<clip>/training/<clip>.npz
357
+ ```
358
+
359
+ **Verify**:
360
+ ```bash
361
+ python -c "
362
+ import numpy as np
363
+ d = np.load('<clip>.npz')
364
+ print({k: d[k].shape for k in d.files})
365
+ assert 'joint_pos' in d.files and 'body_pos_w' in d.files
366
+ "
367
+ ```
368
+
369
+ **Time**: ~10s per clip
370
+
371
+ ### Stage 3: Render Training Visualization
372
+
373
+ Render the NPZ training data as a MuJoCo video to visually verify the processed motion.
374
+
375
+ **Input**: `<category>/<clip>/training/<clip>.npz`
376
+ **Output**: `<category>/<clip>/training/<clip>_training.mp4`, `<clip>_training.gif`
377
+
378
+ The render is produced by the `--render` flag in Stage 2, or can be generated separately using the MuJoCo offscreen renderer with the same camera settings as retarget_all.py.
379
+
380
+ ### Stage 4: Train RL Policy
381
+
382
+ Train a PPO policy to imitate the reference motion in MuJoCo-Warp simulation.
383
+
384
+ **Input**: `<category>/<clip>/training/<clip>.npz`
385
+ **Output**: `~/Repositories/mjlab-gui/logs/rsl_rl/g1_tracking/<timestamp>_<clip>/`
386
+
387
+ ```bash
388
+ cd ~/Repositories/mjlab-gui
389
+ MUJOCO_GL=egl MUJOCO_EGL_DEVICE_ID=0 uv run train \
390
+ Mjlab-Tracking-Flat-Unitree-G1 \
391
+ --env.commands.motion.motion-file ~/Repositories/g1-moves/<category>/<clip>/training/<clip>.npz \
392
+ --env.scene.num-envs 4096 \
393
+ --agent.max-iterations 30000 \
394
+ --agent.save-interval 500 \
395
+ --agent.run-name <clip> \
396
+ --video --video-interval 5000
397
+ ```
398
+
399
+ **Key parameters**:
400
+ - `num-envs 4096`: parallel simulation environments (reduce to 2048/1024 if OOM)
401
+ - `max-iterations 30000`: training steps (~6 hours on RTX PRO 6000)
402
+ - `save-interval 500`: checkpoint every 500 iterations
403
+ - `video-interval 5000`: record evaluation video every 5000 steps
404
+
405
+ **Output structure**:
406
+ ```
407
+ logs/rsl_rl/g1_tracking/<timestamp>_<clip>/
408
+ model_0.pt ... model_29999.pt Checkpoints
409
+ params/agent.yaml PPO hyperparameters
410
+ params/env.yaml Environment config (includes motion_file path)
411
+ events.out.tfevents.* TensorBoard log
412
+ videos/ Evaluation videos
413
+ ```
414
+
415
+ **Monitor training**:
416
+ ```bash
417
+ # TensorBoard
418
+ uv run tensorboard --logdir logs/rsl_rl/g1_tracking/ --port 6006
419
+
420
+ # Key metrics to watch:
421
+ # - Train/mean_reward: should increase steadily, plateau ~3-5
422
+ # - Train/mean_episode_length: should increase toward max (10s)
423
+ # - Episode_Termination/time_out: should approach 1.0 (fewer early terminations)
424
+ # - Metrics/motion/error_body_pos: should decrease
425
+ ```
426
+
427
+ **Verify**:
428
+ ```bash
429
+ # Check final checkpoint exists and has expected keys
430
+ python -c "
431
+ import torch
432
+ ckpt = torch.load('logs/rsl_rl/g1_tracking/<run>/model_29999.pt', map_location='cpu', weights_only=False)
433
+ print(f'iter={ckpt[\"iter\"]}, keys={list(ckpt.keys())}')
434
+ assert ckpt['iter'] == 29999
435
+ "
436
+ ```
437
+
438
+ **Time**: ~6 hours for 30k iterations with 4096 envs on RTX PRO 6000
439
+
440
+ ### Stage 5: Render Policy Rollout
441
+
442
+ Play back the trained policy and record video.
443
+
444
+ **Input**: trained checkpoint + NPZ motion file
445
+ **Output**: policy rollout MP4 + GIF
446
+
447
+ ```bash
448
+ cd ~/Repositories/mjlab-gui
449
+ MUJOCO_GL=egl uv run play \
450
+ Mjlab-Tracking-Flat-Unitree-G1 \
451
+ --checkpoint-file logs/rsl_rl/g1_tracking/<run>/model_29999.pt \
452
+ --motion-file ~/Repositories/g1-moves/<category>/<clip>/training/<clip>.npz \
453
+ --num-envs 1 \
454
+ --video --video-length 600
455
+ ```
456
+
457
+ **Output**: `logs/rsl_rl/g1_tracking/<run>/videos/play/rl-video-step-0.mp4`
458
+
459
+ Generate GIF:
460
+ ```bash
461
+ ffmpeg -y -i input.mp4 \
462
+ -vf "fps=15,scale=360:-1:flags=lanczos,palettegen" -t 20 /tmp/palette.png
463
+ ffmpeg -y -i input.mp4 -i /tmp/palette.png \
464
+ -t 20 -lavfi "fps=15,scale=360:-1:flags=lanczos [x]; [x][1:v] paletteuse" output.gif
465
+ ```
466
+
467
+ ### Stage 6: Archive to g1-moves
468
+
469
+ Copy all policy artifacts back to the clip's directory structure.
470
+
471
+ ```bash
472
+ CLIP=<clip>
473
+ CATEGORY=<category>
474
+ RUN=<timestamp>_${CLIP}
475
+ LOGS=~/Repositories/mjlab-gui/logs/rsl_rl/g1_tracking/${RUN}
476
+ DEST=~/Repositories/g1-moves/${CATEGORY}/${CLIP}/policy
477
+
478
+ mkdir -p ${DEST}
479
+
480
+ # Copy final checkpoint (rename to standard name)
481
+ cp ${LOGS}/model_29999.pt ${DEST}/${CLIP}_policy.pt
482
+
483
+ # Copy training config
484
+ cp ${LOGS}/params/agent.yaml ${DEST}/agent.yaml
485
+ cp ${LOGS}/params/env.yaml ${DEST}/env.yaml
486
+
487
+ # Copy policy rollout video + generate GIF
488
+ cp ${LOGS}/videos/play/rl-video-step-0.mp4 ${DEST}/${CLIP}_policy.mp4
489
+ ffmpeg -y -i ${DEST}/${CLIP}_policy.mp4 \
490
+ -vf "fps=15,scale=360:-1:flags=lanczos,palettegen" -t 20 /tmp/palette.png
491
+ ffmpeg -y -i ${DEST}/${CLIP}_policy.mp4 -i /tmp/palette.png \
492
+ -t 20 -lavfi "fps=15,scale=360:-1:flags=lanczos [x]; [x][1:v] paletteuse" \
493
+ ${DEST}/${CLIP}_policy.gif
494
+
495
+ # Extract training log from TensorBoard
496
+ python -c "
497
+ from tensorboard.backend.event_processing.event_accumulator import EventAccumulator
498
+ import csv
499
+ ea = EventAccumulator('${LOGS}')
500
+ ea.Reload()
501
+ tags = ['Train/mean_reward','Train/mean_episode_length','Loss/value_function',
502
+ 'Loss/surrogate','Loss/learning_rate','Policy/mean_noise_std',
503
+ 'Episode_Reward/motion_body_pos','Episode_Reward/motion_body_ori',
504
+ 'Episode_Reward/motion_body_lin_vel','Episode_Reward/motion_body_ang_vel',
505
+ 'Episode_Reward/motion_global_root_pos','Episode_Reward/motion_global_root_ori',
506
+ 'Episode_Reward/action_rate_l2','Episode_Reward/joint_limit',
507
+ 'Episode_Reward/self_collisions','Metrics/motion/error_anchor_pos',
508
+ 'Metrics/motion/error_anchor_rot','Metrics/motion/error_body_pos',
509
+ 'Metrics/motion/error_body_rot','Metrics/motion/error_joint_pos',
510
+ 'Episode_Termination/time_out','Episode_Termination/anchor_pos',
511
+ 'Episode_Termination/anchor_ori','Perf/total_fps']
512
+ all_data = {}
513
+ for tag in tags:
514
+ for e in ea.Scalars(tag):
515
+ all_data.setdefault(e.step, {})[tag.replace('/','_')] = e.value
516
+ steps = sorted(all_data)
517
+ cols = sorted(set(c for r in all_data.values() for c in r))
518
+ with open('${DEST}/training_log.csv','w',newline='') as f:
519
+ w = csv.writer(f)
520
+ w.writerow(['step']+cols)
521
+ for s in steps:
522
+ w.writerow([s]+[all_data[s].get(c,'') for c in cols])
523
+ print(f'Wrote {len(steps)} rows')
524
+ "
525
+
526
+ # Regenerate metadata
527
+ cd ~/Repositories/g1-moves
528
+ python generate_metadata.py
529
+ ```
530
+
531
+ **Verify**:
532
+ ```bash
533
+ ls -lh ${DEST}/
534
+ # Expected: <clip>_policy.pt, .mp4, .gif, agent.yaml, env.yaml, training_log.csv
535
+ ```
536
+
537
+ ### Stage 7: Commit and Push
538
+
539
+ ```bash
540
+ cd ~/Repositories/g1-moves
541
+ git add ${CATEGORY}/${CLIP}/policy/ manifest.json quality_report.json ${CATEGORY}/${CLIP}/README.md
542
+ git commit -m "Add ${CLIP} trained policy with metadata"
543
+ git push
544
+ ```
545
+
546
+ ## Batch Processing
547
+
548
+ To process multiple clips end-to-end:
549
+
550
+ ### Retarget all (Stage 1)
551
+ ```bash
552
+ cd ~/Repositories/g1-moves
553
+ python retarget_all.py --workers 4
554
+ ```
555
+
556
+ ### Train multiple clips sequentially (Stage 4)
557
+ ```bash
558
+ cd ~/Repositories/mjlab-gui
559
+ for CLIP in B_DadDance J_Dance3_Woah M_Move1; do
560
+ CATEGORY=$(python -c "
561
+ import json
562
+ with open('$HOME/Repositories/g1-moves/manifest.json') as f:
563
+ print(json.load(f)['clips']['${CLIP}']['category'])
564
+ ")
565
+ echo "=== Training ${CLIP} (${CATEGORY}) ==="
566
+ MUJOCO_GL=egl MUJOCO_EGL_DEVICE_ID=0 uv run train \
567
+ Mjlab-Tracking-Flat-Unitree-G1 \
568
+ --env.commands.motion.motion-file ~/Repositories/g1-moves/${CATEGORY}/${CLIP}/training/${CLIP}.npz \
569
+ --env.scene.num-envs 4096 \
570
+ --agent.max-iterations 30000 \
571
+ --agent.save-interval 500 \
572
+ --agent.run-name ${CLIP} \
573
+ --video --video-interval 5000
574
+ done
575
+ ```
576
+
577
+ ### Batch archive all new policies (Stage 6)
578
+ After training completes, archive each run:
579
+ ```bash
580
+ cd ~/Repositories/mjlab-gui/logs/rsl_rl/g1_tracking/
581
+ for RUN_DIR in */; do
582
+ CLIP=$(echo ${RUN_DIR} | sed 's/.*_//' | sed 's/\///')
583
+ # ... run Stage 6 commands for each
584
+ done
585
+ ```
586
+
587
+ ## Sim-to-Real Deployment
588
+
589
+ After training a policy, deploy it to the physical G1 robot.
590
+
591
+ ### Sim2Sim Validation (MuJoCo to MuJoCo)
592
+
593
+ Test the policy in a clean MuJoCo environment before deploying to hardware:
594
+
595
+ ```bash
596
+ cd ~/Repositories/mjlab-gui
597
+ MUJOCO_GL=egl uv run play \
598
+ Mjlab-Tracking-Flat-Unitree-G1 \
599
+ --checkpoint-file logs/rsl_rl/g1_tracking/<run>/model_29999.pt \
600
+ --motion-file ~/Repositories/g1-moves/<category>/<clip>/training/<clip>.npz \
601
+ --num-envs 1 \
602
+ --no-terminations \
603
+ --viewer viser
604
+ ```
605
+
606
+ Open http://localhost:8080 to view 3D visualization.
607
+
608
+ ### Deploy to Physical Robot
609
+
610
+ Uses RoboJuDo framework in `~/Repositories/mjlab-gui/external/RoboJuDo/`.
611
+
612
+ **Entry point**: `python scripts/run_pipeline.py --config=<config_name>`
613
+
614
+ #### Step 1: Export policy to TorchScript JIT
615
+
616
+ mjlab saves standard PyTorch checkpoints. RoboJuDo requires TorchScript JIT (`.pt`) or ONNX (`.onnx`). Export the actor network:
617
+
618
+ ```bash
619
+ cd ~/Repositories/mjlab-gui
620
+ python -c "
621
+ import torch
622
+ ckpt = torch.load('logs/rsl_rl/g1_tracking/<run>/model_29999.pt', map_location='cpu', weights_only=False)
623
+ # Extract actor network from RSL-RL checkpoint
624
+ actor = ckpt['model_state_dict'] # Adapt based on actual model architecture
625
+ # Script and save
626
+ # scripted = torch.jit.script(actor_module)
627
+ # scripted.save('exported_policy.pt')
628
+ print('Keys:', list(ckpt.keys()))
629
+ "
630
+ ```
631
+
632
+ > **Note**: The exact export procedure depends on the mjlab actor architecture. You may need to instantiate the actor class from `src/mjlab/rl/` and load state dict before scripting. This step needs refinement once the first full training run completes.
633
+
634
+ #### Step 2: Create a RoboJuDo config class
635
+
636
+ Add a config to `robojudo/config/g1/g1_cfg.py` for the mjlab-trained policy. Use an existing config as template:
637
+
638
+ - **Sim validation**: Extend `g1` (uses `G1MujocoEnvCfg`)
639
+ - **Real robot**: Extend `g1_real` (uses `G1RealEnvCfg`)
640
+
641
+ Key config components:
642
+ - **Policy**: Point to exported `.pt` file, define obs/action DOF mappings
643
+ - **Environment**: `G1MujocoEnvCfg` (sim) or `G1RealEnvCfg` (real)
644
+ - **Controller**: `JoystickCtrlCfg` (sim), `UnitreeCtrlCfg` (real), or `MotionCtrlCfg` (motion playback)
645
+
646
+ #### Step 3: Network setup (real robot only)
647
+
648
+ Configure the network interface in `robojudo/config/g1/env/g1_real_env_cfg.py`:
649
+
650
+ ```python
651
+ class G1RealEnvCfg(G1EnvCfg, UnitreeEnvCfg):
652
+ unitree: UnitreeEnvCfg.UnitreeCfg = UnitreeEnvCfg.UnitreeCfg(
653
+ net_if="eth0", # Run `ifconfig` to find your interface
654
+ robot="g1",
655
+ msg_type="hg", # G1 uses "hg" message type
656
+ hand_type="NONE", # No dexterous hands
657
+ enable_odometry=True,
658
+ )
659
+ ```
660
+
661
+ Connect to G1 via Ethernet (robot at `192.168.123.10`, workstation at `192.168.123.100`).
662
+
663
+ #### Step 4: Run
664
+
665
+ ```bash
666
+ cd ~/Repositories/mjlab-gui/external/RoboJuDo
667
+
668
+ # Sim2sim validation first
669
+ python scripts/run_pipeline.py --config=g1
670
+
671
+ # Real robot deployment
672
+ python scripts/run_pipeline.py --config=g1_real
673
+ ```
674
+
675
+ The pipeline runs an infinite control loop at 50 Hz (`dt=0.02`). Emergency stop: press `A` button on controller or `Esc` on keyboard.
676
+
677
+ #### Available configs
678
+
679
+ | Config | Environment | Description |
680
+ |--------|------------|-------------|
681
+ | `g1` | MuJoCo sim | Default sim2sim with joystick |
682
+ | `g1_real` | Real robot | Unitree controller |
683
+ | `g1_beyondmimic` | MuJoCo sim | Motion imitation (ONNX) |
684
+ | `g1_switch` | MuJoCo sim | Multi-policy switching |
685
+ | `g1_h2h` | MuJoCo sim | Human2Humanoid motion imitation |
686
+
687
+ #### Policy format reference
688
+
689
+ | Format | Used by | Loading |
690
+ |--------|---------|---------|
691
+ | TorchScript JIT (`.pt`) | UnitreePolicy, AMOPolicy, H2HPolicy | `torch.jit.load()` |
692
+ | ONNX (`.onnx`) | BeyondMimicPolicy, ASAPPolicy | `onnxruntime.InferenceSession()` |
693
+
694
+ **Safety**: Always have the robot on a tether/harness for first deployment of new motions. During real robot initialization (~1000 steps), place the robot on the ground for sensor calibration. Start with slow, low-energy clips (B_Fence1, B_DadDance) before attempting high-energy dance or karate motions.
695
+
696
+ ## Environment Setup
697
+
698
+ ```bash
699
+ # Required for headless MuJoCo rendering
700
+ export MUJOCO_GL=egl
701
+ export MUJOCO_EGL_DEVICE_ID=0
702
+
703
+ # GPU selection (if multiple GPUs)
704
+ export CUDA_VISIBLE_DEVICES=0
705
+
706
+ # Python execution in mjlab-gui
707
+ cd ~/Repositories/mjlab-gui
708
+ uv run <command> # Uses pyproject.toml dependencies
709
+
710
+ # Python execution in g1-moves
711
+ cd ~/Repositories/g1-moves
712
+ python <script> # Uses system Python with movin_sdk_python
713
+
714
+ # video2robot (two conda envs)
715
+ conda run -n phmr python <script> # Pose extraction (PromptHMR)
716
+ conda run -n gmr python <script> # Motion retargeting (GMR)
717
+ ```
718
+
719
+ ## Common Issues
720
+
721
+ | Problem | Fix |
722
+ |---------|-----|
723
+ | `CUDA out of memory` | Reduce `--env.scene.num-envs` (4096 -> 2048 -> 1024) |
724
+ | `MUJOCO_GL error` | Set `export MUJOCO_GL=egl` before running |
725
+ | `movin_sdk_python not found` | `pip install movin_sdk_python` |
726
+ | `WandB login prompt` | Use `process_motion_local.py` wrapper instead of `csv_to_npz.py` |
727
+ | Training reward not improving | Check motion NPZ is valid, try lower learning rate (1e-4) |
728
+ | Policy falls immediately | Train longer, or check ground calibration in retarget step |
729
+ | TensorBoard empty | Run `uv run tensorboard --logdir logs/rsl_rl` from mjlab-gui dir |
730
+ | SMPL-X betas size mismatch | Pass `num_betas=10` to `smplx.create()` in GMR's `smpl.py` |
731
+ | PromptHMR sam2 warning | Non-critical `_C.so undefined symbol` — results are unaffected |
732
+ | video2robot AV1 codec | PromptHMR auto-converts to H.264; no manual step needed |
733
+
734
+ ## Data Formats
735
+
736
+ | Format | Columns/Keys | Shape |
737
+ |--------|-------------|-------|
738
+ | **BVH** | 51-joint humanoid skeleton | N frames at 60 FPS |
739
+ | **PKL** | fps, root_pos, root_rot (xyzw), dof_pos | (N, 3), (N, 4), (N, 29) |
740
+ | **CSV** | root_xyz + root_quat_xyzw + 29 joints | N rows x 36 cols, no header |
741
+ | **NPZ** | fps, joint_pos, joint_vel, body_pos_w, body_quat_w, body_lin_vel_w, body_ang_vel_w | (N, 29), (N, 30, 3/4) |
742
+ | **PT** | model_state_dict, optimizer_state_dict, iter, infos | PyTorch checkpoint |
DATASET_CARD.md ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ task_categories:
4
+ - robotics
5
+ - reinforcement-learning
6
+ tags:
7
+ - motion-capture
8
+ - humanoid-robot
9
+ - unitree-g1
10
+ - bvh
11
+ - sim-to-real
12
+ size_categories:
13
+ - n<1K
14
+ ---
15
+
16
+ # G1 Moves
17
+
18
+ 59 motion capture clips for the Unitree G1 humanoid robot (29 DOF, mode 15), captured with [MOVIN TRACIN](https://movin3d.com/) markerless motion capture. Each clip is provided at multiple pipeline stages: raw mocap (BVH/FBX), retargeted robot joint trajectories (PKL), and processed RL training data (NPZ).
19
+
20
+ ## Dataset Summary
21
+
22
+ | | |
23
+ |---|---|
24
+ | **Total clips** | 59 |
25
+ | **Total duration** | 29.5 minutes (106,149 frames at 60 FPS) |
26
+ | **Categories** | Dance (28), Karate (27), Bonus (4) |
27
+ | **Clip duration** | 6.5s - 119.5s |
28
+ | **Robot** | Unitree G1, mode 15, 29 DOF |
29
+ | **Capture system** | MOVIN TRACIN (markerless, LiDAR + vision) |
30
+ | **Retarget SDK** | [movin_sdk_python](https://github.com/MOVIN3D/movin_sdk_python) |
31
+
32
+ ## Supported Tasks
33
+
34
+ - **Motion imitation RL**: Train policies to track reference motions on the G1 robot using the NPZ training data
35
+ - **Sim-to-real transfer**: Deploy trained policies from MuJoCo simulation to physical G1 hardware
36
+ - **Motion retargeting research**: Study human-to-robot motion transfer using the BVH-to-PKL pipeline
37
+ - **Animation / visualization**: Import FBX files into Blender, Maya, Unreal Engine, or Unity
38
+
39
+ ## Dataset Structure
40
+
41
+ Each clip lives in its own subfolder organized by pipeline stage:
42
+
43
+ ```
44
+ <category>/<clip>/
45
+ capture/ Original motion capture data
46
+ <clip>.bvh BVH motion capture (51-joint humanoid skeleton)
47
+ <clip>.gif Preview animation
48
+ <clip>.mp4 Preview video
49
+ <clip>_bl.fbx FBX for Blender
50
+ <clip>_mb.fbx FBX for Maya
51
+ <clip>_ue.fbx FBX for Unreal Engine
52
+ <clip>_un.fbx FBX for Unity
53
+ retarget/ Retargeted G1 joint trajectories
54
+ <clip>.pkl Retargeted joint angles (29 DOF)
55
+ <clip>.csv Joint angles as CSV (no header)
56
+ <clip>_retarget.gif Retarget preview animation
57
+ <clip>_retarget.mp4 Retarget preview video
58
+ training/ Processed RL training data
59
+ <clip>.npz Training data with forward kinematics
60
+ <clip>_training.gif Training visualization
61
+ <clip>_training.mp4 Training visualization video
62
+ policy/ Trained RL policy (if available)
63
+ <clip>_policy.pt PyTorch checkpoint
64
+ <clip>_policy.gif Policy rollout animation
65
+ <clip>_policy.mp4 Policy rollout video
66
+ agent.yaml PPO hyperparameters
67
+ env.yaml Full environment configuration
68
+ training_log.csv Training metrics (rewards, losses, errors)
69
+ ```
70
+
71
+ ## File Format Reference
72
+
73
+ ### BVH (capture)
74
+
75
+ Standard BVH motion capture format with a 51-joint humanoid skeleton.
76
+
77
+ - **Root**: Hips (6 DOF: XYZ position + YXZ Euler rotation)
78
+ - **Joints**: 3 DOF each (YXZ Euler rotation order)
79
+ - **Frame rate**: 60 FPS
80
+ - **Coordinate system**: Y-up
81
+
82
+ ### PKL (retarget)
83
+
84
+ Python pickle containing a dict with retargeted G1 joint trajectories:
85
+
86
+ | Key | Shape | Type | Description |
87
+ |-----|-------|------|-------------|
88
+ | `fps` | scalar | int | Frame rate (60) |
89
+ | `root_pos` | (N, 3) | float64 | Root position in world frame (meters) |
90
+ | `root_rot` | (N, 4) | float64 | Root orientation as quaternion (xyzw) |
91
+ | `dof_pos` | (N, 29) | float64 | Joint angles in radians |
92
+
93
+ Joint order (29 DOF):
94
+
95
+ | Index | Joint | Index | Joint |
96
+ |-------|-------|-------|-------|
97
+ | 0 | left_hip_pitch | 15 | left_shoulder_pitch |
98
+ | 1 | left_hip_roll | 16 | left_shoulder_roll |
99
+ | 2 | left_hip_yaw | 17 | left_shoulder_yaw |
100
+ | 3 | left_knee | 18 | left_elbow |
101
+ | 4 | left_ankle_pitch | 19 | left_wrist_roll |
102
+ | 5 | left_ankle_roll | 20 | left_wrist_pitch |
103
+ | 6 | right_hip_pitch | 21 | left_wrist_yaw |
104
+ | 7 | right_hip_roll | 22 | right_shoulder_pitch |
105
+ | 8 | right_hip_yaw | 23 | right_shoulder_roll |
106
+ | 9 | right_knee | 24 | right_shoulder_yaw |
107
+ | 10 | right_ankle_pitch | 25 | right_elbow |
108
+ | 11 | right_ankle_roll | 26 | right_wrist_roll |
109
+ | 12 | waist_yaw | 27 | right_wrist_pitch |
110
+ | 13 | waist_roll | 28 | right_wrist_yaw |
111
+ | 14 | waist_pitch | | |
112
+
113
+ ### CSV (retarget)
114
+
115
+ Same data as PKL in plain CSV format (no header row). 36 columns:
116
+
117
+ | Columns | Content |
118
+ |---------|---------|
119
+ | 0-2 | Root position (x, y, z) |
120
+ | 3-6 | Root quaternion (x, y, z, w) |
121
+ | 7-35 | Joint angles (29 DOF, same order as PKL) |
122
+
123
+ ### NPZ (training)
124
+
125
+ NumPy compressed archive with forward kinematics computed from the retargeted motion. Used directly as RL training reference.
126
+
127
+ | Key | Shape | Type | Description |
128
+ |-----|-------|------|-------------|
129
+ | `fps` | (1,) | float64 | Frame rate (60) |
130
+ | `joint_pos` | (N, 29) | float32 | Joint positions (radians) |
131
+ | `joint_vel` | (N, 29) | float32 | Joint velocities (rad/s) |
132
+ | `body_pos_w` | (N, 30, 3) | float32 | Body positions in world frame (meters) |
133
+ | `body_quat_w` | (N, 30, 4) | float32 | Body orientations as quaternions |
134
+ | `body_lin_vel_w` | (N, 30, 3) | float32 | Body linear velocities (m/s) |
135
+ | `body_ang_vel_w` | (N, 30, 3) | float32 | Body angular velocities (rad/s) |
136
+
137
+ N = BVH frames - 1 (velocity requires finite differences).
138
+
139
+ ### FBX (capture)
140
+
141
+ Four platform-optimized FBX variants per clip:
142
+
143
+ | Suffix | Target |
144
+ |--------|--------|
145
+ | `_bl.fbx` | Blender |
146
+ | `_mb.fbx` | Maya |
147
+ | `_ue.fbx` | Unreal Engine |
148
+ | `_un.fbx` | Unity |
149
+
150
+ ## Usage Examples
151
+
152
+ ### Load retargeted motion (PKL)
153
+
154
+ ```python
155
+ import pickle
156
+ import numpy as np
157
+
158
+ with open("dance/B_DadDance/retarget/B_DadDance.pkl", "rb") as f:
159
+ motion = pickle.load(f)
160
+
161
+ print(f"FPS: {motion['fps']}")
162
+ print(f"Duration: {motion['dof_pos'].shape[0] / motion['fps']:.1f}s")
163
+ print(f"Root position at frame 0: {motion['root_pos'][0]}")
164
+ print(f"Joint angles shape: {motion['dof_pos'].shape}") # (2509, 29)
165
+ ```
166
+
167
+ ### Load training data (NPZ)
168
+
169
+ ```python
170
+ import numpy as np
171
+
172
+ data = np.load("dance/B_DadDance/training/B_DadDance.npz")
173
+
174
+ joint_pos = data["joint_pos"] # (2508, 29)
175
+ joint_vel = data["joint_vel"] # (2508, 29)
176
+ body_pos = data["body_pos_w"] # (2508, 30, 3)
177
+ body_quat = data["body_quat_w"] # (2508, 30, 4)
178
+
179
+ # Get pelvis height over time
180
+ pelvis_z = body_pos[:, 0, 2]
181
+ print(f"Pelvis height: {pelvis_z.min():.3f} - {pelvis_z.max():.3f} m")
182
+ ```
183
+
184
+ ### Filter clips by duration or difficulty
185
+
186
+ ```python
187
+ import json
188
+
189
+ with open("manifest.json") as f:
190
+ manifest = json.load(f)
191
+
192
+ # Find clips longer than 30 seconds
193
+ long_clips = {
194
+ name: clip for name, clip in manifest["clips"].items()
195
+ if clip["duration_s"] > 30
196
+ }
197
+ print(f"{len(long_clips)} clips > 30s")
198
+
199
+ # Sort by motion energy (difficulty proxy)
200
+ by_energy = sorted(
201
+ manifest["clips"].items(),
202
+ key=lambda x: x[1]["motion_stats"]["mean_joint_velocity"],
203
+ reverse=True,
204
+ )
205
+ print("Most energetic:", by_energy[0][0])
206
+ print("Least energetic:", by_energy[-1][0])
207
+ ```
208
+
209
+ ## Data Collection
210
+
211
+ All 59 clips were captured using the [MOVIN TRACIN](https://movin3d.com/) markerless motion capture system. MOVIN TRACIN uses on-device AI to fuse LiDAR point clouds and vision into motion data without markers, suits, or multi-camera rigs. Performances were recorded and exported using [MOVIN Studio](https://www.movin3d.com/studio).
212
+
213
+ ### Performers
214
+
215
+ | Prefix | Performer | Clips |
216
+ |--------|-----------|-------|
217
+ | `B_` | [Mitch Chaiet](https://mitchchaiet.com/) | Bonus clips + some dance |
218
+ | `J_` | [Jasmine Coro](https://jasminecoro.com/) | Dance choreography |
219
+ | `M_` | [Mike Gassaway](https://www.backstage.com/u/mike-gassaway/) | Karate / martial arts |
220
+
221
+ ### Processing Pipeline
222
+
223
+ 1. **Capture**: MOVIN TRACIN records performer motion as BVH + FBX
224
+ 2. **Retarget**: [movin_sdk_python](https://github.com/MOVIN3D/movin_sdk_python) maps human skeleton to G1 joint limits (1.75m human height)
225
+ 3. **Ground calibration**: MuJoCo forward kinematics finds minimum foot Z, shifts root for ground contact
226
+ 4. **Training data**: MuJoCo computes full-body forward kinematics (positions, orientations, velocities)
227
+ 5. **RL training**: PPO with motion imitation rewards in MuJoCo-Warp (4096 parallel envs)
228
+
229
+ ## Metadata Files
230
+
231
+ | File | Description |
232
+ |------|-------------|
233
+ | `manifest.json` | Machine-readable index of all 59 clips with per-clip metadata |
234
+ | `quality_report.json` | Automated validation (joint limits, ground penetration, frame consistency) |
235
+ | `generate_metadata.py` | Script to regenerate all metadata from source data |
236
+
237
+ ## Citation
238
+
239
+ ```bibtex
240
+ @misc{g1moves2026,
241
+ title={G1 Moves: Motion Capture Dataset for the Unitree G1 Humanoid Robot},
242
+ author={Chaiet, Mitch},
243
+ year={2026},
244
+ publisher={GitHub},
245
+ url={https://github.com/experientialtech/g1-moves}
246
+ }
247
+ ```
248
+
249
+ ## License
250
+
251
+ CC-BY-4.0
252
+
253
+ ## Acknowledgements
254
+
255
+ - [MOVIN3D](https://movin3d.com/) for the MOVIN TRACIN capture system and movin_sdk_python retargeting SDK
256
+ - [Dell Technologies](https://www.dell.com/) for the Pro Max Tower T2 workstation used for capture and training
257
+ - [Unitree Robotics](https://www.unitree.com/) for the G1 humanoid robot platform
Motion-Player-ROS/CMakeLists.txt ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ cmake_minimum_required(VERSION 3.8)
2
+ project(motion_player)
3
+
4
+ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
5
+ add_compile_options(-Wall -Wextra -Wpedantic)
6
+ endif()
7
+
8
+ # find dependencies
9
+ find_package(ament_cmake REQUIRED)
10
+ find_package(ament_cmake_python REQUIRED)
11
+
12
+ install(
13
+ DIRECTORY urdf meshes launch rviz
14
+ DESTINATION share/${PROJECT_NAME}
15
+ )
16
+
17
+ # Install Python scripts
18
+ install(
19
+ PROGRAMS scripts/motion_player.py
20
+ DESTINATION lib/${PROJECT_NAME}
21
+ RENAME motion_player
22
+ )
23
+
24
+
25
+ if(BUILD_TESTING)
26
+ find_package(ament_lint_auto REQUIRED)
27
+ # the following line skips the linter which checks for copyrights
28
+ # comment the line when a copyright and license is added to all source files
29
+ set(ament_cmake_copyright_FOUND TRUE)
30
+ # the following line skips cpplint (only works in a git repo)
31
+ # comment the line when this package is in a git repo and when
32
+ # a copyright and license is added to all source files
33
+ set(ament_cmake_cpplint_FOUND TRUE)
34
+ ament_lint_auto_find_test_dependencies()
35
+ endif()
36
+
37
+ ament_package()
Motion-Player-ROS/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Motion Player Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
Motion-Player-ROS/README.md ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Motion Player
2
+
3
+ A ROS 2 package for playing back motion capture data on a humanoid robot (Unitree G1) with simultaneous BVH skeleton visualization in RViz.
4
+
5
+ ## Demo
6
+
7
+ ![Demo](doc/demo.gif)
8
+
9
+ ## Features
10
+
11
+ - **Motion Playback**: Play pre-recorded motion data (`.pkl` format) on a 29-DOF humanoid robot model
12
+ - **Real-time Motion Retargeting**: Receive live mocap data via OSC from [MOVIN TRACIN](https://www.movin3d.com) and retarget to robot in real-time
13
+ - **Real-time Visualization**: Simultaneously visualize both the original motion capture skeleton and retargeted robot motion in RViz
14
+ - **BVH Visualization**: Display the original BVH motion capture skeleton alongside the robot
15
+ - **RViz Integration**: Full visualization in RViz2 with robot model and skeleton markers
16
+
17
+ ## Prerequisites
18
+
19
+ - **ROS 2**: Humble (tested)
20
+ - Required ROS 2 packages:
21
+ - `robot_state_publisher`
22
+ - `rviz2`
23
+ - `xacro`
24
+ - `tf2_ros`
25
+
26
+ - Required pip packages:
27
+ - `numpy`
28
+ - `scipy`
29
+ - `movin-sdk-python` (required for BVH loading and real-time mode)
30
+
31
+
32
+ ## Installation
33
+
34
+ 1. Clone this repository into your ROS 2 workspace:
35
+ ```bash
36
+ cd ~/ros2_ws/src
37
+ git clone https://github.com/MOVIN3D/Motion-Player-ROS
38
+ ```
39
+
40
+ 2. Install MOVIN SDK Python (required for receiving mocap data and real-time retargeting):
41
+ ```bash
42
+ pip install git+https://github.com/MOVIN3D/MOVIN-SDK-Python.git
43
+ ```
44
+
45
+ For more details about MOVIN SDK, visit: https://github.com/MOVIN3D/MOVIN-SDK-Python
46
+
47
+ 3. Build the package:
48
+ ```bash
49
+ cd ~/ros2_ws
50
+ colcon build --packages-select motion_player
51
+ ```
52
+
53
+ 4. Source the workspace:
54
+ ```bash
55
+ source ~/ros2_ws/install/setup.bash
56
+ ```
57
+
58
+ ## Usage
59
+
60
+ ### Playback Mode (from file)
61
+
62
+ Launch the motion player with pre-recorded motion files:
63
+ ```bash
64
+ ros2 launch motion_player player.launch.py motion_file:=/path/to/your/motion.pkl bvh_file:=/path/to/your/motion.bvh
65
+ ```
66
+
67
+ Or run the node directly:
68
+ ```bash
69
+ ros2 run motion_player motion_player --ros-args -p motion_file:=/path/to/your/motion.pkl
70
+ ```
71
+
72
+ ### Real-time Mode (live mocap)
73
+
74
+ Launch the real-time motion player to receive live mocap data via OSC from [MOVIN TRACIN](https://www.movin3d.com):
75
+ ```bash
76
+ ros2 launch motion_player realtime.launch.py
77
+ ```
78
+
79
+ This mode enables:
80
+ - **Real-time retargeting**: Motion capture data is retargeted to the robot model on-the-fly using [MOVIN SDK Python](https://github.com/MOVIN3D/MOVIN-SDK-Python)
81
+ - **Live visualization**: Both the original mocap skeleton and the retargeted robot motion are displayed simultaneously in RViz
82
+
83
+ With custom parameters:
84
+ ```bash
85
+ ros2 launch motion_player realtime.launch.py port:=11235 human_height:=1.80 skeleton_offset_x:=1.5
86
+ ```
87
+
88
+ Or run the node directly with `--realtime` flag:
89
+ ```bash
90
+ ros2 run motion_player motion_player --realtime --ros-args -p port:=11235 -p human_height:=1.80
91
+ ```
92
+
93
+ ### Launch Arguments
94
+
95
+ #### player.launch.py (Playback Mode)
96
+
97
+ | Argument | Default | Description |
98
+ |----------|---------|-------------|
99
+ | `motion_file` | (required) | Path to the motion pickle file (`.pkl`) |
100
+ | `bvh_file` | (required) | Path to the BVH file (`.bvh`)|
101
+ | `loop` | `true` | Whether to loop the motion playback |
102
+ | `urdf_file` | (package default) | Path to custom URDF file |
103
+ | `rviz_config` | (package default) | Path to custom RViz config file |
104
+
105
+ #### realtime.launch.py (Real-time Mode)
106
+
107
+ | Argument | Default | Description |
108
+ |----------|---------|-------------|
109
+ | `port` | `11235` | UDP port to listen for OSC mocap data |
110
+ | `robot_type` | `unitree_g1` | Target robot type (`unitree_g1` or `unitree_g1_with_hands`) |
111
+ | `human_height` | `1.75` | Human height in meters for scaling |
112
+ | `skeleton_offset_x` | `1.0` | X offset to place skeleton beside robot |
113
+ | `urdf_file` | (package default) | Path to custom URDF file |
114
+ | `rviz_config` | (package default) | Path to custom RViz config file |
115
+
116
+ ## File Formats
117
+
118
+ ### Motion File (`.pkl`)
119
+
120
+ The motion file contains joint angles that have been **retargeted from motion capture data to the robot URDF**. This file stores the converted motion that can be directly applied to the Unitree G1 robot model.
121
+
122
+ The pickle file should contain a dictionary with:
123
+
124
+ ```python
125
+ {
126
+ 'fps': float, # Frames per second
127
+ 'root_pos': np.ndarray, # Root position [n_frames, 3]
128
+ 'root_rot': np.ndarray, # Root rotation quaternion (xyzw) [n_frames, 4]
129
+ 'dof_pos': np.ndarray, # Joint positions [n_frames, 29]
130
+ }
131
+ ```
132
+
133
+ ### BVH File (`.bvh`)
134
+
135
+ The BVH file contains the **original motion capture data** from [MOVIN TRACIN](https://www.movin3d.com) motion capture system.
136
+
137
+ Standard BVH (Biovision Hierarchy) motion capture format.
138
+ The BVH skeleton will be displayed as red spheres (joints) and orange cylinders (bones) in RViz, allowing you to compare the original motion capture with the retargeted robot motion.
139
+
140
+ ## ROS Topics
141
+
142
+ | Topic | Type | Description |
143
+ |-------|------|-------------|
144
+ | `/joint_states` | `sensor_msgs/JointState` | Robot joint states |
145
+ | `/skeleton_markers` | `visualization_msgs/MarkerArray` | Skeleton visualization (both modes) |
146
+ | `/tf` | TF2 | Robot transforms |
147
+
148
+ ## Project Structure
149
+
150
+ ```
151
+ motion_player_ros/
152
+ ├── CMakeLists.txt
153
+ ├── package.xml
154
+ ├── README.md
155
+ ├── data/
156
+ │ ├── test1.bvh # Example BVH file
157
+ │ └── test1.pkl # Example motion file
158
+ ├── doc/
159
+ │ └── demo.gif
160
+ ├── launch/
161
+ │ ├── player.launch.py # Playback mode launch file
162
+ │ └── realtime.launch.py # Real-time mode launch file
163
+ ├── meshes/ # Robot mesh files (STL)*
164
+ ├── rviz/
165
+ │ └── robot.rviz # RViz configuration
166
+ ├── scripts/
167
+ │ └── motion_player.py # Unified motion player node (supports --realtime flag)
168
+ └── urdf/
169
+ └── g1_custom_collision_29dof.urdf # Robot URDF*
170
+ ```
171
+
172
+ ## Acknowledgments
173
+
174
+ This project uses:
175
+
176
+ - **[MOVIN SDK Python](https://github.com/MOVIN3D/MOVIN-SDK-Python)** - Motion retargeting SDK for real-time mocap to robot conversion
177
+ - **[MOVIN TRACIN](https://www.movin3d.com)** - Motion capture system for generating mocap data
178
+
179
+ The URDF and STL mesh files for the Unitree G1 robot are sourced from [Unitree Robotics](https://github.com/unitreerobotics). Please refer to their repositories for the original robot models and licensing information:
180
+
181
+ - [unitree_ros](https://github.com/unitreerobotics/unitree_ros) - ROS packages with URDF files for Unitree robots
182
+ - [unitree_mujoco](https://github.com/unitreerobotics/unitree_mujoco) - Mujoco simulation for Unitree robots
183
+
184
+ ## License
185
+
186
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
187
+
188
+ **Note:** The robot URDF and mesh files (`urdf/` and `meshes/` directories) are from Unitree Robotics and may be subject to their own licensing terms.
Motion-Player-ROS/package.xml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
3
+ <package format="3">
4
+ <name>motion_player</name>
5
+ <version>1.0.0</version>
6
+ <description>ROS 2 package for playing back motion capture data on humanoid robots with BVH skeleton visualization</description>
7
+ <maintainer email="dy.jang@movin3d.com">YUN</maintainer>
8
+ <license>MIT</license>
9
+
10
+ <buildtool_depend>ament_cmake</buildtool_depend>
11
+ <buildtool_depend>ament_cmake_python</buildtool_depend>
12
+
13
+ <exec_depend>robot_state_publisher</exec_depend>
14
+ <exec_depend>rviz2</exec_depend>
15
+ <exec_depend>xacro</exec_depend>
16
+ <exec_depend>rclpy</exec_depend>
17
+ <exec_depend>sensor_msgs</exec_depend>
18
+ <exec_depend>geometry_msgs</exec_depend>
19
+ <exec_depend>tf2_ros</exec_depend>
20
+
21
+ <test_depend>ament_lint_auto</test_depend>
22
+ <test_depend>ament_lint_common</test_depend>
23
+
24
+ <export>
25
+ <build_type>ament_cmake</build_type>
26
+ </export>
27
+ </package>
README.md ADDED
@@ -0,0 +1,276 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p align="center">
2
+ <img src="logo.png" alt="Experiential Technologies" width="500">
3
+ </p>
4
+
5
+ # G1 Moves
6
+
7
+ Motion capture clips for the Unitree G1 humanoid robot, captured with Movin Studio and exported as BVH and FBX.
8
+
9
+ ## Credits
10
+
11
+ **Director:** [Mitch Chaiet](https://mitchchaiet.com/)
12
+ **DIT:** [Molly Maguire](https://www.linkedin.com/in/mollymaguire001/)
13
+ **Dance:** [Jasmine Coro](https://jasminecoro.com/)
14
+ **Karate:** [Mike Gassaway](https://www.backstage.com/u/mike-gassaway/)
15
+
16
+ ## Structure
17
+
18
+ ```
19
+ dance/ 28 clips — dance routines
20
+ B_DadDance/
21
+ B_LongDance/
22
+ B_SpiralDance/
23
+ B_StretchDance/
24
+ B_WiggleDance/
25
+ J_Dance0_StepTouch/
26
+ J_Dance1_Modern/
27
+ J_Dance2_Salsa/
28
+ J_Dance3_Woah/
29
+ J_Dance4_Broadway/
30
+ J_Dance5_Hype/
31
+ J_Dance6_Sassy/
32
+ J_Dance7_Party/
33
+ J_Dance8_WestCoast/
34
+ J_Dance9_PeaceMaker/
35
+ J_Dance11_Gnarly/
36
+ J_Dance12_LushLife/
37
+ J_Dance17_Shuffle/
38
+ J_Dance18_TikTok/
39
+ J_Dance19_LetsGO/
40
+ J_Dance20_DWG/
41
+ J_Dance21_Blunt/
42
+ J_Dance22_Thrilling/
43
+ J_Dance23_MidnightSun/
44
+ J_ShortDance13_SingleLadies/
45
+ J_ShortDance14_Disco/
46
+ J_ShortDance15_Nineties/
47
+ J_ShortDance16_JazzWalk/
48
+ karate/ 27 clips — karate/martial arts moves
49
+ B_AttackKarate/
50
+ B_BowKarate/
51
+ B_ChopsKarate/
52
+ B_CrazyChopsKarate/
53
+ B_ForwardKarate/
54
+ B_LongKarate/
55
+ B_SpinKarate/
56
+ M_Move1/ — Guard Combo
57
+ M_Move2/ — Low Punch
58
+ M_Move3/ — Horse Stance
59
+ M_Move4/ — Spin Punch
60
+ M_Move5/ — Twist Punch
61
+ M_Move6/ — Spin Strike
62
+ M_Move7/ — Rapid Punch
63
+ M_Move8/ — Drop Spin
64
+ M_Move9/ — Level Change
65
+ M_Move10/ — Side Kick
66
+ M_Move11/ — Blitz
67
+ M_Move17/ — Double Strike
68
+ M_Move18/ — Front Kick
69
+ M_Move19/ — Slow Kata
70
+ M_Move20/ — Open Strike
71
+ M_ShortMove12/ — Quick Jab
72
+ M_ShortMove13/ — Snap Kick
73
+ M_ShortMove14/ — Light Punch
74
+ M_ShortMove15/ — Drop Strike
75
+ M_ShortMove16/ — Power Burst
76
+ bonus/ 4 clips — fencing, hands-up, chops
77
+ B_Fence1/
78
+ B_Fence2/
79
+ B_HandsChop/
80
+ B_HandsUp/
81
+ movin-studio-project/ Raw Movin Studio recordings and project file
82
+ ```
83
+
84
+ Each clip lives in its own subfolder containing:
85
+
86
+ | File | Format |
87
+ |------|--------|
88
+ | `<clip>.bvh` | BVH motion capture (humanoid skeleton, Hips root) |
89
+ | `<clip>.pkl` | Retargeted G1 joint trajectories (29 DOF) |
90
+ | `<clip>_bl.fbx` | FBX for Blender |
91
+ | `<clip>_mb.fbx` | FBX for Maya |
92
+ | `<clip>_ue.fbx` | FBX for Unreal Engine |
93
+ | `<clip>_un.fbx` | FBX for Unity |
94
+
95
+ ## Retarget
96
+
97
+ All 59 BVH clips have been retargeted to the Unitree G1 (mode 15, 29 DOF) using [movin_sdk_python](https://github.com/MOVIN3D/movin_sdk_python). The pipeline:
98
+
99
+ 1. **BVH → IK**: Per-frame inverse kinematics maps human skeleton to G1 joint limits (1.75m human height)
100
+ 2. **Ground calibration**: MuJoCo forward kinematics finds minimum foot Z across all frames, shifts root down for ground contact
101
+ 3. **PKL output**: `{fps, root_pos, root_rot, dof_pos}` — 60 FPS, quaternions in xyzw order, 29 joint angles
102
+ 4. **Video render**: MuJoCo offscreen 1080x1080, libx264 CRF 18
103
+
104
+ Run `python retarget_all.py` to regenerate (skips existing outputs).
105
+
106
+ ## Equipment
107
+
108
+ ### Motion Capture
109
+
110
+ All 59 clips were captured using the [MOVIN TRACIN](https://movin3d.com/) markerless motion capture system from [MOVIN3D](https://movin3d.com/). MOVIN TRACIN uses on-device AI to fuse LiDAR point clouds and vision into production-ready motion data — no markers, no suit, no multi-camera rig. Captured performances were recorded and exported using [MOVIN Studio](https://www.movin3d.com/studio), which provides real-time skeleton visualization, recording management, and export to BVH and FBX formats. Retargeting from human skeleton to G1 robot joint space was performed using [movin_sdk_python](https://github.com/MOVIN3D/movin_sdk_python).
111
+
112
+ Thank you to [MOVIN3D](https://movin3d.com/) for building an incredible motion capture platform that makes professional-grade mocap accessible to robotics researchers.
113
+
114
+ ### Workstation
115
+
116
+ All data was captured and policies were trained on a [Dell Pro Max Tower T2](https://creatorfolio.co/mitchbookpro) workstation from [Dell Technologies](https://www.dell.com/):
117
+
118
+ | Component | Spec |
119
+ |-----------|------|
120
+ | CPU | Intel Core Ultra 9 285K (24 cores, up to 7.2 GHz) |
121
+ | GPU | NVIDIA RTX PRO 6000 Blackwell Workstation Edition (96 GB GDDR7) |
122
+ | RAM | 128 GB DDR5 |
123
+ | Storage | 2x 4 TB WD SN8000S NVMe SSD (8 TB total) |
124
+ | OS | Ubuntu 24.04 LTS |
125
+
126
+ The RTX PRO 6000 Blackwell with 96 GB of VRAM enables running thousands of parallel MuJoCo-Warp simulation environments on a single GPU for reinforcement learning training, while the 24-core Ultra 9 285K handles motion retargeting and data processing. Thank you to [Dell Technologies](https://www.dell.com/) for providing the compute power behind this project.
127
+
128
+ ## Pipeline Progress
129
+
130
+ | Stage | Bonus (4) | Dance (28) | Karate (27) | Total (59) |
131
+ |-------|:---------:|:----------:|:-----------:|:----------:|
132
+ | BVH (capture) | 4 | 28 | 27 | 59 |
133
+ | PKL (retarget) | 4 | 28 | 27 | 59 |
134
+ | NPZ (training) | 4 | 28 | 27 | 59 |
135
+ | Policy (.pt) | 4 | 0 | 0 | 4 |
136
+ | ONNX (.onnx) | 4 | 0 | 0 | 4 |
137
+
138
+ ## Clips
139
+
140
+ ### Dance (28)
141
+
142
+ | Mocap | Retarget | Training |
143
+ |-------|----------|----------|
144
+ | **B_DadDance** | | |
145
+ | ![](dance/B_DadDance/capture/B_DadDance.gif) | ![](dance/B_DadDance/retarget/B_DadDance_retarget.gif) | ![](dance/B_DadDance/training/B_DadDance_training.gif) |
146
+ | **B_LongDance** | | |
147
+ | ![](dance/B_LongDance/capture/B_LongDance.gif) | ![](dance/B_LongDance/retarget/B_LongDance_retarget.gif) | ![](dance/B_LongDance/training/B_LongDance_training.gif) |
148
+ | **B_SpiralDance** | | |
149
+ | ![](dance/B_SpiralDance/capture/B_SpiralDance.gif) | ![](dance/B_SpiralDance/retarget/B_SpiralDance_retarget.gif) | ![](dance/B_SpiralDance/training/B_SpiralDance_training.gif) |
150
+ | **B_StretchDance** | | |
151
+ | ![](dance/B_StretchDance/capture/B_StretchDance.gif) | ![](dance/B_StretchDance/retarget/B_StretchDance_retarget.gif) | ![](dance/B_StretchDance/training/B_StretchDance_training.gif) |
152
+ | **B_WiggleDance** | | |
153
+ | ![](dance/B_WiggleDance/capture/B_WiggleDance.gif) | ![](dance/B_WiggleDance/retarget/B_WiggleDance_retarget.gif) | ![](dance/B_WiggleDance/training/B_WiggleDance_training.gif) |
154
+ | **J_Dance0_StepTouch** | | |
155
+ | ![](dance/J_Dance0_StepTouch/capture/J_Dance0_StepTouch.gif) | ![](dance/J_Dance0_StepTouch/retarget/J_Dance0_StepTouch_retarget.gif) | ![](dance/J_Dance0_StepTouch/training/J_Dance0_StepTouch_training.gif) |
156
+ | **J_Dance1_Modern** | | |
157
+ | ![](dance/J_Dance1_Modern/capture/J_Dance1_Modern.gif) | ![](dance/J_Dance1_Modern/retarget/J_Dance1_Modern_retarget.gif) | ![](dance/J_Dance1_Modern/training/J_Dance1_Modern_training.gif) |
158
+ | **J_Dance2_Salsa** | | |
159
+ | ![](dance/J_Dance2_Salsa/capture/J_Dance2_Salsa.gif) | ![](dance/J_Dance2_Salsa/retarget/J_Dance2_Salsa_retarget.gif) | ![](dance/J_Dance2_Salsa/training/J_Dance2_Salsa_training.gif) |
160
+ | **J_Dance3_Woah** | | |
161
+ | ![](dance/J_Dance3_Woah/capture/J_Dance3_Woah.gif) | ![](dance/J_Dance3_Woah/retarget/J_Dance3_Woah_retarget.gif) | ![](dance/J_Dance3_Woah/training/J_Dance3_Woah_training.gif) |
162
+ | **J_Dance4_Broadway** | | |
163
+ | ![](dance/J_Dance4_Broadway/capture/J_Dance4_Broadway.gif) | ![](dance/J_Dance4_Broadway/retarget/J_Dance4_Broadway_retarget.gif) | ![](dance/J_Dance4_Broadway/training/J_Dance4_Broadway_training.gif) |
164
+ | **J_Dance5_Hype** | | |
165
+ | ![](dance/J_Dance5_Hype/capture/J_Dance5_Hype.gif) | ![](dance/J_Dance5_Hype/retarget/J_Dance5_Hype_retarget.gif) | ![](dance/J_Dance5_Hype/training/J_Dance5_Hype_training.gif) |
166
+ | **J_Dance6_Sassy** | | |
167
+ | ![](dance/J_Dance6_Sassy/capture/J_Dance6_Sassy.gif) | ![](dance/J_Dance6_Sassy/retarget/J_Dance6_Sassy_retarget.gif) | ![](dance/J_Dance6_Sassy/training/J_Dance6_Sassy_training.gif) |
168
+ | **J_Dance7_Party** | | |
169
+ | ![](dance/J_Dance7_Party/capture/J_Dance7_Party.gif) | ![](dance/J_Dance7_Party/retarget/J_Dance7_Party_retarget.gif) | ![](dance/J_Dance7_Party/training/J_Dance7_Party_training.gif) |
170
+ | **J_Dance8_WestCoast** | | |
171
+ | ![](dance/J_Dance8_WestCoast/capture/J_Dance8_WestCoast.gif) | ![](dance/J_Dance8_WestCoast/retarget/J_Dance8_WestCoast_retarget.gif) | ![](dance/J_Dance8_WestCoast/training/J_Dance8_WestCoast_training.gif) |
172
+ | **J_Dance9_PeaceMaker** | | |
173
+ | ![](dance/J_Dance9_PeaceMaker/capture/J_Dance9_PeaceMaker.gif) | ![](dance/J_Dance9_PeaceMaker/retarget/J_Dance9_PeaceMaker_retarget.gif) | ![](dance/J_Dance9_PeaceMaker/training/J_Dance9_PeaceMaker_training.gif) |
174
+ | **J_Dance11_Gnarly** | | |
175
+ | ![](dance/J_Dance11_Gnarly/capture/J_Dance11_Gnarly.gif) | ![](dance/J_Dance11_Gnarly/retarget/J_Dance11_Gnarly_retarget.gif) | ![](dance/J_Dance11_Gnarly/training/J_Dance11_Gnarly_training.gif) |
176
+ | **J_Dance12_LushLife** | | |
177
+ | ![](dance/J_Dance12_LushLife/capture/J_Dance12_LushLife.gif) | ![](dance/J_Dance12_LushLife/retarget/J_Dance12_LushLife_retarget.gif) | ![](dance/J_Dance12_LushLife/training/J_Dance12_LushLife_training.gif) |
178
+ | **J_Dance17_Shuffle** | | |
179
+ | ![](dance/J_Dance17_Shuffle/capture/J_Dance17_Shuffle.gif) | ![](dance/J_Dance17_Shuffle/retarget/J_Dance17_Shuffle_retarget.gif) | ![](dance/J_Dance17_Shuffle/training/J_Dance17_Shuffle_training.gif) |
180
+ | **J_Dance18_TikTok** | | |
181
+ | ![](dance/J_Dance18_TikTok/capture/J_Dance18_TikTok.gif) | ![](dance/J_Dance18_TikTok/retarget/J_Dance18_TikTok_retarget.gif) | ![](dance/J_Dance18_TikTok/training/J_Dance18_TikTok_training.gif) |
182
+ | **J_Dance19_LetsGO** | | |
183
+ | ![](dance/J_Dance19_LetsGO/capture/J_Dance19_LetsGO.gif) | ![](dance/J_Dance19_LetsGO/retarget/J_Dance19_LetsGO_retarget.gif) | ![](dance/J_Dance19_LetsGO/training/J_Dance19_LetsGO_training.gif) |
184
+ | **J_Dance20_DWG** | | |
185
+ | ![](dance/J_Dance20_DWG/capture/J_Dance20_DWG.gif) | ![](dance/J_Dance20_DWG/retarget/J_Dance20_DWG_retarget.gif) | ![](dance/J_Dance20_DWG/training/J_Dance20_DWG_training.gif) |
186
+ | **J_Dance21_Blunt** | | |
187
+ | ![](dance/J_Dance21_Blunt/capture/J_Dance21_Blunt.gif) | ![](dance/J_Dance21_Blunt/retarget/J_Dance21_Blunt_retarget.gif) | ![](dance/J_Dance21_Blunt/training/J_Dance21_Blunt_training.gif) |
188
+ | **J_Dance22_Thrilling** | | |
189
+ | ![](dance/J_Dance22_Thrilling/capture/J_Dance22_Thrilling.gif) | ![](dance/J_Dance22_Thrilling/retarget/J_Dance22_Thrilling_retarget.gif) | ![](dance/J_Dance22_Thrilling/training/J_Dance22_Thrilling_training.gif) |
190
+ | **J_Dance23_MidnightSun** | | |
191
+ | ![](dance/J_Dance23_MidnightSun/capture/J_Dance23_MidnightSun.gif) | ![](dance/J_Dance23_MidnightSun/retarget/J_Dance23_MidnightSun_retarget.gif) | ![](dance/J_Dance23_MidnightSun/training/J_Dance23_MidnightSun_training.gif) |
192
+ | **J_ShortDance13_SingleLadies** | | |
193
+ | ![](dance/J_ShortDance13_SingleLadies/capture/J_ShortDance13_SingleLadies.gif) | ![](dance/J_ShortDance13_SingleLadies/retarget/J_ShortDance13_SingleLadies_retarget.gif) | ![](dance/J_ShortDance13_SingleLadies/training/J_ShortDance13_SingleLadies_training.gif) |
194
+ | **J_ShortDance14_Disco** | | |
195
+ | ![](dance/J_ShortDance14_Disco/capture/J_ShortDance14_Disco.gif) | ![](dance/J_ShortDance14_Disco/retarget/J_ShortDance14_Disco_retarget.gif) | ![](dance/J_ShortDance14_Disco/training/J_ShortDance14_Disco_training.gif) |
196
+ | **J_ShortDance15_Nineties** | | |
197
+ | ![](dance/J_ShortDance15_Nineties/capture/J_ShortDance15_Nineties.gif) | ![](dance/J_ShortDance15_Nineties/retarget/J_ShortDance15_Nineties_retarget.gif) | ![](dance/J_ShortDance15_Nineties/training/J_ShortDance15_Nineties_training.gif) |
198
+ | **J_ShortDance16_JazzWalk** | | |
199
+ | ![](dance/J_ShortDance16_JazzWalk/capture/J_ShortDance16_JazzWalk.gif) | ![](dance/J_ShortDance16_JazzWalk/retarget/J_ShortDance16_JazzWalk_retarget.gif) | ![](dance/J_ShortDance16_JazzWalk/training/J_ShortDance16_JazzWalk_training.gif) |
200
+
201
+ ### Karate (27)
202
+
203
+ | Mocap | Retarget | Training |
204
+ |-------|----------|----------|
205
+ | **B_AttackKarate** | | |
206
+ | ![](karate/B_AttackKarate/capture/B_AttackKarate.gif) | ![](karate/B_AttackKarate/retarget/B_AttackKarate_retarget.gif) | ![](karate/B_AttackKarate/training/B_AttackKarate_training.gif) |
207
+ | **B_BowKarate** | | |
208
+ | ![](karate/B_BowKarate/capture/B_BowKarate.gif) | ![](karate/B_BowKarate/retarget/B_BowKarate_retarget.gif) | ![](karate/B_BowKarate/training/B_BowKarate_training.gif) |
209
+ | **B_ChopsKarate** | | |
210
+ | ![](karate/B_ChopsKarate/capture/B_ChopsKarate.gif) | ![](karate/B_ChopsKarate/retarget/B_ChopsKarate_retarget.gif) | ![](karate/B_ChopsKarate/training/B_ChopsKarate_training.gif) |
211
+ | **B_CrazyChopsKarate** | | |
212
+ | ![](karate/B_CrazyChopsKarate/capture/B_CrazyChopsKarate.gif) | ![](karate/B_CrazyChopsKarate/retarget/B_CrazyChopsKarate_retarget.gif) | ![](karate/B_CrazyChopsKarate/training/B_CrazyChopsKarate_training.gif) |
213
+ | **B_ForwardKarate** | | |
214
+ | ![](karate/B_ForwardKarate/capture/B_ForwardKarate.gif) | ![](karate/B_ForwardKarate/retarget/B_ForwardKarate_retarget.gif) | ![](karate/B_ForwardKarate/training/B_ForwardKarate_training.gif) |
215
+ | **B_LongKarate** | | |
216
+ | ![](karate/B_LongKarate/capture/B_LongKarate.gif) | ![](karate/B_LongKarate/retarget/B_LongKarate_retarget.gif) | ![](karate/B_LongKarate/training/B_LongKarate_training.gif) |
217
+ | **B_SpinKarate** | | |
218
+ | ![](karate/B_SpinKarate/capture/B_SpinKarate.gif) | ![](karate/B_SpinKarate/retarget/B_SpinKarate_retarget.gif) | ![](karate/B_SpinKarate/training/B_SpinKarate_training.gif) |
219
+ | **M_Move1 — Guard Combo** | | |
220
+ | ![](karate/M_Move1/capture/M_Move1.gif) | ![](karate/M_Move1/retarget/M_Move1_retarget.gif) | ![](karate/M_Move1/training/M_Move1_training.gif) |
221
+ | **M_Move2 — Low Punch** | | |
222
+ | ![](karate/M_Move2/capture/M_Move2.gif) | ![](karate/M_Move2/retarget/M_Move2_retarget.gif) | ![](karate/M_Move2/training/M_Move2_training.gif) |
223
+ | **M_Move3 — Horse Stance** | | |
224
+ | ![](karate/M_Move3/capture/M_Move3.gif) | ![](karate/M_Move3/retarget/M_Move3_retarget.gif) | ![](karate/M_Move3/training/M_Move3_training.gif) |
225
+ | **M_Move4 — Spin Punch** | | |
226
+ | ![](karate/M_Move4/capture/M_Move4.gif) | ![](karate/M_Move4/retarget/M_Move4_retarget.gif) | ![](karate/M_Move4/training/M_Move4_training.gif) |
227
+ | **M_Move5 — Twist Punch** | | |
228
+ | ![](karate/M_Move5/capture/M_Move5.gif) | ![](karate/M_Move5/retarget/M_Move5_retarget.gif) | ![](karate/M_Move5/training/M_Move5_training.gif) |
229
+ | **M_Move6 — Spin Strike** | | |
230
+ | ![](karate/M_Move6/capture/M_Move6.gif) | ![](karate/M_Move6/retarget/M_Move6_retarget.gif) | ![](karate/M_Move6/training/M_Move6_training.gif) |
231
+ | **M_Move7 — Rapid Punch** | | |
232
+ | ![](karate/M_Move7/capture/M_Move7.gif) | ![](karate/M_Move7/retarget/M_Move7_retarget.gif) | ![](karate/M_Move7/training/M_Move7_training.gif) |
233
+ | **M_Move8 — Drop Spin** | | |
234
+ | ![](karate/M_Move8/capture/M_Move8.gif) | ![](karate/M_Move8/retarget/M_Move8_retarget.gif) | ![](karate/M_Move8/training/M_Move8_training.gif) |
235
+ | **M_Move9 — Level Change** | | |
236
+ | ![](karate/M_Move9/capture/M_Move9.gif) | ![](karate/M_Move9/retarget/M_Move9_retarget.gif) | ![](karate/M_Move9/training/M_Move9_training.gif) |
237
+ | **M_Move10 — Side Kick** | | |
238
+ | ![](karate/M_Move10/capture/M_Move10.gif) | ![](karate/M_Move10/retarget/M_Move10_retarget.gif) | ![](karate/M_Move10/training/M_Move10_training.gif) |
239
+ | **M_Move11 — Blitz** | | |
240
+ | ![](karate/M_Move11/capture/M_Move11.gif) | ![](karate/M_Move11/retarget/M_Move11_retarget.gif) | ![](karate/M_Move11/training/M_Move11_training.gif) |
241
+ | **M_Move17 — Double Strike** | | |
242
+ | ![](karate/M_Move17/capture/M_Move17.gif) | ![](karate/M_Move17/retarget/M_Move17_retarget.gif) | ![](karate/M_Move17/training/M_Move17_training.gif) |
243
+ | **M_Move18 — Front Kick** | | |
244
+ | ![](karate/M_Move18/capture/M_Move18.gif) | ![](karate/M_Move18/retarget/M_Move18_retarget.gif) | ![](karate/M_Move18/training/M_Move18_training.gif) |
245
+ | **M_Move19 — Slow Kata** | | |
246
+ | ![](karate/M_Move19/capture/M_Move19.gif) | ![](karate/M_Move19/retarget/M_Move19_retarget.gif) | ![](karate/M_Move19/training/M_Move19_training.gif) |
247
+ | **M_Move20 — Open Strike** | | |
248
+ | ![](karate/M_Move20/capture/M_Move20.gif) | ![](karate/M_Move20/retarget/M_Move20_retarget.gif) | ![](karate/M_Move20/training/M_Move20_training.gif) |
249
+ | **M_ShortMove12 — Quick Jab** | | |
250
+ | ![](karate/M_ShortMove12/capture/M_ShortMove12.gif) | ![](karate/M_ShortMove12/retarget/M_ShortMove12_retarget.gif) | ![](karate/M_ShortMove12/training/M_ShortMove12_training.gif) |
251
+ | **M_ShortMove13 — Snap Kick** | | |
252
+ | ![](karate/M_ShortMove13/capture/M_ShortMove13.gif) | ![](karate/M_ShortMove13/retarget/M_ShortMove13_retarget.gif) | ![](karate/M_ShortMove13/training/M_ShortMove13_training.gif) |
253
+ | **M_ShortMove14 — Light Punch** | | |
254
+ | ![](karate/M_ShortMove14/capture/M_ShortMove14.gif) | ![](karate/M_ShortMove14/retarget/M_ShortMove14_retarget.gif) | ![](karate/M_ShortMove14/training/M_ShortMove14_training.gif) |
255
+ | **M_ShortMove15 — Drop Strike** | | |
256
+ | ![](karate/M_ShortMove15/capture/M_ShortMove15.gif) | ![](karate/M_ShortMove15/retarget/M_ShortMove15_retarget.gif) | ![](karate/M_ShortMove15/training/M_ShortMove15_training.gif) |
257
+ | **M_ShortMove16 — Power Burst** | | |
258
+ | ![](karate/M_ShortMove16/capture/M_ShortMove16.gif) | ![](karate/M_ShortMove16/retarget/M_ShortMove16_retarget.gif) | ![](karate/M_ShortMove16/training/M_ShortMove16_training.gif) |
259
+
260
+ ### Bonus (4)
261
+
262
+ | Mocap | Retarget | Training | Policy |
263
+ |-------|----------|----------|--------|
264
+ | **B_Fence1** | | | |
265
+ | ![](bonus/B_Fence1/capture/B_Fence1.gif) | ![](bonus/B_Fence1/retarget/B_Fence1_retarget.gif) | ![](bonus/B_Fence1/training/B_Fence1_training.gif) | ![](bonus/B_Fence1/policy/B_Fence1_policy.gif) |
266
+ | **B_Fence2** | | | |
267
+ | ![](bonus/B_Fence2/capture/B_Fence2.gif) | ![](bonus/B_Fence2/retarget/B_Fence2_retarget.gif) | ![](bonus/B_Fence2/training/B_Fence2_training.gif) | ![](bonus/B_Fence2/policy/B_Fence2_policy.gif) |
268
+ | **B_HandsChop** | | | |
269
+ | ![](bonus/B_HandsChop/capture/B_HandsChop.gif) | ![](bonus/B_HandsChop/retarget/B_HandsChop_retarget.gif) | ![](bonus/B_HandsChop/training/B_HandsChop_training.gif) | ![](bonus/B_HandsChop/policy/B_HandsChop_policy.gif) |
270
+ | **B_HandsUp** | | | |
271
+ | ![](bonus/B_HandsUp/capture/B_HandsUp.gif) | ![](bonus/B_HandsUp/retarget/B_HandsUp_retarget.gif) | ![](bonus/B_HandsUp/training/B_HandsUp_training.gif) | ![](bonus/B_HandsUp/policy/B_HandsUp_policy.gif) |
272
+
273
+ ## Capture Details
274
+
275
+ - **Skeleton**: Humanoid, Hips root, 6-DOF root channels, 3-DOF joint rotations (YXZ)
276
+ - **Export formats**: BVH + 4 FBX variants (Blender, Maya, Unreal, Unity)
__pycache__/retarget_all.cpython-313.pyc ADDED
Binary file (15.9 kB). View file
 
app/scripts/CLAUDE.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ <claude-mem-context>
2
+ # Recent Activity
3
+
4
+ <!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
5
+
6
+ *No recent activity*
7
+ </claude-mem-context>
bonus/CLAUDE.md ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <claude-mem-context>
2
+ # Recent Activity
3
+
4
+ <!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
5
+
6
+ ### Feb 22, 2026
7
+
8
+ | ID | Time | T | Title | Read |
9
+ |----|------|---|-------|------|
10
+ | #1572 | 11:01 PM | ✅ | Removed incomplete B_Fence2 motion clip files | ~278 |
11
+ </claude-mem-context>
bonus/movin_export_result.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Start exporting clip 'B_DadDance'.
2
+ Start loading MOVINMan motion : B_DadDance
3
+ Motion Path : recordings\Actor_1_260223_072738.bin
4
+ Clip 'B_DadDance' exported successfully.
5
+
dance/CLAUDE.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ <claude-mem-context>
2
+ # Recent Activity
3
+
4
+ <!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
5
+
6
+ *No recent activity*
7
+ </claude-mem-context>
dance/movin_export_result.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Start exporting clip 'J_Dance23_MidnightSun'.
2
+ Start loading MOVINMan motion : J_Dance23_MidnightSun
3
+ Motion Path : recordings\Actor_1_260223_074610.bin
4
+ Clip 'J_Dance23_MidnightSun' exported successfully.
5
+
docs/plans/CLAUDE.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ <claude-mem-context>
2
+ # Recent Activity
3
+
4
+ <!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
5
+
6
+ *No recent activity*
7
+ </claude-mem-context>
export_onnx.py ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Export a trained checkpoint to ONNX with bundled motion data.
2
+
3
+ Usage:
4
+ uv run python export_onnx.py <category>/<clip>
5
+ uv run python export_onnx.py bonus/B_Fence1
6
+ uv run python export_onnx.py --all # export all clips with policies
7
+ """
8
+
9
+ import argparse
10
+ import os
11
+ import sys
12
+ from dataclasses import asdict
13
+ from pathlib import Path
14
+ from typing import cast
15
+
16
+ import torch
17
+ from torch import nn
18
+
19
+ import mjlab.tasks # noqa: F401 (populate registry)
20
+ from mjlab.envs import ManagerBasedRlEnv
21
+ from mjlab.rl import RslRlVecEnvWrapper
22
+ from mjlab.rl.exporter_utils import attach_metadata_to_onnx, get_base_metadata
23
+ from mjlab.tasks.registry import load_env_cfg, load_rl_cfg, load_runner_cls
24
+ from mjlab.tasks.tracking.mdp.commands import MotionCommand, MotionCommandCfg
25
+ from mjlab.tasks.tracking.rl.runner import MotionTrackingOnPolicyRunner
26
+ from mjlab.utils.torch import configure_torch_backends
27
+
28
+ TASK = "Mjlab-Tracking-Flat-Unitree-G1"
29
+ REPO_DIR = Path(__file__).resolve().parent
30
+
31
+
32
+ class _OnnxActorModel(nn.Module):
33
+ """ONNX-exportable wrapper for the actor MLP + obs normalizer."""
34
+
35
+ def __init__(self, actor_critic):
36
+ super().__init__()
37
+ self.normalizer = actor_critic.actor_obs_normalizer
38
+ self.actor = actor_critic.actor
39
+ # Get input size from first Linear layer
40
+ for layer in self.actor:
41
+ if isinstance(layer, nn.Linear):
42
+ self.input_size = layer.in_features
43
+ break
44
+
45
+ def forward(self, x):
46
+ return self.actor(self.normalizer(x))
47
+
48
+
49
+ class _OnnxMotionModel(nn.Module):
50
+ """ONNX-exportable model wrapping the policy and motion reference data."""
51
+
52
+ def __init__(self, actor_model, motion):
53
+ super().__init__()
54
+ self.policy = actor_model
55
+ self.register_buffer("joint_pos", motion.joint_pos.to("cpu"))
56
+ self.register_buffer("joint_vel", motion.joint_vel.to("cpu"))
57
+ self.register_buffer("body_pos_w", motion.body_pos_w.to("cpu"))
58
+ self.register_buffer("body_quat_w", motion.body_quat_w.to("cpu"))
59
+ self.register_buffer("body_lin_vel_w", motion.body_lin_vel_w.to("cpu"))
60
+ self.register_buffer("body_ang_vel_w", motion.body_ang_vel_w.to("cpu"))
61
+ self.time_step_total: int = self.joint_pos.shape[0]
62
+
63
+ def forward(self, x, time_step):
64
+ time_step_clamped = torch.clamp(
65
+ time_step.long().squeeze(-1), max=self.time_step_total - 1
66
+ )
67
+ return (
68
+ self.policy(x),
69
+ self.joint_pos[time_step_clamped],
70
+ self.joint_vel[time_step_clamped],
71
+ self.body_pos_w[time_step_clamped],
72
+ self.body_quat_w[time_step_clamped],
73
+ self.body_lin_vel_w[time_step_clamped],
74
+ self.body_ang_vel_w[time_step_clamped],
75
+ )
76
+
77
+
78
+ def export_clip(category: str, clip: str, device: str = "cuda:0"):
79
+ """Export a single clip's policy to ONNX."""
80
+ clip_dir = REPO_DIR / category / clip
81
+ checkpoint = clip_dir / "policy" / f"{clip}_policy.pt"
82
+ motion = clip_dir / "training" / f"{clip}.npz"
83
+ output_dir = clip_dir / "policy"
84
+ output_name = f"{clip}.onnx"
85
+
86
+ if not checkpoint.exists():
87
+ print(f"SKIP {category}/{clip} — no policy checkpoint")
88
+ return False
89
+ if not motion.exists():
90
+ print(f"SKIP {category}/{clip} — no training NPZ")
91
+ return False
92
+
93
+ print(f"Exporting {category}/{clip}...")
94
+
95
+ env_cfg = load_env_cfg(TASK, play=True)
96
+ agent_cfg = load_rl_cfg(TASK)
97
+
98
+ motion_cmd = env_cfg.commands["motion"]
99
+ assert isinstance(motion_cmd, MotionCommandCfg)
100
+ motion_cmd.motion_file = str(motion)
101
+
102
+ env_cfg.scene.num_envs = 1
103
+ env = ManagerBasedRlEnv(cfg=env_cfg, device=device)
104
+ env_wrapped = RslRlVecEnvWrapper(env, clip_actions=agent_cfg.clip_actions)
105
+
106
+ runner_cls = load_runner_cls(TASK) or MotionTrackingOnPolicyRunner
107
+ runner = runner_cls(env_wrapped, asdict(agent_cfg), device=device)
108
+ runner.load(str(checkpoint), load_optimizer=False, map_location=device)
109
+
110
+ # Build ONNX model directly (bypasses runner.export_policy_to_onnx which
111
+ # relies on PPO.get_policy() / ActorCritic.as_onnx() that don't exist in
112
+ # the installed rsl_rl version).
113
+ actor_model = _OnnxActorModel(runner.alg.policy)
114
+ motion_term = cast(MotionCommand, env.command_manager.get_term("motion"))
115
+ model = _OnnxMotionModel(actor_model, motion_term.motion)
116
+ model.to("cpu")
117
+ model.eval()
118
+
119
+ os.makedirs(str(output_dir), exist_ok=True)
120
+ obs = torch.zeros(1, actor_model.input_size)
121
+ time_step = torch.zeros(1, 1)
122
+ torch.onnx.export(
123
+ model,
124
+ (obs, time_step),
125
+ str(output_dir / output_name),
126
+ export_params=True,
127
+ opset_version=18,
128
+ verbose=False,
129
+ input_names=["obs", "time_step"],
130
+ output_names=[
131
+ "actions",
132
+ "joint_pos",
133
+ "joint_vel",
134
+ "body_pos_w",
135
+ "body_quat_w",
136
+ "body_lin_vel_w",
137
+ "body_ang_vel_w",
138
+ ],
139
+ dynamic_axes={},
140
+ dynamo=False,
141
+ )
142
+
143
+ metadata = get_base_metadata(env, "local")
144
+ metadata.update(
145
+ {
146
+ "anchor_body_name": motion_term.cfg.anchor_body_name,
147
+ "body_names": list(motion_term.cfg.body_names),
148
+ }
149
+ )
150
+ attach_metadata_to_onnx(str(output_dir / output_name), metadata)
151
+
152
+ print(f" Exported: {output_dir / output_name}")
153
+ env.close()
154
+ return True
155
+
156
+
157
+ def find_all_clips_with_policies():
158
+ """Find all clips that have a trained policy checkpoint."""
159
+ clips = []
160
+ for category in ["bonus", "dance", "karate"]:
161
+ cat_dir = REPO_DIR / category
162
+ if not cat_dir.is_dir():
163
+ continue
164
+ for clip_dir in sorted(cat_dir.iterdir()):
165
+ if not clip_dir.is_dir():
166
+ continue
167
+ clip = clip_dir.name
168
+ pt = clip_dir / "policy" / f"{clip}_policy.pt"
169
+ npz = clip_dir / "training" / f"{clip}.npz"
170
+ if pt.exists() and npz.exists():
171
+ clips.append((category, clip))
172
+ return clips
173
+
174
+
175
+ def main():
176
+ parser = argparse.ArgumentParser(description="Export trained policies to ONNX")
177
+ parser.add_argument("clip", nargs="?", help="category/clip (e.g. bonus/B_Fence1)")
178
+ parser.add_argument("--all", action="store_true", help="Export all clips with policies")
179
+ parser.add_argument("--device", default="cuda:0", help="Device (default: cuda:0)")
180
+ args = parser.parse_args()
181
+
182
+ if not args.clip and not args.all:
183
+ parser.print_help()
184
+ sys.exit(1)
185
+
186
+ configure_torch_backends()
187
+ device = args.device if torch.cuda.is_available() else "cpu"
188
+
189
+ if args.all:
190
+ clips = find_all_clips_with_policies()
191
+ print(f"Found {len(clips)} clips with trained policies")
192
+ ok, skip = 0, 0
193
+ for category, clip in clips:
194
+ onnx = REPO_DIR / category / clip / "policy" / f"{clip}.onnx"
195
+ if onnx.exists():
196
+ print(f"SKIP {category}/{clip} — ONNX already exists")
197
+ skip += 1
198
+ continue
199
+ if export_clip(category, clip, device):
200
+ ok += 1
201
+ else:
202
+ skip += 1
203
+ print(f"\nDone: {ok} exported, {skip} skipped")
204
+ else:
205
+ parts = args.clip.strip("/").split("/")
206
+ if len(parts) != 2:
207
+ print(f"Expected category/clip, got: {args.clip}")
208
+ sys.exit(1)
209
+ category, clip = parts
210
+ if not export_clip(category, clip, device):
211
+ sys.exit(1)
212
+
213
+
214
+ if __name__ == "__main__":
215
+ main()
external/CLAUDE.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ <claude-mem-context>
2
+ # Recent Activity
3
+
4
+ <!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
5
+
6
+ *No recent activity*
7
+ </claude-mem-context>
generate_metadata.py ADDED
@@ -0,0 +1,504 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Generate dataset metadata for g1-moves repository.
3
+
4
+ Reads all 59 motion capture clips and produces:
5
+ - manifest.json: per-clip metadata index
6
+ - quality_report.json: automated validation results
7
+ - <clip>/README.md: per-clip summary
8
+
9
+ Usage:
10
+ python generate_metadata.py
11
+ python generate_metadata.py --skip-quality
12
+ python generate_metadata.py --clips "B_Fence*"
13
+ """
14
+
15
+ import argparse
16
+ import json
17
+ import os
18
+ import pickle
19
+ import fnmatch
20
+ from datetime import datetime, timezone
21
+
22
+ import numpy as np
23
+
24
+ # ── G1 joint configuration ──────────────────────────────────────────────────
25
+
26
+ JOINT_NAMES = [
27
+ "left_hip_pitch_joint", "left_hip_roll_joint", "left_hip_yaw_joint",
28
+ "left_knee_joint", "left_ankle_pitch_joint", "left_ankle_roll_joint",
29
+ "right_hip_pitch_joint", "right_hip_roll_joint", "right_hip_yaw_joint",
30
+ "right_knee_joint", "right_ankle_pitch_joint", "right_ankle_roll_joint",
31
+ "waist_yaw_joint", "waist_roll_joint", "waist_pitch_joint",
32
+ "left_shoulder_pitch_joint", "left_shoulder_roll_joint",
33
+ "left_shoulder_yaw_joint", "left_elbow_joint", "left_wrist_roll_joint",
34
+ "left_wrist_pitch_joint", "left_wrist_yaw_joint",
35
+ "right_shoulder_pitch_joint", "right_shoulder_roll_joint",
36
+ "right_shoulder_yaw_joint", "right_elbow_joint", "right_wrist_roll_joint",
37
+ "right_wrist_pitch_joint", "right_wrist_yaw_joint",
38
+ ]
39
+
40
+ JOINT_LIMITS = {
41
+ "left_hip_pitch_joint": (-2.5307, 2.8798),
42
+ "left_hip_roll_joint": (-0.5236, 2.9671),
43
+ "left_hip_yaw_joint": (-2.7576, 2.7576),
44
+ "left_knee_joint": (-0.0873, 2.8798),
45
+ "left_ankle_pitch_joint": (-0.8727, 0.5236),
46
+ "left_ankle_roll_joint": (-0.2618, 0.2618),
47
+ "right_hip_pitch_joint": (-2.5307, 2.8798),
48
+ "right_hip_roll_joint": (-2.9671, 0.5236),
49
+ "right_hip_yaw_joint": (-2.7576, 2.7576),
50
+ "right_knee_joint": (-0.0873, 2.8798),
51
+ "right_ankle_pitch_joint": (-0.8727, 0.5236),
52
+ "right_ankle_roll_joint": (-0.2618, 0.2618),
53
+ "waist_yaw_joint": (-2.6180, 2.6180),
54
+ "waist_roll_joint": (-0.5200, 0.5200),
55
+ "waist_pitch_joint": (-0.5200, 0.5200),
56
+ "left_shoulder_pitch_joint": (-3.0892, 2.6704),
57
+ "left_shoulder_roll_joint": (-1.5882, 2.2515),
58
+ "left_shoulder_yaw_joint": (-2.6180, 2.6180),
59
+ "left_elbow_joint": (-1.0472, 2.0944),
60
+ "left_wrist_roll_joint": (-1.9722, 1.9722),
61
+ "left_wrist_pitch_joint": (-1.6144, 1.6144),
62
+ "left_wrist_yaw_joint": (-1.6144, 1.6144),
63
+ "right_shoulder_pitch_joint": (-3.0892, 2.6704),
64
+ "right_shoulder_roll_joint": (-2.2515, 1.5882),
65
+ "right_shoulder_yaw_joint": (-2.6180, 2.6180),
66
+ "right_elbow_joint": (-1.0472, 2.0944),
67
+ "right_wrist_roll_joint": (-1.9722, 1.9722),
68
+ "right_wrist_pitch_joint": (-1.6144, 1.6144),
69
+ "right_wrist_yaw_joint": (-1.6144, 1.6144),
70
+ }
71
+
72
+ # Performer mapping from clip name prefix
73
+ PERFORMERS = {
74
+ "B_": "Mitch Chaiet",
75
+ "J_": "Jasmine Coro",
76
+ "M_": "Mike Gassaway",
77
+ }
78
+
79
+ # Foot body indices in NPZ body_pos_w (30 bodies)
80
+ # These are the ankle roll links which represent the foot
81
+ FOOT_BODY_NAMES = ["left_ankle_roll_link", "right_ankle_roll_link"]
82
+ FOOT_BODY_INDICES = [3, 6] # indices in the 30-body array
83
+
84
+
85
+ def get_performer(clip_name):
86
+ for prefix, name in PERFORMERS.items():
87
+ if clip_name.startswith(prefix):
88
+ return name
89
+ return "Unknown"
90
+
91
+
92
+ def parse_bvh(path):
93
+ """Extract frame count, frame time, and joint count from BVH file."""
94
+ joints = 0
95
+ frames = 0
96
+ frame_time = 0.0
97
+ with open(path) as f:
98
+ for line in f:
99
+ stripped = line.strip()
100
+ if "JOINT" in stripped or "ROOT" in stripped:
101
+ joints += 1
102
+ if stripped.startswith("Frames:"):
103
+ frames = int(stripped.split(":")[1].strip())
104
+ if stripped.startswith("Frame Time:"):
105
+ frame_time = float(stripped.split(":")[1].strip())
106
+ return {
107
+ "joints": joints,
108
+ "frames": frames,
109
+ "frame_time": frame_time,
110
+ "fps": round(1.0 / frame_time) if frame_time > 0 else 0,
111
+ "duration_s": round(frames * frame_time, 2),
112
+ }
113
+
114
+
115
+ def load_pkl(path):
116
+ """Load retargeted PKL file."""
117
+ with open(path, "rb") as f:
118
+ return pickle.load(f)
119
+
120
+
121
+ def load_npz(path):
122
+ """Load training NPZ file."""
123
+ return np.load(path)
124
+
125
+
126
+ def compute_motion_stats(pkl_data):
127
+ """Compute motion energy and difficulty metrics from PKL data."""
128
+ dof_pos = np.array(pkl_data["dof_pos"], dtype=np.float64)
129
+ root_pos = np.array(pkl_data["root_pos"], dtype=np.float64)
130
+ fps = int(pkl_data["fps"])
131
+
132
+ # Joint velocities (finite differences)
133
+ joint_vel = np.diff(dof_pos, axis=0) * fps
134
+ mean_joint_vel = float(np.mean(np.abs(joint_vel)))
135
+ max_joint_vel = float(np.max(np.abs(joint_vel)))
136
+
137
+ # Root displacement
138
+ root_deltas = np.diff(root_pos, axis=0)
139
+ root_displacement = float(np.sum(np.linalg.norm(root_deltas, axis=1)))
140
+
141
+ # Root velocity
142
+ root_vel = root_deltas * fps
143
+ mean_root_vel = float(np.mean(np.linalg.norm(root_vel, axis=1)))
144
+
145
+ return {
146
+ "mean_joint_velocity": round(mean_joint_vel, 4),
147
+ "max_joint_velocity": round(max_joint_vel, 4),
148
+ "root_displacement_m": round(root_displacement, 4),
149
+ "mean_root_velocity": round(mean_root_vel, 4),
150
+ }
151
+
152
+
153
+ def compute_joint_range(pkl_data):
154
+ """Compute per-joint min/max from PKL data."""
155
+ dof_pos = np.array(pkl_data["dof_pos"], dtype=np.float64)
156
+ return {
157
+ "min": [round(float(v), 4) for v in dof_pos.min(axis=0)],
158
+ "max": [round(float(v), 4) for v in dof_pos.max(axis=0)],
159
+ }
160
+
161
+
162
+ def check_joint_limits(pkl_data):
163
+ """Check for joint limit violations."""
164
+ dof_pos = np.array(pkl_data["dof_pos"], dtype=np.float64)
165
+ violations = 0
166
+ max_excess = 0.0
167
+ worst_joint = None
168
+
169
+ for j, name in enumerate(JOINT_NAMES):
170
+ lo, hi = JOINT_LIMITS[name]
171
+ below = dof_pos[:, j] < lo
172
+ above = dof_pos[:, j] > hi
173
+ joint_violations = int(np.sum(below) + np.sum(above))
174
+ if joint_violations > 0:
175
+ violations += joint_violations
176
+ excess_below = float(np.max(lo - dof_pos[below, j])) if np.any(below) else 0.0
177
+ excess_above = float(np.max(dof_pos[above, j] - hi)) if np.any(above) else 0.0
178
+ joint_max = max(excess_below, excess_above)
179
+ if joint_max > max_excess:
180
+ max_excess = joint_max
181
+ worst_joint = name
182
+
183
+ return {
184
+ "violations": violations,
185
+ "max_excess_rad": round(max_excess, 4),
186
+ "worst_joint": worst_joint,
187
+ }
188
+
189
+
190
+ def check_ground_penetration(npz_data):
191
+ """Check for foot ground penetration in training data."""
192
+ body_pos = npz_data["body_pos_w"] # (frames, 30, 3)
193
+ min_foot_z = float("inf")
194
+ penetration_frames = 0
195
+
196
+ for idx in FOOT_BODY_INDICES:
197
+ foot_z = body_pos[:, idx, 2]
198
+ below = foot_z < -0.01 # 1cm tolerance
199
+ penetration_frames += int(np.sum(below))
200
+ min_foot_z = min(min_foot_z, float(np.min(foot_z)))
201
+
202
+ return {
203
+ "penetration_frames": penetration_frames,
204
+ "min_foot_z_m": round(min_foot_z, 4),
205
+ }
206
+
207
+
208
+ def check_nan(pkl_data, npz_data):
209
+ """Check for NaN values in data arrays."""
210
+ issues = []
211
+ for key in ["root_pos", "root_rot", "dof_pos"]:
212
+ arr = np.array(pkl_data[key])
213
+ if np.any(np.isnan(arr)):
214
+ issues.append(f"pkl.{key}")
215
+ for key in npz_data.files:
216
+ arr = npz_data[key]
217
+ if np.any(np.isnan(arr)):
218
+ issues.append(f"npz.{key}")
219
+ return {"has_nan": len(issues) > 0, "fields": issues}
220
+
221
+
222
+ def get_file_sizes(clip_dir, clip_name):
223
+ """Get sizes of key data files."""
224
+ files = {
225
+ "bvh": f"capture/{clip_name}.bvh",
226
+ "pkl": f"retarget/{clip_name}.pkl",
227
+ "csv": f"retarget/{clip_name}.csv",
228
+ "npz": f"training/{clip_name}.npz",
229
+ }
230
+ sizes = {}
231
+ for key, rel_path in files.items():
232
+ full = os.path.join(clip_dir, rel_path)
233
+ if os.path.exists(full):
234
+ sizes[key] = os.path.getsize(full)
235
+ return sizes
236
+
237
+
238
+ def get_pipeline_stages(clip_dir, clip_name):
239
+ """Determine which pipeline stages are complete."""
240
+ stages = []
241
+ if os.path.exists(os.path.join(clip_dir, "capture", f"{clip_name}.bvh")):
242
+ stages.append("capture")
243
+ if os.path.exists(os.path.join(clip_dir, "retarget", f"{clip_name}.pkl")):
244
+ stages.append("retarget")
245
+ if os.path.exists(os.path.join(clip_dir, "training", f"{clip_name}.npz")):
246
+ stages.append("training")
247
+ if os.path.exists(os.path.join(clip_dir, "policy", f"{clip_name}_policy.pt")):
248
+ stages.append("policy")
249
+ return stages
250
+
251
+
252
+ def generate_clip_readme(clip_dir, clip_name, clip_data):
253
+ """Generate a README.md for a clip folder."""
254
+ stages = clip_data["pipeline_stages"]
255
+ stats = clip_data["motion_stats"]
256
+ has_policy = "policy" in stages
257
+
258
+ lines = [
259
+ f"# {clip_name}",
260
+ "",
261
+ f"**Category:** {clip_data['category'].title()} | "
262
+ f"**Performer:** {clip_data['performer']} | "
263
+ f"**Duration:** {clip_data['duration_s']}s | "
264
+ f"**Frames:** {clip_data['frames']}",
265
+ "",
266
+ "## Files",
267
+ "",
268
+ "| Stage | Files |",
269
+ "|-------|-------|",
270
+ f"| `capture/` | BVH, MP4, GIF, 4x FBX |",
271
+ f"| `retarget/` | PKL, CSV, MP4, GIF |",
272
+ f"| `training/` | NPZ, MP4, GIF |",
273
+ ]
274
+ if has_policy:
275
+ lines.append(f"| `policy/` | PT, MP4, GIF, agent.yaml, env.yaml, training_log.csv |")
276
+
277
+ lines.extend([
278
+ "",
279
+ "## Motion Stats",
280
+ "",
281
+ f"| Metric | Value |",
282
+ f"|--------|-------|",
283
+ f"| Joint velocity (mean) | {stats['mean_joint_velocity']:.2f} rad/s |",
284
+ f"| Joint velocity (max) | {stats['max_joint_velocity']:.2f} rad/s |",
285
+ f"| Root displacement | {stats['root_displacement_m']:.2f} m |",
286
+ f"| Root velocity (mean) | {stats['mean_root_velocity']:.2f} m/s |",
287
+ "",
288
+ "## Formats",
289
+ "",
290
+ "- **BVH**: Motion capture with 51-joint humanoid skeleton, 60 FPS",
291
+ f"- **PKL**: Retargeted G1 trajectories — `root_pos` ({clip_data['frames']}, 3), "
292
+ f"`root_rot` ({clip_data['frames']}, 4), `dof_pos` ({clip_data['frames']}, 29)",
293
+ f"- **NPZ**: Training data — `joint_pos/vel` ({clip_data['training_frames']}, 29), "
294
+ f"`body_pos/quat/vel` ({clip_data['training_frames']}, 30, 3/4)",
295
+ "- **FBX**: Blender (`_bl`), Maya (`_mb`), Unreal (`_ue`), Unity (`_un`)",
296
+ "",
297
+ ])
298
+
299
+ readme_path = os.path.join(clip_dir, "README.md")
300
+ with open(readme_path, "w") as f:
301
+ f.write("\n".join(lines))
302
+ return readme_path
303
+
304
+
305
+ def discover_clips(base_dir, pattern=None):
306
+ """Find all clip directories."""
307
+ clips = []
308
+ for category in ["dance", "karate", "bonus"]:
309
+ cat_dir = os.path.join(base_dir, category)
310
+ if not os.path.isdir(cat_dir):
311
+ continue
312
+ for clip_name in sorted(os.listdir(cat_dir)):
313
+ clip_dir = os.path.join(cat_dir, clip_name)
314
+ if not os.path.isdir(clip_dir):
315
+ continue
316
+ bvh = os.path.join(clip_dir, "capture", f"{clip_name}.bvh")
317
+ if not os.path.exists(bvh):
318
+ continue
319
+ if pattern and not fnmatch.fnmatch(clip_name, pattern):
320
+ continue
321
+ clips.append((category, clip_name, clip_dir))
322
+ return clips
323
+
324
+
325
+ def main():
326
+ parser = argparse.ArgumentParser(description="Generate g1-moves dataset metadata")
327
+ parser.add_argument("--skip-quality", action="store_true", help="Skip quality checks")
328
+ parser.add_argument("--clips", type=str, default=None, help="Only process matching clips")
329
+ args = parser.parse_args()
330
+
331
+ base_dir = os.path.dirname(os.path.abspath(__file__))
332
+ os.chdir(base_dir)
333
+
334
+ clips = discover_clips(".", args.clips)
335
+ print(f"Found {len(clips)} clips")
336
+
337
+ now = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
338
+
339
+ manifest = {
340
+ "version": "1.0",
341
+ "generated": now,
342
+ "robot": "unitree_g1",
343
+ "robot_mode": 15,
344
+ "dof": 29,
345
+ "capture_system": "MOVIN TRACIN",
346
+ "retarget_sdk": "movin_sdk_python",
347
+ "clips": {},
348
+ }
349
+
350
+ quality = {
351
+ "generated": now,
352
+ "checks": {
353
+ "joint_limit_violations": {"description": "Frames where retargeted angles exceed G1 limits", "clips": {}},
354
+ "ground_penetration": {"description": "Frames where foot Z < -1cm", "clips": {}},
355
+ "frame_consistency": {"description": "PKL frames == BVH frames, NPZ frames == BVH - 1", "clips": {}},
356
+ "nan_check": {"description": "NaN values in PKL or NPZ arrays", "clips": {}},
357
+ "file_completeness": {"description": "All expected files present", "clips": {}},
358
+ },
359
+ "summary": {"passed": [], "warnings": [], "errors": []},
360
+ }
361
+
362
+ total_frames = 0
363
+ total_duration = 0.0
364
+
365
+ for category, clip_name, clip_dir in clips:
366
+ print(f" Processing {clip_name}...", end=" ", flush=True)
367
+
368
+ # Parse BVH
369
+ bvh_path = os.path.join(clip_dir, "capture", f"{clip_name}.bvh")
370
+ bvh = parse_bvh(bvh_path)
371
+
372
+ # Load PKL
373
+ pkl_path = os.path.join(clip_dir, "retarget", f"{clip_name}.pkl")
374
+ pkl_data = load_pkl(pkl_path)
375
+
376
+ # Load NPZ
377
+ npz_path = os.path.join(clip_dir, "training", f"{clip_name}.npz")
378
+ npz_data = load_npz(npz_path)
379
+
380
+ # Compute stats
381
+ motion_stats = compute_motion_stats(pkl_data)
382
+ joint_range = compute_joint_range(pkl_data)
383
+ stages = get_pipeline_stages(clip_dir, clip_name)
384
+ file_sizes = get_file_sizes(clip_dir, clip_name)
385
+
386
+ clip_entry = {
387
+ "category": category,
388
+ "performer": get_performer(clip_name),
389
+ "frames": bvh["frames"],
390
+ "fps": bvh["fps"],
391
+ "duration_s": bvh["duration_s"],
392
+ "bvh_joints": bvh["joints"],
393
+ "retarget_dof": 29,
394
+ "training_frames": int(npz_data["joint_pos"].shape[0]),
395
+ "file_sizes": file_sizes,
396
+ "joint_range": joint_range,
397
+ "motion_stats": motion_stats,
398
+ "has_policy": "policy" in stages,
399
+ "pipeline_stages": stages,
400
+ }
401
+ manifest["clips"][clip_name] = clip_entry
402
+
403
+ total_frames += bvh["frames"]
404
+ total_duration += bvh["duration_s"]
405
+
406
+ # Quality checks
407
+ if not args.skip_quality:
408
+ # Joint limits
409
+ jl = check_joint_limits(pkl_data)
410
+ quality["checks"]["joint_limit_violations"]["clips"][clip_name] = jl
411
+
412
+ # Ground penetration
413
+ gp = check_ground_penetration(npz_data)
414
+ quality["checks"]["ground_penetration"]["clips"][clip_name] = gp
415
+
416
+ # Frame consistency
417
+ pkl_frames = np.array(pkl_data["dof_pos"]).shape[0]
418
+ npz_frames = npz_data["joint_pos"].shape[0]
419
+ fc = {
420
+ "bvh_frames": bvh["frames"],
421
+ "pkl_frames": pkl_frames,
422
+ "npz_frames": npz_frames,
423
+ "pkl_match": pkl_frames == bvh["frames"],
424
+ "npz_match": npz_frames in (bvh["frames"], bvh["frames"] - 1),
425
+ }
426
+ quality["checks"]["frame_consistency"]["clips"][clip_name] = fc
427
+
428
+ # NaN check
429
+ nan = check_nan(pkl_data, npz_data)
430
+ quality["checks"]["nan_check"]["clips"][clip_name] = nan
431
+
432
+ # File completeness
433
+ expected_capture = [f"{clip_name}.bvh", f"{clip_name}.gif", f"{clip_name}.mp4",
434
+ f"{clip_name}_bl.fbx", f"{clip_name}_mb.fbx",
435
+ f"{clip_name}_ue.fbx", f"{clip_name}_un.fbx"]
436
+ expected_retarget = [f"{clip_name}.pkl", f"{clip_name}.csv",
437
+ f"{clip_name}_retarget.gif", f"{clip_name}_retarget.mp4"]
438
+ expected_training = [f"{clip_name}.npz",
439
+ f"{clip_name}_training.gif", f"{clip_name}_training.mp4"]
440
+ missing = []
441
+ for f in expected_capture:
442
+ if not os.path.exists(os.path.join(clip_dir, "capture", f)):
443
+ missing.append(f"capture/{f}")
444
+ for f in expected_retarget:
445
+ if not os.path.exists(os.path.join(clip_dir, "retarget", f)):
446
+ missing.append(f"retarget/{f}")
447
+ for f in expected_training:
448
+ if not os.path.exists(os.path.join(clip_dir, "training", f)):
449
+ missing.append(f"training/{f}")
450
+ quality["checks"]["file_completeness"]["clips"][clip_name] = {
451
+ "complete": len(missing) == 0,
452
+ "missing": missing,
453
+ }
454
+
455
+ # Classify clip
456
+ has_issues = (jl["violations"] > 0 or gp["penetration_frames"] > 0 or
457
+ not fc["pkl_match"] or not fc["npz_match"] or
458
+ nan["has_nan"] or len(missing) > 0)
459
+ has_errors = nan["has_nan"] or not fc["pkl_match"] or not fc["npz_match"]
460
+
461
+ if has_errors:
462
+ quality["summary"]["errors"].append(clip_name)
463
+ elif has_issues:
464
+ quality["summary"]["warnings"].append(clip_name)
465
+ else:
466
+ quality["summary"]["passed"].append(clip_name)
467
+
468
+ # Generate per-clip README
469
+ generate_clip_readme(clip_dir, clip_name, clip_entry)
470
+
471
+ print("done")
472
+
473
+ # Add totals to manifest
474
+ manifest["total_clips"] = len(clips)
475
+ manifest["total_duration_s"] = round(total_duration, 1)
476
+ manifest["total_frames"] = total_frames
477
+ manifest["categories"] = {}
478
+ for cat in ["dance", "karate", "bonus"]:
479
+ cat_clips = [c for c in clips if c[0] == cat]
480
+ manifest["categories"][cat] = {
481
+ "clips": len(cat_clips),
482
+ "duration_s": round(sum(manifest["clips"][c[1]]["duration_s"] for c in cat_clips), 1),
483
+ }
484
+
485
+ # Write manifest
486
+ with open("manifest.json", "w") as f:
487
+ json.dump(manifest, f, indent=2)
488
+ print(f"\nWrote manifest.json ({len(clips)} clips)")
489
+
490
+ # Write quality report
491
+ if not args.skip_quality:
492
+ with open("quality_report.json", "w") as f:
493
+ json.dump(quality, f, indent=2)
494
+ p = len(quality["summary"]["passed"])
495
+ w = len(quality["summary"]["warnings"])
496
+ e = len(quality["summary"]["errors"])
497
+ print(f"Wrote quality_report.json ({p} passed, {w} warnings, {e} errors)")
498
+
499
+ print(f"Generated {len(clips)} clip READMEs")
500
+ print(f"\nDataset: {len(clips)} clips, {total_frames} frames, {total_duration:.0f}s ({total_duration/60:.1f} min)")
501
+
502
+
503
+ if __name__ == "__main__":
504
+ main()
karate/CLAUDE.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ <claude-mem-context>
2
+ # Recent Activity
3
+
4
+ <!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
5
+
6
+ *No recent activity*
7
+ </claude-mem-context>
karate/movin_export_result.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Start exporting clip 'M_Dance20'.
2
+ Start loading MOVINMan motion : M_Dance20
3
+ Motion Path : recordings\Actor_1_260223_073816.bin
4
+ Clip 'M_Dance20' exported successfully.
5
+
manifest.json ADDED
The diff for this file is too large to render. See raw diff
 
mjlab/.dockerignore ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ .venv/
2
+ .git/
3
+ .github/
4
+ .gitignore
5
+ Dockerfile
mjlab/.gitignore ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ wandb/
2
+ logs/
3
+ onnx/
4
+ videos/
5
+ __pycache__/
6
+ MUJOCO_LOG.TXT
7
+ debug.py
8
+ .vscode/
9
+ *.ipynb_checkpoints/
10
+ motions/
11
+ *_rerun*
12
+ artifacts/
13
+ .venv/
14
+ render_robots.py
15
+ benchmark_results/
16
+
17
+ # Documentation outputs.
18
+ **/_build/*
19
+ **/generated/*
20
+
mjlab/.pre-commit-config.yaml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ # Ruff version.
4
+ rev: v0.14.14
5
+ hooks:
6
+ # Run the linter.
7
+ - id: ruff-check
8
+ args: [ --fix ]
9
+ # Run the formatter.
10
+ - id: ruff-format
mjlab/.python-version ADDED
@@ -0,0 +1 @@
 
 
1
+ 3.13
mjlab/CITATION.cff ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This CITATION.cff file was generated with cffinit.
2
+ # Visit https://bit.ly/cffinit to generate yours today!
3
+
4
+ cff-version: 1.2.0
5
+ title: >-
6
+ mjlab: A Lightweight Framework for GPU-Accelerated Robot Learning
7
+ message: >-
8
+ If you use this software, please cite it using the
9
+ metadata from this file.
10
+ type: software
11
+ authors:
12
+ - given-names: Kevin
13
+ family-names: Zakka
14
+ email: zakka@berkeley.edu
15
+ - given-names: Brent
16
+ family-names: Yi
17
+ email: brentyi@berkeley.edu
18
+ - given-names: Qiayuan
19
+ family-names: Liao
20
+ email: qiayuanl@berkeley.edu
21
+ - given-names: Louis
22
+ family-names: Le Lay
23
+ email: le.lay.louis@gmail.com
24
+ - given-names: Koushil
25
+ family-names: Sreenath
26
+ - given-names: Pieter
27
+ family-names: Abbeel
28
+ repository-code: 'https://github.com/mujocolab/mjlab'
29
+ keywords:
30
+ - mujoco
31
+ - mujoco-warp
32
+ - simulation
33
+ - reinforcement-learning
34
+ - robotics
35
+ license: Apache-2.0
36
+ commit: 20233215611f55fba8cff34a1ce3f9937ab63a25
37
+ version: 1.1.1
38
+ date-released: '2026-02-14'
39
+ preferred-citation:
40
+ type: article
41
+ title: >-
42
+ mjlab: A Lightweight Framework for GPU-Accelerated Robot Learning
43
+ authors:
44
+ - given-names: Kevin
45
+ family-names: Zakka
46
+ - given-names: Qiayuan
47
+ family-names: Liao
48
+ - given-names: Brent
49
+ family-names: Yi
50
+ - given-names: Louis
51
+ family-names: Le Lay
52
+ - given-names: Koushil
53
+ family-names: Sreenath
54
+ - given-names: Pieter
55
+ family-names: Abbeel
56
+ year: 2026
57
+ url: https://arxiv.org/abs/2601.22074
58
+ identifiers:
59
+ - type: arxiv
60
+ value: 2601.22074
mjlab/CLAUDE.md ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Development Workflow
2
+
3
+ **Always use `uv run`, not python**.
4
+
5
+ ```sh
6
+
7
+ # 1. Make changes.
8
+
9
+ # 2. Type check.
10
+ uv run ty check # Fast
11
+ uv run pyright # More thorough, but slower
12
+
13
+ # 3. Run tests.
14
+ uv run pytest tests/ # Single suite
15
+ uv run pytest tests/<test_file>.py # Specific file
16
+
17
+ # 4. Format and lint before committing.
18
+ uv run ruff format
19
+ uv run ruff check --fix
20
+ ```
21
+
22
+ We've bundled common commands into a Makefile for convenience.
23
+
24
+ ```sh
25
+ make format # Format and lint
26
+ make type # Type-check
27
+ make check # make format && make type
28
+ make test-fast # Run tests excluding slow ones
29
+ make test # Run the full test suite
30
+ make docs # Build documentation
31
+ ```
32
+
33
+ Before creating a PR, ensure all checks pass with `make test`.
34
+
35
+ When making user-facing changes, add an entry to `docs/source/changelog.rst`
36
+ under the "Upcoming version (not yet released)" section using
37
+ Added/Changed/Fixed categories.
38
+
39
+ Some style guidelines to follow:
40
+ - Line length limit is 88 columns. This applies to code, comments, and docstrings.
41
+ - Avoid local imports unless they are strictly necessary (e.g. circular imports).
42
+ - Tests should follow these principles:
43
+ - Use functions and fixtures; do not use test classes.
44
+ - Favor targeted, efficient tests over exhaustive edge-case coverage.
45
+ - Prefer running individual tests rather than the full test suite to improve iteration speed.
mjlab/CONTRIBUTING.md ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributing
2
+
3
+ Bug fixes and documentation improvements are always welcome. For new features, please open an issue first so we can discuss whether it fits and work out the design, as we're intentional about keeping the scope focused.
4
+
5
+ ## Workflow
6
+
7
+ 1. Fork the repository and create a feature branch.
8
+ 2. Make your changes.
9
+ 3. Ensure formatting, type checking, and tests pass: `make test-all`.
10
+ 4. Submit a pull request.
11
+
12
+ Type checking (`make type`) is required, PRs that don't pass will be blocked. You can optionally install pre-commit hooks (`pre-commit install`) to catch issues early.
13
+
14
+ ## Changelog
15
+
16
+ Add entries to the "Upcoming version" section in `docs/source/changelog.rst` under the appropriate category (Added / Changed / Fixed), following [Keep a Changelog](https://keepachangelog.com/) conventions.
17
+
18
+ ## Getting Help
19
+
20
+ - **Issues**: https://github.com/mujocolab/mjlab/issues
21
+ - **Discussions**: https://github.com/mujocolab/mjlab/discussions
22
+
23
+ ## License
24
+
25
+ By contributing, you agree your contributions will be licensed under Apache 2.0.
mjlab/Dockerfile ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Refer to uv-docker-example:
2
+ # https://github.com/astral-sh/uv-docker-example/blob/main/standalone.Dockerfile
3
+ # Note that we use uv to launch, so we omit the second half of the example (non-UV final image)
4
+
5
+ FROM nvidia/cuda:12.8.0-devel-ubuntu24.04
6
+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
7
+
8
+ ENV DEBIAN_FRONTEND=noninteractive
9
+ RUN apt-get update && apt-get install -y \
10
+ git \
11
+ curl \
12
+ libegl-dev \
13
+ && rm -rf /var/lib/apt/lists/*
14
+
15
+ ENV UV_COMPILE_BYTECODE=1
16
+ ENV UV_LINK_MODE=copy
17
+ ENV UV_PYTHON_PREFERENCE=only-managed
18
+
19
+ RUN uv python install 3.13
20
+
21
+ WORKDIR /app
22
+
23
+ RUN --mount=type=cache,target=/root/.cache/uv \
24
+ --mount=type=bind,source=uv.lock,target=uv.lock \
25
+ --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
26
+ uv sync --locked --no-install-project --no-editable --no-dev
27
+
28
+ ADD . /app
29
+
30
+ RUN --mount=type=cache,target=/root/.cache/uv \
31
+ uv sync --locked --no-editable --no-dev
32
+
33
+ ENV MUJOCO_GL=egl
34
+ EXPOSE 8080
35
+
36
+ CMD ["uv", "run", "python", "tests/smoke_test.py"]
mjlab/LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2025, The mjlab Developers
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
mjlab/Makefile ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .PHONY: sync
2
+ sync:
3
+ uv sync --all-extras --all-packages --group dev
4
+
5
+ .PHONY: format
6
+ format:
7
+ uv run ruff format
8
+ uv run ruff check --fix
9
+
10
+ .PHONY: type
11
+ type:
12
+ uv run ty check
13
+ uv run pyright
14
+
15
+ .PHONY: check
16
+ check: format type
17
+
18
+ .PHONY: test
19
+ test:
20
+ uv run pytest
21
+
22
+ .PHONY: test-fast
23
+ test-fast:
24
+ uv run pytest -m "not slow"
25
+
26
+ .PHONY: test-cpu
27
+ test-cpu:
28
+ FORCE_CPU=1 uv run pytest
29
+
30
+ .PHONY: test-cpu-fast
31
+ test-cpu-fast:
32
+ FORCE_CPU=1 uv run pytest -m "not slow"
33
+
34
+ .PHONY: test-all
35
+ test-all: check test
36
+
37
+ .PHONY: build
38
+ build:
39
+ uv build
40
+ uv run --isolated --no-project --with dist/*.whl tests/smoke_test.py
41
+ uv run --isolated --no-project --with dist/*.tar.gz tests/smoke_test.py
42
+ @echo "Build and import test successful"
43
+
44
+ .PHONY: docs
45
+ docs:
46
+ uv run --group docs sphinx-build docs docs/_build
47
+
48
+ .PHONY: docs-multiversion
49
+ docs-multiversion:
50
+ uv run --group docs sphinx-multiversion docs docs/_build
51
+
52
+ .PHONY: docs-watch
53
+ docs-watch:
54
+ uv run --group docs sphinx-autobuild docs docs/_build
55
+
56
+ .PHONY: publish-test
57
+ publish-test: build
58
+ uv publish --publish-url https://test.pypi.org/legacy/
59
+
60
+ .PHONY: publish
61
+ publish: build
62
+ uv publish
63
+
64
+ .PHONY: docker-build
65
+ docker-build:
66
+ docker build -t mjlab:latest .
mjlab/README.md ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ![Project banner](https://raw.githubusercontent.com/mujocolab/mjlab/main/docs/source/_static/mjlab-banner.jpg)
2
+
3
+ # mjlab
4
+
5
+ [![GitHub Actions](https://img.shields.io/github/actions/workflow/status/mujocolab/mjlab/ci.yml?branch=main)](https://github.com/mujocolab/mjlab/actions/workflows/ci.yml?query=branch%3Amain)
6
+ [![Documentation](https://github.com/mujocolab/mjlab/actions/workflows/docs.yml/badge.svg)](https://mujocolab.github.io/mjlab/)
7
+ [![License](https://img.shields.io/github/license/mujocolab/mjlab)](https://github.com/mujocolab/mjlab/blob/main/LICENSE)
8
+ [![Nightly Benchmarks](https://img.shields.io/badge/Nightly-Benchmarks-blue)](https://mujocolab.github.io/mjlab/nightly/)
9
+ [![PyPI](https://img.shields.io/pypi/v/mjlab)](https://pypi.org/project/mjlab/)
10
+
11
+ mjlab combines [Isaac Lab](https://github.com/isaac-sim/IsaacLab)'s manager-based API with [MuJoCo Warp](https://github.com/google-deepmind/mujoco_warp), a GPU-accelerated version of [MuJoCo](https://github.com/google-deepmind/mujoco).
12
+ The framework provides composable building blocks for environment design,
13
+ with minimal dependencies and direct access to native MuJoCo data structures.
14
+
15
+ ## Getting Started
16
+
17
+ mjlab requires an NVIDIA GPU for training. macOS is supported for evaluation only.
18
+
19
+ **Try it now:**
20
+
21
+ Run the demo (no installation needed):
22
+
23
+ ```bash
24
+ uvx --from mjlab --refresh demo
25
+ ```
26
+
27
+ Or try in [Google Colab](https://colab.research.google.com/github/mujocolab/mjlab/blob/main/notebooks/demo.ipynb) (no local setup required).
28
+
29
+ **Install from source:**
30
+
31
+ ```bash
32
+ git clone https://github.com/mujocolab/mjlab.git && cd mjlab
33
+ uv run demo
34
+ ```
35
+
36
+ For alternative installation methods (PyPI, Docker), see the [Installation Guide](https://mujocolab.github.io/mjlab/source/installation.html).
37
+
38
+ ## Training Examples
39
+
40
+ ### 1. Velocity Tracking
41
+
42
+ Train a Unitree G1 humanoid to follow velocity commands on flat terrain:
43
+
44
+ ```bash
45
+ uv run train Mjlab-Velocity-Flat-Unitree-G1 --env.scene.num-envs 4096
46
+ ```
47
+
48
+ **Multi-GPU Training:** Scale to multiple GPUs using `--gpu-ids`:
49
+
50
+ ```bash
51
+ uv run train Mjlab-Velocity-Flat-Unitree-G1 \
52
+ --gpu-ids 0 1 \
53
+ --env.scene.num-envs 4096
54
+ ```
55
+
56
+ See the [Distributed Training guide](https://mujocolab.github.io/mjlab/source/distributed_training.html) for details.
57
+
58
+ Evaluate a policy while training (fetches latest checkpoint from Weights & Biases):
59
+
60
+ ```bash
61
+ uv run play Mjlab-Velocity-Flat-Unitree-G1 --wandb-run-path your-org/mjlab/run-id
62
+ ```
63
+
64
+ ### 2. Motion Imitation
65
+
66
+ Train a humanoid to mimic reference motions. mjlab uses WandB to manage motion datasets.
67
+ See the [motion preprocessing documentation](https://github.com/HybridRobotics/whole_body_tracking/blob/main/README.md#motion-preprocessing--registry-setup) for setup instructions.
68
+
69
+ ```bash
70
+ uv run train Mjlab-Tracking-Flat-Unitree-G1 --registry-name your-org/motions/motion-name --env.scene.num-envs 4096
71
+ uv run play Mjlab-Tracking-Flat-Unitree-G1 --wandb-run-path your-org/mjlab/run-id
72
+ ```
73
+
74
+ ### 3. Sanity-check with Dummy Agents
75
+
76
+ Use built-in agents to sanity check your MDP before training:
77
+
78
+ ```bash
79
+ uv run play Mjlab-Your-Task-Id --agent zero # Sends zero actions
80
+ uv run play Mjlab-Your-Task-Id --agent random # Sends uniform random actions
81
+ ```
82
+
83
+ When running motion-tracking tasks, add `--registry-name your-org/motions/motion-name` to the command.
84
+
85
+
86
+ ## Community Projects
87
+
88
+ mjlab is used for research and robotics applications around the world. Examples:
89
+
90
+ <table>
91
+ <tr>
92
+ <td>
93
+ <a href="https://github.com/menloresearch/asimov-mjlab">
94
+ menloresearch/asimov-mjlab
95
+ <br /><img
96
+ alt="GitHub stars"
97
+ src="https://img.shields.io/github/stars/menloresearch/asimov-mjlab?style=social"
98
+ />
99
+ </a>
100
+ </td>
101
+ <td>Locomotion fork for the Asimov bipedal robot.</td>
102
+ </tr>
103
+ <tr>
104
+ <td>
105
+ <a href="http://husky-humanoid.github.io/">
106
+ HUSKY
107
+ </a>
108
+ <br />
109
+ <a href="https://github.com/mujocolab/mjlab/discussions/572">#572</a>
110
+ ·
111
+ <a href="https://arxiv.org/abs/2602.03205">Paper</a>
112
+ </td>
113
+ <td>
114
+ Humanoid skateboarding with dynamic balance control.
115
+ </td>
116
+ </tr>
117
+ <tr>
118
+ <td>
119
+ <a href="https://github.com/Nagi-ovo/mjlab-homierl">
120
+ Nagi-ovo/mjlab-homierl
121
+ <br /><img
122
+ alt="GitHub stars"
123
+ src="https://img.shields.io/github/stars/Nagi-ovo/mjlab-homierl?style=social"
124
+ />
125
+ </a>
126
+ </td>
127
+ <td>Multi-task H1 locomotion (walk/squat/stand) with upper-body disturbance robustness.</td>
128
+ </tr>
129
+ <tr>
130
+ <td>
131
+ <a href="https://github.com/MyoHub/mjlab_myosuite">
132
+ MyoHub/mjlab_myosuite
133
+ <br /><img
134
+ alt="GitHub stars"
135
+ src="https://img.shields.io/github/stars/MyoHub/mjlab_myosuite?style=social"
136
+ />
137
+ </a>
138
+ </td>
139
+ <td>Musculoskeletal simulation integration with MyoSuite.</td>
140
+ </tr>
141
+ <tr>
142
+ <td>
143
+ <a href="https://github.com/MarcDcls/mjlab_upkie">
144
+ MarcDcls/mjlab_upkie
145
+ <br /><img
146
+ alt="GitHub stars"
147
+ src="https://img.shields.io/github/stars/MarcDcls/mjlab_upkie?style=social"
148
+ />
149
+ </a>
150
+ </td>
151
+ <td>Velocity control for the Upkie wheeled biped.</td>
152
+ </tr>
153
+ <tr>
154
+ <td>
155
+ <a href="https://github.com/unitreerobotics/unitree_rl_mjlab">
156
+ unitreerobotics/unitree_rl_mjlab
157
+ <br /><img
158
+ alt="GitHub stars"
159
+ src="https://img.shields.io/github/stars/unitreerobotics/unitree_rl_mjlab?style=social"
160
+ />
161
+ </a>
162
+ </td>
163
+ <td>Official Unitree RL environments for Go2, G1, and H1_2.</td>
164
+ </tr>
165
+ <tr>
166
+ <td>
167
+ <a href="https://github.com/Msornerrrr/in-hand-rotation-mjlab">
168
+ Msornerrrr/in-hand-rotation-mjlab
169
+ <br /><img
170
+ alt="GitHub stars"
171
+ src="https://img.shields.io/github/stars/Msornerrrr/in-hand-rotation-mjlab?style=social"
172
+ />
173
+ </a>
174
+ </td>
175
+ <td>Sim-to-real RL for in-hand cube rotation with the LEAP Hand.</td>
176
+ </tr>
177
+ </table>
178
+
179
+ Want to share your project? Post in [Show and Tell](https://github.com/mujocolab/mjlab/discussions/categories/show-and-tell)!
180
+
181
+ ## Documentation
182
+
183
+ Full documentation is available at **[mujocolab.github.io/mjlab](https://mujocolab.github.io/mjlab/)**.
184
+
185
+ ## Development
186
+
187
+ ```bash
188
+ make test # Run all tests
189
+ make test-fast # Skip slow tests
190
+ make format # Format and lint
191
+ make docs # Build docs locally
192
+ ```
193
+
194
+ For development setup: `uvx pre-commit install`
195
+
196
+ ## Citation
197
+
198
+ If you use mjlab in your research, please cite:
199
+
200
+ ```bibtex
201
+ @misc{zakka2026mjlablightweightframeworkgpuaccelerated,
202
+ title={mjlab: A Lightweight Framework for GPU-Accelerated Robot Learning},
203
+ author={Kevin Zakka and Qiayuan Liao and Brent Yi and Louis Le Lay and Koushil Sreenath and Pieter Abbeel},
204
+ year={2026},
205
+ eprint={2601.22074},
206
+ archivePrefix={arXiv},
207
+ primaryClass={cs.RO},
208
+ url={https://arxiv.org/abs/2601.22074},
209
+ }
210
+ ```
211
+
212
+ ## License
213
+
214
+ mjlab is licensed under the [Apache License, Version 2.0](LICENSE).
215
+
216
+ ### Third-Party Code
217
+
218
+ Some portions of mjlab are forked from external projects:
219
+
220
+ - **`src/mjlab/utils/lab_api/`** — Utilities forked from [NVIDIA Isaac
221
+ Lab](https://github.com/isaac-sim/IsaacLab) (BSD-3-Clause license, see file
222
+ headers)
223
+
224
+ Forked components retain their original licenses. See file headers for details.
225
+
226
+ ## Acknowledgments
227
+
228
+ mjlab wouldn't exist without the excellent work of the Isaac Lab team, whose API
229
+ design and abstractions mjlab builds upon.
230
+
231
+ Thanks to the MuJoCo Warp team — especially Erik Frey and Taylor Howell — for
232
+ answering our questions, giving helpful feedback, and implementing features
233
+ based on our requests countless times.
mjlab/RELEASING.md ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Releasing
2
+
3
+ ## Pre-release checklist
4
+
5
+ 1. Bump `version` in `pyproject.toml`.
6
+ 2. Update `version` and `date-released` in `CITATION.cff`.
7
+ 3. Update the "Upcoming version (not yet released)" heading in `docs/source/changelog.rst` to the new version number and date.
8
+ 4. Commit the version bump, then create an annotated tag:
9
+
10
+ ```sh
11
+ git tag -a vX.Y.Z -m "Release vX.Y.Z"
12
+ git push origin vX.Y.Z
13
+ ```
14
+
15
+ ## Build and verify
16
+
17
+ Clean previous build artifacts, then build:
18
+
19
+ ```sh
20
+ rm -rf dist/
21
+ make build
22
+ ```
23
+
24
+ This runs `uv build` to produce a wheel and sdist in `dist/`, then smoke-tests
25
+ both artifacts in isolated environments.
26
+
27
+ ## Test on TestPyPI (optional but recommended)
28
+
29
+ Upload to TestPyPI first to catch packaging issues before the real release:
30
+
31
+ ```sh
32
+ UV_PUBLISH_TOKEN=<your-testpypi-token> make publish-test
33
+ ```
34
+
35
+ Then verify the upload works end-to-end. Use `--index-strategy unsafe-best-match`
36
+ because TestPyPI won't have all dependencies and uv needs to fall back to real
37
+ PyPI for them:
38
+
39
+ ```sh
40
+ uvx --extra-index-url https://test.pypi.org/simple/ \
41
+ --index-strategy unsafe-best-match \
42
+ --from mjlab \
43
+ demo
44
+ ```
45
+
46
+ Note: TestPyPI requires a separate account and token from real PyPI.
47
+ Generate one at https://test.pypi.org/manage/account/token/.
48
+
49
+ ## Publish to PyPI
50
+
51
+ ```sh
52
+ UV_PUBLISH_TOKEN=<your-pypi-token> make publish
53
+ ```
54
+
55
+ Generate a token at https://pypi.org/manage/account/token/.
56
+
57
+ ## Post-release
58
+
59
+ Verify the release installs and runs correctly. Use `--refresh` to bypass
60
+ the `uvx` cache (which may still hold the TestPyPI version):
61
+
62
+ ```sh
63
+ uvx --refresh --from mjlab demo
64
+ ```
65
+
66
+ ## Releasing from a past tag
67
+
68
+ If the tag has already been created and HEAD has moved ahead, check out the
69
+ tag before building:
70
+
71
+ ```sh
72
+ git checkout vX.Y.Z
73
+ make build
74
+ make publish
75
+ git checkout main
76
+ ```
mjlab/pyproject.toml ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [build-system]
2
+ requires = ["uv_build>=0.8.19,<0.9.0"]
3
+ build-backend = "uv_build"
4
+
5
+ [project]
6
+ name = "mjlab"
7
+ version = "1.1.1"
8
+ license = "Apache-2.0"
9
+ license-files = ["LICENSE"]
10
+ readme = { file = "README.md", content-type = "text/markdown" }
11
+ authors = [
12
+ {name = "The MjLab Developers"},
13
+ ]
14
+ keywords = ["mujoco", "mujoco-warp", "simulation", "reinforcement-learning", "robotics"]
15
+ classifiers = [
16
+ "Development Status :: 5 - Production/Stable",
17
+ "Intended Audience :: Developers",
18
+ "Intended Audience :: Science/Research",
19
+ "License :: OSI Approved :: Apache Software License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Programming Language :: Python :: 3 :: Only",
26
+ "Typing :: Typed",
27
+ "Environment :: GPU :: NVIDIA CUDA",
28
+ "Topic :: Scientific/Engineering",
29
+ "Natural Language :: English",
30
+ ]
31
+ description = "Isaac Lab API, powered by MuJoCo-Warp, for RL and robotics research."
32
+ requires-python = ">=3.10,<3.14"
33
+ dependencies = [
34
+ "prettytable",
35
+ "tqdm",
36
+ "tyro>=1.0.1",
37
+ "torch>=2.7.0",
38
+ "torchrunx>=0.3.4",
39
+ "warp-lang>=1.12.0.dev",
40
+ "mujoco-warp>=3.5.0",
41
+ "mujoco>=3.5.0",
42
+ "trimesh>=4.8.3",
43
+ "viser>=1.0.21",
44
+ "mediapy>=1.2.6",
45
+ "imageio-ffmpeg",
46
+ "tensordict",
47
+ "rsl-rl-lib==4.0.1",
48
+ "tensorboard>=2.20.0",
49
+ "onnxscript>=0.5.4",
50
+ "wandb>=0.22.3",
51
+ ]
52
+
53
+ [project.urls]
54
+ "Bug Reports" = "https://github.com/mujocolab/mjlab/issues"
55
+ "Source" = "https://github.com/mujocolab/mjlab"
56
+
57
+ [project.scripts]
58
+ train = "mjlab.scripts.train:main"
59
+ play = "mjlab.scripts.play:main"
60
+ demo = "mjlab.scripts.demo:main"
61
+ list_envs = "mjlab.scripts.list_envs:main"
62
+ viz-nan = "mjlab.scripts.nan_viz:main"
63
+
64
+ [dependency-groups]
65
+ dev = [
66
+ "ipdb>=0.13.13",
67
+ "pre-commit>=4.3.0",
68
+ "pyright>=1.1.408",
69
+ "pytest>=v9.0.2",
70
+ "ruff>=v0.14.14",
71
+ "ty>=v0.0.14",
72
+ ]
73
+ docs = [
74
+ "myst-parser>=4.0.1",
75
+ "sphinx>=8.1.3",
76
+ "sphinx-autodoc-typehints>=3.0.1",
77
+ "sphinx-autobuild>=2024.10.3",
78
+ "sphinx-book-theme>=1.1.4",
79
+ "sphinx-copybutton>=0.5.2",
80
+ "sphinx-design>=0.6.1",
81
+ "autodocsumm",
82
+ "sphinxemoji",
83
+ "sphinxcontrib.bibtex",
84
+ "sphinx-icon",
85
+ "sphinx-tabs",
86
+ "sphinx_multiversion",
87
+ ]
88
+
89
+ [project.optional-dependencies]
90
+ cu128 = ["torch>=2.7.0"]
91
+
92
+ [tool.uv]
93
+ required-environments = [
94
+ "sys_platform == 'darwin' and platform_machine == 'arm64'",
95
+ "sys_platform == 'linux' and platform_machine == 'x86_64'",
96
+ ]
97
+
98
+ [[tool.uv.index]]
99
+ url = "https://pypi.org/simple"
100
+
101
+ [[tool.uv.index]]
102
+ name = "nvidia"
103
+ url = "https://pypi.nvidia.com/"
104
+ explicit = true
105
+
106
+ [[tool.uv.index]]
107
+ name = "pytorch-cu128"
108
+ url = "https://download.pytorch.org/whl/cu128"
109
+ explicit = true
110
+
111
+ [[tool.uv.index]]
112
+ name = "pytorch-cpu"
113
+ url = "https://download.pytorch.org/whl/cpu"
114
+ explicit = true
115
+
116
+ [[tool.uv.index]]
117
+ name = "mujoco"
118
+ url = "https://py.mujoco.org"
119
+ explicit = true
120
+
121
+ [tool.uv.sources]
122
+ warp-lang = { index = "nvidia", marker = "sys_platform != 'darwin'" }
123
+ torch = { index = "pytorch-cu128", extra = "cu128", marker = "sys_platform != 'darwin'" }
124
+ mujoco = { index = "mujoco" }
125
+ mujoco-warp = { git = "https://github.com/google-deepmind/mujoco_warp", rev = "fc9158989525538db53a2a8c3c0f156cbfeca911" }
126
+
127
+ [tool.ruff]
128
+ src = ["src"] # Helpful for recognizing first-party imports.
129
+ indent-width = 2
130
+ exclude = [
131
+ "src/mjlab/utils/lab_api",
132
+ "typings",
133
+ ]
134
+
135
+ [tool.ruff.lint]
136
+ select = ["E4", "E7", "E9", "F", "I", "B"]
137
+ ignore = ["B011"]
138
+
139
+ [tool.pyright]
140
+ pythonVersion = "3.10"
141
+ ignore = ["./typings", "./src/mjlab/utils/lab_api", "./docs"]
142
+ stubPath = "typings"
143
+
144
+ [tool.ty.environment]
145
+ extra-paths = ["typings"]
146
+
147
+ [tool.ty.src]
148
+ include = ["src", "tests"]
149
+ exclude = ["src/mjlab/utils/lab_api", "typings"]
150
+
151
+ [tool.pytest.ini_options]
152
+ markers = [
153
+ "slow: marks tests as slow (deselect with '-m \"not slow\"')",
154
+ ]
155
+ addopts = "--strict-markers"
mjlab/uv.lock ADDED
The diff for this file is too large to render. See raw diff
 
movin-studio-project/project.json ADDED
The diff for this file is too large to render. See raw diff
 
quality_report.json ADDED
@@ -0,0 +1,1512 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "generated": "2026-02-25T06:18:21Z",
3
+ "checks": {
4
+ "joint_limit_violations": {
5
+ "description": "Frames where retargeted angles exceed G1 limits",
6
+ "clips": {
7
+ "B_DadDance": {
8
+ "violations": 1,
9
+ "max_excess_rad": 0.0,
10
+ "worst_joint": "right_ankle_roll_joint"
11
+ },
12
+ "B_LongDance": {
13
+ "violations": 62,
14
+ "max_excess_rad": 0.0,
15
+ "worst_joint": "right_ankle_roll_joint"
16
+ },
17
+ "B_SpiralDance": {
18
+ "violations": 0,
19
+ "max_excess_rad": 0.0,
20
+ "worst_joint": null
21
+ },
22
+ "B_StretchDance": {
23
+ "violations": 0,
24
+ "max_excess_rad": 0.0,
25
+ "worst_joint": null
26
+ },
27
+ "B_WiggleDance": {
28
+ "violations": 0,
29
+ "max_excess_rad": 0.0,
30
+ "worst_joint": null
31
+ },
32
+ "J_Dance0_StepTouch": {
33
+ "violations": 281,
34
+ "max_excess_rad": 0.0,
35
+ "worst_joint": "left_ankle_roll_joint"
36
+ },
37
+ "J_Dance11_Gnarly": {
38
+ "violations": 2,
39
+ "max_excess_rad": 0.0,
40
+ "worst_joint": "left_ankle_roll_joint"
41
+ },
42
+ "J_Dance12_LushLife": {
43
+ "violations": 0,
44
+ "max_excess_rad": 0.0,
45
+ "worst_joint": null
46
+ },
47
+ "J_Dance17_Shuffle": {
48
+ "violations": 16,
49
+ "max_excess_rad": 0.0,
50
+ "worst_joint": "left_ankle_roll_joint"
51
+ },
52
+ "J_Dance18_TikTok": {
53
+ "violations": 8,
54
+ "max_excess_rad": 0.0,
55
+ "worst_joint": "right_ankle_roll_joint"
56
+ },
57
+ "J_Dance19_LetsGO": {
58
+ "violations": 0,
59
+ "max_excess_rad": 0.0,
60
+ "worst_joint": null
61
+ },
62
+ "J_Dance1_Modern": {
63
+ "violations": 58,
64
+ "max_excess_rad": 0.0,
65
+ "worst_joint": "right_ankle_roll_joint"
66
+ },
67
+ "J_Dance20_DWG": {
68
+ "violations": 0,
69
+ "max_excess_rad": 0.0,
70
+ "worst_joint": null
71
+ },
72
+ "J_Dance21_Blunt": {
73
+ "violations": 81,
74
+ "max_excess_rad": 0.0,
75
+ "worst_joint": "left_ankle_roll_joint"
76
+ },
77
+ "J_Dance22_Thrilling": {
78
+ "violations": 17,
79
+ "max_excess_rad": 0.0,
80
+ "worst_joint": "left_ankle_roll_joint"
81
+ },
82
+ "J_Dance23_MidnightSun": {
83
+ "violations": 31,
84
+ "max_excess_rad": 0.0,
85
+ "worst_joint": "left_ankle_roll_joint"
86
+ },
87
+ "J_Dance2_Salsa": {
88
+ "violations": 9,
89
+ "max_excess_rad": 0.0,
90
+ "worst_joint": "left_ankle_roll_joint"
91
+ },
92
+ "J_Dance3_Woah": {
93
+ "violations": 109,
94
+ "max_excess_rad": 0.0,
95
+ "worst_joint": "left_ankle_roll_joint"
96
+ },
97
+ "J_Dance4_Broadway": {
98
+ "violations": 27,
99
+ "max_excess_rad": 0.0,
100
+ "worst_joint": "left_ankle_roll_joint"
101
+ },
102
+ "J_Dance5_Hype": {
103
+ "violations": 134,
104
+ "max_excess_rad": 0.0,
105
+ "worst_joint": "left_ankle_roll_joint"
106
+ },
107
+ "J_Dance6_Sassy": {
108
+ "violations": 0,
109
+ "max_excess_rad": 0.0,
110
+ "worst_joint": null
111
+ },
112
+ "J_Dance7_Party": {
113
+ "violations": 38,
114
+ "max_excess_rad": 0.0,
115
+ "worst_joint": "right_ankle_roll_joint"
116
+ },
117
+ "J_Dance8_WestCoast": {
118
+ "violations": 11,
119
+ "max_excess_rad": 0.0,
120
+ "worst_joint": "right_ankle_roll_joint"
121
+ },
122
+ "J_Dance9_PeaceMaker": {
123
+ "violations": 105,
124
+ "max_excess_rad": 0.0,
125
+ "worst_joint": "right_ankle_roll_joint"
126
+ },
127
+ "J_ShortDance13_SingleLadies": {
128
+ "violations": 0,
129
+ "max_excess_rad": 0.0,
130
+ "worst_joint": null
131
+ },
132
+ "J_ShortDance14_Disco": {
133
+ "violations": 1,
134
+ "max_excess_rad": 0.0,
135
+ "worst_joint": "right_ankle_roll_joint"
136
+ },
137
+ "J_ShortDance15_Nineties": {
138
+ "violations": 2,
139
+ "max_excess_rad": 0.0,
140
+ "worst_joint": "right_ankle_roll_joint"
141
+ },
142
+ "J_ShortDance16_JazzWalk": {
143
+ "violations": 1,
144
+ "max_excess_rad": 0.0,
145
+ "worst_joint": "left_ankle_roll_joint"
146
+ },
147
+ "B_AttackKarate": {
148
+ "violations": 310,
149
+ "max_excess_rad": 0.0,
150
+ "worst_joint": "left_ankle_roll_joint"
151
+ },
152
+ "B_BowKarate": {
153
+ "violations": 283,
154
+ "max_excess_rad": 0.0,
155
+ "worst_joint": "left_ankle_roll_joint"
156
+ },
157
+ "B_ChopsKarate": {
158
+ "violations": 149,
159
+ "max_excess_rad": 0.0,
160
+ "worst_joint": "left_ankle_roll_joint"
161
+ },
162
+ "B_CrazyChopsKarate": {
163
+ "violations": 68,
164
+ "max_excess_rad": 0.0,
165
+ "worst_joint": "left_ankle_roll_joint"
166
+ },
167
+ "B_ForwardKarate": {
168
+ "violations": 132,
169
+ "max_excess_rad": 0.0,
170
+ "worst_joint": "right_ankle_roll_joint"
171
+ },
172
+ "B_LongKarate": {
173
+ "violations": 398,
174
+ "max_excess_rad": 0.0,
175
+ "worst_joint": "left_ankle_roll_joint"
176
+ },
177
+ "B_SpinKarate": {
178
+ "violations": 208,
179
+ "max_excess_rad": 0.0,
180
+ "worst_joint": "right_ankle_roll_joint"
181
+ },
182
+ "M_Move1": {
183
+ "violations": 376,
184
+ "max_excess_rad": 0.0,
185
+ "worst_joint": "right_ankle_roll_joint"
186
+ },
187
+ "M_Move10": {
188
+ "violations": 80,
189
+ "max_excess_rad": 0.0,
190
+ "worst_joint": "right_ankle_roll_joint"
191
+ },
192
+ "M_Move11": {
193
+ "violations": 117,
194
+ "max_excess_rad": 0.0,
195
+ "worst_joint": "left_ankle_roll_joint"
196
+ },
197
+ "M_Move17": {
198
+ "violations": 53,
199
+ "max_excess_rad": 0.0,
200
+ "worst_joint": "left_ankle_roll_joint"
201
+ },
202
+ "M_Move18": {
203
+ "violations": 77,
204
+ "max_excess_rad": 0.0,
205
+ "worst_joint": "left_ankle_roll_joint"
206
+ },
207
+ "M_Move19": {
208
+ "violations": 7,
209
+ "max_excess_rad": 0.0,
210
+ "worst_joint": "right_ankle_roll_joint"
211
+ },
212
+ "M_Move2": {
213
+ "violations": 477,
214
+ "max_excess_rad": 0.0,
215
+ "worst_joint": "left_ankle_roll_joint"
216
+ },
217
+ "M_Move20": {
218
+ "violations": 56,
219
+ "max_excess_rad": 0.0,
220
+ "worst_joint": "right_ankle_roll_joint"
221
+ },
222
+ "M_Move3": {
223
+ "violations": 331,
224
+ "max_excess_rad": 0.0,
225
+ "worst_joint": "left_ankle_roll_joint"
226
+ },
227
+ "M_Move4": {
228
+ "violations": 330,
229
+ "max_excess_rad": 0.0,
230
+ "worst_joint": "right_ankle_roll_joint"
231
+ },
232
+ "M_Move5": {
233
+ "violations": 297,
234
+ "max_excess_rad": 0.0,
235
+ "worst_joint": "left_ankle_roll_joint"
236
+ },
237
+ "M_Move6": {
238
+ "violations": 98,
239
+ "max_excess_rad": 0.0,
240
+ "worst_joint": "left_ankle_roll_joint"
241
+ },
242
+ "M_Move7": {
243
+ "violations": 167,
244
+ "max_excess_rad": 0.0,
245
+ "worst_joint": "right_ankle_roll_joint"
246
+ },
247
+ "M_Move8": {
248
+ "violations": 117,
249
+ "max_excess_rad": 0.0,
250
+ "worst_joint": "right_ankle_roll_joint"
251
+ },
252
+ "M_Move9": {
253
+ "violations": 182,
254
+ "max_excess_rad": 0.0,
255
+ "worst_joint": "left_ankle_roll_joint"
256
+ },
257
+ "M_ShortMove12": {
258
+ "violations": 10,
259
+ "max_excess_rad": 0.0,
260
+ "worst_joint": "left_ankle_roll_joint"
261
+ },
262
+ "M_ShortMove13": {
263
+ "violations": 37,
264
+ "max_excess_rad": 0.0,
265
+ "worst_joint": "left_ankle_roll_joint"
266
+ },
267
+ "M_ShortMove14": {
268
+ "violations": 16,
269
+ "max_excess_rad": 0.0,
270
+ "worst_joint": "left_ankle_roll_joint"
271
+ },
272
+ "M_ShortMove15": {
273
+ "violations": 46,
274
+ "max_excess_rad": 0.0,
275
+ "worst_joint": "left_ankle_roll_joint"
276
+ },
277
+ "M_ShortMove16": {
278
+ "violations": 76,
279
+ "max_excess_rad": 0.0,
280
+ "worst_joint": "right_ankle_roll_joint"
281
+ },
282
+ "B_Fence1": {
283
+ "violations": 17,
284
+ "max_excess_rad": 0.0,
285
+ "worst_joint": "left_ankle_roll_joint"
286
+ },
287
+ "B_Fence2": {
288
+ "violations": 35,
289
+ "max_excess_rad": 0.0,
290
+ "worst_joint": "left_ankle_roll_joint"
291
+ },
292
+ "B_HandsChop": {
293
+ "violations": 0,
294
+ "max_excess_rad": 0.0,
295
+ "worst_joint": null
296
+ },
297
+ "B_HandsUp": {
298
+ "violations": 0,
299
+ "max_excess_rad": 0.0,
300
+ "worst_joint": null
301
+ }
302
+ }
303
+ },
304
+ "ground_penetration": {
305
+ "description": "Frames where foot Z < -1cm",
306
+ "clips": {
307
+ "B_DadDance": {
308
+ "penetration_frames": 0,
309
+ "min_foot_z_m": 0.0423
310
+ },
311
+ "B_LongDance": {
312
+ "penetration_frames": 0,
313
+ "min_foot_z_m": 0.0424
314
+ },
315
+ "B_SpiralDance": {
316
+ "penetration_frames": 0,
317
+ "min_foot_z_m": 0.0361
318
+ },
319
+ "B_StretchDance": {
320
+ "penetration_frames": 0,
321
+ "min_foot_z_m": 0.0323
322
+ },
323
+ "B_WiggleDance": {
324
+ "penetration_frames": 0,
325
+ "min_foot_z_m": 0.0313
326
+ },
327
+ "J_Dance0_StepTouch": {
328
+ "penetration_frames": 0,
329
+ "min_foot_z_m": 0.0367
330
+ },
331
+ "J_Dance11_Gnarly": {
332
+ "penetration_frames": 0,
333
+ "min_foot_z_m": 0.035
334
+ },
335
+ "J_Dance12_LushLife": {
336
+ "penetration_frames": 0,
337
+ "min_foot_z_m": 0.0371
338
+ },
339
+ "J_Dance17_Shuffle": {
340
+ "penetration_frames": 0,
341
+ "min_foot_z_m": 0.0387
342
+ },
343
+ "J_Dance18_TikTok": {
344
+ "penetration_frames": 0,
345
+ "min_foot_z_m": 0.0344
346
+ },
347
+ "J_Dance19_LetsGO": {
348
+ "penetration_frames": 0,
349
+ "min_foot_z_m": 0.0419
350
+ },
351
+ "J_Dance1_Modern": {
352
+ "penetration_frames": 0,
353
+ "min_foot_z_m": 0.0369
354
+ },
355
+ "J_Dance20_DWG": {
356
+ "penetration_frames": 0,
357
+ "min_foot_z_m": 0.0335
358
+ },
359
+ "J_Dance21_Blunt": {
360
+ "penetration_frames": 0,
361
+ "min_foot_z_m": 0.0494
362
+ },
363
+ "J_Dance22_Thrilling": {
364
+ "penetration_frames": 0,
365
+ "min_foot_z_m": 0.0382
366
+ },
367
+ "J_Dance23_MidnightSun": {
368
+ "penetration_frames": 0,
369
+ "min_foot_z_m": 0.0335
370
+ },
371
+ "J_Dance2_Salsa": {
372
+ "penetration_frames": 0,
373
+ "min_foot_z_m": 0.0386
374
+ },
375
+ "J_Dance3_Woah": {
376
+ "penetration_frames": 0,
377
+ "min_foot_z_m": 0.0399
378
+ },
379
+ "J_Dance4_Broadway": {
380
+ "penetration_frames": 0,
381
+ "min_foot_z_m": 0.0394
382
+ },
383
+ "J_Dance5_Hype": {
384
+ "penetration_frames": 0,
385
+ "min_foot_z_m": 0.0384
386
+ },
387
+ "J_Dance6_Sassy": {
388
+ "penetration_frames": 0,
389
+ "min_foot_z_m": 0.0348
390
+ },
391
+ "J_Dance7_Party": {
392
+ "penetration_frames": 0,
393
+ "min_foot_z_m": 0.0435
394
+ },
395
+ "J_Dance8_WestCoast": {
396
+ "penetration_frames": 0,
397
+ "min_foot_z_m": 0.0607
398
+ },
399
+ "J_Dance9_PeaceMaker": {
400
+ "penetration_frames": 0,
401
+ "min_foot_z_m": 0.0359
402
+ },
403
+ "J_ShortDance13_SingleLadies": {
404
+ "penetration_frames": 0,
405
+ "min_foot_z_m": 0.0331
406
+ },
407
+ "J_ShortDance14_Disco": {
408
+ "penetration_frames": 0,
409
+ "min_foot_z_m": 0.0394
410
+ },
411
+ "J_ShortDance15_Nineties": {
412
+ "penetration_frames": 0,
413
+ "min_foot_z_m": 0.038
414
+ },
415
+ "J_ShortDance16_JazzWalk": {
416
+ "penetration_frames": 0,
417
+ "min_foot_z_m": 0.0353
418
+ },
419
+ "B_AttackKarate": {
420
+ "penetration_frames": 0,
421
+ "min_foot_z_m": 0.0371
422
+ },
423
+ "B_BowKarate": {
424
+ "penetration_frames": 0,
425
+ "min_foot_z_m": 0.0355
426
+ },
427
+ "B_ChopsKarate": {
428
+ "penetration_frames": 0,
429
+ "min_foot_z_m": 0.0406
430
+ },
431
+ "B_CrazyChopsKarate": {
432
+ "penetration_frames": 0,
433
+ "min_foot_z_m": 0.0381
434
+ },
435
+ "B_ForwardKarate": {
436
+ "penetration_frames": 0,
437
+ "min_foot_z_m": 0.0415
438
+ },
439
+ "B_LongKarate": {
440
+ "penetration_frames": 0,
441
+ "min_foot_z_m": 0.0346
442
+ },
443
+ "B_SpinKarate": {
444
+ "penetration_frames": 0,
445
+ "min_foot_z_m": 0.0406
446
+ },
447
+ "M_Move1": {
448
+ "penetration_frames": 0,
449
+ "min_foot_z_m": 0.0353
450
+ },
451
+ "M_Move10": {
452
+ "penetration_frames": 0,
453
+ "min_foot_z_m": 0.038
454
+ },
455
+ "M_Move11": {
456
+ "penetration_frames": 0,
457
+ "min_foot_z_m": 0.0381
458
+ },
459
+ "M_Move17": {
460
+ "penetration_frames": 0,
461
+ "min_foot_z_m": 0.0313
462
+ },
463
+ "M_Move18": {
464
+ "penetration_frames": 0,
465
+ "min_foot_z_m": 0.0355
466
+ },
467
+ "M_Move19": {
468
+ "penetration_frames": 0,
469
+ "min_foot_z_m": 0.0355
470
+ },
471
+ "M_Move2": {
472
+ "penetration_frames": 0,
473
+ "min_foot_z_m": 0.0362
474
+ },
475
+ "M_Move20": {
476
+ "penetration_frames": 0,
477
+ "min_foot_z_m": 0.0365
478
+ },
479
+ "M_Move3": {
480
+ "penetration_frames": 0,
481
+ "min_foot_z_m": 0.0365
482
+ },
483
+ "M_Move4": {
484
+ "penetration_frames": 0,
485
+ "min_foot_z_m": 0.0418
486
+ },
487
+ "M_Move5": {
488
+ "penetration_frames": 0,
489
+ "min_foot_z_m": 0.042
490
+ },
491
+ "M_Move6": {
492
+ "penetration_frames": 0,
493
+ "min_foot_z_m": 0.0335
494
+ },
495
+ "M_Move7": {
496
+ "penetration_frames": 0,
497
+ "min_foot_z_m": 0.0375
498
+ },
499
+ "M_Move8": {
500
+ "penetration_frames": 0,
501
+ "min_foot_z_m": 0.0469
502
+ },
503
+ "M_Move9": {
504
+ "penetration_frames": 0,
505
+ "min_foot_z_m": 0.0361
506
+ },
507
+ "M_ShortMove12": {
508
+ "penetration_frames": 0,
509
+ "min_foot_z_m": 0.0336
510
+ },
511
+ "M_ShortMove13": {
512
+ "penetration_frames": 0,
513
+ "min_foot_z_m": 0.0324
514
+ },
515
+ "M_ShortMove14": {
516
+ "penetration_frames": 0,
517
+ "min_foot_z_m": 0.0346
518
+ },
519
+ "M_ShortMove15": {
520
+ "penetration_frames": 0,
521
+ "min_foot_z_m": 0.038
522
+ },
523
+ "M_ShortMove16": {
524
+ "penetration_frames": 0,
525
+ "min_foot_z_m": 0.0365
526
+ },
527
+ "B_Fence1": {
528
+ "penetration_frames": 0,
529
+ "min_foot_z_m": 0.0394
530
+ },
531
+ "B_Fence2": {
532
+ "penetration_frames": 0,
533
+ "min_foot_z_m": 0.0414
534
+ },
535
+ "B_HandsChop": {
536
+ "penetration_frames": 0,
537
+ "min_foot_z_m": 0.0361
538
+ },
539
+ "B_HandsUp": {
540
+ "penetration_frames": 0,
541
+ "min_foot_z_m": 0.05
542
+ }
543
+ }
544
+ },
545
+ "frame_consistency": {
546
+ "description": "PKL frames == BVH frames, NPZ frames == BVH - 1",
547
+ "clips": {
548
+ "B_DadDance": {
549
+ "bvh_frames": 2509,
550
+ "pkl_frames": 2509,
551
+ "npz_frames": 2508,
552
+ "pkl_match": true,
553
+ "npz_match": true
554
+ },
555
+ "B_LongDance": {
556
+ "bvh_frames": 7167,
557
+ "pkl_frames": 7167,
558
+ "npz_frames": 7166,
559
+ "pkl_match": true,
560
+ "npz_match": true
561
+ },
562
+ "B_SpiralDance": {
563
+ "bvh_frames": 2868,
564
+ "pkl_frames": 2868,
565
+ "npz_frames": 2867,
566
+ "pkl_match": true,
567
+ "npz_match": true
568
+ },
569
+ "B_StretchDance": {
570
+ "bvh_frames": 2586,
571
+ "pkl_frames": 2586,
572
+ "npz_frames": 2585,
573
+ "pkl_match": true,
574
+ "npz_match": true
575
+ },
576
+ "B_WiggleDance": {
577
+ "bvh_frames": 2237,
578
+ "pkl_frames": 2237,
579
+ "npz_frames": 2236,
580
+ "pkl_match": true,
581
+ "npz_match": true
582
+ },
583
+ "J_Dance0_StepTouch": {
584
+ "bvh_frames": 1949,
585
+ "pkl_frames": 1949,
586
+ "npz_frames": 1949,
587
+ "pkl_match": true,
588
+ "npz_match": true
589
+ },
590
+ "J_Dance11_Gnarly": {
591
+ "bvh_frames": 2709,
592
+ "pkl_frames": 2709,
593
+ "npz_frames": 2708,
594
+ "pkl_match": true,
595
+ "npz_match": true
596
+ },
597
+ "J_Dance12_LushLife": {
598
+ "bvh_frames": 2136,
599
+ "pkl_frames": 2136,
600
+ "npz_frames": 2135,
601
+ "pkl_match": true,
602
+ "npz_match": true
603
+ },
604
+ "J_Dance17_Shuffle": {
605
+ "bvh_frames": 1922,
606
+ "pkl_frames": 1922,
607
+ "npz_frames": 1921,
608
+ "pkl_match": true,
609
+ "npz_match": true
610
+ },
611
+ "J_Dance18_TikTok": {
612
+ "bvh_frames": 1077,
613
+ "pkl_frames": 1077,
614
+ "npz_frames": 1076,
615
+ "pkl_match": true,
616
+ "npz_match": true
617
+ },
618
+ "J_Dance19_LetsGO": {
619
+ "bvh_frames": 1491,
620
+ "pkl_frames": 1491,
621
+ "npz_frames": 1490,
622
+ "pkl_match": true,
623
+ "npz_match": true
624
+ },
625
+ "J_Dance1_Modern": {
626
+ "bvh_frames": 2265,
627
+ "pkl_frames": 2265,
628
+ "npz_frames": 2264,
629
+ "pkl_match": true,
630
+ "npz_match": true
631
+ },
632
+ "J_Dance20_DWG": {
633
+ "bvh_frames": 938,
634
+ "pkl_frames": 938,
635
+ "npz_frames": 937,
636
+ "pkl_match": true,
637
+ "npz_match": true
638
+ },
639
+ "J_Dance21_Blunt": {
640
+ "bvh_frames": 1725,
641
+ "pkl_frames": 1725,
642
+ "npz_frames": 1724,
643
+ "pkl_match": true,
644
+ "npz_match": true
645
+ },
646
+ "J_Dance22_Thrilling": {
647
+ "bvh_frames": 1619,
648
+ "pkl_frames": 1619,
649
+ "npz_frames": 1618,
650
+ "pkl_match": true,
651
+ "npz_match": true
652
+ },
653
+ "J_Dance23_MidnightSun": {
654
+ "bvh_frames": 2915,
655
+ "pkl_frames": 2915,
656
+ "npz_frames": 2914,
657
+ "pkl_match": true,
658
+ "npz_match": true
659
+ },
660
+ "J_Dance2_Salsa": {
661
+ "bvh_frames": 2151,
662
+ "pkl_frames": 2151,
663
+ "npz_frames": 2150,
664
+ "pkl_match": true,
665
+ "npz_match": true
666
+ },
667
+ "J_Dance3_Woah": {
668
+ "bvh_frames": 1800,
669
+ "pkl_frames": 1800,
670
+ "npz_frames": 1799,
671
+ "pkl_match": true,
672
+ "npz_match": true
673
+ },
674
+ "J_Dance4_Broadway": {
675
+ "bvh_frames": 1677,
676
+ "pkl_frames": 1677,
677
+ "npz_frames": 1676,
678
+ "pkl_match": true,
679
+ "npz_match": true
680
+ },
681
+ "J_Dance5_Hype": {
682
+ "bvh_frames": 1896,
683
+ "pkl_frames": 1896,
684
+ "npz_frames": 1895,
685
+ "pkl_match": true,
686
+ "npz_match": true
687
+ },
688
+ "J_Dance6_Sassy": {
689
+ "bvh_frames": 1914,
690
+ "pkl_frames": 1914,
691
+ "npz_frames": 1913,
692
+ "pkl_match": true,
693
+ "npz_match": true
694
+ },
695
+ "J_Dance7_Party": {
696
+ "bvh_frames": 2773,
697
+ "pkl_frames": 2773,
698
+ "npz_frames": 2772,
699
+ "pkl_match": true,
700
+ "npz_match": true
701
+ },
702
+ "J_Dance8_WestCoast": {
703
+ "bvh_frames": 2395,
704
+ "pkl_frames": 2395,
705
+ "npz_frames": 2394,
706
+ "pkl_match": true,
707
+ "npz_match": true
708
+ },
709
+ "J_Dance9_PeaceMaker": {
710
+ "bvh_frames": 3501,
711
+ "pkl_frames": 3501,
712
+ "npz_frames": 3500,
713
+ "pkl_match": true,
714
+ "npz_match": true
715
+ },
716
+ "J_ShortDance13_SingleLadies": {
717
+ "bvh_frames": 842,
718
+ "pkl_frames": 842,
719
+ "npz_frames": 841,
720
+ "pkl_match": true,
721
+ "npz_match": true
722
+ },
723
+ "J_ShortDance14_Disco": {
724
+ "bvh_frames": 858,
725
+ "pkl_frames": 858,
726
+ "npz_frames": 857,
727
+ "pkl_match": true,
728
+ "npz_match": true
729
+ },
730
+ "J_ShortDance15_Nineties": {
731
+ "bvh_frames": 787,
732
+ "pkl_frames": 787,
733
+ "npz_frames": 786,
734
+ "pkl_match": true,
735
+ "npz_match": true
736
+ },
737
+ "J_ShortDance16_JazzWalk": {
738
+ "bvh_frames": 637,
739
+ "pkl_frames": 637,
740
+ "npz_frames": 636,
741
+ "pkl_match": true,
742
+ "npz_match": true
743
+ },
744
+ "B_AttackKarate": {
745
+ "bvh_frames": 2831,
746
+ "pkl_frames": 2831,
747
+ "npz_frames": 2830,
748
+ "pkl_match": true,
749
+ "npz_match": true
750
+ },
751
+ "B_BowKarate": {
752
+ "bvh_frames": 2254,
753
+ "pkl_frames": 2254,
754
+ "npz_frames": 2253,
755
+ "pkl_match": true,
756
+ "npz_match": true
757
+ },
758
+ "B_ChopsKarate": {
759
+ "bvh_frames": 3160,
760
+ "pkl_frames": 3160,
761
+ "npz_frames": 3159,
762
+ "pkl_match": true,
763
+ "npz_match": true
764
+ },
765
+ "B_CrazyChopsKarate": {
766
+ "bvh_frames": 1452,
767
+ "pkl_frames": 1452,
768
+ "npz_frames": 1451,
769
+ "pkl_match": true,
770
+ "npz_match": true
771
+ },
772
+ "B_ForwardKarate": {
773
+ "bvh_frames": 2180,
774
+ "pkl_frames": 2180,
775
+ "npz_frames": 2179,
776
+ "pkl_match": true,
777
+ "npz_match": true
778
+ },
779
+ "B_LongKarate": {
780
+ "bvh_frames": 2881,
781
+ "pkl_frames": 2881,
782
+ "npz_frames": 2880,
783
+ "pkl_match": true,
784
+ "npz_match": true
785
+ },
786
+ "B_SpinKarate": {
787
+ "bvh_frames": 1540,
788
+ "pkl_frames": 1540,
789
+ "npz_frames": 1539,
790
+ "pkl_match": true,
791
+ "npz_match": true
792
+ },
793
+ "M_Move1": {
794
+ "bvh_frames": 1870,
795
+ "pkl_frames": 1870,
796
+ "npz_frames": 1869,
797
+ "pkl_match": true,
798
+ "npz_match": true
799
+ },
800
+ "M_Move10": {
801
+ "bvh_frames": 1832,
802
+ "pkl_frames": 1832,
803
+ "npz_frames": 1831,
804
+ "pkl_match": true,
805
+ "npz_match": true
806
+ },
807
+ "M_Move11": {
808
+ "bvh_frames": 996,
809
+ "pkl_frames": 996,
810
+ "npz_frames": 995,
811
+ "pkl_match": true,
812
+ "npz_match": true
813
+ },
814
+ "M_Move17": {
815
+ "bvh_frames": 1598,
816
+ "pkl_frames": 1598,
817
+ "npz_frames": 1597,
818
+ "pkl_match": true,
819
+ "npz_match": true
820
+ },
821
+ "M_Move18": {
822
+ "bvh_frames": 1003,
823
+ "pkl_frames": 1003,
824
+ "npz_frames": 1002,
825
+ "pkl_match": true,
826
+ "npz_match": true
827
+ },
828
+ "M_Move19": {
829
+ "bvh_frames": 1012,
830
+ "pkl_frames": 1012,
831
+ "npz_frames": 1012,
832
+ "pkl_match": true,
833
+ "npz_match": true
834
+ },
835
+ "M_Move2": {
836
+ "bvh_frames": 2187,
837
+ "pkl_frames": 2187,
838
+ "npz_frames": 2186,
839
+ "pkl_match": true,
840
+ "npz_match": true
841
+ },
842
+ "M_Move20": {
843
+ "bvh_frames": 1414,
844
+ "pkl_frames": 1414,
845
+ "npz_frames": 1413,
846
+ "pkl_match": true,
847
+ "npz_match": true
848
+ },
849
+ "M_Move3": {
850
+ "bvh_frames": 1918,
851
+ "pkl_frames": 1918,
852
+ "npz_frames": 1917,
853
+ "pkl_match": true,
854
+ "npz_match": true
855
+ },
856
+ "M_Move4": {
857
+ "bvh_frames": 1755,
858
+ "pkl_frames": 1755,
859
+ "npz_frames": 1754,
860
+ "pkl_match": true,
861
+ "npz_match": true
862
+ },
863
+ "M_Move5": {
864
+ "bvh_frames": 2159,
865
+ "pkl_frames": 2159,
866
+ "npz_frames": 2158,
867
+ "pkl_match": true,
868
+ "npz_match": true
869
+ },
870
+ "M_Move6": {
871
+ "bvh_frames": 2137,
872
+ "pkl_frames": 2137,
873
+ "npz_frames": 2136,
874
+ "pkl_match": true,
875
+ "npz_match": true
876
+ },
877
+ "M_Move7": {
878
+ "bvh_frames": 1429,
879
+ "pkl_frames": 1429,
880
+ "npz_frames": 1428,
881
+ "pkl_match": true,
882
+ "npz_match": true
883
+ },
884
+ "M_Move8": {
885
+ "bvh_frames": 843,
886
+ "pkl_frames": 843,
887
+ "npz_frames": 842,
888
+ "pkl_match": true,
889
+ "npz_match": true
890
+ },
891
+ "M_Move9": {
892
+ "bvh_frames": 1638,
893
+ "pkl_frames": 1638,
894
+ "npz_frames": 1637,
895
+ "pkl_match": true,
896
+ "npz_match": true
897
+ },
898
+ "M_ShortMove12": {
899
+ "bvh_frames": 467,
900
+ "pkl_frames": 467,
901
+ "npz_frames": 466,
902
+ "pkl_match": true,
903
+ "npz_match": true
904
+ },
905
+ "M_ShortMove13": {
906
+ "bvh_frames": 539,
907
+ "pkl_frames": 539,
908
+ "npz_frames": 538,
909
+ "pkl_match": true,
910
+ "npz_match": true
911
+ },
912
+ "M_ShortMove14": {
913
+ "bvh_frames": 393,
914
+ "pkl_frames": 393,
915
+ "npz_frames": 392,
916
+ "pkl_match": true,
917
+ "npz_match": true
918
+ },
919
+ "M_ShortMove15": {
920
+ "bvh_frames": 408,
921
+ "pkl_frames": 408,
922
+ "npz_frames": 407,
923
+ "pkl_match": true,
924
+ "npz_match": true
925
+ },
926
+ "M_ShortMove16": {
927
+ "bvh_frames": 443,
928
+ "pkl_frames": 443,
929
+ "npz_frames": 442,
930
+ "pkl_match": true,
931
+ "npz_match": true
932
+ },
933
+ "B_Fence1": {
934
+ "bvh_frames": 1620,
935
+ "pkl_frames": 1620,
936
+ "npz_frames": 1619,
937
+ "pkl_match": true,
938
+ "npz_match": true
939
+ },
940
+ "B_Fence2": {
941
+ "bvh_frames": 638,
942
+ "pkl_frames": 638,
943
+ "npz_frames": 637,
944
+ "pkl_match": true,
945
+ "npz_match": true
946
+ },
947
+ "B_HandsChop": {
948
+ "bvh_frames": 1766,
949
+ "pkl_frames": 1766,
950
+ "npz_frames": 1765,
951
+ "pkl_match": true,
952
+ "npz_match": true
953
+ },
954
+ "B_HandsUp": {
955
+ "bvh_frames": 442,
956
+ "pkl_frames": 442,
957
+ "npz_frames": 441,
958
+ "pkl_match": true,
959
+ "npz_match": true
960
+ }
961
+ }
962
+ },
963
+ "nan_check": {
964
+ "description": "NaN values in PKL or NPZ arrays",
965
+ "clips": {
966
+ "B_DadDance": {
967
+ "has_nan": false,
968
+ "fields": []
969
+ },
970
+ "B_LongDance": {
971
+ "has_nan": false,
972
+ "fields": []
973
+ },
974
+ "B_SpiralDance": {
975
+ "has_nan": false,
976
+ "fields": []
977
+ },
978
+ "B_StretchDance": {
979
+ "has_nan": false,
980
+ "fields": []
981
+ },
982
+ "B_WiggleDance": {
983
+ "has_nan": false,
984
+ "fields": []
985
+ },
986
+ "J_Dance0_StepTouch": {
987
+ "has_nan": false,
988
+ "fields": []
989
+ },
990
+ "J_Dance11_Gnarly": {
991
+ "has_nan": false,
992
+ "fields": []
993
+ },
994
+ "J_Dance12_LushLife": {
995
+ "has_nan": false,
996
+ "fields": []
997
+ },
998
+ "J_Dance17_Shuffle": {
999
+ "has_nan": false,
1000
+ "fields": []
1001
+ },
1002
+ "J_Dance18_TikTok": {
1003
+ "has_nan": false,
1004
+ "fields": []
1005
+ },
1006
+ "J_Dance19_LetsGO": {
1007
+ "has_nan": false,
1008
+ "fields": []
1009
+ },
1010
+ "J_Dance1_Modern": {
1011
+ "has_nan": false,
1012
+ "fields": []
1013
+ },
1014
+ "J_Dance20_DWG": {
1015
+ "has_nan": false,
1016
+ "fields": []
1017
+ },
1018
+ "J_Dance21_Blunt": {
1019
+ "has_nan": false,
1020
+ "fields": []
1021
+ },
1022
+ "J_Dance22_Thrilling": {
1023
+ "has_nan": false,
1024
+ "fields": []
1025
+ },
1026
+ "J_Dance23_MidnightSun": {
1027
+ "has_nan": false,
1028
+ "fields": []
1029
+ },
1030
+ "J_Dance2_Salsa": {
1031
+ "has_nan": false,
1032
+ "fields": []
1033
+ },
1034
+ "J_Dance3_Woah": {
1035
+ "has_nan": false,
1036
+ "fields": []
1037
+ },
1038
+ "J_Dance4_Broadway": {
1039
+ "has_nan": false,
1040
+ "fields": []
1041
+ },
1042
+ "J_Dance5_Hype": {
1043
+ "has_nan": false,
1044
+ "fields": []
1045
+ },
1046
+ "J_Dance6_Sassy": {
1047
+ "has_nan": false,
1048
+ "fields": []
1049
+ },
1050
+ "J_Dance7_Party": {
1051
+ "has_nan": false,
1052
+ "fields": []
1053
+ },
1054
+ "J_Dance8_WestCoast": {
1055
+ "has_nan": false,
1056
+ "fields": []
1057
+ },
1058
+ "J_Dance9_PeaceMaker": {
1059
+ "has_nan": false,
1060
+ "fields": []
1061
+ },
1062
+ "J_ShortDance13_SingleLadies": {
1063
+ "has_nan": false,
1064
+ "fields": []
1065
+ },
1066
+ "J_ShortDance14_Disco": {
1067
+ "has_nan": false,
1068
+ "fields": []
1069
+ },
1070
+ "J_ShortDance15_Nineties": {
1071
+ "has_nan": false,
1072
+ "fields": []
1073
+ },
1074
+ "J_ShortDance16_JazzWalk": {
1075
+ "has_nan": false,
1076
+ "fields": []
1077
+ },
1078
+ "B_AttackKarate": {
1079
+ "has_nan": false,
1080
+ "fields": []
1081
+ },
1082
+ "B_BowKarate": {
1083
+ "has_nan": false,
1084
+ "fields": []
1085
+ },
1086
+ "B_ChopsKarate": {
1087
+ "has_nan": false,
1088
+ "fields": []
1089
+ },
1090
+ "B_CrazyChopsKarate": {
1091
+ "has_nan": false,
1092
+ "fields": []
1093
+ },
1094
+ "B_ForwardKarate": {
1095
+ "has_nan": false,
1096
+ "fields": []
1097
+ },
1098
+ "B_LongKarate": {
1099
+ "has_nan": false,
1100
+ "fields": []
1101
+ },
1102
+ "B_SpinKarate": {
1103
+ "has_nan": false,
1104
+ "fields": []
1105
+ },
1106
+ "M_Move1": {
1107
+ "has_nan": false,
1108
+ "fields": []
1109
+ },
1110
+ "M_Move10": {
1111
+ "has_nan": false,
1112
+ "fields": []
1113
+ },
1114
+ "M_Move11": {
1115
+ "has_nan": false,
1116
+ "fields": []
1117
+ },
1118
+ "M_Move17": {
1119
+ "has_nan": false,
1120
+ "fields": []
1121
+ },
1122
+ "M_Move18": {
1123
+ "has_nan": false,
1124
+ "fields": []
1125
+ },
1126
+ "M_Move19": {
1127
+ "has_nan": false,
1128
+ "fields": []
1129
+ },
1130
+ "M_Move2": {
1131
+ "has_nan": false,
1132
+ "fields": []
1133
+ },
1134
+ "M_Move20": {
1135
+ "has_nan": false,
1136
+ "fields": []
1137
+ },
1138
+ "M_Move3": {
1139
+ "has_nan": false,
1140
+ "fields": []
1141
+ },
1142
+ "M_Move4": {
1143
+ "has_nan": false,
1144
+ "fields": []
1145
+ },
1146
+ "M_Move5": {
1147
+ "has_nan": false,
1148
+ "fields": []
1149
+ },
1150
+ "M_Move6": {
1151
+ "has_nan": false,
1152
+ "fields": []
1153
+ },
1154
+ "M_Move7": {
1155
+ "has_nan": false,
1156
+ "fields": []
1157
+ },
1158
+ "M_Move8": {
1159
+ "has_nan": false,
1160
+ "fields": []
1161
+ },
1162
+ "M_Move9": {
1163
+ "has_nan": false,
1164
+ "fields": []
1165
+ },
1166
+ "M_ShortMove12": {
1167
+ "has_nan": false,
1168
+ "fields": []
1169
+ },
1170
+ "M_ShortMove13": {
1171
+ "has_nan": false,
1172
+ "fields": []
1173
+ },
1174
+ "M_ShortMove14": {
1175
+ "has_nan": false,
1176
+ "fields": []
1177
+ },
1178
+ "M_ShortMove15": {
1179
+ "has_nan": false,
1180
+ "fields": []
1181
+ },
1182
+ "M_ShortMove16": {
1183
+ "has_nan": false,
1184
+ "fields": []
1185
+ },
1186
+ "B_Fence1": {
1187
+ "has_nan": false,
1188
+ "fields": []
1189
+ },
1190
+ "B_Fence2": {
1191
+ "has_nan": false,
1192
+ "fields": []
1193
+ },
1194
+ "B_HandsChop": {
1195
+ "has_nan": false,
1196
+ "fields": []
1197
+ },
1198
+ "B_HandsUp": {
1199
+ "has_nan": false,
1200
+ "fields": []
1201
+ }
1202
+ }
1203
+ },
1204
+ "file_completeness": {
1205
+ "description": "All expected files present",
1206
+ "clips": {
1207
+ "B_DadDance": {
1208
+ "complete": true,
1209
+ "missing": []
1210
+ },
1211
+ "B_LongDance": {
1212
+ "complete": true,
1213
+ "missing": []
1214
+ },
1215
+ "B_SpiralDance": {
1216
+ "complete": true,
1217
+ "missing": []
1218
+ },
1219
+ "B_StretchDance": {
1220
+ "complete": true,
1221
+ "missing": []
1222
+ },
1223
+ "B_WiggleDance": {
1224
+ "complete": true,
1225
+ "missing": []
1226
+ },
1227
+ "J_Dance0_StepTouch": {
1228
+ "complete": true,
1229
+ "missing": []
1230
+ },
1231
+ "J_Dance11_Gnarly": {
1232
+ "complete": true,
1233
+ "missing": []
1234
+ },
1235
+ "J_Dance12_LushLife": {
1236
+ "complete": true,
1237
+ "missing": []
1238
+ },
1239
+ "J_Dance17_Shuffle": {
1240
+ "complete": true,
1241
+ "missing": []
1242
+ },
1243
+ "J_Dance18_TikTok": {
1244
+ "complete": true,
1245
+ "missing": []
1246
+ },
1247
+ "J_Dance19_LetsGO": {
1248
+ "complete": true,
1249
+ "missing": []
1250
+ },
1251
+ "J_Dance1_Modern": {
1252
+ "complete": true,
1253
+ "missing": []
1254
+ },
1255
+ "J_Dance20_DWG": {
1256
+ "complete": true,
1257
+ "missing": []
1258
+ },
1259
+ "J_Dance21_Blunt": {
1260
+ "complete": true,
1261
+ "missing": []
1262
+ },
1263
+ "J_Dance22_Thrilling": {
1264
+ "complete": true,
1265
+ "missing": []
1266
+ },
1267
+ "J_Dance23_MidnightSun": {
1268
+ "complete": true,
1269
+ "missing": []
1270
+ },
1271
+ "J_Dance2_Salsa": {
1272
+ "complete": true,
1273
+ "missing": []
1274
+ },
1275
+ "J_Dance3_Woah": {
1276
+ "complete": true,
1277
+ "missing": []
1278
+ },
1279
+ "J_Dance4_Broadway": {
1280
+ "complete": true,
1281
+ "missing": []
1282
+ },
1283
+ "J_Dance5_Hype": {
1284
+ "complete": true,
1285
+ "missing": []
1286
+ },
1287
+ "J_Dance6_Sassy": {
1288
+ "complete": true,
1289
+ "missing": []
1290
+ },
1291
+ "J_Dance7_Party": {
1292
+ "complete": true,
1293
+ "missing": []
1294
+ },
1295
+ "J_Dance8_WestCoast": {
1296
+ "complete": true,
1297
+ "missing": []
1298
+ },
1299
+ "J_Dance9_PeaceMaker": {
1300
+ "complete": true,
1301
+ "missing": []
1302
+ },
1303
+ "J_ShortDance13_SingleLadies": {
1304
+ "complete": true,
1305
+ "missing": []
1306
+ },
1307
+ "J_ShortDance14_Disco": {
1308
+ "complete": true,
1309
+ "missing": []
1310
+ },
1311
+ "J_ShortDance15_Nineties": {
1312
+ "complete": true,
1313
+ "missing": []
1314
+ },
1315
+ "J_ShortDance16_JazzWalk": {
1316
+ "complete": true,
1317
+ "missing": []
1318
+ },
1319
+ "B_AttackKarate": {
1320
+ "complete": true,
1321
+ "missing": []
1322
+ },
1323
+ "B_BowKarate": {
1324
+ "complete": true,
1325
+ "missing": []
1326
+ },
1327
+ "B_ChopsKarate": {
1328
+ "complete": true,
1329
+ "missing": []
1330
+ },
1331
+ "B_CrazyChopsKarate": {
1332
+ "complete": true,
1333
+ "missing": []
1334
+ },
1335
+ "B_ForwardKarate": {
1336
+ "complete": true,
1337
+ "missing": []
1338
+ },
1339
+ "B_LongKarate": {
1340
+ "complete": true,
1341
+ "missing": []
1342
+ },
1343
+ "B_SpinKarate": {
1344
+ "complete": true,
1345
+ "missing": []
1346
+ },
1347
+ "M_Move1": {
1348
+ "complete": true,
1349
+ "missing": []
1350
+ },
1351
+ "M_Move10": {
1352
+ "complete": true,
1353
+ "missing": []
1354
+ },
1355
+ "M_Move11": {
1356
+ "complete": true,
1357
+ "missing": []
1358
+ },
1359
+ "M_Move17": {
1360
+ "complete": true,
1361
+ "missing": []
1362
+ },
1363
+ "M_Move18": {
1364
+ "complete": true,
1365
+ "missing": []
1366
+ },
1367
+ "M_Move19": {
1368
+ "complete": true,
1369
+ "missing": []
1370
+ },
1371
+ "M_Move2": {
1372
+ "complete": true,
1373
+ "missing": []
1374
+ },
1375
+ "M_Move20": {
1376
+ "complete": true,
1377
+ "missing": []
1378
+ },
1379
+ "M_Move3": {
1380
+ "complete": true,
1381
+ "missing": []
1382
+ },
1383
+ "M_Move4": {
1384
+ "complete": true,
1385
+ "missing": []
1386
+ },
1387
+ "M_Move5": {
1388
+ "complete": true,
1389
+ "missing": []
1390
+ },
1391
+ "M_Move6": {
1392
+ "complete": true,
1393
+ "missing": []
1394
+ },
1395
+ "M_Move7": {
1396
+ "complete": true,
1397
+ "missing": []
1398
+ },
1399
+ "M_Move8": {
1400
+ "complete": true,
1401
+ "missing": []
1402
+ },
1403
+ "M_Move9": {
1404
+ "complete": true,
1405
+ "missing": []
1406
+ },
1407
+ "M_ShortMove12": {
1408
+ "complete": true,
1409
+ "missing": []
1410
+ },
1411
+ "M_ShortMove13": {
1412
+ "complete": true,
1413
+ "missing": []
1414
+ },
1415
+ "M_ShortMove14": {
1416
+ "complete": true,
1417
+ "missing": []
1418
+ },
1419
+ "M_ShortMove15": {
1420
+ "complete": true,
1421
+ "missing": []
1422
+ },
1423
+ "M_ShortMove16": {
1424
+ "complete": true,
1425
+ "missing": []
1426
+ },
1427
+ "B_Fence1": {
1428
+ "complete": true,
1429
+ "missing": []
1430
+ },
1431
+ "B_Fence2": {
1432
+ "complete": true,
1433
+ "missing": []
1434
+ },
1435
+ "B_HandsChop": {
1436
+ "complete": true,
1437
+ "missing": []
1438
+ },
1439
+ "B_HandsUp": {
1440
+ "complete": true,
1441
+ "missing": []
1442
+ }
1443
+ }
1444
+ }
1445
+ },
1446
+ "summary": {
1447
+ "passed": [
1448
+ "B_SpiralDance",
1449
+ "B_StretchDance",
1450
+ "B_WiggleDance",
1451
+ "J_Dance12_LushLife",
1452
+ "J_Dance19_LetsGO",
1453
+ "J_Dance20_DWG",
1454
+ "J_Dance6_Sassy",
1455
+ "J_ShortDance13_SingleLadies",
1456
+ "B_HandsChop",
1457
+ "B_HandsUp"
1458
+ ],
1459
+ "warnings": [
1460
+ "B_DadDance",
1461
+ "B_LongDance",
1462
+ "J_Dance0_StepTouch",
1463
+ "J_Dance11_Gnarly",
1464
+ "J_Dance17_Shuffle",
1465
+ "J_Dance18_TikTok",
1466
+ "J_Dance1_Modern",
1467
+ "J_Dance21_Blunt",
1468
+ "J_Dance22_Thrilling",
1469
+ "J_Dance23_MidnightSun",
1470
+ "J_Dance2_Salsa",
1471
+ "J_Dance3_Woah",
1472
+ "J_Dance4_Broadway",
1473
+ "J_Dance5_Hype",
1474
+ "J_Dance7_Party",
1475
+ "J_Dance8_WestCoast",
1476
+ "J_Dance9_PeaceMaker",
1477
+ "J_ShortDance14_Disco",
1478
+ "J_ShortDance15_Nineties",
1479
+ "J_ShortDance16_JazzWalk",
1480
+ "B_AttackKarate",
1481
+ "B_BowKarate",
1482
+ "B_ChopsKarate",
1483
+ "B_CrazyChopsKarate",
1484
+ "B_ForwardKarate",
1485
+ "B_LongKarate",
1486
+ "B_SpinKarate",
1487
+ "M_Move1",
1488
+ "M_Move10",
1489
+ "M_Move11",
1490
+ "M_Move17",
1491
+ "M_Move18",
1492
+ "M_Move19",
1493
+ "M_Move2",
1494
+ "M_Move20",
1495
+ "M_Move3",
1496
+ "M_Move4",
1497
+ "M_Move5",
1498
+ "M_Move6",
1499
+ "M_Move7",
1500
+ "M_Move8",
1501
+ "M_Move9",
1502
+ "M_ShortMove12",
1503
+ "M_ShortMove13",
1504
+ "M_ShortMove14",
1505
+ "M_ShortMove15",
1506
+ "M_ShortMove16",
1507
+ "B_Fence1",
1508
+ "B_Fence2"
1509
+ ],
1510
+ "errors": []
1511
+ }
1512
+ }
render_all.sh ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Render all BVH files to MP4, running N jobs in parallel
3
+ cd "$(dirname "$0")"
4
+
5
+ JOBS=4
6
+ count=0
7
+ total=$(find . -name "*.bvh" -type f | wc -l)
8
+ current=0
9
+
10
+ for bvh in $(find . -name "*.bvh" -type f | sort); do
11
+ mp4="${bvh%.bvh}.mp4"
12
+ current=$((current + 1))
13
+
14
+ # Skip if already rendered
15
+ if [ -f "$mp4" ]; then
16
+ echo "[$current/$total] SKIP $bvh (already exists)"
17
+ continue
18
+ fi
19
+
20
+ echo "[$current/$total] Rendering $bvh..."
21
+ python3 render_bvh.py "$bvh" "$mp4" &
22
+
23
+ count=$((count + 1))
24
+ if [ $count -ge $JOBS ]; then
25
+ wait
26
+ count=0
27
+ fi
28
+ done
29
+
30
+ wait
31
+ echo "All done!"
render_bvh.py ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Fast BVH to MP4 renderer using PIL + ffmpeg pipe."""
2
+ import sys
3
+ import subprocess
4
+ import numpy as np
5
+ from PIL import Image, ImageDraw
6
+
7
+ WIDTH, HEIGHT = 640, 640
8
+ BG_COLOR = (0, 0, 0)
9
+ BONE_COLOR = (0, 255, 170)
10
+ JOINT_COLOR = (0, 255, 170)
11
+ JOINT_RADIUS = 3
12
+ BONE_WIDTH = 3
13
+
14
+
15
+ def parse_bvh(filepath):
16
+ with open(filepath) as f:
17
+ lines = f.readlines()
18
+
19
+ joints = []
20
+ parent_stack = []
21
+ joint_offsets = {}
22
+ joint_channels = {}
23
+ joint_parents = {}
24
+ channel_order = []
25
+ i = 0
26
+
27
+ while i < len(lines):
28
+ line = lines[i].strip()
29
+ if line.startswith('ROOT') or line.startswith('JOINT'):
30
+ name = line.split()[-1]
31
+ joints.append(name)
32
+ joint_parents[name] = parent_stack[-1] if parent_stack else None
33
+ elif line.startswith('End Site'):
34
+ name = parent_stack[-1] + '_End'
35
+ joints.append(name)
36
+ joint_parents[name] = parent_stack[-1]
37
+ elif line.startswith('OFFSET'):
38
+ vals = list(map(float, line.split()[1:]))
39
+ joint_offsets[joints[-1]] = np.array(vals)
40
+ elif line.startswith('CHANNELS'):
41
+ parts = line.split()
42
+ n_ch = int(parts[1])
43
+ ch_names = parts[2:2+n_ch]
44
+ joint_channels[joints[-1]] = ch_names
45
+ for ch in ch_names:
46
+ channel_order.append((joints[-1], ch))
47
+ elif line == '{':
48
+ if joints:
49
+ parent_stack.append(joints[-1])
50
+ elif line == '}':
51
+ if parent_stack:
52
+ parent_stack.pop()
53
+ elif line.startswith('MOTION'):
54
+ i += 1
55
+ break
56
+ i += 1
57
+
58
+ n_frames = int(lines[i].split(':')[1])
59
+ i += 1
60
+ frame_time = float(lines[i].split(':')[1])
61
+ i += 1
62
+
63
+ frames = []
64
+ while i < len(lines):
65
+ line = lines[i].strip()
66
+ if line:
67
+ frames.append(list(map(float, line.split())))
68
+ i += 1
69
+
70
+ return joints, joint_offsets, joint_channels, joint_parents, channel_order, np.array(frames), n_frames, frame_time
71
+
72
+
73
+ # Precompute rotation matrices for common angles
74
+ def rot_x(a):
75
+ c, s = np.cos(a), np.sin(a)
76
+ return np.array([[1,0,0],[0,c,-s],[0,s,c]])
77
+
78
+ def rot_y(a):
79
+ c, s = np.cos(a), np.sin(a)
80
+ return np.array([[c,0,s],[0,1,0],[-s,0,c]])
81
+
82
+ def rot_z(a):
83
+ c, s = np.cos(a), np.sin(a)
84
+ return np.array([[c,-s,0],[s,c,0],[0,0,1]])
85
+
86
+ ROT_FN = {'X': rot_x, 'Y': rot_y, 'Z': rot_z}
87
+
88
+
89
+ def compute_all_positions(frames, joints, offsets, channels, parents, ch_order):
90
+ """Vectorized position computation for all frames."""
91
+ n_frames = len(frames)
92
+ n_joints = len(joints)
93
+ joint_idx = {j: i for i, j in enumerate(joints)}
94
+
95
+ # Build channel mapping
96
+ ch_map = {}
97
+ ci = 0
98
+ for joint, ch_name in ch_order:
99
+ if joint not in ch_map:
100
+ ch_map[joint] = {}
101
+ ch_map[joint][ch_name] = ci
102
+ ci += 1
103
+
104
+ all_positions = np.zeros((n_frames, n_joints, 3))
105
+
106
+ for fi in range(n_frames):
107
+ fd = frames[fi]
108
+ positions = {}
109
+ rotations = {}
110
+
111
+ for joint in joints:
112
+ parent = parents[joint]
113
+ offset = offsets.get(joint, np.zeros(3))
114
+
115
+ if parent is None:
116
+ cm = ch_map.get(joint, {})
117
+ tx = fd[cm['Xposition']] if 'Xposition' in cm else 0
118
+ ty = fd[cm['Yposition']] if 'Yposition' in cm else 0
119
+ tz = fd[cm['Zposition']] if 'Zposition' in cm else 0
120
+ p_pos = np.array([tx, ty, tz])
121
+ p_rot = np.eye(3)
122
+ else:
123
+ p_pos = positions[parent]
124
+ p_rot = rotations[parent]
125
+
126
+ pos = p_pos + p_rot @ offset
127
+
128
+ local_rot = np.eye(3)
129
+ if joint in channels and joint in ch_map:
130
+ for ch in channels[joint]:
131
+ if 'rotation' in ch.lower():
132
+ axis = ch[0]
133
+ val = np.radians(fd[ch_map[joint][ch]])
134
+ local_rot = local_rot @ ROT_FN[axis](val)
135
+
136
+ rotations[joint] = p_rot @ local_rot
137
+ positions[joint] = pos
138
+ all_positions[fi, joint_idx[joint]] = pos
139
+
140
+ return all_positions
141
+
142
+
143
+ def project(pos_3d, center, scale):
144
+ """Simple orthographic projection: X right, Y up, looking from front-ish."""
145
+ # Rotate slightly for a 3/4 view
146
+ angle = np.radians(30)
147
+ c, s = np.cos(angle), np.sin(angle)
148
+ x = pos_3d[:, 0] * c + pos_3d[:, 2] * s
149
+ y = pos_3d[:, 1]
150
+ # Map to screen
151
+ sx = (x - center[0]) * scale + WIDTH / 2
152
+ sy = HEIGHT / 2 - (y - center[1]) * scale
153
+ return np.column_stack([sx, sy])
154
+
155
+
156
+ def main():
157
+ bvh_path = sys.argv[1] if len(sys.argv) > 1 else 'dance/J_Dance3_Woah/J_Dance3_Woah.bvh'
158
+ out_path = sys.argv[2] if len(sys.argv) > 2 else bvh_path.rsplit('.', 1)[0] + '.mp4'
159
+
160
+ print(f"Parsing {bvh_path}...")
161
+ joints, offsets, channels, parents, ch_order, frames, n_frames, frame_time = parse_bvh(bvh_path)
162
+
163
+ # Filter joints
164
+ finger_keywords = ['Index', 'Middle', 'Ring', 'Pinky', 'Thumb']
165
+ major_mask = [i for i, j in enumerate(joints) if '_End' not in j and not any(k in j for k in finger_keywords)]
166
+ major_joints = [joints[i] for i in major_mask]
167
+ major_set = set(major_mask)
168
+
169
+ bones = []
170
+ joint_idx = {j: i for i, j in enumerate(joints)}
171
+ for j in major_joints:
172
+ p = parents[j]
173
+ if p is not None and joint_idx[p] in major_set:
174
+ bones.append((joint_idx[p], joint_idx[j]))
175
+
176
+ # Subsample for speed
177
+ step = 2
178
+ sampled = frames[::step]
179
+ fps = 1.0 / (frame_time * step)
180
+
181
+ print(f"Computing positions for {len(sampled)} frames...")
182
+ all_pos = compute_all_positions(sampled, joints, offsets, channels, parents, ch_order)
183
+
184
+ # Compute projection params from all major joint positions
185
+ major_pos = all_pos[:, major_mask, :]
186
+ flat = major_pos.reshape(-1, 3)
187
+
188
+ angle = np.radians(30)
189
+ c, s = np.cos(angle), np.sin(angle)
190
+ proj_x = flat[:, 0] * c + flat[:, 2] * s
191
+ proj_y = flat[:, 1]
192
+
193
+ cx = (proj_x.min() + proj_x.max()) / 2
194
+ cy = (proj_y.min() + proj_y.max()) / 2
195
+ rx = (proj_x.max() - proj_x.min()) / 2
196
+ ry = (proj_y.max() - proj_y.min()) / 2
197
+ max_r = max(rx, ry) * 1.3
198
+ scale = (min(WIDTH, HEIGHT) / 2) / max_r if max_r > 0 else 1
199
+ center = np.array([cx, cy])
200
+
201
+ print(f"Rendering to {out_path} at {fps:.0f} fps...")
202
+ proc = subprocess.Popen([
203
+ 'ffmpeg', '-y',
204
+ '-f', 'rawvideo', '-pix_fmt', 'rgb24',
205
+ '-s', f'{WIDTH}x{HEIGHT}',
206
+ '-r', str(int(round(fps))),
207
+ '-i', '-',
208
+ '-c:v', 'libx264', '-preset', 'fast', '-crf', '23',
209
+ '-pix_fmt', 'yuv420p',
210
+ out_path
211
+ ], stdin=subprocess.PIPE, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
212
+
213
+ for fi in range(len(sampled)):
214
+ pts = project(all_pos[fi], center, scale)
215
+
216
+ img = Image.new('RGB', (WIDTH, HEIGHT), BG_COLOR)
217
+ draw = ImageDraw.Draw(img)
218
+
219
+ for pi, ci in bones:
220
+ x1, y1 = pts[pi]
221
+ x2, y2 = pts[ci]
222
+ draw.line([(x1, y1), (x2, y2)], fill=BONE_COLOR, width=BONE_WIDTH)
223
+
224
+ for idx in major_mask:
225
+ x, y = pts[idx]
226
+ draw.ellipse([x-JOINT_RADIUS, y-JOINT_RADIUS, x+JOINT_RADIUS, y+JOINT_RADIUS],
227
+ fill=JOINT_COLOR)
228
+
229
+ proc.stdin.write(np.array(img).tobytes())
230
+
231
+ proc.stdin.close()
232
+ proc.wait()
233
+ print(f"Done: {out_path}")
234
+
235
+
236
+ if __name__ == '__main__':
237
+ main()
retarget_all.py ADDED
@@ -0,0 +1,364 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Batch retarget all BVH clips to G1 robot PKL + render MP4/GIF previews.
3
+
4
+ Usage:
5
+ python retarget_all.py # process all clips, skip completed
6
+ python retarget_all.py --force # reprocess everything
7
+ python retarget_all.py --workers 8 # custom parallelism
8
+ """
9
+ import argparse
10
+ import os
11
+ import pickle
12
+ import subprocess
13
+ import sys
14
+ import time
15
+ from multiprocessing import Pool
16
+ from pathlib import Path
17
+
18
+ import mujoco
19
+ import numpy as np
20
+ from movin_sdk_python import Retargeter, load_bvh_file
21
+
22
+ REPO_DIR = Path(__file__).resolve().parent
23
+ MUJOCO_XML = Path("/home/mitch/Repositories/g1-urdf/g1_mode15_square.xml")
24
+ CATEGORIES = ["dance", "karate", "bonus"]
25
+ HUMAN_HEIGHT = 1.75
26
+
27
+ # Rendering config
28
+ RENDER_W, RENDER_H = 1080, 1080
29
+ CAM_AZIMUTH = 90
30
+ CAM_ELEVATION = -10
31
+ CAM_DISTANCE = 2.8
32
+ CAM_LOOKAT = [0, 0, 0.65]
33
+ FFMPEG_CRF = 18
34
+
35
+ # GIF config
36
+ GIF_WIDTH = 360
37
+ GIF_FPS = 15
38
+
39
+
40
+ def discover_bvh_clips():
41
+ """Find all BVH files under category/clip/capture/ directories."""
42
+ clips = []
43
+ for cat in CATEGORIES:
44
+ cat_dir = REPO_DIR / cat
45
+ if not cat_dir.is_dir():
46
+ continue
47
+ for clip_dir in sorted(cat_dir.iterdir()):
48
+ if not clip_dir.is_dir():
49
+ continue
50
+ capture_dir = clip_dir / "capture"
51
+ if capture_dir.is_dir():
52
+ bvh_files = list(capture_dir.glob("*.bvh"))
53
+ else:
54
+ bvh_files = list(clip_dir.glob("*.bvh"))
55
+ if bvh_files:
56
+ clips.append(bvh_files[0])
57
+ return clips
58
+
59
+
60
+ MIN_MP4_SIZE = 10_000 # bytes — valid MP4s are at least 10KB
61
+
62
+
63
+ def is_valid_file(path, min_size=1):
64
+ """Check file exists and is at least min_size bytes."""
65
+ return path.exists() and path.stat().st_size >= min_size
66
+
67
+
68
+ def clip_root(bvh_path):
69
+ """Get the clip root directory from a BVH path.
70
+
71
+ Handles both capture/ subdirectory and flat layout.
72
+ """
73
+ if bvh_path.parent.name == "capture":
74
+ return bvh_path.parent.parent
75
+ return bvh_path.parent
76
+
77
+
78
+ def is_complete(bvh_path):
79
+ """Check if all outputs already exist and are valid for a clip."""
80
+ stem = bvh_path.stem
81
+ root = clip_root(bvh_path)
82
+ retarget_dir = root / "retarget"
83
+ pkl = retarget_dir / f"{stem}.pkl"
84
+ csv = retarget_dir / f"{stem}.csv"
85
+ mp4 = retarget_dir / f"{stem}_retarget.mp4"
86
+ gif = retarget_dir / f"{stem}_retarget.gif"
87
+ return (is_valid_file(pkl, 1000)
88
+ and is_valid_file(csv, 100)
89
+ and is_valid_file(mp4, MIN_MP4_SIZE)
90
+ and is_valid_file(gif, 1000))
91
+
92
+
93
+ def retarget_bvh(bvh_path):
94
+ """Retarget BVH to PKL with ground offset calibration."""
95
+ frames, _, parents, bones = load_bvh_file(str(bvh_path), human_height=HUMAN_HEIGHT)
96
+ retargeter = Retargeter(robot_type="unitree_g1", human_height=HUMAN_HEIGHT)
97
+
98
+ n_frames = len(frames)
99
+ root_pos = np.zeros((n_frames, 3))
100
+ root_rot = np.zeros((n_frames, 4)) # xyzw storage
101
+ dof_pos = np.zeros((n_frames, 29))
102
+
103
+ for i, frame_data in enumerate(frames):
104
+ qpos = retargeter.retarget(frame_data)
105
+ root_pos[i] = qpos[:3]
106
+ # MuJoCo returns wxyz, store as xyzw
107
+ root_rot[i] = [qpos[4], qpos[5], qpos[6], qpos[3]]
108
+ dof_pos[i] = qpos[7:]
109
+
110
+ # Ground offset: find min foot Z via MuJoCo FK
111
+ model = mujoco.MjModel.from_xml_path(str(MUJOCO_XML))
112
+ data = mujoco.MjData(model)
113
+
114
+ # Find foot geom IDs (ankle bodies)
115
+ foot_geom_ids = []
116
+ for gi in range(model.ngeom):
117
+ body_name = model.body(model.geom_bodyid[gi]).name
118
+ if "ankle" in body_name:
119
+ foot_geom_ids.append(gi)
120
+
121
+ min_foot_z = float("inf")
122
+ for i in range(n_frames):
123
+ data.qpos[:3] = root_pos[i]
124
+ # Convert xyzw back to wxyz for MuJoCo
125
+ data.qpos[3:7] = [root_rot[i, 3], root_rot[i, 0], root_rot[i, 1], root_rot[i, 2]]
126
+ data.qpos[7:] = dof_pos[i]
127
+ mujoco.mj_forward(model, data)
128
+ for gi in foot_geom_ids:
129
+ z = data.geom_xpos[gi, 2]
130
+ if z < min_foot_z:
131
+ min_foot_z = z
132
+
133
+ # Shift root down so feet touch ground
134
+ if min_foot_z != float("inf"):
135
+ root_pos[:, 2] -= min_foot_z
136
+
137
+ # BVH files in this repo are all 60fps
138
+ pkl_data = {
139
+ "fps": 60,
140
+ "root_pos": root_pos,
141
+ "root_rot": root_rot,
142
+ "dof_pos": dof_pos,
143
+ "local_body_pos": None,
144
+ "link_body_list": None,
145
+ }
146
+ return pkl_data
147
+
148
+
149
+ def render_mp4(pkl_data, mp4_path):
150
+ """Render motion to MP4 using MuJoCo offscreen + ffmpeg pipe."""
151
+ model = mujoco.MjModel.from_xml_path(str(MUJOCO_XML))
152
+ data = mujoco.MjData(model)
153
+ renderer = mujoco.Renderer(model, height=RENDER_H, width=RENDER_W)
154
+
155
+ root_pos = pkl_data["root_pos"]
156
+ root_rot = pkl_data["root_rot"]
157
+ dof_pos = pkl_data["dof_pos"]
158
+ fps = pkl_data["fps"]
159
+ n_frames = len(root_pos)
160
+
161
+ proc = subprocess.Popen(
162
+ [
163
+ "ffmpeg", "-y",
164
+ "-f", "rawvideo", "-pix_fmt", "rgb24",
165
+ "-s", f"{RENDER_W}x{RENDER_H}",
166
+ "-r", str(fps),
167
+ "-i", "-",
168
+ "-c:v", "libx264", "-preset", "fast", "-crf", str(FFMPEG_CRF),
169
+ "-pix_fmt", "yuv420p",
170
+ str(mp4_path),
171
+ ],
172
+ stdin=subprocess.PIPE,
173
+ stdout=subprocess.DEVNULL,
174
+ stderr=subprocess.DEVNULL,
175
+ )
176
+
177
+ cam = mujoco.MjvCamera()
178
+ cam.azimuth = CAM_AZIMUTH
179
+ cam.elevation = CAM_ELEVATION
180
+ cam.distance = CAM_DISTANCE
181
+ cam.lookat[:] = CAM_LOOKAT
182
+
183
+ for i in range(n_frames):
184
+ data.qpos[:3] = root_pos[i]
185
+ data.qpos[3:7] = [root_rot[i, 3], root_rot[i, 0], root_rot[i, 1], root_rot[i, 2]]
186
+ data.qpos[7:] = dof_pos[i]
187
+ mujoco.mj_forward(model, data)
188
+ renderer.update_scene(data, cam)
189
+ pixels = renderer.render()
190
+ proc.stdin.write(pixels.tobytes())
191
+
192
+ proc.stdin.close()
193
+ proc.wait()
194
+ renderer.close()
195
+
196
+
197
+ def create_gif(mp4_path, gif_path):
198
+ """Create optimized GIF from MP4 using palettegen/paletteuse."""
199
+ palette_filter = f"fps={GIF_FPS},scale={GIF_WIDTH}:-1:flags=lanczos"
200
+ # Use per-clip palette file to avoid race conditions with multiprocessing
201
+ palette_path = str(mp4_path).replace(".mp4", "_palette.png")
202
+ # Two-pass: generate palette, then apply
203
+ subprocess.run(
204
+ [
205
+ "ffmpeg", "-y", "-i", str(mp4_path),
206
+ "-vf", f"{palette_filter},palettegen",
207
+ "-t", "20", # cap at 20s to keep GIF size reasonable
208
+ palette_path,
209
+ ],
210
+ stdout=subprocess.DEVNULL,
211
+ stderr=subprocess.DEVNULL,
212
+ check=True,
213
+ )
214
+ subprocess.run(
215
+ [
216
+ "ffmpeg", "-y", "-i", str(mp4_path),
217
+ "-i", palette_path,
218
+ "-t", "20",
219
+ "-lavfi", f"{palette_filter} [x]; [x][1:v] paletteuse",
220
+ str(gif_path),
221
+ ],
222
+ stdout=subprocess.DEVNULL,
223
+ stderr=subprocess.DEVNULL,
224
+ check=True,
225
+ )
226
+ # Clean up palette
227
+ os.remove(palette_path)
228
+
229
+
230
+ def pkl_to_csv(pkl_data, csv_path):
231
+ """Export PKL motion data to CSV (36 columns: 3 pos + 4 quat + 29 joints)."""
232
+ root_pos = pkl_data["root_pos"]
233
+ root_rot = pkl_data["root_rot"]
234
+ dof_pos = pkl_data["dof_pos"]
235
+ combined = np.hstack([root_pos, root_rot, dof_pos])
236
+ np.savetxt(csv_path, combined, delimiter=",", fmt="%.10f")
237
+
238
+
239
+ def process_clip(args):
240
+ """Process a single BVH clip through the full pipeline."""
241
+ bvh_path, force = args
242
+ stem = bvh_path.stem
243
+ root = clip_root(bvh_path)
244
+ cat = root.parent.name
245
+ label = f"{cat}/{stem}"
246
+ retarget_dir = root / "retarget"
247
+ retarget_dir.mkdir(exist_ok=True)
248
+ pkl_path = retarget_dir / f"{stem}.pkl"
249
+ csv_path = retarget_dir / f"{stem}.csv"
250
+ mp4_path = retarget_dir / f"{stem}_retarget.mp4"
251
+ gif_path = retarget_dir / f"{stem}_retarget.gif"
252
+
253
+ if not force and is_complete(bvh_path):
254
+ print(f" [SKIP] {label} — all outputs exist", flush=True)
255
+ return f"SKIP {label}"
256
+
257
+ t0 = time.time()
258
+ try:
259
+ # Step 1: Retarget BVH → PKL
260
+ if force or not is_valid_file(pkl_path, 1000):
261
+ print(f" [RETARGET] {label} — loading BVH and running IK...", flush=True)
262
+ pkl_data = retarget_bvh(bvh_path)
263
+ with open(pkl_path, "wb") as f:
264
+ pickle.dump(pkl_data, f)
265
+ n = len(pkl_data["root_pos"])
266
+ sz = pkl_path.stat().st_size
267
+ print(f" [RETARGET] {label} — done: {n} frames, {sz/1024:.0f}KB pkl ({time.time()-t0:.1f}s)", flush=True)
268
+ else:
269
+ with open(pkl_path, "rb") as f:
270
+ pkl_data = pickle.load(f)
271
+ n = len(pkl_data["root_pos"])
272
+ print(f" [RETARGET] {label} — using existing pkl ({n} frames)", flush=True)
273
+
274
+ # Step 2: Export CSV
275
+ if force or not is_valid_file(csv_path, 100):
276
+ pkl_to_csv(pkl_data, csv_path)
277
+ sz = csv_path.stat().st_size
278
+ print(f" [CSV] {label} — done: {sz/1024:.0f}KB csv", flush=True)
279
+ else:
280
+ print(f" [CSV] {label} — using existing csv", flush=True)
281
+
282
+ # Step 3: Render retarget MP4
283
+ if force or not is_valid_file(mp4_path, MIN_MP4_SIZE):
284
+ if mp4_path.exists():
285
+ mp4_path.unlink() # remove corrupt file
286
+ t1 = time.time()
287
+ print(f" [RENDER] {label} — rendering {n} frames to MP4...", flush=True)
288
+ render_mp4(pkl_data, mp4_path)
289
+ sz = mp4_path.stat().st_size
290
+ if sz < MIN_MP4_SIZE:
291
+ raise RuntimeError(f"Rendered MP4 too small ({sz} bytes), likely corrupt")
292
+ print(f" [RENDER] {label} — done: {sz/1024/1024:.1f}MB mp4 ({time.time()-t1:.1f}s)", flush=True)
293
+ else:
294
+ print(f" [RENDER] {label} — using existing mp4", flush=True)
295
+
296
+ # Step 4: Create GIF
297
+ if force or not is_valid_file(gif_path, 1000):
298
+ t2 = time.time()
299
+ print(f" [GIF] {label} — generating optimized GIF...", flush=True)
300
+ create_gif(mp4_path, gif_path)
301
+ sz = gif_path.stat().st_size
302
+ print(f" [GIF] {label} — done: {sz/1024/1024:.1f}MB gif ({time.time()-t2:.1f}s)", flush=True)
303
+ else:
304
+ print(f" [GIF] {label} — using existing gif", flush=True)
305
+
306
+ elapsed = time.time() - t0
307
+ print(f" [OK] {label} — complete ({n} frames, {elapsed:.1f}s total)", flush=True)
308
+ return f"OK {label} ({n} frames, {elapsed:.1f}s)"
309
+
310
+ except Exception as e:
311
+ elapsed = time.time() - t0
312
+ print(f" [FAIL] {label} — {e} ({elapsed:.1f}s)", flush=True)
313
+ return f"FAIL {label} ({elapsed:.1f}s): {e}"
314
+
315
+
316
+ def main():
317
+ parser = argparse.ArgumentParser(description="Batch retarget BVH clips to G1 robot")
318
+ parser.add_argument("--force", action="store_true", help="Reprocess all clips")
319
+ parser.add_argument("--workers", type=int, default=4, help="Number of parallel workers")
320
+ parser.add_argument("--clips", type=str, help="Comma-separated clip names to process (e.g. B_Fence1,B_DadDance)")
321
+ args = parser.parse_args()
322
+
323
+ clips = discover_bvh_clips()
324
+ if args.clips:
325
+ names = set(args.clips.split(","))
326
+ clips = [c for c in clips if c.stem in names]
327
+ print(f"Found {len(clips)} BVH clips")
328
+
329
+ if not args.force:
330
+ pending = [c for c in clips if not is_complete(c)]
331
+ print(f" {len(clips) - len(pending)} already complete, {len(pending)} to process")
332
+ else:
333
+ pending = clips
334
+
335
+ if not pending:
336
+ print("Nothing to do.")
337
+ return
338
+
339
+ work = [(c, args.force) for c in pending]
340
+
341
+ print(f"\nStarting processing with {args.workers} workers...\n", flush=True)
342
+ t_start = time.time()
343
+ if args.workers == 1:
344
+ results = [process_clip(w) for w in work]
345
+ else:
346
+ with Pool(args.workers) as pool:
347
+ results = list(pool.imap_unordered(process_clip, work))
348
+
349
+ print(f"\n{'='*60}")
350
+ for r in sorted(results):
351
+ print(f" {r}")
352
+
353
+ ok = sum(1 for r in results if r.startswith("OK"))
354
+ fail = sum(1 for r in results if r.startswith("FAIL"))
355
+ skip = sum(1 for r in results if r.startswith("SKIP"))
356
+ elapsed = time.time() - t_start
357
+ print(f"\nDone: {ok} OK, {fail} FAIL, {skip} SKIP in {elapsed:.1f}s")
358
+
359
+ if fail > 0:
360
+ sys.exit(1)
361
+
362
+
363
+ if __name__ == "__main__":
364
+ main()