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,443 @@
1
+ #pragma once
2
+ // D16 adjoint (engine B, 2026-11-02): the row + PD reverse of rows_adj.h reorganized for one warp per world (NablaEngine's
3
+ // shape), the same math in a different summation order (gated against rows_adj.h, host f64 <= 1e-12; on the device f64 against
4
+ // host, f32 against f64). Phases, each lane writing only its own slots (deterministic, no float atomics):
5
+ // F lane = body, root to leaf: for x in {lambda, a*, v} the twist of every body (Om_b(x), V_b(x) at the body origin), so a
6
+ // point p on body b moves at V_b + Om_b x (p - xpos_b) (kin.h point_jacobian's columns summed against x);
7
+ // C lane = contact (batches of kConBatch): the primal contact (collide at the pair / slot, make_frame, mu), its rows (J_r x =
8
+ // d_r . dV(x), imp, D, aref), their cotangents, p_bar = sum_x W_x x (Om_2(x) - Om_1(x)), the frame / collider reverse
9
+ // (rows_adj.h helpers) -> the two geoms' body pose cotangents (direct), and the deposit (W_x, p x W_x) for D;
10
+ // D lane = body, contacts in order: the deposits at b2 (+) and b1 (-), into the lane's subtree accumulator;
11
+ // B lane = body, leaf to root: subtree sums; each body's dofs: axis / anchor cotangents -> xrot_bar / xpos_bar, and the
12
+ // pull-back of W_v (aref's J v) -> v_bar;
13
+ // L lane = joint: limit rows (J = +-1 at the dof): v_bar, q_bar; P lane = dof: PD (u_bar, q_bar, v_bar).
14
+ // The model is read through Tab (d5's body accessor, rnea_adj.h) and CTab (contact / joint / actuator data, below).
15
+ #include <cstdint>
16
+
17
+ #include "shell_adj.h" // ADJ_STAMP (L5 section timers, compiled out by default)
18
+ #include "tree_adj.h" // d5: rnea_adj.h (lanes, Tab) + the pose layout (pose_xpos / pose_xquat)
19
+ #include "rows_adj.h"
20
+
21
+ namespace js::soft::adj {
22
+
23
+ constexpr int kConBatch = 12; // contacts per batch of phase C (shared words: kConBatch x kConRec; 12 so that the twists,
24
+ // a batch and an FK pose (224) fit the shell's 1,152-word staging scratch)
25
+ constexpr int kConRec = 24; // W_x 9, p 3, direct pose cotangents of the two bodies 6 + 6
26
+ constexpr int kTw = 18;
27
+ constexpr uint32_t kRowsNoContact = 1u << 8; // flag: a recorded contact did not reproduce in the recompute (its rows are skipped:
28
+ // the gradient is not valid; the trainer reads the flag once per iteration) // per body: Om_x 9, V_x 9 (phase F), reused as the subtree message (phase B)
29
+
30
+ // The contact / joint / actuator model as the reverse reads it: VIEWS whose fields are already the derived law values (K, B, the
31
+ // clamped solimp, tran, the joint's dof invweight0), of the parameter type P (double on the host and the f64 gate, float on the f32
32
+ // device path: L5 (i), no FP64 in the f32 kernel). Hook 2: the scalable fields (K, B, imp, margin, mu0) are what an accessor scales;
33
+ // the derived values (cR, dA, imp, its derivative) are recomputed from them per contact (README / EXTENSION_HOOKS.md).
34
+ template <class P> struct PairV { int g1, g2, condim, foot; P margin, gap, mu0, tran, imp[5]; KBT<P> kb; };
35
+ template <class P> struct GeomV { int body, type; P size[3], pos[3], quat[4]; };
36
+ template <class P> struct JointV { int dof, qadr; bool limited; P range[2], margin, diw, imp[5]; KBT<P> kb; };
37
+ template <class P> struct ActV { int dof; P kp, kd; };
38
+
39
+ template <class P> inline PairV<P> pair_view(const SoftPair& pr, const SoftGeom* geoms, const double* body_iw, double timestep) {
40
+ const SolParam sp = sol_param(pr.solref, pr.solimp, timestep);
41
+ const KB kb = stiffness_damping(sp, false);
42
+ PairV<P> v;
43
+ v.g1 = pr.g1; v.g2 = pr.g2; v.condim = pr.condim; v.foot = pr.foot;
44
+ v.margin = P(pr.margin); v.gap = P(pr.gap); v.mu0 = P(pr.friction[0]);
45
+ v.tran = P(body_iw[geoms[pr.g1].body] + body_iw[geoms[pr.g2].body]);
46
+ for (int k = 0; k < 5; ++k) v.imp[k] = P(sp.imp[k]);
47
+ v.kb = KBT<P>{P(kb.K), P(kb.B)};
48
+ return v;
49
+ }
50
+ template <class P> inline GeomV<P> geom_view(const SoftGeom& sg) {
51
+ GeomV<P> v;
52
+ v.body = sg.body; v.type = sg.type;
53
+ for (int k = 0; k < 3; ++k) { v.size[k] = P(sg.size[k]); v.pos[k] = P(sg.pos[k]); }
54
+ for (int k = 0; k < 4; ++k) v.quat[k] = P(sg.quat[k]);
55
+ return v;
56
+ }
57
+ template <class P> inline JointV<P> joint_view(const SoftJoint& jt, const double* dof_iw, double timestep) {
58
+ const SolParam sp = sol_param(jt.solref, jt.solimp, timestep);
59
+ const KB kb = stiffness_damping(sp, false);
60
+ JointV<P> v;
61
+ v.dof = jt.dof; v.qadr = jt.qadr; v.limited = jt.limited;
62
+ v.range[0] = P(jt.range[0]); v.range[1] = P(jt.range[1]); v.margin = P(jt.margin); v.diw = P(dof_iw[jt.dof]);
63
+ for (int k = 0; k < 5; ++k) v.imp[k] = P(sp.imp[k]);
64
+ v.kb = KBT<P>{P(kb.K), P(kb.B)};
65
+ return v;
66
+ }
67
+ template <class P> inline ActV<P> act_view(const SoftActuator& A) { return ActV<P>{A.dof, P(A.kp), P(A.kd)}; }
68
+
69
+ struct HostCTab { // host only (std::vector): the views computed on the fly in double, the same law calls as before
70
+ using P = double;
71
+ const SoftModel* m;
72
+ PairV<double> pair(int i) const {
73
+ std::vector<double> biw(m->bodies.size());
74
+ for (size_t b = 0; b < biw.size(); ++b) biw[b] = m->bodies[b].invweight0[0];
75
+ return pair_view<double>(m->pairs[i], m->geoms.data(), biw.data(), m->timestep);
76
+ }
77
+ GeomV<double> geom(int g) const { return geom_view<double>(m->geoms[g]); }
78
+ JointV<double> joint(int j) const { return joint_view<double>(m->joints[j], m->dof_invweight0.data(), m->timestep); }
79
+ int njoint() const { return static_cast<int>(m->joints.size()); }
80
+ int nact() const { return static_cast<int>(m->actuators.size()); }
81
+ ActV<double> act(int a) const { return act_view<double>(m->actuators[a]); }
82
+ double impratio() const { return m->impratio; }
83
+ int nv() const { return m->nv; }
84
+ };
85
+
86
+ // L5 (ii): an exclusive prefix sum of one int per lane and the total, on every lane (integer shuffles: exact and fixed order). Used as
87
+ // LANE_SCAN(cnt, pre, tot) after a block that set LV(cnt); cnt / pre / tot are LANE1(int, ...) arrays.
88
+ #if defined(__CUDA_ARCH__)
89
+ #define LANE_SCAN(cnt, pre, tot) ADJ_LANES(lane) { int v_ = LV(cnt), in_ = v_; \
90
+ for (int o_ = 1; o_ < 32; o_ <<= 1) { const int t_ = __shfl_up_sync(0xffffffffu, in_, o_); if (lane >= o_) in_ += t_; } \
91
+ LV(pre) = in_ - v_; LV(tot) = __shfl_sync(0xffffffffu, in_, 31); }
92
+ #else
93
+ #define LANE_SCAN(cnt, pre, tot) { int a_ = 0; for (int l_ = 0; l_ < 32; ++l_) { pre[l_] = a_; a_ += cnt[l_]; } \
94
+ for (int l_ = 0; l_ < 32; ++l_) tot[l_] = a_; }
95
+ #endif
96
+
97
+ template <class S, class Tab>
98
+ DN_HOST_DEVICE inline bool tab_static(const Tab& B, int b) {
99
+ for (; b > 0; b = B.parent(b)) if (B.jnt(b) != -1) return false;
100
+ return true;
101
+ }
102
+
103
+ // the geom's world pose from its body's (xpos, xquat): geom_pose's formula
104
+ template <class S, class G>
105
+ DN_HOST_DEVICE inline GeomPose<S> geom_pose_from(const S* xp, const S* xq, const G& g) {
106
+ GeomPose<S> gp;
107
+ S R[9], t[3];
108
+ quat_to_mat(xq, R);
109
+ mat_vec(R, g.pos, t);
110
+ gp.p = V<S>{xp[0] + t[0], xp[1] + t[1], xp[2] + t[2]};
111
+ S gq[4] = {S(g.quat[0]), S(g.quat[1]), S(g.quat[2]), S(g.quat[3])}, q[4];
112
+ quat_mul(xq, gq, q);
113
+ quat_to_mat(q, gp.R);
114
+ return gp;
115
+ }
116
+
117
+ // inputs of one substep: pose (SoA, d5's pose_xpos / pose_xquat), q, v, lambda, a*, zone(row) / clamp(dof) bits, the contact table
118
+ // (pair, slot) in row order, ncon, foot friction (< 0: the pair's own). ADDS into q_bar, v_bar, u_bar, xpos_bar, xrot_bar (nb x 3).
119
+ // scratch: kNB x kTw + kConBatch x kConRec words of S.
120
+ // con(i, pair, slot): contact i of the row order (the record's table, or arrays on the host)
121
+ template <class S, class Tab, class CTab, class ZoneFn, class ClampFn, class ConFn>
122
+ DN_HOST_DEVICE void rows_act_reverse_lanes(const Tab& B, const CTab& C, const S* pose, const S* q, const S* v, const S* lambda,
123
+ const S* a_star, ZoneFn zone, ClampFn clamp, ConFn con, int ncon,
124
+ double foot_friction, S* q_bar, S* v_bar, S* u_bar, S* xpos_bar, S* xrot_bar,
125
+ S* scratch, uint32_t* flag, int sect_substep = -1) {
126
+ #define RL_STAMP(k) do { if (sect_substep >= 0) ADJ_STAMP(sect_substep, (k)); } while (0)
127
+ (void)sect_substep;
128
+ S (*tw)[kTw] = reinterpret_cast<S (*)[kTw]>(scratch);
129
+ S (*cr)[kConRec] = reinterpret_cast<S (*)[kConRec]>(scratch + kNB * kTw);
130
+ using P = typename CTab::P;
131
+ const int nb = B.nb(), nv = C.nv();
132
+ const S* xs[3] = {lambda, a_star, v};
133
+ LANE1(int, dep); LANE1(int, par); LANE1(int, jtl); LANE1(int, stl);
134
+ LANEA(S, Rm, 9); LANEA(S, ax, 3);
135
+ ADJ_LANES(lane) {
136
+ LV(dep) = lane < nb ? B.depth(lane) : -1;
137
+ LV(par) = lane < nb ? B.parent(lane) : 0;
138
+ LV(jtl) = lane < nb ? B.jnt(lane) : -1;
139
+ LV(stl) = lane < nb ? (tab_static<S>(B, lane) ? 1 : 0) : 1;
140
+ if (lane < nb) {
141
+ quat_to_mat(pose_xquat(pose, lane), LV(Rm));
142
+ if (LV(jtl) == kJntHinge) mat_vec(LV(Rm), B.axis(lane), LV(ax));
143
+ else LV(ax)[0] = LV(ax)[1] = LV(ax)[2] = S(0);
144
+ }
145
+ if (lane == 0) for (int k = 0; k < kTw; ++k) tw[0][k] = S(0);
146
+ }
147
+ RL_STAMP(6);
148
+ // ---- F: the twists, root to leaf
149
+ for (int d = 1; d <= B.maxdepth(); ++d) {
150
+ ADJ_LANES(lane) {
151
+ if (LV(dep) == d) {
152
+ S* t = tw[lane];
153
+ const S* tp = tw[LV(par)];
154
+ const S* xb = pose_xpos(pose, lane);
155
+ const S* xpp = pose_xpos(pose, LV(par));
156
+ if (LV(stl)) {
157
+ for (int k = 0; k < kTw; ++k) t[k] = S(0);
158
+ } else if (LV(jtl) == kJntFree) {
159
+ const int da = B.dadr(lane);
160
+ for (int x = 0; x < 3; ++x) {
161
+ const S wb[3] = {xs[x][da + 3], xs[x][da + 4], xs[x][da + 5]};
162
+ S w[3];
163
+ mat_vec(LV(Rm), wb, w);
164
+ for (int k = 0; k < 3; ++k) { t[3 * x + k] = w[k]; t[9 + 3 * x + k] = xs[x][da + k]; }
165
+ }
166
+ } else {
167
+ const S r[3] = {xb[0] - xpp[0], xb[1] - xpp[1], xb[2] - xpp[2]};
168
+ const int da = B.dadr(lane);
169
+ for (int x = 0; x < 3; ++x) {
170
+ const S* Om = tp + 3 * x;
171
+ const S* Vp = tp + 9 + 3 * x;
172
+ S c[3];
173
+ cross3(Om, r, c);
174
+ const S xi = LV(jtl) == kJntHinge ? xs[x][da] : S(0);
175
+ for (int k = 0; k < 3; ++k) { t[3 * x + k] = Om[k] + LV(ax)[k] * xi; t[9 + 3 * x + k] = Vp[k] + c[k]; }
176
+ }
177
+ }
178
+ }
179
+ }
180
+ }
181
+ RL_STAMP(7);
182
+ // ---- C + D: contacts in batches; each lane = body keeps its subtree accumulator (A_x 9, B_x 9) in registers
183
+ LANEA(S, acc, kTw);
184
+ ADJ_LANES(lane) { for (int k = 0; k < kTw; ++k) LV(acc)[k] = S(0); }
185
+ // limit rows come first in the row order (make_rows: joints in order, lower side then upper): lane = joint counts its active sides,
186
+ // an exclusive scan gives each joint's first row and nlim (L5 (ii); was a serial scan on every lane)
187
+ #if !defined(__CUDA_ARCH__)
188
+ assert(C.njoint() <= 32 && "rows_act_reverse_lanes: one lane per joint");
189
+ #endif
190
+ LANE1(int, jcnt); LANE1(int, jrow); LANE1(int, nlimv);
191
+ ADJ_LANES(lane) {
192
+ LV(jcnt) = 0;
193
+ if (lane < C.njoint()) {
194
+ const auto jt = C.joint(lane);
195
+ if (jt.limited) {
196
+ const S qj = q[jt.qadr];
197
+ LV(jcnt) = ((qj - S(jt.range[0])) < jt.margin ? 1 : 0) + ((S(jt.range[1]) - qj) < jt.margin ? 1 : 0);
198
+ }
199
+ }
200
+ }
201
+ LANE_SCAN(jcnt, jrow, nlimv);
202
+ int carry = 0; // contact rows before the current batch
203
+ for (int c0 = 0; c0 < ncon; c0 += kConBatch) {
204
+ LANE1(int, ccnt); LANE1(int, crow); LANE1(int, ctot);
205
+ ADJ_LANES(lane) {
206
+ LV(ccnt) = 0;
207
+ if (lane < kConBatch && c0 + lane < ncon) { int pk, sk; con(c0 + lane, pk, sk); LV(ccnt) = C.pair(pk).condim == 1 ? 1 : 4; }
208
+ }
209
+ LANE_SCAN(ccnt, crow, ctot);
210
+ ADJ_LANES(lane) {
211
+ const int ci = c0 + lane;
212
+ if (lane < kConBatch) for (int k = 0; k < kConRec; ++k) cr[lane][k] = S(0);
213
+ if (lane < kConBatch && ci < ncon) {
214
+ int cpi, csl;
215
+ con(ci, cpi, csl);
216
+ const auto pr = C.pair(cpi);
217
+ const auto ga = C.geom(pr.g1), gb = C.geom(pr.g2);
218
+ const int b1 = ga.body, b2 = gb.body;
219
+ const int row0 = LV(nlimv) + carry + LV(crow);
220
+ const GeomPose<S> pa = geom_pose_from(pose_xpos(pose, b1), pose_xquat(pose, b1), ga);
221
+ const GeomPose<S> pbp = geom_pose_from(pose_xpos(pose, b2), pose_xquat(pose, b2), gb);
222
+ PreContact<S> pc[2]; // L5 (iii): every collider writes at most 2 (capsule-capsule returns once it has two; plane-capsule 2)
223
+ const int n = collide(pc, pr.margin + pr.gap, ga.type, pa, ga.size, gb.type, pbp, gb.size);
224
+ int hit = -1;
225
+ for (int k = 0; k < n; ++k) if (pc[k].slot == csl) hit = k;
226
+ if (hit < 0) { // fail fast through the flag (no device assert, no silent use of another contact)
227
+ *flag = *flag | kRowsNoContact;
228
+ continue;
229
+ }
230
+ V<S> fr[3];
231
+ make_frame(pc[hit].normal, pc[hit].tangent, fr);
232
+ const S dist = pc[hit].dist;
233
+ const V<S> p = pc[hit].pos;
234
+ const P f0 = (pr.foot >= 0 && foot_friction >= 0) ? P(foot_friction) : pr.mu0;
235
+ const P mu = smax(P(1e-5), f0);
236
+ const int k = pr.condim == 1 ? 1 : 4;
237
+ // dV(x) = (V_b2 + Om_b2 x (p - xpos_b2)) - (same for b1)
238
+ V<S> dV[3], dOm[3];
239
+ for (int x = 0; x < 3; ++x) {
240
+ V<S> s2 = vz<S>(), s1 = vz<S>(), o2 = vz<S>(), o1 = vz<S>();
241
+ for (int side = 0; side < 2; ++side) {
242
+ const int b = side == 0 ? b2 : b1;
243
+ const V<S> Om = va(tw[b] + 3 * x), Vb = va(tw[b] + 9 + 3 * x);
244
+ const V<S> pt = vadd(Vb, vcr(Om, vsub(p, va(pose_xpos(pose, b)))));
245
+ if (side == 0) { s2 = pt; o2 = Om; } else { s1 = pt; o1 = Om; }
246
+ }
247
+ dV[x] = vsub(s2, s1);
248
+ dOm[x] = vsub(o2, o1);
249
+ }
250
+ // the rows: primal and cotangents
251
+ const KBT<P> kb = pr.kb;
252
+ const P tran = pr.tran;
253
+ const P dA = k == 1 ? tran : tran + mu * mu * tran;
254
+ const S imp = impedance(pr.imp, dist, pr.margin);
255
+ const S R0 = (S(1) - imp) * S(dA) / imp;
256
+ const P cR = k == 1 ? P(1) : P(2) * mu * mu / smax(P(kMinVal), P(C.impratio()));
257
+ const S Dv = S(1) / (S(cR) * R0);
258
+ V<S> dr[4], W[3] = {vz<S>(), vz<S>(), vz<S>()};
259
+ S co[4][3], Dbs = S(0), ibs = S(0), pbs = S(0);
260
+ for (int j = 0; j < k; ++j) {
261
+ dr[j] = k == 1 ? fr[0] : vadd(fr[0], vsc(fr[1 + j / 2], S(j % 2 == 0 ? mu : -mu)));
262
+ co[j][0] = co[j][1] = co[j][2] = S(0);
263
+ if (!zone(row0 + j)) continue;
264
+ const S s = vdot(dr[j], dV[0]), t = vdot(dr[j], dV[1]), vel = vdot(dr[j], dV[2]);
265
+ const S aref = reference_accel(kb, imp, vel, dist, pr.margin);
266
+ const S e = t - aref;
267
+ S arb = Dv * s;
268
+ #ifdef DN_ADJ_TEST_HOOKS
269
+ if (g_test_flip == 11 && ci == 0 && j == 0) arb = S(0) - arb; // planted bug: one row's arb sign flipped
270
+ #endif
271
+ Dbs = Dbs - s * e;
272
+ co[j][0] = S(0) - Dv * e;
273
+ co[j][1] = S(0) - Dv * s;
274
+ co[j][2] = S(0) - S(kb.B) * arb;
275
+ ibs = ibs - S(kb.K) * (dist - S(pr.margin)) * arb;
276
+ pbs = pbs - S(kb.K) * imp * arb;
277
+ for (int x = 0; x < 3; ++x) W[x] = vadd(W[x], vsc(dr[j], co[j][x]));
278
+ }
279
+ P cRd = cR;
280
+ #ifdef DN_ADJ_TEST_HOOKS
281
+ if (g_test_flip == 12 && k != 1) cRd = P(1); // planted bug: the pyramid's cR factor dropped from the D -> imp derivative
282
+ #endif
283
+ ibs = ibs + Dbs * Dv * Dv * S(cRd * dA) / (imp * imp);
284
+ pbs = pbs + ibs * impedance_dpos(pr.imp, dist, pr.margin);
285
+ // p_bar and the frame cotangent
286
+ V<S> pbar = vz<S>(), fbar[3] = {vz<S>(), vz<S>(), vz<S>()};
287
+ for (int x = 0; x < 3; ++x) pbar = vadd(pbar, vcr(W[x], dOm[x]));
288
+ for (int j = 0; j < k; ++j) {
289
+ V<S> g = vz<S>();
290
+ for (int x = 0; x < 3; ++x) g = vadd(g, vsc(dV[x], co[j][x]));
291
+ fbar[0] = vadd(fbar[0], g);
292
+ if (k != 1) fbar[1 + j / 2] = vadd(fbar[1 + j / 2], vsc(g, S(j % 2 == 0 ? mu : -mu)));
293
+ }
294
+ V<S> nbr, tbr;
295
+ bool tused;
296
+ make_frame_reverse(pc[hit].normal, pc[hit].tangent, fbar, nbr, tbr, tused);
297
+ if (!tused) tbr = vz<S>();
298
+ GeomBar<S> bA{vz<S>(), vz<S>()}, bB{vz<S>(), vz<S>()};
299
+ collide_reverse(tab_static<S>(B, b1) != 0, ga, pa, gb, pbp, csl, pbs, pbar, nbr, tbr, bA, bB);
300
+ S* rec = cr[lane];
301
+ for (int x = 0; x < 3; ++x) { rec[3 * x] = W[x].x; rec[3 * x + 1] = W[x].y; rec[3 * x + 2] = W[x].z; }
302
+ rec[9] = p.x; rec[10] = p.y; rec[11] = p.z;
303
+ for (int side = 0; side < 2; ++side) { // direct pose cotangents of the geoms' bodies (static ones dropped by D)
304
+ const GeomBar<S>& gbar = side == 0 ? bA : bB;
305
+ const GeomPose<S>& P = side == 0 ? pa : pbp;
306
+ const int b = side == 0 ? b1 : b2;
307
+ const V<S> off = vsub(P.p, va(pose_xpos(pose, b)));
308
+ const V<S> rot = vadd(vcr(off, gbar.p), vcr(zaxis(P.R), gbar.z));
309
+ S* o = rec + 12 + 6 * side;
310
+ o[0] = gbar.p.x; o[1] = gbar.p.y; o[2] = gbar.p.z; o[3] = rot.x; o[4] = rot.y; o[5] = rot.z;
311
+ }
312
+ }
313
+ }
314
+ // D: lane = body, the batch's contacts in order
315
+ ADJ_LANES(lane) {
316
+ if (lane < nb && !LV(stl)) {
317
+ for (int c = 0; c < kConBatch && c0 + c < ncon; ++c) {
318
+ int cpi, csl;
319
+ con(c0 + c, cpi, csl);
320
+ const auto pr = C.pair(cpi);
321
+ const int b1 = C.geom(pr.g1).body, b2 = C.geom(pr.g2).body;
322
+ const S* rec = cr[c];
323
+ for (int side = 0; side < 2; ++side) {
324
+ const int b = side == 0 ? b2 : b1;
325
+ if (b != lane) continue;
326
+ const S sg = S(side == 0 ? 1.0 : -1.0);
327
+ for (int x = 0; x < 3; ++x) {
328
+ const S Wx[3] = {rec[3 * x], rec[3 * x + 1], rec[3 * x + 2]};
329
+ S pW[3];
330
+ cross3(rec + 9, Wx, pW);
331
+ for (int kk = 0; kk < 3; ++kk) { LV(acc)[3 * x + kk] = LV(acc)[3 * x + kk] + sg * Wx[kk];
332
+ LV(acc)[9 + 3 * x + kk] = LV(acc)[9 + 3 * x + kk] + sg * pW[kk]; }
333
+ }
334
+ }
335
+ for (int side = 0; side < 2; ++side) {
336
+ const int b = side == 0 ? b1 : b2;
337
+ if (b != lane) continue;
338
+ const S* o = rec + 12 + 6 * side;
339
+ for (int kk = 0; kk < 3; ++kk) { xpos_bar[3 * b + kk] = xpos_bar[3 * b + kk] + o[kk];
340
+ xrot_bar[3 * b + kk] = xrot_bar[3 * b + kk] + o[3 + kk]; }
341
+ }
342
+ }
343
+ }
344
+ }
345
+ #if defined(__CUDA_ARCH__)
346
+ carry += ctot;
347
+ #else
348
+ carry += ctot[0];
349
+ #endif
350
+ }
351
+ RL_STAMP(8);
352
+ // ---- B: leaf to root, the subtree sums and each body's dof terms (tw[] reused as the message rows)
353
+ for (int d = B.maxdepth(); d >= 1; --d) {
354
+ ADJ_LANES(lane) {
355
+ if (LV(dep) == d && !LV(stl)) {
356
+ for (int ci = 0; ci < B.nchild(lane); ++ci) {
357
+ const S* m = tw[B.child(lane, ci)];
358
+ for (int kk = 0; kk < kTw; ++kk) LV(acc)[kk] = LV(acc)[kk] + m[kk];
359
+ }
360
+ const S* anc = pose_xpos(pose, lane);
361
+ const int da = B.dadr(lane);
362
+ auto dof_terms = [&](const S* a, int dof) { // one rotational dof with world axis a, anchor xpos_b
363
+ S ab[3] = {S(0), S(0), S(0)}, anb[3] = {S(0), S(0), S(0)};
364
+ for (int x = 0; x < 3; ++x) {
365
+ const S xi = xs[x][dof];
366
+ const S* A = LV(acc) + 3 * x;
367
+ const S* Bt = LV(acc) + 9 + 3 * x;
368
+ S aA[3], Aa[3];
369
+ cross3(anc, A, aA);
370
+ cross3(A, a, Aa);
371
+ for (int kk = 0; kk < 3; ++kk) { ab[kk] = ab[kk] + xi * (Bt[kk] - aA[kk]); anb[kk] = anb[kk] - xi * Aa[kk]; }
372
+ if (x == 2) { // the pull-back of W_v (aref's J v): v_bar[dof] += a . (B_v - anc x A_v)
373
+ S t[3] = {Bt[0] - aA[0], Bt[1] - aA[1], Bt[2] - aA[2]};
374
+ v_bar[dof] = v_bar[dof] + dot3(a, t);
375
+ }
376
+ }
377
+ S rot[3];
378
+ cross3(a, ab, rot);
379
+ for (int kk = 0; kk < 3; ++kk) { xrot_bar[3 * lane + kk] = xrot_bar[3 * lane + kk] + rot[kk];
380
+ xpos_bar[3 * lane + kk] = xpos_bar[3 * lane + kk] + anb[kk]; }
381
+ };
382
+ if (LV(jtl) == kJntHinge) {
383
+ dof_terms(LV(ax), da);
384
+ } else if (LV(jtl) == kJntFree) {
385
+ for (int kk = 0; kk < 3; ++kk) v_bar[da + kk] = v_bar[da + kk] + LV(acc)[6 + kk]; // translation: A_v
386
+ for (int e = 0; e < 3; ++e) {
387
+ const S a[3] = {LV(Rm)[e], LV(Rm)[3 + e], LV(Rm)[6 + e]};
388
+ dof_terms(a, da + 3 + e);
389
+ }
390
+ }
391
+ for (int kk = 0; kk < kTw; ++kk) tw[lane][kk] = LV(acc)[kk];
392
+ }
393
+ }
394
+ }
395
+ RL_STAMP(9);
396
+ // ---- L: lane = joint, the limit rows (J = +-1 at the dof; lower side first)
397
+ ADJ_LANES(lane) {
398
+ if (lane < C.njoint()) {
399
+ int row = LV(jrow); // this joint's first limit row (the scan above, L5 (ii))
400
+ const auto jt = C.joint(lane);
401
+ if (jt.limited) {
402
+ for (int side = -1; side <= 1; side += 2) {
403
+ const S qj = q[jt.qadr];
404
+ const S dist = side < 0 ? qj - S(jt.range[0]) : S(jt.range[1]) - qj;
405
+ if (!(dist < jt.margin)) continue;
406
+ const int r = row++;
407
+ if (!zone(r)) continue;
408
+ const S sg = S(side < 0 ? 1.0 : -1.0);
409
+ const KBT<P> kb = jt.kb;
410
+ const P dA = jt.diw;
411
+ const S imp = impedance(jt.imp, dist, jt.margin);
412
+ const S Dv = S(1) / ((S(1) - imp) * S(dA) / imp);
413
+ const S s = sg * lambda[jt.dof], t = sg * a_star[jt.dof], vel = sg * v[jt.dof];
414
+ const S aref = reference_accel(kb, imp, vel, dist, jt.margin);
415
+ const S e = t - aref, arb = Dv * s;
416
+ const S cv = S(0) - S(kb.B) * arb;
417
+ S ib = S(0) - S(kb.K) * (dist - S(jt.margin)) * arb;
418
+ S pb = S(0) - S(kb.K) * imp * arb;
419
+ ib = ib + (S(0) - s * e) * Dv * Dv * S(dA) / (imp * imp);
420
+ pb = pb + ib * impedance_dpos(jt.imp, dist, jt.margin);
421
+ v_bar[jt.dof] = v_bar[jt.dof] + cv * sg;
422
+ q_bar[jt.dof] = q_bar[jt.dof] + pb * sg;
423
+ }
424
+ }
425
+ }
426
+ }
427
+ // ---- P: lane = actuator (one per dof on the G1), PD on the unclamped
428
+ ADJ_LANES(lane) {
429
+ if (lane < C.nact()) {
430
+ const auto A = C.act(lane);
431
+ if (!clamp(A.dof)) {
432
+ u_bar[lane] = u_bar[lane] + lambda[A.dof] * S(A.kp);
433
+ q_bar[A.dof] = q_bar[A.dof] - lambda[A.dof] * S(A.kp);
434
+ v_bar[A.dof] = v_bar[A.dof] - lambda[A.dof] * S(A.kd);
435
+ }
436
+ }
437
+ }
438
+ RL_STAMP(10);
439
+ (void)nv;
440
+ #undef RL_STAMP
441
+ }
442
+
443
+ } // namespace js::soft::adj