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/env/env14.py
ADDED
|
@@ -0,0 +1,568 @@
|
|
|
1
|
+
"""The E0 env on the new engine's training path (E0ENV14_PREREG.md): w3c's gpu_fullbody_vec_env, untouched, with its physics
|
|
2
|
+
swapped for the Step14 (feat/d16-14x train14.py), one control step per call. The env's own step() does everything else:
|
|
3
|
+
_act_to_excitation, its activation per substep (the reward's a_sum / 5), phase, reward, termination, resets / RSI, obs.
|
|
4
|
+
|
|
5
|
+
env = S.make_env("fullbody", cfg, seed, stochastic_init=True)
|
|
6
|
+
env14 = Env14(env, tree14, case_dir, H) # or install_from_env(env, H): E0_ENGINE14=1 is the flag, unset = the old engine
|
|
7
|
+
|
|
8
|
+
With grad enabled (the training rollout) the call is Step14.apply on a Window14 slot; SAPO's next initialize_trajectory (after its
|
|
9
|
+
backward) resets the window. Without grad (eval, render) it is Engine14.control_step, untaped (bitwise the taped forward). Until
|
|
10
|
+
the step 4 lifts Step14's muscle assert, lce / a / u go in detached and lce1 comes out detached (the actor's muscle gradient is 0).
|
|
11
|
+
"""
|
|
12
|
+
import importlib.util
|
|
13
|
+
import os
|
|
14
|
+
import pathlib
|
|
15
|
+
|
|
16
|
+
import torch
|
|
17
|
+
|
|
18
|
+
# (3a) was: sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1] / "muscle_ref"))
|
|
19
|
+
from diffneusim.env.e0loop14 import rotm # noqa: E402
|
|
20
|
+
# the body (tools/d16_bodies/d16_body.py, D16_BODY=<tag>, unset the 14x): its quaternions' qpos addresses (the root's and the balls') and NV
|
|
21
|
+
# come from the header the engine compiles, so the chart below fits any body of the family (11-09, feat/d16-taskwalk: the 290)
|
|
22
|
+
# (3a) was: sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2] / "d16_bodies"))
|
|
23
|
+
from diffneusim.engine import d16_body as BODY # noqa: E402
|
|
24
|
+
QUATS, NV = tuple(BODY.QUATS), int(BODY.NV)
|
|
25
|
+
assert QUATS[0] == 3 and list(QUATS) == sorted(QUATS), QUATS
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def old_to_law(q, qd):
|
|
29
|
+
"""e0loop14's chart change, out of place (autograd-safe): the root and ball quaternions normalized, v[0:3] = R(q_root) qd[3:6]
|
|
30
|
+
(world), v[3:6] = qd[0:3] (body); the same operations as e0loop14.old_to_law, so the same values"""
|
|
31
|
+
# the process's body (D16_BODY at import) must be the state's: with another body's QUATS the slices still fill nq and the output is
|
|
32
|
+
# silently wrong (11-10: a 290 record read with D16_BODY unset normalized its left subtalar and mtp as a "quaternion")
|
|
33
|
+
assert q.shape[0] == BODY.NQ and qd.shape[0] == BODY.NV, (q.shape, qd.shape, BODY.NQ, BODY.NV, "D16_BODY must be the state's body")
|
|
34
|
+
nrm = lambda x: x / torch.linalg.norm(x, dim=0, keepdim=True) # noqa: E731
|
|
35
|
+
parts, k0 = [], 0 # the same slices as the 14x's literal form (3, 24, 32), for any body's QUATS
|
|
36
|
+
for k in QUATS:
|
|
37
|
+
parts += [q[k0:k], nrm(q[k:k + 4])]
|
|
38
|
+
k0 = k + 4
|
|
39
|
+
qn = torch.cat(parts + [q[k0:]], 0)
|
|
40
|
+
v = torch.cat([torch.einsum("ijn,jn->in", rotm(qn[3:7]), qd[3:6]), qd[0:3], qd[6:]], 0)
|
|
41
|
+
return qn, v
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def law_to_old(q, v):
|
|
45
|
+
return torch.cat([v[3:6], torch.einsum("jin,jn->in", rotm(q[3:7]), v[0:3]), v[6:]], 0)
|
|
46
|
+
|
|
47
|
+
MUSCLE_GRAD = True # A later change lifted Step14's muscle-gradient assert (the step 4 wired, feat/d16-14x): lce / a / u keep their graph
|
|
48
|
+
RESET_FIX = True # in-step resets zero the warm start and keep the env's A0 (E0ENV14_PREREG.md, second amendment's section)
|
|
49
|
+
GLUE_COMPILE = os.environ.get("E0_ENV14_GLUE", "0") == "1" # M4b: the glue (charts + transposes) as one compiled function per direction
|
|
50
|
+
# E0_ENV14_F64=1 (2026-11-05, tools/e0_eval_f64): eval-only, glue off, no gradients. The engine runs in float64 and env14 keeps a
|
|
51
|
+
# float64 shadow of the physics state (q, v, warm, l_ce, a) across control steps; the env sees float32 copies for its observation,
|
|
52
|
+
# reward and terminations, as in training. A world the env resets enters the shadow from the env's (float32) state. Unset: unchanged.
|
|
53
|
+
F64 = False
|
|
54
|
+
# E0_ENV14_RESET32=1 (2026-11-07; feat/e0-eval-f64-root 8d06f5dd, the review): eval-only, with E0_ENV14_EQUIL14. The reset's fibre equilibrium runs
|
|
55
|
+
# on a float32 engine at KFIB (6), the policy's own launches (X14_EQUIL_SCHEDULE), whatever E0_ENV14_F64 and ENGINE14_KFIB set, so every arm of a
|
|
56
|
+
# replay starts each episode from one reset state. The paper's two root-reset f64 replays ran this (tools/e0_eval_f64/REPLAY_ROOT.md). Unset: the
|
|
57
|
+
# reset runs on the step's engine at its Newton count (under E0_ENV14_F64 the float64 engine; under ENGINE14_KFIB its count).
|
|
58
|
+
RESET32 = False
|
|
59
|
+
# E0_ENV14_ACT14=1 (2026-11-09, feat/d16-taskwalk step 2): the env's per-substep activation (its reward's a_sum / 5, the activation and
|
|
60
|
+
# metabolic terms) is the engine's own k_act14 (x14_engine_kernels.cuh: soft/muscle.h's muscle_activation, k_mus's first stage; the Mac gate
|
|
61
|
+
# tools/d16_taskwalk/test_act14.py: bitwise k_mus's per-substep a) with its VJP k_act14_vjp, instead of the old sim's activate (old_act 0).
|
|
62
|
+
# Unset: unchanged (the old filter, counted as old_act).
|
|
63
|
+
ACT14 = os.environ.get("E0_ENV14_ACT14", "0") == "1"
|
|
64
|
+
# E0_ENV14_KINLATCH=1 (2026-11-09, feat/d16-taskwalk step 3; the review's decision (a)): the mirror's strike latch reads each foot's contact in the
|
|
65
|
+
# D16 law (kin_contact14.FootTouch14: the floor pairs' geoms on calcn / toes within their margin, the engine's own active set, K0 / K1 against
|
|
66
|
+
# MuJoCo) through env._mirror_down, instead of the old engine's contact force above 1 N. Every control step asserts old_contact 0 and one latch
|
|
67
|
+
# read. Its gate's K2 FAIL and the diagnostic: tools/d16_taskwalk/PLAN.md 3a. Unset: unchanged.
|
|
68
|
+
KINLATCH = os.environ.get("E0_ENV14_KINLATCH", "0") == "1"
|
|
69
|
+
# E0_ENV14_NO_OLD=1 (the review, 11-09: the old engine at 0 calls): every control step asserts old_sim 0, the sum of every route into the old engine
|
|
70
|
+
# after the install (old_count.py), failing fast. Unset: counted only.
|
|
71
|
+
NO_OLD = os.environ.get("E0_ENV14_NO_OLD", "0") == "1"
|
|
72
|
+
# E0_ENV14_GROUND14=1 (2026-11-09, feat/d16-taskwalk step 4): the task-walk reset grounds its pose on the D16 law's foot geoms (the lowest
|
|
73
|
+
# just touches the plane, kin_contact14.FootTouch14.gap) instead of the old model's contact spheres. At the keyframe the old rule leaves the
|
|
74
|
+
# D16 foot 2.2 mm inside the floor on the 290 and the 14x. Flat ground only. Unset: unchanged.
|
|
75
|
+
GROUND14 = os.environ.get("E0_ENV14_GROUND14", "0") == "1"
|
|
76
|
+
# E0_ENV14_BACKEND=cpu (2026-11-09, feat/d16-taskwalk step 5): the Mac dry-run's engine, cpu14.CpuEngine14 (the GPU binding's own kernels
|
|
77
|
+
# through the fiber shim; E0_ENV14_CPU_LIB the built library), forward only, on the env's device (the CPU). Unset or "cuda": unchanged.
|
|
78
|
+
BACKEND = os.environ.get("E0_ENV14_BACKEND", "cuda")
|
|
79
|
+
assert BACKEND in ("cuda", "cpu"), f"E0_ENV14_BACKEND={BACKEND!r}: cuda or cpu"
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class Act14(torch.autograd.Function):
|
|
83
|
+
"""a_new = k_act14(u, a_prev) on the env's layout [NM, n]; the engine's layout is [n, NM] (transposed in and out)"""
|
|
84
|
+
|
|
85
|
+
@staticmethod
|
|
86
|
+
def forward(ctx, u, a_prev, ext, dt):
|
|
87
|
+
ut, at = u.detach().t().contiguous(), a_prev.detach().t().contiguous()
|
|
88
|
+
out = torch.empty_like(at)
|
|
89
|
+
ext.act([ut, at, out], dt)
|
|
90
|
+
ctx.save_for_backward(ut, at)
|
|
91
|
+
ctx.ext, ctx.dt = ext, dt
|
|
92
|
+
return out.t().contiguous()
|
|
93
|
+
|
|
94
|
+
@staticmethod
|
|
95
|
+
def backward(ctx, a_bar):
|
|
96
|
+
ut, at = ctx.saved_tensors
|
|
97
|
+
ub, ab = torch.empty_like(ut), torch.empty_like(at)
|
|
98
|
+
ctx.ext.act_vjp([ut, at, a_bar.t().contiguous(), ub, ab], ctx.dt)
|
|
99
|
+
return ub.t().contiguous(), ab.t().contiguous(), None, None
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def equil14_default(glue):
|
|
103
|
+
"""E0_ENV14_EQUIL14, P1's reset equilibrium on the 14x law (install_equil14): ON by default with the compiled glue
|
|
104
|
+
(E0_ENV14_GLUE=1, the E0 learning jobs' setting), off by default without it (eval14 runs the glue off), since the integration
|
|
105
|
+
commit after a3461d72 (the review, 2026-11-03). E0_ENV14_EQUIL14=0 turns it off; =1 asks for it. Under the default, a glue run
|
|
106
|
+
with DN_FIBER_INIT_VC=1 (the velocity-consistent start, not ported) or DN_FIBER_INIT_ITERS=0 (no equilibration)
|
|
107
|
+
fails at install_equil14's asserts: set E0_ENV14_EQUIL14=0 for it. So must every arm that means today's old-engine
|
|
108
|
+
equilibration (gate_equil14.py sets it itself)."""
|
|
109
|
+
v = os.environ.get("E0_ENV14_EQUIL14")
|
|
110
|
+
if v is None:
|
|
111
|
+
return bool(glue)
|
|
112
|
+
assert v in ("0", "1"), f"E0_ENV14_EQUIL14={v!r}: 0 or 1"
|
|
113
|
+
return v == "1"
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def rew14_default(glue, env=None):
|
|
117
|
+
"""E0_ENV14_REW14, the fused reward + observation node (tools/d16_fused_env): ON by default with the compiled glue
|
|
118
|
+
(E0_ENV14_GLUE=1, the E0 learning jobs' setting) and off by default without it (eval14 runs the glue off), since the
|
|
119
|
+
integration commit after 11e50a92 (the review, the design's approval, 2026-11-03). E0_ENV14_REW14=0 turns it off; =1 asks for it
|
|
120
|
+
(rew14_hook.install asserts the glue). A glue run in a configuration the node does not support (E0_M4C=1, mirror, taskwalk,
|
|
121
|
+
latent, OBS_AUG, YAW_FREE, ET_MODE, REF_SWITCH, dr_snap, musclepd) fails at install by the hook's asserts: set
|
|
122
|
+
E0_ENV14_REW14=0 for it. So must every timing or gate arm that means "without REW14"."""
|
|
123
|
+
v = os.environ.get("E0_ENV14_REW14")
|
|
124
|
+
if v is None:
|
|
125
|
+
if not glue:
|
|
126
|
+
return False
|
|
127
|
+
ok, why = rew14_supported(env) # unset: on wherever the node supports the configuration, off (and said so) elsewhere
|
|
128
|
+
if not ok:
|
|
129
|
+
print(f"[env14] E0_ENV14_REW14 off: the fused reward node does not support {why}", flush=True)
|
|
130
|
+
return ok
|
|
131
|
+
assert v in ("0", "1"), f"E0_ENV14_REW14={v!r}: 0 or 1"
|
|
132
|
+
return v == "1"
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def rew14_supported(env):
|
|
136
|
+
"""(ok, reason): the configurations rew14_hook.install accepts (its asserts, checked here without failing)"""
|
|
137
|
+
t = getattr(env, "imitation_task", None)
|
|
138
|
+
checks = [(t is not None and getattr(t, "IM_MIMIC", False) and getattr(env, "imitation", False), "a task other than mimic imitation"),
|
|
139
|
+
(getattr(env, "mirror", None) is None, "the mirror"), (getattr(env, "taskwalk", None) is None, "task walking"),
|
|
140
|
+
(getattr(env, "latent_task", None) is None and not getattr(env, "LATENT", False), "a latent task"),
|
|
141
|
+
(not getattr(env, "M4C", False), "E0_M4C"), (not getattr(env, "OBS_AUG", False), "OBS_AUG"),
|
|
142
|
+
(not getattr(env, "YAW_FREE", False), "YAW_FREE"), (not getattr(env, "ET_MODE", False), "ET_MODE"),
|
|
143
|
+
(not getattr(env, "REF_SWITCH", False), "REF_SWITCH"), (not getattr(env, "dr_snap", False), "dr_snap"),
|
|
144
|
+
(getattr(env, "musclepd", None) is None, "the MuscleVAE PD servo"),
|
|
145
|
+
(getattr(env, "_tw_fs", None) is None and getattr(env, "_tw_obs_h_ground", False) is False, "the task-walk observations"),
|
|
146
|
+
(t is None or (not getattr(t, "PHASE_OBS", False) and t.cond_obs(1) is None), "phase or conditional observations")]
|
|
147
|
+
for ok, why in checks:
|
|
148
|
+
if not ok:
|
|
149
|
+
return False, why
|
|
150
|
+
return True, ""
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def glue_pre(q, qd, lce, a, u):
|
|
154
|
+
"""the step's inputs to Step14's layout: the old chart to the law chart, world-major to lane-major (the eager path's ops)"""
|
|
155
|
+
qn, v = old_to_law(q, qd)
|
|
156
|
+
return qn.t().contiguous(), v.t().contiguous(), lce.t().contiguous(), a.t().contiguous(), u.t().contiguous()
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def glue_post(q1, v1, l1, a1):
|
|
160
|
+
"""Step14's outputs back: the law chart to the old chart, lane-major to world-major"""
|
|
161
|
+
q_old = q1.t()
|
|
162
|
+
return q_old.contiguous(), law_to_old(q_old, v1.t()).contiguous(), l1.t().contiguous(), a1.t().contiguous()
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
class Env14:
|
|
166
|
+
def __init__(self, env, tree14, case_dir, H):
|
|
167
|
+
# (3a) was: sys.path.insert(0, str(pathlib.Path(tree14) / "tools" / "d16_14x"))
|
|
168
|
+
from diffneusim.engine import engine14
|
|
169
|
+
self.env, self.n, self.H = env, env.num_envs, H
|
|
170
|
+
self.dt14 = float(engine14.DT) # the engine's substep (E0_ENV14_ACT14's op asserts the env's)
|
|
171
|
+
self.f64 = F64
|
|
172
|
+
fdt = torch.float32
|
|
173
|
+
self.dev = "cuda"
|
|
174
|
+
if BACKEND == "cpu": # the Mac dry-run (see BACKEND): no Step14 / Window14 (no adjoint), the env's device
|
|
175
|
+
# (3a) was: sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
|
|
176
|
+
from diffneusim.env import cpu14
|
|
177
|
+
self.dev = env.device
|
|
178
|
+
self.train14 = None
|
|
179
|
+
self.eng = cpu14.CpuEngine14(self.n, fdt, case_dir, os.environ["E0_ENV14_CPU_LIB"])
|
|
180
|
+
env.sim_on_cpu = True # the env equilibrates its resets where the simulation runs (gpu_fullbody_vec_env._reset_envs)
|
|
181
|
+
else:
|
|
182
|
+
from diffneusim.engine import soft14
|
|
183
|
+
from diffneusim.engine import step14 as train14 # (3a fix) tools/d16_14x/train14.py, not the imitation driver
|
|
184
|
+
self.train14 = train14
|
|
185
|
+
self.eng = engine14.Engine14(self.n, fdt, case_dir)
|
|
186
|
+
# E0_ENV14_RESET32=1 (see RESET32): the reset's fibre equilibrium on a float32 engine at KFIB, the policy's own reset, whatever
|
|
187
|
+
# E0_ENV14_F64 and ENGINE14_KFIB set; each world's f64 shadow enters from that f32 entry. Unset: the reset follows self.eng.
|
|
188
|
+
self.eng_equil = self.eng
|
|
189
|
+
self.win = train14.Window14(self.n, H) if BACKEND == "cuda" else None
|
|
190
|
+
self.chart = train14.Chart14(soft14.Soft14().L) if BACKEND == "cuda" else None
|
|
191
|
+
self.warm = torch.zeros(self.n, NV, dtype=fdt, device=self.dev)
|
|
192
|
+
self.sh, self.sh_last = None, None # E0_ENV14_F64's shadow and what it handed the env
|
|
193
|
+
self.dirty = torch.ones(self.n, dtype=torch.bool, device=self.dev) # E0_ENV14_F64: worlds the env (re)set since the last step
|
|
194
|
+
self.win_used = False
|
|
195
|
+
self.count = dict(step14=0, control_step=0, old_sim=0, win_reset=0)
|
|
196
|
+
self.cap = {}
|
|
197
|
+
self.k = 0
|
|
198
|
+
self.out = None
|
|
199
|
+
self.glue = GLUE_COMPILE
|
|
200
|
+
if self.glue:
|
|
201
|
+
assert MUSCLE_GRAD
|
|
202
|
+
# fused, never CUDA-graphed: under m4a's cudagraph trees the glue's inputs alternate between graph-managed outputs and
|
|
203
|
+
# eager tensors (resets), so the tree re-recorded it ("cudagraph managed tensor data pointer changed", a ~30 s stall
|
|
204
|
+
# per occurrence, 06:16), and every graphed glue call deepens BPTT's pending path by one node
|
|
205
|
+
opts = {"triton.cudagraphs": False}
|
|
206
|
+
self.pre = torch.compile(glue_pre, dynamic=False, options=opts)
|
|
207
|
+
self.post = torch.compile(glue_post, dynamic=False, options=opts)
|
|
208
|
+
self.old_sim = env.sim
|
|
209
|
+
# the calls that still reach the old engine (activation, contact readouts, old equilibria): counted, not changed (old_count.py)
|
|
210
|
+
_spec = importlib.util.spec_from_file_location("old_count", pathlib.Path(__file__).resolve().parent / "old_count.py")
|
|
211
|
+
_oc = importlib.util.module_from_spec(_spec)
|
|
212
|
+
_spec.loader.exec_module(_oc)
|
|
213
|
+
self.oldc = _oc.install(env, self)
|
|
214
|
+
if ACT14:
|
|
215
|
+
assert os.environ.get("E0_REW14_SKIP_ENV_ACT", "0") != "1", "E0_ENV14_ACT14 with E0_REW14_SKIP_ENV_ACT: one owner of the activation"
|
|
216
|
+
assert env.musclepd is None, "E0_ENV14_ACT14: the env's MuscleVAE PD servo sets A itself"
|
|
217
|
+
self.count["act14"] = 0
|
|
218
|
+
|
|
219
|
+
def act14(u, a, dt):
|
|
220
|
+
assert abs(float(dt) - self.dt14) < 1e-15, (dt, self.dt14)
|
|
221
|
+
self.count["act14"] += 1
|
|
222
|
+
return Act14.apply(u, a, self.eng.ext, self.dt14)
|
|
223
|
+
env._activation = act14
|
|
224
|
+
self.foot = None
|
|
225
|
+
if KINLATCH or GROUND14:
|
|
226
|
+
import json
|
|
227
|
+
# (3a) was: sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
|
|
228
|
+
from diffneusim.env import kin_contact14
|
|
229
|
+
assert not getattr(env, "_tw_slopes_live", False), "E0_ENV14_KINLATCH / GROUND14: flat ground only (the floor plane z = 0)"
|
|
230
|
+
law = json.load(open(BODY.LAW))
|
|
231
|
+
assert pathlib.Path(env.model).name == law["source"]["dnmodel"], ("the env's body is not the law's", env.model, law["source"])
|
|
232
|
+
self.foot = kin_contact14.FootTouch14(BODY.LAW, env._monitor, env.device, torch.float32)
|
|
233
|
+
if KINLATCH:
|
|
234
|
+
assert getattr(env, "mirror", None) is not None, "E0_ENV14_KINLATCH: the latch is the mirror's (DN_MIRROR_SYM=1)"
|
|
235
|
+
assert getattr(env, "_tw_fs", None) is None, "E0_ENV14_KINLATCH: the footstep plan reads the contact force itself"
|
|
236
|
+
def _latch_poses(): # TW1 K2 (train_tw14 --tw1-k2): the reward's FK of this q, hoisted before the latch, detached
|
|
237
|
+
fk = getattr(env, "_tw_fk_pre", None)
|
|
238
|
+
if fk is None:
|
|
239
|
+
return None
|
|
240
|
+
return ({b: fk[0][b].detach() for b in self.foot.bodies}, {b: fk[1][b].detach() for b in self.foot.bodies})
|
|
241
|
+
env._mirror_down = lambda: self.foot.touch(env.q.detach(), _latch_poses())
|
|
242
|
+
# TASKWALK_FALL_NONFOOT=1 (opt-in; 11-13, the review, the m118: the running line ends KNEELING on the femur / tibia floor pairs,
|
|
243
|
+
# the root above FALL_ROOT_H): a fall when any NON-foot floor pair of the D16 law is within its margin, the engine's own contact set.
|
|
244
|
+
# The reward's fall test calls env._tw_nonfoot_term(q) (a function, no carried state). Its bodies join the reward's FK set only with
|
|
245
|
+
# the knob on, so the hoisted FK of TW1 K2 covers them (no second FK there); knob off = no change at all.
|
|
246
|
+
self.nonfoot = None
|
|
247
|
+
if os.environ.get("TASKWALK_FALL_NONFOOT", "0") != "0":
|
|
248
|
+
assert os.environ["TASKWALK_FALL_NONFOOT"] == "1", os.environ["TASKWALK_FALL_NONFOOT"]
|
|
249
|
+
assert KINLATCH, "TASKWALK_FALL_NONFOOT reads the D16 law's contact set beside the latch: set E0_ENV14_KINLATCH=1"
|
|
250
|
+
self.nonfoot = kin_contact14.FootTouch14(BODY.LAW, env._monitor, env.device, torch.float32, geoms=kin_contact14.other_geoms)
|
|
251
|
+
env._tw_bodies = sorted(set(env._tw_bodies) | set(self.nonfoot.bodies))
|
|
252
|
+
|
|
253
|
+
def _nonfoot_poses():
|
|
254
|
+
fk = getattr(env, "_tw_fk_pre", None)
|
|
255
|
+
if fk is None:
|
|
256
|
+
return None
|
|
257
|
+
return ({b: fk[0][b].detach() for b in self.nonfoot.bodies}, {b: fk[1][b].detach() for b in self.nonfoot.bodies})
|
|
258
|
+
env._tw_nonfoot_term = lambda: self.nonfoot.any_down(env.q.detach(), _nonfoot_poses())
|
|
259
|
+
print(f"[env14] TASKWALK_FALL_NONFOOT: a fall on any of {len(self.nonfoot.geoms['o'])} non-foot floor pairs within the margin "
|
|
260
|
+
f"{self.nonfoot.margin} m ({sorted({g['body'] for g in self.nonfoot.geoms['o']})})", flush=True)
|
|
261
|
+
# TASKWALK_LIMIT_TORQUE_STOP=1 (11-14): the reward's limit-torque term adds the solver's stop, from this law's limit rows
|
|
262
|
+
if os.environ.get("TASKWALK_LIMIT_TORQUE_STOP", "0") != "0":
|
|
263
|
+
env._tw_law_path = str(BODY.LAW)
|
|
264
|
+
if GROUND14:
|
|
265
|
+
assert env.taskwalk is not None and (not env._tw_init_ref or os.environ.get("D16_TW_RESET") in ("ks14t_clip", "run_clip", "run_clip_1646",
|
|
266
|
+
"pose3_scone", "diag_states", "x016run_states", "myoassist_clip", "s11_clip")), \
|
|
267
|
+
"E0_ENV14_GROUND14: the task-walk reset (the keyframe, or a declared D16_TW_RESET=ks14t_clip / run_clip / run_clip_1646 (train_tw14.RUN_CLIPS) / myoassist_clip / s11_clip (train_tw14.RUN_CLIPS) / pose3_scone (train_tw14.POSE_SETS) / x016run_states (train_tw14.STATE_LISTS) / diag_states (train_tw14, eval only): _tw_ground_pose runs after the RSI draw)"
|
|
268
|
+
self.count["ground14"] = 0
|
|
269
|
+
|
|
270
|
+
def ground14(q0, env_ids):
|
|
271
|
+
with torch.no_grad():
|
|
272
|
+
q0 = q0.clone()
|
|
273
|
+
# the env's own joint-limit clamp (_reset_envs applies it AFTER the grounding) first, so the grounded pose is the final
|
|
274
|
+
# one: the clamp is idempotent and leaves the root's translation alone. Without it the dry-run found the knees (keyframe
|
|
275
|
+
# at their limit, the noise past it) clamped after the grounding, the D16 foot up to 0.7 mm in the floor
|
|
276
|
+
q0[env._lim_qadr] = torch.clamp(q0[env._lim_qadr], env._lim_lo.to(q0.dtype), env._lim_hi.to(q0.dtype))
|
|
277
|
+
gap = self.foot.gap(q0)
|
|
278
|
+
ez = torch.zeros(3, q0.shape[1], dtype=q0.dtype, device=q0.device)
|
|
279
|
+
ez[2] = gap.to(q0.dtype)
|
|
280
|
+
q0[:3] -= env._tw_root_from_world.to(q0.dtype) @ ez # the old rule's map from a world shift to the root's qpos
|
|
281
|
+
self.count["ground14"] += 1
|
|
282
|
+
return q0
|
|
283
|
+
env._tw_ground_pose = ground14
|
|
284
|
+
orig_ate = env._act_to_excitation
|
|
285
|
+
|
|
286
|
+
def act2u(x):
|
|
287
|
+
u = orig_ate(x)
|
|
288
|
+
self.cap["u"] = u
|
|
289
|
+
return u
|
|
290
|
+
env._act_to_excitation = act2u
|
|
291
|
+
# resets: step() resets its done envs through _reset_envs (never through reset, which also calls it). For those ids the
|
|
292
|
+
# contact warm start is zeroed (MuJoCo's mj_resetData) and the reset mask keeps the env's A0 over k_mus's a1 (the old
|
|
293
|
+
# env's graph cut). reset_fix False is the gate's positive control: the pre-fix hook on reset only
|
|
294
|
+
self.reset_fix = RESET_FIX
|
|
295
|
+
self.reset_mask = torch.zeros(self.n, dtype=torch.bool, device=self.dev)
|
|
296
|
+
orig_reset_envs = env._reset_envs
|
|
297
|
+
|
|
298
|
+
def reset_envs(env_ids=None):
|
|
299
|
+
out = orig_reset_envs(env_ids)
|
|
300
|
+
if self.reset_fix:
|
|
301
|
+
with torch.no_grad():
|
|
302
|
+
if env_ids is None:
|
|
303
|
+
self.warm.zero_()
|
|
304
|
+
self.reset_mask.fill_(True)
|
|
305
|
+
else:
|
|
306
|
+
self.warm.index_fill_(0, env_ids, 0.0)
|
|
307
|
+
self.reset_mask.index_fill_(0, env_ids, True)
|
|
308
|
+
return out
|
|
309
|
+
env._reset_envs = reset_envs
|
|
310
|
+
orig_reset = env.reset
|
|
311
|
+
|
|
312
|
+
def reset(env_ids=None, *x, **kw):
|
|
313
|
+
out = orig_reset(env_ids, *x, **kw)
|
|
314
|
+
if not self.reset_fix:
|
|
315
|
+
with torch.no_grad():
|
|
316
|
+
if env_ids is None:
|
|
317
|
+
self.warm.zero_()
|
|
318
|
+
else:
|
|
319
|
+
self.warm[env_ids] = 0.0
|
|
320
|
+
return out
|
|
321
|
+
env.reset = reset
|
|
322
|
+
orig_init = env.initialize_trajectory
|
|
323
|
+
|
|
324
|
+
def initialize_trajectory(*x, **kw):
|
|
325
|
+
if self.win_used: # the previous window's backward has run (SAPO's order)
|
|
326
|
+
self.win.reset()
|
|
327
|
+
self.win_used = False
|
|
328
|
+
self.count["win_reset"] += 1
|
|
329
|
+
return orig_init(*x, **kw)
|
|
330
|
+
env.initialize_trajectory = initialize_trajectory
|
|
331
|
+
orig_step = env.step
|
|
332
|
+
|
|
333
|
+
def step(actions):
|
|
334
|
+
assert self.k == 0, f"env14: a control step starts at substep 0, found k = {self.k}" # (P2 (iv): k is static per step)
|
|
335
|
+
self.reset_mask.zero_()
|
|
336
|
+
n_act = self.count.get("act14", 0)
|
|
337
|
+
n_latch = self.foot.n_calls if self.foot is not None else 0
|
|
338
|
+
out = orig_step(actions)
|
|
339
|
+
if KINLATCH:
|
|
340
|
+
assert self.count.get("old_contact", 0) == 0, f"E0_ENV14_KINLATCH: the old contact force ran ({self.count.get('old_contact')} calls)"
|
|
341
|
+
assert self.foot.n_calls - n_latch == 1, ("E0_ENV14_KINLATCH: the latch did not read the D16 contact once", self.foot.n_calls - n_latch)
|
|
342
|
+
if NO_OLD:
|
|
343
|
+
assert self.count.get("old_sim", 0) == 0, f"E0_ENV14_NO_OLD: the old engine ran after the install: {dict(self.oldc.names)}"
|
|
344
|
+
if ACT14: # the review (11-09): the switch proved at run time, every control step, failing fast (not logged)
|
|
345
|
+
assert self.count.get("old_act", 0) == 0, f"E0_ENV14_ACT14: the old activation ran ({self.count.get('old_act')} calls)"
|
|
346
|
+
assert self.count["act14"] - n_act == env.SUBSTEPS, ("E0_ENV14_ACT14: the engine's op did not run once per substep",
|
|
347
|
+
self.count["act14"] - n_act, env.SUBSTEPS)
|
|
348
|
+
if self.a1 is not None: # the next step's a is the engine's a1 (its gradient chain); the reward's a_sum used the env's op
|
|
349
|
+
# the mask's clone: where saves its condition for the backward, and the next step rewrites reset_mask in place.
|
|
350
|
+
# env.a detached: its reset columns are constants, and its other columns (the env op's a, masked out) would only
|
|
351
|
+
# send exact zeros back through the env's activation op (a dead backward, 1.5 ms per control step at 4,096)
|
|
352
|
+
env.a = (torch.where(self.reset_mask[None, :].clone(), env.a.detach(), self.a1).contiguous() if self.reset_fix
|
|
353
|
+
else self.a1)
|
|
354
|
+
return out
|
|
355
|
+
env.step = step
|
|
356
|
+
self.a1 = None
|
|
357
|
+
outer = self
|
|
358
|
+
|
|
359
|
+
class Sim:
|
|
360
|
+
def step(self, q, qd, tau=None, lce=None, A=None, z=None, dt=None):
|
|
361
|
+
if outer.k == 0:
|
|
362
|
+
outer.out = outer._control_step(z)
|
|
363
|
+
outer.k = (outer.k + 1) % env.SUBSTEPS
|
|
364
|
+
return outer.out
|
|
365
|
+
|
|
366
|
+
def __getattr__(self, name):
|
|
367
|
+
return outer.oldc.forward("sim", outer.old_sim, name)
|
|
368
|
+
env.sim = Sim()
|
|
369
|
+
|
|
370
|
+
def assert_guards(self, where, latch_reads=None):
|
|
371
|
+
"""The step wrapper's switch checks (E0_ENV14_KINLATCH / NO_OLD / ACT14) for a loop that calls env._step_a directly: SapoWindow, the
|
|
372
|
+
captured path, where the wrapper above never runs (11-13, the review: heel mode's old-engine GRF trained 8 epochs unseen there,
|
|
373
|
+
caught only by a gate's end-of-run count). Python counters only: no device read. latch_reads, when given, is the number of latch
|
|
374
|
+
reads the window must have made (one per eager step, none in a replay)."""
|
|
375
|
+
if KINLATCH:
|
|
376
|
+
assert self.count.get("old_contact", 0) == 0, f"E0_ENV14_KINLATCH ({where}): the old contact force ran ({self.count.get('old_contact')} calls)"
|
|
377
|
+
if latch_reads is not None:
|
|
378
|
+
assert latch_reads[0] == latch_reads[1], f"E0_ENV14_KINLATCH ({where}): the latch read the D16 contact {latch_reads[0]} times, not {latch_reads[1]}"
|
|
379
|
+
if NO_OLD:
|
|
380
|
+
assert self.count.get("old_sim", 0) == 0, f"E0_ENV14_NO_OLD ({where}): the old engine ran after the install: {dict(self.oldc.names)}"
|
|
381
|
+
if ACT14:
|
|
382
|
+
assert self.count.get("old_act", 0) == 0, f"E0_ENV14_ACT14 ({where}): the old activation ran ({self.count.get('old_act')} calls)"
|
|
383
|
+
|
|
384
|
+
def _control_step(self, z):
|
|
385
|
+
if self.glue:
|
|
386
|
+
return self._control_step_glue(z)
|
|
387
|
+
env = self.env
|
|
388
|
+
qn, v = old_to_law(env.q, env.qd)
|
|
389
|
+
qw, vw = qn.t().contiguous(), v.t().contiguous()
|
|
390
|
+
if MUSCLE_GRAD:
|
|
391
|
+
lw, aw, uw = (x.t().contiguous() for x in (env.lce, env.a, self.cap["u"]))
|
|
392
|
+
else:
|
|
393
|
+
lw, aw, uw = (x.detach().t().contiguous() for x in (env.lce, env.a, self.cap["u"]))
|
|
394
|
+
if torch.is_grad_enabled():
|
|
395
|
+
q1, v1, l1, a1, w1 = self.train14.Step14.apply(qw, vw, lw, aw, uw, self.warm, self.eng, self.win, self.chart)
|
|
396
|
+
self.win_used = True
|
|
397
|
+
self.count["step14"] += 1
|
|
398
|
+
else:
|
|
399
|
+
o = self.eng.control_step(qw, vw, self.warm, lw, aw, uw)
|
|
400
|
+
q1, v1, l1, w1 = (o[k].clone() for k in ("qpos", "qvel", "lce", "warm"))
|
|
401
|
+
self.count["control_step"] += 1
|
|
402
|
+
self.warm.copy_(w1.detach()) # in place: the one env14 state that crosses control steps (CAPTURE_PLAN.md P2 (iv))
|
|
403
|
+
a1o = a1 if torch.is_grad_enabled() else o["a"].clone()
|
|
404
|
+
self.a1 = (a1o.t() if MUSCLE_GRAD else a1o.detach().t()).contiguous()
|
|
405
|
+
q_old = q1.t()
|
|
406
|
+
qd_old = law_to_old(q_old, v1.t())
|
|
407
|
+
l_old = l1.t() if MUSCLE_GRAD else l1.detach().t()
|
|
408
|
+
return q_old.contiguous(), qd_old.contiguous(), l_old.contiguous(), z
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
def _control_step_f64(self, z):
|
|
412
|
+
"""E0_ENV14_F64: the control step on the float64 engine from the float64 shadow. A world the env did not reset must still
|
|
413
|
+
hold exactly the float32 copy this path handed it (asserted), so no other writer of the env's state goes unseen."""
|
|
414
|
+
assert not torch.is_grad_enabled(), "E0_ENV14_F64 replays without gradients (eval14)"
|
|
415
|
+
env = self.env
|
|
416
|
+
if self.sh_last is not None:
|
|
417
|
+
keep = ~self.dirty
|
|
418
|
+
for name, x, last in zip(("q", "qd", "lce", "a"), (env.q, env.qd, env.lce, env.a), self.sh_last):
|
|
419
|
+
assert torch.equal(x[:, keep], last[:, keep]), f"E0_ENV14_F64: the env changed a non-reset world's {name}"
|
|
420
|
+
qn, v = old_to_law(env.q.double(), env.qd.double())
|
|
421
|
+
cur = dict(q=qn, v=v, l=env.lce.double(), a=env.a.double())
|
|
422
|
+
if self.sh is None:
|
|
423
|
+
self.sh = {k: x.clone() for k, x in cur.items()}
|
|
424
|
+
else:
|
|
425
|
+
d = self.dirty
|
|
426
|
+
for k in self.sh:
|
|
427
|
+
self.sh[k][:, d] = cur[k][:, d]
|
|
428
|
+
self.dirty.zero_()
|
|
429
|
+
o = self.eng.control_step(self.sh["q"].t().contiguous(), self.sh["v"].t().contiguous(), self.warm,
|
|
430
|
+
self.sh["l"].t().contiguous(), self.sh["a"].t().contiguous(), self.cap["u"].double().t().contiguous())
|
|
431
|
+
q1, v1, l1, w1, a1 = (o[k].clone() for k in ("qpos", "qvel", "lce", "warm", "a"))
|
|
432
|
+
self.count["control_step"] += 1
|
|
433
|
+
self.warm.copy_(w1)
|
|
434
|
+
self.sh = dict(q=q1.t().contiguous(), v=v1.t().contiguous(), l=l1.t().contiguous(), a=a1.t().contiguous())
|
|
435
|
+
q_old = self.sh["q"].float().contiguous()
|
|
436
|
+
qd_old = law_to_old(self.sh["q"], self.sh["v"]).float().contiguous()
|
|
437
|
+
l_old = self.sh["l"].float().contiguous()
|
|
438
|
+
self.a1 = self.sh["a"].float().contiguous()
|
|
439
|
+
self.sh_last = (q_old, qd_old, l_old, self.a1)
|
|
440
|
+
return q_old, qd_old, l_old, z
|
|
441
|
+
|
|
442
|
+
def _control_step_glue(self, z):
|
|
443
|
+
"""M4b: _control_step with the glue compiled (E0_ENV14_GLUE=1); the same operations, fused, so roundoff (gated)"""
|
|
444
|
+
env = self.env
|
|
445
|
+
qw, vw, lw, aw, uw = self.pre(env.q, env.qd, env.lce, env.a, self.cap["u"])
|
|
446
|
+
if torch.is_grad_enabled():
|
|
447
|
+
q1, v1, l1, a1, w1 = self.train14.Step14.apply(qw, vw, lw, aw, uw, self.warm, self.eng, self.win, self.chart)
|
|
448
|
+
self.win_used = True
|
|
449
|
+
self.count["step14"] += 1
|
|
450
|
+
else:
|
|
451
|
+
o = self.eng.control_step(qw, vw, self.warm, lw, aw, uw)
|
|
452
|
+
q1, v1, l1, w1, a1 = (o[k].clone() for k in ("qpos", "qvel", "lce", "warm", "a"))
|
|
453
|
+
self.count["control_step"] += 1
|
|
454
|
+
self.warm.copy_(w1.detach()) # in place: the one env14 state that crosses control steps (CAPTURE_PLAN.md P2 (iv))
|
|
455
|
+
q_old, qd_old, l_old, self.a1 = self.post(q1, v1, l1, a1)
|
|
456
|
+
return q_old, qd_old, l_old, z
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
def install_equil14(env, e14):
|
|
460
|
+
"""P1 (tools/e0speed/CAPTURE_PLAN.md), E0_ENV14_EQUIL14=1: the reset's fibre equilibrium on the 14x law (Engine14.equil_lce,
|
|
461
|
+
one masked kernel) in place of the old engine's mtu_gpu.equilibrate_fibers, for this env only. The same iteration (l_ce_prev
|
|
462
|
+
<- l_ce at fixed q0 and a0) and the same round count (DN_FIBER_INIT_ITERS, default 8), on the stage's own fibre solve."""
|
|
463
|
+
old, eng = env._myoleg_gpu, e14.eng_equil
|
|
464
|
+
# the case's muscles are the env's model's, in the env's order: lce, a and u cross this boundary by index
|
|
465
|
+
lo = torch.as_tensor(eng.case["lopt"], dtype=torch.float64).cpu()
|
|
466
|
+
dl = float((lo - env.l_opt.double().cpu()).abs().max())
|
|
467
|
+
assert lo.numel() == env.l_opt.numel() and dl < 1e-6, f"the case's l_opt is not the model's: max |d| {dl}"
|
|
468
|
+
print(f"[env14] the case's l_opt = the model's, in order: {lo.numel()} muscles, max |d| {dl:.2e} m", flush=True)
|
|
469
|
+
outer = int(os.environ.get("DN_FIBER_INIT_ITERS", "8"))
|
|
470
|
+
assert outer >= 1, "E0_ENV14_EQUIL14 with DN_FIBER_INIT_ITERS=0 (no equilibration): unset the flag instead"
|
|
471
|
+
e14.count.setdefault("equil14", 0)
|
|
472
|
+
|
|
473
|
+
_mc_tab = {}
|
|
474
|
+
|
|
475
|
+
def _millard_reset_counter(P):
|
|
476
|
+
"""(11-17 23:4x, the review: the l_ce-move assert WITHDRAWN as mis-specified; the commit message holds the table) three numbers
|
|
477
|
+
of a Millard f64 reset as a device tensor [3] (no host read): the compliant (world, muscle) pairs whose one more f64 polish round
|
|
478
|
+
moves l_ce by more than 1e-3 l_opt; the largest F_T / F_max among those pairs (at the schedule's end); the largest
|
|
479
|
+
|F_T(after the extra round) - F_T(at the schedule's end)| / F_max over ALL compliant pairs. F_T at a round's end = the fibre side at
|
|
480
|
+
that round's own velocity (millard_curves_torch.mtu_forces: F_max cos(phi) (A f_L f_V + f_PE + beta v0), the engine's residual at
|
|
481
|
+
its solved state)."""
|
|
482
|
+
if not _mc_tab:
|
|
483
|
+
from diffneusim.rl import millard_curves_torch as _mct
|
|
484
|
+
names = [m_["name"] for m_ in env._monitor.jm["muscles"]]
|
|
485
|
+
_mc_tab["p"] = _mct.case_table(os.environ["E0_MUSCLE_CASE"], names, P["l_end"].device, torch.float64)
|
|
486
|
+
_mc_tab["f"] = _mct.mtu_forces
|
|
487
|
+
p, f = _mc_tab["p"], _mc_tab["f"]
|
|
488
|
+
dt_ = P["dt"]
|
|
489
|
+
le, lm, lp, a_ = P["l_end"].t(), P["l_more"].t(), P["l_prev"].t(), P["a"].t() # (n_mus, n_env), as mtu_forces takes them
|
|
490
|
+
fe = f(le, (le - lp) / dt_, a_, p)[0] / p["F_max"]
|
|
491
|
+
fm = f(lm, (lm - le) / dt_, a_, p)[0] / p["F_max"]
|
|
492
|
+
comp = ~p["rigid"].expand_as(fe)
|
|
493
|
+
mv = (lm - le).abs() / p["l_opt"]
|
|
494
|
+
big = comp & (mv > 1e-3)
|
|
495
|
+
zero = torch.zeros((), dtype=fe.dtype, device=fe.device)
|
|
496
|
+
return torch.stack([big.sum().to(fe.dtype), torch.where(big, fe.abs(), zero).max(), torch.where(comp, (fm - fe).abs(), zero).max()])
|
|
497
|
+
|
|
498
|
+
def equilibrate_fibers(q0, lce0, a0, dt, model_path=None, qd=None, iters=None):
|
|
499
|
+
assert qd is None, "E0_ENV14_EQUIL14: DN_FIBER_INIT_VC (the velocity-consistent start) is not ported"
|
|
500
|
+
n = q0.shape[1]
|
|
501
|
+
with torch.no_grad():
|
|
502
|
+
qn, _ = old_to_law(q0, torch.zeros(env.qd.shape[0], n, dtype=q0.dtype, device=q0.device))
|
|
503
|
+
qt, at, msk = qn.t().contiguous().to(eng.dt), a0.t().contiguous().to(eng.dt), torch.ones(n, dtype=torch.bool, device=q0.device) # the engine's dtype (main's E0_ENV14_F64)
|
|
504
|
+
out = eng.equil_lce(qt, lce0.t().contiguous().to(eng.dt), at, msk, outer=outer if iters is None else int(iters))
|
|
505
|
+
mc = None
|
|
506
|
+
if getattr(eng, "millard_polish", None) is not None: # (11-17 23:4x, the review) the f64 Millard reset's LOGGED counter (no assert)
|
|
507
|
+
mc = _millard_reset_counter(eng.millard_polish)
|
|
508
|
+
eng.millard_polish = None
|
|
509
|
+
acc = getattr(e14, "millard_counter", None)
|
|
510
|
+
e14.millard_counter = mc if acc is None else torch.stack([acc[0] + mc[0], torch.maximum(acc[1], mc[1]), torch.maximum(acc[2], mc[2])])
|
|
511
|
+
e14.millard_counter_calls = getattr(e14, "millard_counter_calls", 0) + 1
|
|
512
|
+
if e14.millard_counter_calls % 256 == 0: # one host read every 256 reset calls: the running totals since the first reset
|
|
513
|
+
c = e14.millard_counter.tolist()
|
|
514
|
+
print(f"[env14] Millard reset counter after {e14.millard_counter_calls} reset calls: pairs whose one more f64 polish round moves "
|
|
515
|
+
f"> 1e-3 l_opt {int(c[0])}, max F_T / F_max among them {c[1]:.3e}; max |dF_T| / F_max over all compliant pairs {c[2]:.3e} (logged)",
|
|
516
|
+
flush=True)
|
|
517
|
+
if e14.count["equil14"] == 0: # the trainer's own record of the reset it runs: the law, the launches, and the fibres against this model's l_opt
|
|
518
|
+
r = out / env.l_opt.view(1, -1)
|
|
519
|
+
with torch.no_grad(): # the residual: one further fibre-solve round at the step's DT, |its move| / l_opt (no state written)
|
|
520
|
+
res = (eng.equil_residual(qt, out, at, msk) / env.l_opt.view(1, -1)).flatten()
|
|
521
|
+
print(f"[env14] first reset: law {'millard' if eng.millard else 'geyer'}, launches (rounds, dt) {eng.equil_log}, {n} worlds, a0 {float(a0.mean()):.4f}, "
|
|
522
|
+
f"l_ce / l_opt min {float(r.min()):.3f} p1 {float(r.quantile(0.01)):.3f} median {float(r.median()):.3f} p99 {float(r.quantile(0.99)):.3f} max {float(r.max()):.3f}; "
|
|
523
|
+
f"residual (one more round at DT, |d l_ce| / l_opt) median {float(res.median()):.2e} p99 {float(res.quantile(0.99)):.2e} max {float(res.max()):.2e}"
|
|
524
|
+
+ ("" if mc is None else "; Millard f64 reset, one more f64 polish round (logged, no assert): pairs moving > 1e-3 l_opt "
|
|
525
|
+
f"{int(mc[0])}, max F_T / F_max among them {float(mc[1]):.3e}, max |dF_T| / F_max over all compliant pairs {float(mc[2]):.3e}"),
|
|
526
|
+
flush=True)
|
|
527
|
+
e14.count["equil14"] += 1
|
|
528
|
+
return out.t().contiguous().to(lce0.dtype) # the env keeps its own dtype (a no-op unless E0_ENV14_F64)
|
|
529
|
+
|
|
530
|
+
class MtuProxy: # the env's mtu_gpu handle with equilibrate_fibers replaced; everything else is the module's
|
|
531
|
+
def __getattr__(self, k):
|
|
532
|
+
return getattr(old, k)
|
|
533
|
+
proxy = MtuProxy()
|
|
534
|
+
proxy.equilibrate_fibers = equilibrate_fibers
|
|
535
|
+
env._myoleg_gpu = proxy
|
|
536
|
+
pending = getattr(env, "_fibres_pending", False) # (3a) the construction reset kept its seed fibres (no old engine)
|
|
537
|
+
if eng.millard or eng.equil_schedule is not None or pending:
|
|
538
|
+
# (X14_EQUIL_SCHEDULE, the Geyer-root arm: the construction reset ran the old engine's 8 rounds at DT, not the schedule, so it is redone too.)
|
|
539
|
+
# The construction reset (GpuFullBodyVecEnv.__init__'s self.reset(), before the trainer installs env14) equilibrated every
|
|
540
|
+
# world's fibres on the old engine, i.e. the Geyer law, and SapoVec.train does not reset at its start. On a Millard case each
|
|
541
|
+
# world's first episode would start from the wrong law's fibres, so redo that equilibrium here on the case's law, at the same
|
|
542
|
+
# (q, a) from the reset's seed l_opt: no RNG draw, so poses and the random stream are unchanged. A Geyer case skips this
|
|
543
|
+
# (its construction reset is already its own law). The review, 11-06, decision B.
|
|
544
|
+
assert env.musclepd is None, "the construction re-equilibration does not set musclepd's _pd_lce_prev"
|
|
545
|
+
seed = env.l_opt.view(-1, 1).repeat(1, env.num_envs).contiguous()
|
|
546
|
+
lce = equilibrate_fibers(env.q, seed, env.a, env.dt, env.model)
|
|
547
|
+
assert lce.shape == env.lce.shape and lce.dtype == env.lce.dtype and bool(torch.isfinite(lce).all()), (lce.shape, lce.dtype)
|
|
548
|
+
env.lce = lce
|
|
549
|
+
env._fibres_pending = False
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
def install_from_env(env, H, tree14=None, case_dir=None):
|
|
553
|
+
"""the flag: E0_ENGINE14=1 swaps the physics; unset leaves the old engine (returns None)"""
|
|
554
|
+
if os.environ.get("E0_ENGINE14", "0") != "1":
|
|
555
|
+
return None
|
|
556
|
+
tree14 = tree14 or os.environ["E0_TREE14"]
|
|
557
|
+
case_dir = case_dir or os.environ["E0_MUSCLE_CASE"]
|
|
558
|
+
e14 = Env14(env, tree14, case_dir, H)
|
|
559
|
+
e14.equil_on = equil14_default(e14.glue) # P1 (equil14_default: on with the glue)
|
|
560
|
+
if e14.equil_on:
|
|
561
|
+
install_equil14(env, e14)
|
|
562
|
+
assert not getattr(env, "_fibres_pending", False), "the construction reset's fibres are unequilibrated: E0_ENV14_EQUIL14 must be on"
|
|
563
|
+
e14.rew14_on = rew14_default(e14.glue, env)
|
|
564
|
+
if e14.rew14_on: # the fused reward + obs node (tools/d16_fused_env/rew14_hook.py)
|
|
565
|
+
# (3a) was: sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2] / "d16_fused_env"))
|
|
566
|
+
from diffneusim.env import rew14_hook
|
|
567
|
+
rew14_hook.install(env, e14, H)
|
|
568
|
+
return e14
|