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
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
// Portions of this file are translated from MuJoCo 3.16.0 (https://github.com/google-deepmind/mujoco), Copyright 2021
|
|
3
|
+
// DeepMind Technologies Limited, licensed under the Apache License, Version 2.0. Changed by this project: transcribed to
|
|
4
|
+
// templated C++ (double, Dual, float), restructured for the G1 soft law and the GPU path. See core/soft/NOTICE.md.
|
|
5
|
+
// D16 C1 (2026-11-02): one substep of the soft law, MuJoCo 3.16.0's mj_step for the G1 scene (implicitfast;
|
|
6
|
+
// LAW_SPEC_MUJOCO316.md "The implicitfast step", "Position servos and forcerange"), f64, and the control step (decimation
|
|
7
|
+
// substeps with ctrl held). Order: mj_kinematics, M, collision, rows (with the reference), qfrc_bias, actuator force
|
|
8
|
+
// (clamped to forcerange before qacc_smooth), qacc_smooth = M^-1 (qfrc_actuator - qfrc_bias), the Newton solve, then
|
|
9
|
+
// implicitfast: (M + h kd on the unclamped actuated dofs) qacc_imp = qfrc_smooth + qfrc_constraint, qvel += h qacc_imp,
|
|
10
|
+
// qpos integrated with the new qvel (mju_quatIntegrate for the free root, body-frame angular velocity), and
|
|
11
|
+
// qacc_warmstart = the solver's qacc.
|
|
12
|
+
#include <algorithm>
|
|
13
|
+
#include <cmath>
|
|
14
|
+
#include <vector>
|
|
15
|
+
|
|
16
|
+
#include "kin.h"
|
|
17
|
+
#include "newton.h"
|
|
18
|
+
#include "rows.h"
|
|
19
|
+
|
|
20
|
+
namespace js::soft {
|
|
21
|
+
|
|
22
|
+
struct SoftActuator { int dof, qadr; double kp, kd, lo, hi; bool forcelimited; };
|
|
23
|
+
|
|
24
|
+
struct SoftModel {
|
|
25
|
+
std::vector<SoftBody> bodies;
|
|
26
|
+
std::vector<SoftGeom> geoms;
|
|
27
|
+
std::vector<SoftPair> pairs;
|
|
28
|
+
std::vector<SoftJoint> joints;
|
|
29
|
+
std::vector<SoftActuator> actuators; // MuJoCo actuator order (ctrl index)
|
|
30
|
+
std::vector<double> armature, dof_invweight0;
|
|
31
|
+
double gravity[3] = {0, 0, -9.81};
|
|
32
|
+
double timestep = 0.005, impratio = 1, tolerance = 1e-8, ls_tolerance = 0.01;
|
|
33
|
+
int iterations = 10, ls_iterations = 20, nq = 0, nv = 0;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// dec_hash: a fingerprint of the substep's discrete decisions (the contact list's (pair, slot), the solver's active set, the
|
|
37
|
+
// actuator clamps), so a finite-difference stencil can tell whether it crossed a decision boundary (C2's positive control)
|
|
38
|
+
// One substep's tape record (the format agreed with engine B, 2026-11-02 09:4x: NablaEngine's record + min_nu), f64 on the CPU
|
|
39
|
+
// reference: the substep's input state, the solver's a*, a_adv = qH^-1 (qfrc_smooth + qfrc_constraint) (qvel' = qvel + h a_adv),
|
|
40
|
+
// the decisions (contact table in row order, the rows' quadratic zone, the actuator clamps) and the two factors the adjoint
|
|
41
|
+
// needs: L_H (H = M + sum_active D J'J at the final zones) and L_Q (qH = M + h kd on the unclamped actuated dofs), lower
|
|
42
|
+
// triangles, full nv x nv storage here (the GPU record packs them). min_nu: the smallest core distance of a sphere / capsule
|
|
43
|
+
// self contact (+inf without one), for the frozen-normal rule.
|
|
44
|
+
struct SubstepTape {
|
|
45
|
+
std::vector<double> q, v, a_star, a_adv, L_H, L_Q;
|
|
46
|
+
std::vector<double> M, qfrc_smooth, qacc_smooth; // the solve's inputs besides the rows (for L3, the parallelization 1)
|
|
47
|
+
std::vector<int> zone, clamp, con_pair, con_slot;
|
|
48
|
+
int ncon = 0, nefc = 0, nlim = 0, niter = 0;
|
|
49
|
+
bool warm_used = false, ran_out = false, stalled = false; // the solver's exits (newton::Result), the record's flags
|
|
50
|
+
double min_nu = 1e300;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
struct SubstepStats { int ncon = 0, nefc = 0, niter = 0, nclamped = 0; bool warm_used = false; unsigned long long dec_hash = 0; };
|
|
54
|
+
inline void hash_mix(unsigned long long& h, unsigned long long v) { h ^= v + 0x9e3779b97f4a7c15ULL + (h << 6) + (h >> 2); }
|
|
55
|
+
|
|
56
|
+
// mju_quatIntegrate (engine_util_spatial.c:233-242): quat <- normalize4(quat) * axisangle(vel / |vel|, h |vel|)
|
|
57
|
+
inline void quat_integrate(double* quat, const double* vel, double h) {
|
|
58
|
+
double axis[3] = {vel[0], vel[1], vel[2]};
|
|
59
|
+
V3<double> a{axis[0], axis[1], axis[2]};
|
|
60
|
+
const double n = normalize3(a);
|
|
61
|
+
const double angle = h * n;
|
|
62
|
+
double qrot[4] = {1, 0, 0, 0};
|
|
63
|
+
if (angle != 0) {
|
|
64
|
+
const double s = std::sin(0.5 * angle);
|
|
65
|
+
qrot[0] = std::cos(0.5 * angle); qrot[1] = a.x * s; qrot[2] = a.y * s; qrot[3] = a.z * s;
|
|
66
|
+
}
|
|
67
|
+
quat_normalize(quat);
|
|
68
|
+
double r[4];
|
|
69
|
+
quat_mul(quat, qrot, r);
|
|
70
|
+
for (int k = 0; k < 4; ++k) quat[k] = r[k];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// the smooth dynamics of one state, the first half of a substep (and of the hand's CPU reference): the frames X, qM with
|
|
74
|
+
// armature (full nv x nv), the actuator clamps, qfrc_smooth = qfrc_actuator - qfrc_bias, qacc_smooth = M^-1 qfrc_smooth
|
|
75
|
+
struct SmoothTerms {
|
|
76
|
+
std::vector<BodyState<double>> X;
|
|
77
|
+
std::vector<double> M, qfrc_smooth, qacc_smooth;
|
|
78
|
+
std::vector<char> clamped;
|
|
79
|
+
int nclamped = 0;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
inline void smooth_terms(const SoftModel& m, const double* qpos, const double* qvel, const double* ctrl, SmoothTerms& o) {
|
|
83
|
+
const int nb = static_cast<int>(m.bodies.size()), nv = m.nv;
|
|
84
|
+
o.X.assign(nb, BodyState<double>{});
|
|
85
|
+
fk(m.bodies.data(), nb, qpos, o.X.data());
|
|
86
|
+
o.M.assign(static_cast<size_t>(nv) * nv, 0.0);
|
|
87
|
+
std::vector<double> bias_(nv), jp(3 * nv), jr(3 * nv), w(3 * nb), al(3 * nb), vo(3 * nb), ao(3 * nb);
|
|
88
|
+
mass_matrix(m.bodies.data(), nb, o.X.data(), nv, m.armature.data(), o.M.data(), jp.data(), jr.data());
|
|
89
|
+
bias(m.bodies.data(), nb, o.X.data(), nv, qvel, m.gravity, bias_.data(), jp.data(), jr.data(), w.data(), al.data(),
|
|
90
|
+
vo.data(), ao.data());
|
|
91
|
+
// actuators: force = kp ctrl - kp q - kd qvel, clipped to forcerange (mju_clip); clamped iff force <= lo || >= hi
|
|
92
|
+
std::vector<double> qfrc_act(nv, 0.0);
|
|
93
|
+
o.clamped.assign(nv, 0);
|
|
94
|
+
o.nclamped = 0;
|
|
95
|
+
for (size_t u = 0; u < m.actuators.size(); ++u) {
|
|
96
|
+
const SoftActuator& a = m.actuators[u];
|
|
97
|
+
double f = a.kp * ctrl[u] + (0 + (-a.kp) * qpos[a.qadr] + (-a.kd) * qvel[a.dof]);
|
|
98
|
+
if (a.forcelimited) {
|
|
99
|
+
f = f < a.lo ? a.lo : (f > a.hi ? a.hi : f);
|
|
100
|
+
if (f <= a.lo || f >= a.hi) { o.clamped[a.dof] = 1; ++o.nclamped; }
|
|
101
|
+
}
|
|
102
|
+
qfrc_act[a.dof] += f;
|
|
103
|
+
}
|
|
104
|
+
o.qfrc_smooth.assign(nv, 0.0);
|
|
105
|
+
o.qacc_smooth.assign(nv, 0.0);
|
|
106
|
+
std::vector<double> LM(o.M);
|
|
107
|
+
for (int i = 0; i < nv; ++i) o.qfrc_smooth[i] = qfrc_act[i] - bias_[i];
|
|
108
|
+
newton::chol_factor(LM.data(), nv, kMinVal);
|
|
109
|
+
newton::chol_solve(LM.data(), o.qacc_smooth.data(), o.qfrc_smooth.data(), nv);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// one substep in place on (qpos, qvel, warm); ctrl [nu]; foot_friction < 0: the exported value
|
|
113
|
+
inline SubstepStats substep(const SoftModel& m, double* qpos, double* qvel, double* warm, const double* ctrl,
|
|
114
|
+
double foot_friction, SubstepTape* tape = nullptr) {
|
|
115
|
+
const int nb = static_cast<int>(m.bodies.size()), nv = m.nv;
|
|
116
|
+
SubstepStats st;
|
|
117
|
+
SmoothTerms sm_;
|
|
118
|
+
smooth_terms(m, qpos, qvel, ctrl, sm_);
|
|
119
|
+
const std::vector<BodyState<double>>& X = sm_.X;
|
|
120
|
+
const std::vector<double>& M = sm_.M;
|
|
121
|
+
const std::vector<double>& qfrc_smooth = sm_.qfrc_smooth;
|
|
122
|
+
const std::vector<double>& qacc_smooth = sm_.qacc_smooth;
|
|
123
|
+
const std::vector<char>& clamped = sm_.clamped;
|
|
124
|
+
st.nclamped = sm_.nclamped;
|
|
125
|
+
// contacts, rows, solve
|
|
126
|
+
std::vector<SoftContact<double>> con;
|
|
127
|
+
collide_all(m.geoms.data(), static_cast<int>(m.geoms.size()), m.pairs.data(), static_cast<int>(m.pairs.size()), X.data(),
|
|
128
|
+
foot_friction, con);
|
|
129
|
+
Rows<double> rows;
|
|
130
|
+
make_rows(m.bodies.data(), X.data(), nv, m.dof_invweight0.data(), m.joints.data(), static_cast<int>(m.joints.size()),
|
|
131
|
+
m.geoms.data(), m.pairs.data(), con, qpos, qvel, m.timestep, m.impratio, rows);
|
|
132
|
+
newton::Problem pr;
|
|
133
|
+
pr.nv = nv; pr.nefc = rows.n; pr.M = M.data(); pr.qfrc_smooth = qfrc_smooth.data(); pr.qacc_smooth = qacc_smooth.data();
|
|
134
|
+
pr.J = rows.J.data(); pr.aref = rows.aref.data(); pr.D = rows.D.data();
|
|
135
|
+
pr.iterations = m.iterations; pr.ls_iterations = m.ls_iterations; pr.tolerance = m.tolerance;
|
|
136
|
+
pr.ls_tolerance = m.ls_tolerance;
|
|
137
|
+
const newton::Result res = newton::solve(pr, warm);
|
|
138
|
+
st.ncon = static_cast<int>(con.size()); st.nefc = rows.n; st.niter = res.niter; st.warm_used = res.warm_used;
|
|
139
|
+
for (const SoftContact<double>& c : con) hash_mix(st.dec_hash, static_cast<unsigned long long>(c.pair) * 4 + c.slot);
|
|
140
|
+
hash_mix(st.dec_hash, 0xA11CEULL);
|
|
141
|
+
for (int r = 0; r < rows.n; ++r) hash_mix(st.dec_hash, static_cast<unsigned long long>(r) * 2 + (res.state[r] == newton::kQuadratic));
|
|
142
|
+
hash_mix(st.dec_hash, 0xC1A3ULL);
|
|
143
|
+
for (int i = 0; i < nv; ++i) if (clamped[i]) hash_mix(st.dec_hash, static_cast<unsigned long long>(i));
|
|
144
|
+
// implicitfast: qH = M + h kd (unclamped actuated dofs); qacc_imp = qH^-1 (qfrc_smooth + qfrc_constraint)
|
|
145
|
+
const double h = m.timestep;
|
|
146
|
+
std::vector<double> qH(M), rhs(nv), qacc_imp(nv);
|
|
147
|
+
for (const SoftActuator& a : m.actuators)
|
|
148
|
+
if (!clamped[a.dof]) qH[static_cast<size_t>(a.dof) * nv + a.dof] += h * a.kd;
|
|
149
|
+
for (int i = 0; i < nv; ++i) rhs[i] = qfrc_smooth[i] + res.qfrc_constraint[i];
|
|
150
|
+
newton::chol_factor(qH.data(), nv, kMinVal);
|
|
151
|
+
newton::chol_solve(qH.data(), qacc_imp.data(), rhs.data(), nv);
|
|
152
|
+
if (tape) { // the record, before the state advances
|
|
153
|
+
tape->q.assign(qpos, qpos + m.nq); tape->v.assign(qvel, qvel + nv);
|
|
154
|
+
tape->a_star = res.qacc; tape->a_adv = qacc_imp; tape->L_H = res.L; tape->L_Q = qH;
|
|
155
|
+
tape->M = M; tape->qfrc_smooth = qfrc_smooth; tape->qacc_smooth = qacc_smooth;
|
|
156
|
+
tape->zone.assign(rows.n, 0);
|
|
157
|
+
for (int r = 0; r < rows.n; ++r) tape->zone[r] = res.state[r] == newton::kQuadratic;
|
|
158
|
+
tape->clamp.assign(clamped.begin(), clamped.end());
|
|
159
|
+
tape->con_pair.clear(); tape->con_slot.clear();
|
|
160
|
+
tape->min_nu = 1e300;
|
|
161
|
+
for (const SoftContact<double>& c : con) {
|
|
162
|
+
tape->con_pair.push_back(c.pair); tape->con_slot.push_back(c.slot);
|
|
163
|
+
const SoftPair& pr = m.pairs[c.pair];
|
|
164
|
+
const SoftGeom &g1 = m.geoms[pr.g1], &g2 = m.geoms[pr.g2];
|
|
165
|
+
if (g1.type != 0 && g2.type != 0) // a self contact of two sphere / capsule cores: dist + both radii
|
|
166
|
+
tape->min_nu = std::min(tape->min_nu, c.dist + g1.size[0] + g2.size[0]);
|
|
167
|
+
}
|
|
168
|
+
tape->ncon = static_cast<int>(con.size()); tape->nefc = rows.n; tape->niter = res.niter;
|
|
169
|
+
tape->warm_used = res.warm_used; tape->ran_out = res.ran_out; tape->stalled = res.stalled;
|
|
170
|
+
tape->nlim = 0;
|
|
171
|
+
for (int r = 0; r < rows.n; ++r) tape->nlim += rows.type[r] == kRowLimit;
|
|
172
|
+
}
|
|
173
|
+
// mj_advance: qvel += h qacc_imp; positions with the new qvel; warm start = the solver's qacc
|
|
174
|
+
for (int i = 0; i < nv; ++i) qvel[i] += h * qacc_imp[i];
|
|
175
|
+
for (int b = 1; b < nb; ++b) {
|
|
176
|
+
const SoftBody& bd = m.bodies[b];
|
|
177
|
+
if (bd.jnt_type == kJntFree) {
|
|
178
|
+
for (int k = 0; k < 3; ++k) qpos[bd.qadr + k] += h * qvel[bd.dadr + k];
|
|
179
|
+
quat_integrate(qpos + bd.qadr + 3, qvel + bd.dadr + 3, h);
|
|
180
|
+
} else if (bd.jnt_type == kJntHinge) {
|
|
181
|
+
qpos[bd.qadr] += h * qvel[bd.dadr];
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
for (int i = 0; i < nv; ++i) warm[i] = res.qacc[i];
|
|
185
|
+
return st;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
} // namespace js::soft
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
// The record layout follows NablaEngine's tape.py (https://github.com/OamIcs/NablaEngine at 70d0c8c), Copyright 2026 The
|
|
3
|
+
// NablaEngine Authors, Apache License, Version 2.0; the code here is this project's own. See core/soft/NOTICE.md.
|
|
4
|
+
// D16 L4 (2026-11-02): the tape record, one per world and substep, that engine B's adjoint megakernel reads. The
|
|
5
|
+
// layout is NablaEngine's (src/nablaengine/g1_engine/tape.py at 70d0c8c), as agreed with B (tools/d16_adj/README.md: hdr,
|
|
6
|
+
// flags, min_nu, clamp, zone bits, contact table, q, v, a*, a_adv, L_H, L_Q), sized from our model and capacities. For the G1
|
|
7
|
+
// (nq 36, nv 35, 64 contacts, 192 rows) it is NablaEngine's table word for word: L_H at 192, L_Q at 832, 1472 words.
|
|
8
|
+
//
|
|
9
|
+
// Words are T (float in production, double for the f64 build B's dot test runs); the offsets are in words and the same for
|
|
10
|
+
// both. Integer fields are stored bitwise: a u32 in a float word, the same u32 zero-extended in a double word (decode by
|
|
11
|
+
// reinterpreting, never by value). Records and their large blocks start on 32-word boundaries; padding words are zero.
|
|
12
|
+
//
|
|
13
|
+
// hdr 1 ncon | nefc << 8 | nlim << 16 | niter << 24 (u8 each)
|
|
14
|
+
// flags 1 kTape* bits below
|
|
15
|
+
// min_nu 1 T: the smallest core distance (dist + both radii) of a sphere / capsule self contact, +inf without one
|
|
16
|
+
// reserved 1 0
|
|
17
|
+
// clamp nv/32 bit d: dof d's actuator force at or past its range (implicitfast leaves its kd out of L_Q)
|
|
18
|
+
// zone rows/32 bit r: row r (limits first, then contacts in contact order, 4 pyramid rows each) QUADRATIC at a*
|
|
19
|
+
// con con/2 u16 per contact in row order, low half first: pair | slot << 9; kTapeConNone past ncon
|
|
20
|
+
// qpos nq the substep's input
|
|
21
|
+
// qvel nv
|
|
22
|
+
// qacc nv a*: the final Newton acceleration (also the next substep's warm start)
|
|
23
|
+
// qacc_adv nv a_adv = qH^-1 (qfrc_smooth + qfrc_constraint): qvel' = qvel + h a_adv
|
|
24
|
+
// (pad to 32)
|
|
25
|
+
// L_H nv(nv+1)/2 chol(M + sum over QUADRATIC rows of D J'J) at a*'s zones (chol(M) with no rows), packed TRI(i, j)
|
|
26
|
+
// (pad to 32)
|
|
27
|
+
// L_Q nv(nv+1)/2 chol(M + h kd on the unclamped actuated dofs), packed TRI(i, j); absent (LQ -1) for a body without
|
|
28
|
+
// implicitfast (the 14x: Euler, no actuator kd; tape_layout's lq false). The G1's record is unchanged.
|
|
29
|
+
// (pad to 32)
|
|
30
|
+
// POSE 7 npose optional (npose > 0; engine B's proposal, the layout 2026-11-02): the bodies' frames at the substep's
|
|
31
|
+
// input q, as L1 computed them and L2 used them: xpos [npose][3], then xquat [npose][4] (kernel P's hand
|
|
32
|
+
// order, so its pose writes can target this slot). xmat is not stored: forward and adjoint derive it from
|
|
33
|
+
// xquat with the same rounded helper. Present iff the flags carry kTapePose; npose 0 is NablaEngine's
|
|
34
|
+
// record word for word. Kept only if B's pre-registered A/B (recompute against read) shows read faster.
|
|
35
|
+
// (pad to 32)
|
|
36
|
+
// MUS nmus optional (nmus > 0; the muscle stage, 2026-11-02): lce_prev [nmus], each muscle's fibre length at the
|
|
37
|
+
// substep's input. Present iff the flags carry kTapeMus; nmus 0 leaves the record as above.
|
|
38
|
+
// (pad to 32)
|
|
39
|
+
// The muscles' per-control-step values (the activation a_0 at the step's start and the excitation u, [nmus] each) are not in
|
|
40
|
+
// the substep records: they go in a separate per-control-step record, tape_ctl_layout / tape_ctl_pack below.
|
|
41
|
+
//
|
|
42
|
+
// Flags (NablaEngine's bit where the meaning is the same): kTapeOverflow (a capacity was exceeded: the record is not valid),
|
|
43
|
+
// kTapeNonconv (the iterations ran out before a stopping test held), kTapeSingular (min_nu < kTapeSingularNu), kTapeWarm (the
|
|
44
|
+
// warm start was kept), kTapeStalled (the line search returned alpha 0). NablaEngine's REFACT has no counterpart: our solve
|
|
45
|
+
// always refactors H at the final zones (newton.h), so L_H is never an incremental factor.
|
|
46
|
+
//
|
|
47
|
+
// The writer is one function for both sides: tape_pack(rec, layout, in, lane, nlanes) writes every word of the record, lane
|
|
48
|
+
// strided (GPU: lane 0..31 of the world's warp, nlanes 32, coalesced; CPU: lane 0, nlanes 1). Each word has exactly one
|
|
49
|
+
// writer, so the record is the same bits whatever nlanes is, and no word needs a prior memset. tape_pack_range writes the
|
|
50
|
+
// words in [w0, w1) only, with the same code (k_post: L_H at the solve's end, the rest after implicitfast, k_pre: POSE).
|
|
51
|
+
#include <cmath>
|
|
52
|
+
#include <cstdint>
|
|
53
|
+
#include <cstring>
|
|
54
|
+
|
|
55
|
+
#include "diffneusim/macros.h"
|
|
56
|
+
#if defined(D16_NV_GT64)
|
|
57
|
+
#include <cassert> // (tape_pack_range's split-factor check)
|
|
58
|
+
#endif
|
|
59
|
+
|
|
60
|
+
namespace js::soft {
|
|
61
|
+
|
|
62
|
+
constexpr uint32_t kTapeOverflow = 1u << 0, kTapeNonconv = 1u << 9, kTapeSingular = 1u << 10, kTapeWarm = 1u << 12,
|
|
63
|
+
kTapeStalled = 1u << 13, kTapePose = 1u << 14, kTapeMus = 1u << 15;
|
|
64
|
+
constexpr double kTapeSingularNu = 5e-3; // m (NablaEngine's SINGULAR_NU)
|
|
65
|
+
constexpr uint32_t kTapeConNone = 0xFFFFu;
|
|
66
|
+
constexpr int kTapeAlign = 32;
|
|
67
|
+
|
|
68
|
+
struct TapeLayout {
|
|
69
|
+
int nq, nv, ntri, maxcon, maxrows;
|
|
70
|
+
int hdr, flags, min_nu, reserved, clamp, zone, con, qpos, qvel, qacc, qadv, LH, LQ, words;
|
|
71
|
+
int n_clamp, n_zone, n_con;
|
|
72
|
+
int npose, pose; // the optional POSE block: npose bodies at word pose (-1 without it)
|
|
73
|
+
int nmus, mus; // the optional MUS block: nmus muscles' lce_prev at word mus (-1 without it)
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
DN_HOST_DEVICE constexpr int tape_ceil(int a, int b) { return (a + b - 1) / b; }
|
|
77
|
+
|
|
78
|
+
#if defined(D16_NV_GT64) // a body whose limit mask needs more words than its dofs (PHASE_B.md section 6.1): the clamp words hold that mask on the 14x family's path.
|
|
79
|
+
// B3c: the factor blocks (L_H, L_Q) are the split storage's mwords words (::d16::split::WORDS), as the solve keeps them. Required: left at
|
|
80
|
+
// -1, ntri is -1 and tape_layout_ok false, so a reader that forgets them fails where the layout is checked
|
|
81
|
+
DN_HOST_DEVICE constexpr TapeLayout tape_layout(int nq, int nv, int maxcon, int maxrows, int npose = 0, int nmus = 0,
|
|
82
|
+
bool lq = true, int nlim = 0, int mwords = -1) {
|
|
83
|
+
#else
|
|
84
|
+
DN_HOST_DEVICE constexpr TapeLayout tape_layout(int nq, int nv, int maxcon, int maxrows, int npose = 0, int nmus = 0,
|
|
85
|
+
bool lq = true) {
|
|
86
|
+
#endif
|
|
87
|
+
TapeLayout t{};
|
|
88
|
+
#if defined(D16_NV_GT64)
|
|
89
|
+
t.nq = nq; t.nv = nv; t.ntri = mwords > 0 ? mwords : -1; t.maxcon = maxcon; t.maxrows = maxrows;
|
|
90
|
+
#else
|
|
91
|
+
t.nq = nq; t.nv = nv; t.ntri = nv * (nv + 1) / 2; t.maxcon = maxcon; t.maxrows = maxrows;
|
|
92
|
+
#endif
|
|
93
|
+
// at least 2 clamp words (tools/d16_bodies/PORT_DESIGN.md section 5): the limit mask lives there, and l3.cuh and adj14.cuh read two of
|
|
94
|
+
// them, so at NV <= 32 a second word would land on the zone block. NV 33..64 keeps ceil(nv / 32) = 2.
|
|
95
|
+
t.n_clamp = nv <= 64 ? 2 : tape_ceil(nv, 32); t.n_zone = tape_ceil(maxrows, 32); t.n_con = tape_ceil(maxcon, 2);
|
|
96
|
+
#if defined(D16_NV_GT64)
|
|
97
|
+
if (tape_ceil(nlim, 32) > t.n_clamp) t.n_clamp = tape_ceil(nlim, 32);
|
|
98
|
+
#endif
|
|
99
|
+
int o = 0;
|
|
100
|
+
t.hdr = o++; t.flags = o++; t.min_nu = o++; t.reserved = o++;
|
|
101
|
+
t.clamp = o; o += t.n_clamp;
|
|
102
|
+
t.zone = o; o += t.n_zone;
|
|
103
|
+
t.con = o; o += t.n_con;
|
|
104
|
+
t.qpos = o; o += nq;
|
|
105
|
+
t.qvel = o; o += nv;
|
|
106
|
+
t.qacc = o; o += nv;
|
|
107
|
+
t.qadv = o; o += nv;
|
|
108
|
+
o = tape_ceil(o, kTapeAlign) * kTapeAlign;
|
|
109
|
+
#if defined(D16_NV_GT64) // (an invalid layout, ntri -1, keeps its blocks empty; tape_layout_ok refuses it)
|
|
110
|
+
t.LH = o; o += t.ntri > 0 ? t.ntri : 0;
|
|
111
|
+
o = tape_ceil(o, kTapeAlign) * kTapeAlign;
|
|
112
|
+
t.LQ = -1;
|
|
113
|
+
if (lq) { t.LQ = o; o += t.ntri > 0 ? t.ntri : 0; o = tape_ceil(o, kTapeAlign) * kTapeAlign; }
|
|
114
|
+
#else
|
|
115
|
+
t.LH = o; o += t.ntri;
|
|
116
|
+
o = tape_ceil(o, kTapeAlign) * kTapeAlign;
|
|
117
|
+
t.LQ = -1;
|
|
118
|
+
if (lq) { t.LQ = o; o += t.ntri; o = tape_ceil(o, kTapeAlign) * kTapeAlign; }
|
|
119
|
+
#endif
|
|
120
|
+
t.npose = npose; t.pose = -1;
|
|
121
|
+
if (npose > 0) { t.pose = o; o += 7 * npose; }
|
|
122
|
+
o = tape_ceil(o, kTapeAlign) * kTapeAlign;
|
|
123
|
+
t.nmus = nmus; t.mus = -1;
|
|
124
|
+
if (nmus > 0) { t.mus = o; o += nmus; }
|
|
125
|
+
t.words = tape_ceil(o, kTapeAlign) * kTapeAlign;
|
|
126
|
+
return t;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// the field widths the packing assumes (pair 9 bits, slot 7, the u8 counts, clamp <= 2 words)
|
|
130
|
+
DN_HOST_DEVICE constexpr bool tape_layout_ok(const TapeLayout& t, int npair) {
|
|
131
|
+
#if defined(D16_NV_GT64) // B3c: the dofs are u8 fields nowhere in the record past the clamp mask's words; the factors' split words given
|
|
132
|
+
return t.nv <= 255 && t.ntri > 0 && npair <= 512 && t.maxcon <= 255 && t.maxrows <= 255;
|
|
133
|
+
#else
|
|
134
|
+
return t.nv <= 64 && npair <= 512 && t.maxcon <= 255 && t.maxrows <= 255;
|
|
135
|
+
#endif
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// One substep's record content, as the producer holds it (S: its scalar; the record's T may be narrower: rounded on store)
|
|
139
|
+
template <class S> struct TapeIn {
|
|
140
|
+
int ncon = 0, nefc = 0, nlim = 0, niter = 0;
|
|
141
|
+
uint32_t flags = 0;
|
|
142
|
+
S min_nu = S(0); // the caller stores +inf (or any value >= 1e30, mapped to +inf) without a self contact
|
|
143
|
+
const int* clamp = nullptr; // [nv] nonzero: clamped
|
|
144
|
+
const int* zone = nullptr; // [nefc] nonzero: QUADRATIC
|
|
145
|
+
const int* con_pair = nullptr;
|
|
146
|
+
const int* con_slot = nullptr; // [ncon]
|
|
147
|
+
const S* q = nullptr; const S* v = nullptr; const S* a_star = nullptr; const S* a_adv = nullptr; // [nq], [nv] x 3
|
|
148
|
+
const S* L_H = nullptr; const S* L_Q = nullptr; // lower triangles: ld 0 packed TRI(i, j); else full storage, row stride ld
|
|
149
|
+
int ld_H = 0, ld_Q = 0;
|
|
150
|
+
const S* xpos = nullptr; const S* xquat = nullptr; // the POSE block's source: [npose][3], [npose][4] (layout npose > 0)
|
|
151
|
+
// optional sources in the forms k_post holds them (the request, 2026-11-02; used when not null, instead of the arrays
|
|
152
|
+
// above): the clamp and zone bit words ([n_clamp], [ceil(nefc / 32)]; zone bits past nefc are masked here), and the hand's
|
|
153
|
+
// conmeta words (hand.h; words of the record's scalar, read bitwise; bits 0-11 = pair | slot << 9 are the tape's entry)
|
|
154
|
+
const uint32_t* clamp_bits = nullptr;
|
|
155
|
+
const uint32_t* zone_bits = nullptr;
|
|
156
|
+
const S* con_meta = nullptr;
|
|
157
|
+
const S* lce_prev = nullptr; // the MUS block's source: [nmus] (layout nmus > 0)
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// A tape word's store. JS_TAPE_STREAM (a build's choice; the 14x binding defines it, the G1's does not): an evict-first store
|
|
161
|
+
// (st.global.cs): the tape is written once per step and read only in the backward, so it should not evict the next kernel's
|
|
162
|
+
// working set from L2. Otherwise a plain store (the G1's record, unchanged).
|
|
163
|
+
template <class X> DN_HOST_DEVICE inline void tape_st(X* p, X v) {
|
|
164
|
+
#if defined(__CUDA_ARCH__) && defined(JS_TAPE_STREAM)
|
|
165
|
+
__stcs(p, v);
|
|
166
|
+
#else
|
|
167
|
+
*p = v;
|
|
168
|
+
#endif
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
template <class T> struct TapeWord;
|
|
172
|
+
template <> struct TapeWord<float> { using U = uint32_t; };
|
|
173
|
+
template <> struct TapeWord<double> { using U = uint64_t; };
|
|
174
|
+
|
|
175
|
+
template <class T> DN_HOST_DEVICE inline void tape_put_u(T* rec, int w, uint32_t v) {
|
|
176
|
+
using U = typename TapeWord<T>::U;
|
|
177
|
+
const U u = static_cast<U>(v);
|
|
178
|
+
#ifdef __CUDA_ARCH__
|
|
179
|
+
tape_st(reinterpret_cast<U*>(rec) + w, u);
|
|
180
|
+
#else
|
|
181
|
+
std::memcpy(rec + w, &u, sizeof(U));
|
|
182
|
+
#endif
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
template <class T> DN_HOST_DEVICE inline uint32_t tape_get_u(const T* rec, int w) {
|
|
186
|
+
using U = typename TapeWord<T>::U;
|
|
187
|
+
U u;
|
|
188
|
+
#ifdef __CUDA_ARCH__
|
|
189
|
+
u = reinterpret_cast<const U*>(rec)[w];
|
|
190
|
+
#else
|
|
191
|
+
std::memcpy(&u, rec + w, sizeof(U));
|
|
192
|
+
#endif
|
|
193
|
+
return static_cast<uint32_t>(u);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// row i of the packed lower triangle that holds entry k (exact: the float estimate is corrected by integer steps)
|
|
197
|
+
DN_HOST_DEVICE inline int tri_row(int k) {
|
|
198
|
+
int i = static_cast<int>((sqrtf(8.f * static_cast<float>(k) + 1.f) - 1.f) * 0.5f);
|
|
199
|
+
while (i > 0 && i * (i + 1) / 2 > k) --i;
|
|
200
|
+
while ((i + 1) * (i + 2) / 2 <= k) ++i;
|
|
201
|
+
return i;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
template <class S> DN_HOST_DEVICE inline uint32_t tape_flags(bool overflow, bool ran_out, bool warm, bool stalled, S min_nu) {
|
|
205
|
+
return (overflow ? kTapeOverflow : 0u) | (ran_out ? kTapeNonconv : 0u) | (min_nu < S(kTapeSingularNu) ? kTapeSingular : 0u) |
|
|
206
|
+
(warm ? kTapeWarm : 0u) | (stalled ? kTapeStalled : 0u);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
template <class T, class S>
|
|
210
|
+
DN_HOST_DEVICE inline void tape_pack_range(T* rec, const TapeLayout& t, const TapeIn<S>& in, int w0, int w1, int lane,
|
|
211
|
+
int nlanes) {
|
|
212
|
+
// each section's loop runs over its words inside [w0, w1); the code per word is the same as a whole-record pack
|
|
213
|
+
auto lo = [&](int a) { return a > w0 ? a : w0; };
|
|
214
|
+
auto hi = [&](int b) { return b < w1 ? b : w1; };
|
|
215
|
+
// scalars and bit words (each word one writer)
|
|
216
|
+
for (int w = lo(0) + lane; w < hi(t.qpos); w += nlanes) {
|
|
217
|
+
if (w == t.hdr) {
|
|
218
|
+
tape_put_u(rec, w, static_cast<uint32_t>(in.ncon) | static_cast<uint32_t>(in.nefc) << 8 |
|
|
219
|
+
static_cast<uint32_t>(in.nlim) << 16 | static_cast<uint32_t>(in.niter) << 24);
|
|
220
|
+
} else if (w == t.flags) {
|
|
221
|
+
tape_put_u(rec, w, in.flags | (t.npose > 0 ? kTapePose : 0u) | (t.nmus > 0 ? kTapeMus : 0u));
|
|
222
|
+
} else if (w == t.min_nu) {
|
|
223
|
+
tape_st(rec + w, in.min_nu >= S(1e30) ? static_cast<T>(INFINITY) : static_cast<T>(in.min_nu));
|
|
224
|
+
} else if (w == t.reserved) {
|
|
225
|
+
tape_put_u(rec, w, 0u);
|
|
226
|
+
} else if (w < t.zone) { // clamp
|
|
227
|
+
const int b0 = 32 * (w - t.clamp);
|
|
228
|
+
uint32_t bits = 0;
|
|
229
|
+
if (in.clamp_bits) bits = in.clamp_bits[w - t.clamp];
|
|
230
|
+
else for (int k = 0; k < 32 && b0 + k < t.nv; ++k) bits |= (in.clamp[b0 + k] ? 1u : 0u) << k;
|
|
231
|
+
tape_put_u(rec, w, bits);
|
|
232
|
+
} else if (w < t.con) { // zone
|
|
233
|
+
const int r0 = 32 * (w - t.zone);
|
|
234
|
+
uint32_t bits = 0;
|
|
235
|
+
if (in.zone_bits) {
|
|
236
|
+
if (r0 < in.nefc) bits = in.zone_bits[w - t.zone] & (in.nefc - r0 >= 32 ? 0xFFFFFFFFu : (1u << (in.nefc - r0)) - 1u);
|
|
237
|
+
} else {
|
|
238
|
+
for (int k = 0; k < 32 && r0 + k < in.nefc; ++k) bits |= (in.zone[r0 + k] ? 1u : 0u) << k;
|
|
239
|
+
}
|
|
240
|
+
tape_put_u(rec, w, bits);
|
|
241
|
+
} else { // con: entries 2e (low half) and 2e + 1
|
|
242
|
+
const int e = 2 * (w - t.con);
|
|
243
|
+
uint32_t lo_e = kTapeConNone, hi_e = kTapeConNone;
|
|
244
|
+
if (in.con_meta) {
|
|
245
|
+
if (e < in.ncon) lo_e = tape_get_u(in.con_meta, e) & 0xFFFu;
|
|
246
|
+
if (e + 1 < in.ncon) hi_e = tape_get_u(in.con_meta, e + 1) & 0xFFFu;
|
|
247
|
+
} else {
|
|
248
|
+
if (e < in.ncon) lo_e = static_cast<uint32_t>(in.con_pair[e]) | static_cast<uint32_t>(in.con_slot[e]) << 9;
|
|
249
|
+
if (e + 1 < in.ncon) hi_e = static_cast<uint32_t>(in.con_pair[e + 1]) | static_cast<uint32_t>(in.con_slot[e + 1]) << 9;
|
|
250
|
+
}
|
|
251
|
+
tape_put_u(rec, w, lo_e | hi_e << 16);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
// vectors (and the padding up to L_H)
|
|
255
|
+
for (int w = lo(t.qpos) + lane; w < hi(t.LH); w += nlanes) {
|
|
256
|
+
if (w < t.qvel) tape_st(rec + w, static_cast<T>(in.q[w - t.qpos]));
|
|
257
|
+
else if (w < t.qacc) tape_st(rec + w, static_cast<T>(in.v[w - t.qvel]));
|
|
258
|
+
else if (w < t.qadv) tape_st(rec + w, static_cast<T>(in.a_star[w - t.qacc]));
|
|
259
|
+
else if (w < t.qadv + t.nv) tape_st(rec + w, static_cast<T>(in.a_adv[w - t.qadv]));
|
|
260
|
+
else tape_put_u(rec, w, 0u);
|
|
261
|
+
}
|
|
262
|
+
// the two factors, the POSE and MUS blocks (and their padding)
|
|
263
|
+
for (int w = lo(t.LH) + lane; w < hi(t.words); w += nlanes) {
|
|
264
|
+
if (t.nmus > 0 && w >= t.mus) {
|
|
265
|
+
const int k = w - t.mus;
|
|
266
|
+
if (k < t.nmus) tape_st(rec + w, static_cast<T>(in.lce_prev[k]));
|
|
267
|
+
else tape_put_u(rec, w, 0u);
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
if (t.npose > 0 && w >= t.pose) {
|
|
271
|
+
const int k = w - t.pose;
|
|
272
|
+
if (k < 3 * t.npose) tape_st(rec + w, static_cast<T>(in.xpos[k]));
|
|
273
|
+
else if (k < 7 * t.npose) tape_st(rec + w, static_cast<T>(in.xquat[k - 3 * t.npose]));
|
|
274
|
+
else tape_put_u(rec, w, 0u);
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
const bool H = t.LQ < 0 || w < t.LQ; // no L_Q: every factor word past L_H is padding (k >= ntri)
|
|
278
|
+
const int k = w - (H ? t.LH : t.LQ);
|
|
279
|
+
if (k >= t.ntri) { tape_put_u(rec, w, 0u); continue; }
|
|
280
|
+
#if defined(D16_NV_GT64) // B3c: a factor block holds the split storage's words in their own order; a dense writer (ld > 0) has no place in it
|
|
281
|
+
const S* L = H ? in.L_H : in.L_Q;
|
|
282
|
+
assert((H ? in.ld_H : in.ld_Q) == 0 && "phase B: the tape's factors are the split words (ld 0)");
|
|
283
|
+
tape_st(rec + w, static_cast<T>(L[k]));
|
|
284
|
+
#else
|
|
285
|
+
const int i = tri_row(k), j = k - i * (i + 1) / 2;
|
|
286
|
+
const S* L = H ? in.L_H : in.L_Q;
|
|
287
|
+
const int ld = H ? in.ld_H : in.ld_Q;
|
|
288
|
+
tape_st(rec + w, static_cast<T>(ld == 0 ? L[k] : L[static_cast<size_t>(i) * ld + j]));
|
|
289
|
+
#endif
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
template <class T, class S>
|
|
294
|
+
DN_HOST_DEVICE inline void tape_pack(T* rec, const TapeLayout& t, const TapeIn<S>& in, int lane, int nlanes) {
|
|
295
|
+
tape_pack_range(rec, t, in, 0, t.words, lane, nlanes);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// The muscles' per-control-step record [world][words]: a_0 [nmus] (the activation at the control step's start), then u [nmus]
|
|
299
|
+
// (the excitation the step holds), padded to 32 words. One per world and control step, beside the substep records.
|
|
300
|
+
struct TapeCtlLayout { int nmus, a0, u, words; };
|
|
301
|
+
DN_HOST_DEVICE constexpr TapeCtlLayout tape_ctl_layout(int nmus) {
|
|
302
|
+
return TapeCtlLayout{nmus, 0, nmus, tape_ceil(2 * nmus, kTapeAlign) * kTapeAlign};
|
|
303
|
+
}
|
|
304
|
+
template <class T, class S>
|
|
305
|
+
DN_HOST_DEVICE inline void tape_ctl_pack(T* rec, const TapeCtlLayout& c, const S* a0, const S* u, int lane, int nlanes) {
|
|
306
|
+
for (int w = lane; w < c.words; w += nlanes) {
|
|
307
|
+
if (w < c.u) tape_st(rec + w, static_cast<T>(a0[w]));
|
|
308
|
+
else if (w < c.u + c.nmus) tape_st(rec + w, static_cast<T>(u[w - c.u]));
|
|
309
|
+
else tape_put_u(rec, w, 0u);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
} // namespace js::soft
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
// Portions of this file are translated from MuJoCo 3.16.0 (https://github.com/google-deepmind/mujoco), Copyright 2021
|
|
3
|
+
// DeepMind Technologies Limited, licensed under the Apache License, Version 2.0. Changed by this project: transcribed to
|
|
4
|
+
// templated C++ (double, float), restricted to an ellipsoid against a plane. See core/soft/NOTICE.md.
|
|
5
|
+
// D16 14x (2026-11-03; tools/d16_14x/FLOOR_CONTACT_TABLE.md decision C): MuJoCo's plane-ellipsoid collision, for
|
|
6
|
+
// MuscleMimic's 19 floor-contact ellipsoids. MuJoCo 3.16.0 collides a plane with an ellipsoid through mjc_PlaneConvex
|
|
7
|
+
// (engine_collision_driver.c:50's table; engine_collision_convex.c:1091-1120): the ellipsoid's support point v along the plane's
|
|
8
|
+
// -normal (mjc_ellipsoidSupport :262-294), dist = normal . (v - plane pos), one contact (a geom without mesh data) at
|
|
9
|
+
// v - dist / 2 normal with the plane's normal and a zero tangent. The CCD object is initialized with margin 0 there.
|
|
10
|
+
// collide14 dispatches it and leaves every other type pair to collide.h's collide (the G1's colliders, unchanged), so the G1
|
|
11
|
+
// build does not see this file.
|
|
12
|
+
#include "../collide.h"
|
|
13
|
+
|
|
14
|
+
namespace js::soft::x14 {
|
|
15
|
+
|
|
16
|
+
constexpr int kGeomEllipsoid = 4; // mjGEOM_ELLIPSOID
|
|
17
|
+
|
|
18
|
+
// ellipsoid g2 (world position pos2, row-major rotation R2, semi-axes size2) against plane g1 (position pos1, normal z1)
|
|
19
|
+
template <class S, class P = double>
|
|
20
|
+
DN_HOST_DEVICE int plane_ellipsoid(PreContact<S>* con, P margin, V3<S> pos1, V3<S> z1, V3<S> pos2, const S* R2, const P* size2) {
|
|
21
|
+
using so3::js_sqrt;
|
|
22
|
+
using L = lit_t<S>;
|
|
23
|
+
const S dir[3] = {S(0) - z1.x, S(0) - z1.y, S(0) - z1.z};
|
|
24
|
+
// mjc_ellipsoidSupport: dir to the geom's frame (matT dir), scaled by the sizes, normalized, scaled again, back to the world
|
|
25
|
+
S ld[3];
|
|
26
|
+
ld[0] = R2[0] * dir[0] + R2[3] * dir[1] + R2[6] * dir[2];
|
|
27
|
+
ld[1] = R2[1] * dir[0] + R2[4] * dir[1] + R2[7] * dir[2];
|
|
28
|
+
ld[2] = R2[2] * dir[0] + R2[5] * dir[1] + R2[8] * dir[2];
|
|
29
|
+
S ls[3] = {ld[0] * S(size2[0]), ld[1] * S(size2[1]), ld[2] * S(size2[2])};
|
|
30
|
+
const S norm2 = ls[0] * ls[0] + ls[1] * ls[1] + ls[2] * ls[2];
|
|
31
|
+
S v[3];
|
|
32
|
+
if (norm2 < L(kMinVal * kMinVal)) { // mjMINVAL2: too small to normalize
|
|
33
|
+
v[0] = R2[0] * S(size2[0]) + pos2.x;
|
|
34
|
+
v[1] = R2[3] * S(size2[0]) + pos2.y;
|
|
35
|
+
v[2] = R2[6] * S(size2[0]) + pos2.z;
|
|
36
|
+
} else {
|
|
37
|
+
const S inv = S(1) / js_sqrt(norm2);
|
|
38
|
+
ls[0] = ls[0] * inv * S(size2[0]);
|
|
39
|
+
ls[1] = ls[1] * inv * S(size2[1]);
|
|
40
|
+
ls[2] = ls[2] * inv * S(size2[2]);
|
|
41
|
+
v[0] = R2[0] * ls[0] + R2[1] * ls[1] + R2[2] * ls[2];
|
|
42
|
+
v[1] = R2[3] * ls[0] + R2[4] * ls[1] + R2[5] * ls[2];
|
|
43
|
+
v[2] = R2[6] * ls[0] + R2[7] * ls[1] + R2[8] * ls[2];
|
|
44
|
+
v[0] = v[0] + pos2.x; v[1] = v[1] + pos2.y; v[2] = v[2] + pos2.z;
|
|
45
|
+
}
|
|
46
|
+
// mjc_PlaneConvex: the normal distance, the first (only) contact
|
|
47
|
+
const S dist = z1.x * (v[0] - pos1.x) + z1.y * (v[1] - pos1.y) + z1.z * (v[2] - pos1.z);
|
|
48
|
+
if (dist > S(margin)) return 0;
|
|
49
|
+
con[0].dist = dist;
|
|
50
|
+
const S h = S(-0.5) * dist;
|
|
51
|
+
con[0].pos = V3<S>{v[0] + z1.x * h, v[1] + z1.y * h, v[2] + z1.z * h};
|
|
52
|
+
con[0].normal = z1;
|
|
53
|
+
con[0].tangent = V3<S>{S(0), S(0), S(0)};
|
|
54
|
+
con[0].slot = 0;
|
|
55
|
+
return 1;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// the 14x's collider dispatch: plane-ellipsoid here, every other pair collide.h's (t1 <= t2: the plane is geom 1)
|
|
59
|
+
template <class S, class P = double>
|
|
60
|
+
DN_HOST_DEVICE int collide14(PreContact<S>* con, P margin, int t1, const GeomPose<S>& g1, const P* size1, int t2,
|
|
61
|
+
const GeomPose<S>& g2, const P* size2) {
|
|
62
|
+
if (t2 == kGeomEllipsoid) {
|
|
63
|
+
JS_DEVICE_ASSERT(t1 == 0 && "the 14x's ellipsoids collide with the floor only (FLOOR_CONTACT_TABLE.md)");
|
|
64
|
+
return plane_ellipsoid<S, P>(con, margin, g1.p, zaxis(g1.R), g2.p, g2.R, size2);
|
|
65
|
+
}
|
|
66
|
+
return collide<S, P>(con, margin, t1, g1, size1, t2, g2, size2);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
} // namespace js::soft::x14
|