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,686 @@
|
|
|
1
|
+
"""Shared .dnrec writer + engine forward-kinematics for the renderers (humanoid + full-body).
|
|
2
|
+
|
|
3
|
+
The .dnrec binary: MAGIC ``b"JPLY"``, ``uint32`` version + ``uint32`` header length, a JSON header
|
|
4
|
+
(scene / dt / bodies / channel layout), then the float32 frame blocks. ``fk_poses`` walks a dnmodel
|
|
5
|
+
body tree (free / ball / hinge / slide joints) to world poses; ``write_dnrec`` packs the per-frame
|
|
6
|
+
channels (pose, qvel, optional mtu_poly / activation / contact) into the binary the viewer reads.
|
|
7
|
+
|
|
8
|
+
Torch-free on purpose: a renderer can build geometry + poses without importing the GPU bridge.
|
|
9
|
+
"""
|
|
10
|
+
import json
|
|
11
|
+
import math
|
|
12
|
+
import struct
|
|
13
|
+
|
|
14
|
+
import os
|
|
15
|
+
import numpy as np
|
|
16
|
+
|
|
17
|
+
MAGIC = b"JPLY"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
# The record format's extensions: .dnrec, and .jplay, its earlier name (the same format and magic: the paper's stored records).
|
|
22
|
+
# The body format likewise: .dnmodel, and .jmodel.
|
|
23
|
+
RECORD_SUFFIXES = (".dnrec", ".jplay")
|
|
24
|
+
MODEL_SUFFIXES = (".dnmodel", ".jmodel")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def is_record(path):
|
|
28
|
+
return str(path).lower().endswith(RECORD_SUFFIXES)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def muscle_l_opt(mu):
|
|
32
|
+
"""`optimal_fiber_length` for one muscle dict, whichever spelling the .dnmodel uses.
|
|
33
|
+
|
|
34
|
+
A muscle declares its scalars EITHER as MuJoCo's positional `gainprm`
|
|
35
|
+
[F_max, l_opt, l_slack, v_max, W, C, N, K, E_REF] OR with the source's own names -- OpenSim's and
|
|
36
|
+
Hyfydy's (decisions/0020). The C++ loader handles both; python consumers that re-read the raw JSON
|
|
37
|
+
did not, and every one of them reached for `mu["gainprm"][1]`. A converted Hyfydy/OpenSim model has
|
|
38
|
+
no `gainprm` at all, so that read is a KeyError -- which is how the H1622 smoke test failed.
|
|
39
|
+
|
|
40
|
+
Use this instead of indexing `gainprm`. Same value, both spellings, one place to fix.
|
|
41
|
+
"""
|
|
42
|
+
if "gainprm" in mu:
|
|
43
|
+
return float(mu["gainprm"][1])
|
|
44
|
+
v = mu.get("optimal_fiber_length")
|
|
45
|
+
assert v is not None, (
|
|
46
|
+
f"muscle {mu.get('name', '?')!r} declares neither `gainprm` nor `optimal_fiber_length`; "
|
|
47
|
+
"a .dnmodel muscle must carry one of the two forms (decisions/0020)")
|
|
48
|
+
return float(v)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def muscle_f_max(mu):
|
|
52
|
+
"""`max_isometric_force` for one muscle dict, whichever spelling the .dnmodel uses.
|
|
53
|
+
|
|
54
|
+
Same two forms as muscle_l_opt: MuJoCo's positional `gainprm[0]` or the source's own name
|
|
55
|
+
(decisions/0020). The render path needs it for PCSA = Fmax/sigma_max, and it was the LAST
|
|
56
|
+
positional read left after the l_opt sweep -- which only looked for `[1]`, so every converted model
|
|
57
|
+
still died with KeyError: 'gainprm' when the viewer tried to draw its muscles.
|
|
58
|
+
"""
|
|
59
|
+
if "gainprm" in mu:
|
|
60
|
+
return float(mu["gainprm"][0])
|
|
61
|
+
v = mu.get("max_isometric_force")
|
|
62
|
+
assert v is not None, (
|
|
63
|
+
f"muscle {mu.get('name', '?')!r} declares neither `gainprm` nor `max_isometric_force`")
|
|
64
|
+
return float(v)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def muscle_f_maxes(jm):
|
|
68
|
+
"""`max_isometric_force` for every muscle, in file order."""
|
|
69
|
+
return [muscle_f_max(mu) for mu in jm["muscles"]]
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def muscle_l_opts(jm):
|
|
73
|
+
"""`optimal_fiber_length` for every muscle, in file order."""
|
|
74
|
+
return [muscle_l_opt(mu) for mu in jm["muscles"]]
|
|
75
|
+
|
|
76
|
+
def _dnmodel_module():
|
|
77
|
+
"""diffneusim.model.dnmodel: the one .dnmodel reader, torch-free"""
|
|
78
|
+
from diffneusim.model import dnmodel
|
|
79
|
+
return dnmodel
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def load_dnmodel(path):
|
|
83
|
+
"""Parse a `.dnmodel` (JSON + comments) into a dict: diffneusim.model.read_model, the one reader."""
|
|
84
|
+
return _JM.parse(path)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
_JM = _dnmodel_module()
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def quat_mul(a, b):
|
|
91
|
+
aw, ax, ay, az = a
|
|
92
|
+
bw, bx, by, bz = b
|
|
93
|
+
return np.array([
|
|
94
|
+
aw * bw - ax * bx - ay * by - az * bz,
|
|
95
|
+
aw * bx + ax * bw + ay * bz - az * by,
|
|
96
|
+
aw * by - ax * bz + ay * bw + az * bx,
|
|
97
|
+
aw * bz + ax * by - ay * bx + az * bw,
|
|
98
|
+
], dtype=np.float64)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def quat_axis_angle(axis, angle):
|
|
102
|
+
axis = np.asarray(axis, dtype=np.float64)
|
|
103
|
+
n = np.linalg.norm(axis)
|
|
104
|
+
assert n > 0
|
|
105
|
+
axis = axis / n
|
|
106
|
+
s = math.sin(0.5 * float(angle))
|
|
107
|
+
return np.array([math.cos(0.5 * float(angle)), axis[0] * s, axis[1] * s, axis[2] * s], dtype=np.float64)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def quat_rotate(q, v):
|
|
111
|
+
w, x, y, z = q
|
|
112
|
+
u = np.array([x, y, z], dtype=np.float64)
|
|
113
|
+
v = np.asarray(v, dtype=np.float64)
|
|
114
|
+
return v + 2.0 * w * np.cross(u, v) + 2.0 * np.cross(u, np.cross(u, v))
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def normalize_quat(q):
|
|
118
|
+
q = np.asarray(q, dtype=np.float64)
|
|
119
|
+
return q / np.linalg.norm(q)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def quat_to_R(q):
|
|
123
|
+
"""[w, x, y, z] quat -> 3x3 rotation matrix (f64; the render-side companion to quat_mul/quat_rotate).
|
|
124
|
+
Exporters use the SEPARATE tools/_mjcf_export_util.quat_to_R (same math, MJCF-export dialect)."""
|
|
125
|
+
w, x, y, z = (float(v) for v in q)
|
|
126
|
+
return np.array([[1 - 2 * (y * y + z * z), 2 * (x * y - z * w), 2 * (x * z + y * w)],
|
|
127
|
+
[2 * (x * y + z * w), 1 - 2 * (x * x + z * z), 2 * (y * z - x * w)],
|
|
128
|
+
[2 * (x * z - y * w), 2 * (y * z + x * w), 1 - 2 * (x * x + y * y)]], dtype=np.float64)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def fk_closure(jm, want):
|
|
132
|
+
"""Ancestor closure of `want`, ascending. Pass to fk_poses(..., subset=) to skip bodies nobody reads.
|
|
133
|
+
|
|
134
|
+
Body order is topological (a parent always has a lower index -- fk_poses already relies on it to read
|
|
135
|
+
poses[parent] while filling in order), so ascending order of the closure is a valid evaluation order.
|
|
136
|
+
"""
|
|
137
|
+
bodies = jm["bodies"]
|
|
138
|
+
need = set()
|
|
139
|
+
for b in want:
|
|
140
|
+
i = int(b)
|
|
141
|
+
while i >= 0:
|
|
142
|
+
need.add(i)
|
|
143
|
+
i = int(bodies[i]["parent"])
|
|
144
|
+
return sorted(need)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def fk_poses(jm, q, subset=None):
|
|
148
|
+
"""World poses (n_body, 7) = [pos(3), quat(4)] per body.
|
|
149
|
+
|
|
150
|
+
`subset` = an fk_closure() list: evaluate ONLY those bodies and leave the rest NaN. Same math, just
|
|
151
|
+
skipping poses the caller never reads -- the full-body IK residual reads 8 bodies whose closure is 25 of
|
|
152
|
+
156, and it runs ~200 FK per frame, so this is a 6x whole-retarget win. NaN (not zero) so an accidental
|
|
153
|
+
read of a skipped body propagates visibly instead of looking like a body at the origin.
|
|
154
|
+
"""
|
|
155
|
+
bodies = jm["bodies"]
|
|
156
|
+
poses = (np.zeros((len(bodies), 7), dtype=np.float64) if subset is None
|
|
157
|
+
else np.full((len(bodies), 7), np.nan, dtype=np.float64))
|
|
158
|
+
# RENDER-ONLY kinematic couplings (physics ignores this top-level key, like `visual_geoms`): a body
|
|
159
|
+
# pinned to `fixed` for the dynamics but whose VISUAL mesh should track a coupling joint (the full-body
|
|
160
|
+
# patella -- pinned for stability, muscle handled by moving via-points, but the kneecap mesh must follow
|
|
161
|
+
# the knee to match the muscle). See docs/training/campaigns/fullbody/knee-simplification.md.
|
|
162
|
+
rc = jm.get("render_couplings", {})
|
|
163
|
+
v2q = {int(b["vadr"]): int(b["qadr"]) for b in bodies if b.get("vadr") is not None and b.get("qadr") is not None}
|
|
164
|
+
for i in (range(len(bodies)) if subset is None else subset):
|
|
165
|
+
body = bodies[i]
|
|
166
|
+
parent = int(body["parent"])
|
|
167
|
+
if parent >= 0:
|
|
168
|
+
pp = poses[parent, :3]
|
|
169
|
+
pq = poses[parent, 3:7]
|
|
170
|
+
else:
|
|
171
|
+
pp = np.zeros(3, dtype=np.float64)
|
|
172
|
+
pq = np.array([1.0, 0.0, 0.0, 0.0], dtype=np.float64)
|
|
173
|
+
rcpl = rc.get(str(i))
|
|
174
|
+
if rcpl is not None: # draw at the coupled pose: q_coupled =
|
|
175
|
+
base_p = pp + quat_rotate(pq, np.asarray(rcpl["pos"], dtype=np.float64)) # sum coef[k]*theta^k,
|
|
176
|
+
base_q = normalize_quat(quat_mul(pq, normalize_quat(rcpl["quat"]))) # theta = q[qadr(cdof)]
|
|
177
|
+
coef = np.asarray(rcpl["coef"], dtype=np.float64)
|
|
178
|
+
theta = float(q[v2q.get(int(rcpl["cdof"]), int(rcpl["cdof"]))])
|
|
179
|
+
qc = float((coef * theta ** np.arange(coef.shape[0])).sum())
|
|
180
|
+
axis = np.asarray(rcpl["axis"], dtype=np.float64)
|
|
181
|
+
if rcpl["joint"] in ("revolute", "hinge"):
|
|
182
|
+
poses[i, :3] = base_p
|
|
183
|
+
poses[i, 3:7] = normalize_quat(quat_mul(base_q, quat_axis_angle(axis, qc)))
|
|
184
|
+
elif rcpl["joint"] in ("slide", "prismatic"):
|
|
185
|
+
poses[i, :3] = base_p + quat_rotate(base_q, axis * qc)
|
|
186
|
+
poses[i, 3:7] = base_q
|
|
187
|
+
else:
|
|
188
|
+
raise AssertionError(f"render_coupling joint {rcpl['joint']}")
|
|
189
|
+
continue
|
|
190
|
+
cp = body.get("coupled")
|
|
191
|
+
if cp is not None: # PHYSICS coupled ("mimic") joint: q_dep =
|
|
192
|
+
local_p = np.asarray(body["pos"], dtype=np.float64) # sum coef[k]*q_master^k, driven scalar joint
|
|
193
|
+
local_q = normalize_quat(body["quat"])
|
|
194
|
+
base_p = pp + quat_rotate(pq, local_p)
|
|
195
|
+
base_q = normalize_quat(quat_mul(pq, local_q))
|
|
196
|
+
coef = np.asarray(cp["coef"], dtype=np.float64)
|
|
197
|
+
theta = float(q[int(cp["master_qadr"])])
|
|
198
|
+
qc = float((coef * theta ** np.arange(coef.shape[0])).sum())
|
|
199
|
+
axis = np.asarray(body["axis"], dtype=np.float64)
|
|
200
|
+
if body["joint"] in ("revolute", "hinge"):
|
|
201
|
+
poses[i, :3] = base_p
|
|
202
|
+
poses[i, 3:7] = normalize_quat(quat_mul(base_q, quat_axis_angle(axis, qc)))
|
|
203
|
+
elif body["joint"] in ("slide", "prismatic"):
|
|
204
|
+
poses[i, :3] = base_p + quat_rotate(base_q, axis * qc)
|
|
205
|
+
poses[i, 3:7] = base_q
|
|
206
|
+
else:
|
|
207
|
+
raise AssertionError(f"coupled joint {body['joint']}")
|
|
208
|
+
continue
|
|
209
|
+
local_p = np.asarray(body["pos"], dtype=np.float64)
|
|
210
|
+
local_q = normalize_quat(body["quat"])
|
|
211
|
+
base_p = pp + quat_rotate(pq, local_p)
|
|
212
|
+
base_q = normalize_quat(quat_mul(pq, local_q))
|
|
213
|
+
qa = int(body["qadr"])
|
|
214
|
+
if "joints" in body:
|
|
215
|
+
# compound joint: ordered scalar primitive stack T_J = T_0(q0)...T_{n-1},
|
|
216
|
+
# primitive 0 nearest the parent, body frame AFTER the last primitive.
|
|
217
|
+
# Accumulate the joint transform (R_j, p_j) in the parent-attach frame.
|
|
218
|
+
assert "joint" not in body, "a body has either 'joint' or 'joints'"
|
|
219
|
+
rj = np.array([1.0, 0.0, 0.0, 0.0], dtype=np.float64)
|
|
220
|
+
pj = np.zeros(3, dtype=np.float64)
|
|
221
|
+
off = 0
|
|
222
|
+
for prim in body["joints"]:
|
|
223
|
+
ptype = prim["type"]
|
|
224
|
+
axis = np.asarray(prim["axis"], dtype=np.float64)
|
|
225
|
+
if ptype in ("hinge", "revolute"):
|
|
226
|
+
rk = quat_axis_angle(axis, q[qa + off])
|
|
227
|
+
pk = np.zeros(3, dtype=np.float64)
|
|
228
|
+
elif ptype in ("slide", "prismatic"):
|
|
229
|
+
rk = np.array([1.0, 0.0, 0.0, 0.0], dtype=np.float64)
|
|
230
|
+
pk = axis * q[qa + off]
|
|
231
|
+
else:
|
|
232
|
+
raise AssertionError(f"unknown compound primitive {ptype}")
|
|
233
|
+
# T_J <- T_J . T_k : p_j += R_j p_k ; R_j = R_j R_k.
|
|
234
|
+
pj = pj + quat_rotate(rj, pk)
|
|
235
|
+
rj = quat_mul(rj, rk)
|
|
236
|
+
off += 1
|
|
237
|
+
out_p = base_p + quat_rotate(base_q, pj)
|
|
238
|
+
out_q = normalize_quat(quat_mul(base_q, rj))
|
|
239
|
+
poses[i, :3] = out_p
|
|
240
|
+
poses[i, 3:7] = out_q
|
|
241
|
+
continue
|
|
242
|
+
joint = body["joint"]
|
|
243
|
+
if joint == "fixed":
|
|
244
|
+
out_p, out_q = base_p, base_q
|
|
245
|
+
elif joint == "free":
|
|
246
|
+
# compose the body attach frame (base_p/base_q = parent o quat_tree/pos_tree) with the free
|
|
247
|
+
# joint's (pos, quat), matching the engine chain-FK. The old code used the raw free pos/quat
|
|
248
|
+
# and dropped quat_tree -> a model whose root quat_tree != identity (myoLeg26's +90deg-about-x
|
|
249
|
+
# y-up->z-up map) rendered LYING DOWN. base_q=identity models (ant) are unchanged.
|
|
250
|
+
out_p = base_p + quat_rotate(base_q, q[qa:qa + 3].astype(np.float64))
|
|
251
|
+
out_q = normalize_quat(quat_mul(base_q, q[qa + 3:qa + 7]))
|
|
252
|
+
elif joint == "ball":
|
|
253
|
+
out_p = base_p
|
|
254
|
+
out_q = normalize_quat(quat_mul(base_q, q[qa:qa + 4]))
|
|
255
|
+
elif joint in ("revolute", "hinge"):
|
|
256
|
+
out_p = base_p
|
|
257
|
+
out_q = normalize_quat(quat_mul(base_q, quat_axis_angle(body["axis"], q[qa])))
|
|
258
|
+
elif joint in ("slide", "prismatic"):
|
|
259
|
+
out_p = base_p + quat_rotate(base_q, np.asarray(body["axis"], dtype=np.float64) * q[qa])
|
|
260
|
+
out_q = base_q
|
|
261
|
+
else:
|
|
262
|
+
raise AssertionError(f"unknown joint {joint}")
|
|
263
|
+
poses[i, :3] = out_p
|
|
264
|
+
poses[i, 3:7] = out_q
|
|
265
|
+
return poses
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
def com_track(jm, pose):
|
|
269
|
+
"""Whole-body centre of mass per frame -> (T, 1, 3), from the render pose (T, nbody, 7) + the dnmodel
|
|
270
|
+
body masses/com offsets. Pure kinematics (mass-weighted world body-COMs), for the viewer's COM-trail
|
|
271
|
+
overlay -- no engine/physics needed, works for any pose trajectory."""
|
|
272
|
+
pose = np.asarray(pose, np.float64)
|
|
273
|
+
bodies = jm["bodies"]
|
|
274
|
+
m = np.array([float(b.get("mass", 0.0)) for b in bodies])
|
|
275
|
+
lc = np.array([b.get("com", [0.0, 0.0, 0.0]) for b in bodies], float) # per-body LOCAL com offset
|
|
276
|
+
M = float(m.sum())
|
|
277
|
+
assert M > 0.0, "dnmodel has zero total mass; cannot compute COM"
|
|
278
|
+
T = pose.shape[0]
|
|
279
|
+
out = np.zeros((T, 1, 3))
|
|
280
|
+
for t in range(T):
|
|
281
|
+
wc = np.array([pose[t, b, :3] + quat_rotate(pose[t, b, 3:7], lc[b]) for b in range(len(bodies))])
|
|
282
|
+
out[t, 0] = (m[:, None] * wc).sum(axis=0) / M
|
|
283
|
+
return out.astype(np.float32)
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
SELFCOL_RENDER_GROUP = 7 # its own group so the collider can be toggled off in the viewer
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
def selfcol_shown():
|
|
290
|
+
"""Whether renders SHOW the self-collision colliders by default. Design note, 2026-09-26: "turn the self collider
|
|
291
|
+
off in every render unless I explicitly ask for it" -- the translucent capsules overlapped the limbs oddly. They
|
|
292
|
+
are still written into the .dnrec and listed in its header's geom_groups_default (the file bytes do not depend on
|
|
293
|
+
this preference), and the offline renderer (renderer.make_scene: to_mp4 / snapshot / strobe) drops the group;
|
|
294
|
+
DN_RENDER_SELFCOL=1, or naming the group in --geom-groups, shows them."""
|
|
295
|
+
return os.environ.get("DN_RENDER_SELFCOL") == "1"
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
def _quat_from_z_to(v):
|
|
299
|
+
"""Unit quaternion taking local +z onto the unit vector v (shortest arc)."""
|
|
300
|
+
c = float(v[2])
|
|
301
|
+
if c > 1 - 1e-12:
|
|
302
|
+
return [1.0, 0.0, 0.0, 0.0]
|
|
303
|
+
if c < -1 + 1e-12:
|
|
304
|
+
return [0.0, 1.0, 0.0, 0.0] # 180 deg about x
|
|
305
|
+
ax = np.cross([0.0, 0.0, 1.0], v)
|
|
306
|
+
sq = np.sqrt((1 + c) * 2)
|
|
307
|
+
q = np.array([sq * 0.5, ax[0] / sq, ax[1] / sq, ax[2] / sq])
|
|
308
|
+
return [float(x) for x in q / np.linalg.norm(q)]
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
def render_bodies_from_visual_geoms(jm):
|
|
312
|
+
"""Build the write_dnrec `bodies` list (one {name, geoms} per engine body) from the .dnmodel's
|
|
313
|
+
top-level ``visual_geoms`` block — the SINGLE source of render geometry, carried WITH the model.
|
|
314
|
+
|
|
315
|
+
Fail-fast on purpose (dev-rules: no fallback): a model with no ``visual_geoms`` or zero geoms is a
|
|
316
|
+
hard error, NOT a cue to synthesize placeholder spheres. Synthesizing "dots" from mass/COM is exactly
|
|
317
|
+
the recurring bug this replaces — a physics model must not render as fake geometry. Add the real
|
|
318
|
+
capsules/spheres to the model (see tools/export_humanoid.py's visual_geoms emission) instead.
|
|
319
|
+
"""
|
|
320
|
+
assert "visual_geoms" in jm, (
|
|
321
|
+
"dnmodel has no 'visual_geoms' block — the renderer needs real per-body geometry carried in the "
|
|
322
|
+
"model (see tools/export_humanoid.py). Refusing to synthesize placeholder spheres.")
|
|
323
|
+
vg = jm["visual_geoms"]
|
|
324
|
+
assert len(vg) == len(jm["bodies"]), (len(vg), len(jm["bodies"]))
|
|
325
|
+
size_len = {"capsule": 2, "sphere": 1, "box": 3} # type -> expected len(size)
|
|
326
|
+
bodies = []
|
|
327
|
+
for i, v in enumerate(vg):
|
|
328
|
+
geoms = [dict(g) for g in v.get("geoms", [])]
|
|
329
|
+
for g in v.get("geoms", []):
|
|
330
|
+
t = g.get("type")
|
|
331
|
+
if t == "mesh":
|
|
332
|
+
# STL bone mesh: an .stl file (abs or repo-relative) drawn under the body frame
|
|
333
|
+
# by TRS(pos, quat, scale). The renderer loads the raw mesh via meshes.load_stl.
|
|
334
|
+
assert isinstance(g.get("file"), str) and g["file"], f"body {i}: mesh geom needs a 'file' path"
|
|
335
|
+
assert len(g.get("scale", [])) == 3, f"body {i}: mesh geom needs scale[3]"
|
|
336
|
+
else:
|
|
337
|
+
assert t in size_len, f"body {i}: unsupported visual geom type {t!r} (capsule/sphere/box/mesh only)"
|
|
338
|
+
assert len(g.get("size", [])) == size_len[t], f"body {i}: {t} size must have {size_len[t]} element(s)"
|
|
339
|
+
assert len(g.get("pos", [])) == 3 and len(g.get("quat", [])) == 4 and len(g.get("rgba", [])) == 4, \
|
|
340
|
+
f"body {i}: each visual geom needs pos[3], quat[4], rgba[4]"
|
|
341
|
+
if "group" in g:
|
|
342
|
+
group = int(g["group"])
|
|
343
|
+
assert group >= 0 and float(g["group"]) == float(group), f"body {i}: geom group must be a non-negative int"
|
|
344
|
+
bodies.append({"name": v.get("name", f"B{i}"), "geoms": geoms})
|
|
345
|
+
|
|
346
|
+
# Optional contact-visual overlay. Physics still consumes only contact.{body,center,radius};
|
|
347
|
+
# render_group/render_rgba are renderer metadata so collision spheres can stay in a separate
|
|
348
|
+
# toggleable group while being visible in ordinary renders.
|
|
349
|
+
contact = jm.get("contact", {})
|
|
350
|
+
for gi, g in enumerate(contact.get("geoms", []) if isinstance(contact, dict) else []):
|
|
351
|
+
if "render_group" not in g:
|
|
352
|
+
continue
|
|
353
|
+
assert g.get("type") == "sphere", f"contact geom {gi}: renderable contact geoms must be sphere"
|
|
354
|
+
body = int(g["body"])
|
|
355
|
+
assert 0 <= body < len(bodies), f"contact geom {gi}: body index out of range"
|
|
356
|
+
group = int(g["render_group"])
|
|
357
|
+
assert group >= 0 and float(g["render_group"]) == float(group), (
|
|
358
|
+
f"contact geom {gi}: render_group must be a non-negative int")
|
|
359
|
+
rgba = g.get("render_rgba", [1.0, 0.58, 0.04, 0.78])
|
|
360
|
+
assert len(rgba) == 4, f"contact geom {gi}: render_rgba must be rgba[4]"
|
|
361
|
+
# render_radius is a display-only size (physics still uses the true contact radius). Real
|
|
362
|
+
# contact spheres are often ~1cm, which is nearly invisible and occluded by the limb geom; a
|
|
363
|
+
# slightly larger render_radius lets the collider be seen as a distinct marker.
|
|
364
|
+
render_radius = float(g.get("render_radius", g["radius"]))
|
|
365
|
+
assert render_radius > 0.0, f"contact geom {gi}: render_radius must be > 0"
|
|
366
|
+
bodies[body]["geoms"].append({
|
|
367
|
+
"type": "sphere",
|
|
368
|
+
"size": [render_radius],
|
|
369
|
+
"pos": [float(x) for x in g["center"]],
|
|
370
|
+
"quat": [1.0, 0.0, 0.0, 0.0],
|
|
371
|
+
"rgba": [float(x) for x in rgba],
|
|
372
|
+
"group": group,
|
|
373
|
+
"collider": "sphere",
|
|
374
|
+
})
|
|
375
|
+
# SELF-COLLISION overlay, same idea as the contact one above: collision-only shapes drawn into a
|
|
376
|
+
# separate group so they can be toggled. Unlike the contact spheres this needs no per-geom opt-in --
|
|
377
|
+
# a self_collision block exists only to constrain the body, and "how big is the collider" is a
|
|
378
|
+
# question you answer by looking at it. Set DN_RENDER_SELFCOL=0 to leave them out of the file; renders hide
|
|
379
|
+
# them by default either way (renderer.make_scene; see selfcol_shown).
|
|
380
|
+
#
|
|
381
|
+
# A shape is a segment plus a radius; the renderer's capsule is built along local +z and centred, so
|
|
382
|
+
# p0 -> p1 becomes a capsule at the midpoint rotated from +z onto (p1 - p0). p0 == p1 is a sphere,
|
|
383
|
+
# which is what a zero-length capsule is.
|
|
384
|
+
if os.environ.get("DN_RENDER_SELFCOL", "1") != "0":
|
|
385
|
+
seen = set()
|
|
386
|
+
for pair in jm.get("self_collision", {}).get("pairs", []):
|
|
387
|
+
for side in ("a", "b"):
|
|
388
|
+
sh = pair[side]
|
|
389
|
+
key = (sh["body"], tuple(sh["p0"]), tuple(sh["p1"]), sh["radius"])
|
|
390
|
+
if key in seen: # the same shape appears in several pairs
|
|
391
|
+
continue
|
|
392
|
+
seen.add(key)
|
|
393
|
+
b_i = int(sh["body"])
|
|
394
|
+
assert 0 <= b_i < len(bodies), f"self_collision: body index {b_i} out of range"
|
|
395
|
+
p0 = np.asarray(sh["p0"], float); p1 = np.asarray(sh["p1"], float)
|
|
396
|
+
seg = p1 - p0
|
|
397
|
+
L = float(np.linalg.norm(seg))
|
|
398
|
+
g = {"pos": [float(x) for x in (p0 + p1) * 0.5],
|
|
399
|
+
"rgba": [0.20, 0.85, 1.00, 0.12], "group": SELFCOL_RENDER_GROUP,
|
|
400
|
+
"collider": "self"}
|
|
401
|
+
if L < 1e-9:
|
|
402
|
+
g.update(type="sphere", size=[float(sh["radius"])], quat=[1.0, 0.0, 0.0, 0.0])
|
|
403
|
+
else:
|
|
404
|
+
g.update(type="capsule", size=[float(sh["radius"]), L * 0.5],
|
|
405
|
+
quat=_quat_from_z_to(seg / L))
|
|
406
|
+
bodies[b_i]["geoms"].append(g)
|
|
407
|
+
|
|
408
|
+
total = sum(len(b["geoms"]) for b in bodies)
|
|
409
|
+
assert total > 0, "visual_geoms is present but empty (0 geoms) — nothing to render"
|
|
410
|
+
return bodies
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
def default_geom_groups(bodies):
|
|
414
|
+
# every group present, the self-collider's included: this is WRITTEN into the .dnrec header, so it must not
|
|
415
|
+
# depend on a render preference (a re-eval would stop being byte-identical to the rollouts pinned in
|
|
416
|
+
# docs/repro/). The self-collider is hidden at RENDER time instead (renderer.make_scene, selfcol_shown).
|
|
417
|
+
groups = sorted({int(g.get("group", 0)) for b in bodies for g in b.get("geoms", [])})
|
|
418
|
+
return groups if groups else [0]
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
def motion_half_extent(pose, floor=2.5, margin=1.5):
|
|
422
|
+
"""Ground-patch half-extent that ENCLOSES the motion's x/y reach, so a translating clip keeps a
|
|
423
|
+
floor under it (the writer's default patch is fixed at 2.0). `floor` = minimum half-extent,
|
|
424
|
+
`margin` = padding beyond the farthest body. Pass the result as `write_dnrec(ground_half_extent=)`."""
|
|
425
|
+
px, py = pose[:, :, 0], pose[:, :, 1]
|
|
426
|
+
reach = max(abs(float(px.max())), abs(float(px.min())), abs(float(py.max())), abs(float(py.min())))
|
|
427
|
+
return max(floor, reach + margin)
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
def write_dnrec(path, pose, qvel, mtu_poly, activation, contact, bodies, dt, scene="fullbody_contact",
|
|
431
|
+
qpos=None, lce_source=None, ground_half_extent=None,
|
|
432
|
+
caption=None, camera=None, root_index=None,
|
|
433
|
+
model=None, provenance=None, z=None, tau=None, act=None, reward=None, com=None, ground_rgba=None):
|
|
434
|
+
"""Write a .dnrec physical trace. `lce_source` records the PROVENANCE of the l_ce slot in the
|
|
435
|
+
activation channel [A, radius_vol, l_mtu, l_ce]: "sim" = real simulated fiber
|
|
436
|
+
length (physical MTU state); "render_default_l_opt" = a render-only default derived from the
|
|
437
|
+
muscle's optimal fiber length (NOT physical -- training/analysis must not treat it as fiber state);
|
|
438
|
+
None = no muscles / no l_ce written. Consumers that need physical MTU state assert
|
|
439
|
+
header["lce_source"] == "sim". `ground_half_extent` overrides the default 2.0 ground patch (use
|
|
440
|
+
`motion_half_extent(pose)` to enclose a translating clip) -- no post-write header re-pack needed.
|
|
441
|
+
|
|
442
|
+
`caption` (optional list[str]) and `camera` (optional dict with yaw/pitch/dist[,z_lift]) stamp
|
|
443
|
+
header["caption"] / header["camera"] so a producer can declare its own on-screen caption and camera
|
|
444
|
+
framing instead of relying on the viewer's built-in per-scene tables (tools/viz/hud.SCENE_CAPTIONS,
|
|
445
|
+
tools/viz/camera.SCENE_CAM) -- those tables are generic fallbacks, used only when a clip omits these
|
|
446
|
+
fields. `root_index` (optional int, index into `bodies`) declares which body the viewer's live
|
|
447
|
+
readouts treat as "the" root/base (e.g. forward-speed); omitted -> the viewer defaults to body 0.
|
|
448
|
+
All three default to None (omitted from the header), so existing callers/clips are unaffected.
|
|
449
|
+
|
|
450
|
+
SELF-CONTAINED RECORD (v2, dnrec-format.md / issue #1): `model` embeds the FULL .dnmodel dict into
|
|
451
|
+
header["model"] so the clip replays AND renders standalone (no companion .dnmodel); `provenance` is a
|
|
452
|
+
free-form dict (producer/git_sha/...). The extra STATE channels are the record's full sim state:
|
|
453
|
+
`z` (stiction anchor, (frames, nz)), `tau` (applied generalized force, (frames, nv) -- the control
|
|
454
|
+
input a torque run needs for exact replay), `act` (raw policy action, (frames, na)), `reward`
|
|
455
|
+
((frames,)). Each is written only when given. Presence of ANY v2 field (model/provenance/z/tau/act/
|
|
456
|
+
reward) stamps format version 2; otherwise version stays 1 (byte-compatible with pre-v2 clips).
|
|
457
|
+
All v2 params default to None, so existing callers/clips are unaffected."""
|
|
458
|
+
assert lce_source in (None, "sim", "render_default_l_opt"), lce_source
|
|
459
|
+
pose = np.asarray(pose, dtype="<f4")
|
|
460
|
+
if qpos is None:
|
|
461
|
+
qpos = np.zeros((pose.shape[0], 0), dtype="<f4")
|
|
462
|
+
qpos = np.asarray(qpos, dtype="<f4")
|
|
463
|
+
qvel = np.asarray(qvel, dtype="<f4")
|
|
464
|
+
mtu_poly = np.asarray(mtu_poly, dtype="<f4")
|
|
465
|
+
activation = np.asarray(activation, dtype="<f4")
|
|
466
|
+
contact = np.asarray(contact, dtype="<f4")
|
|
467
|
+
frames, nb, _ = pose.shape
|
|
468
|
+
assert nb == len(bodies)
|
|
469
|
+
assert qpos.shape[0] == frames
|
|
470
|
+
assert qvel.shape[0] == frames
|
|
471
|
+
assert mtu_poly.shape[0] == frames
|
|
472
|
+
assert activation.shape[0] == frames
|
|
473
|
+
assert contact.shape[0] == frames
|
|
474
|
+
stride = nb * 7
|
|
475
|
+
nq = qpos.shape[1]
|
|
476
|
+
nv = qvel.shape[1]
|
|
477
|
+
nm = mtu_poly.shape[1]
|
|
478
|
+
poly_stride = mtu_poly.shape[2]
|
|
479
|
+
channels = {
|
|
480
|
+
"pose": {"offset": 0, "stride_floats": 7, "count": nb},
|
|
481
|
+
"qpos": {"offset": stride, "stride_floats": 1, "count": nq},
|
|
482
|
+
}
|
|
483
|
+
blocks = [pose.reshape(frames, nb * 7), qpos.reshape(frames, nq)]
|
|
484
|
+
stride += nq
|
|
485
|
+
channels.update({
|
|
486
|
+
"qvel": {"offset": stride, "stride_floats": 1, "count": nv},
|
|
487
|
+
})
|
|
488
|
+
blocks.append(qvel.reshape(frames, nv))
|
|
489
|
+
stride += nv
|
|
490
|
+
if z is not None: # stiction anchor state (v2 replay); (frames, nz)
|
|
491
|
+
z = np.asarray(z, dtype="<f4"); assert z.shape[0] == frames, (z.shape, frames)
|
|
492
|
+
z = z.reshape(frames, -1); nz = z.shape[1]
|
|
493
|
+
channels["z"] = {"offset": stride, "stride_floats": 1, "count": nz}
|
|
494
|
+
blocks.append(z); stride += nz
|
|
495
|
+
channels["mtu_poly"] = {"offset": stride, "stride_floats": poly_stride, "count": nm}
|
|
496
|
+
blocks.append(mtu_poly.reshape(frames, nm * poly_stride))
|
|
497
|
+
stride += nm * poly_stride
|
|
498
|
+
# The activation channel carries its OWN count. It equals nm for every artifact built with the render
|
|
499
|
+
# geometry, but a LIGHT one (DN_DNREC_MTU=0, rl_env_render.light_muscle_channels) has no
|
|
500
|
+
# polylines and still has one activation row per muscle. The header already declares the two counts
|
|
501
|
+
# separately; only this line used to tie them together.
|
|
502
|
+
na = int(activation.shape[1])
|
|
503
|
+
assert nm in (0, na), f"mtu_poly has {nm} muscles but activation has {na}"
|
|
504
|
+
channels["activation"] = {"offset": stride, "stride_floats": 4, "count": na}
|
|
505
|
+
blocks.append(activation.reshape(frames, na * 4))
|
|
506
|
+
stride += na * 4
|
|
507
|
+
if contact.shape[1] > 0:
|
|
508
|
+
channels["contact"] = {"offset": stride, "stride_floats": 7, "count": contact.shape[1]}
|
|
509
|
+
blocks.append(contact.reshape(frames, contact.shape[1] * 7))
|
|
510
|
+
stride += contact.shape[1] * 7
|
|
511
|
+
if com is not None: # whole-body COM track (T,1,3) for the COM-trail overlay
|
|
512
|
+
com = np.asarray(com, dtype="<f4").reshape(frames, 3)
|
|
513
|
+
channels["com"] = {"offset": stride, "stride_floats": 3, "count": 1}
|
|
514
|
+
blocks.append(com); stride += 3
|
|
515
|
+
for _name, _arr in (("tau", tau), ("act", act), ("reward", reward)): # v2 record channels
|
|
516
|
+
if _arr is None:
|
|
517
|
+
continue
|
|
518
|
+
a = np.asarray(_arr, dtype="<f4"); assert a.shape[0] == frames, (_name, a.shape, frames)
|
|
519
|
+
a = a.reshape(frames, -1); c = a.shape[1]
|
|
520
|
+
channels[_name] = {"offset": stride, "stride_floats": 1, "count": c}
|
|
521
|
+
blocks.append(a); stride += c
|
|
522
|
+
header = {
|
|
523
|
+
"scene": scene,
|
|
524
|
+
"dt": float(dt),
|
|
525
|
+
"n_frames": int(frames),
|
|
526
|
+
"n_bodies": int(nb),
|
|
527
|
+
"bodies": bodies,
|
|
528
|
+
"geom_groups_default": default_geom_groups(bodies),
|
|
529
|
+
"ground": {"z": 0.0, "half_extent": 2.0 if ground_half_extent is None else float(ground_half_extent),
|
|
530
|
+
"rgba": [0.42, 0.43, 0.48, 1.0] if ground_rgba is None else [float(x) for x in ground_rgba]},
|
|
531
|
+
"frame": {"stride_floats": int(stride), "channels": channels},
|
|
532
|
+
}
|
|
533
|
+
if lce_source is not None:
|
|
534
|
+
header["lce_source"] = lce_source
|
|
535
|
+
if caption is not None:
|
|
536
|
+
assert isinstance(caption, (list, tuple)) and all(isinstance(x, str) for x in caption), caption
|
|
537
|
+
header["caption"] = list(caption)
|
|
538
|
+
if camera is not None:
|
|
539
|
+
assert isinstance(camera, dict) and {"yaw", "pitch", "dist"} <= set(camera), camera
|
|
540
|
+
header["camera"] = {k: float(v) for k, v in camera.items()}
|
|
541
|
+
if root_index is not None:
|
|
542
|
+
ri = int(root_index)
|
|
543
|
+
assert float(root_index) == float(ri) and 0 <= ri < len(bodies), (root_index, len(bodies))
|
|
544
|
+
header["root_index"] = ri
|
|
545
|
+
if model is not None: # embed the full .dnmodel -> self-contained (v2)
|
|
546
|
+
assert isinstance(model, dict) and "bodies" in model, "model must be the parsed .dnmodel dict"
|
|
547
|
+
header["model"] = model
|
|
548
|
+
if provenance is not None:
|
|
549
|
+
assert isinstance(provenance, dict), provenance
|
|
550
|
+
header["provenance"] = provenance
|
|
551
|
+
# Presence of ANY v2 field bumps the format version; else stay v1 (byte-IDENTICAL to old clips:
|
|
552
|
+
# v1 keeps no header "version" key, as before; the struct prefix carries the version for both).
|
|
553
|
+
version = 2 if any(x is not None for x in (model, provenance, z, tau, act, reward)) else 1
|
|
554
|
+
if version == 2:
|
|
555
|
+
header["version"] = 2
|
|
556
|
+
hb = json.dumps(header).encode("utf-8")
|
|
557
|
+
with open(path, "wb") as f:
|
|
558
|
+
f.write(MAGIC)
|
|
559
|
+
f.write(struct.pack("<II", version, len(hb)))
|
|
560
|
+
f.write(hb)
|
|
561
|
+
f.write(np.concatenate(blocks, axis=1).astype("<f4").tobytes())
|
|
562
|
+
return path
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
def load_dnrec(path):
|
|
566
|
+
"""Read a .dnrec back into numpy (torch-free) -- the record-consumer side of the format (analysis,
|
|
567
|
+
replay). Returns dict(header, model, dt, n_frames, version, channels). `model` is the embedded
|
|
568
|
+
.dnmodel dict (v2) or None (v1 -> a .dnmodel must be supplied separately). `channels[name]` is
|
|
569
|
+
(frames, count) for scalar-stride channels (qpos/qvel/z/tau/act/reward) or (frames, count,
|
|
570
|
+
stride_floats) for structured ones (pose=7, activation=4, contact=7, mtu_poly). Handles both v1 and
|
|
571
|
+
v2 clips."""
|
|
572
|
+
with open(path, "rb") as f:
|
|
573
|
+
raw = f.read()
|
|
574
|
+
assert raw[:4] == MAGIC, (raw[:4],)
|
|
575
|
+
version, hlen = struct.unpack_from("<II", raw, 4)
|
|
576
|
+
assert version in (1, 2), f"unsupported .dnrec version {version}"
|
|
577
|
+
header = json.loads(raw[12:12 + hlen])
|
|
578
|
+
fr = header["frame"]; stride = int(fr["stride_floats"]); nfr = int(header["n_frames"])
|
|
579
|
+
flat = np.frombuffer(raw[12 + hlen:], dtype="<f4").reshape(nfr, stride)
|
|
580
|
+
channels = {}
|
|
581
|
+
for name, spec in fr["channels"].items():
|
|
582
|
+
off, sf, cnt = int(spec["offset"]), int(spec["stride_floats"]), int(spec["count"])
|
|
583
|
+
block = flat[:, off:off + cnt * sf]
|
|
584
|
+
channels[name] = block.reshape(nfr, cnt) if sf == 1 else block.reshape(nfr, cnt, sf)
|
|
585
|
+
return dict(header=header, model=header.get("model"), dt=float(header["dt"]),
|
|
586
|
+
n_frames=nfr, version=version, channels=channels)
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
def set_provenance(path, extra):
|
|
590
|
+
"""Merge `extra` (a JSON-serializable dict) into a v2 `.dnrec` header's ``provenance`` block, in
|
|
591
|
+
place -- folds a record's non-state metadata (training curve / eval log / wall-time / n_env /
|
|
592
|
+
stiction params) INTO the single self-contained file so no companion `.npz` is needed
|
|
593
|
+
(dnrec-format.md P4). Rewrites the file: the JSON header length changes and shifts the frame offset,
|
|
594
|
+
so the float32 frame block is read then written back verbatim (byte-for-byte)."""
|
|
595
|
+
path = str(path)
|
|
596
|
+
assert is_record(path), path
|
|
597
|
+
assert isinstance(extra, dict), extra
|
|
598
|
+
with open(path, "rb") as f:
|
|
599
|
+
raw = f.read()
|
|
600
|
+
assert raw[:4] == MAGIC, (raw[:4],)
|
|
601
|
+
version, hlen = struct.unpack_from("<II", raw, 4)
|
|
602
|
+
assert version == 2, f"provenance requires a v2 record (with model/state); got version {version}"
|
|
603
|
+
header = json.loads(raw[12:12 + hlen])
|
|
604
|
+
frames = raw[12 + hlen:] # float32 block -- preserved verbatim
|
|
605
|
+
header.setdefault("provenance", {}).update(extra)
|
|
606
|
+
hb = json.dumps(header).encode("utf-8")
|
|
607
|
+
with open(path, "wb") as f:
|
|
608
|
+
f.write(MAGIC)
|
|
609
|
+
f.write(struct.pack("<II", version, len(hb)))
|
|
610
|
+
f.write(hb)
|
|
611
|
+
f.write(frames)
|
|
612
|
+
return path
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
def set_task(path, task):
|
|
616
|
+
"""Stamp a steering record's TASK into its `.dnrec` header (header["task"]), in place, so the renderer draws the live map and
|
|
617
|
+
the task readout (hud.task_track). `task`: {"mode": "target" | "schedule" | "straight" | "random", "label": str, "targets":
|
|
618
|
+
[[x, y], ...] (metres in the start pose's frame, x ahead, y left), "radius": m, "speeds": [m/s per waypoint] (optional),
|
|
619
|
+
"schedule": [[t_s, deg_left], ...] or [[t_s, deg_left, v], ...] (a per-segment speed), "v_fixed": m/s, "footsteps": per
|
|
620
|
+
frame [p0x, p0y, p1x, p1y, heading, provisional, left] (WORLD, TASKWALK_FOOTSTEPS; optional, required for "random": the
|
|
621
|
+
plan is the only map a random command has)}. The frame block is preserved byte-for-byte (as set_provenance)."""
|
|
622
|
+
path = str(path)
|
|
623
|
+
assert is_record(path), path
|
|
624
|
+
assert isinstance(task, dict) and task.get("mode") in ("target", "schedule", "straight", "random"), task
|
|
625
|
+
if task["mode"] == "target":
|
|
626
|
+
assert task.get("targets") and all(len(t) == 2 for t in task["targets"]), task
|
|
627
|
+
if task["mode"] == "schedule":
|
|
628
|
+
assert task.get("schedule") and all(len(t) in (2, 3) for t in task["schedule"]), task
|
|
629
|
+
if task["mode"] == "random":
|
|
630
|
+
assert task.get("footsteps") and all(len(r) == 7 for r in task["footsteps"]), task
|
|
631
|
+
with open(path, "rb") as f:
|
|
632
|
+
raw = f.read()
|
|
633
|
+
assert raw[:4] == MAGIC, (raw[:4],)
|
|
634
|
+
version, hlen = struct.unpack_from("<II", raw, 4)
|
|
635
|
+
header = json.loads(raw[12:12 + hlen])
|
|
636
|
+
frames = raw[12 + hlen:]
|
|
637
|
+
header["task"] = task
|
|
638
|
+
hb = json.dumps(header).encode("utf-8")
|
|
639
|
+
with open(path, "wb") as f:
|
|
640
|
+
f.write(MAGIC)
|
|
641
|
+
f.write(struct.pack("<II", version, len(hb)))
|
|
642
|
+
f.write(hb)
|
|
643
|
+
f.write(frames)
|
|
644
|
+
return path
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
def load_record(path):
|
|
648
|
+
"""Read a recorded rollout as a canonical numpy dict from EITHER a v2 `.dnrec` record OR a legacy
|
|
649
|
+
`.npz` -- the migration bridge (dnrec-format.md P2). A consumer swaps `np.load(p)` -> `load_record(p)`
|
|
650
|
+
and reads the same keys regardless of format, so producer/consumer migration is order-independent and
|
|
651
|
+
dropping the `.npz` later is transparent. Canonical keys (present when the record carries them):
|
|
652
|
+
`q` (=qpos), `qd` (=qvel), `z`, `lce`, `activation` (the A scalar), `action`, `reward`, `tau`, `dt`,
|
|
653
|
+
and `model` (the embedded .dnmodel, `.dnrec` v2 only). A `.npz` is returned key-for-key as written."""
|
|
654
|
+
path = str(path)
|
|
655
|
+
if not is_record(path):
|
|
656
|
+
with np.load(path) as z: # legacy .npz: pass through verbatim
|
|
657
|
+
return {k: z[k] for k in z.files}
|
|
658
|
+
d = load_dnrec(path)
|
|
659
|
+
ch = d["channels"]
|
|
660
|
+
out = {"dt": d["dt"]}
|
|
661
|
+
if d["model"] is not None:
|
|
662
|
+
out["model"] = d["model"]
|
|
663
|
+
if "qpos" in ch: out["q"] = ch["qpos"]
|
|
664
|
+
if "qvel" in ch: out["qd"] = ch["qvel"]
|
|
665
|
+
if "z" in ch: out["z"] = ch["z"]
|
|
666
|
+
if "activation" in ch: # activation channel = [A, radius_vol, l_mtu, l_ce]
|
|
667
|
+
out["activation"] = ch["activation"][:, :, 0] # the A scalar (what the .npz stored)
|
|
668
|
+
if d["header"].get("lce_source") == "sim": # l_ce is a real fiber state only if sim-provenance
|
|
669
|
+
out["lce"] = ch["activation"][:, :, 3]
|
|
670
|
+
if "tau" in ch: out["tau"] = ch["tau"]
|
|
671
|
+
if "act" in ch: out["action"] = ch["act"]
|
|
672
|
+
if "reward" in ch: out["reward"] = ch["reward"].reshape(d["n_frames"])
|
|
673
|
+
if "contact" in ch: # unpack the contact channel [witness3, force3, fn]
|
|
674
|
+
c = ch["contact"] # (nc, 7); RAW engine force -- the swing/stance
|
|
675
|
+
nf = d["n_frames"] # legibility floor is a RENDER-time skip, not stored
|
|
676
|
+
out["contact_witness"] = c[:, :, 0:3].reshape(nf, -1)
|
|
677
|
+
out["contact_force"] = c[:, :, 3:6].reshape(nf, -1)
|
|
678
|
+
prov = d["header"].get("provenance", {}) # layer-4 metadata (dnrec-format.md)
|
|
679
|
+
if prov:
|
|
680
|
+
out["provenance"] = prov
|
|
681
|
+
# Fold the training telemetry (curve/eval_log/n_env/steps_num/train_wall/reset_height/stick_*)
|
|
682
|
+
# to top-level so a metadata consumer reads the SAME keys whether the record is a `.npz` (keys
|
|
683
|
+
# are top-level) or a self-contained `.dnrec` (keys live under provenance.training) -- P4.
|
|
684
|
+
for k, v in prov.get("training", {}).items():
|
|
685
|
+
out[k] = np.asarray(v) if isinstance(v, list) else v
|
|
686
|
+
return out
|