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.
- diffneusim/__init__.py +1 -0
- diffneusim/_cache.py +42 -0
- diffneusim/_paths.py +5 -0
- diffneusim/bindings/rew14_ext.cu +115 -0
- diffneusim/bindings/soft14_capi.cpp +443 -0
- diffneusim/bindings/soft14_engine_ext.cu +596 -0
- diffneusim/bindings/soft_capi.cpp +782 -0
- diffneusim/bindings/soft_engine_ext.cu +495 -0
- diffneusim/core/cpu_engine/build.sh +40 -0
- diffneusim/core/cpu_engine/fiber/cuda_runtime.h +445 -0
- diffneusim/core/cpu_engine/x14_cpu.cpp +283 -0
- diffneusim/core/diff/dual.h +126 -0
- diffneusim/core/include/diffneusim/macros.h +35 -0
- diffneusim/core/kin/kinematic_tree.h +273 -0
- diffneusim/core/math/so3.h +182 -0
- diffneusim/core/soft/adj/out_adj.h +102 -0
- diffneusim/core/soft/adj/rnea_adj.h +425 -0
- diffneusim/core/soft/adj/rows_adj.h +439 -0
- diffneusim/core/soft/adj/rows_functor.h +89 -0
- diffneusim/core/soft/adj/rows_lanes.h +443 -0
- diffneusim/core/soft/adj/shell_adj.h +243 -0
- diffneusim/core/soft/adj/tree_adj.h +356 -0
- diffneusim/core/soft/collide.h +183 -0
- diffneusim/core/soft/gpu/adj14.cuh +233 -0
- diffneusim/core/soft/gpu/adj14_mus.cuh +98 -0
- diffneusim/core/soft/gpu/adj_shell.cuh +50 -0
- diffneusim/core/soft/gpu/adj_tab.cuh +49 -0
- diffneusim/core/soft/gpu/body14.cuh +47 -0
- diffneusim/core/soft/gpu/chol_rn.cuh +458 -0
- diffneusim/core/soft/gpu/chol_small.cuh +123 -0
- diffneusim/core/soft/gpu/chol_split.cuh +193 -0
- diffneusim/core/soft/gpu/engine_launch.cuh +263 -0
- diffneusim/core/soft/gpu/fk_rn.cuh +109 -0
- diffneusim/core/soft/gpu/generated/body_019e20820f86_mmfloor.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_62f77a4bb16b_mmfloor.cuh +52 -0
- diffneusim/core/soft/gpu/generated/body_77dbb7213f26_mmfloor_rampsb3l_n6t12.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rampsb3l_n6t12.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsd05_n6t12.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsdef_n6t12.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsmjd_n6t12.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +52 -0
- diffneusim/core/soft/gpu/generated/body_a944653edd64_mmfloor.cuh +25 -0
- diffneusim/core/soft/gpu/generated/body_a944653edd64_mmfloor_rampsb3l_n6t12.cuh +25 -0
- diffneusim/core/soft/gpu/generated/g1_soft_5db44fd45286.cuh +74 -0
- diffneusim/core/soft/gpu/generated/split_62f77a4bb16b_mmfloor.cuh +18 -0
- diffneusim/core/soft/gpu/generated/split_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +18 -0
- diffneusim/core/soft/gpu/generated/x14_soft_019e20820f86_mmfloor.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_62f77a4bb16b_mmfloor.cuh +129 -0
- diffneusim/core/soft/gpu/generated/x14_soft_77dbb7213f26_mmfloor_rampsb3l_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rampsb3l_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsd05_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsdef_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsmjd_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +129 -0
- diffneusim/core/soft/gpu/generated/x14_soft_a944653edd64_mmfloor.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_a944653edd64_mmfloor_rampsb3l_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/k_mus.cuh +1038 -0
- diffneusim/core/soft/gpu/k_mus_host.cuh +377 -0
- diffneusim/core/soft/gpu/k_pre.cuh +52 -0
- diffneusim/core/soft/gpu/kernel_p.cuh +490 -0
- diffneusim/core/soft/gpu/kp14.cuh +465 -0
- diffneusim/core/soft/gpu/l2v2.cuh +367 -0
- diffneusim/core/soft/gpu/l2x14.cuh +319 -0
- diffneusim/core/soft/gpu/l3.cuh +1483 -0
- diffneusim/core/soft/gpu/model_view.cuh +48 -0
- diffneusim/core/soft/gpu/mus_case_fits.h +15 -0
- diffneusim/core/soft/gpu/mus_classes.h +182 -0
- diffneusim/core/soft/gpu/mus_row_cf.h +44 -0
- diffneusim/core/soft/gpu/rew14.cuh +177 -0
- diffneusim/core/soft/gpu/rows_ctab.cuh +44 -0
- diffneusim/core/soft/gpu/tree_m.cuh +247 -0
- diffneusim/core/soft/gpu/x14_engine_kernels.cuh +260 -0
- diffneusim/core/soft/gpu/x14_rowcf.h +14 -0
- diffneusim/core/soft/hand.h +124 -0
- diffneusim/core/soft/impedance.h +115 -0
- diffneusim/core/soft/jvp.h +202 -0
- diffneusim/core/soft/kin.h +250 -0
- diffneusim/core/soft/muscle.h +1208 -0
- diffneusim/core/soft/newton.h +371 -0
- diffneusim/core/soft/rows.h +176 -0
- diffneusim/core/soft/step.h +188 -0
- diffneusim/core/soft/tape.h +313 -0
- diffneusim/core/soft/x14/collide14.h +69 -0
- diffneusim/core/soft/x14/jvp14.h +182 -0
- diffneusim/core/soft/x14/law14.h +453 -0
- diffneusim/core/soft/x14adj/collide14_adj.h +134 -0
- diffneusim/core/soft/x14adj/passive14_adj.h +162 -0
- diffneusim/core/soft/x14adj/reward14.h +484 -0
- diffneusim/core/soft/x14adj/rows14_adj.h +400 -0
- diffneusim/core/soft/x14adj/scan14.h +349 -0
- diffneusim/core/soft/x14adj/shell14_adj.h +122 -0
- diffneusim/core/soft/x14adj/sweep14.h +255 -0
- diffneusim/core/soft/x14adj/tree14_adj.h +500 -0
- diffneusim/core/soft/x14adj/x14adj_common.h +96 -0
- diffneusim/data/mirror/H1622v2k_geyer_hfdeq.npz +0 -0
- diffneusim/data/mirror/H1622v2k_hfd.npz +0 -0
- diffneusim/data/mirror/H1622v2k_millard_hfdeq.npz +0 -0
- diffneusim/data/mirror/fullbody_contact.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_p2str.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_p2str_rigid.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_calf2_pe.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfix.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfixlegs01.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01legs.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01lumbar.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_lumbfix.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_lumbfixlegs01.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1a.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n2.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_rom23.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_hinge.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1a.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n2.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_rom23.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_lspine_girdle_osimeq.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_lspine_girdle_millard.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_lspine_girdle_osimeq.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_compound_g14eq.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30_luispe.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30_trunk0701.npz +0 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_axfix.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_axfixlegs01.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01legs.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01lumbar.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_lumbfix.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_lumbfixlegs01.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_n1.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_n1a.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_n2.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_rom23.json +91 -0
- diffneusim/data/reference/musclemimic/myofullbody_mimic_sites.json +261 -0
- diffneusim/data/reference/pose3/pose3_scone.json +305 -0
- diffneusim/data/reference/pose3/pose3_scone.txt +3 -0
- diffneusim/data/reference/pose3/pose3_scone_gait.npz +0 -0
- diffneusim/data/reference/pose3/pose3_scone_mirror.npz +0 -0
- diffneusim/data/reference/pose3/pose3_scone_stand.npz +0 -0
- diffneusim/data/reference/x016run/MD5SUMS +241 -0
- diffneusim/data/reference/x016run/x016run_states.txt +240 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_r3.npz +0 -0
- diffneusim/data/state_prior/lumbar_poly_fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
- diffneusim/engine/__init__.py +0 -0
- diffneusim/engine/build_tag.py +52 -0
- diffneusim/engine/case_tables.py +46 -0
- diffneusim/engine/d16_body.py +80 -0
- diffneusim/engine/engine14.py +367 -0
- diffneusim/engine/gen_split.py +159 -0
- diffneusim/engine/hand_format.py +69 -0
- diffneusim/engine/live14.py +149 -0
- diffneusim/engine/phase_b_tree.py +137 -0
- diffneusim/engine/soft14.py +130 -0
- diffneusim/engine/soft_capi.py +373 -0
- diffneusim/engine/soft_engine.py +165 -0
- diffneusim/engine/step14.py +132 -0
- diffneusim/engine/tape_format.py +89 -0
- diffneusim/engine/x14cpu.py +163 -0
- diffneusim/env/__init__.py +0 -0
- diffneusim/env/absent.py +20 -0
- diffneusim/env/cpu14.py +105 -0
- diffneusim/env/e0loop14.py +224 -0
- diffneusim/env/env14.py +568 -0
- diffneusim/env/kin_contact14.py +193 -0
- diffneusim/env/mimic_sites_x14.json +366 -0
- diffneusim/env/old_count.py +78 -0
- diffneusim/env/rew14.py +114 -0
- diffneusim/env/rew14_hook.py +105 -0
- diffneusim/g1/__init__.py +1 -0
- diffneusim/g1/arm_a2.py +165 -0
- diffneusim/g1/arm_a3.py +576 -0
- diffneusim/g1/read_a3.py +79 -0
- diffneusim/g1/rg1_read.py +89 -0
- diffneusim/model/__init__.py +66 -0
- diffneusim/model/case.py +17 -0
- diffneusim/model/dnmodel.py +79 -0
- diffneusim/model/fuse_fixed.py +281 -0
- diffneusim/model/monitor.py +834 -0
- diffneusim/models/BODIES.toml +48 -0
- diffneusim/models/MANIFEST.toml +979 -0
- diffneusim/models/cases/G290/case.bin +0 -0
- diffneusim/models/cases/G290/case.json +1 -0
- diffneusim/models/cases/G356-SRC/case.bin +0 -0
- diffneusim/models/cases/G356-SRC/case.json +1 -0
- diffneusim/models/cases/G416/case.bin +0 -0
- diffneusim/models/cases/G416/case.json +1 -0
- diffneusim/models/cases/M290C-SRC/case.bin +0 -0
- diffneusim/models/cases/M290C-SRC/case.json +1 -0
- diffneusim/models/cases/M290R-SRC/case.bin +0 -0
- diffneusim/models/cases/M290R-SRC/case.json +1 -0
- diffneusim/models/cases/M356C-SRC/case.bin +0 -0
- diffneusim/models/cases/M356C-SRC/case.json +1 -0
- diffneusim/models/cases/M356R-SRC/case.bin +0 -0
- diffneusim/models/cases/M356R-SRC/case.json +1 -0
- diffneusim/models/cases/M416C-SRC/case.bin +0 -0
- diffneusim/models/cases/M416C-SRC/case.json +1 -0
- diffneusim/models/derived/d16_expanded_62f77a4bb16b1e67_mmfloor.xml +673 -0
- diffneusim/models/derived/d16_expanded_a1e8b196b2cd7b3c_mmfloor.xml +673 -0
- diffneusim/models/derived/d16_soft_law_019e20820f8633b9_mmfloor.json +7844 -0
- diffneusim/models/derived/d16_soft_law_62f77a4bb16b1e67_mmfloor.json +16855 -0
- diffneusim/models/derived/d16_soft_law_77dbb7213f26e821_mmfloor_rampsb3l_n6t12.json +7883 -0
- diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rampsb3l_n6t12.json +7883 -0
- diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsd05_n6t12.json +7868 -0
- diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsdef_n6t12.json +7868 -0
- diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsmjd_n6t12.json +7868 -0
- diffneusim/models/derived/d16_soft_law_a1e8b196b2cd7b3c_mmfloor_rampsb3l_n6t12.json +16894 -0
- diffneusim/models/derived/d16_soft_law_a944653edd642082_mmfloor.json +12655 -0
- diffneusim/models/derived/d16_soft_law_a944653edd642082_mmfloor_rampsb3l_n6t12.json +12700 -0
- diffneusim/models/derived/unitree_g1_soft_law.json +15580 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +28913 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.dnmodel +29202 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfixlegs01.dnmodel +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +46970 -0
- diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +38570 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.dnmodel +38923 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
- diffneusim/models/fullbody_meshes/1mc.stl +0 -0
- diffneusim/models/fullbody_meshes/2distph.stl +0 -0
- diffneusim/models/fullbody_meshes/2mc.stl +0 -0
- diffneusim/models/fullbody_meshes/2midph.stl +0 -0
- diffneusim/models/fullbody_meshes/2proxph.stl +0 -0
- diffneusim/models/fullbody_meshes/3distph.stl +0 -0
- diffneusim/models/fullbody_meshes/3mc.stl +0 -0
- diffneusim/models/fullbody_meshes/3midph.stl +0 -0
- diffneusim/models/fullbody_meshes/3proxph.stl +0 -0
- diffneusim/models/fullbody_meshes/4distph.stl +0 -0
- diffneusim/models/fullbody_meshes/4mc.stl +0 -0
- diffneusim/models/fullbody_meshes/4midph.stl +0 -0
- diffneusim/models/fullbody_meshes/4proxph.stl +0 -0
- diffneusim/models/fullbody_meshes/5distph.stl +0 -0
- diffneusim/models/fullbody_meshes/5mc.stl +0 -0
- diffneusim/models/fullbody_meshes/5midph.stl +0 -0
- diffneusim/models/fullbody_meshes/5proxph.stl +0 -0
- diffneusim/models/fullbody_meshes/NOTICE +2 -0
- diffneusim/models/fullbody_meshes/capitate.stl +0 -0
- diffneusim/models/fullbody_meshes/clavicle.stl +0 -0
- diffneusim/models/fullbody_meshes/hamate.stl +0 -0
- diffneusim/models/fullbody_meshes/hat_cervical.stl +0 -0
- diffneusim/models/fullbody_meshes/hat_jaw.stl +0 -0
- diffneusim/models/fullbody_meshes/hat_skull.stl +0 -0
- diffneusim/models/fullbody_meshes/humerus.stl +0 -0
- diffneusim/models/fullbody_meshes/l_bofoot.stl +0 -0
- diffneusim/models/fullbody_meshes/l_femur.stl +0 -0
- diffneusim/models/fullbody_meshes/l_fibula.stl +0 -0
- diffneusim/models/fullbody_meshes/l_foot.stl +0 -0
- diffneusim/models/fullbody_meshes/l_patella.stl +0 -0
- diffneusim/models/fullbody_meshes/l_pelvis.stl +0 -0
- diffneusim/models/fullbody_meshes/l_talus.stl +0 -0
- diffneusim/models/fullbody_meshes/l_tibia.stl +0 -0
- diffneusim/models/fullbody_meshes/lumbar1.stl +0 -0
- diffneusim/models/fullbody_meshes/lumbar2.stl +0 -0
- diffneusim/models/fullbody_meshes/lumbar3.stl +0 -0
- diffneusim/models/fullbody_meshes/lumbar4.stl +0 -0
- diffneusim/models/fullbody_meshes/lumbar5.stl +0 -0
- diffneusim/models/fullbody_meshes/lunate.stl +0 -0
- diffneusim/models/fullbody_meshes/pisiform.stl +0 -0
- diffneusim/models/fullbody_meshes/r_bofoot.stl +0 -0
- diffneusim/models/fullbody_meshes/r_femur.stl +0 -0
- diffneusim/models/fullbody_meshes/r_fibula.stl +0 -0
- diffneusim/models/fullbody_meshes/r_foot.stl +0 -0
- diffneusim/models/fullbody_meshes/r_patella.stl +0 -0
- diffneusim/models/fullbody_meshes/r_pelvis.stl +0 -0
- diffneusim/models/fullbody_meshes/r_talus.stl +0 -0
- diffneusim/models/fullbody_meshes/r_tibia.stl +0 -0
- diffneusim/models/fullbody_meshes/radius.stl +0 -0
- diffneusim/models/fullbody_meshes/sacrum.stl +0 -0
- diffneusim/models/fullbody_meshes/scaphoid.stl +0 -0
- diffneusim/models/fullbody_meshes/scapula.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic10_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic11_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic12_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic1_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic2_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic3_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic4_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic5_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic6_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic7_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic8_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic9_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thorax.stl +0 -0
- diffneusim/models/fullbody_meshes/thumbdist.stl +0 -0
- diffneusim/models/fullbody_meshes/thumbprox.stl +0 -0
- diffneusim/models/fullbody_meshes/trapezium.stl +0 -0
- diffneusim/models/fullbody_meshes/trapezoid.stl +0 -0
- diffneusim/models/fullbody_meshes/triquetrum.stl +0 -0
- diffneusim/models/fullbody_meshes/ulna.stl +0 -0
- diffneusim/models/source/myo_fullbody/UPSTREAM.md +91 -0
- diffneusim/models/source/myoleg/UPSTREAM.md +52 -0
- diffneusim/models/source/unitree_g1/LICENSE.mjlab +202 -0
- diffneusim/models/source/unitree_g1/UPSTREAM.md +38 -0
- diffneusim/models/source/unitree_g1/assets/head_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_ankle_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_ankle_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_elbow_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_hip_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_hip_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_hip_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_knee_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_rubber_hand.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_shoulder_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_shoulder_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_shoulder_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_wrist_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_wrist_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_wrist_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/logo_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/pelvis.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/pelvis_contour_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_ankle_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_ankle_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_elbow_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_hip_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_hip_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_hip_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_knee_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_rubber_hand.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_shoulder_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_shoulder_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_shoulder_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_wrist_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_wrist_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_wrist_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/torso_link_rev_1_0.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/waist_roll_link_rev_1_0.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/waist_yaw_link_rev_1_0.STL +0 -0
- diffneusim/models/source/unitree_g1/dump_mjlab_reference.py +30 -0
- diffneusim/models/source/unitree_g1/g1.xml +308 -0
- diffneusim/models/source/unitree_g1/g1_constants.py +298 -0
- diffneusim/models/source/unitree_g1/mjlab_compiled_reference.json +857 -0
- diffneusim/models/unitree_g1.dnmodel +4393 -0
- diffneusim/models/unitree_g1_selfcol.dnmodel +20824 -0
- diffneusim/rl/__init__.py +2 -0
- diffneusim/rl/dynsyn_layer.py +146 -0
- diffneusim/rl/footstep_plan.py +337 -0
- diffneusim/rl/g1_bm_env.py +572 -0
- diffneusim/rl/g1_bm_eval.py +168 -0
- diffneusim/rl/g1_bm_fused.py +275 -0
- diffneusim/rl/g1_bm_ppo.py +622 -0
- diffneusim/rl/g1_bm_sapo.py +551 -0
- diffneusim/rl/g1_ppo.py +395 -0
- diffneusim/rl/g1_sapo_soft.py +240 -0
- diffneusim/rl/g1_soft_env.py +452 -0
- diffneusim/rl/g1_soft_grad.py +145 -0
- diffneusim/rl/geyer_curves_torch.py +108 -0
- diffneusim/rl/gpu_fullbody_vec_env.py +1241 -0
- diffneusim/rl/imitation.py +2027 -0
- diffneusim/rl/imitation_reward_v2.py +248 -0
- diffneusim/rl/imitation_reward_v3.py +349 -0
- diffneusim/rl/latent_task.py +175 -0
- diffneusim/rl/llc_reward.py +316 -0
- diffneusim/rl/millard_curves_torch.py +154 -0
- diffneusim/rl/mirror_symmetry.py +212 -0
- diffneusim/rl/model_path.py +35 -0
- diffneusim/rl/mvae_recon.py +123 -0
- diffneusim/rl/nets_shac.py +599 -0
- diffneusim/rl/reset_pool.py +154 -0
- diffneusim/rl/sapo_capture.py +873 -0
- diffneusim/rl/sapo_vec.py +1051 -0
- diffneusim/rl/shac_vec.py +346 -0
- diffneusim/rl/state_prior.py +151 -0
- diffneusim/rl/step_library.py +105 -0
- diffneusim/rl/task_walk_env.py +1793 -0
- diffneusim/rl/task_walk_reward.py +3300 -0
- diffneusim/run.py +23 -0
- diffneusim/run_env.py +46 -0
- diffneusim/tasks/__init__.py +147 -0
- diffneusim/tasks/legacy_names.py +63 -0
- diffneusim/tasks/paths.py +79 -0
- diffneusim/tasks/settings.py +202 -0
- diffneusim/third_party/instantmimic_947430ee/LICENSE +202 -0
- diffneusim/third_party/instantmimic_947430ee/NOTICE +19 -0
- diffneusim/third_party/instantmimic_947430ee/README.md +31 -0
- diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/benchmark_protocol.py +106 -0
- diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/metrics.py +214 -0
- diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/reference.py +513 -0
- diffneusim/third_party/instantmimic_947430ee/instantmimic/motion/quaternion.py +193 -0
- diffneusim/train/__init__.py +0 -0
- diffneusim/train/eval_ckpt.py +239 -0
- diffneusim/train/eval_mimic.py +133 -0
- diffneusim/train/gait_report.py +203 -0
- diffneusim/train/gcot_chain.py +51 -0
- diffneusim/train/levers.py +135 -0
- diffneusim/train/masked_reset.py +314 -0
- diffneusim/train/rl_algorithm_suite.py +917 -0
- diffneusim/train/train14.py +240 -0
- diffneusim/train/train_tw14.py +674 -0
- diffneusim/viz/__init__.py +5 -0
- diffneusim/viz/__main__.py +41 -0
- diffneusim/viz/camera.py +115 -0
- diffneusim/viz/dnrec.py +118 -0
- diffneusim/viz/dnrec_io.py +686 -0
- diffneusim/viz/hud.py +565 -0
- diffneusim/viz/meshes.py +458 -0
- diffneusim/viz/play.py +237 -0
- diffneusim/viz/record.py +74 -0
- diffneusim/viz/render.py +1402 -0
- diffneusim/viz/renderer.py +268 -0
- diffneusim/viz/rl_env_render.py +635 -0
- diffneusim/viz/snapshot.py +54 -0
- diffneusim/viz/strobe.py +124 -0
- diffneusim/viz/to_mp4.py +58 -0
- diffneusim/viz/ui.py +481 -0
- diffneusim/viz/viewer.py +2086 -0
- diffneusim-1.0.0.dist-info/METADATA +226 -0
- diffneusim-1.0.0.dist-info/RECORD +682 -0
- diffneusim-1.0.0.dist-info/WHEEL +5 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSE +201 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/BSD-3-Clause-NC-ARMS-hand-wrist-4.3.txt +20 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/BSD-3-Clause-NC-MoBL-ARMS.txt +25 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/CC-BY-3.0-OpenSim-geometry.txt +25 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Christophy2012-lumbarspine.txt +10 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Lai2017-model-high-flex.txt +10 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Lee2015-hand_muscle.txt +11 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Rajagopal2016-full_body.txt +11 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Uhlrich2022-fbmodpassivecal.txt +10 -0
- diffneusim-1.0.0.dist-info/licenses/NOTICE +274 -0
- diffneusim-1.0.0.dist-info/top_level.txt +1 -0
diffneusim/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""DiffNeuSim: a differentiable musculoskeletal simulator on the GPU."""
|
diffneusim/_cache.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Where the package builds its CPU libraries: never inside the installed package (it may be read-only, or shared by several users).
|
|
2
|
+
|
|
3
|
+
The root is $XDG_CACHE_HOME/diffneusim, or ~/.cache/diffneusim when XDG_CACHE_HOME is unset. Each library goes in a folder named by a
|
|
4
|
+
content tag over its sources, its flags and the compiler (path and --version), so a change to any of them builds anew and a stale build
|
|
5
|
+
is never reused. torch's extensions follow TORCH_EXTENSIONS_DIR (torch's own default otherwise).
|
|
6
|
+
"""
|
|
7
|
+
import os
|
|
8
|
+
import pathlib
|
|
9
|
+
import shutil
|
|
10
|
+
import subprocess
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def root():
|
|
14
|
+
x = os.environ.get("XDG_CACHE_HOME")
|
|
15
|
+
r = (pathlib.Path(x) if x else pathlib.Path.home() / ".cache") / "diffneusim"
|
|
16
|
+
r.mkdir(parents=True, exist_ok=True)
|
|
17
|
+
assert os.access(r, os.W_OK), (f"the build cache {r} is not writable: set XDG_CACHE_HOME to a writable folder "
|
|
18
|
+
"(diffneusim builds its CPU libraries there, never inside the package)")
|
|
19
|
+
return r
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def compiler(cxx):
|
|
23
|
+
"""[path, first line of --version] of the C++ compiler, for the build tag"""
|
|
24
|
+
path = shutil.which(cxx)
|
|
25
|
+
assert path is not None, f"the C++ compiler {cxx!r} is not on PATH (diffneusim builds its CPU libraries with it once)"
|
|
26
|
+
ver = subprocess.run([path, "--version"], capture_output=True, text=True, check=True).stdout.splitlines()[0]
|
|
27
|
+
return [os.path.realpath(path), ver]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def build_lib(kind, name, sources, cmd):
|
|
31
|
+
"""build sources[0] (its includes in the tag) with cmd + ["-o", out] into <root>/<kind>/<tag>/<name> once; return the library path.
|
|
32
|
+
cmd[0] is the compiler. The build lands under a temporary name and is renamed, so parallel first runs never load a partial file."""
|
|
33
|
+
from diffneusim._paths import ROOT
|
|
34
|
+
from diffneusim.engine import build_tag as BT
|
|
35
|
+
tag = BT.tag(ROOT, sources, list(cmd[1:]) + compiler(cmd[0]))
|
|
36
|
+
lib = root() / kind / tag / name
|
|
37
|
+
if not lib.exists():
|
|
38
|
+
lib.parent.mkdir(parents=True, exist_ok=True)
|
|
39
|
+
tmp = lib.with_name(f"{name}.{os.getpid()}.tmp")
|
|
40
|
+
subprocess.run(list(cmd) + ["-o", str(tmp)], check=True)
|
|
41
|
+
os.replace(tmp, lib)
|
|
42
|
+
return lib
|
diffneusim/_paths.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"""The package directory: the engine's CUDA sources (core/, bindings/), the bodies (models/), the reference data (data/) and the vendored
|
|
2
|
+
code (third_party/) ship inside it, so an installed package and a clone read the same files."""
|
|
3
|
+
import pathlib
|
|
4
|
+
|
|
5
|
+
ROOT = pathlib.Path(__file__).resolve().parent
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// D16 fused env side, the torch extension (engine C, 2026-11-03; tools/d16_fused_env/DESIGN.md): Fwd14r / Bwd14r
|
|
2
|
+
// (core/soft/gpu/rew14.cuh) for env14's E0_ENV14_REW14 path. Graph-capturable: init() keeps the reference tables and does the
|
|
3
|
+
// one-time setup (the shared-memory attribute, the scan tables) before any capture; fwd / bwd only launch on the current stream
|
|
4
|
+
// into the caller's preallocated tensors (no allocation, no host sync). Loaded by tools/d16_fused_env/rew14.py.
|
|
5
|
+
#include <torch/extension.h>
|
|
6
|
+
#include <ATen/cuda/CUDAContext.h>
|
|
7
|
+
|
|
8
|
+
#include <vector>
|
|
9
|
+
|
|
10
|
+
#if defined(D16_BODY_HEADER) // a body of the 14x layout (D16_BODY; rew14.py asserts its sizes), e.g. the imitation's N1 law on the RHLS floor
|
|
11
|
+
#include D16_BODY_HEADER
|
|
12
|
+
#else
|
|
13
|
+
#include "soft/gpu/generated/x14_soft_f1c2243ae6be_mmfloor.cuh"
|
|
14
|
+
#define D16_X14_NS d16::x14_soft_f1c2243ae6be_mmfloor
|
|
15
|
+
#endif
|
|
16
|
+
#include "soft/gpu/rew14.cuh"
|
|
17
|
+
|
|
18
|
+
namespace {
|
|
19
|
+
namespace A = d16::x14adj;
|
|
20
|
+
namespace MD = D16_X14_NS;
|
|
21
|
+
|
|
22
|
+
template <class T> struct Node {
|
|
23
|
+
bool ready = false;
|
|
24
|
+
A::Rew14Model<T> M;
|
|
25
|
+
A::Rew14Ref<T> R;
|
|
26
|
+
std::vector<torch::Tensor> keep; // the tables and V, alive for the node's lifetime
|
|
27
|
+
const T* V = nullptr;
|
|
28
|
+
};
|
|
29
|
+
Node<float> g32;
|
|
30
|
+
Node<double> g64;
|
|
31
|
+
|
|
32
|
+
void need(const torch::Tensor& t, at::ScalarType st, std::vector<int64_t> shape, const char* name) {
|
|
33
|
+
TORCH_CHECK(t.is_cuda() && t.scalar_type() == st && t.is_contiguous(), name, ": a contiguous CUDA tensor of the right dtype");
|
|
34
|
+
TORCH_CHECK(t.sizes().vec() == shape, name, ": shape ", t.sizes(), " expected ", c10::IntArrayRef(shape));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
template <class T>
|
|
38
|
+
void init_t(Node<T>& N, at::ScalarType st, const torch::Tensor& site_b, const torch::Tensor& site_pq, const torch::Tensor& wk, int64_t root_b,
|
|
39
|
+
const std::vector<torch::Tensor>& tabs) {
|
|
40
|
+
TORCH_CHECK(site_b.is_cpu() && site_b.numel() == A::kRS && site_pq.is_cpu() && site_pq.numel() == 7 * A::kRS && wk.is_cpu() &&
|
|
41
|
+
wk.numel() == 2 * A::kRT, "rew14.init: the site map and MM_TERMS on the CPU");
|
|
42
|
+
TORCH_CHECK(tabs.size() == 12, "rew14.init: 12 reference tables");
|
|
43
|
+
auto sb = site_b.to(torch::kInt32).contiguous(); auto pq = site_pq.to(torch::kFloat64).contiguous(); auto w = wk.to(torch::kFloat64).contiguous();
|
|
44
|
+
for (int i = 0; i < A::kRS; ++i) {
|
|
45
|
+
N.M.site_b[i] = sb.data_ptr<int>()[i];
|
|
46
|
+
for (int k = 0; k < 3; ++k) N.M.site_p[i][k] = static_cast<T>(pq.data_ptr<double>()[7 * i + k]);
|
|
47
|
+
for (int k = 0; k < 4; ++k) N.M.site_q[i][k] = static_cast<T>(pq.data_ptr<double>()[7 * i + 3 + k]);
|
|
48
|
+
}
|
|
49
|
+
for (int t = 0; t < A::kRT; ++t) { N.M.w[t] = static_cast<T>(w.data_ptr<double>()[t]); N.M.k[t] = static_cast<T>(w.data_ptr<double>()[A::kRT + t]); }
|
|
50
|
+
N.M.root_b = static_cast<int>(root_b);
|
|
51
|
+
const int64_t ttot = tabs[7].size(0);
|
|
52
|
+
const std::vector<std::vector<int64_t>> shp = {{48, ttot}, {48, ttot}, {48, ttot}, {48, ttot}, {3, ttot}, {4, ttot}, {3, ttot},
|
|
53
|
+
{ttot, A::NQ}, {ttot, A::NV}, {ttot, 48}, {ttot, 3}, {ttot, 6}};
|
|
54
|
+
N.keep.clear();
|
|
55
|
+
const T* p[12];
|
|
56
|
+
for (int k = 0; k < 12; ++k) { need(tabs[k], st, shp[k], "rew14.init: a reference table"); N.keep.push_back(tabs[k]); p[k] = tabs[k].data_ptr<T>(); }
|
|
57
|
+
N.R = A::Rew14Ref<T>{p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], static_cast<long>(ttot)};
|
|
58
|
+
auto Vt = torch::from_blob(const_cast<double*>(MD::kValues), {MD::NVALS}, torch::kFloat64).to(tabs[0].device()).to(st).contiguous();
|
|
59
|
+
N.keep.push_back(Vt);
|
|
60
|
+
N.V = Vt.data_ptr<T>();
|
|
61
|
+
d16::rew14::rew14_setup<T>();
|
|
62
|
+
N.ready = true;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
void init(const torch::Tensor& site_b, const torch::Tensor& site_pq, const torch::Tensor& wk, int64_t root_b, const std::vector<torch::Tensor>& tabs) {
|
|
66
|
+
TORCH_CHECK(!tabs.empty(), "rew14.init: tables");
|
|
67
|
+
if (tabs[0].scalar_type() == torch::kFloat32) init_t(g32, torch::kFloat32, site_b, site_pq, wk, root_b, tabs);
|
|
68
|
+
else init_t(g64, torch::kFloat64, site_b, site_pq, wk, root_b, tabs);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
template <class T>
|
|
72
|
+
void fwd_t(const Node<T>& N, at::ScalarType st, const torch::Tensor& start, const torch::Tensor& clipT, const torch::Tensor& loop,
|
|
73
|
+
const torch::Tensor& phase, const torch::Tensor& q1, const torch::Tensor& v1, const torch::Tensor& lce1, torch::Tensor& r,
|
|
74
|
+
torch::Tensor& term, torch::Tensor& obs) {
|
|
75
|
+
TORCH_CHECK(N.ready, "rew14: init() first, for this dtype");
|
|
76
|
+
const int64_t n = q1.size(0);
|
|
77
|
+
need(start, torch::kInt64, {n}, "start"); need(clipT, torch::kInt64, {n}, "clipT"); need(loop, torch::kUInt8, {n}, "loop");
|
|
78
|
+
need(phase, st, {n}, "phase"); need(q1, st, {n, A::NQ}, "q1"); need(v1, st, {n, A::NV}, "v1"); need(lce1, st, {n, A::kNM14}, "lce1");
|
|
79
|
+
need(r, st, {n}, "r"); need(term, st, {n, d16::rew14::kTerm}, "term"); need(obs, st, {n, A::kObs}, "obs");
|
|
80
|
+
d16::rew14::rew14_fwd<T>(static_cast<int>(n), at::cuda::getCurrentCUDAStream(), N.V, N.M, N.R, reinterpret_cast<const long*>(start.data_ptr<int64_t>()),
|
|
81
|
+
reinterpret_cast<const long*>(clipT.data_ptr<int64_t>()), loop.data_ptr<uint8_t>(), phase.data_ptr<T>(), q1.data_ptr<T>(),
|
|
82
|
+
v1.data_ptr<T>(), lce1.data_ptr<T>(), r.data_ptr<T>(), term.data_ptr<T>(), obs.data_ptr<T>());
|
|
83
|
+
}
|
|
84
|
+
template <class T>
|
|
85
|
+
void bwd_t(const Node<T>& N, at::ScalarType st, const torch::Tensor& start, const torch::Tensor& clipT, const torch::Tensor& loop,
|
|
86
|
+
const torch::Tensor& phase, const torch::Tensor& q1, const torch::Tensor& v1, const torch::Tensor& rb, const torch::Tensor& ob,
|
|
87
|
+
torch::Tensor& qg, torch::Tensor& vg, torch::Tensor& lg) {
|
|
88
|
+
TORCH_CHECK(N.ready, "rew14: init() first, for this dtype");
|
|
89
|
+
const int64_t n = q1.size(0);
|
|
90
|
+
need(start, torch::kInt64, {n}, "start"); need(clipT, torch::kInt64, {n}, "clipT"); need(loop, torch::kUInt8, {n}, "loop");
|
|
91
|
+
need(phase, st, {n}, "phase"); need(q1, st, {n, A::NQ}, "q1"); need(v1, st, {n, A::NV}, "v1");
|
|
92
|
+
need(rb, st, {n}, "r_bar"); need(ob, st, {n, A::kObs}, "obs_bar");
|
|
93
|
+
need(qg, st, {n, A::NQ}, "q1_bar"); need(vg, st, {n, A::NV}, "v1_bar"); need(lg, st, {n, A::kNM14}, "lce1_bar");
|
|
94
|
+
d16::rew14::rew14_bwd<T>(static_cast<int>(n), at::cuda::getCurrentCUDAStream(), N.V, N.M, N.R, reinterpret_cast<const long*>(start.data_ptr<int64_t>()),
|
|
95
|
+
reinterpret_cast<const long*>(clipT.data_ptr<int64_t>()), loop.data_ptr<uint8_t>(), phase.data_ptr<T>(), q1.data_ptr<T>(),
|
|
96
|
+
v1.data_ptr<T>(), rb.data_ptr<T>(), ob.data_ptr<T>(), qg.data_ptr<T>(), vg.data_ptr<T>(), lg.data_ptr<T>());
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
void fwd(const torch::Tensor& start, const torch::Tensor& clipT, const torch::Tensor& loop, const torch::Tensor& phase, const torch::Tensor& q1,
|
|
100
|
+
const torch::Tensor& v1, const torch::Tensor& lce1, torch::Tensor r, torch::Tensor term, torch::Tensor obs) {
|
|
101
|
+
if (q1.scalar_type() == torch::kFloat32) fwd_t(g32, torch::kFloat32, start, clipT, loop, phase, q1, v1, lce1, r, term, obs);
|
|
102
|
+
else fwd_t(g64, torch::kFloat64, start, clipT, loop, phase, q1, v1, lce1, r, term, obs);
|
|
103
|
+
}
|
|
104
|
+
void bwd(const torch::Tensor& start, const torch::Tensor& clipT, const torch::Tensor& loop, const torch::Tensor& phase, const torch::Tensor& q1,
|
|
105
|
+
const torch::Tensor& v1, const torch::Tensor& rb, const torch::Tensor& ob, torch::Tensor qg, torch::Tensor vg, torch::Tensor lg) {
|
|
106
|
+
if (q1.scalar_type() == torch::kFloat32) bwd_t(g32, torch::kFloat32, start, clipT, loop, phase, q1, v1, rb, ob, qg, vg, lg);
|
|
107
|
+
else bwd_t(g64, torch::kFloat64, start, clipT, loop, phase, q1, v1, rb, ob, qg, vg, lg);
|
|
108
|
+
}
|
|
109
|
+
} // namespace
|
|
110
|
+
|
|
111
|
+
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
|
|
112
|
+
m.def("init", &init, "the site map, MM_TERMS and the 12 reference tables (CUDA, the node's dtype); the one-time setup");
|
|
113
|
+
m.def("fwd", &fwd, "Fwd14r into r [n], term [n][8], obs [n][708] (preallocated)");
|
|
114
|
+
m.def("bwd", &bwd, "Bwd14r into q1_bar [n][40] (raw), v1_bar [n][37], lce1_bar [n][356] (preallocated)");
|
|
115
|
+
}
|
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
// D16 14x (2026-11-02): the C ABI of the 14x soft law's CPU f64 reference (core/soft/x14/law14.h), for the parity
|
|
2
|
+
// tools (tools/d16_14x/x14_parity.py), the composed gate (soft_substep: one substep with an external generalized force) and the
|
|
3
|
+
// GPU gates. The model comes from the law JSON as flat arrays (tools/d16_14x/soft14.py documents each layout).
|
|
4
|
+
#include <algorithm>
|
|
5
|
+
#include <cmath>
|
|
6
|
+
#include <cstring>
|
|
7
|
+
#include <stdexcept>
|
|
8
|
+
#include <thread>
|
|
9
|
+
#include <vector>
|
|
10
|
+
|
|
11
|
+
#include "soft/hand.h"
|
|
12
|
+
#include "soft/tape.h"
|
|
13
|
+
#include "soft/x14/jvp14.h" // law14.h and its forward-mode derivative (C2 for the 14x)
|
|
14
|
+
|
|
15
|
+
using js::soft::x14::Model14;
|
|
16
|
+
namespace X = js::soft::x14;
|
|
17
|
+
|
|
18
|
+
extern "C" {
|
|
19
|
+
|
|
20
|
+
// bodies: bint [nb][6] = parent, jtype, qadr, dadr, master_qadr, master_dadr; bdbl [nb][24] = coef, axis 3, pos 3, quat 4,
|
|
21
|
+
// ipos 3, iquat 4, inertia 3, mass, invweight0 2; dof entries: ent_int [nent][2] = dof, body; ent_coef [nent]
|
|
22
|
+
void* s14_new(int nb, int nq, int nv, const int* bint, const double* bdbl, int nent, const int* ent_int, const double* ent_coef,
|
|
23
|
+
const double* armature, const double* damping) {
|
|
24
|
+
Model14* m = new Model14;
|
|
25
|
+
m->nq = nq; m->nv = nv;
|
|
26
|
+
m->bodies.resize(nb);
|
|
27
|
+
for (int b = 0; b < nb; ++b) {
|
|
28
|
+
X::Body14& x = m->bodies[b];
|
|
29
|
+
const int* i = bint + 6 * b;
|
|
30
|
+
const double* d = bdbl + 24 * b;
|
|
31
|
+
x.parent = i[0]; x.jtype = i[1]; x.qadr = i[2]; x.dadr = i[3]; x.master_qadr = i[4]; x.master_dadr = i[5];
|
|
32
|
+
x.coef = d[0];
|
|
33
|
+
std::memcpy(x.axis, d + 1, 3 * sizeof(double)); std::memcpy(x.pos, d + 4, 3 * sizeof(double));
|
|
34
|
+
std::memcpy(x.quat, d + 7, 4 * sizeof(double)); std::memcpy(x.ipos, d + 11, 3 * sizeof(double));
|
|
35
|
+
std::memcpy(x.iquat, d + 14, 4 * sizeof(double)); std::memcpy(x.inertia, d + 18, 3 * sizeof(double));
|
|
36
|
+
x.mass = d[21]; x.invweight0[0] = d[22]; x.invweight0[1] = d[23];
|
|
37
|
+
}
|
|
38
|
+
m->dofs.assign(nv, {});
|
|
39
|
+
for (int e = 0; e < nent; ++e) m->dofs[ent_int[2 * e]].push_back(X::DofEnt{ent_int[2 * e + 1], ent_coef[e]});
|
|
40
|
+
m->armature.assign(armature, armature + nv);
|
|
41
|
+
m->damping.assign(damping, damping + nv);
|
|
42
|
+
m->finalize();
|
|
43
|
+
return m;
|
|
44
|
+
}
|
|
45
|
+
void s14_free(void* h) { delete static_cast<Model14*>(h); }
|
|
46
|
+
|
|
47
|
+
// geoms: g_int [ng][2] = body, type; g_dbl [ng][10] = size 3, pos 3, quat 4. pairs: p_int [np][4] = g1, g2, condim, foot (-1);
|
|
48
|
+
// p_dbl [np][12] = friction 3, solref 2, solimp 5, margin, gap. limits: l_int [nl][2] = dof, qadr; l_dbl [nl][13] = coef,
|
|
49
|
+
// range 2, solref 2, solimp 5, margin, diagA. springs: s_int [ns][2] = dof, qadr; s_dbl [ns][2] = k, rest. ball_rom: r_int
|
|
50
|
+
// [nr][2] = qadr, dadr; r_dbl [nr][12] = lo 3, hi 3, d_lim 3, exp_a, exp_w, beta. opt_d [7] = gravity 3, timestep, impratio,
|
|
51
|
+
// tolerance, ls_tolerance; opt_i [3] = iterations, ls_iterations, nsub
|
|
52
|
+
void s14_law(void* h, int ng, const int* g_int, const double* g_dbl, int np, const int* p_int, const double* p_dbl, int nl,
|
|
53
|
+
const int* l_int, const double* l_dbl, int ns, const int* s_int, const double* s_dbl, int nr, const int* r_int,
|
|
54
|
+
const double* r_dbl, const double* opt_d, const int* opt_i) {
|
|
55
|
+
Model14& m = *static_cast<Model14*>(h);
|
|
56
|
+
m.geoms.resize(ng);
|
|
57
|
+
for (int g = 0; g < ng; ++g) {
|
|
58
|
+
js::soft::SoftGeom& x = m.geoms[g];
|
|
59
|
+
x.body = g_int[2 * g]; x.type = g_int[2 * g + 1];
|
|
60
|
+
std::memcpy(x.size, g_dbl + 10 * g, 3 * sizeof(double)); std::memcpy(x.pos, g_dbl + 10 * g + 3, 3 * sizeof(double));
|
|
61
|
+
std::memcpy(x.quat, g_dbl + 10 * g + 6, 4 * sizeof(double));
|
|
62
|
+
}
|
|
63
|
+
m.pairs.resize(np);
|
|
64
|
+
for (int p = 0; p < np; ++p) {
|
|
65
|
+
js::soft::SoftPair& x = m.pairs[p];
|
|
66
|
+
x.g1 = p_int[4 * p]; x.g2 = p_int[4 * p + 1]; x.condim = p_int[4 * p + 2]; x.foot = p_int[4 * p + 3];
|
|
67
|
+
const double* d = p_dbl + 12 * p;
|
|
68
|
+
std::memcpy(x.friction, d, 3 * sizeof(double)); std::memcpy(x.solref, d + 3, 2 * sizeof(double));
|
|
69
|
+
std::memcpy(x.solimp, d + 5, 5 * sizeof(double)); x.margin = d[10]; x.gap = d[11];
|
|
70
|
+
}
|
|
71
|
+
m.limits.resize(nl);
|
|
72
|
+
for (int l = 0; l < nl; ++l) {
|
|
73
|
+
X::Limit14& x = m.limits[l];
|
|
74
|
+
x.dof = l_int[2 * l]; x.qadr = l_int[2 * l + 1];
|
|
75
|
+
const double* d = l_dbl + 13 * l;
|
|
76
|
+
x.coef = d[0]; x.range[0] = d[1]; x.range[1] = d[2];
|
|
77
|
+
std::memcpy(x.solref, d + 3, 2 * sizeof(double)); std::memcpy(x.solimp, d + 5, 5 * sizeof(double));
|
|
78
|
+
x.margin = d[10]; x.diagA = d[11];
|
|
79
|
+
}
|
|
80
|
+
m.springs.resize(ns);
|
|
81
|
+
for (int s = 0; s < ns; ++s) m.springs[s] = X::Spring14{s_int[2 * s], s_int[2 * s + 1], s_dbl[2 * s], s_dbl[2 * s + 1]};
|
|
82
|
+
m.roms.resize(nr);
|
|
83
|
+
for (int r = 0; r < nr; ++r) {
|
|
84
|
+
X::BallRom14& x = m.roms[r];
|
|
85
|
+
x.qadr = r_int[2 * r]; x.dadr = r_int[2 * r + 1];
|
|
86
|
+
const double* d = r_dbl + 12 * r;
|
|
87
|
+
std::memcpy(x.lo, d, 3 * sizeof(double)); std::memcpy(x.hi, d + 3, 3 * sizeof(double));
|
|
88
|
+
std::memcpy(x.d_lim, d + 6, 3 * sizeof(double));
|
|
89
|
+
x.exp_a = d[9]; x.exp_w = d[10]; x.beta = d[11];
|
|
90
|
+
}
|
|
91
|
+
std::memcpy(m.gravity, opt_d, 3 * sizeof(double));
|
|
92
|
+
m.timestep = opt_d[3]; m.impratio = opt_d[4]; m.tolerance = opt_d[5]; m.ls_tolerance = opt_d[6];
|
|
93
|
+
m.iterations = opt_i[0]; m.ls_iterations = opt_i[1]; m.nsub = opt_i[2];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// the smooth terms at one state: xpos [nb][3], xquat [nb][4], xipos [nb][3], M [nv][nv], bias, passive, qfrc_smooth,
|
|
97
|
+
// qacc_smooth [nv]; tau_ext [nv] or null
|
|
98
|
+
void s14_smooth(void* h, const double* qpos, const double* qvel, const double* tau_ext, double* xpos, double* xquat, double* xipos,
|
|
99
|
+
double* M, double* bias, double* passive, double* qfrc_smooth, double* qacc_smooth) {
|
|
100
|
+
const Model14& m = *static_cast<Model14*>(h);
|
|
101
|
+
X::Smooth14 o;
|
|
102
|
+
X::smooth(m, qpos, qvel, tau_ext, o);
|
|
103
|
+
for (size_t b = 0; b < o.X.size(); ++b) {
|
|
104
|
+
for (int k = 0; k < 3; ++k) { xpos[3 * b + k] = o.X[b].xpos[k]; xipos[3 * b + k] = o.X[b].xipos[k]; }
|
|
105
|
+
for (int k = 0; k < 4; ++k) xquat[4 * b + k] = o.X[b].xquat[k];
|
|
106
|
+
}
|
|
107
|
+
std::memcpy(M, o.M.data(), o.M.size() * sizeof(double));
|
|
108
|
+
for (int i = 0; i < m.nv; ++i) { bias[i] = o.bias[i]; passive[i] = o.passive[i]; qfrc_smooth[i] = o.qfrc_smooth[i];
|
|
109
|
+
qacc_smooth[i] = o.qacc_smooth[i]; }
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// the contacts and rows at one state (cap rows / contacts at most; returns nefc, or -1 if over cap): type, id, J [cap][nv],
|
|
113
|
+
// pos, margin, diagA, aref, R, D; contacts: con_int [cap][3] = pair, slot, condim; con_dbl [cap][13] = dist, pos 3, frame 9
|
|
114
|
+
int s14_rows(void* h, const double* qpos, const double* qvel, double foot_friction, int cap, int* type, int* id, double* J,
|
|
115
|
+
double* pos, double* margin, double* diagA, double* aref, double* R, double* D, int* ncon, int* con_int,
|
|
116
|
+
double* con_dbl) {
|
|
117
|
+
const Model14& m = *static_cast<Model14*>(h);
|
|
118
|
+
std::vector<js::soft::BodyState<double>> Xs;
|
|
119
|
+
X::fk(m, qpos, Xs);
|
|
120
|
+
std::vector<js::soft::SoftContact<double>> con;
|
|
121
|
+
X::collide_all14(m.geoms.data(), static_cast<int>(m.geoms.size()), m.pairs.data(), static_cast<int>(m.pairs.size()),
|
|
122
|
+
Xs.data(), foot_friction, con);
|
|
123
|
+
js::soft::Rows<double> rows;
|
|
124
|
+
X::make_rows(m, Xs, con, qpos, qvel, rows);
|
|
125
|
+
if (rows.n > cap || static_cast<int>(con.size()) > cap) return -1;
|
|
126
|
+
for (int r = 0; r < rows.n; ++r) {
|
|
127
|
+
type[r] = rows.type[r]; id[r] = rows.id[r]; pos[r] = rows.pos[r]; margin[r] = rows.margin[r]; diagA[r] = rows.diagA[r];
|
|
128
|
+
aref[r] = rows.aref[r]; R[r] = rows.R[r]; D[r] = rows.D[r];
|
|
129
|
+
}
|
|
130
|
+
std::memcpy(J, rows.J.data(), rows.J.size() * sizeof(double));
|
|
131
|
+
*ncon = static_cast<int>(con.size());
|
|
132
|
+
for (size_t c = 0; c < con.size(); ++c) {
|
|
133
|
+
con_int[3 * c] = con[c].pair; con_int[3 * c + 1] = con[c].slot; con_int[3 * c + 2] = con[c].condim;
|
|
134
|
+
double* d = con_dbl + 13 * c;
|
|
135
|
+
d[0] = con[c].dist; d[1] = con[c].pos.x; d[2] = con[c].pos.y; d[3] = con[c].pos.z;
|
|
136
|
+
for (int k = 0; k < 3; ++k) { d[4 + 3 * k] = con[c].frame[k].x; d[5 + 3 * k] = con[c].frame[k].y; d[6 + 3 * k] = con[c].frame[k].z; }
|
|
137
|
+
}
|
|
138
|
+
return rows.n;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// the entry point (X14_COMPOSED_PREREG.md, agreed 2026-11-02 22:2x): one substep from (qpos, qvel, warm) with the external
|
|
142
|
+
// generalized force tau_ext [nv] added to qfrc_smooth as k_pre adds it; outputs to qpos1 / qvel1 / warm1 (inputs untouched);
|
|
143
|
+
// stats [6] = ncon, nefc, nlim, niter, warm_used, ran_out. foot_friction < 0: the exported values.
|
|
144
|
+
void soft_substep(void* h, const double* qpos, const double* qvel, const double* warm, const double* tau_ext, double foot_friction,
|
|
145
|
+
double* qpos1, double* qvel1, double* warm1, int* stats) {
|
|
146
|
+
const Model14& m = *static_cast<Model14*>(h);
|
|
147
|
+
std::memcpy(qpos1, qpos, m.nq * sizeof(double));
|
|
148
|
+
std::memcpy(qvel1, qvel, m.nv * sizeof(double));
|
|
149
|
+
std::memcpy(warm1, warm, m.nv * sizeof(double));
|
|
150
|
+
const X::Stats14 st = X::substep(m, qpos1, qvel1, warm1, tau_ext, foot_friction);
|
|
151
|
+
stats[0] = st.ncon; stats[1] = st.nefc; stats[2] = st.nlim; stats[3] = st.niter; stats[4] = st.warm_used; stats[5] = st.ran_out;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
} // extern "C"
|
|
155
|
+
|
|
156
|
+
namespace {
|
|
157
|
+
void need(bool ok, const char* what) { if (!ok) throw std::runtime_error(what); }
|
|
158
|
+
#if defined(D16_NV_GT64) // a phase B body (tools/d16_bodies/PHASE_B.md): the hand's M block is kernel P's split storage, its map given once by s14_set_split
|
|
159
|
+
static std::vector<int> g_split_word; // per dense packed entry its split word, -1 off the storage (gen_split.py's gSplitWord)
|
|
160
|
+
static int g_split_words = -1;
|
|
161
|
+
static js::soft::HandLayout hand14_layout(int nv, int nc, int nr, int kdof) {
|
|
162
|
+
need(g_split_words > 0 && static_cast<int>(g_split_word.size()) == nv * (nv + 1) / 2, "hand: a phase B body needs its split map first (s14_set_split)");
|
|
163
|
+
return js::soft::hand_layout(nv, nc, nr, kdof, g_split_words);
|
|
164
|
+
}
|
|
165
|
+
#endif
|
|
166
|
+
} // namespace
|
|
167
|
+
|
|
168
|
+
extern "C" {
|
|
169
|
+
// D16 14x hand: the CPU reference record of one state (what the 14x k_pre writes; core/soft/hand.h's layout), from law14.h: the
|
|
170
|
+
// smooth terms with tau_ext, the contacts and rows, the contact-frame Jacobian on each contact's support. Two 14x rules:
|
|
171
|
+
// support: dof d is in a contact's support iff its driven joints on b2's chain differ from those on b1's (a coupled master
|
|
172
|
+
// can drive a joint on the shared path and another on one branch only; the G1's dof-mask rule would drop it). The shared
|
|
173
|
+
// joints' terms are computed identically on both sides and cancel exactly.
|
|
174
|
+
// limit rows in unit form (KPRE14_PREREG.md): a row J = +-c e_m is written as J' = sign(J) e_m with D' = c^2 D and
|
|
175
|
+
// aref' = aref / |c| (the same cost, active test and force J' f'), so the hand's limit row stays a signed unit row.
|
|
176
|
+
// rec64 / rec32 [words] (either may be null). Over a capacity the counts carry overflow 1 and the tables stop there.
|
|
177
|
+
void s14_hand(void* h, const double* qpos, const double* qvel, const double* tau_ext, double foot_friction, int nc, int nr, int kdof,
|
|
178
|
+
double* rec64, float* rec32) {
|
|
179
|
+
const Model14& m = *static_cast<Model14*>(h);
|
|
180
|
+
const int nv = m.nv, nb = static_cast<int>(m.bodies.size());
|
|
181
|
+
#if defined(D16_NV_GT64)
|
|
182
|
+
const js::soft::HandLayout L = hand14_layout(nv, nc, nr, kdof);
|
|
183
|
+
#else
|
|
184
|
+
const js::soft::HandLayout L = js::soft::hand_layout(nv, nc, nr, kdof);
|
|
185
|
+
#endif
|
|
186
|
+
need(js::soft::hand_layout_ok(L, static_cast<int>(m.pairs.size())), "hand: field widths");
|
|
187
|
+
X::Smooth14 st;
|
|
188
|
+
X::smooth(m, qpos, qvel, tau_ext, st);
|
|
189
|
+
std::vector<js::soft::SoftContact<double>> con;
|
|
190
|
+
X::collide_all14(m.geoms.data(), static_cast<int>(m.geoms.size()), m.pairs.data(), static_cast<int>(m.pairs.size()),
|
|
191
|
+
st.X.data(), foot_friction, con);
|
|
192
|
+
js::soft::Rows<double> rows;
|
|
193
|
+
X::make_rows(m, st.X, con, qpos, qvel, rows);
|
|
194
|
+
// per body, the (dof, body) entries on its chain
|
|
195
|
+
std::vector<std::vector<long long>> chain(nb);
|
|
196
|
+
for (int d = 0; d < nv; ++d)
|
|
197
|
+
for (const X::DofEnt& e : m.dofs[d])
|
|
198
|
+
for (int b = 1; b < nb; ++b)
|
|
199
|
+
if (m.anc[b][e.body]) chain[b].push_back(static_cast<long long>(d) * 1000 + e.body);
|
|
200
|
+
for (auto& c : chain) std::sort(c.begin(), c.end());
|
|
201
|
+
auto entries_of = [&](int b, int d) {
|
|
202
|
+
std::vector<long long> o;
|
|
203
|
+
if (b <= 0) return o;
|
|
204
|
+
for (long long x : chain[b]) if (x / 1000 == d) o.push_back(x);
|
|
205
|
+
return o;
|
|
206
|
+
};
|
|
207
|
+
std::vector<double> V(L.words, 0.0);
|
|
208
|
+
std::vector<uint32_t> U(L.words, 0u);
|
|
209
|
+
std::vector<char> isint(L.words, 0);
|
|
210
|
+
auto put_u = [&](int w, uint32_t x) { U[w] = x; isint[w] = 1; };
|
|
211
|
+
#if defined(D16_NV_GT64) // M through the split map: an entry off the storage must be an exact zero
|
|
212
|
+
for (int i = 0; i < nv; ++i)
|
|
213
|
+
for (int j = 0; j <= i; ++j) {
|
|
214
|
+
const int w = g_split_word[static_cast<size_t>(i) * (i + 1) / 2 + j];
|
|
215
|
+
const double x = st.M[static_cast<size_t>(i) * nv + j];
|
|
216
|
+
if (w >= 0) V[L.M + w] = x;
|
|
217
|
+
else need(x == 0.0, "hand: an entry of M off the split storage");
|
|
218
|
+
}
|
|
219
|
+
for (int i = 0; i < nv; ++i) { V[L.qfrc + i] = st.qfrc_smooth[i]; V[L.qacc + i] = st.qacc_smooth[i]; }
|
|
220
|
+
for (int k = 0; k < L.n_clamp; ++k) put_u(L.clamp + k, 0u);
|
|
221
|
+
#else
|
|
222
|
+
for (int i = 0; i < nv; ++i)
|
|
223
|
+
for (int j = 0; j <= i; ++j) V[L.M + i * (i + 1) / 2 + j] = st.M[static_cast<size_t>(i) * nv + j];
|
|
224
|
+
for (int i = 0; i < nv; ++i) { V[L.qfrc + i] = st.qfrc_smooth[i]; V[L.qacc + i] = st.qacc_smooth[i]; }
|
|
225
|
+
put_u(L.clamp, 0u); put_u(L.clamp + 1, 0u); // no PD actuators on the 14x
|
|
226
|
+
#endif
|
|
227
|
+
const int ncon = static_cast<int>(con.size());
|
|
228
|
+
int nlim = 0;
|
|
229
|
+
for (int r = 0; r < rows.n; ++r) nlim += rows.type[r] == js::soft::kRowLimit;
|
|
230
|
+
const bool ovf = ncon > nc || rows.n > nr;
|
|
231
|
+
const int nc_w = ncon < nc ? ncon : nc;
|
|
232
|
+
int nr_w = rows.n < nr ? rows.n : nr;
|
|
233
|
+
for (int r = 0; r < nr_w; ++r) if (rows.type[r] != js::soft::kRowLimit && rows.id[r] >= nc_w) { nr_w = r; break; }
|
|
234
|
+
put_u(L.counts, static_cast<uint32_t>(nc_w)); put_u(L.counts + 1, static_cast<uint32_t>(nr_w));
|
|
235
|
+
put_u(L.counts + 2, static_cast<uint32_t>(nlim)); put_u(L.counts + 3, ovf ? 1u : 0u);
|
|
236
|
+
{
|
|
237
|
+
double mn = 1e300;
|
|
238
|
+
for (int c = 0; c < nc_w; ++c) {
|
|
239
|
+
const js::soft::SoftPair& pr = m.pairs[con[c].pair];
|
|
240
|
+
const js::soft::SoftGeom &g1 = m.geoms[pr.g1], &g2 = m.geoms[pr.g2];
|
|
241
|
+
if (g1.type != 0 && g2.type != 0) mn = std::min(mn, con[c].dist + g1.size[0] + g2.size[0]);
|
|
242
|
+
}
|
|
243
|
+
V[L.min_nu] = mn >= 1e30 ? INFINITY : mn;
|
|
244
|
+
}
|
|
245
|
+
std::vector<int> row0(ncon, -1);
|
|
246
|
+
for (int r = 0; r < rows.n; ++r)
|
|
247
|
+
if (rows.type[r] != js::soft::kRowLimit && row0[rows.id[r]] < 0) row0[rows.id[r]] = r;
|
|
248
|
+
std::vector<double> jp1(3 * nv), jp2(3 * nv);
|
|
249
|
+
std::vector<uint8_t> dofs(static_cast<size_t>(nc) * kdof, 0xFF);
|
|
250
|
+
for (int c = 0; c < nc_w; ++c) {
|
|
251
|
+
const js::soft::SoftContact<double>& ct = con[c];
|
|
252
|
+
const js::soft::SoftPair& pr = m.pairs[ct.pair];
|
|
253
|
+
const int b1 = m.geoms[pr.g1].body, b2 = m.geoms[pr.g2].body;
|
|
254
|
+
const double p[3] = {ct.pos.x, ct.pos.y, ct.pos.z};
|
|
255
|
+
X::jac(m, st.X, b2, p, jp2.data(), static_cast<double*>(nullptr));
|
|
256
|
+
X::jac(m, st.X, b1, p, jp1.data(), static_cast<double*>(nullptr));
|
|
257
|
+
int nd = 0;
|
|
258
|
+
for (int i = 0; i < nv; ++i) {
|
|
259
|
+
if (entries_of(b2, i) == entries_of(b1, i)) continue;
|
|
260
|
+
need(nd < kdof, "hand: a contact's support exceeds kdof");
|
|
261
|
+
const double dx = jp2[i] - jp1[i], dy = jp2[nv + i] - jp1[nv + i], dz = jp2[2 * nv + i] - jp1[2 * nv + i];
|
|
262
|
+
for (int k = 0; k < 3; ++k)
|
|
263
|
+
V[L.conJ + (c * 3 + k) * kdof + nd] = ct.frame[k].x * dx + ct.frame[k].y * dy + ct.frame[k].z * dz;
|
|
264
|
+
dofs[static_cast<size_t>(c) * kdof + nd] = static_cast<uint8_t>(i);
|
|
265
|
+
++nd;
|
|
266
|
+
}
|
|
267
|
+
need(row0[c] >= 0 && row0[c] < 256, "hand: contact row0");
|
|
268
|
+
put_u(L.conmeta + c, js::soft::hand_conmeta(ct.pair, ct.slot, ct.condim, row0[c], nd));
|
|
269
|
+
V[L.conmu + c] = ct.mu;
|
|
270
|
+
}
|
|
271
|
+
for (int w4 = 0; w4 < js::soft::tape_ceil(nc * kdof, 4); ++w4) {
|
|
272
|
+
uint32_t x = 0;
|
|
273
|
+
for (int b = 0; b < 4; ++b) x |= static_cast<uint32_t>(dofs[4 * w4 + b]) << (8 * b);
|
|
274
|
+
put_u(L.condof + w4, x);
|
|
275
|
+
}
|
|
276
|
+
for (int w = L.condof; w < L.conmeta; ++w) if (!isint[w]) put_u(w, 0u);
|
|
277
|
+
for (int r = 0; r < nr_w; ++r) {
|
|
278
|
+
uint32_t meta;
|
|
279
|
+
if (rows.type[r] == js::soft::kRowLimit) {
|
|
280
|
+
const X::Limit14& lm = m.limits[rows.id[r]];
|
|
281
|
+
const double Jd = rows.J[static_cast<size_t>(r) * nv + lm.dof], c = std::fabs(lm.coef);
|
|
282
|
+
V[L.aref + r] = rows.aref[r] / c;
|
|
283
|
+
V[L.efcD + r] = rows.D[r] * c * c;
|
|
284
|
+
meta = js::soft::hand_rowmeta(js::soft::kHandRowLimit, lm.dof, 0, Jd < 0);
|
|
285
|
+
} else {
|
|
286
|
+
V[L.aref + r] = rows.aref[r];
|
|
287
|
+
V[L.efcD + r] = rows.D[r];
|
|
288
|
+
const int c = rows.id[r];
|
|
289
|
+
const uint32_t t = rows.type[r] == js::soft::kRowFrictionless ? js::soft::kHandRowFrictionless : js::soft::kHandRowPyramidal;
|
|
290
|
+
meta = js::soft::hand_rowmeta(t, c, r - row0[c], false);
|
|
291
|
+
}
|
|
292
|
+
put_u(L.rowmeta + r, meta);
|
|
293
|
+
}
|
|
294
|
+
for (int w = L.rowmeta; w < L.words; ++w) if (!isint[w]) put_u(w, 0u);
|
|
295
|
+
for (int w = L.counts; w < L.conJ; ++w) if (!isint[w] && w > L.min_nu) put_u(w, 0u);
|
|
296
|
+
for (int w = 0; w < L.words; ++w) {
|
|
297
|
+
if (isint[w]) {
|
|
298
|
+
if (rec64) js::soft::tape_put_u(rec64, w, U[w]);
|
|
299
|
+
if (rec32) js::soft::tape_put_u(rec32, w, U[w]);
|
|
300
|
+
} else {
|
|
301
|
+
if (rec64) rec64[w] = V[w];
|
|
302
|
+
if (rec32) rec32[w] = static_cast<float>(V[w]);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// n states (each thread its own), qpos [n][nq], qvel [n][nv], tau_ext [n][nv] or null, fric [n]; rec64 [n][words]
|
|
308
|
+
void s14_hand_batch(void* h, int n, const double* qpos, const double* qvel, const double* tau_ext, const double* fric, int nc, int nr,
|
|
309
|
+
int kdof, double* rec64, int nthreads) {
|
|
310
|
+
const Model14& m = *static_cast<Model14*>(h);
|
|
311
|
+
#if defined(D16_NV_GT64)
|
|
312
|
+
const int words = hand14_layout(m.nv, nc, nr, kdof).words;
|
|
313
|
+
#else
|
|
314
|
+
const int words = js::soft::hand_layout(m.nv, nc, nr, kdof).words;
|
|
315
|
+
#endif
|
|
316
|
+
const int T = std::max(1, std::min(nthreads, n));
|
|
317
|
+
std::vector<std::thread> th;
|
|
318
|
+
for (int t = 0; t < T; ++t)
|
|
319
|
+
th.emplace_back([&, t] {
|
|
320
|
+
for (int i = t; i < n; i += T)
|
|
321
|
+
s14_hand(h, qpos + static_cast<size_t>(i) * m.nq, qvel + static_cast<size_t>(i) * m.nv,
|
|
322
|
+
tau_ext ? tau_ext + static_cast<size_t>(i) * m.nv : nullptr, fric[i], nc, nr, kdof,
|
|
323
|
+
rec64 + static_cast<size_t>(i) * words, nullptr);
|
|
324
|
+
});
|
|
325
|
+
for (std::thread& x : th) x.join();
|
|
326
|
+
}
|
|
327
|
+
#if defined(D16_NV_GT64)
|
|
328
|
+
int s14_hand_words(int nv, int nc, int nr, int kdof) { return hand14_layout(nv, nc, nr, kdof).words; }
|
|
329
|
+
// the split map of a phase B body (gen_split.py's gSplitWord [ntri], WORDS): once, before any hand
|
|
330
|
+
void s14_set_split(const int* word, int ntri, int words) {
|
|
331
|
+
need(ntri > 0 && words > 0, "split map: sizes");
|
|
332
|
+
g_split_word.assign(word, word + ntri);
|
|
333
|
+
g_split_words = words;
|
|
334
|
+
}
|
|
335
|
+
#else
|
|
336
|
+
int s14_hand_words(int nv, int nc, int nr, int kdof) { return js::soft::hand_layout(nv, nc, nr, kdof).words; }
|
|
337
|
+
#endif
|
|
338
|
+
} // extern "C"
|
|
339
|
+
|
|
340
|
+
// ---- D16 14x C2 (2026-11-03): the substep's JVP and VJP for the adjoint gates (core/soft/x14/jvp14.h) ----
|
|
341
|
+
// Tangent coordinates [nv]: the free root (world translation 3, body-frame rotation 3), each ball (body-frame rotation 3,
|
|
342
|
+
// quat <- quat (x) exp(delta / 2)), each independent hinge or coupling master; v and tau_ext in qvel's coordinates. The warm
|
|
343
|
+
// start has no tangent. The exported friction (law14's foot_friction -1). Outputs' values are soft_substep's, bitwise.
|
|
344
|
+
namespace {
|
|
345
|
+
constexpr int kJvpK = 4;
|
|
346
|
+
using DJ = X::D14<kJvpK>;
|
|
347
|
+
void jvp_flags(const X::JvpFlags14& fl, int* flags) {
|
|
348
|
+
if (!flags) return;
|
|
349
|
+
flags[0] = fl.contact_set_changed; flags[1] = fl.nquadratic; flags[2] = fl.ncon; flags[3] = fl.nefc; flags[4] = fl.niter;
|
|
350
|
+
flags[5] = fl.nlim;
|
|
351
|
+
}
|
|
352
|
+
} // namespace
|
|
353
|
+
|
|
354
|
+
extern "C" {
|
|
355
|
+
|
|
356
|
+
// One law14 substep and its JVP along ndir (1..4) directions: tq, tv, ttau [ndir][nv] -> tq1, tv1, ta1 [ndir][nv]; q1 [nq],
|
|
357
|
+
// v1 [nv], a1 [nv] (a*, the next warm start); flags [6] = contact_set_changed, nquadratic, ncon, nefc, niter, nlim.
|
|
358
|
+
void s14_substep_jvp(void* h, const double* q, const double* v, const double* warm, const double* tau_ext, int ndir,
|
|
359
|
+
const double* tq, const double* tv, const double* ttau, double* q1, double* v1, double* a1, double* tq1,
|
|
360
|
+
double* tv1, double* ta1, int* flags) {
|
|
361
|
+
const Model14& m = *static_cast<Model14*>(h);
|
|
362
|
+
need(ndir >= 1 && ndir <= kJvpK, "s14_substep_jvp: 1 <= ndir <= 4");
|
|
363
|
+
const int nq = m.nq, nv = m.nv;
|
|
364
|
+
std::vector<DJ> qd(nq), vd(nv), td(nv), as;
|
|
365
|
+
for (int i = 0; i < nq; ++i) qd[i] = DJ(q[i]);
|
|
366
|
+
for (int i = 0; i < nv; ++i) { vd[i] = DJ(v[i]); td[i] = DJ(tau_ext ? tau_ext[i] : 0.0); }
|
|
367
|
+
for (int k = 0; k < ndir; ++k) {
|
|
368
|
+
X::seed_q14<kJvpK>(m, q, tq + static_cast<size_t>(k) * nv, k, qd);
|
|
369
|
+
for (int i = 0; i < nv; ++i) { vd[i].d[k] = tv[static_cast<size_t>(k) * nv + i]; td[i].d[k] = ttau[static_cast<size_t>(k) * nv + i]; }
|
|
370
|
+
}
|
|
371
|
+
std::vector<double> w(warm, warm + nv);
|
|
372
|
+
const X::JvpFlags14 fl = X::substep_jvp14<kJvpK>(m, qd, vd, w.data(), td, -1.0, as);
|
|
373
|
+
for (int i = 0; i < nq; ++i) q1[i] = qd[i].v;
|
|
374
|
+
for (int i = 0; i < nv; ++i) { v1[i] = vd[i].v; a1[i] = w[i]; }
|
|
375
|
+
for (int k = 0; k < ndir; ++k) {
|
|
376
|
+
X::tangent_q14<kJvpK>(m, qd, k, tq1 + static_cast<size_t>(k) * nv);
|
|
377
|
+
for (int i = 0; i < nv; ++i) { tv1[static_cast<size_t>(k) * nv + i] = vd[i].d[k]; ta1[static_cast<size_t>(k) * nv + i] = as[i].d[k]; }
|
|
378
|
+
}
|
|
379
|
+
jvp_flags(fl, flags);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// The VJP as the transpose of the JVP's Jacobian (3 nv columns, 4 per pass; a reference, not a fast path): the cotangents of
|
|
383
|
+
// (q1's tangent, v1, a1) [nv] each -> those of (q's tangent, v, tau_ext) [nv] each. flags: the first pass's.
|
|
384
|
+
void s14_substep_vjp(void* h, const double* q, const double* v, const double* warm, const double* tau_ext, const double* bq1,
|
|
385
|
+
const double* bv1, const double* ba1, double* bq, double* bv, double* btau, int* flags) {
|
|
386
|
+
const Model14& m = *static_cast<Model14*>(h);
|
|
387
|
+
const int nq = m.nq, nv = m.nv, nin = 3 * nv;
|
|
388
|
+
std::vector<double> T(static_cast<size_t>(3) * kJvpK * nv), O(static_cast<size_t>(3) * kJvpK * nv), q1(nq), v1(nv), a1(nv);
|
|
389
|
+
std::vector<double> bin(nin, 0.0);
|
|
390
|
+
int fl[6];
|
|
391
|
+
for (int c0 = 0; c0 < nin; c0 += kJvpK) {
|
|
392
|
+
const int nd = std::min(kJvpK, nin - c0);
|
|
393
|
+
std::fill(T.begin(), T.end(), 0.0);
|
|
394
|
+
double *tq = T.data(), *tv = tq + kJvpK * nv, *tt = tv + kJvpK * nv;
|
|
395
|
+
for (int k = 0; k < nd; ++k) {
|
|
396
|
+
const int c = c0 + k;
|
|
397
|
+
(c < nv ? tq : c < 2 * nv ? tv : tt)[static_cast<size_t>(k) * nv + c % nv] = 1.0;
|
|
398
|
+
}
|
|
399
|
+
double *oq = O.data(), *ov = oq + kJvpK * nv, *oa = ov + kJvpK * nv;
|
|
400
|
+
s14_substep_jvp(h, q, v, warm, tau_ext, nd, tq, tv, tt, q1.data(), v1.data(), a1.data(), oq, ov, oa, fl);
|
|
401
|
+
if (c0 == 0) for (int j = 0; j < 6 && flags; ++j) flags[j] = fl[j];
|
|
402
|
+
for (int k = 0; k < nd; ++k) {
|
|
403
|
+
double s = 0.0;
|
|
404
|
+
for (int i = 0; i < nv; ++i)
|
|
405
|
+
s += bq1[i] * oq[static_cast<size_t>(k) * nv + i] + bv1[i] * ov[static_cast<size_t>(k) * nv + i] + ba1[i] * oa[static_cast<size_t>(k) * nv + i];
|
|
406
|
+
bin[c0 + k] = s;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
for (int i = 0; i < nv; ++i) { bq[i] = bin[i]; bv[i] = bin[nv + i]; btau[i] = bin[2 * nv + i]; }
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
} // extern "C"
|
|
413
|
+
|
|
414
|
+
extern "C" {
|
|
415
|
+
// The 14x tape record (core/soft/tape.h, the layout for the adjoint, 2026-11-03): tape_layout(nq, nv, maxcon, maxrows, npose,
|
|
416
|
+
// nmus, lq false) (Euler: no L_Q). out [20] = words, hdr, flags, min_nu, clamp, zone, con, qpos, qvel, qacc, qadv, LH, LQ, pose,
|
|
417
|
+
// mus, n_clamp, n_zone, n_con, ctl words (tape_ctl_layout(nmus)), ctl u offset. npair: the law's NPR.
|
|
418
|
+
#if defined(D16_NV_GT64) // B3c: a phase B record needs the limit count and the split words (tape.h): s14_tape_layout_b, after s14_set_split
|
|
419
|
+
static void tape_layout_out(const js::soft::TapeLayout& t, int npair, int nmus, int* out) {
|
|
420
|
+
need(js::soft::tape_layout_ok(t, npair), "s14_tape_layout: the packing's field widths");
|
|
421
|
+
const js::soft::TapeCtlLayout c = js::soft::tape_ctl_layout(nmus);
|
|
422
|
+
const int v[20] = {t.words, t.hdr, t.flags, t.min_nu, t.clamp, t.zone, t.con, t.qpos, t.qvel, t.qacc, t.qadv, t.LH, t.LQ, t.pose,
|
|
423
|
+
t.mus, t.n_clamp, t.n_zone, t.n_con, c.words, c.u};
|
|
424
|
+
for (int i = 0; i < 20; ++i) out[i] = v[i];
|
|
425
|
+
}
|
|
426
|
+
void s14_tape_layout(int, int, int, int, int, int, int, int*) {
|
|
427
|
+
need(false, "s14_tape_layout: a phase B body's record needs its limit count and split words: call s14_tape_layout_b");
|
|
428
|
+
}
|
|
429
|
+
void s14_tape_layout_b(int nq, int nv, int maxcon, int maxrows, int npose, int nmus, int npair, int nlim, int* out) {
|
|
430
|
+
need(g_split_words > 0, "s14_tape_layout_b: the split map first (s14_set_split)");
|
|
431
|
+
tape_layout_out(js::soft::tape_layout(nq, nv, maxcon, maxrows, npose, nmus, false, nlim, g_split_words), npair, nmus, out);
|
|
432
|
+
}
|
|
433
|
+
#else
|
|
434
|
+
void s14_tape_layout(int nq, int nv, int maxcon, int maxrows, int npose, int nmus, int npair, int* out) {
|
|
435
|
+
const js::soft::TapeLayout t = js::soft::tape_layout(nq, nv, maxcon, maxrows, npose, nmus, false);
|
|
436
|
+
need(js::soft::tape_layout_ok(t, npair), "s14_tape_layout: the packing's field widths");
|
|
437
|
+
const js::soft::TapeCtlLayout c = js::soft::tape_ctl_layout(nmus);
|
|
438
|
+
const int v[20] = {t.words, t.hdr, t.flags, t.min_nu, t.clamp, t.zone, t.con, t.qpos, t.qvel, t.qacc, t.qadv, t.LH, t.LQ, t.pose,
|
|
439
|
+
t.mus, t.n_clamp, t.n_zone, t.n_con, c.words, c.u};
|
|
440
|
+
for (int i = 0; i < 20; ++i) out[i] = v[i];
|
|
441
|
+
}
|
|
442
|
+
#endif
|
|
443
|
+
} // extern "C"
|