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,69 @@
|
|
|
1
|
+
"""D16 hand (core/soft/hand.h) from Python: the layout through the C ABI (soft_hand_layout), decode() into fields, and
|
|
2
|
+
expand() into the CPU law's dense rows, so a hand from k_pre (GPU) or from soft_hand (the CPU reference) can be compared with
|
|
3
|
+
rows.h. Integer words are stored bitwise (tape_format.words_u32)."""
|
|
4
|
+
import ctypes
|
|
5
|
+
|
|
6
|
+
import numpy as np
|
|
7
|
+
|
|
8
|
+
from diffneusim.engine.tape_format import tri_unpack, words_u32
|
|
9
|
+
|
|
10
|
+
KEYS = ("nv", "ntri", "nc", "nr", "kdof", "M", "qfrc", "qacc", "clamp", "counts", "min_nu", "conJ", "condof", "conmeta", "conmu",
|
|
11
|
+
"aref", "efcD", "rowmeta", "words")
|
|
12
|
+
NC, NR, KDOF = 64, 192, 16 # the G1's hand capacities, NablaEngine's MAXCON / NEFC for the mjlab G1 (k_post's shared fast path
|
|
13
|
+
# is 32 / 128 inside them); the corpora's largest world has 33 contacts and 118 rows
|
|
14
|
+
ROW_LIMIT, ROW_FRICTIONLESS, ROW_PYRAMIDAL = 1, 2, 3
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def layout(lib, nv, nc=NC, nr=NR, kdof=KDOF):
|
|
18
|
+
# the library's own count and names must equal KEYS (an entry inserted in the C array would otherwise shift every later
|
|
19
|
+
# index silently; the request after d5's crash, 2026-11-02)
|
|
20
|
+
getattr(lib, "soft_hand_layout_keys").restype = ctypes.c_char_p
|
|
21
|
+
n_lib, k_lib = int(getattr(lib, "soft_hand_layout_count")()), getattr(lib, "soft_hand_layout_keys")().decode()
|
|
22
|
+
assert n_lib == len(KEYS) and k_lib == ",".join(KEYS), (n_lib, len(KEYS), k_lib, ",".join(KEYS))
|
|
23
|
+
out = np.zeros(len(KEYS), np.int32)
|
|
24
|
+
lib.soft_hand_layout(nv, nc, nr, kdof, out.ctypes.data_as(ctypes.POINTER(ctypes.c_int)))
|
|
25
|
+
return dict(zip(KEYS, (int(x) for x in out)))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def decode(rec, h):
|
|
29
|
+
"""one record [words] -> dict of fields (the contact and row tables cut at ncon / nefc)"""
|
|
30
|
+
a = np.ascontiguousarray(rec)
|
|
31
|
+
assert a.shape == (h["words"],), (a.shape, h["words"])
|
|
32
|
+
u = words_u32(a).astype(np.int64)
|
|
33
|
+
nv, nc, nr, kd = h["nv"], h["nc"], h["nr"], h["kdof"]
|
|
34
|
+
ncon, nefc, nlim, ovf = (int(u[h["counts"] + k]) for k in range(4))
|
|
35
|
+
out = dict(M=tri_unpack(a[h["M"]:h["M"] + h["ntri"]], nv), qfrc_smooth=a[h["qfrc"]:h["qfrc"] + nv],
|
|
36
|
+
qacc_smooth=a[h["qacc"]:h["qacc"] + nv], ncon=ncon, nefc=nefc, nlim=nlim, overflow=ovf,
|
|
37
|
+
min_nu=a[h["min_nu"]])
|
|
38
|
+
cl = u[h["clamp"]] | (u[h["clamp"] + 1] << 32)
|
|
39
|
+
out["clamp"] = ((cl >> np.arange(nv)) & 1).astype(bool)
|
|
40
|
+
out["conJ"] = a[h["conJ"]:h["conJ"] + nc * 3 * kd].reshape(nc, 3, kd)[:ncon]
|
|
41
|
+
dw = u[h["condof"]:h["condof"] + (nc * kd + 3) // 4]
|
|
42
|
+
out["condof"] = ((dw[:, None] >> (8 * np.arange(4))) & 255).reshape(-1)[:nc * kd].reshape(nc, kd)[:ncon]
|
|
43
|
+
m = u[h["conmeta"]:h["conmeta"] + nc][:ncon]
|
|
44
|
+
out.update(con_pair=m & 511, con_slot=(m >> 9) & 7, con_condim=(m >> 12) & 3, con_row0=(m >> 16) & 255,
|
|
45
|
+
con_nd=(m >> 24) & 31, con_mu=a[h["conmu"]:h["conmu"] + ncon])
|
|
46
|
+
rm = u[h["rowmeta"]:h["rowmeta"] + nr][:nefc]
|
|
47
|
+
out.update(aref=a[h["aref"]:h["aref"] + nefc], D=a[h["efcD"]:h["efcD"] + nefc], row_type=rm & 3,
|
|
48
|
+
row_index=(rm >> 2) & 255, row_k=(rm >> 10) & 3, row_neg=((rm >> 12) & 1).astype(bool))
|
|
49
|
+
return out
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def expand(d, nv):
|
|
53
|
+
"""the dense J [nefc, nv] of a decoded hand (limits +-e_dof; contact rows Jn + s mu Jt(t), s = (+,-,+,-), t = (1,1,2,2))"""
|
|
54
|
+
J = np.zeros((d["nefc"], nv), d["conJ"].dtype if d["ncon"] else np.float64)
|
|
55
|
+
for r in range(d["nefc"]):
|
|
56
|
+
t, i = int(d["row_type"][r]), int(d["row_index"][r])
|
|
57
|
+
if t == ROW_LIMIT:
|
|
58
|
+
J[r, i] = -1.0 if d["row_neg"][r] else 1.0
|
|
59
|
+
continue
|
|
60
|
+
nd = int(d["con_nd"][i])
|
|
61
|
+
dofs = d["condof"][i, :nd]
|
|
62
|
+
cj = d["conJ"][i]
|
|
63
|
+
if t == ROW_FRICTIONLESS:
|
|
64
|
+
J[r, dofs] = cj[0, :nd]
|
|
65
|
+
else:
|
|
66
|
+
k = int(d["row_k"][r])
|
|
67
|
+
tt, s = (1 if k < 2 else 2), (1.0 if k % 2 == 0 else -1.0)
|
|
68
|
+
J[r, dofs] = cj[0, :nd] + (s * d["con_mu"][i]) * cj[tt, :nd]
|
|
69
|
+
return J
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"""The viewer's live simulation on the shipped CPU engine (core/cpu_engine: the GPU engine's own kernels through the fiber shim), labelled.
|
|
2
|
+
LiveSim14 has the interface the viewer drives (reset, set_pin, step, finite, q_np, act_np, contact_np and the attributes it reads) and runs a
|
|
3
|
+
shipped muscle body (models/BODIES.toml) on its paper build (the body's tag) and its muscle case, one 2 ms substep per step, u held between
|
|
4
|
+
steps.
|
|
5
|
+
- The start state is the viewer's pose, v = 0, warm 0, a = A0, and the fibres at k_mus_equil's equilibrium (8 rounds, as the training
|
|
6
|
+
env's reset).
|
|
7
|
+
- Precision: f32 (the production engine's) unless DN_VIEW_CPU_F64=1.
|
|
8
|
+
- Not wired: the contact-force arrows (ncon = 0 here) and PD actuators (the muscle bodies have none).
|
|
9
|
+
- The CPU engine library is built once per source or compiler change into $XDG_CACHE_HOME/diffneusim/cpu_engine (default
|
|
10
|
+
~/.cache/diffneusim; needs a C++ compiler, CXX)."""
|
|
11
|
+
import os
|
|
12
|
+
import re
|
|
13
|
+
import pathlib
|
|
14
|
+
import shutil
|
|
15
|
+
import subprocess
|
|
16
|
+
|
|
17
|
+
import numpy as np
|
|
18
|
+
|
|
19
|
+
from diffneusim._paths import ROOT
|
|
20
|
+
from diffneusim.model import body_info, body_of
|
|
21
|
+
from diffneusim.model.case import read_case
|
|
22
|
+
|
|
23
|
+
LABEL = "D16 engine on the CPU (the GPU kernels through the fiber shim)"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _body(dnmodel_path):
|
|
27
|
+
"""the shipped muscle body at this path, as (name, its BODIES.toml entry), or None"""
|
|
28
|
+
name = body_of(dnmodel_path) if dnmodel_path else None
|
|
29
|
+
if name is None:
|
|
30
|
+
return None
|
|
31
|
+
b = body_info(name)
|
|
32
|
+
return (name, b) if "tag" in b else None
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class LiveSim14:
|
|
36
|
+
A0 = 0.05 # the training env's baseline activation (GpuFullBodyVecEnv.A0)
|
|
37
|
+
fixed_dt = 0.002 # the law's substep: the viewer sets its sim dt to this
|
|
38
|
+
backend = "cpu-d16"
|
|
39
|
+
pd = None
|
|
40
|
+
|
|
41
|
+
@staticmethod
|
|
42
|
+
def accepts(dnmodel_path):
|
|
43
|
+
"""a shipped muscle body (models/BODIES.toml)"""
|
|
44
|
+
return _body(dnmodel_path) is not None
|
|
45
|
+
|
|
46
|
+
@staticmethod
|
|
47
|
+
def available(dnmodel_path):
|
|
48
|
+
b = _body(dnmodel_path)
|
|
49
|
+
return b is not None and (b[1]["case"] / "case.bin").exists() and shutil.which(os.environ.get("CXX", "c++")) is not None
|
|
50
|
+
|
|
51
|
+
def __init__(self, dnmodel_path, jm, q0_np):
|
|
52
|
+
hit = _body(dnmodel_path)
|
|
53
|
+
assert hit is not None, f"live14: {dnmodel_path} is not a shipped muscle body (models/BODIES.toml)"
|
|
54
|
+
name, b = hit
|
|
55
|
+
from diffneusim.engine import x14cpu
|
|
56
|
+
from diffneusim.engine import build_tag as BT
|
|
57
|
+
tag, case = b["tag"], b["case"]
|
|
58
|
+
header = ROOT / "core" / "soft" / "gpu" / "generated" / f"body_{tag}.cuh"
|
|
59
|
+
V = {k: int(v) for k, v in re.findall(r"^#define D16_BODY_(\w+) (\d+)\s*$", header.read_text(), re.M)}
|
|
60
|
+
self._quats = (3, V["BQ0"], V["BQ1"]) # the root's and the two balls' quaternion addresses (d16_body.QUATS)
|
|
61
|
+
flags = ["-DD16_X14_MILLARD"] if "law" in read_case(case) else []
|
|
62
|
+
CE = ROOT / "core" / "cpu_engine"
|
|
63
|
+
src = [CE / "x14_cpu.cpp", CE / "fiber" / "cuda_runtime.h", CE / "build.sh", header]
|
|
64
|
+
from diffneusim import _cache # the user's build cache (XDG_CACHE_HOME), never the package
|
|
65
|
+
out = _cache.root() / "cpu_engine" / BT.tag(ROOT, src, [tag] + flags + _cache.compiler(os.environ.get("CXX", "c++")))
|
|
66
|
+
lib = out / f"libx14cpu_{tag}.so"
|
|
67
|
+
if not lib.exists():
|
|
68
|
+
print(f"live14: building the CPU engine for {name} into {out} (once per source change)", flush=True)
|
|
69
|
+
subprocess.run(["bash", str(CE / "build.sh"), tag, str(out)] + flags, check=True, capture_output=True)
|
|
70
|
+
assert lib.exists(), lib
|
|
71
|
+
self.prec = 1 if os.environ.get("DN_VIEW_CPU_F64", "0") == "1" else 0
|
|
72
|
+
self.E = x14cpu.X14Cpu(lib, case, self.prec)
|
|
73
|
+
self.ft = self.E.ft
|
|
74
|
+
self.nq, self.nv, self.nm, self.ncon = self.E.nq, self.E.nv, self.E.nm, 0
|
|
75
|
+
assert (self.nq, self.nv) == (V["NQ"], V["NV"]), ((self.nq, self.nv), V["NQ"], V["NV"])
|
|
76
|
+
self.has_muscle = True
|
|
77
|
+
self.label = f"{LABEL}, {name}" + (" f64" if self.prec else " f32")
|
|
78
|
+
self.jm = jm
|
|
79
|
+
self.dt = self.fixed_dt
|
|
80
|
+
lo_case = np.asarray(self.E.keep[1], np.float64) # TABLE[1] = lopt, in the case's muscle order
|
|
81
|
+
from diffneusim.viz.dnrec_io import muscle_l_opts
|
|
82
|
+
lo_model = np.asarray(muscle_l_opts(jm), np.float64)
|
|
83
|
+
assert lo_model.shape == lo_case.shape and float(np.abs(lo_model - lo_case).max()) < 1e-6, "live14: the case's l_opt is not the model's (env14.install_equil14's check)"
|
|
84
|
+
self.l_opt = lo_case.astype(self.ft)
|
|
85
|
+
self.q0_np = np.array(q0_np, dtype=np.float64)
|
|
86
|
+
assert self.q0_np.shape == (self.nq,), f"live14: q0 has {self.q0_np.shape}, the engine nq {self.nq}"
|
|
87
|
+
self.excitation, self.excitation_vec, self.pin, self.n_steps = 0.0, None, None, 0
|
|
88
|
+
self.reset()
|
|
89
|
+
|
|
90
|
+
def _law_q(self, q):
|
|
91
|
+
"""env14.old_to_law's q: the root and the two ball quaternions normalized"""
|
|
92
|
+
q = np.array(q, dtype=np.float64)
|
|
93
|
+
for k in self._quats:
|
|
94
|
+
q[k:k + 4] = q[k:k + 4] / np.linalg.norm(q[k:k + 4])
|
|
95
|
+
return q
|
|
96
|
+
|
|
97
|
+
def reset(self):
|
|
98
|
+
self.n_steps = 0
|
|
99
|
+
self.q = self._law_q(self.q0_np).astype(self.ft).reshape(1, -1)
|
|
100
|
+
self.v = np.zeros((1, self.nv), self.ft)
|
|
101
|
+
self.w = np.zeros((1, self.nv), self.ft)
|
|
102
|
+
self.a = np.full((1, self.nm), self.A0, self.ft)
|
|
103
|
+
self._apply_pin()
|
|
104
|
+
n = int(os.environ.get("DN_VIEW_FIBER_INIT_ITERS", "8"))
|
|
105
|
+
seed = self.l_opt.reshape(1, -1).copy()
|
|
106
|
+
self.lce = self.E.equil(self.q, seed, self.a, outer=n) if n > 0 else seed
|
|
107
|
+
|
|
108
|
+
def set_pin(self, q_idx=None, q_val=None, v_idx=None):
|
|
109
|
+
"""as LiveSim.set_pin: hold coordinates kinematically and zero their velocity dofs (here in the law's chart; zero is zero in both)"""
|
|
110
|
+
if q_idx is None:
|
|
111
|
+
self.pin = None
|
|
112
|
+
return
|
|
113
|
+
qi, qv = np.asarray(q_idx, np.int64), np.asarray(q_val, np.float64)
|
|
114
|
+
vi = np.asarray(v_idx if v_idx is not None else [], np.int64)
|
|
115
|
+
assert qi.shape == qv.shape and (qi.size == 0 or (qi.min() >= 0 and qi.max() < self.nq)) and (vi.size == 0 or (vi.min() >= 0 and vi.max() < self.nv))
|
|
116
|
+
self.pin = dict(q_idx=qi, v_idx=vi, q_val=qv)
|
|
117
|
+
self._apply_pin()
|
|
118
|
+
|
|
119
|
+
def set_pd_targets(self, q_np):
|
|
120
|
+
raise AssertionError("live14: the muscle bodies have no PD actuators")
|
|
121
|
+
|
|
122
|
+
def _apply_pin(self):
|
|
123
|
+
p = self.pin
|
|
124
|
+
if p is None:
|
|
125
|
+
return
|
|
126
|
+
self.q[0, p["q_idx"]] = p["q_val"]
|
|
127
|
+
self.v[0, p["v_idx"]] = 0.0
|
|
128
|
+
|
|
129
|
+
def step(self, dt):
|
|
130
|
+
assert abs(dt - self.fixed_dt) < 1e-12, f"live14: the engine steps the law's {self.fixed_dt} s substep, the viewer asked {dt}"
|
|
131
|
+
if self.excitation_vec is not None:
|
|
132
|
+
u = np.clip(np.asarray(self.excitation_vec, np.float64).reshape(1, self.nm), 0.0, 1.0).astype(self.ft)
|
|
133
|
+
else:
|
|
134
|
+
u = np.full((1, self.nm), float(self.excitation), self.ft)
|
|
135
|
+
(self.q, self.v, self.w, self.lce, self.a), _, _ = self.E.run(self.q, self.v, self.w, self.lce, self.a, u, steps=1, nsub=1)
|
|
136
|
+
self._apply_pin()
|
|
137
|
+
self.n_steps += 1
|
|
138
|
+
|
|
139
|
+
def finite(self):
|
|
140
|
+
return bool(np.isfinite(self.q).all())
|
|
141
|
+
|
|
142
|
+
def q_np(self):
|
|
143
|
+
return np.asarray(self.q, np.float64).reshape(-1)
|
|
144
|
+
|
|
145
|
+
def act_np(self):
|
|
146
|
+
return np.asarray(self.a, np.float64).reshape(-1)
|
|
147
|
+
|
|
148
|
+
def contact_np(self):
|
|
149
|
+
return None
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"""Phase B's measured basis (2026-11-06; PHASE_B.md): the sparsity of M and of the Newton matrix H on a body's dof tree, and what eliminating the finger dofs onto a dense core costs.
|
|
2
|
+
From the law JSON only (no engine). M[i][j] != 0 exactly when dofs i and j both move one body (one is an ancestor of the other, coupled masters included), so a floor contact, whose Jacobian support is one body's chain, adds
|
|
3
|
+
nothing outside M's pattern; a self pair couples its two bodies' chains. The split: E = the dofs of the bodies below a wrist (a hand's bones and fingers), the core = the rest. The elimination is exact when no E dof is coupled
|
|
4
|
+
to an E dof of another chain and every E dof's off-chain coupling lands on its own core ancestors; then the core's Schur complement is dense of order |core| and E's factor has no fill.
|
|
5
|
+
What else enters a matrix the engine factors (core/soft/gpu/kp14.cuh, l3.cuh): kernel P's M is the tree's CRBA plus armature on the diagonal; k_post's H adds each active limit row's D
|
|
6
|
+
on its own dof's diagonal and each contact's J'DJ over its support; implicitfast's L_Q adds h kd on the diagonal. Muscles act as explicit torques (k_mus) and enter no factored matrix.
|
|
7
|
+
So the checks below also cover the review's three (11-06): equality couplings (expanded as master-driven joints: none may sit below a wrist or have a master in a finger chain), MuJoCo
|
|
8
|
+
tendons or equalities left in the expanded model (none may exist), and limit rows on finger dofs (each one dof, not coupled).
|
|
9
|
+
python tools/d16_bodies/phase_b_tree.py LAW.json [LAW.json ...]"""
|
|
10
|
+
import json
|
|
11
|
+
import sys
|
|
12
|
+
|
|
13
|
+
import numpy as np
|
|
14
|
+
|
|
15
|
+
NDOF = {"free": 6, "ball": 3, "hinge": 1, "slide": 1}
|
|
16
|
+
WRIST = ("lunate_r", "lunate_l")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def chains_of(L):
|
|
20
|
+
B = L["bodies"]
|
|
21
|
+
own = {}
|
|
22
|
+
for i, b in enumerate(B):
|
|
23
|
+
if b.get("dadr", -1) >= 0:
|
|
24
|
+
for k in range(NDOF[b["jtype"]]):
|
|
25
|
+
own.setdefault(b["dadr"] + k, i)
|
|
26
|
+
assert len(own) == L["nv"], (len(own), L["nv"])
|
|
27
|
+
|
|
28
|
+
def chain(i):
|
|
29
|
+
out = set()
|
|
30
|
+
while i > 0:
|
|
31
|
+
b = B[i]
|
|
32
|
+
if b.get("dadr", -1) >= 0:
|
|
33
|
+
out |= set(range(b["dadr"], b["dadr"] + NDOF[b["jtype"]]))
|
|
34
|
+
if b.get("master_dadr", -1) >= 0:
|
|
35
|
+
out.add(b["master_dadr"])
|
|
36
|
+
i = b["parent"]
|
|
37
|
+
return out
|
|
38
|
+
|
|
39
|
+
return B, own, [chain(i) for i in range(len(B))]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def below_wrist(B, i):
|
|
43
|
+
"""a hand bone or finger: a body below a wrist that is not itself a wrist body (the wrist's two hinges are two bodies named lunate)"""
|
|
44
|
+
if B[i]["name"] in WRIST:
|
|
45
|
+
return False
|
|
46
|
+
i = B[i]["parent"]
|
|
47
|
+
while i > 0:
|
|
48
|
+
if B[i]["name"] in WRIST:
|
|
49
|
+
return True
|
|
50
|
+
i = B[i]["parent"]
|
|
51
|
+
return False
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def symbolic(P, order):
|
|
55
|
+
A = P[np.ix_(order, order)].copy()
|
|
56
|
+
madds = 0
|
|
57
|
+
for k in range(len(order)):
|
|
58
|
+
rows = np.nonzero(A[k + 1:, k])[0] + k + 1
|
|
59
|
+
madds += len(rows) * (len(rows) + 1) // 2 + len(rows)
|
|
60
|
+
A[np.ix_(rows, rows)] = True
|
|
61
|
+
return int(np.tril(A).sum()), int(madds)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def main():
|
|
65
|
+
for path in sys.argv[1:]:
|
|
66
|
+
L = json.load(open(path))
|
|
67
|
+
nv = L["nv"]
|
|
68
|
+
B, own, ch = chains_of(L)
|
|
69
|
+
G = L["geoms"]
|
|
70
|
+
P = np.zeros((nv, nv), bool)
|
|
71
|
+
for c in ch:
|
|
72
|
+
c = sorted(c)
|
|
73
|
+
P[np.ix_(c, c)] = True
|
|
74
|
+
H = P.copy() # every pair active at once: the widest pattern the Newton matrix can take
|
|
75
|
+
for pr in L["pairs"]:
|
|
76
|
+
c = sorted(ch[G[pr["g1"]]["body"]] | ch[G[pr["g2"]]["body"]])
|
|
77
|
+
H[np.ix_(c, c)] = True
|
|
78
|
+
E = sorted(d for d in range(nv) if below_wrist(B, own[d]))
|
|
79
|
+
core = [d for d in range(nv) if d not in set(E)]
|
|
80
|
+
dense = nv * (nv + 1) // 2
|
|
81
|
+
print(f"== {path.split('/')[-1]}: nv {nv}, bodies {len(B)}, limits {len(L['limits'])}, pairs {len(L['pairs'])}")
|
|
82
|
+
print(f" M: {int(np.tril(P).sum())} of {dense} entries ({100 * np.tril(P).sum() / dense:.0f}%); H with every pair: {int(np.tril(H).sum())}")
|
|
83
|
+
for nm, X in (("M", P), ("H", H)):
|
|
84
|
+
d = symbolic(X, list(range(nv)))
|
|
85
|
+
r = symbolic(X, list(range(nv))[::-1])
|
|
86
|
+
print(f" {nm} factor, multiply-adds: dense order {d[1]} (nnz {d[0]}); leaves first {r[1]} (nnz {r[0]}, fill {r[0] - int(np.tril(X).sum())})")
|
|
87
|
+
if not E:
|
|
88
|
+
continue
|
|
89
|
+
# the split: E's rows and its coupling to the core
|
|
90
|
+
EE = H[np.ix_(E, E)]
|
|
91
|
+
groups = {}
|
|
92
|
+
for d in E: # E's chains: the bodies below each wrist's children (one per finger or thumb)
|
|
93
|
+
i = own[d]
|
|
94
|
+
while B[B[i]["parent"]]["name"] not in WRIST:
|
|
95
|
+
i = B[i]["parent"]
|
|
96
|
+
groups.setdefault(B[i]["name"], []).append(d)
|
|
97
|
+
cross = sum(int(H[np.ix_(a, b)].any()) for ga, a in groups.items() for gb, b in groups.items() if ga < gb)
|
|
98
|
+
anc = {g: sorted(set().union(*(set(core) & ch[own[d]] for d in ds))) for g, ds in groups.items()}
|
|
99
|
+
offchain = sum(int(H[d, c]) for g, ds in groups.items() for d in ds for c in core if c not in set(anc[g]))
|
|
100
|
+
ec = int(H[np.ix_(E, core)].sum())
|
|
101
|
+
# elimination of E onto the core, leaves first within each chain: E's own fill, and the Schur update of each chain's core ancestors
|
|
102
|
+
order = E[::-1] + core
|
|
103
|
+
n_e = len(E)
|
|
104
|
+
A = H[np.ix_(order, order)].copy()
|
|
105
|
+
madds_e = 0
|
|
106
|
+
for k in range(n_e):
|
|
107
|
+
rows = np.nonzero(A[k + 1:, k])[0] + k + 1
|
|
108
|
+
madds_e += len(rows) * (len(rows) + 1) // 2 + len(rows)
|
|
109
|
+
A[np.ix_(rows, rows)] = True
|
|
110
|
+
fill_e = int(np.tril(A[:n_e, :n_e]).sum()) - int(np.tril(EE).sum())
|
|
111
|
+
S = A[n_e:, n_e:]
|
|
112
|
+
nc = len(core)
|
|
113
|
+
core_dense = nc ** 3 // 6 + nc * nc // 2
|
|
114
|
+
store = int(np.tril(A[:n_e, :n_e]).sum()) + int(A[n_e:, :n_e].sum()) + nc * (nc + 1) // 2
|
|
115
|
+
print(f" split: E {n_e} dofs in {len(groups)} chains ({', '.join(f'{g} {len(v)}' for g, v in sorted(groups.items()))}), core {nc}")
|
|
116
|
+
print(f" exact: E-E coupling across chains {cross} (0 needed); E coupled off its chain's core ancestors {offchain} (0 needed); E's fill {fill_e}; core ancestors per chain {sorted({len(v) for v in anc.values()})}")
|
|
117
|
+
print(f" cost: E elimination {madds_e} multiply-adds, then the core's dense factor {core_dense} (order {nc}); total {madds_e + core_dense}; Schur complement dense: {bool(np.tril(S).all())}")
|
|
118
|
+
cb = [(i, b["master_dadr"]) for i, b in enumerate(B) if b.get("master_dadr", -1) >= 0]
|
|
119
|
+
cb_below = sum(1 for i, m in cb if below_wrist(B, i))
|
|
120
|
+
cb_master = sum(1 for i, m in cb if m in set(E))
|
|
121
|
+
fl = [l for l in L["limits"] if l["dof"] in set(E)]
|
|
122
|
+
fl_bad = sum(1 for l in fl if l["coupled"] or not isinstance(l["dof"], int))
|
|
123
|
+
import pathlib
|
|
124
|
+
import re
|
|
125
|
+
xml = pathlib.Path(path).parent / L["source"]["expanded_xml"]
|
|
126
|
+
X = xml.read_text()
|
|
127
|
+
n_eq = len(re.findall(r"<equality\b", X))
|
|
128
|
+
n_ten = len(re.findall(r"<tendon\b", X))
|
|
129
|
+
print(f" other terms: couplings {len(cb)}, below a wrist {cb_below}, master in a finger chain {cb_master} (0 needed); limits on finger dofs {len(fl)}, coupled or multi-dof {fl_bad} (0 needed); "
|
|
130
|
+
f"the expanded model's equality sections {n_eq}, tendon sections {n_ten} (0 needed)")
|
|
131
|
+
ok = cross == 0 and offchain == 0 and fill_e == 0 and cb_below == 0 and cb_master == 0 and fl_bad == 0 and n_eq == 0 and n_ten == 0
|
|
132
|
+
print(f" SPLIT {'EXACT' if ok else 'NOT EXACT'}")
|
|
133
|
+
print(f" storage: {store} words (E's rows {int(np.tril(A[:n_e, :n_e]).sum())}, E-core {int(A[n_e:, :n_e].sum())}, core {nc * (nc + 1) // 2}) against {dense} dense")
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
if __name__ == "__main__":
|
|
137
|
+
main()
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"""ctypes loader of bindings/soft14_capi.cpp (the 14x soft law's CPU f64 reference, core/soft/x14/law14.h) from the law JSON
|
|
2
|
+
tools/d16_14x/export_14x_law.py writes. Builds the library on first use when it is older than its sources."""
|
|
3
|
+
import ctypes
|
|
4
|
+
import json
|
|
5
|
+
import os
|
|
6
|
+
|
|
7
|
+
import numpy as np
|
|
8
|
+
|
|
9
|
+
from diffneusim._paths import ROOT as ROOT # (3a) the repo root
|
|
10
|
+
SRC = [ROOT / "bindings" / "soft14_capi.cpp"] + sorted((ROOT / "core" / "soft" / "x14").glob("*.h")) + sorted((ROOT / "core" / "soft").glob("*.h"))
|
|
11
|
+
EXTRA = os.environ.get("SOFT14_EXTRA", "").split()
|
|
12
|
+
LIB = None # set by build(): the library in the user's build cache (diffneusim._cache), never inside the package
|
|
13
|
+
# the contact set: X14_VARIANT=mm (the default since 2026-11-03: MuscleMimic's floor contacts, FLOOR_CONTACT_TABLE.md, gates in
|
|
14
|
+
# COMPOSED14.md) or e0 (the 10 foot spheres, CONTACT_PARAMS.md decision 1)
|
|
15
|
+
VARIANT = os.environ.get("X14_VARIANT", "mm")
|
|
16
|
+
assert VARIANT in ("mm", "e0"), f"X14_VARIANT={VARIANT!r}: mm or e0"
|
|
17
|
+
# (3a) was: sys.path.insert(0, str(ROOT / "tools" / "d16_bodies"))
|
|
18
|
+
from diffneusim.engine import d16_body as BODY # noqa: E402
|
|
19
|
+
LAW = BODY.LAW if BODY.TAG else ROOT / "models" / "derived" / ("e0_14x_soft_law_f1c2243ae6be449e" + ("_mmfloor" if VARIANT == "mm" else "") + ".json")
|
|
20
|
+
D = ctypes.POINTER(ctypes.c_double)
|
|
21
|
+
I = ctypes.POINTER(ctypes.c_int)
|
|
22
|
+
JT = {"world": -1, "free": 0, "ball": 1, "hinge": 3}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def build():
|
|
26
|
+
"""the library, built once per content tag (sources + flags + compiler) into the build cache"""
|
|
27
|
+
global LIB
|
|
28
|
+
if LIB is None:
|
|
29
|
+
from diffneusim import _cache
|
|
30
|
+
LIB = _cache.build_lib("build-soft", "libsoft14.so", SRC, ["c++", "-std=c++17", "-O2", "-fPIC", "-shared", "-pthread"] + EXTRA
|
|
31
|
+
+ ["-I", str(ROOT / "core"), "-I", str(ROOT / "core" / "include"), str(SRC[0])])
|
|
32
|
+
return LIB
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def p(a):
|
|
36
|
+
return a.ctypes.data_as(D if a.dtype == np.float64 else I)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class Soft14:
|
|
40
|
+
def __init__(self, law_path=LAW, iterations=None):
|
|
41
|
+
"""iterations: override the law's Newton cap (the truth setting for the cap study); None keeps the law's (4)"""
|
|
42
|
+
build()
|
|
43
|
+
self.lib = ctypes.CDLL(str(LIB))
|
|
44
|
+
self.lib.s14_new.restype = ctypes.c_void_p
|
|
45
|
+
self.L = L = json.load(open(law_path))
|
|
46
|
+
if iterations is not None:
|
|
47
|
+
L["opt"]["iterations"] = int(iterations)
|
|
48
|
+
B = L["bodies"]
|
|
49
|
+
self.nb, self.nq, self.nv = len(B), L["nq"], L["nv"]
|
|
50
|
+
bint = np.zeros((self.nb, 6), np.int32); bdbl = np.zeros((self.nb, 24))
|
|
51
|
+
for i, b in enumerate(B):
|
|
52
|
+
bint[i] = [b["parent"], JT[b["jtype"]], b["qadr"], b["dadr"], b.get("master_qadr", -1), b.get("master_dadr", -1)]
|
|
53
|
+
if i == 0:
|
|
54
|
+
bdbl[i, 7] = bdbl[i, 14] = 1.0
|
|
55
|
+
continue
|
|
56
|
+
bdbl[i] = [b.get("coef", 1.0), *b["axis"], *b["pos"], *b["quat"], *b["ipos"], *b["iquat"], *b["inertia_principal"], b["mass"],
|
|
57
|
+
*L["body_invweight0"][i]]
|
|
58
|
+
ent = [(d, e[0], e[1]) for d, lst in enumerate(L["dofs"]) for e in lst]
|
|
59
|
+
ei = np.array([[d, b] for d, b, _ in ent], np.int32); ec = np.array([c for _, _, c in ent])
|
|
60
|
+
arm = np.array(L["armature"]); damp = np.array(L["passive"]["damping"])
|
|
61
|
+
self.h = ctypes.c_void_p(self.lib.s14_new(self.nb, self.nq, self.nv, p(bint), p(bdbl), len(ent), p(ei), p(ec), p(arm), p(damp)))
|
|
62
|
+
G = L["geoms"]; gi = np.array([[g["body"], g["type"]] for g in G], np.int32); gd = np.array([[*g["size"], *g["pos"], *g["quat"]] for g in G])
|
|
63
|
+
P = L["pairs"]; pi_ = np.array([[x["g1"], x["g2"], x["condim"], -1] for x in P], np.int32)
|
|
64
|
+
pd = np.array([[*x["friction"][:3], *x["solref"], *x["solimp"], x["margin"], x["gap"]] for x in P])
|
|
65
|
+
Li = L["limits"]; li = np.array([[x["dof"], x["qadr"]] for x in Li], np.int32)
|
|
66
|
+
ld = np.array([[x["coef"], *x["range"], *x["solref"], *x["solimp"], x["margin"], x["diagA"], 0.0] for x in Li])
|
|
67
|
+
S = L["passive"]["coord_springs"]; si = np.array([[x["dof"], x["qadr"]] for x in S], np.int32); sd = np.array([[x["k"], x["rest"]] for x in S])
|
|
68
|
+
R = L["passive"]["ball_rom"]; ri = np.array([[x["qadr"], x["dadr"]] for x in R], np.int32)
|
|
69
|
+
rd = np.array([[*[r[0] for r in x["range"]], *[r[1] for r in x["range"]], *x["d_lim"], x["exp_a"], x["exp_w"], x["beta"]] for x in R])
|
|
70
|
+
o = L["opt"]; od = np.array([*o["gravity"], o["timestep"], o["impratio"], o["tolerance"], o["ls_tolerance"]])
|
|
71
|
+
oi = np.array([o["iterations"], o["ls_iterations"], o["nsub"]], np.int32)
|
|
72
|
+
self._keep = [bint, bdbl, ei, ec, arm, damp, gi, gd, pi_, pd, li, ld, si, sd, ri, rd, od, oi]
|
|
73
|
+
self.lib.s14_law(self.h, len(G), p(gi), p(gd), len(P), p(pi_), p(pd), len(Li), p(li), p(ld), len(S), p(si), p(sd), len(R), p(ri), p(rd), p(od), p(oi))
|
|
74
|
+
|
|
75
|
+
def smooth(self, q, v, tau=None):
|
|
76
|
+
nb, nv = self.nb, self.nv
|
|
77
|
+
out = dict(xpos=np.zeros((nb, 3)), xquat=np.zeros((nb, 4)), xipos=np.zeros((nb, 3)), M=np.zeros((nv, nv)), bias=np.zeros(nv),
|
|
78
|
+
passive=np.zeros(nv), qfrc_smooth=np.zeros(nv), qacc_smooth=np.zeros(nv))
|
|
79
|
+
q, v = np.ascontiguousarray(q, np.float64), np.ascontiguousarray(v, np.float64)
|
|
80
|
+
t = None if tau is None else p(np.ascontiguousarray(tau, np.float64))
|
|
81
|
+
self.lib.s14_smooth(self.h, p(q), p(v), t, *[p(out[k]) for k in ("xpos", "xquat", "xipos", "M", "bias", "passive", "qfrc_smooth", "qacc_smooth")])
|
|
82
|
+
return out
|
|
83
|
+
|
|
84
|
+
def rows(self, q, v, cap=512):
|
|
85
|
+
nv = self.nv
|
|
86
|
+
a = dict(type=np.zeros(cap, np.int32), id=np.zeros(cap, np.int32), J=np.zeros((cap, nv)), pos=np.zeros(cap), margin=np.zeros(cap),
|
|
87
|
+
diagA=np.zeros(cap), aref=np.zeros(cap), R=np.zeros(cap), D=np.zeros(cap))
|
|
88
|
+
nc = np.zeros(1, np.int32); ci = np.zeros((cap, 3), np.int32); cd = np.zeros((cap, 13))
|
|
89
|
+
q, v = np.ascontiguousarray(q, np.float64), np.ascontiguousarray(v, np.float64)
|
|
90
|
+
n = self.lib.s14_rows(self.h, p(q), p(v), ctypes.c_double(-1.0), cap, p(a["type"]), p(a["id"]), p(a["J"]), p(a["pos"]), p(a["margin"]),
|
|
91
|
+
p(a["diagA"]), p(a["aref"]), p(a["R"]), p(a["D"]), p(nc), p(ci), p(cd))
|
|
92
|
+
assert n >= 0, "over cap"
|
|
93
|
+
r = {k: x[:n] for k, x in a.items()}
|
|
94
|
+
k = int(nc[0])
|
|
95
|
+
r["con"] = dict(pair=ci[:k, 0], slot=ci[:k, 1], condim=ci[:k, 2], dist=cd[:k, 0], pos=cd[:k, 1:4], frame=cd[:k, 4:13].reshape(k, 3, 3))
|
|
96
|
+
return r
|
|
97
|
+
|
|
98
|
+
def hand_words(self, nc=64, nr=255, kdof=16):
|
|
99
|
+
return int(self.lib.s14_hand_words(self.nv, nc, nr, kdof))
|
|
100
|
+
|
|
101
|
+
def hand_batch(self, q, v, tau=None, fric=None, nc=64, nr=255, kdof=16, nthreads=8):
|
|
102
|
+
"""the CPU 14x hand records [n, words] (f64) of n states (law convention)"""
|
|
103
|
+
q, v = np.ascontiguousarray(q, np.float64), np.ascontiguousarray(v, np.float64)
|
|
104
|
+
n = len(q)
|
|
105
|
+
fr = np.full(n, -1.0) if fric is None else np.ascontiguousarray(fric, np.float64)
|
|
106
|
+
out = np.zeros((n, self.hand_words(nc, nr, kdof)))
|
|
107
|
+
t = None if tau is None else p(np.ascontiguousarray(tau, np.float64))
|
|
108
|
+
self.lib.s14_hand_batch(self.h, n, p(q), p(v), t, p(fr), nc, nr, kdof, p(out), nthreads)
|
|
109
|
+
return out
|
|
110
|
+
|
|
111
|
+
def substep(self, q, v, w, tau=None, fric=-1.0):
|
|
112
|
+
q1, v1, w1, st = np.zeros(self.nq), np.zeros(self.nv), np.zeros(self.nv), np.zeros(6, np.int32)
|
|
113
|
+
q, v, w = (np.ascontiguousarray(x, np.float64) for x in (q, v, w))
|
|
114
|
+
t = None if tau is None else p(np.ascontiguousarray(tau, np.float64))
|
|
115
|
+
self.lib.soft_substep(self.h, p(q), p(v), p(w), t, ctypes.c_double(fric), p(q1), p(v1), p(w1), p(st))
|
|
116
|
+
return q1, v1, w1, st
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def from_old_engine(q, qd):
|
|
120
|
+
"""the old engine's 14x state (core/dyn/articulated.h:70-81: qd[0:3] = root w, qd[3:6] = root v, both in the body frame) to the
|
|
121
|
+
law's MuJoCo convention (qvel[0:3] = root v in the world frame, qvel[3:6] = root w in the body frame). q is the same layout
|
|
122
|
+
(root position, quaternion wxyz, coordinates); ball qd is the child frame's w in both."""
|
|
123
|
+
q = np.asarray(q, np.float64).copy(); qd = np.asarray(qd, np.float64)
|
|
124
|
+
w, x, y, z = q[3:7] / np.linalg.norm(q[3:7])
|
|
125
|
+
R = np.array([[1 - 2 * (y * y + z * z), 2 * (x * y - w * z), 2 * (x * z + w * y)], [2 * (x * y + w * z), 1 - 2 * (x * x + z * z), 2 * (y * z - w * x)],
|
|
126
|
+
[2 * (x * z - w * y), 2 * (y * z + w * x), 1 - 2 * (x * x + y * y)]])
|
|
127
|
+
v = qd.copy()
|
|
128
|
+
v[0:3] = R @ qd[3:6]
|
|
129
|
+
v[3:6] = qd[0:3]
|
|
130
|
+
return q, v
|