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,175 @@
|
|
|
1
|
+
"""The latent skill model's downstream task (P3): heading and speed commands for a high-level policy that drives the
|
|
2
|
+
FROZEN latent decoder. docs/training/campaigns/fullbody/latent-skill-model.md, "P3 implementation".
|
|
3
|
+
|
|
4
|
+
The task is MuscleVAE's (Feng et al. 2023, arXiv:2312.07340, App. B.3, eq. 45), taken over from ControlVAE (Yao et
|
|
5
|
+
al. 2022, arXiv:2210.06063, Sec. 4.3, eq. 25), "the heading control task":
|
|
6
|
+
|
|
7
|
+
L_g = w_theta |theta* - theta| + w_v |v* - v| / max(v*, 1), w_theta = 2.0, w_v = 1.0
|
|
8
|
+
|
|
9
|
+
theta* in [-pi, pi], v* in [0, 3] m/s. ControlVAE: "We compute theta_h according to the orientation of the character's
|
|
10
|
+
root and v as the component of the root's velocity along this direction", the target direction (its released
|
|
11
|
+
PlayGround/joystick_playground.py get_loss projects onto the target direction as well). Here theta is the root's yaw
|
|
12
|
+
(the ZYX heading DnModelMonitor.yaw_quat divides out, the steering line's `_tw_root_yaw` on feat/steer), the heading
|
|
13
|
+
difference is wrapped to [-pi, pi], and v is the root's horizontal world velocity dotted with (cos theta*, sin theta*).
|
|
14
|
+
|
|
15
|
+
THE COMMAND. Drawn per env at every reset and again every CMD_PERIOD seconds: ControlVAE Sec. 4.2, "the corresponding
|
|
16
|
+
goal parameters g changing randomly every 72 steps" at its 20 Hz control rate, i.e. 3.6 s (its released config switches
|
|
17
|
+
every 96 frames, 4.8 s; MuscleVAE states no period). The heading is uniform in [-pi, pi) in the world, the speed
|
|
18
|
+
uniform in [V_LO, V_HI] (the papers' text ranges; both released playgrounds draw the speed from the set {0, 0, 1, 2, 3}).
|
|
19
|
+
The steering line's DeepLoco plan generator (a N(0, 0.25^2) heading step every 0.5 s, 10 % sharp turns) is a different
|
|
20
|
+
task and lives only on feat/steer.
|
|
21
|
+
|
|
22
|
+
THE OBSERVATION (the command relative to the current heading), the released code's target2n_target:
|
|
23
|
+
[v*, cos(theta* - theta), sin(theta* - theta)]. It reads the root yaw IN THE GRAPH, as every other observation is: the
|
|
24
|
+
steering line measured that a detached heading observation cuts the path by which turning the body changes the error
|
|
25
|
+
(feat/steer 3894f120, TASKWALK_HEADING_OBS_COUPLED).
|
|
26
|
+
|
|
27
|
+
THE FALL PRICE. The papers roll out a learned world model for a fixed horizon with no termination and price a fall by
|
|
28
|
+
L_fall = max(h* - h_root, 0), h* = 0.5 m (ControlVAE eq. 23). This env TERMINATES a fall (the body has contact spheres on
|
|
29
|
+
the feet only) and SAPO values the state after a fall at 0. With a reward of -L_g <= 0 a fall would then END a stream of
|
|
30
|
+
costs, i.e. pay, so the reward carries a per-step survival constant: r = ALIVE - L_g. It is a required knob with no
|
|
31
|
+
default (DN_LATENT_TASK_ALIVE): no source gives its value. `alive_bound` is the smallest constant that keeps every
|
|
32
|
+
step's reward >= 0 while the body moves no faster than V_HI, so that no state is worth falling from.
|
|
33
|
+
|
|
34
|
+
EVAL (DN_LATENT_TASK_SCHEDULE="t0:deg0:v0,t1:deg1:v1,..."): from t_i seconds after the reset the command is deg_i
|
|
35
|
+
degrees left of the heading the episode started with, at v_i m/s (t0 = 0; piecewise constant), as the steering line's
|
|
36
|
+
schedule mode. No random redraw then.
|
|
37
|
+
|
|
38
|
+
Pure tensor ops, no host sync in reset / advance / obs / reward."""
|
|
39
|
+
import math
|
|
40
|
+
|
|
41
|
+
import torch
|
|
42
|
+
|
|
43
|
+
from diffneusim.model.monitor import _quat_rotate
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def root_yaw(q):
|
|
47
|
+
"""(n,) world yaw of the root quaternion q[3:7] (w, x, y, z): the ZYX heading DnModelMonitor.yaw_quat divides out."""
|
|
48
|
+
w, x, y, z = q[3], q[4], q[5], q[6]
|
|
49
|
+
return torch.atan2(2.0 * (w * z + x * y), 1.0 - 2.0 * (y * y + z * z))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def wrap_angle(a):
|
|
53
|
+
"""a wrapped to [-pi, pi]; differentiable (d/da = 1) away from the cut at +-pi."""
|
|
54
|
+
return torch.atan2(torch.sin(a), torch.cos(a))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def heading_speed_loss(q, qd, heading, speed, w_heading, w_speed):
|
|
58
|
+
"""MuscleVAE eq. 45 per env, and its parts: (L_g, |theta* - theta| wrapped, |v* - v|, v). q (nq, n), qd (nv, n);
|
|
59
|
+
the root's linear velocity qd[3:6] is in the root frame, so R(q_root) maps it to the world."""
|
|
60
|
+
err = wrap_angle(heading - root_yaw(q)).abs()
|
|
61
|
+
v_world = _quat_rotate(q[3:7], qd[3:6])
|
|
62
|
+
v = v_world[0] * torch.cos(heading) + v_world[1] * torch.sin(heading)
|
|
63
|
+
dv = (speed - v).abs()
|
|
64
|
+
return w_heading * err + w_speed * dv / speed.clamp_min(1.0), err, dv, v
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def alive_bound(w_heading, w_speed, v_hi):
|
|
68
|
+
"""The largest L_g over targets v* in [0, v_hi] and root speeds |v| <= v_hi. The heading term is at most w_heading pi;
|
|
69
|
+
the speed term at most (v* + v_hi) / max(v*, 1), which rises on v* <= 1 and falls beyond, so its largest value is
|
|
70
|
+
1 + v_hi at v* = 1 when v_hi >= 1, and 2 v_hi at v* = v_hi otherwise."""
|
|
71
|
+
s = 1.0 + v_hi if v_hi >= 1.0 else 2.0 * v_hi
|
|
72
|
+
return w_heading * math.pi + w_speed * s
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def parse_schedule(raw, device):
|
|
76
|
+
"""'t0:deg0:v0,t1:deg1:v1,...' -> (t (k,), heading offset in rad (k,), speed (k,)) tensors; t0 = 0, t increasing."""
|
|
77
|
+
pts = [tuple(float(v) for v in p.split(":")) for p in raw.split(",") if p.strip()]
|
|
78
|
+
assert pts and all(len(p) == 3 for p in pts), f"schedule {raw!r}: comma-separated t:deg:v triples"
|
|
79
|
+
assert pts[0][0] == 0.0, f"schedule {raw!r}: the first time must be 0"
|
|
80
|
+
assert all(b[0] > a[0] for a, b in zip(pts, pts[1:])), f"schedule {raw!r}: times must increase"
|
|
81
|
+
assert all(p[2] >= 0.0 for p in pts), f"schedule {raw!r}: speeds must be >= 0"
|
|
82
|
+
return (torch.tensor([p[0] for p in pts], device=device),
|
|
83
|
+
torch.tensor([math.radians(p[1]) for p in pts], device=device),
|
|
84
|
+
torch.tensor([p[2] for p in pts], device=device))
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class HeadingSpeedTask:
|
|
88
|
+
"""The command state of `num_envs` envs and the task's reward and observation (module doc). The env owns one, calls
|
|
89
|
+
reset(env_ids, q) after a reset pose is in place, reward(q, qd) after the physics, then advance(), then obs(q)."""
|
|
90
|
+
|
|
91
|
+
def __init__(self, num_envs, device, rng, control_dt, alive, w_heading=2.0, w_speed=1.0, v_lo=0.0, v_hi=3.0,
|
|
92
|
+
period=3.6, schedule=None):
|
|
93
|
+
assert control_dt > 0.0 and period > 0.0, (control_dt, period)
|
|
94
|
+
assert 0.0 <= v_lo <= v_hi, (v_lo, v_hi)
|
|
95
|
+
assert w_heading >= 0.0 and w_speed >= 0.0, (w_heading, w_speed)
|
|
96
|
+
self.n, self.device, self.rng, self.dt = int(num_envs), torch.device(device), rng, float(control_dt)
|
|
97
|
+
self.alive, self.w_heading, self.w_speed = float(alive), float(w_heading), float(w_speed)
|
|
98
|
+
self.v_lo, self.v_hi, self.period = float(v_lo), float(v_hi), float(period)
|
|
99
|
+
n = self.n
|
|
100
|
+
self.heading = torch.zeros(n, device=self.device) # the commanded world yaw (rad)
|
|
101
|
+
self.speed = torch.zeros(n, device=self.device) # the commanded speed along it (m/s)
|
|
102
|
+
self.t = torch.zeros(n, device=self.device) # seconds since the reset
|
|
103
|
+
self.t_draw = torch.zeros(n, device=self.device) # seconds since the last random draw
|
|
104
|
+
self.yaw0 = torch.zeros(n, device=self.device) # the root yaw at the reset (schedule mode)
|
|
105
|
+
self.schedule = None
|
|
106
|
+
if schedule:
|
|
107
|
+
self.set_schedule(schedule)
|
|
108
|
+
# window statistics (sum |dtheta|, sum |dv|, sum L_g, count), accumulated on the device; pop_stats reads them
|
|
109
|
+
self._acc = torch.zeros(4, device=self.device)
|
|
110
|
+
|
|
111
|
+
def set_schedule(self, raw):
|
|
112
|
+
"""Eval: replace the random redraw by the schedule `raw` (module doc); None restores the random commands."""
|
|
113
|
+
self.schedule = None if raw is None else parse_schedule(raw, self.device)
|
|
114
|
+
|
|
115
|
+
def _draw(self, m):
|
|
116
|
+
h = (2.0 * torch.rand(m, generator=self.rng, device=self.device) - 1.0) * math.pi
|
|
117
|
+
v = self.v_lo + (self.v_hi - self.v_lo) * torch.rand(m, generator=self.rng, device=self.device)
|
|
118
|
+
return h, v
|
|
119
|
+
|
|
120
|
+
def _scheduled(self, t, yaw0):
|
|
121
|
+
ts, dh, vs = self.schedule
|
|
122
|
+
i = (torch.searchsorted(ts, t.contiguous(), right=True) - 1).clamp_min(0)
|
|
123
|
+
return wrap_angle(yaw0 + dh[i]), vs[i]
|
|
124
|
+
|
|
125
|
+
@torch.no_grad()
|
|
126
|
+
def reset(self, env_ids, q):
|
|
127
|
+
"""New commands for the restarting envs `env_ids`; q (nq, n) already holds their reset pose."""
|
|
128
|
+
m = len(env_ids)
|
|
129
|
+
y0 = root_yaw(q[:, env_ids].detach())
|
|
130
|
+
self.yaw0 = self.yaw0.clone(); self.yaw0[env_ids] = y0
|
|
131
|
+
self.t = self.t.clone(); self.t[env_ids] = 0.0
|
|
132
|
+
self.t_draw = self.t_draw.clone(); self.t_draw[env_ids] = 0.0
|
|
133
|
+
if self.schedule is None:
|
|
134
|
+
h, v = self._draw(m)
|
|
135
|
+
else:
|
|
136
|
+
h, v = self._scheduled(torch.zeros(m, device=self.device), y0)
|
|
137
|
+
self.heading = self.heading.clone(); self.heading[env_ids] = h
|
|
138
|
+
self.speed = self.speed.clone(); self.speed[env_ids] = v
|
|
139
|
+
|
|
140
|
+
@torch.no_grad()
|
|
141
|
+
def advance(self):
|
|
142
|
+
"""One control step of the command clock: the command for the NEXT step (the reward of this step read the old
|
|
143
|
+
one, the one its action was chosen under). Random mode redraws every env whose CMD_PERIOD has run out."""
|
|
144
|
+
self.t = self.t + self.dt
|
|
145
|
+
self.t_draw = self.t_draw + self.dt
|
|
146
|
+
if self.schedule is None:
|
|
147
|
+
due = self.t_draw >= self.period - 1e-6
|
|
148
|
+
h, v = self._draw(self.n)
|
|
149
|
+
self.heading = torch.where(due, h, self.heading)
|
|
150
|
+
self.speed = torch.where(due, v, self.speed)
|
|
151
|
+
self.t_draw = torch.where(due, torch.zeros_like(self.t_draw), self.t_draw)
|
|
152
|
+
else:
|
|
153
|
+
self.heading, self.speed = self._scheduled(self.t, self.yaw0)
|
|
154
|
+
|
|
155
|
+
def obs(self, q):
|
|
156
|
+
"""(n, 3) [v*, cos(theta* - theta), sin(theta* - theta)], theta = the root yaw of q, in the graph."""
|
|
157
|
+
d = self.heading - root_yaw(q)
|
|
158
|
+
return torch.stack([self.speed, torch.cos(d), torch.sin(d)], 1).to(q.dtype)
|
|
159
|
+
|
|
160
|
+
def reward(self, q, qd):
|
|
161
|
+
"""(n,) ALIVE - L_g at the post-step state, in the graph; accumulates the window statistics (no sync)."""
|
|
162
|
+
L, err, dv, _ = heading_speed_loss(q, qd, self.heading, self.speed, self.w_heading, self.w_speed)
|
|
163
|
+
with torch.no_grad():
|
|
164
|
+
fin = torch.isfinite(L)
|
|
165
|
+
z = torch.zeros_like(L)
|
|
166
|
+
self._acc = self._acc + torch.stack([torch.where(fin, err, z).sum(), torch.where(fin, dv, z).sum(),
|
|
167
|
+
torch.where(fin, L, z).sum(), fin.sum().to(L.dtype)])
|
|
168
|
+
return self.alive - L
|
|
169
|
+
|
|
170
|
+
def pop_stats(self):
|
|
171
|
+
"""Window means since the last call {heading_err_deg, speed_err, L_g} (one host read), and reset them."""
|
|
172
|
+
s = self._acc.tolist()
|
|
173
|
+
self._acc = torch.zeros_like(self._acc)
|
|
174
|
+
c = max(s[3], 1.0)
|
|
175
|
+
return {"heading_err_deg": math.degrees(s[0] / c), "speed_err": s[1] / c, "L_g": s[2] / c}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
"""DeepLoco's low-level-controller reward (Peng et al. 2017), for the footstep task's imitation arm (TASKWALK_LLC=1).
|
|
2
|
+
|
|
3
|
+
A port of the released code's cScenarioExpImitateStep::CalcRewardStep (github.com/xbpeng/DeepLoco 518f502,
|
|
4
|
+
scenarios/ScenarioExpImitateStep.cpp), every weight and scale from it, with its joint weights from
|
|
5
|
+
cScenarioExpImitate::CalcJointWeights (each joint's DiffWeight in data/characters/biped3d_mocap.txt, L1-normalised):
|
|
6
|
+
|
|
7
|
+
r = (0.5 exp(-2 E_pose) + 0.05 exp(-0.005 E_vel) + 0.2 exp(-5 E_ee) + 0.1 exp(-10 E_root) + 0.1 exp(-10 E_com)
|
|
8
|
+
+ 0.1 ((cos e + 1) / 2)^4) / 1.05, in [0, 1]; 0 on a fallen step (HasFallen, which includes a step fail)
|
|
9
|
+
|
|
10
|
+
E_pose sum_j w_j e_j over the joints, the root's rotation included, both poses heading-normalised (NormalizePoseHeading);
|
|
11
|
+
e_j the squared rotation angle (CalcPoseErr)
|
|
12
|
+
E_vel the same over the joint velocities (CalcVelErr; the root's angular velocity included)
|
|
13
|
+
E_ee the end effectors relative to the root against the reference's, x 2 / n_ee, plus the swing foot's squared distance
|
|
14
|
+
to its target in the step's second half: FootstepPlan.reward with the env's TASKWALK_STEP_EE is exactly that kernel
|
|
15
|
+
E_root the root's height above the ground against the reference's, squared (the root velocity part is multiplied by 0)
|
|
16
|
+
E_com 0.1 |v_COM - v_COM,ref|^2
|
|
17
|
+
e the plan heading against the character's heading
|
|
18
|
+
|
|
19
|
+
DeepLoco's biped has 8 joints; this body's joints map onto them by region (joint_groups): root (the pelvis orientation) 1.0,
|
|
20
|
+
torso (lumbar5's three hinges) 0.5, each hip (ball) 0.5, each knee 0.3, each ankle 0.2, where DeepLoco's spherical ankle is
|
|
21
|
+
this model's ankle + subtalar + mtp hinges together (the foot's orientation and its toe; DeepLoco's foot has no toe). Every
|
|
22
|
+
moving joint is in exactly one group (asserted), so none is tracked twice or silently dropped.
|
|
23
|
+
|
|
24
|
+
The torso: this model's lumbar5 hinges drive a coupled spine (lumbar4..1 at 1.48-2.04x in flexion), so the torso turns ~8x
|
|
25
|
+
their angle. Its error is the torso body's orientation against the root, as DeepLoco's spherical torso joint is (torso_chain);
|
|
26
|
+
until 2026-10-24 15:xx the hinge angles were compared directly, which priced the torso ~1/64 of that, and a 33-deg stoop cost
|
|
27
|
+
0.15% of the pose term (llccold, docs-dev/deeploco/20261024_0930_llc_cold).
|
|
28
|
+
|
|
29
|
+
The arms (a body with them, 14x): DeepLoco's biped has none. DeepMimic's humanoid3d (Peng et al. 2018, the same CalcPoseErr /
|
|
30
|
+
CalcVelErr and CalcJointWeights; github.com/xbpeng/DeepMimic data/characters/humanoid3d.txt) carries biped3d's weights unchanged
|
|
31
|
+
(root 1, chest 0.5, hips 0.5, knees 0.3, ankles 0.2) and adds each shoulder (spherical, child of the chest) 0.3, each elbow
|
|
32
|
+
(revolute) 0.2 and a fixed wrist (0); those are the weights here (arm_frames). This arm's girdle master drives the clavicle, the
|
|
33
|
+
scapula and the shoulder elevation (coefficients up to -4.13), so its hinge angles underprice the arm as lumbar5's did the torso:
|
|
34
|
+
the shoulder's error is the humerus body's rotation against the torso body (to which the thorax the girdle hangs from is rigidly
|
|
35
|
+
attached), and its rate the three shoulder masters' own rates (the monitor's rate assembly refuses a coupled chain; the velocity
|
|
36
|
+
term is 0.05 of the reward). The elbow is its flexion hinge. The forearm's pronation (no such joint in humanoid3d) and the wrist
|
|
37
|
+
(fixed there) take 0. An armless body (14t) gets exactly the groups it had.
|
|
38
|
+
|
|
39
|
+
Where this differs, and why:
|
|
40
|
+
- the heights are measured above the LOWER CALCANEUS ORIGIN on both sides (root_height_above_feet), not above the ground:
|
|
41
|
+
the retargeted step clips are not re-grounded (their root heights span 0.887-0.935 m), so a ground reference would carry a
|
|
42
|
+
per-clip offset; the same definition on both sides keeps the comparison a pose comparison;
|
|
43
|
+
- the COM velocity is compared in each side's own heading frame. DeepLoco compares world vectors after re-anchoring the
|
|
44
|
+
kinematic character to the simulated root at each step's start (UpdateNewStep); within a step the two differ by the turn
|
|
45
|
+
the body makes, which is small at 30 Hz but not zero;
|
|
46
|
+
- the reference velocities are TIME-WARPED: each step clip is played over the plan's nominal step time L / v (step_library.py),
|
|
47
|
+
so its joint and COM velocities scale by (the clip's own duration) / (its play time), as DeepLoco's 0.5-s clock warps its
|
|
48
|
+
clips;
|
|
49
|
+
- the scale: the env multiplies r by TASKWALK_LLC_SCALE (DeepLoco's own reward is in [0, 1]; ours sets SAPO's step size);
|
|
50
|
+
- the end-effector term is horizontal (step_library.py says why) and pays 0 while the footstep plan is provisional (the
|
|
51
|
+
footstep plan's guard); until the first plan exists the pose terms track the reset clip, as DeepLoco's kinematic character
|
|
52
|
+
plays its walk (biped3d_walk) from the random reset time until the step controller takes over.
|
|
53
|
+
"""
|
|
54
|
+
import torch
|
|
55
|
+
|
|
56
|
+
TERM_W = {"pose": 0.5, "vel": 0.05, "ee": 0.2, "root": 0.1, "com": 0.1, "heading": 0.1} # CalcRewardStep
|
|
57
|
+
TERM_SCALE = {"pose": 2.0, "vel": 0.005, "ee": 5.0, "root": 10.0, "com": 10.0}
|
|
58
|
+
COM_ERR_FACTOR = 0.1 # com_err = 0.1 |dv|^2
|
|
59
|
+
# biped3d_mocap.txt DiffWeight: root 1, torso 0.5, hips 0.5, knees 0.3, ankles 0.2 (sum 3.5), L1-normalised by CalcJointWeights;
|
|
60
|
+
# humanoid3d.txt adds shoulder 0.3, elbow 0.2, wrist 0 (fixed); the forearm's pronation has no humanoid3d joint, so 0
|
|
61
|
+
REGION_W = {"root": 1.0, "torso": 0.5, "hip": 0.5, "knee": 0.3, "ankle": 0.2, "shoulder": 0.3, "elbow": 0.2, "forearm": 0.0,
|
|
62
|
+
"wrist": 0.0}
|
|
63
|
+
REGION_BODIES = {"torso": ("lumbar5",), "hip_r": ("femur_r",), "knee_r": ("tibia_r",), "ankle_r": ("talus_r", "calcn_r", "toes_r"),
|
|
64
|
+
"hip_l": ("femur_l",), "knee_l": ("tibia_l",), "ankle_l": ("talus_l", "calcn_l", "toes_l")}
|
|
65
|
+
ARM_REGION_BODIES = {f"{r}_{s}": tuple(f"{b}_{s}" for b in bs) for s in ("r", "l")
|
|
66
|
+
for r, bs in (("shoulder", ("clavicle", "humphant", "humerus")), ("elbow", ("ulna",)),
|
|
67
|
+
("forearm", ("radius",)), ("wrist", ("lunate",)))}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def joint_groups(jm):
|
|
71
|
+
"""[(name, kind, q index list, v index list, normalised weight)] for the dnmodel's moving joints, by DeepLoco's regions.
|
|
72
|
+
kind: 'root' (the free joint's quaternion, its angular velocity), 'ball' (a 4-wide quaternion, 3 rates), 'scalar' (hinges),
|
|
73
|
+
'chain' (the torso: hinges that drive a coupled spine, compared through the torso body; torso_chain), 'body' (a shoulder:
|
|
74
|
+
compared through the humerus body, arm_frames). The arm regions enter only on a body whose arms move; a 0-weight group
|
|
75
|
+
(the forearm's pronation, the wrist) is covered by the assert and then dropped."""
|
|
76
|
+
bodies = jm["bodies"]
|
|
77
|
+
free = [b for b in bodies if b.get("joint") == "free"]
|
|
78
|
+
assert len(free) == 1, f"one free root expected, found {len(free)}"
|
|
79
|
+
root = free[0]
|
|
80
|
+
groups = [("root", "root", list(range(int(root["qadr"]) + 3, int(root["qadr"]) + 7)),
|
|
81
|
+
list(range(int(root["vadr"]), int(root["vadr"]) + 3)), REGION_W["root"])]
|
|
82
|
+
covered = set()
|
|
83
|
+
regions = dict(REGION_BODIES)
|
|
84
|
+
if any(_moving(b) and b.get("name") in {n for ns in ARM_REGION_BODIES.values() for n in ns} for b in bodies):
|
|
85
|
+
regions.update(ARM_REGION_BODIES)
|
|
86
|
+
for name, names in regions.items():
|
|
87
|
+
sel = [b for b in bodies if b.get("name") in names and not b.get("coupled") and b.get("joint") in ("ball", "revolute")]
|
|
88
|
+
assert sel, f"no moving joint for region {name} ({names})"
|
|
89
|
+
kinds = {b["joint"] for b in sel}
|
|
90
|
+
if kinds == {"ball"}:
|
|
91
|
+
assert len(sel) == 1, (name, len(sel))
|
|
92
|
+
qa, va = int(sel[0]["qadr"]), int(sel[0]["vadr"])
|
|
93
|
+
g = (name, "ball", list(range(qa, qa + 4)), list(range(va, va + 3)))
|
|
94
|
+
else:
|
|
95
|
+
assert kinds == {"revolute"}, (name, kinds)
|
|
96
|
+
# the torso's hinges drive a coupled spine (torso_chain), a shoulder's girdle the arm (arm_frames): each error is
|
|
97
|
+
# its body's rotation, not the hinges'
|
|
98
|
+
kind = "chain" if name == "torso" else "body" if name.startswith("shoulder") else "scalar"
|
|
99
|
+
g = (name, kind, [int(b["qadr"]) for b in sel], [int(b["vadr"]) for b in sel])
|
|
100
|
+
groups.append(g + (REGION_W[name.split("_")[0]],))
|
|
101
|
+
covered |= {id(b) for b in sel}
|
|
102
|
+
moving = [b for b in bodies if _moving(b)]
|
|
103
|
+
missed = [b["name"] for b in moving if id(b) not in covered]
|
|
104
|
+
assert not missed, f"moving joints in no DeepLoco region: {missed}"
|
|
105
|
+
tot = sum(g[4] for g in groups)
|
|
106
|
+
return [(n, k, qi, vi, w / tot) for (n, k, qi, vi, w) in groups if w > 0.0]
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def _moving(b):
|
|
110
|
+
return b.get("joint") in ("ball", "revolute") and not b.get("coupled")
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def arm_frames(jm, parent="torso"):
|
|
114
|
+
"""{'shoulder_r' / 'shoulder_l': (the humerus body's index, the torso body's)}, {} on an armless body. humanoid3d's spherical
|
|
115
|
+
shoulder is the upper arm's rotation against the chest; every body between the torso and the girdle's first joint must be
|
|
116
|
+
rigidly attached (asserted), so the torso body is that chest."""
|
|
117
|
+
bodies = jm["bodies"]
|
|
118
|
+
names = [b.get("name", "") for b in bodies]
|
|
119
|
+
out = {}
|
|
120
|
+
for s in ("r", "l"):
|
|
121
|
+
if not any(_moving(b) and b.get("name") in ARM_REGION_BODIES[f"shoulder_{s}"] for b in bodies):
|
|
122
|
+
continue
|
|
123
|
+
child = max(i for i, n in enumerate(names) if n == f"humerus_{s}") # the segment's last joint entry is its frame
|
|
124
|
+
first = names.index(f"clavicle_{s}")
|
|
125
|
+
i = bodies[first].get("parent")
|
|
126
|
+
while names[i] != parent:
|
|
127
|
+
assert bodies[i].get("joint") in (None, "fixed"), f"a moving joint ({names[i]}) between the {parent} and the girdle"
|
|
128
|
+
i = bodies[i].get("parent")
|
|
129
|
+
out[f"shoulder_{s}"] = (child, i)
|
|
130
|
+
assert len(out) in (0, 2), out
|
|
131
|
+
return out
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def torso_chain(jm, body="torso"):
|
|
135
|
+
"""(the torso body's index, {velocity index of each master hinge: its summed linear coupling along the root -> torso
|
|
136
|
+
chain}). In this model lumbar5's three hinges also drive lumbar4..1 (flexion coefficients 1.48, 1.63, 1.85, 2.04), so the
|
|
137
|
+
torso turns ~8x lumbar5's own flexion against the root (measured 7.7 deg / deg on rollouts, 2026-10-24). DeepLoco's torso is
|
|
138
|
+
one spherical joint, so its pose error is that rotation; the rate error scales each master's rate by its chain sum."""
|
|
139
|
+
bodies = jm["bodies"]
|
|
140
|
+
names = [b.get("name") for b in bodies]
|
|
141
|
+
i = names.index(body)
|
|
142
|
+
chain = []
|
|
143
|
+
while i is not None and i >= 0:
|
|
144
|
+
chain.append(i)
|
|
145
|
+
i = bodies[i].get("parent")
|
|
146
|
+
scale = {}
|
|
147
|
+
for j in chain:
|
|
148
|
+
b = bodies[j]
|
|
149
|
+
if b.get("joint") != "revolute":
|
|
150
|
+
continue
|
|
151
|
+
c = b.get("coupled")
|
|
152
|
+
if c:
|
|
153
|
+
coef = [float(x) for x in c["coef"]]
|
|
154
|
+
assert coef[0] == 0.0 and all(x == 0.0 for x in coef[2:]), (b.get("joint_name"), coef) # a linear coupling only
|
|
155
|
+
scale[int(c["master_vadr"])] = scale.get(int(c["master_vadr"]), 0.0) + coef[1]
|
|
156
|
+
else:
|
|
157
|
+
scale[int(b["vadr"])] = scale.get(int(b["vadr"]), 0.0) + 1.0
|
|
158
|
+
return names.index(body), scale
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def qmul(a, b):
|
|
162
|
+
"""Hamilton product of (4, n) quaternions (w, x, y, z)."""
|
|
163
|
+
aw, ax, ay, az = a
|
|
164
|
+
bw, bx, by, bz = b
|
|
165
|
+
return torch.stack([aw * bw - ax * bx - ay * by - az * bz, aw * bx + ax * bw + ay * bz - az * by,
|
|
166
|
+
aw * by - ax * bz + ay * bw + az * bx, aw * bz + ax * by - ay * bx + az * bw])
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def qconj(a):
|
|
170
|
+
return torch.stack([a[0], -a[1], -a[2], -a[3]])
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def _yaw_free(qr):
|
|
174
|
+
"""(4, n) root quaternions (w, x, y, z) with the heading divided out (DnModelMonitor.yaw_free_quat)."""
|
|
175
|
+
from diffneusim.model.monitor import DnModelMonitor
|
|
176
|
+
return DnModelMonitor.yaw_free_quat(qr)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def _geo2(a, b):
|
|
180
|
+
"""Squared geodesic angle between unit quaternions, (4, n) each: (2 acos |<a, b>|)^2."""
|
|
181
|
+
dot = (a * b).sum(0).abs().clamp(max=1.0 - 1e-6)
|
|
182
|
+
return (2.0 * torch.acos(dot)) ** 2
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def pose_vel_errors(q, qd, q_ref, qd_ref, groups, torso=None, arms=None, per_group=False):
|
|
186
|
+
"""(E_pose, E_vel), each (n,): the joint-weighted squared rotation and rate errors (CalcPoseErr / CalcVelErr). q_ref, qd_ref
|
|
187
|
+
must already be time-warped and detached; the root's rotation is compared heading-free, its rate (body frame) as is. A 'chain'
|
|
188
|
+
group needs torso = (the torso's orientation relative to the root, sim (4, n); the reference's (4, n); {vadr: chain sum}); a
|
|
189
|
+
'body' group needs arms[name] = (the humerus against the torso, sim (4, n); the reference's (4, n)).
|
|
190
|
+
per_group (probes): also returns ({group: w e_pose}, {group: w e_vel}, {group: e_pose unweighted}); the weighted pieces sum to
|
|
191
|
+
E_pose / E_vel, accumulated in the same order, so E_pose / E_vel are bit-identical either way."""
|
|
192
|
+
ep = torch.zeros_like(q[0])
|
|
193
|
+
ev = torch.zeros_like(q[0])
|
|
194
|
+
pp, pv, pe = {}, {}, {}
|
|
195
|
+
for (name, kind, qi, vi, w) in groups:
|
|
196
|
+
if kind == "root":
|
|
197
|
+
e = _geo2(_yaw_free(q[qi[0]:qi[0] + 4]), _yaw_free(q_ref[qi[0]:qi[0] + 4]))
|
|
198
|
+
elif kind == "ball":
|
|
199
|
+
e = _geo2(q[qi[0]:qi[0] + 4], q_ref[qi[0]:qi[0] + 4])
|
|
200
|
+
elif kind == "chain":
|
|
201
|
+
assert torso is not None, "the torso chain is compared through the torso body (torso_chain)"
|
|
202
|
+
e = _geo2(torso[0], torso[1])
|
|
203
|
+
elif kind == "body":
|
|
204
|
+
assert arms is not None and name in arms, f"the shoulder {name} is compared through the humerus body (arm_frames)"
|
|
205
|
+
e = _geo2(arms[name][0], arms[name][1])
|
|
206
|
+
else:
|
|
207
|
+
e = ((q[qi] - q_ref[qi]) ** 2).sum(0)
|
|
208
|
+
ep = ep + w * e
|
|
209
|
+
if kind == "chain":
|
|
210
|
+
sc = torch.tensor([torso[2][v] for v in vi], dtype=qd.dtype, device=qd.device)[:, None]
|
|
211
|
+
evj = w * ((sc * (qd[vi] - qd_ref[vi])) ** 2).sum(0)
|
|
212
|
+
else:
|
|
213
|
+
evj = w * ((qd[vi] - qd_ref[vi]) ** 2).sum(0)
|
|
214
|
+
ev = ev + evj
|
|
215
|
+
if per_group:
|
|
216
|
+
pp[name], pv[name], pe[name] = w * e, evj, e
|
|
217
|
+
if per_group:
|
|
218
|
+
return ep, ev, pp, pv, pe
|
|
219
|
+
return ep, ev
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def split_exp_term(term, scale, pieces):
|
|
223
|
+
"""A kernel term = exp(-scale E) with E = sum_j pieces[j], split into one probe source per piece: {j: s_j} with values
|
|
224
|
+
term * p_j / E (they sum to term) and gradients (-scale term) dp_j (they sum to d term, the chain rule at this step), so an
|
|
225
|
+
actor-gradient attribution can price each joint group's share of a pose / rate kernel exactly. Probes only: nothing here
|
|
226
|
+
enters a training reward."""
|
|
227
|
+
e = sum(pieces.values())
|
|
228
|
+
coef = (-scale * term).detach()
|
|
229
|
+
share = (term / e.clamp_min(1e-30)).detach()
|
|
230
|
+
return {j: share * p.detach() + coef * (p - p.detach()) for j, p in pieces.items()}
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def heading_kernel(err):
|
|
234
|
+
"""DeepLoco's heading reward, (0.5 (cos e + 1))^4."""
|
|
235
|
+
return (0.5 * (torch.cos(err) + 1.0)) ** 4
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
def llc_reward(e_pose, e_vel, r_ee, e_root, dv_com, head_err):
|
|
239
|
+
"""CalcRewardStep in [0, 1]: e_pose / e_vel / e_root (n,), r_ee = the end-effector kernel exp(-5 E_ee) (n,), dv_com (3, n) the
|
|
240
|
+
COM velocity error, head_err (n,) the heading error. Returns (r, the six terms before weighting, for logging)."""
|
|
241
|
+
terms = {"pose": torch.exp(-TERM_SCALE["pose"] * e_pose),
|
|
242
|
+
"vel": torch.exp(-TERM_SCALE["vel"] * e_vel),
|
|
243
|
+
"ee": r_ee,
|
|
244
|
+
"root": torch.exp(-TERM_SCALE["root"] * e_root),
|
|
245
|
+
"com": torch.exp(-TERM_SCALE["com"] * COM_ERR_FACTOR * (dv_com * dv_com).sum(0)),
|
|
246
|
+
"heading": heading_kernel(head_err)}
|
|
247
|
+
tot = sum(TERM_W.values())
|
|
248
|
+
r = sum(TERM_W[k] * terms[k] for k in TERM_W) / tot
|
|
249
|
+
return r, terms
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
def root_height_above_feet(root_z, foot_z):
|
|
253
|
+
"""The root's height above the lower of the two calcaneus origins, (n,); foot_z (2, n)."""
|
|
254
|
+
return root_z - torch.minimum(foot_z[0], foot_z[1])
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
class LlcRef:
|
|
258
|
+
"""Per-frame references an ImitationTask's clips do not carry: the root height above the lower calcaneus (m) and the COM
|
|
259
|
+
velocity in the root's heading frame (m/s per clip second), differenced within each clip (one-sided at an open clip's ends,
|
|
260
|
+
across the seam for a closed loop), from the clips' own FK."""
|
|
261
|
+
|
|
262
|
+
def __init__(self, task, monitor, feet, torso, arms=None):
|
|
263
|
+
q = task.ref_q.t().contiguous() # (nq, sum_T)
|
|
264
|
+
arms = dict(arms or {})
|
|
265
|
+
with torch.no_grad():
|
|
266
|
+
pos, quat, com = monitor.body_poses_subset(q, sorted({*feet, torso, *(i for ab in arms.values() for i in ab)}), True)
|
|
267
|
+
self.torso_rel = qmul(qconj(q[3:7]), quat[torso]) # (4, sum_T), the torso against the root
|
|
268
|
+
self.arm_rel = {k: qmul(qconj(quat[pa]), quat[ch]) for k, (ch, pa) in arms.items()} # the humerus against the torso
|
|
269
|
+
self.root_h = root_height_above_feet(q[2], torch.stack([pos[feet[0]][2], pos[feet[1]][2]]))
|
|
270
|
+
ip, im, span = clip_differences(task.clip_start, task.clip_T, task.cyclic, q.device)
|
|
271
|
+
v = (com[:, ip] - com[:, im]) / (span.to(com.dtype) * task.ref_dt)
|
|
272
|
+
w_, x_, y_, z_ = q[3], q[4], q[5], q[6]
|
|
273
|
+
yaw = torch.atan2(2.0 * (w_ * z_ + x_ * y_), 1.0 - 2.0 * (y_ * y_ + z_ * z_))
|
|
274
|
+
c, s = torch.cos(yaw), torch.sin(yaw)
|
|
275
|
+
self.com_vel = torch.stack([c * v[0] + s * v[1], -s * v[0] + c * v[1], v[2]]) # (3, sum_T)
|
|
276
|
+
self.task = task
|
|
277
|
+
|
|
278
|
+
def at(self, phase):
|
|
279
|
+
"""(root height (n,), COM velocity (3, n), the torso's orientation against the root (4, n)) at each env's clip and phase
|
|
280
|
+
(the task's own frame indexing; the quaternion sign-aligned and renormalised, as ref_at blends)."""
|
|
281
|
+
i0, i1, wf = self.task.frame_idx(phase)
|
|
282
|
+
h = self.root_h[i0] * (1.0 - wf) + self.root_h[i1] * wf
|
|
283
|
+
v = self.com_vel[:, i0] * (1.0 - wf) + self.com_vel[:, i1] * wf
|
|
284
|
+
return h, v, _nlerp(self.torso_rel, i0, i1, wf)
|
|
285
|
+
|
|
286
|
+
def arms_at(self, phase):
|
|
287
|
+
"""{shoulder: the humerus's orientation against the torso (4, n)} at each env's clip and phase (as `at`)."""
|
|
288
|
+
i0, i1, wf = self.task.frame_idx(phase)
|
|
289
|
+
return {k: _nlerp(r, i0, i1, wf) for k, r in self.arm_rel.items()}
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
def _nlerp(Q, i0, i1, wf):
|
|
293
|
+
"""(4, n) frames i0 -> i1 of the (4, T) quaternions Q, sign-aligned and renormalised (as ref_at blends)."""
|
|
294
|
+
a, b = Q[:, i0], Q[:, i1]
|
|
295
|
+
b = torch.where((a * b).sum(0, keepdim=True) < 0.0, -b, b)
|
|
296
|
+
t = a * (1.0 - wf) + b * wf
|
|
297
|
+
return t / t.norm(dim=0, keepdim=True)
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
def clip_differences(clip_start, clip_T, cyclic, device):
|
|
301
|
+
"""(ip, im, span) global frame indices and their spacing in frames for a central difference within each clip: across the
|
|
302
|
+
seam for a closed loop, one-sided (span 1) at the two ends of an open clip."""
|
|
303
|
+
total = int((clip_start + clip_T).max())
|
|
304
|
+
ip = torch.empty(total, dtype=torch.long, device=device)
|
|
305
|
+
im = torch.empty_like(ip)
|
|
306
|
+
for c in range(int(clip_T.shape[0])):
|
|
307
|
+
s0, T = int(clip_start[c]), int(clip_T[c])
|
|
308
|
+
t = torch.arange(T, device=device)
|
|
309
|
+
if cyclic:
|
|
310
|
+
ip[s0:s0 + T] = s0 + (t + 1) % T
|
|
311
|
+
im[s0:s0 + T] = s0 + (t - 1) % T
|
|
312
|
+
else:
|
|
313
|
+
ip[s0:s0 + T] = s0 + (t + 1).clamp(max=T - 1)
|
|
314
|
+
im[s0:s0 + T] = s0 + (t - 1).clamp(min=0)
|
|
315
|
+
span = torch.where(ip > im, ip - im, torch.full_like(ip, 2)) # a loop's seam pair wraps: still two frames apart
|
|
316
|
+
return ip, im, span
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"""Millard 2013 MTU force in torch, so the reward's in-graph force consumers (the Wang 2012 metabolic rate and the knee-load
|
|
2
|
+
term) run on a Millard case (2026-11-17; the review item M0, the design's "every predictive result on Millard").
|
|
3
|
+
|
|
4
|
+
WHY A SECOND PORT, AND WHY FROM THE CASE. geyer_curves_torch transcribes the Geyer 2010 curves from the dnmodel's gainprm. A
|
|
5
|
+
Millard muscle has no closed-form curves: the engine reads the loader's BAKED quintic-Hermite tables (core/io/dnmodel.h
|
|
6
|
+
bake_millard_block; per muscle its curve set, and an exact own passive table where the loader's affine map is not the identity,
|
|
7
|
+
tools/d16/muscle_ref/millard_tables.h). Rebuilding those curves from the dnmodel's Bezier parameters would be a second
|
|
8
|
+
implementation of the same curves, checked against nothing. So this port reads the SAME arrays the engine uploads from the
|
|
9
|
+
muscle case (muscle_ref_gate --export-gpu: law, mset, pen_h, lce_min, pfl_a, pfl_b, mc_i, mc_f, mc_knot, mc_sinmax, pfl_curve,
|
|
10
|
+
and the shared fmax, lopt, vmax, beta, rigid; read by diffneusim.model.read_case, the engine's own reader) and
|
|
11
|
+
evaluates them with curve_table_eval's arithmetic, core/soft/muscle.h millard_curve_i, operation for operation.
|
|
12
|
+
|
|
13
|
+
THE FORCE, ON THE FIBRE SIDE (the same move as geyer_curves_torch). The engine's backward-Euler residual (muscle.h section 4m,
|
|
14
|
+
Millard 2013 Eq. 8) is
|
|
15
|
+
R(l_ce) = f_T(l_T / l_s) - cos(phi) [A f_L(l0) f_V(v0) + f_PE(a_m l0 + b_m) + beta v0], l0 = l_ce / l_opt,
|
|
16
|
+
v0 = v_ce / (l_opt v_max)
|
|
17
|
+
so at the solved state the tendon force F_max f_T equals F_max cos(phi) (A f_L f_V + f_PE + beta v0): a function of l_ce, v_ce
|
|
18
|
+
and A only, all of which the env carries in-graph. No l_mtu, no tendon curve. Pennation is the fixed-width rule, sin(phi) =
|
|
19
|
+
pen_h / l_ce clamped at sin(phi_max) (millard_pennation); pen_h = 0 gives cos(phi) = 1 with no division by l_ce, so the 76
|
|
20
|
+
unpennated thelen2003 trunk fibres (lce_min 0) stay finite in value and gradient at l_ce = 0.
|
|
21
|
+
F_MTU = F_max cos(phi) (A f_L f_V + f_PE + beta v0) compliant (the residual's fibre side; NOT floored, as Geyer's)
|
|
22
|
+
= max(0, that) if l_ce > lce_min, else 0 rigid (Eqs. 9-15, muscle.h millard_rigid: the tendon at slack, the
|
|
23
|
+
geometric fibre clamped at lce_min where the tendon carries nothing)
|
|
24
|
+
F_CE = F_max A f_L f_V the active fibre force along the fibre (Wang 2012 supp. Eq. 1),
|
|
25
|
+
which with the fibre velocity is the contractile element's power
|
|
26
|
+
WHERE THE FIBRE-SIDE FORM IS NOT THE ENGINE'S. A compliant fibre ON its Eq. 7 bound (l_ce = lce_min with R < 0, a slack tendon)
|
|
27
|
+
carries the tendon force f_T, below the fibre side. On every muscle family the active and passive curves are 0 at the bound
|
|
28
|
+
(legs 0.25 l_opt, arms 0.43, the trunk's 0 or its pennation floor), so both sides are 0 there unless the fibre moves off the
|
|
29
|
+
bound inside the step; the gate reports that subset apart.
|
|
30
|
+
|
|
31
|
+
CHECKED AGAINST THE ENGINE, NOT AGAINST ITSELF: tools/d16_x14adj/millard_reward_gate.py runs core/soft/muscle.h's own Millard
|
|
32
|
+
law (millard_fiber, compiled from tools/d16_x14adj/millard_reward_ref.cpp) on the case's arrays and compares its converged
|
|
33
|
+
tendon force with this port at the converged l_ce, compliant and rigid, f64 and f32, plus the case's own exported references
|
|
34
|
+
(refc_F, ref32_F) where the case carries them."""
|
|
35
|
+
import importlib.util
|
|
36
|
+
|
|
37
|
+
import numpy as np
|
|
38
|
+
import torch
|
|
39
|
+
|
|
40
|
+
from diffneusim._paths import ROOT as ROOT # (3a) the repo root
|
|
41
|
+
K_AFL, K_PFL, K_TFL, K_FV = 0, 1, 2, 3 # muscle.h MCurve, dnmodel.h's push order
|
|
42
|
+
|
|
43
|
+
_KG = None
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _kg():
|
|
47
|
+
"""the engine's case reader (case_tables.load_case / is_millard), loaded once from its file: one reader for the case format"""
|
|
48
|
+
global _KG
|
|
49
|
+
if _KG is None:
|
|
50
|
+
spec = importlib.util.spec_from_file_location("case_tables", ROOT / "engine" / "case_tables.py")
|
|
51
|
+
_KG = importlib.util.module_from_spec(spec)
|
|
52
|
+
spec.loader.exec_module(_KG)
|
|
53
|
+
return _KG
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _curve_view(C, ci, dev, dt):
|
|
57
|
+
"""per-muscle gathered view of curve indices ci (n_mus,): mc_f's eight scalars and mc_i's (first knot, count), as (n_mus, 1)"""
|
|
58
|
+
f = C["mc_f"][ci] # (n_mus, 8): x0, x1, dx, inv_dx, a_y0, a_d0, a_y1, a_d1
|
|
59
|
+
i = C["mc_i"][ci] # (n_mus, 2): first knot, knot count
|
|
60
|
+
col = lambda x, typ: torch.as_tensor(np.ascontiguousarray(x), dtype=typ, device=dev)[:, None] # noqa: E731
|
|
61
|
+
v = {k: col(f[:, j], dt) for j, k in enumerate(("x0", "x1", "h", "inv_dx", "a_y0", "a_d0", "a_y1", "a_d1"))}
|
|
62
|
+
v["k0"] = col(i[:, 0].astype(np.int64), torch.int64)
|
|
63
|
+
v["imax"] = col((i[:, 1] - 2).astype(np.float64), dt) # the last cell's index, n - 2
|
|
64
|
+
assert (i[:, 1] >= 2).all(), "a curve table with fewer than two knots"
|
|
65
|
+
return v
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def case_table(case_dir, names, device, dtype=torch.float32):
|
|
69
|
+
"""The Millard force table from a muscle case (n_mus = len(names), in the env model's muscle order, which is the case's: env14
|
|
70
|
+
asserts the case's per-muscle arrays against the env model's in that order). Every array is the engine's own upload; the f32
|
|
71
|
+
table is the f64 store cast once, as the f32 engine's is."""
|
|
72
|
+
KG = _kg()
|
|
73
|
+
C = KG.load_case(case_dir)
|
|
74
|
+
assert KG.is_millard(C), f"{case_dir}: not a Millard case (no law arrays)"
|
|
75
|
+
nm = int(C["fmax"].shape[0])
|
|
76
|
+
assert nm == len(names), f"{case_dir}: {nm} muscles, the model has {len(names)}"
|
|
77
|
+
nmset, ncurve = int(C["law"][1]), int(C["law"][2])
|
|
78
|
+
mset = C["mset"].astype(np.int64)
|
|
79
|
+
pflc = C["pfl_curve"].astype(np.int64)
|
|
80
|
+
assert mset.shape == (nm,) and mset.min() >= 0 and mset.max() < nmset, "mset outside the case's curve sets"
|
|
81
|
+
assert C["mc_i"].shape == (ncurve, 2) and C["mc_f"].shape == (ncurve, 8) and C["mc_sinmax"].shape == (nmset,)
|
|
82
|
+
assert pflc.min() >= 0 and pflc.max() < ncurve, "pfl_curve outside the case's curves"
|
|
83
|
+
assert int(C["mc_i"][:, 0].max() + C["mc_i"][:, 1].max()) <= C["mc_knot"].shape[0], "mc_i points past mc_knot"
|
|
84
|
+
rig = C["rigid"].astype(np.int64)
|
|
85
|
+
assert set(np.unique(rig).tolist()) <= {0, 1}, (f"{case_dir}: rigid = {sorted(set(np.unique(rig).tolist()))}: a Millard case is rigid 0 / 1 "
|
|
86
|
+
"(engine14 refuses rigid = 2 on Millard)")
|
|
87
|
+
col = lambda x: torch.as_tensor(np.ascontiguousarray(x, dtype=np.float64), dtype=dtype, device=device)[:, None] # noqa: E731
|
|
88
|
+
p = dict(law="millard2012", case_dir=str(case_dir),
|
|
89
|
+
F_max=col(C["fmax"]), l_opt=col(C["lopt"]), v_max=col(C["vmax"]), beta=col(C["beta"]),
|
|
90
|
+
pen_h=col(C["pen_h"]), lce_min=col(C["lce_min"]), pfl_a=col(C["pfl_a"]), pfl_b=col(C["pfl_b"]),
|
|
91
|
+
sinmax=col(C["mc_sinmax"][mset]),
|
|
92
|
+
pennated=torch.as_tensor(C["pen_h"] > 0, device=device)[:, None],
|
|
93
|
+
rigid=torch.as_tensor(rig == 1, device=device)[:, None],
|
|
94
|
+
afl=_curve_view(C, 4 * mset + K_AFL, device, dtype),
|
|
95
|
+
pfl=_curve_view(C, pflc, device, dtype),
|
|
96
|
+
fv=_curve_view(C, 4 * mset + K_FV, device, dtype),
|
|
97
|
+
knots=torch.as_tensor(np.ascontiguousarray(C["mc_knot"], dtype=np.float64), dtype=dtype, device=device))
|
|
98
|
+
p["_np"] = {k: C[k] for k in ("fmax", "lopt", "lslack", "vmax", "beta", "pen_h", "lce_min", "rigid")} # for the callers' checks
|
|
99
|
+
return p
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def curve(x, c, knots):
|
|
103
|
+
"""curve_table_eval's value (muscle.h millard_curve_i, operation for operation), differentiable in x. Linear extrapolation
|
|
104
|
+
below x0 and above x1; inside, the quintic Hermite cell i = floor((x - x0) / dx), clamped to [0, n - 2]. All three branches are
|
|
105
|
+
finite for every x (the interior's clamped cell is evaluated outside too), so torch.where's masked gradients carry no NaN."""
|
|
106
|
+
s = (x - c["x0"]) * c["inv_dx"]
|
|
107
|
+
i = torch.minimum(torch.floor(s.detach()).clamp_min(0.0), c["imax"]) # the engine's int cast of s >= 0, then its clamp
|
|
108
|
+
u = s - i
|
|
109
|
+
k = (c["k0"] + i.to(torch.int64)) * 3
|
|
110
|
+
kf = knots.reshape(-1)
|
|
111
|
+
y_i, d_i, e_i = kf[k], kf[k + 1], kf[k + 2]
|
|
112
|
+
y_j, d_j, e_j = kf[k + 3], kf[k + 4], kf[k + 5]
|
|
113
|
+
u2 = u * u
|
|
114
|
+
u3 = u2 * u
|
|
115
|
+
u4 = u3 * u
|
|
116
|
+
u5 = u4 * u
|
|
117
|
+
h = c["h"]
|
|
118
|
+
H0 = 1 - 10 * u3 + 15 * u4 - 6 * u5
|
|
119
|
+
H1 = u - 6 * u3 + 8 * u4 - 3 * u5
|
|
120
|
+
H2 = 0.5 * u2 - 1.5 * u3 + 1.5 * u4 - 0.5 * u5
|
|
121
|
+
G0 = 10 * u3 - 15 * u4 + 6 * u5
|
|
122
|
+
G1 = -4 * u3 + 7 * u4 - 3 * u5
|
|
123
|
+
G2 = 0.5 * u3 - u4 + 0.5 * u5
|
|
124
|
+
y_in = H0 * y_i + H1 * h * d_i + H2 * h * h * e_i + G0 * y_j + G1 * h * d_j + G2 * h * h * e_j
|
|
125
|
+
y_lo = c["a_y0"] + c["a_d0"] * (x - c["x0"])
|
|
126
|
+
y_hi = c["a_y1"] + c["a_d1"] * (x - c["x1"])
|
|
127
|
+
return torch.where(x <= c["x0"], y_lo, torch.where(x >= c["x1"], y_hi, y_in))
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def cos_pennation(l_ce, p):
|
|
131
|
+
"""cos(phi) by the fixed-width rule (muscle.h millard_pennation): sin(phi) = pen_h / l_ce, set to sin(phi_max) where it would
|
|
132
|
+
exceed it (there no gradient reaches l_ce: the engine's dphi = 0). The division runs only where the clamp is off, so l_ce is
|
|
133
|
+
at least pen_h / sin(phi_max) > 0 there; the other lanes divide by 1. Unpennated (pen_h = 0): exactly 1, no division."""
|
|
134
|
+
h, smax = p["pen_h"], p["sinmax"]
|
|
135
|
+
clamp = p["pennated"] & (h > smax * l_ce) # the engine's pen_h / l_ce > sin(phi_max); true for any l_ce <= 0
|
|
136
|
+
free = p["pennated"] & ~clamp
|
|
137
|
+
sp = torch.where(free, h / torch.where(free, l_ce, torch.ones_like(l_ce)),
|
|
138
|
+
torch.where(clamp, smax.expand_as(l_ce), torch.zeros_like(l_ce)))
|
|
139
|
+
return torch.sqrt(1 - sp * sp)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def mtu_forces(l_ce, v_ce, a, p):
|
|
143
|
+
"""(F_MTU, F_CE) in newtons, in-graph; the same contract as geyer_curves_torch.mtu_forces. `p` is case_table's dict; `l_ce`,
|
|
144
|
+
`v_ce`, `a` are (n_mus, n_env); v_ce > 0 is lengthening (muscle.h's v0 = (l_ce - l_ce_prev) / (dt v_max l_opt))."""
|
|
145
|
+
l0 = l_ce / p["l_opt"]
|
|
146
|
+
v0 = v_ce / (p["l_opt"] * p["v_max"])
|
|
147
|
+
fl = curve(l0, p["afl"], p["knots"])
|
|
148
|
+
fpe = curve(p["pfl_a"] * l0 + p["pfl_b"], p["pfl"], p["knots"])
|
|
149
|
+
fv = curve(v0, p["fv"], p["knots"])
|
|
150
|
+
act = a * fl * fv
|
|
151
|
+
fib = act + fpe + p["beta"] * v0
|
|
152
|
+
f = p["F_max"] * fib * cos_pennation(l_ce, p)
|
|
153
|
+
f_rigid = torch.where(l_ce > p["lce_min"], f.clamp_min(0.0), torch.zeros_like(f))
|
|
154
|
+
return torch.where(p["rigid"], f_rigid, f), p["F_max"] * act
|