diffneusim 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (682) hide show
  1. diffneusim/__init__.py +1 -0
  2. diffneusim/_cache.py +42 -0
  3. diffneusim/_paths.py +5 -0
  4. diffneusim/bindings/rew14_ext.cu +115 -0
  5. diffneusim/bindings/soft14_capi.cpp +443 -0
  6. diffneusim/bindings/soft14_engine_ext.cu +596 -0
  7. diffneusim/bindings/soft_capi.cpp +782 -0
  8. diffneusim/bindings/soft_engine_ext.cu +495 -0
  9. diffneusim/core/cpu_engine/build.sh +40 -0
  10. diffneusim/core/cpu_engine/fiber/cuda_runtime.h +445 -0
  11. diffneusim/core/cpu_engine/x14_cpu.cpp +283 -0
  12. diffneusim/core/diff/dual.h +126 -0
  13. diffneusim/core/include/diffneusim/macros.h +35 -0
  14. diffneusim/core/kin/kinematic_tree.h +273 -0
  15. diffneusim/core/math/so3.h +182 -0
  16. diffneusim/core/soft/adj/out_adj.h +102 -0
  17. diffneusim/core/soft/adj/rnea_adj.h +425 -0
  18. diffneusim/core/soft/adj/rows_adj.h +439 -0
  19. diffneusim/core/soft/adj/rows_functor.h +89 -0
  20. diffneusim/core/soft/adj/rows_lanes.h +443 -0
  21. diffneusim/core/soft/adj/shell_adj.h +243 -0
  22. diffneusim/core/soft/adj/tree_adj.h +356 -0
  23. diffneusim/core/soft/collide.h +183 -0
  24. diffneusim/core/soft/gpu/adj14.cuh +233 -0
  25. diffneusim/core/soft/gpu/adj14_mus.cuh +98 -0
  26. diffneusim/core/soft/gpu/adj_shell.cuh +50 -0
  27. diffneusim/core/soft/gpu/adj_tab.cuh +49 -0
  28. diffneusim/core/soft/gpu/body14.cuh +47 -0
  29. diffneusim/core/soft/gpu/chol_rn.cuh +458 -0
  30. diffneusim/core/soft/gpu/chol_small.cuh +123 -0
  31. diffneusim/core/soft/gpu/chol_split.cuh +193 -0
  32. diffneusim/core/soft/gpu/engine_launch.cuh +263 -0
  33. diffneusim/core/soft/gpu/fk_rn.cuh +109 -0
  34. diffneusim/core/soft/gpu/generated/body_019e20820f86_mmfloor.cuh +28 -0
  35. diffneusim/core/soft/gpu/generated/body_62f77a4bb16b_mmfloor.cuh +52 -0
  36. diffneusim/core/soft/gpu/generated/body_77dbb7213f26_mmfloor_rampsb3l_n6t12.cuh +28 -0
  37. diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rampsb3l_n6t12.cuh +28 -0
  38. diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsd05_n6t12.cuh +28 -0
  39. diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsdef_n6t12.cuh +28 -0
  40. diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsmjd_n6t12.cuh +28 -0
  41. diffneusim/core/soft/gpu/generated/body_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +52 -0
  42. diffneusim/core/soft/gpu/generated/body_a944653edd64_mmfloor.cuh +25 -0
  43. diffneusim/core/soft/gpu/generated/body_a944653edd64_mmfloor_rampsb3l_n6t12.cuh +25 -0
  44. diffneusim/core/soft/gpu/generated/g1_soft_5db44fd45286.cuh +74 -0
  45. diffneusim/core/soft/gpu/generated/split_62f77a4bb16b_mmfloor.cuh +18 -0
  46. diffneusim/core/soft/gpu/generated/split_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +18 -0
  47. diffneusim/core/soft/gpu/generated/x14_soft_019e20820f86_mmfloor.cuh +123 -0
  48. diffneusim/core/soft/gpu/generated/x14_soft_62f77a4bb16b_mmfloor.cuh +129 -0
  49. diffneusim/core/soft/gpu/generated/x14_soft_77dbb7213f26_mmfloor_rampsb3l_n6t12.cuh +123 -0
  50. diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rampsb3l_n6t12.cuh +123 -0
  51. diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsd05_n6t12.cuh +123 -0
  52. diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsdef_n6t12.cuh +123 -0
  53. diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsmjd_n6t12.cuh +123 -0
  54. diffneusim/core/soft/gpu/generated/x14_soft_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +129 -0
  55. diffneusim/core/soft/gpu/generated/x14_soft_a944653edd64_mmfloor.cuh +123 -0
  56. diffneusim/core/soft/gpu/generated/x14_soft_a944653edd64_mmfloor_rampsb3l_n6t12.cuh +123 -0
  57. diffneusim/core/soft/gpu/k_mus.cuh +1038 -0
  58. diffneusim/core/soft/gpu/k_mus_host.cuh +377 -0
  59. diffneusim/core/soft/gpu/k_pre.cuh +52 -0
  60. diffneusim/core/soft/gpu/kernel_p.cuh +490 -0
  61. diffneusim/core/soft/gpu/kp14.cuh +465 -0
  62. diffneusim/core/soft/gpu/l2v2.cuh +367 -0
  63. diffneusim/core/soft/gpu/l2x14.cuh +319 -0
  64. diffneusim/core/soft/gpu/l3.cuh +1483 -0
  65. diffneusim/core/soft/gpu/model_view.cuh +48 -0
  66. diffneusim/core/soft/gpu/mus_case_fits.h +15 -0
  67. diffneusim/core/soft/gpu/mus_classes.h +182 -0
  68. diffneusim/core/soft/gpu/mus_row_cf.h +44 -0
  69. diffneusim/core/soft/gpu/rew14.cuh +177 -0
  70. diffneusim/core/soft/gpu/rows_ctab.cuh +44 -0
  71. diffneusim/core/soft/gpu/tree_m.cuh +247 -0
  72. diffneusim/core/soft/gpu/x14_engine_kernels.cuh +260 -0
  73. diffneusim/core/soft/gpu/x14_rowcf.h +14 -0
  74. diffneusim/core/soft/hand.h +124 -0
  75. diffneusim/core/soft/impedance.h +115 -0
  76. diffneusim/core/soft/jvp.h +202 -0
  77. diffneusim/core/soft/kin.h +250 -0
  78. diffneusim/core/soft/muscle.h +1208 -0
  79. diffneusim/core/soft/newton.h +371 -0
  80. diffneusim/core/soft/rows.h +176 -0
  81. diffneusim/core/soft/step.h +188 -0
  82. diffneusim/core/soft/tape.h +313 -0
  83. diffneusim/core/soft/x14/collide14.h +69 -0
  84. diffneusim/core/soft/x14/jvp14.h +182 -0
  85. diffneusim/core/soft/x14/law14.h +453 -0
  86. diffneusim/core/soft/x14adj/collide14_adj.h +134 -0
  87. diffneusim/core/soft/x14adj/passive14_adj.h +162 -0
  88. diffneusim/core/soft/x14adj/reward14.h +484 -0
  89. diffneusim/core/soft/x14adj/rows14_adj.h +400 -0
  90. diffneusim/core/soft/x14adj/scan14.h +349 -0
  91. diffneusim/core/soft/x14adj/shell14_adj.h +122 -0
  92. diffneusim/core/soft/x14adj/sweep14.h +255 -0
  93. diffneusim/core/soft/x14adj/tree14_adj.h +500 -0
  94. diffneusim/core/soft/x14adj/x14adj_common.h +96 -0
  95. diffneusim/data/mirror/H1622v2k_geyer_hfdeq.npz +0 -0
  96. diffneusim/data/mirror/H1622v2k_hfd.npz +0 -0
  97. diffneusim/data/mirror/H1622v2k_millard_hfdeq.npz +0 -0
  98. diffneusim/data/mirror/fullbody_contact.npz +0 -0
  99. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard.npz +0 -0
  100. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_p2str.npz +0 -0
  101. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_p2str_rigid.npz +0 -0
  102. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.npz +0 -0
  103. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.npz +0 -0
  104. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq.npz +0 -0
  105. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin.npz +0 -0
  106. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_calf2_pe.npz +0 -0
  107. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
  108. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfix.npz +0 -0
  109. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfixlegs01.npz +0 -0
  110. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01.npz +0 -0
  111. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01legs.npz +0 -0
  112. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01lumbar.npz +0 -0
  113. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_lumbfix.npz +0 -0
  114. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_lumbfixlegs01.npz +0 -0
  115. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.npz +0 -0
  116. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1a.npz +0 -0
  117. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n2.npz +0 -0
  118. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_rom23.npz +0 -0
  119. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair.npz +0 -0
  120. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
  121. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_hinge.npz +0 -0
  122. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.npz +0 -0
  123. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1a.npz +0 -0
  124. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n2.npz +0 -0
  125. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_rom23.npz +0 -0
  126. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_lspine_girdle_osimeq.npz +0 -0
  127. diffneusim/data/mirror/fullbody_contact_spinecoupled_lspine_girdle_millard.npz +0 -0
  128. diffneusim/data/mirror/fullbody_contact_spinecoupled_lspine_girdle_osimeq.npz +0 -0
  129. diffneusim/data/mirror/myoleg26_3d_compound_g14eq.npz +0 -0
  130. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq.npz +0 -0
  131. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose.npz +0 -0
  132. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin.npz +0 -0
  133. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30.npz +0 -0
  134. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30.npz +0 -0
  135. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30_luispe.npz +0 -0
  136. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30_trunk0701.npz +0 -0
  137. diffneusim/data/muscle_fit/wang_mass_volume_14t.json +91 -0
  138. diffneusim/data/muscle_fit/wang_mass_volume_14t_axfix.json +91 -0
  139. diffneusim/data/muscle_fit/wang_mass_volume_14t_axfixlegs01.json +91 -0
  140. diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01.json +91 -0
  141. diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01legs.json +91 -0
  142. diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01lumbar.json +91 -0
  143. diffneusim/data/muscle_fit/wang_mass_volume_14t_lumbfix.json +91 -0
  144. diffneusim/data/muscle_fit/wang_mass_volume_14t_lumbfixlegs01.json +91 -0
  145. diffneusim/data/muscle_fit/wang_mass_volume_14t_n1.json +91 -0
  146. diffneusim/data/muscle_fit/wang_mass_volume_14t_n1a.json +91 -0
  147. diffneusim/data/muscle_fit/wang_mass_volume_14t_n2.json +91 -0
  148. diffneusim/data/muscle_fit/wang_mass_volume_14t_rom23.json +91 -0
  149. diffneusim/data/reference/musclemimic/myofullbody_mimic_sites.json +261 -0
  150. diffneusim/data/reference/pose3/pose3_scone.json +305 -0
  151. diffneusim/data/reference/pose3/pose3_scone.txt +3 -0
  152. diffneusim/data/reference/pose3/pose3_scone_gait.npz +0 -0
  153. diffneusim/data/reference/pose3/pose3_scone_mirror.npz +0 -0
  154. diffneusim/data/reference/pose3/pose3_scone_stand.npz +0 -0
  155. diffneusim/data/reference/x016run/MD5SUMS +241 -0
  156. diffneusim/data/reference/x016run/x016run_states.txt +240 -0
  157. diffneusim/data/reference/x016run/x016run_v3p00_s0_l0.npz +0 -0
  158. diffneusim/data/reference/x016run/x016run_v3p00_s0_l1.npz +0 -0
  159. diffneusim/data/reference/x016run/x016run_v3p00_s0_l2.npz +0 -0
  160. diffneusim/data/reference/x016run/x016run_v3p00_s0_l3.npz +0 -0
  161. diffneusim/data/reference/x016run/x016run_v3p00_s0_r0.npz +0 -0
  162. diffneusim/data/reference/x016run/x016run_v3p00_s0_r1.npz +0 -0
  163. diffneusim/data/reference/x016run/x016run_v3p00_s0_r2.npz +0 -0
  164. diffneusim/data/reference/x016run/x016run_v3p00_s0_r3.npz +0 -0
  165. diffneusim/data/reference/x016run/x016run_v3p00_s1_l0.npz +0 -0
  166. diffneusim/data/reference/x016run/x016run_v3p00_s1_l1.npz +0 -0
  167. diffneusim/data/reference/x016run/x016run_v3p00_s1_l2.npz +0 -0
  168. diffneusim/data/reference/x016run/x016run_v3p00_s1_l3.npz +0 -0
  169. diffneusim/data/reference/x016run/x016run_v3p00_s1_r0.npz +0 -0
  170. diffneusim/data/reference/x016run/x016run_v3p00_s1_r1.npz +0 -0
  171. diffneusim/data/reference/x016run/x016run_v3p00_s1_r2.npz +0 -0
  172. diffneusim/data/reference/x016run/x016run_v3p00_s1_r3.npz +0 -0
  173. diffneusim/data/reference/x016run/x016run_v3p00_s2_l0.npz +0 -0
  174. diffneusim/data/reference/x016run/x016run_v3p00_s2_l1.npz +0 -0
  175. diffneusim/data/reference/x016run/x016run_v3p00_s2_l2.npz +0 -0
  176. diffneusim/data/reference/x016run/x016run_v3p00_s2_l3.npz +0 -0
  177. diffneusim/data/reference/x016run/x016run_v3p00_s2_r0.npz +0 -0
  178. diffneusim/data/reference/x016run/x016run_v3p00_s2_r1.npz +0 -0
  179. diffneusim/data/reference/x016run/x016run_v3p00_s2_r2.npz +0 -0
  180. diffneusim/data/reference/x016run/x016run_v3p00_s2_r3.npz +0 -0
  181. diffneusim/data/reference/x016run/x016run_v3p00_s3_l0.npz +0 -0
  182. diffneusim/data/reference/x016run/x016run_v3p00_s3_l1.npz +0 -0
  183. diffneusim/data/reference/x016run/x016run_v3p00_s3_l2.npz +0 -0
  184. diffneusim/data/reference/x016run/x016run_v3p00_s3_l3.npz +0 -0
  185. diffneusim/data/reference/x016run/x016run_v3p00_s3_r0.npz +0 -0
  186. diffneusim/data/reference/x016run/x016run_v3p00_s3_r1.npz +0 -0
  187. diffneusim/data/reference/x016run/x016run_v3p00_s3_r2.npz +0 -0
  188. diffneusim/data/reference/x016run/x016run_v3p00_s3_r3.npz +0 -0
  189. diffneusim/data/reference/x016run/x016run_v3p00_s4_l0.npz +0 -0
  190. diffneusim/data/reference/x016run/x016run_v3p00_s4_l1.npz +0 -0
  191. diffneusim/data/reference/x016run/x016run_v3p00_s4_l2.npz +0 -0
  192. diffneusim/data/reference/x016run/x016run_v3p00_s4_l3.npz +0 -0
  193. diffneusim/data/reference/x016run/x016run_v3p00_s4_r0.npz +0 -0
  194. diffneusim/data/reference/x016run/x016run_v3p00_s4_r1.npz +0 -0
  195. diffneusim/data/reference/x016run/x016run_v3p00_s4_r2.npz +0 -0
  196. diffneusim/data/reference/x016run/x016run_v3p00_s4_r3.npz +0 -0
  197. diffneusim/data/reference/x016run/x016run_v3p00_s5_l0.npz +0 -0
  198. diffneusim/data/reference/x016run/x016run_v3p00_s5_l1.npz +0 -0
  199. diffneusim/data/reference/x016run/x016run_v3p00_s5_l2.npz +0 -0
  200. diffneusim/data/reference/x016run/x016run_v3p00_s5_l3.npz +0 -0
  201. diffneusim/data/reference/x016run/x016run_v3p00_s5_r0.npz +0 -0
  202. diffneusim/data/reference/x016run/x016run_v3p00_s5_r1.npz +0 -0
  203. diffneusim/data/reference/x016run/x016run_v3p00_s5_r2.npz +0 -0
  204. diffneusim/data/reference/x016run/x016run_v3p00_s5_r3.npz +0 -0
  205. diffneusim/data/reference/x016run/x016run_v3p00_s6_l0.npz +0 -0
  206. diffneusim/data/reference/x016run/x016run_v3p00_s6_l1.npz +0 -0
  207. diffneusim/data/reference/x016run/x016run_v3p00_s6_l2.npz +0 -0
  208. diffneusim/data/reference/x016run/x016run_v3p00_s6_l3.npz +0 -0
  209. diffneusim/data/reference/x016run/x016run_v3p00_s6_r0.npz +0 -0
  210. diffneusim/data/reference/x016run/x016run_v3p00_s6_r1.npz +0 -0
  211. diffneusim/data/reference/x016run/x016run_v3p00_s6_r2.npz +0 -0
  212. diffneusim/data/reference/x016run/x016run_v3p00_s6_r3.npz +0 -0
  213. diffneusim/data/reference/x016run/x016run_v3p00_s7_l0.npz +0 -0
  214. diffneusim/data/reference/x016run/x016run_v3p00_s7_l1.npz +0 -0
  215. diffneusim/data/reference/x016run/x016run_v3p00_s7_l2.npz +0 -0
  216. diffneusim/data/reference/x016run/x016run_v3p00_s7_l3.npz +0 -0
  217. diffneusim/data/reference/x016run/x016run_v3p00_s7_r0.npz +0 -0
  218. diffneusim/data/reference/x016run/x016run_v3p00_s7_r1.npz +0 -0
  219. diffneusim/data/reference/x016run/x016run_v3p00_s7_r2.npz +0 -0
  220. diffneusim/data/reference/x016run/x016run_v3p00_s7_r3.npz +0 -0
  221. diffneusim/data/reference/x016run/x016run_v3p25_s0_l0.npz +0 -0
  222. diffneusim/data/reference/x016run/x016run_v3p25_s0_l1.npz +0 -0
  223. diffneusim/data/reference/x016run/x016run_v3p25_s0_l2.npz +0 -0
  224. diffneusim/data/reference/x016run/x016run_v3p25_s0_l3.npz +0 -0
  225. diffneusim/data/reference/x016run/x016run_v3p25_s0_r0.npz +0 -0
  226. diffneusim/data/reference/x016run/x016run_v3p25_s0_r1.npz +0 -0
  227. diffneusim/data/reference/x016run/x016run_v3p25_s0_r2.npz +0 -0
  228. diffneusim/data/reference/x016run/x016run_v3p25_s0_r3.npz +0 -0
  229. diffneusim/data/reference/x016run/x016run_v3p25_s1_l0.npz +0 -0
  230. diffneusim/data/reference/x016run/x016run_v3p25_s1_l1.npz +0 -0
  231. diffneusim/data/reference/x016run/x016run_v3p25_s1_l2.npz +0 -0
  232. diffneusim/data/reference/x016run/x016run_v3p25_s1_l3.npz +0 -0
  233. diffneusim/data/reference/x016run/x016run_v3p25_s1_r0.npz +0 -0
  234. diffneusim/data/reference/x016run/x016run_v3p25_s1_r1.npz +0 -0
  235. diffneusim/data/reference/x016run/x016run_v3p25_s1_r2.npz +0 -0
  236. diffneusim/data/reference/x016run/x016run_v3p25_s1_r3.npz +0 -0
  237. diffneusim/data/reference/x016run/x016run_v3p25_s2_l0.npz +0 -0
  238. diffneusim/data/reference/x016run/x016run_v3p25_s2_l1.npz +0 -0
  239. diffneusim/data/reference/x016run/x016run_v3p25_s2_l2.npz +0 -0
  240. diffneusim/data/reference/x016run/x016run_v3p25_s2_l3.npz +0 -0
  241. diffneusim/data/reference/x016run/x016run_v3p25_s2_r0.npz +0 -0
  242. diffneusim/data/reference/x016run/x016run_v3p25_s2_r1.npz +0 -0
  243. diffneusim/data/reference/x016run/x016run_v3p25_s2_r2.npz +0 -0
  244. diffneusim/data/reference/x016run/x016run_v3p25_s2_r3.npz +0 -0
  245. diffneusim/data/reference/x016run/x016run_v3p25_s3_l0.npz +0 -0
  246. diffneusim/data/reference/x016run/x016run_v3p25_s3_l1.npz +0 -0
  247. diffneusim/data/reference/x016run/x016run_v3p25_s3_l2.npz +0 -0
  248. diffneusim/data/reference/x016run/x016run_v3p25_s3_l3.npz +0 -0
  249. diffneusim/data/reference/x016run/x016run_v3p25_s3_r0.npz +0 -0
  250. diffneusim/data/reference/x016run/x016run_v3p25_s3_r1.npz +0 -0
  251. diffneusim/data/reference/x016run/x016run_v3p25_s3_r2.npz +0 -0
  252. diffneusim/data/reference/x016run/x016run_v3p25_s3_r3.npz +0 -0
  253. diffneusim/data/reference/x016run/x016run_v3p25_s4_l0.npz +0 -0
  254. diffneusim/data/reference/x016run/x016run_v3p25_s4_l1.npz +0 -0
  255. diffneusim/data/reference/x016run/x016run_v3p25_s4_l2.npz +0 -0
  256. diffneusim/data/reference/x016run/x016run_v3p25_s4_l3.npz +0 -0
  257. diffneusim/data/reference/x016run/x016run_v3p25_s4_r0.npz +0 -0
  258. diffneusim/data/reference/x016run/x016run_v3p25_s4_r1.npz +0 -0
  259. diffneusim/data/reference/x016run/x016run_v3p25_s4_r2.npz +0 -0
  260. diffneusim/data/reference/x016run/x016run_v3p25_s4_r3.npz +0 -0
  261. diffneusim/data/reference/x016run/x016run_v3p25_s5_l0.npz +0 -0
  262. diffneusim/data/reference/x016run/x016run_v3p25_s5_l1.npz +0 -0
  263. diffneusim/data/reference/x016run/x016run_v3p25_s5_l2.npz +0 -0
  264. diffneusim/data/reference/x016run/x016run_v3p25_s5_l3.npz +0 -0
  265. diffneusim/data/reference/x016run/x016run_v3p25_s5_r0.npz +0 -0
  266. diffneusim/data/reference/x016run/x016run_v3p25_s5_r1.npz +0 -0
  267. diffneusim/data/reference/x016run/x016run_v3p25_s5_r2.npz +0 -0
  268. diffneusim/data/reference/x016run/x016run_v3p25_s5_r3.npz +0 -0
  269. diffneusim/data/reference/x016run/x016run_v3p25_s6_l0.npz +0 -0
  270. diffneusim/data/reference/x016run/x016run_v3p25_s6_l1.npz +0 -0
  271. diffneusim/data/reference/x016run/x016run_v3p25_s6_l2.npz +0 -0
  272. diffneusim/data/reference/x016run/x016run_v3p25_s6_l3.npz +0 -0
  273. diffneusim/data/reference/x016run/x016run_v3p25_s6_r0.npz +0 -0
  274. diffneusim/data/reference/x016run/x016run_v3p25_s6_r1.npz +0 -0
  275. diffneusim/data/reference/x016run/x016run_v3p25_s6_r2.npz +0 -0
  276. diffneusim/data/reference/x016run/x016run_v3p25_s6_r3.npz +0 -0
  277. diffneusim/data/reference/x016run/x016run_v3p25_s7_l0.npz +0 -0
  278. diffneusim/data/reference/x016run/x016run_v3p25_s7_l1.npz +0 -0
  279. diffneusim/data/reference/x016run/x016run_v3p25_s7_l2.npz +0 -0
  280. diffneusim/data/reference/x016run/x016run_v3p25_s7_l3.npz +0 -0
  281. diffneusim/data/reference/x016run/x016run_v3p25_s7_r0.npz +0 -0
  282. diffneusim/data/reference/x016run/x016run_v3p25_s7_r1.npz +0 -0
  283. diffneusim/data/reference/x016run/x016run_v3p25_s7_r2.npz +0 -0
  284. diffneusim/data/reference/x016run/x016run_v3p25_s7_r3.npz +0 -0
  285. diffneusim/data/reference/x016run/x016run_v3p50_s0_l0.npz +0 -0
  286. diffneusim/data/reference/x016run/x016run_v3p50_s0_l1.npz +0 -0
  287. diffneusim/data/reference/x016run/x016run_v3p50_s0_l2.npz +0 -0
  288. diffneusim/data/reference/x016run/x016run_v3p50_s0_l3.npz +0 -0
  289. diffneusim/data/reference/x016run/x016run_v3p50_s0_r0.npz +0 -0
  290. diffneusim/data/reference/x016run/x016run_v3p50_s0_r1.npz +0 -0
  291. diffneusim/data/reference/x016run/x016run_v3p50_s0_r2.npz +0 -0
  292. diffneusim/data/reference/x016run/x016run_v3p50_s0_r3.npz +0 -0
  293. diffneusim/data/reference/x016run/x016run_v3p50_s1_l0.npz +0 -0
  294. diffneusim/data/reference/x016run/x016run_v3p50_s1_l1.npz +0 -0
  295. diffneusim/data/reference/x016run/x016run_v3p50_s1_l2.npz +0 -0
  296. diffneusim/data/reference/x016run/x016run_v3p50_s1_l3.npz +0 -0
  297. diffneusim/data/reference/x016run/x016run_v3p50_s1_r0.npz +0 -0
  298. diffneusim/data/reference/x016run/x016run_v3p50_s1_r1.npz +0 -0
  299. diffneusim/data/reference/x016run/x016run_v3p50_s1_r2.npz +0 -0
  300. diffneusim/data/reference/x016run/x016run_v3p50_s1_r3.npz +0 -0
  301. diffneusim/data/reference/x016run/x016run_v3p50_s2_l0.npz +0 -0
  302. diffneusim/data/reference/x016run/x016run_v3p50_s2_l1.npz +0 -0
  303. diffneusim/data/reference/x016run/x016run_v3p50_s2_l2.npz +0 -0
  304. diffneusim/data/reference/x016run/x016run_v3p50_s2_l3.npz +0 -0
  305. diffneusim/data/reference/x016run/x016run_v3p50_s2_r0.npz +0 -0
  306. diffneusim/data/reference/x016run/x016run_v3p50_s2_r1.npz +0 -0
  307. diffneusim/data/reference/x016run/x016run_v3p50_s2_r2.npz +0 -0
  308. diffneusim/data/reference/x016run/x016run_v3p50_s2_r3.npz +0 -0
  309. diffneusim/data/reference/x016run/x016run_v3p50_s3_l0.npz +0 -0
  310. diffneusim/data/reference/x016run/x016run_v3p50_s3_l1.npz +0 -0
  311. diffneusim/data/reference/x016run/x016run_v3p50_s3_l2.npz +0 -0
  312. diffneusim/data/reference/x016run/x016run_v3p50_s3_l3.npz +0 -0
  313. diffneusim/data/reference/x016run/x016run_v3p50_s3_r0.npz +0 -0
  314. diffneusim/data/reference/x016run/x016run_v3p50_s3_r1.npz +0 -0
  315. diffneusim/data/reference/x016run/x016run_v3p50_s3_r2.npz +0 -0
  316. diffneusim/data/reference/x016run/x016run_v3p50_s3_r3.npz +0 -0
  317. diffneusim/data/reference/x016run/x016run_v3p50_s5_l0.npz +0 -0
  318. diffneusim/data/reference/x016run/x016run_v3p50_s5_l1.npz +0 -0
  319. diffneusim/data/reference/x016run/x016run_v3p50_s5_l2.npz +0 -0
  320. diffneusim/data/reference/x016run/x016run_v3p50_s5_l3.npz +0 -0
  321. diffneusim/data/reference/x016run/x016run_v3p50_s5_r0.npz +0 -0
  322. diffneusim/data/reference/x016run/x016run_v3p50_s5_r1.npz +0 -0
  323. diffneusim/data/reference/x016run/x016run_v3p50_s5_r2.npz +0 -0
  324. diffneusim/data/reference/x016run/x016run_v3p50_s5_r3.npz +0 -0
  325. diffneusim/data/reference/x016run/x016run_v3p50_s6_l0.npz +0 -0
  326. diffneusim/data/reference/x016run/x016run_v3p50_s6_l1.npz +0 -0
  327. diffneusim/data/reference/x016run/x016run_v3p50_s6_l2.npz +0 -0
  328. diffneusim/data/reference/x016run/x016run_v3p50_s6_l3.npz +0 -0
  329. diffneusim/data/reference/x016run/x016run_v3p50_s6_r0.npz +0 -0
  330. diffneusim/data/reference/x016run/x016run_v3p50_s6_r1.npz +0 -0
  331. diffneusim/data/reference/x016run/x016run_v3p50_s6_r2.npz +0 -0
  332. diffneusim/data/reference/x016run/x016run_v3p50_s6_r3.npz +0 -0
  333. diffneusim/data/reference/x016run/x016run_v3p50_s7_l0.npz +0 -0
  334. diffneusim/data/reference/x016run/x016run_v3p50_s7_l1.npz +0 -0
  335. diffneusim/data/reference/x016run/x016run_v3p50_s7_l2.npz +0 -0
  336. diffneusim/data/reference/x016run/x016run_v3p50_s7_l3.npz +0 -0
  337. diffneusim/data/reference/x016run/x016run_v3p50_s7_r0.npz +0 -0
  338. diffneusim/data/reference/x016run/x016run_v3p50_s7_r1.npz +0 -0
  339. diffneusim/data/reference/x016run/x016run_v3p50_s7_r2.npz +0 -0
  340. diffneusim/data/reference/x016run/x016run_v3p50_s7_r3.npz +0 -0
  341. diffneusim/data/reference/x016run/x016run_v3p75_s0_l0.npz +0 -0
  342. diffneusim/data/reference/x016run/x016run_v3p75_s0_l1.npz +0 -0
  343. diffneusim/data/reference/x016run/x016run_v3p75_s0_l2.npz +0 -0
  344. diffneusim/data/reference/x016run/x016run_v3p75_s0_l3.npz +0 -0
  345. diffneusim/data/reference/x016run/x016run_v3p75_s0_r0.npz +0 -0
  346. diffneusim/data/reference/x016run/x016run_v3p75_s0_r1.npz +0 -0
  347. diffneusim/data/reference/x016run/x016run_v3p75_s0_r2.npz +0 -0
  348. diffneusim/data/reference/x016run/x016run_v3p75_s0_r3.npz +0 -0
  349. diffneusim/data/reference/x016run/x016run_v3p75_s1_l0.npz +0 -0
  350. diffneusim/data/reference/x016run/x016run_v3p75_s1_l1.npz +0 -0
  351. diffneusim/data/reference/x016run/x016run_v3p75_s1_l2.npz +0 -0
  352. diffneusim/data/reference/x016run/x016run_v3p75_s1_l3.npz +0 -0
  353. diffneusim/data/reference/x016run/x016run_v3p75_s1_r0.npz +0 -0
  354. diffneusim/data/reference/x016run/x016run_v3p75_s1_r1.npz +0 -0
  355. diffneusim/data/reference/x016run/x016run_v3p75_s1_r2.npz +0 -0
  356. diffneusim/data/reference/x016run/x016run_v3p75_s1_r3.npz +0 -0
  357. diffneusim/data/reference/x016run/x016run_v3p75_s2_l0.npz +0 -0
  358. diffneusim/data/reference/x016run/x016run_v3p75_s2_l1.npz +0 -0
  359. diffneusim/data/reference/x016run/x016run_v3p75_s2_l2.npz +0 -0
  360. diffneusim/data/reference/x016run/x016run_v3p75_s2_l3.npz +0 -0
  361. diffneusim/data/reference/x016run/x016run_v3p75_s2_r0.npz +0 -0
  362. diffneusim/data/reference/x016run/x016run_v3p75_s2_r1.npz +0 -0
  363. diffneusim/data/reference/x016run/x016run_v3p75_s2_r2.npz +0 -0
  364. diffneusim/data/reference/x016run/x016run_v3p75_s2_r3.npz +0 -0
  365. diffneusim/data/reference/x016run/x016run_v3p75_s3_l0.npz +0 -0
  366. diffneusim/data/reference/x016run/x016run_v3p75_s3_l1.npz +0 -0
  367. diffneusim/data/reference/x016run/x016run_v3p75_s3_l2.npz +0 -0
  368. diffneusim/data/reference/x016run/x016run_v3p75_s3_l3.npz +0 -0
  369. diffneusim/data/reference/x016run/x016run_v3p75_s3_r0.npz +0 -0
  370. diffneusim/data/reference/x016run/x016run_v3p75_s3_r1.npz +0 -0
  371. diffneusim/data/reference/x016run/x016run_v3p75_s3_r2.npz +0 -0
  372. diffneusim/data/reference/x016run/x016run_v3p75_s3_r3.npz +0 -0
  373. diffneusim/data/reference/x016run/x016run_v3p75_s5_l0.npz +0 -0
  374. diffneusim/data/reference/x016run/x016run_v3p75_s5_l1.npz +0 -0
  375. diffneusim/data/reference/x016run/x016run_v3p75_s5_l2.npz +0 -0
  376. diffneusim/data/reference/x016run/x016run_v3p75_s5_l3.npz +0 -0
  377. diffneusim/data/reference/x016run/x016run_v3p75_s5_r0.npz +0 -0
  378. diffneusim/data/reference/x016run/x016run_v3p75_s5_r1.npz +0 -0
  379. diffneusim/data/reference/x016run/x016run_v3p75_s5_r2.npz +0 -0
  380. diffneusim/data/reference/x016run/x016run_v3p75_s5_r3.npz +0 -0
  381. diffneusim/data/reference/x016run/x016run_v3p75_s6_l0.npz +0 -0
  382. diffneusim/data/reference/x016run/x016run_v3p75_s6_l1.npz +0 -0
  383. diffneusim/data/reference/x016run/x016run_v3p75_s6_l2.npz +0 -0
  384. diffneusim/data/reference/x016run/x016run_v3p75_s6_l3.npz +0 -0
  385. diffneusim/data/reference/x016run/x016run_v3p75_s6_r0.npz +0 -0
  386. diffneusim/data/reference/x016run/x016run_v3p75_s6_r1.npz +0 -0
  387. diffneusim/data/reference/x016run/x016run_v3p75_s6_r2.npz +0 -0
  388. diffneusim/data/reference/x016run/x016run_v3p75_s6_r3.npz +0 -0
  389. diffneusim/data/reference/x016run/x016run_v3p75_s7_l0.npz +0 -0
  390. diffneusim/data/reference/x016run/x016run_v3p75_s7_l1.npz +0 -0
  391. diffneusim/data/reference/x016run/x016run_v3p75_s7_l2.npz +0 -0
  392. diffneusim/data/reference/x016run/x016run_v3p75_s7_l3.npz +0 -0
  393. diffneusim/data/reference/x016run/x016run_v3p75_s7_r0.npz +0 -0
  394. diffneusim/data/reference/x016run/x016run_v3p75_s7_r1.npz +0 -0
  395. diffneusim/data/reference/x016run/x016run_v3p75_s7_r2.npz +0 -0
  396. diffneusim/data/reference/x016run/x016run_v3p75_s7_r3.npz +0 -0
  397. diffneusim/data/state_prior/lumbar_poly_fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
  398. diffneusim/engine/__init__.py +0 -0
  399. diffneusim/engine/build_tag.py +52 -0
  400. diffneusim/engine/case_tables.py +46 -0
  401. diffneusim/engine/d16_body.py +80 -0
  402. diffneusim/engine/engine14.py +367 -0
  403. diffneusim/engine/gen_split.py +159 -0
  404. diffneusim/engine/hand_format.py +69 -0
  405. diffneusim/engine/live14.py +149 -0
  406. diffneusim/engine/phase_b_tree.py +137 -0
  407. diffneusim/engine/soft14.py +130 -0
  408. diffneusim/engine/soft_capi.py +373 -0
  409. diffneusim/engine/soft_engine.py +165 -0
  410. diffneusim/engine/step14.py +132 -0
  411. diffneusim/engine/tape_format.py +89 -0
  412. diffneusim/engine/x14cpu.py +163 -0
  413. diffneusim/env/__init__.py +0 -0
  414. diffneusim/env/absent.py +20 -0
  415. diffneusim/env/cpu14.py +105 -0
  416. diffneusim/env/e0loop14.py +224 -0
  417. diffneusim/env/env14.py +568 -0
  418. diffneusim/env/kin_contact14.py +193 -0
  419. diffneusim/env/mimic_sites_x14.json +366 -0
  420. diffneusim/env/old_count.py +78 -0
  421. diffneusim/env/rew14.py +114 -0
  422. diffneusim/env/rew14_hook.py +105 -0
  423. diffneusim/g1/__init__.py +1 -0
  424. diffneusim/g1/arm_a2.py +165 -0
  425. diffneusim/g1/arm_a3.py +576 -0
  426. diffneusim/g1/read_a3.py +79 -0
  427. diffneusim/g1/rg1_read.py +89 -0
  428. diffneusim/model/__init__.py +66 -0
  429. diffneusim/model/case.py +17 -0
  430. diffneusim/model/dnmodel.py +79 -0
  431. diffneusim/model/fuse_fixed.py +281 -0
  432. diffneusim/model/monitor.py +834 -0
  433. diffneusim/models/BODIES.toml +48 -0
  434. diffneusim/models/MANIFEST.toml +979 -0
  435. diffneusim/models/cases/G290/case.bin +0 -0
  436. diffneusim/models/cases/G290/case.json +1 -0
  437. diffneusim/models/cases/G356-SRC/case.bin +0 -0
  438. diffneusim/models/cases/G356-SRC/case.json +1 -0
  439. diffneusim/models/cases/G416/case.bin +0 -0
  440. diffneusim/models/cases/G416/case.json +1 -0
  441. diffneusim/models/cases/M290C-SRC/case.bin +0 -0
  442. diffneusim/models/cases/M290C-SRC/case.json +1 -0
  443. diffneusim/models/cases/M290R-SRC/case.bin +0 -0
  444. diffneusim/models/cases/M290R-SRC/case.json +1 -0
  445. diffneusim/models/cases/M356C-SRC/case.bin +0 -0
  446. diffneusim/models/cases/M356C-SRC/case.json +1 -0
  447. diffneusim/models/cases/M356R-SRC/case.bin +0 -0
  448. diffneusim/models/cases/M356R-SRC/case.json +1 -0
  449. diffneusim/models/cases/M416C-SRC/case.bin +0 -0
  450. diffneusim/models/cases/M416C-SRC/case.json +1 -0
  451. diffneusim/models/derived/d16_expanded_62f77a4bb16b1e67_mmfloor.xml +673 -0
  452. diffneusim/models/derived/d16_expanded_a1e8b196b2cd7b3c_mmfloor.xml +673 -0
  453. diffneusim/models/derived/d16_soft_law_019e20820f8633b9_mmfloor.json +7844 -0
  454. diffneusim/models/derived/d16_soft_law_62f77a4bb16b1e67_mmfloor.json +16855 -0
  455. diffneusim/models/derived/d16_soft_law_77dbb7213f26e821_mmfloor_rampsb3l_n6t12.json +7883 -0
  456. diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rampsb3l_n6t12.json +7883 -0
  457. diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsd05_n6t12.json +7868 -0
  458. diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsdef_n6t12.json +7868 -0
  459. diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsmjd_n6t12.json +7868 -0
  460. diffneusim/models/derived/d16_soft_law_a1e8b196b2cd7b3c_mmfloor_rampsb3l_n6t12.json +16894 -0
  461. diffneusim/models/derived/d16_soft_law_a944653edd642082_mmfloor.json +12655 -0
  462. diffneusim/models/derived/d16_soft_law_a944653edd642082_mmfloor_rampsb3l_n6t12.json +12700 -0
  463. diffneusim/models/derived/unitree_g1_soft_law.json +15580 -0
  464. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +28913 -0
  465. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
  466. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.dnmodel +29202 -0
  467. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid_qk.txt +1 -0
  468. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfixlegs01.dnmodel +1 -0
  469. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
  470. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
  471. diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +46970 -0
  472. diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
  473. diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
  474. diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
  475. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +38570 -0
  476. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
  477. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.dnmodel +38923 -0
  478. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid_qk.txt +1 -0
  479. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
  480. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
  481. diffneusim/models/fullbody_meshes/1mc.stl +0 -0
  482. diffneusim/models/fullbody_meshes/2distph.stl +0 -0
  483. diffneusim/models/fullbody_meshes/2mc.stl +0 -0
  484. diffneusim/models/fullbody_meshes/2midph.stl +0 -0
  485. diffneusim/models/fullbody_meshes/2proxph.stl +0 -0
  486. diffneusim/models/fullbody_meshes/3distph.stl +0 -0
  487. diffneusim/models/fullbody_meshes/3mc.stl +0 -0
  488. diffneusim/models/fullbody_meshes/3midph.stl +0 -0
  489. diffneusim/models/fullbody_meshes/3proxph.stl +0 -0
  490. diffneusim/models/fullbody_meshes/4distph.stl +0 -0
  491. diffneusim/models/fullbody_meshes/4mc.stl +0 -0
  492. diffneusim/models/fullbody_meshes/4midph.stl +0 -0
  493. diffneusim/models/fullbody_meshes/4proxph.stl +0 -0
  494. diffneusim/models/fullbody_meshes/5distph.stl +0 -0
  495. diffneusim/models/fullbody_meshes/5mc.stl +0 -0
  496. diffneusim/models/fullbody_meshes/5midph.stl +0 -0
  497. diffneusim/models/fullbody_meshes/5proxph.stl +0 -0
  498. diffneusim/models/fullbody_meshes/NOTICE +2 -0
  499. diffneusim/models/fullbody_meshes/capitate.stl +0 -0
  500. diffneusim/models/fullbody_meshes/clavicle.stl +0 -0
  501. diffneusim/models/fullbody_meshes/hamate.stl +0 -0
  502. diffneusim/models/fullbody_meshes/hat_cervical.stl +0 -0
  503. diffneusim/models/fullbody_meshes/hat_jaw.stl +0 -0
  504. diffneusim/models/fullbody_meshes/hat_skull.stl +0 -0
  505. diffneusim/models/fullbody_meshes/humerus.stl +0 -0
  506. diffneusim/models/fullbody_meshes/l_bofoot.stl +0 -0
  507. diffneusim/models/fullbody_meshes/l_femur.stl +0 -0
  508. diffneusim/models/fullbody_meshes/l_fibula.stl +0 -0
  509. diffneusim/models/fullbody_meshes/l_foot.stl +0 -0
  510. diffneusim/models/fullbody_meshes/l_patella.stl +0 -0
  511. diffneusim/models/fullbody_meshes/l_pelvis.stl +0 -0
  512. diffneusim/models/fullbody_meshes/l_talus.stl +0 -0
  513. diffneusim/models/fullbody_meshes/l_tibia.stl +0 -0
  514. diffneusim/models/fullbody_meshes/lumbar1.stl +0 -0
  515. diffneusim/models/fullbody_meshes/lumbar2.stl +0 -0
  516. diffneusim/models/fullbody_meshes/lumbar3.stl +0 -0
  517. diffneusim/models/fullbody_meshes/lumbar4.stl +0 -0
  518. diffneusim/models/fullbody_meshes/lumbar5.stl +0 -0
  519. diffneusim/models/fullbody_meshes/lunate.stl +0 -0
  520. diffneusim/models/fullbody_meshes/pisiform.stl +0 -0
  521. diffneusim/models/fullbody_meshes/r_bofoot.stl +0 -0
  522. diffneusim/models/fullbody_meshes/r_femur.stl +0 -0
  523. diffneusim/models/fullbody_meshes/r_fibula.stl +0 -0
  524. diffneusim/models/fullbody_meshes/r_foot.stl +0 -0
  525. diffneusim/models/fullbody_meshes/r_patella.stl +0 -0
  526. diffneusim/models/fullbody_meshes/r_pelvis.stl +0 -0
  527. diffneusim/models/fullbody_meshes/r_talus.stl +0 -0
  528. diffneusim/models/fullbody_meshes/r_tibia.stl +0 -0
  529. diffneusim/models/fullbody_meshes/radius.stl +0 -0
  530. diffneusim/models/fullbody_meshes/sacrum.stl +0 -0
  531. diffneusim/models/fullbody_meshes/scaphoid.stl +0 -0
  532. diffneusim/models/fullbody_meshes/scapula.stl +0 -0
  533. diffneusim/models/fullbody_meshes/thoracic10_s.stl +0 -0
  534. diffneusim/models/fullbody_meshes/thoracic11_s.stl +0 -0
  535. diffneusim/models/fullbody_meshes/thoracic12_s.stl +0 -0
  536. diffneusim/models/fullbody_meshes/thoracic1_s.stl +0 -0
  537. diffneusim/models/fullbody_meshes/thoracic2_s.stl +0 -0
  538. diffneusim/models/fullbody_meshes/thoracic3_s.stl +0 -0
  539. diffneusim/models/fullbody_meshes/thoracic4_s.stl +0 -0
  540. diffneusim/models/fullbody_meshes/thoracic5_s.stl +0 -0
  541. diffneusim/models/fullbody_meshes/thoracic6_s.stl +0 -0
  542. diffneusim/models/fullbody_meshes/thoracic7_s.stl +0 -0
  543. diffneusim/models/fullbody_meshes/thoracic8_s.stl +0 -0
  544. diffneusim/models/fullbody_meshes/thoracic9_s.stl +0 -0
  545. diffneusim/models/fullbody_meshes/thorax.stl +0 -0
  546. diffneusim/models/fullbody_meshes/thumbdist.stl +0 -0
  547. diffneusim/models/fullbody_meshes/thumbprox.stl +0 -0
  548. diffneusim/models/fullbody_meshes/trapezium.stl +0 -0
  549. diffneusim/models/fullbody_meshes/trapezoid.stl +0 -0
  550. diffneusim/models/fullbody_meshes/triquetrum.stl +0 -0
  551. diffneusim/models/fullbody_meshes/ulna.stl +0 -0
  552. diffneusim/models/source/myo_fullbody/UPSTREAM.md +91 -0
  553. diffneusim/models/source/myoleg/UPSTREAM.md +52 -0
  554. diffneusim/models/source/unitree_g1/LICENSE.mjlab +202 -0
  555. diffneusim/models/source/unitree_g1/UPSTREAM.md +38 -0
  556. diffneusim/models/source/unitree_g1/assets/head_link.STL +0 -0
  557. diffneusim/models/source/unitree_g1/assets/left_ankle_pitch_link.STL +0 -0
  558. diffneusim/models/source/unitree_g1/assets/left_ankle_roll_link.STL +0 -0
  559. diffneusim/models/source/unitree_g1/assets/left_elbow_link.STL +0 -0
  560. diffneusim/models/source/unitree_g1/assets/left_hip_pitch_link.STL +0 -0
  561. diffneusim/models/source/unitree_g1/assets/left_hip_roll_link.STL +0 -0
  562. diffneusim/models/source/unitree_g1/assets/left_hip_yaw_link.STL +0 -0
  563. diffneusim/models/source/unitree_g1/assets/left_knee_link.STL +0 -0
  564. diffneusim/models/source/unitree_g1/assets/left_rubber_hand.STL +0 -0
  565. diffneusim/models/source/unitree_g1/assets/left_shoulder_pitch_link.STL +0 -0
  566. diffneusim/models/source/unitree_g1/assets/left_shoulder_roll_link.STL +0 -0
  567. diffneusim/models/source/unitree_g1/assets/left_shoulder_yaw_link.STL +0 -0
  568. diffneusim/models/source/unitree_g1/assets/left_wrist_pitch_link.STL +0 -0
  569. diffneusim/models/source/unitree_g1/assets/left_wrist_roll_link.STL +0 -0
  570. diffneusim/models/source/unitree_g1/assets/left_wrist_yaw_link.STL +0 -0
  571. diffneusim/models/source/unitree_g1/assets/logo_link.STL +0 -0
  572. diffneusim/models/source/unitree_g1/assets/pelvis.STL +0 -0
  573. diffneusim/models/source/unitree_g1/assets/pelvis_contour_link.STL +0 -0
  574. diffneusim/models/source/unitree_g1/assets/right_ankle_pitch_link.STL +0 -0
  575. diffneusim/models/source/unitree_g1/assets/right_ankle_roll_link.STL +0 -0
  576. diffneusim/models/source/unitree_g1/assets/right_elbow_link.STL +0 -0
  577. diffneusim/models/source/unitree_g1/assets/right_hip_pitch_link.STL +0 -0
  578. diffneusim/models/source/unitree_g1/assets/right_hip_roll_link.STL +0 -0
  579. diffneusim/models/source/unitree_g1/assets/right_hip_yaw_link.STL +0 -0
  580. diffneusim/models/source/unitree_g1/assets/right_knee_link.STL +0 -0
  581. diffneusim/models/source/unitree_g1/assets/right_rubber_hand.STL +0 -0
  582. diffneusim/models/source/unitree_g1/assets/right_shoulder_pitch_link.STL +0 -0
  583. diffneusim/models/source/unitree_g1/assets/right_shoulder_roll_link.STL +0 -0
  584. diffneusim/models/source/unitree_g1/assets/right_shoulder_yaw_link.STL +0 -0
  585. diffneusim/models/source/unitree_g1/assets/right_wrist_pitch_link.STL +0 -0
  586. diffneusim/models/source/unitree_g1/assets/right_wrist_roll_link.STL +0 -0
  587. diffneusim/models/source/unitree_g1/assets/right_wrist_yaw_link.STL +0 -0
  588. diffneusim/models/source/unitree_g1/assets/torso_link_rev_1_0.STL +0 -0
  589. diffneusim/models/source/unitree_g1/assets/waist_roll_link_rev_1_0.STL +0 -0
  590. diffneusim/models/source/unitree_g1/assets/waist_yaw_link_rev_1_0.STL +0 -0
  591. diffneusim/models/source/unitree_g1/dump_mjlab_reference.py +30 -0
  592. diffneusim/models/source/unitree_g1/g1.xml +308 -0
  593. diffneusim/models/source/unitree_g1/g1_constants.py +298 -0
  594. diffneusim/models/source/unitree_g1/mjlab_compiled_reference.json +857 -0
  595. diffneusim/models/unitree_g1.dnmodel +4393 -0
  596. diffneusim/models/unitree_g1_selfcol.dnmodel +20824 -0
  597. diffneusim/rl/__init__.py +2 -0
  598. diffneusim/rl/dynsyn_layer.py +146 -0
  599. diffneusim/rl/footstep_plan.py +337 -0
  600. diffneusim/rl/g1_bm_env.py +572 -0
  601. diffneusim/rl/g1_bm_eval.py +168 -0
  602. diffneusim/rl/g1_bm_fused.py +275 -0
  603. diffneusim/rl/g1_bm_ppo.py +622 -0
  604. diffneusim/rl/g1_bm_sapo.py +551 -0
  605. diffneusim/rl/g1_ppo.py +395 -0
  606. diffneusim/rl/g1_sapo_soft.py +240 -0
  607. diffneusim/rl/g1_soft_env.py +452 -0
  608. diffneusim/rl/g1_soft_grad.py +145 -0
  609. diffneusim/rl/geyer_curves_torch.py +108 -0
  610. diffneusim/rl/gpu_fullbody_vec_env.py +1241 -0
  611. diffneusim/rl/imitation.py +2027 -0
  612. diffneusim/rl/imitation_reward_v2.py +248 -0
  613. diffneusim/rl/imitation_reward_v3.py +349 -0
  614. diffneusim/rl/latent_task.py +175 -0
  615. diffneusim/rl/llc_reward.py +316 -0
  616. diffneusim/rl/millard_curves_torch.py +154 -0
  617. diffneusim/rl/mirror_symmetry.py +212 -0
  618. diffneusim/rl/model_path.py +35 -0
  619. diffneusim/rl/mvae_recon.py +123 -0
  620. diffneusim/rl/nets_shac.py +599 -0
  621. diffneusim/rl/reset_pool.py +154 -0
  622. diffneusim/rl/sapo_capture.py +873 -0
  623. diffneusim/rl/sapo_vec.py +1051 -0
  624. diffneusim/rl/shac_vec.py +346 -0
  625. diffneusim/rl/state_prior.py +151 -0
  626. diffneusim/rl/step_library.py +105 -0
  627. diffneusim/rl/task_walk_env.py +1793 -0
  628. diffneusim/rl/task_walk_reward.py +3300 -0
  629. diffneusim/run.py +23 -0
  630. diffneusim/run_env.py +46 -0
  631. diffneusim/tasks/__init__.py +147 -0
  632. diffneusim/tasks/legacy_names.py +63 -0
  633. diffneusim/tasks/paths.py +79 -0
  634. diffneusim/tasks/settings.py +202 -0
  635. diffneusim/third_party/instantmimic_947430ee/LICENSE +202 -0
  636. diffneusim/third_party/instantmimic_947430ee/NOTICE +19 -0
  637. diffneusim/third_party/instantmimic_947430ee/README.md +31 -0
  638. diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/benchmark_protocol.py +106 -0
  639. diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/metrics.py +214 -0
  640. diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/reference.py +513 -0
  641. diffneusim/third_party/instantmimic_947430ee/instantmimic/motion/quaternion.py +193 -0
  642. diffneusim/train/__init__.py +0 -0
  643. diffneusim/train/eval_ckpt.py +239 -0
  644. diffneusim/train/eval_mimic.py +133 -0
  645. diffneusim/train/gait_report.py +203 -0
  646. diffneusim/train/gcot_chain.py +51 -0
  647. diffneusim/train/levers.py +135 -0
  648. diffneusim/train/masked_reset.py +314 -0
  649. diffneusim/train/rl_algorithm_suite.py +917 -0
  650. diffneusim/train/train14.py +240 -0
  651. diffneusim/train/train_tw14.py +674 -0
  652. diffneusim/viz/__init__.py +5 -0
  653. diffneusim/viz/__main__.py +41 -0
  654. diffneusim/viz/camera.py +115 -0
  655. diffneusim/viz/dnrec.py +118 -0
  656. diffneusim/viz/dnrec_io.py +686 -0
  657. diffneusim/viz/hud.py +565 -0
  658. diffneusim/viz/meshes.py +458 -0
  659. diffneusim/viz/play.py +237 -0
  660. diffneusim/viz/record.py +74 -0
  661. diffneusim/viz/render.py +1402 -0
  662. diffneusim/viz/renderer.py +268 -0
  663. diffneusim/viz/rl_env_render.py +635 -0
  664. diffneusim/viz/snapshot.py +54 -0
  665. diffneusim/viz/strobe.py +124 -0
  666. diffneusim/viz/to_mp4.py +58 -0
  667. diffneusim/viz/ui.py +481 -0
  668. diffneusim/viz/viewer.py +2086 -0
  669. diffneusim-1.0.0.dist-info/METADATA +226 -0
  670. diffneusim-1.0.0.dist-info/RECORD +682 -0
  671. diffneusim-1.0.0.dist-info/WHEEL +5 -0
  672. diffneusim-1.0.0.dist-info/licenses/LICENSE +201 -0
  673. diffneusim-1.0.0.dist-info/licenses/LICENSES/BSD-3-Clause-NC-ARMS-hand-wrist-4.3.txt +20 -0
  674. diffneusim-1.0.0.dist-info/licenses/LICENSES/BSD-3-Clause-NC-MoBL-ARMS.txt +25 -0
  675. diffneusim-1.0.0.dist-info/licenses/LICENSES/CC-BY-3.0-OpenSim-geometry.txt +25 -0
  676. diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Christophy2012-lumbarspine.txt +10 -0
  677. diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Lai2017-model-high-flex.txt +10 -0
  678. diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Lee2015-hand_muscle.txt +11 -0
  679. diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Rajagopal2016-full_body.txt +11 -0
  680. diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Uhlrich2022-fbmodpassivecal.txt +10 -0
  681. diffneusim-1.0.0.dist-info/licenses/NOTICE +274 -0
  682. diffneusim-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,2 @@
1
+ """diffneusim.rl: the learning side on top of the engine: the environments (full body, task walking, imitation, the G1), their rewards
2
+ and the SAPO learner."""
@@ -0,0 +1,146 @@
1
+ """DynSyn (Dynamical Synergies, Cheng et al. ICML 2024; arXiv:2407.11472) action layer.
2
+
3
+ Faithful port of the DynSyn reparameterization from the reference repo
4
+ (github.com/Beanpow/DynSyn, dynsyn/algorithms/common/dynsynLayer.py:DynSynLayerBase).
5
+ DEMO-FREE: the muscle grouping (`bins`) is derived from the model's own passive dynamics
6
+ (tools/dynsyn_gen.py), never from motion-capture data.
7
+
8
+ What the reference layer does (dynsynLayer.py:42-65):
9
+ * A low-dim policy emits one action per synergy group (`muscle_group_num` = k values).
10
+ * `repeat_replace_x` (line 42): `x.repeat_interleave(group_dims)` broadcasts each group's
11
+ single action to every muscle in that group, then `x[..., muscle_indx]` de-permutes back
12
+ to the model's muscle order. => every muscle in a group receives the SAME base action.
13
+ * Within-group weight (line 56-63): a separate head produces one weight per NON-first muscle
14
+ of each multi-muscle group; `weight = clamp(w*0.1, -amp, +amp) + 1` (bounded near 1) scales
15
+ those muscles. The first muscle of each group keeps the raw group action. `amp` (== the
16
+ reference `dynsyn_weight_amp`, capped 0.1) is annealed 0 -> 0.1 (utils.py:relu_like), so
17
+ early training is a PURE synergy (amp=0 => all weights exactly 1).
18
+
19
+ This module is a differentiable torch layer (index-gather + scatter), so the SHAC/RPO pathwise
20
+ gradient flows unchanged from the per-muscle activations back to the k-dim policy output.
21
+
22
+ Deviations from the reference (documented, not invented):
23
+ * The reference draws the group action and the within-group weight from separate distributions
24
+ (the weight from a fixed-std SquashedGaussian). Our ActorStochasticMLP has a single output
25
+ head, so both are columns of ONE actor output already squashed by the env's tanh (_env_action).
26
+ That matches the reference's squashed samples column-for-column (group action in [-1,1], weight
27
+ input in [-1,1] -> *0.1 -> clamp(+-amp) -> +1); the only difference is the weight columns share
28
+ the actor's learnable per-dim logstd instead of a fixed dynsyn_log_std. Weight is OPT-IN and OFF
29
+ by default (DN_DYNSYN_WEIGHT=0), so the primary experiment is the pure grouping (== the
30
+ reference's amp=0 regime).
31
+ """
32
+ import json
33
+ import pathlib
34
+
35
+ import torch
36
+
37
+
38
+ def load_bins(path):
39
+ """Load the DynSyn grouping (list[list[int]]) from the JSON produced by tools/dynsyn_gen.py."""
40
+ p = pathlib.Path(path)
41
+ data = json.loads(p.read_text())
42
+ bins = data["bins"] if isinstance(data, dict) else data
43
+ return [[int(m) for m in grp] for grp in bins]
44
+
45
+
46
+ class DynSynExpander:
47
+ """Maps a k-dim (per-synergy-group) policy action in [-1,1] to nm per-muscle actions in [-1,1].
48
+
49
+ Mirrors DynSynLayerBase.repeat_replace_x + the within-group weight. Not an nn.Module (holds no
50
+ parameters): the grouping is a FIXED downstream map, exactly as the reference bakes `bins` into
51
+ the layer. `num_actions` is what the policy must output (k, or k + n_weight when weight is on).
52
+ """
53
+
54
+ def __init__(self, bins, nm, device, weight=False, amp=0.0):
55
+ self.bins = [list(g) for g in bins]
56
+ self.k = len(self.bins)
57
+ self.nm = int(nm)
58
+ assert sum(len(g) for g in self.bins) == self.nm, (sum(len(g) for g in self.bins), self.nm)
59
+ assert sorted(m for g in self.bins for m in g) == list(range(self.nm)), "bins must partition 0..nm-1"
60
+
61
+ # group_of_muscle[m] = the group index whose base action muscle m receives (the gather map
62
+ # that reproduces repeat_interleave + de-permute in one indexing op).
63
+ gom = torch.empty(self.nm, dtype=torch.long)
64
+ for g, grp in enumerate(self.bins):
65
+ for m in grp:
66
+ gom[m] = g
67
+ self.group_of_muscle = gom.to(device)
68
+
69
+ # Non-first muscles of each multi-muscle group, in the reference's group-then-tail order
70
+ # (dynsynLayer.py:19-25). weight_input column j scales muscle weight_muscle_indx[j].
71
+ widx = []
72
+ for grp in self.bins:
73
+ if len(grp) > 1:
74
+ widx.extend(grp[1:])
75
+ self.weight_muscle_indx = torch.tensor(widx, dtype=torch.long, device=device)
76
+ self.n_weight = len(widx)
77
+ self.weight = bool(weight)
78
+ self.amp = float(amp)
79
+ self.num_actions = self.k + (self.n_weight if self.weight else 0)
80
+
81
+ def expand(self, actions):
82
+ """actions (B, num_actions) in [-1,1] -> (B, nm) in [-1,1]. Differentiable."""
83
+ group_action = actions[:, : self.k]
84
+ x = group_action[:, self.group_of_muscle] # (B, nm) group broadcast
85
+ if self.weight and self.amp > 0.0 and self.n_weight > 0:
86
+ w_in = actions[:, self.k :] # (B, n_weight) squashed in [-1,1]
87
+ w = torch.clamp(w_in * 0.1, -self.amp, self.amp) + 1.0 # bounded near 1 (reference line 59)
88
+ wfull = x.new_ones(x.shape).index_copy(1, self.weight_muscle_indx, w)
89
+ x = torch.clamp(x * wfull, -1.0, 1.0) # reference DynSynSACLayer clamp
90
+ return x
91
+
92
+
93
+ def model_digest(model_path):
94
+ """sha256 of a .dnmodel, the identity an action basis is only valid against."""
95
+ import hashlib
96
+ import pathlib
97
+ return hashlib.sha256(pathlib.Path(model_path).read_bytes()).hexdigest()
98
+
99
+
100
+ def load_basis(path, model_path):
101
+ """Load an SVD action-basis V (nm,k) from the npz produced by tools/svd_basis_gen.py.
102
+
103
+ REQUIRES the model the basis was built for and fails if it is not the one in use. V is the top-k right
104
+ singular basis of the EXACT `d(qd')/du` Jacobian, so it is a property of a specific .dnmodel: change the
105
+ muscle geometry and the same file silently becomes the wrong reduction. That is not hypothetical --
106
+ 2026-07-28 the global k=20 basis predated the LTpT_T12 mirror repair and the symmetrize pipeline stage,
107
+ and because nothing recorded the model, only a hand audit of file mtimes caught it. Worse, the trunk's
108
+ share of the basis had changed (1/20 trunk-dominated columns -> 0/20), so the stale file would have
109
+ trained a policy with no trunk actuator and nothing would have said so.
110
+ """
111
+ import numpy as np
112
+ d = np.load(path)
113
+ assert "model_sha256" in d, (
114
+ f"{path} carries no model_sha256, so it cannot be checked against the model in use -- regenerate it "
115
+ f"with tools/svd_basis_gen.py (a basis is only valid for the .dnmodel whose Jacobian produced it)")
116
+ want, got = str(d["model_sha256"]), model_digest(model_path)
117
+ assert want == got, (
118
+ f"action basis {path} was built for a DIFFERENT model: basis expects sha256 {want[:16]}... "
119
+ f"(model {str(d['model']) if 'model' in d else '?'}), but {model_path} is {got[:16]}.... The basis is "
120
+ f"the top-k singular basis of that model's action->dynamics Jacobian, so using it here silently "
121
+ f"applies the wrong reduction. Regenerate: tools/svd_basis_gen.py --env <env> ... --out {path}")
122
+ return torch.tensor(d["V"], dtype=torch.float32)
123
+
124
+
125
+ class LinearBasisExpander:
126
+ """Maps a k-dim latent z in [-1,1] to nm per-muscle actions via a FIXED linear basis: a = clamp(V z, -1,1).
127
+
128
+ V (nm,k) = SVD top-k right singular vectors of the EXACT action->dynamics Jacobian (svd_basis_gen.py) --
129
+ the minimum-reconstruction-error rank-k linear reduction of the muscle->dynamics map, the spectrum-
130
+ optimal alternative to the DynSyn/moment-arm hard grouping. Differentiable dense matmul, so the pathwise
131
+ gradient flows from the nm activations to the k-dim policy. `num_actions` = k; drop-in for DynSynExpander
132
+ (same .expand / .num_actions), selected via DN_SVD_BASIS (mutually exclusive with DN_DYNSYN bins).
133
+ """
134
+
135
+ def __init__(self, V, nm, device, a_rest=0.0):
136
+ assert V.shape[0] == int(nm), (V.shape, nm)
137
+ self.V = V.to(device) # (nm, k)
138
+ self.nm = int(nm)
139
+ self.k = int(V.shape[1])
140
+ self.a_rest = float(a_rest) # rest-action offset: with out_bias 0, z=0 -> a=a_rest;
141
+ self.num_actions = self.k # a_rest~-0.9 => excitation ~0.05 => muscles start OFF
142
+ # (else V_k re-centers the out_bias -> muscles half-on)
143
+
144
+ def expand(self, z):
145
+ """z (B, k) in [-1,1] -> a (B, nm) in [-1,1]. Differentiable. a_rest sets the rest (z=0) activation."""
146
+ return torch.clamp(z @ self.V.t() + self.a_rest, -1.0, 1.0)
@@ -0,0 +1,337 @@
1
+ """DeepLoco's footstep plan (Peng et al. 2017), batched over envs, for the steering task (TASKWALK_FOOTSTEPS=1).
2
+
3
+ A line-by-line port of the released code (github.com/xbpeng/DeepLoco 518f502), our frame being world (x, y) with y to the LEFT
4
+ (DeepLoco's z points to the right: ResetStepPlan puts the right foot at z = +width / 2):
5
+
6
+ plan state mStance (the stance foot), mStepPos0 (the swing foot's target), mStepPos1 (the step after it, for the stance foot),
7
+ mRootHeading -> stance_left, p0, p1, heading
8
+ ResetStepPlan p0 = next_pos(swing, heading, stance foot), p1 = next_pos(stance, heading, p0) -> reset()
9
+ UpdateStepPlan at a stance switch: the foot that landed is checked against its target, |p0 - foot|^2 > step_fail_dist (1) is a
10
+ STEP FAIL (ENABLE_STEP_FAIL is defined: the episode ends); then heading = next_heading(heading),
11
+ p0 <- p1, p1 = next_pos(new stance, heading, p0) -> switch()
12
+ CalcNextHeading random: with probability step_sharp_turn_prob (0.1) a uniform turn in (-pi, pi), else N(0, step_max_heading_
13
+ turn_rate = 0.25 rad); target mode: atan2 toward the target from the plan's centre (p0 + p1) / 2; ADDED for our
14
+ eval's schedule mode (a scripted heading, DeepLoco has none): the schedule's heading at the switch -> next_heading()
15
+ CalcNextStepPos pos0 + R(heading) (L, +-W): the lateral offset to the side of the foot the step is FOR -> next_pos()
16
+ BuildTaskState the swing target relative to the swing foot and the next target relative to the stance foot, in the root's
17
+ heading frame, plus the plan heading -> obs()
18
+ CalcRewardStep end_eff_w exp(-end_eff_scale (5) end_eff_err): in the step's second half the swing foot's squared distance
19
+ to its target joins end_eff_err, which otherwise holds only the end effectors' errors to the kinematic
20
+ reference; with no reference (a predictive arm) that error is 0, so the term pays its full weight in the
21
+ first half and exp(-5 |p0 - foot|^2) of it in the second -> reward()
22
+
23
+ What differs, and why (docs-dev/deeploco/20261023_0215_realign; every difference named):
24
+ - the step length L and width W come from the human at the commanded speed (tools/steer/footstep_fit.py, Fukuchi 2018 at our
25
+ leg length), not DeepLoco's fixed 0.5 m / 0.15 m, because our task commands a speed and has no 0.5-s clock;
26
+ - the stance is the body's own, not DeepLoco's kinematic clock: the plan is (re)built at the FIRST foot strike after a reset
27
+ (a leg's summed vertical contact force rising past TASKWALK_FOOTSTEP_STRIKE_N; the mirror latch reads the same force at its own
28
+ 1 N, so in late swing the two can name different feet; the slots are by role, so the values stay consistent), from the foot
29
+ that landed, and then switches at each
30
+ strike of the swing foot. Until that first strike a provisional plan from the reset pose feeds the observation and nothing
31
+ is charged: the plan is world-anchored, so a reset-pose guess that is one step out of phase stays one step out for the whole
32
+ episode (measured: the padded walker landed a constant 0.6 m, one step, from every target, 2026-10-23 03:15). The step
33
+ phase is the time since the switch over the last step's duration;
34
+ - the observation keeps the heading as (sin, cos) beside the footstep deltas and uses one slot pair: under the mirror the stance
35
+ foot is always the canonical right, so DeepLoco's right / left slots collapse to one, the lateral components flipping with it;
36
+ - horizontal only (flat ground; DeepLoco's target height is the kinematic reference foot's, which a predictive arm does not have);
37
+ - two planner options, both off by default (DeepLoco's plan): REANCHOR rebuilds the next two targets from the foot that actually
38
+ landed at every switch (DeepLoco's world-anchored chain p0 <- p1 lets a miss carry into every later target: the design brief, 2026-10-23
39
+ 19:3x, "the agent never corrects from where the foot actually landed, so the gap keeps growing"; DeepLoco itself shifts the
40
+ next target by the landing error when the step fail is off, and its disabled ENABLE_ADAPTIVE_STEP_PLAN shifts both targets by
41
+ the landing error along world x); max_turn bounds the plan's heading change per step (a scripted command turning 90-180 deg at
42
+ once put the next target beside or behind the body, and the body fell stepping to it; a human takes a 180-deg turn in 2-3
43
+ steps), and the reset plan's first heading from the body's facing (ResetStepPlan aims it at the waypoint);
44
+ - three guards that DeepLoco's clock makes unnecessary, closing what a strike-driven switch opens (skeptic review 2026-10-23
45
+ 04:0x, docs-dev/deeploco/20261023_0315_footstep): a provisional plan pays nothing (else standing in double support after a
46
+ reset is paid the full weight forever); a STALL ends the step: no strike within stall_steps nominal step durations (L / v)
47
+ forces the update with the swing foot where it is, as DeepLoco's clock checks the foot wherever it is at each switch, so a
48
+ stopped character fails within two switches (stall_steps 2 is that bound); a provisional plan that sees no strike in the same
49
+ time becomes the plan. The step fail itself is priced as a fall by the env (task_walk_env._tw_reward);
50
+ - two strike guards, both off by default, that DeepLoco's clock also makes unnecessary (llc14x, 2026-10-25: 3 of 8 straight
51
+ starts ended in a step fail 0.1 s after the reset, the swing foot read as landed 1.3 m short of its target right after
52
+ the plan was laid; docs-dev/deeploco/20261024_2300_llc_14x). min_phase: a strike counts only once the time since the
53
+ switch (since the reset while provisional) is min_phase nominal step durations (L / v), the SIMBICON authors' rule
54
+ (Cartwheel-3D's minPhiBeforeTransitionOnFootContact 0.5 of the nominal step time; the MIT Cheetah disables touchdown
55
+ detection for 90% of the swing, Hyun et al. 2014). arm: a leg's strike counts only after its force has fallen under
56
+ the arming level since its last landing (the caller's `off`; two thresholds as in Grimmer et al. 2019's 400 N / 10 N), and
57
+ then it is LEVEL-triggered (Cartwheel's force > 20 N after the gate), so a push-off whose force dips under the strike
58
+ threshold and rises again is not a landing, and a foot that touched before the gate and stayed loaded strikes when the
59
+ gate opens. Sources and their settings: docs-dev/deeploco/20261024_2300_llc_14x/strike_guard/strike_guard_lit.md.
60
+ - one reward option, off by default, for the same clock: `landed` prices the LANDED foot instead of the foot in the air.
61
+ DeepLoco's second-half term reads the swing foot over a window its clock closes; here the strike closes it, so a body slower
62
+ than its plan collects the term with the heel parked near the target in the air and lands short (every LLC cell, M at 1.3:
63
+ the heel within 1-6 cm of the target, then 9-17 cm back before it lands; human clips 0, the imitation 1.1;
64
+ docs-dev/deeploco/20261026_1404_check8_engine_rebaseline/leg_reach). With `landed`, the same kernel reads the stance foot's
65
+ distance from the target it stepped to, over the first half of the step that follows its strike, and nothing in the second
66
+ half: the landing is fixed once the foot is down, so the policy cannot extend the window.
67
+
68
+ DeepLoco's own clock, `clock` seconds a step (0 = off: the strike-driven step above with its guards), for the reproduction (the design brief,
69
+ 2026-10-27 16:2x: "reproduce the paper as faithfully as we can and benchmark it"; docs-dev/deeploco/20261027_1645_deeploco_repro):
70
+ the stance switches when the step's time is up, wherever the feet are, as UpdateStepPlan runs on the kinematic character's stance
71
+ change (GetStance(kin_time); a 1-s cycle, 0.5 s a step, in the released code); the foot the clock now names as the stance foot is
72
+ checked against p0 there (the step fail, horizontal, squared distance against 1 m^2), then the same update. The plan is final at the
73
+ reset (ResetStepPlan), with the stance and the time already spent in the step read off the reset state's phase (the caller's t0;
74
+ DeepLoco's clock runs on from the sampled state's time). The step's phase is t / clock, so the second-half kernel and the step
75
+ clip's playback run on the clock. The strike guards and `landed` have nothing to do under it and are refused with it; the contacts
76
+ are not read. Our step geometry (L, W) stays the fit's at the command: the reproduction's fit file gives DeepLoco's fixed 0.5 m /
77
+ 0.15 m at its plan speed 1.0 m/s.
78
+ """
79
+ import json
80
+ import math
81
+
82
+ import torch
83
+
84
+
85
+ def step_geometry(fit, v_cmd):
86
+ """(n,) commanded speed -> (step length L, width W) in metres: the human's at the same Froude speed (footstep_fit.py); a fit
87
+ with "fixed_step" = [L, W] gives those at every speed (DeepLoco's plan: CalcNextStepPos at mCurrStepLen, step_length_min =
88
+ max = 0.5 and step_mean_width 0.15 in args/train_llc_args.txt)."""
89
+ if "fixed_step" in fit:
90
+ L, W = (float(x) for x in fit["fixed_step"])
91
+ return torch.full_like(v_cmd, L), torch.full_like(v_cmd, W)
92
+ g = 9.81
93
+ l0 = float(fit["l0"])
94
+ bc, bw = fit["cadence_star_poly"], fit["width_star_poly"]
95
+ vs = v_cmd / math.sqrt(g * l0)
96
+ cad = bc[0] * vs * vs + bc[1] * vs + bc[2] # cadence* = steps per second x sqrt(l0 / g)
97
+ sps = cad * math.sqrt(g / l0)
98
+ assert bool((sps > 0).all()), "the cadence fit went non-positive: a commanded speed far outside the human range"
99
+ L = v_cmd / sps
100
+ W = (bw[0] * vs + bw[1]) * l0
101
+ return L, W
102
+
103
+
104
+ def next_pos(for_left, heading, pos0, L, W):
105
+ """CalcNextStepPos: the target of the foot the step is FOR (for_left True = the left foot), one step L ahead of pos0 along
106
+ heading and W to that foot's side. DeepLoco: delta (L, 0, W), z negated for a left stance, rotated by the heading; z is right."""
107
+ lat = torch.where(for_left, W, -W) # y is LEFT here
108
+ c, s = torch.cos(heading), torch.sin(heading)
109
+ return torch.stack([pos0[0] + c * L - s * lat, pos0[1] + s * L + c * lat])
110
+
111
+
112
+ class FootstepPlan:
113
+ def __init__(self, n, device, fit, sigma=0.25, sharp_p=0.1, fail_dist=1.0, gen=None, stall_steps=2.0, sharp_max=math.pi,
114
+ reanchor=False, max_turn=math.pi, turn_from_body=False, min_phase=0.0, arm=False, landed=False, clock=0.0):
115
+ assert sigma >= 0.0 and 0.0 <= sharp_p <= 1.0 and fail_dist > 0.0 and stall_steps > 0.0, (sigma, sharp_p, fail_dist, stall_steps)
116
+ self.n, self.device, self.fit = n, device, fit
117
+ self.sigma, self.sharp_p, self.fail_dist, self.gen = float(sigma), float(sharp_p), float(fail_dist), gen
118
+ self.stall_steps = float(stall_steps)
119
+ # the sharp turn's range: DeepLoco's U(-pi, pi) by default; TASKWALK_HEADING_SHARP_MAX_DEG bounds it (a sharp turn beyond the
120
+ # per-step turns a human step can make is a step fail whatever the policy does)
121
+ assert 0.0 < sharp_max <= math.pi, sharp_max
122
+ self.sharp_max = float(sharp_max)
123
+ assert 0.0 < max_turn <= math.pi, max_turn
124
+ self.reanchor, self.max_turn = bool(reanchor), float(max_turn)
125
+ # TASKWALK_FOOTSTEP_TURN_FROM_BODY: max_turn bounds the plan's heading from the BODY's facing at each switch, not from the
126
+ # plan's previous heading (a body that turns 18 deg a step let a 70-deg-a-step plan lead it by up to 173 deg, the target
127
+ # behind it, under the re-anchored plan: fslibee, 2026-10-23 21:4x)
128
+ self.turn_from_body = bool(turn_from_body)
129
+ assert not self.turn_from_body or self.max_turn < math.pi, "TURN_FROM_BODY needs a turn bound"
130
+ # the strike guards (module docstring): min_phase in nominal step durations, 0 = off; arm = the two-threshold strike
131
+ assert 0.0 <= min_phase < float(stall_steps), (min_phase, stall_steps)
132
+ self.min_phase, self.arm = float(min_phase), bool(arm)
133
+ self.landed = bool(landed) # the reward option (module docstring)
134
+ # DeepLoco's clock (module docstring): > 0 = the seconds a step lasts; 0 = the strike-driven step
135
+ assert clock >= 0.0, clock
136
+ self.clock = float(clock)
137
+ assert not (self.clock > 0.0 and (self.landed or self.arm or self.min_phase > 0.0)), \
138
+ "the clock closes every step itself: the strike guards and the landed kernel are the strike-driven step's"
139
+ z = lambda: torch.zeros(n, device=device) # noqa: E731
140
+ self.stance_left = torch.zeros(n, dtype=torch.bool, device=device)
141
+ self.p0 = torch.zeros(2, n, device=device)
142
+ self.p1 = torch.zeros(2, n, device=device)
143
+ self.p_land = torch.zeros(2, n, device=device) # the target the stance foot stepped to (landed)
144
+ self.heading = z()
145
+ self.t = z() # seconds since the last stance switch
146
+ self.T = torch.ones(n, device=device) # the last step's duration (the step phase's denominator)
147
+ self.fail = torch.zeros(n, dtype=torch.bool, device=device)
148
+ self.forced = torch.zeros(n, dtype=torch.bool, device=device) # the last switch was a stall's, not a strike's
149
+ self.rebuilt = torch.zeros(n, dtype=torch.bool, device=device) # the last call rebuilt a provisional plan
150
+ self.pending = torch.ones(n, dtype=torch.bool, device=device) # provisional plan: rebuilt at the first strike after reset
151
+ self.prev_on = torch.zeros(2, n, dtype=torch.bool, device=device) # (right, left) contact at the last call: strike edges
152
+ self.armed = torch.zeros(2, n, dtype=torch.bool, device=device) # (right, left) unloaded since its last landing (arm)
153
+
154
+ def reset(self, mask, stance_left, stance_xy, heading, v_cmd, on, body_yaw=None, off=None, t0=None):
155
+ """A PROVISIONAL ResetStepPlan for the envs in `mask` (the swing foot's target one step ahead of the given stance foot,
156
+ then the next), observed until the first strike rebuilds it from the foot that landed (switch()). `on` = (right, left)
157
+ contact now, so a foot already loaded at reset is not read as a strike. With max_turn bounded and the body's yaw given, the
158
+ plan's first heading is at most max_turn from the body's facing (ResetStepPlan lays it toward the waypoint whatever the
159
+ facing: a waypoint behind put the first target behind the stance foot, a step fail within a second in every cell).
160
+ With the clock the plan is final at once (DeepLoco's ResetStepPlan), and t0 (n,) is the time already spent in the
161
+ current step (the clock runs on from the reset state's phase, as DeepLoco's kinematic character does)."""
162
+ assert (t0 is not None) == (self.clock > 0.0), "t0 is the clock's (and only the clock's) reset phase"
163
+ with torch.no_grad():
164
+ if body_yaw is not None and self.max_turn < math.pi:
165
+ dh = torch.remainder(heading - body_yaw + math.pi, 2.0 * math.pi) - math.pi
166
+ heading = body_yaw + dh.clamp(-self.max_turn, self.max_turn)
167
+ L, W = step_geometry(self.fit, v_cmd)
168
+ swing_left = ~stance_left
169
+ p0 = next_pos(swing_left, heading, stance_xy, L, W)
170
+ p1 = next_pos(stance_left, heading, p0, L, W)
171
+ m = mask
172
+ self.stance_left = torch.where(m, stance_left, self.stance_left)
173
+ self.p0 = torch.where(m[None], p0, self.p0)
174
+ self.p1 = torch.where(m[None], p1, self.p1)
175
+ self.p_land = torch.where(m[None], stance_xy, self.p_land)
176
+ self.heading = torch.where(m, heading, self.heading)
177
+ self.fail = torch.where(m, torch.zeros_like(self.fail), self.fail)
178
+ self.prev_on = torch.where(m[None], torch.stack(on), self.prev_on)
179
+ if self.clock > 0.0:
180
+ assert bool(((t0 >= 0.0) & (t0 < self.clock))[m].all()), "the reset phase lies inside one step"
181
+ self.t = torch.where(m, t0.to(self.t.dtype), self.t)
182
+ self.T = torch.where(m, torch.full_like(self.T, self.clock), self.T)
183
+ self.pending = self.pending & ~m
184
+ return
185
+ self.t = torch.where(m, torch.zeros_like(self.t), self.t)
186
+ self.T = torch.where(m, 1.0 / (v_cmd / L), self.T) # nominal: one step's time at the commanded speed
187
+ if self.arm: # a leg unloaded at the reset is armed
188
+ assert off is not None, "the armed strike needs each leg's unloaded flag (off) at the reset"
189
+ self.armed = torch.where(m[None], torch.stack(off), self.armed)
190
+ self.pending = self.pending | m
191
+
192
+ def next_heading(self, mask, target_xy=None, heading_cmd=None, body_yaw=None):
193
+ """CalcNextHeading for the envs in `mask` (random plan, toward a target from the plan's centre, or a scripted heading),
194
+ the change per step bounded to +-max_turn (from the body's yaw instead with turn_from_body)."""
195
+ assert target_xy is None or heading_cmd is None
196
+ if heading_cmd is not None:
197
+ want = heading_cmd
198
+ elif target_xy is not None:
199
+ c = 0.5 * (self.p0 + self.p1)
200
+ d = target_xy - c
201
+ far = (d * d).sum(0) > 0.01
202
+ want = torch.where(far, torch.atan2(d[1], d[0]), self.heading)
203
+ else:
204
+ sharp = torch.rand(self.n, device=self.device, generator=self.gen) < self.sharp_p
205
+ turn = (2.0 * torch.rand(self.n, device=self.device, generator=self.gen) - 1.0) * self.sharp_max
206
+ walk = self.sigma * torch.randn(self.n, device=self.device, generator=self.gen)
207
+ want = self.heading + torch.where(sharp, turn, walk)
208
+ delta = torch.remainder(want - self.heading + math.pi, 2.0 * math.pi) - math.pi
209
+ if heading_cmd is None and target_xy is None:
210
+ delta = want - self.heading # the random walk's own draw (not wrapped: a +-pi draw stays)
211
+ delta = delta.clamp(-self.max_turn, self.max_turn)
212
+ h = self.heading + delta
213
+ if self.turn_from_body:
214
+ assert body_yaw is not None, "TURN_FROM_BODY: the switch needs the body's yaw"
215
+ lead = torch.remainder(h - body_yaw + math.pi, 2.0 * math.pi) - math.pi
216
+ h = body_yaw + lead.clamp(-self.max_turn, self.max_turn)
217
+ return torch.where(mask, h, self.heading)
218
+
219
+ def switch(self, on, feet_xy, v_cmd, dt, target_xy=None, heading_cmd=None, body_yaw=None, off=None):
220
+ """One control step: advance the step clock; where the SWING foot struck (its contact's rising edge; on = (right, left)
221
+ contact now), UpdateStepPlan; where a provisional plan sees its first strike, ResetStepPlan from the foot that landed (a
222
+ simultaneous strike of both counts as the right's, the mirror latch's rule); where no strike came within stall_steps
223
+ nominal steps, the update is forced with the swing foot where it is. feet_xy = (right, left) each (2, n) world positions
224
+ (detached). Sets self.fail where the landing foot is more than fail_dist (a DISTANCE in metres; DeepLoco compares the
225
+ squared distance with step_fail_dist directly, the same at 1) from its target. With the guards on (module docstring), a
226
+ strike also needs the gate (min_phase) and, with arm, `off` = (right, left) each leg under its arming level now.
227
+ With the clock: the step ends when its time is up, wherever the feet are (DeepLoco's UpdateStepPlan on the kinematic
228
+ clock's stance change), the contacts unread; the same update follows."""
229
+ with torch.no_grad():
230
+ on = torch.stack(on)
231
+ strike = on & ~self.prev_on
232
+ self.prev_on = on
233
+ L, W = step_geometry(self.fit, v_cmd)
234
+ if self.clock > 0.0:
235
+ assert not bool(self.pending.any()), "a clock plan is never provisional"
236
+ now = self.t + dt # the step's time after this control step's physics
237
+ sw = now + 0.5 * dt >= self.clock # half a control step of slack for the summed dt
238
+ self.forced = torch.zeros_like(sw)
239
+ else:
240
+ if self.arm: # level-triggered once unloaded since the last landing
241
+ assert off is not None, "the armed strike needs each leg's unloaded flag (off)"
242
+ self.armed = self.armed | torch.stack(off)
243
+ strike = on & self.armed
244
+ if self.min_phase > 0.0:
245
+ strike = strike & (self.t >= self.min_phase * (L / v_cmd))[None]
246
+ stall = self.t >= self.stall_steps * (L / v_cmd) # no strike within stall_steps nominal steps
247
+ struck = torch.where(self.stance_left, strike[0], strike[1]) & ~self.pending
248
+ self.forced = stall & ~struck & ~self.pending
249
+ sw = struck | self.forced
250
+ new_stance_left = self.stance_left ^ sw
251
+ landed = torch.where(new_stance_left[None], feet_xy[1], feet_xy[0]) # the new stance foot = the foot that landed
252
+ d = self.p0 - landed
253
+ self.fail = sw & ((d * d).sum(0) > self.fail_dist ** 2)
254
+ heading = self.next_heading(sw, target_xy, heading_cmd, body_yaw)
255
+ if self.reanchor: # the next targets from the foot that actually landed
256
+ p0n = next_pos(~new_stance_left, heading, landed, L, W)
257
+ else: # DeepLoco's chain: the old next target becomes the target
258
+ p0n = self.p1
259
+ p1n = next_pos(new_stance_left, heading, p0n, L, W)
260
+ self.p_land = torch.where(sw[None], self.p0, self.p_land) # the target the foot that landed stepped to
261
+ self.p0 = torch.where(sw[None], p0n, self.p0)
262
+ self.p1 = torch.where(sw[None], p1n, self.p1)
263
+ self.heading = heading
264
+ if self.clock > 0.0: # every step lasts the clock's time, the remainder kept
265
+ self.t = torch.where(sw, now - self.clock, now)
266
+ self.stance_left = new_stance_left
267
+ self.rebuilt = torch.zeros_like(sw)
268
+ return sw
269
+ self.T = torch.where(sw, self.t.clamp(min=0.2), self.T)
270
+ self.t = torch.where(sw, torch.zeros_like(self.t), self.t) + dt
271
+ self.stance_left = new_stance_left
272
+ if self.arm: # the foot that landed (or was forced down) disarms
273
+ self.armed = self.armed & ~torch.stack([sw & ~new_stance_left, sw & new_stance_left])
274
+ # the first strike after a reset: the plan from the foot that landed (random mode keeps the reset's heading)
275
+ prov_stall = self.pending & stall & ~strike.any(0) # a provisional plan with no strike becomes the plan
276
+ self.pending = self.pending & ~prov_stall
277
+ self.t = torch.where(prov_stall, torch.full_like(self.t, dt), self.t)
278
+ first = self.pending & strike.any(0)
279
+ first_left = strike[1] & ~strike[0]
280
+ landed0 = torch.where(first_left[None], feet_xy[1], feet_xy[0])
281
+ h0 = (self.next_heading(first, target_xy, heading_cmd, body_yaw) if (target_xy is not None or heading_cmd is not None)
282
+ else self.heading)
283
+ q0 = next_pos(~first_left, h0, landed0, L, W)
284
+ q1 = next_pos(first_left, h0, q0, L, W)
285
+ self.p0 = torch.where(first[None], q0, self.p0)
286
+ self.p1 = torch.where(first[None], q1, self.p1)
287
+ self.p_land = torch.where(first[None], landed0, self.p_land) # the plan starts at this foot: no landing error
288
+ self.heading = torch.where(first, h0, self.heading)
289
+ self.stance_left = torch.where(first, first_left, self.stance_left)
290
+ if self.arm:
291
+ self.armed = self.armed & ~torch.stack([first & ~first_left, first & first_left])
292
+ self.T = torch.where(first, L / v_cmd, self.T)
293
+ self.t = torch.where(first, torch.full_like(self.t, dt), self.t)
294
+ self.pending = self.pending & ~first
295
+ self.rebuilt = first # a new plan step that is not a switch (step library)
296
+ return sw
297
+
298
+ def obs(self, feet_xy, yaw):
299
+ """BuildTaskState: (n, 4) = the swing target relative to the swing foot and the next target relative to the stance foot,
300
+ (forward, left) in the root's heading frame. IN THE GRAPH through feet_xy and yaw (the targets are exogenous)."""
301
+ swing = torch.where(self.stance_left[None], feet_xy[0], feet_xy[1])
302
+ stance = torch.where(self.stance_left[None], feet_xy[1], feet_xy[0])
303
+ c, s = torch.cos(yaw), torch.sin(yaw)
304
+ out = []
305
+ for d in (self.p0 - swing, self.p1 - stance):
306
+ out += [c * d[0] + s * d[1], -s * d[0] + c * d[1]]
307
+ return torch.stack(out, 1)
308
+
309
+ def reward(self, feet_xy, scale=5.0, extra_err=None):
310
+ """CalcRewardStep's end-effector term with no reference error: exp(-scale |p0 - swing foot|^2) in the step's second half,
311
+ exp(0) = 1 in its first (DeepLoco's end_eff_err holds only reference errors there), 0 while the plan is provisional;
312
+ (n,), in the graph through feet_xy. With `landed`: exp(-scale |p_land - stance foot|^2) in the step's FIRST half, the
313
+ stance foot being the one that struck at the step's start, and exp(0) in its second."""
314
+ if self.landed:
315
+ stance = torch.where(self.stance_left[None], feet_xy[1], feet_xy[0])
316
+ d = self.p_land - stance
317
+ early = ((self.t / self.T) <= 0.5) & ~self.pending
318
+ err = (d * d).sum(0) * early.to(d.dtype)
319
+ else:
320
+ swing = torch.where(self.stance_left[None], feet_xy[0], feet_xy[1])
321
+ d = self.p0 - swing
322
+ late = ((self.t / self.T) > 0.5) & ~self.pending
323
+ err = (d * d).sum(0) * late.to(d.dtype)
324
+ if extra_err is not None: # DeepLoco's end-effector error (the env's TASKWALK_STEP_EE)
325
+ err = err + extra_err
326
+ return torch.exp(-scale * err) * (~self.pending).to(d.dtype)
327
+
328
+
329
+ def load_fit(path):
330
+ fit = json.load(open(path))
331
+ if "fixed_step" in fit:
332
+ L, W = fit["fixed_step"]
333
+ assert 0.0 < L < 1.5 and 0.0 <= W < 0.5, (path, fit["fixed_step"])
334
+ return fit
335
+ for k in ("l0", "cadence_star_poly", "width_star_poly"):
336
+ assert k in fit, (path, k)
337
+ return fit