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,513 @@
|
|
|
1
|
+
"""Allocation-readable Stage-1 reference semantics.
|
|
2
|
+
|
|
3
|
+
This module intentionally expresses the public mjlab task as ordinary PyTorch.
|
|
4
|
+
The optimized task keeps this implementation as the differential oracle for its
|
|
5
|
+
Warp kernels and graph-captured runtime.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from collections.abc import Mapping
|
|
11
|
+
from dataclasses import dataclass
|
|
12
|
+
|
|
13
|
+
import torch
|
|
14
|
+
import torch.nn.functional as functional
|
|
15
|
+
|
|
16
|
+
from instantmimic.motion.quaternion import (
|
|
17
|
+
quat_conj as _quat_conjugate,
|
|
18
|
+
)
|
|
19
|
+
from instantmimic.motion.quaternion import (
|
|
20
|
+
quat_inverse,
|
|
21
|
+
)
|
|
22
|
+
from instantmimic.motion.quaternion import (
|
|
23
|
+
quat_mul as quat_multiply,
|
|
24
|
+
)
|
|
25
|
+
from instantmimic.motion.quaternion import (
|
|
26
|
+
quat_rotate as quat_apply,
|
|
27
|
+
)
|
|
28
|
+
from instantmimic.motion.quaternion import (
|
|
29
|
+
quat_rotate_inverse as quat_apply_inverse,
|
|
30
|
+
)
|
|
31
|
+
from instantmimic.motion.quaternion import (
|
|
32
|
+
quat_to_matrix as quaternion_to_matrix, # noqa: F401
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
ACTION_DIM = 29
|
|
36
|
+
MOTION_COMMAND_DIM = 58
|
|
37
|
+
TRACKED_BODY_COUNT = 14
|
|
38
|
+
END_EFFECTOR_COUNT = 4
|
|
39
|
+
ACTOR_OBSERVATION_DIM = 160
|
|
40
|
+
CRITIC_OBSERVATION_DIM = 286
|
|
41
|
+
|
|
42
|
+
REWARD_WEIGHTS: Mapping[str, float] = {
|
|
43
|
+
"anchor_position": 0.5,
|
|
44
|
+
"anchor_orientation": 0.5,
|
|
45
|
+
"body_position": 1.0,
|
|
46
|
+
"body_orientation": 1.0,
|
|
47
|
+
"body_linear_velocity": 1.0,
|
|
48
|
+
"body_angular_velocity": 1.0,
|
|
49
|
+
"action_rate": -0.1,
|
|
50
|
+
"joint_limit": -10.0,
|
|
51
|
+
"self_collision": -10.0,
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _validate_width(name: str, value: torch.Tensor, width: int) -> None:
|
|
56
|
+
if value.ndim != 2 or value.shape[-1] != width:
|
|
57
|
+
raise ValueError(
|
|
58
|
+
f"{name} must have shape (batch, {width}); got {tuple(value.shape)}"
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def yaw_quaternion(quaternion: torch.Tensor) -> torch.Tensor:
|
|
63
|
+
w, x, y, z = quaternion.unbind(dim=-1)
|
|
64
|
+
yaw = torch.atan2(2.0 * (w * z + x * y), 1.0 - 2.0 * (y.square() + z.square()))
|
|
65
|
+
half_yaw = 0.5 * yaw
|
|
66
|
+
zeros = torch.zeros_like(half_yaw)
|
|
67
|
+
return torch.stack((torch.cos(half_yaw), zeros, zeros, torch.sin(half_yaw)), dim=-1)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def quaternion_error_magnitude(
|
|
71
|
+
first: torch.Tensor, second: torch.Tensor
|
|
72
|
+
) -> torch.Tensor:
|
|
73
|
+
error = quat_multiply(first, _quat_conjugate(second))
|
|
74
|
+
error = torch.where(error[..., :1] < 0.0, -error, error)
|
|
75
|
+
vector_norm = torch.linalg.vector_norm(error[..., 1:], dim=-1)
|
|
76
|
+
angle = 2.0 * torch.atan2(vector_norm, error[..., 0].clamp_min(1e-12))
|
|
77
|
+
return angle
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def euler_xyz_to_quaternion(euler: torch.Tensor) -> torch.Tensor:
|
|
81
|
+
roll, pitch, yaw = (0.5 * euler).unbind(dim=-1)
|
|
82
|
+
cr, sr = torch.cos(roll), torch.sin(roll)
|
|
83
|
+
cp, sp = torch.cos(pitch), torch.sin(pitch)
|
|
84
|
+
cy, sy = torch.cos(yaw), torch.sin(yaw)
|
|
85
|
+
return torch.stack(
|
|
86
|
+
(
|
|
87
|
+
cr * cp * cy + sr * sp * sy,
|
|
88
|
+
sr * cp * cy - cr * sp * sy,
|
|
89
|
+
cr * sp * cy + sr * cp * sy,
|
|
90
|
+
cr * cp * sy - sr * sp * cy,
|
|
91
|
+
),
|
|
92
|
+
dim=-1,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def motion_relative_to_robot_anchor(
|
|
97
|
+
*,
|
|
98
|
+
robot_anchor_position: torch.Tensor,
|
|
99
|
+
robot_anchor_quaternion: torch.Tensor,
|
|
100
|
+
reference_anchor_position: torch.Tensor,
|
|
101
|
+
reference_anchor_quaternion: torch.Tensor,
|
|
102
|
+
reference_body_position: torch.Tensor,
|
|
103
|
+
reference_body_quaternion: torch.Tensor,
|
|
104
|
+
) -> tuple[torch.Tensor, torch.Tensor]:
|
|
105
|
+
"""Align a reference frame's yaw and horizontal origin to the robot."""
|
|
106
|
+
|
|
107
|
+
delta_position = robot_anchor_position.clone()
|
|
108
|
+
delta_position[..., 2] = reference_anchor_position[..., 2]
|
|
109
|
+
delta_orientation = yaw_quaternion(
|
|
110
|
+
quat_multiply(
|
|
111
|
+
robot_anchor_quaternion,
|
|
112
|
+
quat_inverse(reference_anchor_quaternion),
|
|
113
|
+
)
|
|
114
|
+
)
|
|
115
|
+
relative_offset = reference_body_position - reference_anchor_position[:, None, :]
|
|
116
|
+
target_position = delta_position[:, None, :] + quat_apply(
|
|
117
|
+
delta_orientation[:, None, :], relative_offset
|
|
118
|
+
)
|
|
119
|
+
target_quaternion = quat_multiply(
|
|
120
|
+
delta_orientation[:, None, :], reference_body_quaternion
|
|
121
|
+
)
|
|
122
|
+
return target_position, target_quaternion
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
@dataclass(frozen=True)
|
|
126
|
+
class ObservationNoise:
|
|
127
|
+
anchor_position: torch.Tensor
|
|
128
|
+
anchor_orientation: torch.Tensor
|
|
129
|
+
base_linear_velocity: torch.Tensor
|
|
130
|
+
base_angular_velocity: torch.Tensor
|
|
131
|
+
joint_position: torch.Tensor
|
|
132
|
+
joint_velocity: torch.Tensor
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def assemble_actor_observation(
|
|
136
|
+
*,
|
|
137
|
+
command: torch.Tensor,
|
|
138
|
+
anchor_position: torch.Tensor,
|
|
139
|
+
anchor_orientation: torch.Tensor,
|
|
140
|
+
base_linear_velocity: torch.Tensor,
|
|
141
|
+
base_angular_velocity: torch.Tensor,
|
|
142
|
+
joint_position: torch.Tensor,
|
|
143
|
+
default_joint_position: torch.Tensor,
|
|
144
|
+
joint_velocity: torch.Tensor,
|
|
145
|
+
default_joint_velocity: torch.Tensor,
|
|
146
|
+
action: torch.Tensor,
|
|
147
|
+
noise: ObservationNoise | None = None,
|
|
148
|
+
) -> torch.Tensor:
|
|
149
|
+
terms = {
|
|
150
|
+
"command": command,
|
|
151
|
+
"anchor_position": anchor_position,
|
|
152
|
+
"anchor_orientation": anchor_orientation,
|
|
153
|
+
"base_linear_velocity": base_linear_velocity,
|
|
154
|
+
"base_angular_velocity": base_angular_velocity,
|
|
155
|
+
"joint_position": joint_position,
|
|
156
|
+
"default_joint_position": default_joint_position,
|
|
157
|
+
"joint_velocity": joint_velocity,
|
|
158
|
+
"default_joint_velocity": default_joint_velocity,
|
|
159
|
+
"action": action,
|
|
160
|
+
}
|
|
161
|
+
for name, width in (
|
|
162
|
+
("command", MOTION_COMMAND_DIM),
|
|
163
|
+
("anchor_position", 3),
|
|
164
|
+
("anchor_orientation", 6),
|
|
165
|
+
("base_linear_velocity", 3),
|
|
166
|
+
("base_angular_velocity", 3),
|
|
167
|
+
("joint_position", ACTION_DIM),
|
|
168
|
+
("default_joint_position", ACTION_DIM),
|
|
169
|
+
("joint_velocity", ACTION_DIM),
|
|
170
|
+
("default_joint_velocity", ACTION_DIM),
|
|
171
|
+
("action", ACTION_DIM),
|
|
172
|
+
):
|
|
173
|
+
_validate_width(name, terms[name], width)
|
|
174
|
+
|
|
175
|
+
anchor_position_term = anchor_position
|
|
176
|
+
anchor_orientation_term = anchor_orientation
|
|
177
|
+
base_linear_velocity_term = base_linear_velocity
|
|
178
|
+
base_angular_velocity_term = base_angular_velocity
|
|
179
|
+
joint_position_term = joint_position - default_joint_position
|
|
180
|
+
joint_velocity_term = joint_velocity - default_joint_velocity
|
|
181
|
+
if noise is not None:
|
|
182
|
+
anchor_position_term = anchor_position_term + noise.anchor_position
|
|
183
|
+
anchor_orientation_term = anchor_orientation_term + noise.anchor_orientation
|
|
184
|
+
base_linear_velocity_term = (
|
|
185
|
+
base_linear_velocity_term + noise.base_linear_velocity
|
|
186
|
+
)
|
|
187
|
+
base_angular_velocity_term = (
|
|
188
|
+
base_angular_velocity_term + noise.base_angular_velocity
|
|
189
|
+
)
|
|
190
|
+
joint_position_term = joint_position_term + noise.joint_position
|
|
191
|
+
joint_velocity_term = joint_velocity_term + noise.joint_velocity
|
|
192
|
+
|
|
193
|
+
observation = torch.cat(
|
|
194
|
+
(
|
|
195
|
+
command,
|
|
196
|
+
anchor_position_term,
|
|
197
|
+
anchor_orientation_term,
|
|
198
|
+
base_linear_velocity_term,
|
|
199
|
+
base_angular_velocity_term,
|
|
200
|
+
joint_position_term,
|
|
201
|
+
joint_velocity_term,
|
|
202
|
+
action,
|
|
203
|
+
),
|
|
204
|
+
dim=-1,
|
|
205
|
+
)
|
|
206
|
+
_validate_width("actor observation", observation, ACTOR_OBSERVATION_DIM)
|
|
207
|
+
return observation
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def assemble_critic_observation(
|
|
211
|
+
*,
|
|
212
|
+
command: torch.Tensor,
|
|
213
|
+
anchor_position: torch.Tensor,
|
|
214
|
+
anchor_orientation: torch.Tensor,
|
|
215
|
+
body_position: torch.Tensor,
|
|
216
|
+
body_orientation: torch.Tensor,
|
|
217
|
+
base_linear_velocity: torch.Tensor,
|
|
218
|
+
base_angular_velocity: torch.Tensor,
|
|
219
|
+
joint_position: torch.Tensor,
|
|
220
|
+
default_joint_position: torch.Tensor,
|
|
221
|
+
joint_velocity: torch.Tensor,
|
|
222
|
+
default_joint_velocity: torch.Tensor,
|
|
223
|
+
action: torch.Tensor,
|
|
224
|
+
) -> torch.Tensor:
|
|
225
|
+
for name, value, width in (
|
|
226
|
+
("command", command, MOTION_COMMAND_DIM),
|
|
227
|
+
("anchor_position", anchor_position, 3),
|
|
228
|
+
("anchor_orientation", anchor_orientation, 6),
|
|
229
|
+
("body_position", body_position, TRACKED_BODY_COUNT * 3),
|
|
230
|
+
("body_orientation", body_orientation, TRACKED_BODY_COUNT * 6),
|
|
231
|
+
("base_linear_velocity", base_linear_velocity, 3),
|
|
232
|
+
("base_angular_velocity", base_angular_velocity, 3),
|
|
233
|
+
("joint_position", joint_position, ACTION_DIM),
|
|
234
|
+
("default_joint_position", default_joint_position, ACTION_DIM),
|
|
235
|
+
("joint_velocity", joint_velocity, ACTION_DIM),
|
|
236
|
+
("default_joint_velocity", default_joint_velocity, ACTION_DIM),
|
|
237
|
+
("action", action, ACTION_DIM),
|
|
238
|
+
):
|
|
239
|
+
_validate_width(name, value, width)
|
|
240
|
+
observation = torch.cat(
|
|
241
|
+
(
|
|
242
|
+
command,
|
|
243
|
+
anchor_position,
|
|
244
|
+
anchor_orientation,
|
|
245
|
+
body_position,
|
|
246
|
+
body_orientation,
|
|
247
|
+
base_linear_velocity,
|
|
248
|
+
base_angular_velocity,
|
|
249
|
+
joint_position - default_joint_position,
|
|
250
|
+
joint_velocity - default_joint_velocity,
|
|
251
|
+
action,
|
|
252
|
+
),
|
|
253
|
+
dim=-1,
|
|
254
|
+
)
|
|
255
|
+
_validate_width("critic observation", observation, CRITIC_OBSERVATION_DIM)
|
|
256
|
+
return observation
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
def default_relative_action_targets(
|
|
260
|
+
action: torch.Tensor,
|
|
261
|
+
action_scale: torch.Tensor,
|
|
262
|
+
default_joint_position: torch.Tensor,
|
|
263
|
+
encoder_bias: torch.Tensor,
|
|
264
|
+
) -> torch.Tensor:
|
|
265
|
+
return default_joint_position + action * action_scale - encoder_bias
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
@dataclass(frozen=True)
|
|
269
|
+
class RewardResult:
|
|
270
|
+
raw: Mapping[str, torch.Tensor]
|
|
271
|
+
contributions: Mapping[str, torch.Tensor]
|
|
272
|
+
total: torch.Tensor
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
def _tracking_exponential(
|
|
276
|
+
error: torch.Tensor, standard_deviation: float, *, mean_dim: int | None = None
|
|
277
|
+
) -> torch.Tensor:
|
|
278
|
+
squared = error.square().sum(dim=-1)
|
|
279
|
+
if mean_dim is not None:
|
|
280
|
+
squared = squared.mean(dim=mean_dim)
|
|
281
|
+
return torch.exp(-squared / standard_deviation**2)
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
def compute_reward(
|
|
285
|
+
*,
|
|
286
|
+
robot_anchor_position: torch.Tensor,
|
|
287
|
+
target_anchor_position: torch.Tensor,
|
|
288
|
+
robot_anchor_quaternion: torch.Tensor,
|
|
289
|
+
target_anchor_quaternion: torch.Tensor,
|
|
290
|
+
robot_body_position: torch.Tensor,
|
|
291
|
+
target_body_position: torch.Tensor,
|
|
292
|
+
robot_body_quaternion: torch.Tensor,
|
|
293
|
+
target_body_quaternion: torch.Tensor,
|
|
294
|
+
robot_body_linear_velocity: torch.Tensor,
|
|
295
|
+
target_body_linear_velocity: torch.Tensor,
|
|
296
|
+
robot_body_angular_velocity: torch.Tensor,
|
|
297
|
+
target_body_angular_velocity: torch.Tensor,
|
|
298
|
+
action: torch.Tensor,
|
|
299
|
+
previous_action: torch.Tensor,
|
|
300
|
+
joint_position: torch.Tensor,
|
|
301
|
+
soft_joint_lower: torch.Tensor,
|
|
302
|
+
soft_joint_upper: torch.Tensor,
|
|
303
|
+
self_collision_force_history: torch.Tensor,
|
|
304
|
+
step_duration: float,
|
|
305
|
+
) -> RewardResult:
|
|
306
|
+
orientation_error = quaternion_error_magnitude(
|
|
307
|
+
robot_anchor_quaternion, target_anchor_quaternion
|
|
308
|
+
)
|
|
309
|
+
body_orientation_error = quaternion_error_magnitude(
|
|
310
|
+
robot_body_quaternion, target_body_quaternion
|
|
311
|
+
)
|
|
312
|
+
if self_collision_force_history.ndim == 4:
|
|
313
|
+
collision = (
|
|
314
|
+
torch.linalg.vector_norm(self_collision_force_history, dim=-1)
|
|
315
|
+
.gt(10.0)
|
|
316
|
+
.any(dim=1)
|
|
317
|
+
.sum(dim=-1)
|
|
318
|
+
)
|
|
319
|
+
elif self_collision_force_history.ndim == 3:
|
|
320
|
+
collision = (
|
|
321
|
+
torch.linalg.vector_norm(self_collision_force_history, dim=-1)
|
|
322
|
+
.gt(10.0)
|
|
323
|
+
.sum(dim=-1)
|
|
324
|
+
)
|
|
325
|
+
else:
|
|
326
|
+
raise ValueError(
|
|
327
|
+
"self_collision_force_history must have shape (batch, history, 3) "
|
|
328
|
+
"or (batch, contacts, history, 3)"
|
|
329
|
+
)
|
|
330
|
+
lower_violation = (soft_joint_lower - joint_position).clamp_min(0.0)
|
|
331
|
+
upper_violation = (joint_position - soft_joint_upper).clamp_min(0.0)
|
|
332
|
+
raw = {
|
|
333
|
+
"anchor_position": _tracking_exponential(
|
|
334
|
+
robot_anchor_position - target_anchor_position, 0.3
|
|
335
|
+
),
|
|
336
|
+
"anchor_orientation": torch.exp(-orientation_error.square() / 0.4**2),
|
|
337
|
+
"body_position": _tracking_exponential(
|
|
338
|
+
robot_body_position - target_body_position, 0.3, mean_dim=-1
|
|
339
|
+
),
|
|
340
|
+
"body_orientation": torch.exp(
|
|
341
|
+
-body_orientation_error.square().mean(dim=-1) / 0.4**2
|
|
342
|
+
),
|
|
343
|
+
"body_linear_velocity": _tracking_exponential(
|
|
344
|
+
robot_body_linear_velocity - target_body_linear_velocity,
|
|
345
|
+
1.0,
|
|
346
|
+
mean_dim=-1,
|
|
347
|
+
),
|
|
348
|
+
"body_angular_velocity": _tracking_exponential(
|
|
349
|
+
robot_body_angular_velocity - target_body_angular_velocity,
|
|
350
|
+
3.14,
|
|
351
|
+
mean_dim=-1,
|
|
352
|
+
),
|
|
353
|
+
"action_rate": (action - previous_action).square().sum(dim=-1),
|
|
354
|
+
"joint_limit": (lower_violation + upper_violation).sum(dim=-1),
|
|
355
|
+
"self_collision": collision.to(dtype=robot_anchor_position.dtype),
|
|
356
|
+
}
|
|
357
|
+
contributions = {
|
|
358
|
+
name: value * REWARD_WEIGHTS[name] * step_duration
|
|
359
|
+
for name, value in raw.items()
|
|
360
|
+
}
|
|
361
|
+
total = torch.stack(tuple(contributions.values()), dim=0).sum(dim=0)
|
|
362
|
+
return RewardResult(raw=raw, contributions=contributions, total=total)
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
@dataclass(frozen=True)
|
|
366
|
+
class TerminationResult:
|
|
367
|
+
timeout: torch.Tensor
|
|
368
|
+
anchor_height: torch.Tensor
|
|
369
|
+
anchor_orientation: torch.Tensor
|
|
370
|
+
end_effector_height: torch.Tensor
|
|
371
|
+
terminated: torch.Tensor
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
def compute_terminations(
|
|
375
|
+
*,
|
|
376
|
+
elapsed_steps: torch.Tensor,
|
|
377
|
+
max_episode_steps: int,
|
|
378
|
+
robot_anchor_height: torch.Tensor,
|
|
379
|
+
target_anchor_height: torch.Tensor,
|
|
380
|
+
robot_projected_gravity_z: torch.Tensor,
|
|
381
|
+
target_projected_gravity_z: torch.Tensor | float,
|
|
382
|
+
robot_end_effector_height: torch.Tensor,
|
|
383
|
+
target_end_effector_height: torch.Tensor,
|
|
384
|
+
) -> TerminationResult:
|
|
385
|
+
timeout = elapsed_steps >= max_episode_steps
|
|
386
|
+
anchor_height = (robot_anchor_height - target_anchor_height).abs() > 0.25
|
|
387
|
+
anchor_orientation = (
|
|
388
|
+
robot_projected_gravity_z - target_projected_gravity_z
|
|
389
|
+
).abs() > 0.8
|
|
390
|
+
end_effector_height = (
|
|
391
|
+
(robot_end_effector_height - target_end_effector_height)
|
|
392
|
+
.abs()
|
|
393
|
+
.gt(0.25)
|
|
394
|
+
.any(dim=-1)
|
|
395
|
+
)
|
|
396
|
+
terminated = anchor_height | anchor_orientation | end_effector_height
|
|
397
|
+
return TerminationResult(
|
|
398
|
+
timeout=timeout,
|
|
399
|
+
anchor_height=anchor_height,
|
|
400
|
+
anchor_orientation=anchor_orientation,
|
|
401
|
+
end_effector_height=end_effector_height,
|
|
402
|
+
terminated=terminated,
|
|
403
|
+
)
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
@dataclass(frozen=True)
|
|
407
|
+
class AdaptiveSamplerState:
|
|
408
|
+
bin_failed_count: torch.Tensor
|
|
409
|
+
current_bin_failed: torch.Tensor
|
|
410
|
+
motion_frame_count: int
|
|
411
|
+
bin_count: int
|
|
412
|
+
|
|
413
|
+
@classmethod
|
|
414
|
+
def create(
|
|
415
|
+
cls,
|
|
416
|
+
*,
|
|
417
|
+
motion_frame_count: int,
|
|
418
|
+
sampling_fps: float,
|
|
419
|
+
device: torch.device,
|
|
420
|
+
dtype: torch.dtype,
|
|
421
|
+
) -> AdaptiveSamplerState:
|
|
422
|
+
bin_count = int(motion_frame_count // sampling_fps) + 1
|
|
423
|
+
return cls(
|
|
424
|
+
bin_failed_count=torch.zeros(bin_count, device=device, dtype=dtype),
|
|
425
|
+
current_bin_failed=torch.zeros(bin_count, device=device, dtype=dtype),
|
|
426
|
+
motion_frame_count=motion_frame_count,
|
|
427
|
+
bin_count=bin_count,
|
|
428
|
+
)
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
def failure_bins(
|
|
432
|
+
frame_index: torch.Tensor, motion_frame_count: int, bin_count: int
|
|
433
|
+
) -> torch.Tensor:
|
|
434
|
+
return torch.div(
|
|
435
|
+
frame_index * bin_count, motion_frame_count, rounding_mode="floor"
|
|
436
|
+
).clamp_max(bin_count - 1)
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
def update_failure_ema(
|
|
440
|
+
previous: torch.Tensor, current: torch.Tensor, *, alpha: float
|
|
441
|
+
) -> torch.Tensor:
|
|
442
|
+
return alpha * current + (1.0 - alpha) * previous
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
def sampling_probabilities(
|
|
446
|
+
bin_failed_count: torch.Tensor,
|
|
447
|
+
*,
|
|
448
|
+
uniform_ratio: float,
|
|
449
|
+
kernel_size: int,
|
|
450
|
+
adaptive_lambda: float = 0.8,
|
|
451
|
+
) -> torch.Tensor:
|
|
452
|
+
probabilities = bin_failed_count + uniform_ratio / float(bin_failed_count.numel())
|
|
453
|
+
kernel = probabilities.new_tensor(
|
|
454
|
+
[adaptive_lambda**index for index in range(kernel_size)]
|
|
455
|
+
)
|
|
456
|
+
probabilities = functional.pad(
|
|
457
|
+
probabilities[None, None, :],
|
|
458
|
+
(0, kernel_size - 1),
|
|
459
|
+
mode="replicate",
|
|
460
|
+
)
|
|
461
|
+
probabilities = functional.conv1d(probabilities, kernel.view(1, 1, -1)).flatten()
|
|
462
|
+
return probabilities / probabilities.sum()
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
@dataclass(frozen=True)
|
|
466
|
+
class ResetState:
|
|
467
|
+
root_position: torch.Tensor
|
|
468
|
+
root_quaternion: torch.Tensor
|
|
469
|
+
root_linear_velocity_world: torch.Tensor
|
|
470
|
+
root_angular_velocity_body: torch.Tensor
|
|
471
|
+
joint_position: torch.Tensor
|
|
472
|
+
joint_velocity: torch.Tensor
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
def perturb_reference_state(
|
|
476
|
+
*,
|
|
477
|
+
reference_root_position: torch.Tensor,
|
|
478
|
+
reference_root_quaternion: torch.Tensor,
|
|
479
|
+
reference_root_linear_velocity: torch.Tensor,
|
|
480
|
+
reference_root_angular_velocity: torch.Tensor,
|
|
481
|
+
reference_joint_position: torch.Tensor,
|
|
482
|
+
reference_joint_velocity: torch.Tensor,
|
|
483
|
+
position_delta: torch.Tensor,
|
|
484
|
+
euler_delta: torch.Tensor,
|
|
485
|
+
root_velocity_delta: torch.Tensor,
|
|
486
|
+
joint_position_delta: torch.Tensor,
|
|
487
|
+
joint_lower: torch.Tensor,
|
|
488
|
+
joint_upper: torch.Tensor,
|
|
489
|
+
) -> ResetState:
|
|
490
|
+
root_position = reference_root_position + position_delta
|
|
491
|
+
root_quaternion = quat_multiply(
|
|
492
|
+
euler_xyz_to_quaternion(euler_delta), reference_root_quaternion
|
|
493
|
+
)
|
|
494
|
+
root_linear_velocity_world = (
|
|
495
|
+
reference_root_linear_velocity + root_velocity_delta[..., :3]
|
|
496
|
+
)
|
|
497
|
+
root_angular_velocity_world = (
|
|
498
|
+
reference_root_angular_velocity + root_velocity_delta[..., 3:]
|
|
499
|
+
)
|
|
500
|
+
root_angular_velocity_body = quat_apply_inverse(
|
|
501
|
+
root_quaternion, root_angular_velocity_world
|
|
502
|
+
)
|
|
503
|
+
joint_position = (reference_joint_position + joint_position_delta).clamp(
|
|
504
|
+
min=joint_lower, max=joint_upper
|
|
505
|
+
)
|
|
506
|
+
return ResetState(
|
|
507
|
+
root_position=root_position,
|
|
508
|
+
root_quaternion=root_quaternion,
|
|
509
|
+
root_linear_velocity_world=root_linear_velocity_world,
|
|
510
|
+
root_angular_velocity_body=root_angular_velocity_body,
|
|
511
|
+
joint_position=joint_position,
|
|
512
|
+
joint_velocity=reference_joint_velocity,
|
|
513
|
+
)
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"""Quaternion helpers shared by the motion pipeline.
|
|
2
|
+
|
|
3
|
+
``copysign`` and ``get_euler_xyz`` are derived from NVIDIA's IsaacGymEnvs
|
|
4
|
+
``torch_jit_utils.py``, Copyright (c) 2018-2023, NVIDIA Corporation, licensed
|
|
5
|
+
under BSD-3-Clause; see THIRD_PARTY_NOTICES.md. The rest is repository-original
|
|
6
|
+
and follows the ``mujoco_warp`` scalar-first ``(w, x, y, z)`` convention rather
|
|
7
|
+
than Isaac's ``(x, y, z, w)``.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import numpy as np
|
|
11
|
+
import torch
|
|
12
|
+
from numpy.typing import DTypeLike
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def quat_normalize_np(q: np.ndarray) -> np.ndarray:
|
|
16
|
+
"""Normalize and canonicalize sign, preserving the nonzero input dtype."""
|
|
17
|
+
norm = float(np.linalg.norm(q))
|
|
18
|
+
if norm < 1.0e-8:
|
|
19
|
+
return np.array([1.0, 0.0, 0.0, 0.0], dtype=np.float64)
|
|
20
|
+
out = q / norm
|
|
21
|
+
return -out if out[0] < 0.0 else out
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def quat_mul_np(
|
|
25
|
+
q0: np.ndarray,
|
|
26
|
+
q1: np.ndarray,
|
|
27
|
+
*,
|
|
28
|
+
dtype: DTypeLike = np.float64,
|
|
29
|
+
) -> np.ndarray:
|
|
30
|
+
"""Hamilton product for scalar-first NumPy quaternions."""
|
|
31
|
+
w0, x0, y0, z0 = q0
|
|
32
|
+
w1, x1, y1, z1 = q1
|
|
33
|
+
return np.asarray(
|
|
34
|
+
[
|
|
35
|
+
w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1,
|
|
36
|
+
w0 * x1 + w1 * x0 + y0 * z1 - z0 * y1,
|
|
37
|
+
w0 * y1 + w1 * y0 + z0 * x1 - x0 * z1,
|
|
38
|
+
w0 * z1 + w1 * z0 + x0 * y1 - y0 * x1,
|
|
39
|
+
],
|
|
40
|
+
dtype=dtype,
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def quat_conj_np(q: np.ndarray) -> np.ndarray:
|
|
45
|
+
"""Conjugate one scalar-first quaternion as float64."""
|
|
46
|
+
return np.asarray([q[0], -q[1], -q[2], -q[3]], dtype=np.float64)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def quat_rotate_vec_np(q: np.ndarray, vector: np.ndarray) -> np.ndarray:
|
|
50
|
+
"""Rotate a vector after scalar-first quaternion normalization."""
|
|
51
|
+
q = quat_normalize_np(q)
|
|
52
|
+
xyz = np.asarray(q[1:4], dtype=np.float64)
|
|
53
|
+
twice_cross = 2.0 * np.cross(xyz, vector)
|
|
54
|
+
return vector + q[0] * twice_cross + np.cross(xyz, twice_cross)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@torch.jit.script
|
|
58
|
+
def quat_mul(q0: torch.Tensor, q1: torch.Tensor) -> torch.Tensor:
|
|
59
|
+
w0, x0, y0, z0 = q0[..., 0:1], q0[..., 1:2], q0[..., 2:3], q0[..., 3:4]
|
|
60
|
+
w1, x1, y1, z1 = q1[..., 0:1], q1[..., 1:2], q1[..., 2:3], q1[..., 3:4]
|
|
61
|
+
return torch.cat(
|
|
62
|
+
(
|
|
63
|
+
w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1,
|
|
64
|
+
w0 * x1 + w1 * x0 + y0 * z1 - z0 * y1,
|
|
65
|
+
w0 * y1 + w1 * y0 + z0 * x1 - x0 * z1,
|
|
66
|
+
w0 * z1 + w1 * z0 + x0 * y1 - y0 * x1,
|
|
67
|
+
),
|
|
68
|
+
dim=-1,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
@torch.jit.script
|
|
73
|
+
def quat_conj(q: torch.Tensor) -> torch.Tensor:
|
|
74
|
+
return torch.cat((q[..., 0:1], -q[..., 1:]), dim=-1)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def quat_inverse(q: torch.Tensor) -> torch.Tensor:
|
|
78
|
+
"""Hamilton inverse without assuming a unit-length quaternion."""
|
|
79
|
+
|
|
80
|
+
return quat_conj(q) / torch.sum(q.square(), dim=-1, keepdim=True)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def quat_rotate(q: torch.Tensor, vector: torch.Tensor) -> torch.Tensor:
|
|
84
|
+
"""Rotate by a scalar-first unit quaternion."""
|
|
85
|
+
|
|
86
|
+
xyz = q[..., 1:]
|
|
87
|
+
twice_cross = torch.cross(xyz, vector, dim=-1) * 2.0
|
|
88
|
+
return vector + q[..., :1] * twice_cross + torch.cross(xyz, twice_cross, dim=-1)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def quat_rotate_inverse_unit(q: torch.Tensor, vector: torch.Tensor) -> torch.Tensor:
|
|
92
|
+
"""Inverse-rotate using the unit-quaternion expanded formula."""
|
|
93
|
+
|
|
94
|
+
xyz = q[..., 1:]
|
|
95
|
+
a = vector * (2.0 * q[..., :1].square() - 1.0)
|
|
96
|
+
b = torch.cross(xyz, vector, dim=-1) * q[..., :1] * 2.0
|
|
97
|
+
c = xyz * (torch.sum(xyz * vector, dim=-1, keepdim=True) * 2.0)
|
|
98
|
+
return a - b + c
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def quat_rotate_inverse(q: torch.Tensor, vector: torch.Tensor) -> torch.Tensor:
|
|
102
|
+
"""Apply the conjugate rotation formula without normalizing the input."""
|
|
103
|
+
|
|
104
|
+
return quat_rotate(quat_conj(q), vector)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def quat_to_matrix(q: torch.Tensor) -> torch.Tensor:
|
|
108
|
+
"""Convert scalar-first quaternions to matrices after normalization."""
|
|
109
|
+
|
|
110
|
+
q = q / torch.linalg.vector_norm(q, dim=-1, keepdim=True).clamp_min(
|
|
111
|
+
torch.finfo(q.dtype).eps
|
|
112
|
+
)
|
|
113
|
+
w, x, y, z = q.unbind(dim=-1)
|
|
114
|
+
return torch.stack(
|
|
115
|
+
(
|
|
116
|
+
1 - 2 * (y.square() + z.square()),
|
|
117
|
+
2 * (x * y - w * z),
|
|
118
|
+
2 * (x * z + w * y),
|
|
119
|
+
2 * (x * y + w * z),
|
|
120
|
+
1 - 2 * (x.square() + z.square()),
|
|
121
|
+
2 * (y * z - w * x),
|
|
122
|
+
2 * (x * z - w * y),
|
|
123
|
+
2 * (y * z + w * x),
|
|
124
|
+
1 - 2 * (x.square() + y.square()),
|
|
125
|
+
),
|
|
126
|
+
dim=-1,
|
|
127
|
+
).reshape(q.shape[:-1] + (3, 3))
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
@torch.jit.script
|
|
131
|
+
def quat_to_scaled_axis_angle(q: torch.Tensor) -> torch.Tensor:
|
|
132
|
+
# stable log-map without data-dependent python branching
|
|
133
|
+
q = q / (torch.linalg.norm(q, dim=-1, keepdim=True).clamp_min(1.0e-8))
|
|
134
|
+
# Ensure shortest path: flip quaternion if w < 0
|
|
135
|
+
q = torch.where(q[..., 0:1] < 0.0, -q, q)
|
|
136
|
+
w = torch.clamp(q[..., 0:1], -1.0, 1.0)
|
|
137
|
+
v = q[..., 1:4]
|
|
138
|
+
v_norm = torch.linalg.norm(v, dim=-1, keepdim=True)
|
|
139
|
+
angle = 2.0 * torch.atan2(v_norm, w)
|
|
140
|
+
axis = v / v_norm.clamp_min(1.0e-8)
|
|
141
|
+
aa = axis * angle
|
|
142
|
+
aa_small = 2.0 * v
|
|
143
|
+
return torch.where(v_norm < 1.0e-6, aa_small, aa)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
@torch.jit.script
|
|
147
|
+
def scaled_axis_angle_to_quat(aa: torch.Tensor) -> torch.Tensor:
|
|
148
|
+
angle = torch.linalg.norm(aa, dim=-1, keepdim=True)
|
|
149
|
+
axis = aa / angle.clamp_min(1.0e-8)
|
|
150
|
+
half = 0.5 * angle
|
|
151
|
+
return torch.cat((torch.cos(half), torch.sin(half) * axis), dim=-1)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
@torch.jit.script
|
|
155
|
+
def copysign(a, b):
|
|
156
|
+
# type: (float, Tensor) -> Tensor
|
|
157
|
+
a = torch.tensor(a, device=b.device, dtype=torch.float).repeat(b.shape[0])
|
|
158
|
+
return torch.abs(a) * torch.sign(b)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
@torch.jit.script
|
|
162
|
+
def get_euler_xyz(q, extrinsic: bool = True):
|
|
163
|
+
if extrinsic:
|
|
164
|
+
qw, qx, qy, qz = 0, 1, 2, 3
|
|
165
|
+
# roll (x-axis rotation)
|
|
166
|
+
sinr_cosp = 2.0 * (q[:, qw] * q[:, qx] + q[:, qy] * q[:, qz])
|
|
167
|
+
cosr_cosp = (
|
|
168
|
+
q[:, qw] * q[:, qw]
|
|
169
|
+
- q[:, qx] * q[:, qx]
|
|
170
|
+
- q[:, qy] * q[:, qy]
|
|
171
|
+
+ q[:, qz] * q[:, qz]
|
|
172
|
+
)
|
|
173
|
+
roll = torch.atan2(sinr_cosp, cosr_cosp)
|
|
174
|
+
|
|
175
|
+
# pitch (y-axis rotation)
|
|
176
|
+
sinp = 2.0 * (q[:, qw] * q[:, qy] - q[:, qz] * q[:, qx])
|
|
177
|
+
pitch = torch.where(
|
|
178
|
+
torch.abs(sinp) >= 1, copysign(torch.pi / 2.0, sinp), torch.asin(sinp)
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
# yaw (z-axis rotation)
|
|
182
|
+
siny_cosp = 2.0 * (q[:, qw] * q[:, qz] + q[:, qx] * q[:, qy])
|
|
183
|
+
cosy_cosp = (
|
|
184
|
+
q[:, qw] * q[:, qw]
|
|
185
|
+
+ q[:, qx] * q[:, qx]
|
|
186
|
+
- q[:, qy] * q[:, qy]
|
|
187
|
+
- q[:, qz] * q[:, qz]
|
|
188
|
+
)
|
|
189
|
+
yaw = torch.atan2(siny_cosp, cosy_cosp)
|
|
190
|
+
|
|
191
|
+
return roll % (2 * torch.pi), pitch % (2 * torch.pi), yaw % (2 * torch.pi)
|
|
192
|
+
else:
|
|
193
|
+
raise NotImplementedError("Intrinsic euler angles are not implemented yet")
|
|
File without changes
|