diff --git a/.gitattributes b/.gitattributes index bed0738c7eeb449bca98b5d2f33c89a1ee56349a..5898aaf89b711301982fd7245bd6ca4b7e7ccc9d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -58,3 +58,40 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text # Video files - compressed *.mp4 filter=lfs diff=lfs merge=lfs -text *.webm filter=lfs diff=lfs merge=lfs -text +1500case/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_head_link_2.obj filter=lfs diff=lfs merge=lfs -text +1500case/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_base_link.obj filter=lfs diff=lfs merge=lfs -text +1500case/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_2.obj filter=lfs diff=lfs merge=lfs -text +1500case/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_4.obj filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_RR_Link.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_3.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_LR_Link.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_LF_Link.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_4.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_base_link.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_RF_Link.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_1.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_2.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_L11_Link.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_R11_Link.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_base_link.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_link_2.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_6.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_base_link.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_3.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_4.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_1.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_base_link.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_link_2.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_7.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_5.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_base_link.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_link_2.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link1.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link8.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link3.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link7.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/gripper_base.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link4.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link5.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link2.STL filter=lfs diff=lfs merge=lfs -text +1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/base_link.STL filter=lfs diff=lfs merge=lfs -text diff --git a/1500case/DEPENDENCIES_README.md b/1500case/DEPENDENCIES_README.md new file mode 100644 index 0000000000000000000000000000000000000000..0af5dd45ff47acbd82b4b1423d153f08f2fcc2c5 --- /dev/null +++ b/1500case/DEPENDENCIES_README.md @@ -0,0 +1,51 @@ +# RSSR 1500-case missing dependency supplement + +This supplement accompanies the existing `1500case/assets` and `1500case/dataset`. +It does not introduce new successful trajectories or change experiment outcomes. + +## Contents + +- `source/scene`: original tabletop XML, scene metadata and task-frame contract. +- `source/models`: actual referenced Piper and S1 files, not the server's directory symlink. +- `source/agent_retarget`: the saved agent package, including IK, robot definitions and imports. +- `source/*.py`: four transitively imported local evaluator/IK helpers. +- `implementation_revisions/physical_constraints_17`: original physical XML and scene manifest. +- `implementation_revisions/physical_backend_preflight_16/recovered_assets`: the actual OBJ files referenced by revision 17. +- `dependency_bundle_manifest.json`: original paths, sizes, SHA-256 digests and XML dependency edges. + +Original experiment root: + +``` +/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913 +``` + +All original packaged file bytes are preserved. The original XML and some Python +helpers contain absolute server paths. Simply downloading the directory does not +make those paths portable. Use the supplied relocation script to create a separate +local copy; the downloaded originals are never edited. + +``` +python /path/to/download/1500case/relocate_dependency_bundle.py \ + --destination /path/to/new/nonexistent/1500_dependencies_portable +``` + +The script checks original SHA-256 digests, copies only the manifest-listed +dependencies and rewrites the known experiment/model prefixes in XML, Python and +scene metadata. Keep the generated relocation receipt. Relocation changes paths, +not numeric physics parameters, mesh bytes or task thresholds. The result is a +dependency supplement, not a standalone full campaign launcher or dataset export. + +`tabletop_scene.build_scene()` optionally reads original S1 construction metadata. +Four legacy original OBJ inputs are Git LFS pointer metadata; that builder detects +them and uses the provided real STL fallbacks. These pointer files are explicitly +listed in the manifest. They are not substitutes for renderable OBJ assets. The +compiled revision-17 scene instead references the provided real recovered OBJ +files; those are the authoritative resources for loading that scene. + +Third-party Python libraries are not bundled. The manifest records external import +roots (including NumPy, MuJoCo, robosuite, mimicgen, h5py and pyarrow); use compatible +versions from the original experiment environment. Regenerating a scene or loading +other robot families may need additional assets outside this supplement. + +No credentials, `.env` files, caches, API logs or unrelated model directories are +included. Existing repository data is not overwritten by this addition. diff --git a/1500case/dependency_bundle_manifest.json b/1500case/dependency_bundle_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..e35b07904fd98ee2b729bf72d8c3e0bca61a8245 --- /dev/null +++ b/1500case/dependency_bundle_manifest.json @@ -0,0 +1,1231 @@ +{ + "schema": "rssr.1500_missing_dependencies.v1", + "source_experiment_root": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913", + "created_date": "2026-10-12", + "repo_id": "starry0929/rssr", + "path_in_repo": "1500case", + "original_file_bytes_preserved": true, + "models_symlink_materialized": true, + "scope": "Missing model, scene, IK/evaluator code dependencies; not a complete campaign or new trajectories", + "files": [ + { + "path": "implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_head_link_2.obj", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_head_link_2.obj", + "bytes": 38496139, + "sha256": "5a6dc2fa33de59fd0502c6482eaabc48d846c1ecc863d74f1ec33f83fcd96360", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml" + ] + }, + { + "path": "implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_base_link.obj", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_base_link.obj", + "bytes": 40001354, + "sha256": "dd7b42ad341963e0aaa7e898411078173ba2613a5eff60140232c7d04d0b36da", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml" + ] + }, + { + "path": "implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_2.obj", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_2.obj", + "bytes": 33347575, + "sha256": "d3f639a37cc63757da571bbeeedd130c98afd798af6ba33f1a7960884549b1e3", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml" + ] + }, + { + "path": "implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_4.obj", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_4.obj", + "bytes": 28906301, + "sha256": "955db3acb335e179d35a0ad76f537109f6d2ab0b74fd6d9d5d0db7ed7ef14a32", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml" + ] + }, + { + "path": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "bytes": 51819, + "sha256": "32080253a239bb695fca4076a52fcf7d7ca328da8ac988a275658b9d28f77cae", + "reasons": [ + "MJCF model or include" + ] + }, + { + "path": "implementation_revisions/physical_constraints_17/scene_manifest.json", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/implementation_revisions/physical_constraints_17/scene_manifest.json", + "bytes": 2543, + "sha256": "80464f53d2dad8a5d2be438488c43cfab3b95e359245fe8aaea7ea660db34414", + "reasons": [ + "Scene metadata and provenance" + ] + }, + { + "path": "source/agent_retarget/__init__.py", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/agent_retarget/__init__.py", + "bytes": 63, + "sha256": "8344379114e1f688fee09733429981f065719fcca788dbcdd60768f6f118c871", + "reasons": [ + "Agent package or transitive local Python import" + ] + }, + { + "path": "source/agent_retarget/config.py", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/agent_retarget/config.py", + "bytes": 6452, + "sha256": "58ebc07915d84f5d5d0f4fccddec0da9aa92aca95c5b95d2fca495c1583e530d", + "reasons": [ + "Agent package or transitive local Python import" + ] + }, + { + "path": "source/agent_retarget/embodiment.py", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/agent_retarget/embodiment.py", + "bytes": 8746, + "sha256": "f9b86671b4899dd07377d29f89e34095d17742faf033eaefacdbd4bfe67eb1e9", + "reasons": [ + "Agent package or transitive local Python import" + ] + }, + { + "path": "source/agent_retarget/envs.py", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/agent_retarget/envs.py", + "bytes": 3664, + "sha256": "78671442b5d8bc64ad91de541e19a07fbc1f8250f7edfe2782f781363c3a4734", + "reasons": [ + "Agent package or transitive local Python import" + ] + }, + { + "path": "source/agent_retarget/evaluate.py", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/agent_retarget/evaluate.py", + "bytes": 16317, + "sha256": "19fc561fb61e8925c75e9113710161f2e2478d21733d7ebf11e6c5e8758cf582", + "reasons": [ + "Agent package or transitive local Python import" + ] + }, + { + "path": "source/agent_retarget/ik.py", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/agent_retarget/ik.py", + "bytes": 13688, + "sha256": "c91f5f9b3460b9e27673b7b1fb3161c4d9c35748b6acdda5c4e1138259f9f6c3", + "reasons": [ + "Agent package or transitive local Python import" + ] + }, + { + "path": "source/agent_retarget/instrument.py", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/agent_retarget/instrument.py", + "bytes": 12286, + "sha256": "9f244d00219c27bbfea34d3620de979fa9c44f41855e328473591782d2d0b459", + "reasons": [ + "Agent package or transitive local Python import" + ] + }, + { + "path": "source/agent_retarget/perturb.py", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/agent_retarget/perturb.py", + "bytes": 5683, + "sha256": "ffb4cf848255b05d40a8323c50a936d4412063dbbb3c301382fc6b6b7fac6ada", + "reasons": [ + "Agent package or transitive local Python import" + ] + }, + { + "path": "source/agent_retarget/retarget.py", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/agent_retarget/retarget.py", + "bytes": 6923, + "sha256": "1186b3ddb496321d65e0bf998fa1d0a88cb8ab36541b313870c5f096056680c6", + "reasons": [ + "Agent package or transitive local Python import" + ] + }, + { + "path": "source/agent_retarget/source.py", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/agent_retarget/source.py", + "bytes": 5846, + "sha256": "e805e99094af5975c0ec44aae6a90f67859d09f0a7d1f855804f72df95e2c824", + "reasons": [ + "Agent package or transitive local Python import" + ] + }, + { + "path": "source/agent_retarget/trackc/__init__.py", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/agent_retarget/trackc/__init__.py", + "bytes": 305, + "sha256": "f7326751cb0d23acf779e8fc672523954d97ffd5c6025ab229876c24fe8b8af3", + "reasons": [ + "Agent package or transitive local Python import" + ] + }, + { + "path": "source/agent_retarget/trackc/config_dualarm.py", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/agent_retarget/trackc/config_dualarm.py", + "bytes": 4746, + "sha256": "bc2264c82ddc59a9c9650887e0a88f665baaf01ed7b09369e356fdbeb2fe4973", + "reasons": [ + "Agent package or transitive local Python import" + ] + }, + { + "path": "source/agent_retarget/trackc/eval_dualarm.py", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/agent_retarget/trackc/eval_dualarm.py", + "bytes": 32552, + "sha256": "ae4372e3c839b7d6b914c0dc603a7e497f09080c6165d2fcc25ec05052b921ef", + "reasons": [ + "Agent package or transitive local Python import" + ] + }, + { + "path": "source/agent_retarget/trackc/ik_dualarm.py", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/agent_retarget/trackc/ik_dualarm.py", + "bytes": 20556, + "sha256": "5ce18bc2e2209849a39f7283414ee3c4cc2c2fe28c34ef24b7eb128afcb07b42", + "reasons": [ + "Agent package or transitive local Python import" + ] + }, + { + "path": "source/agent_retarget/trackc/robots.py", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/agent_retarget/trackc/robots.py", + "bytes": 2389, + "sha256": "094aad47659bb0bf798dca9c52524da5bf92c7bdcedce66683dd834f1b92ba2b", + "reasons": [ + "Agent package or transitive local Python import" + ] + }, + { + "path": "source/agent_retarget/trackc/source_dualarm.py", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/agent_retarget/trackc/source_dualarm.py", + "bytes": 6472, + "sha256": "e1efc16ea0f211ddc721f7b69fda3d55273c65588153c22a8bcc997a6c4aa69c", + "reasons": [ + "Agent package or transitive local Python import" + ] + }, + { + "path": "source/constrained_waist.py", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/constrained_waist.py", + "bytes": 9001, + "sha256": "e1f1bd5558a149cd390901be88dc44f01aac3f3f0c2308c787b341b9bf593a82", + "reasons": [ + "Agent package or transitive local Python import" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/mjcf/astribot_s1_mjcf/assets/astribot_s1_asset_for_gripper.xml", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/mjcf/astribot_s1_mjcf/assets/astribot_s1_asset_for_gripper.xml", + "bytes": 7114, + "sha256": "ec55926a0f465bcb34d3fc3098ac3d1dc68152644e41c427a22ac8c5412b7b1f", + "reasons": [ + "Optional tabletop_scene.build_scene metadata input; existing compiled scenes remain authoritative" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/mjcf/astribot_s1_mjcf/model_with_effector/astribot_s1_model_with_gripper.xml", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/mjcf/astribot_s1_mjcf/model_with_effector/astribot_s1_model_with_gripper.xml", + "bytes": 17202, + "sha256": "53fd2c3d4f892edd219c2ea3a0ff7639b697f78286a75f4df85cf4e9bf897452", + "reasons": [ + "Optional tabletop_scene.build_scene metadata input; existing compiled scenes remain authoritative" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_head_link_2.obj", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_head_link_2.obj", + "bytes": 133, + "sha256": "5b661cff41ccbad9dc39a9f9eae090b5b79b3334e2db9e14e9b41a97d8a48571", + "reasons": [ + "Original pointer metadata used by optional builder to select STL fallback" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_base_link.obj", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_base_link.obj", + "bytes": 133, + "sha256": "e22e2ff697d5a7afc13da9679c1979a0c9ed78f70206bafdc973f6d1e835c07d", + "reasons": [ + "Original pointer metadata used by optional builder to select STL fallback" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_2.obj", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_2.obj", + "bytes": 133, + "sha256": "8693639b786ece05aa740895fdad645eea8559ddbcf9ec5319ef8485f1018816", + "reasons": [ + "Original pointer metadata used by optional builder to select STL fallback" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_4.obj", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_4.obj", + "bytes": 133, + "sha256": "1ecb8dce693d5eaace11dbdcd93734bf1a755cdcc388496110ea1a82128c31f2", + "reasons": [ + "Original pointer metadata used by optional builder to select STL fallback" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_base_link.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_base_link.STL", + "bytes": 393484, + "sha256": "f5ce4a1ca6343fa73aac37e9ab1581224eae72b13e906592e253f5b9ff71b7e7", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "mesh referenced by source/scene/s1_tabletop.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_link_2.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_link_2.STL", + "bytes": 1168184, + "sha256": "29a31a52440708e5257005fcaa766d782b6e9895a7d641cf96818db5939b72b5", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "mesh referenced by source/scene/s1_tabletop.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_1.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_1.STL", + "bytes": 160984, + "sha256": "b6c9d2fb9539f3865c15f86dae8bfd88e23daab3a8136775a7f5e840519a9ccf", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "mesh referenced by source/scene/s1_tabletop.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_3.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_3.STL", + "bytes": 1431884, + "sha256": "a8d48fa6ed9eae1d1b85be42937c9f162fb9039a630943f8fae9b511c1fb711a", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "mesh referenced by source/scene/s1_tabletop.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_4.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_4.STL", + "bytes": 325584, + "sha256": "cf0ae423d242e076a628c4181afcd0f42c677d94f5b31582e79997b5620ac043", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "mesh referenced by source/scene/s1_tabletop.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_5.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_5.STL", + "bytes": 1988484, + "sha256": "a8301d519a7cac044de0e9b1dda82147382aed2d0b64b5c2d7035461464a21ae", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "mesh referenced by source/scene/s1_tabletop.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_6.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_6.STL", + "bytes": 626484, + "sha256": "c2a3a57e115c59006eb37ac8dbc28736e2366a048ea2e1545731910ad4c897f7", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "mesh referenced by source/scene/s1_tabletop.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_7.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_7.STL", + "bytes": 216184, + "sha256": "650d570d2e0d2978fc8b870adf2495e8cd24944b6e3a2da3c0fad0a48db2fd8f", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "mesh referenced by source/scene/s1_tabletop.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_base_link.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_base_link.STL", + "bytes": 394684, + "sha256": "a2d63475f85bf98fc0e7569ee5aeb554ff9dc0d6abe10e85b5e58d17c822946e", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "mesh referenced by source/scene/s1_tabletop.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_link_2.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_link_2.STL", + "bytes": 1170384, + "sha256": "9074ba1114c0d0fb9f950c678689f5e2536beadf84c8b24a872165c84066583d", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "mesh referenced by source/scene/s1_tabletop.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_L11_Link.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_L11_Link.STL", + "bytes": 455284, + "sha256": "8c2ac3e5c2039b5e3e9127f1e612520b4e76863619e6d4853d5f640e988df401", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_L1_Link.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_L1_Link.STL", + "bytes": 60584, + "sha256": "93024aba1a6171b305fefe00618b446457e19f32159460e1e4f463bf5163c4cd", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_L2_Link.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_L2_Link.STL", + "bytes": 82084, + "sha256": "4c461d9621422ea16ddfc133ec57b196ad073576425c27e66a096ff879ac71e6", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_R11_Link.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_R11_Link.STL", + "bytes": 455284, + "sha256": "10ce463e0fb7bfb632b310f9f47ce746be98383ed2538f118c4fb4ce69971c55", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_R1_Link.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_R1_Link.STL", + "bytes": 60584, + "sha256": "88e771f4b181eeebdc83e2e5239dbedcaa6b496b2cc5e5896e1ebc4b9586de2b", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_R2_Link.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_R2_Link.STL", + "bytes": 82084, + "sha256": "df220a8f4c534498c769ff83ebfbc2a7920db8223e8f93629abe71d71083b9e9", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_base_link.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_base_link.STL", + "bytes": 1086384, + "sha256": "887e309b8db7285917c26d272a84a3c56b30638e1f4e71e2b23930a9d3244db1", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_base_link.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_base_link.STL", + "bytes": 148284, + "sha256": "82a65945d782623b806f4c59f53bfaef39d14bdd5a84f2e21a25867122493242", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "mesh referenced by source/scene/s1_tabletop.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_link_1.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_link_1.STL", + "bytes": 83184, + "sha256": "9e9c1792b072579214109d18438caf8594820452319c0bd8dca34e1b23276798", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_link_2.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_link_2.STL", + "bytes": 9665084, + "sha256": "94170698aea56450148d63cfff41daf899de7eab03d9fe716ff22959cca73306", + "reasons": [ + "Actual STL fallback for optional source scene builder" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_base_link.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_base_link.STL", + "bytes": 9484534, + "sha256": "88d76fa4c7834bb756298db81907c204cfcb7a918eb4e1380fbc07bc894a2a2c", + "reasons": [ + "Actual STL fallback for optional source scene builder", + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "mesh referenced by source/scene/s1_tabletop.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_1.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_1.STL", + "bytes": 2927384, + "sha256": "a35f95371318c34c2b61b5003ded18d9bd5af7910a42a052974e1ac02f639783", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "mesh referenced by source/scene/s1_tabletop.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_2.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_2.STL", + "bytes": 8721384, + "sha256": "30237e4da5116ada620cdeccea5766fc1a3cf152f6f7892ded49f52ae71878a6", + "reasons": [ + "Actual STL fallback for optional source scene builder", + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "mesh referenced by source/scene/s1_tabletop.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_3.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_3.STL", + "bytes": 2721384, + "sha256": "eab30e56b62eb82c185fd601f73d28b3c948975ea427b250a5ce0ff58b2aeaab", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "mesh referenced by source/scene/s1_tabletop.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_4.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_4.STL", + "bytes": 7149984, + "sha256": "f0a1e9860d36598beec63562a27f88733216cc7d8db9796274e381b5d90c362c", + "reasons": [ + "Actual STL fallback for optional source scene builder", + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "mesh referenced by source/scene/s1_tabletop.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_LF_Link.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_LF_Link.STL", + "bytes": 3733184, + "sha256": "4bf080c0908855a21de278d5c3d356f9a3e04bc7e967671bf21fdd91b220cc6a", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_LR_Link.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_LR_Link.STL", + "bytes": 3733184, + "sha256": "4bf080c0908855a21de278d5c3d356f9a3e04bc7e967671bf21fdd91b220cc6a", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_RF_Link.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_RF_Link.STL", + "bytes": 3733184, + "sha256": "4bf080c0908855a21de278d5c3d356f9a3e04bc7e967671bf21fdd91b220cc6a", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_RR_Link.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_RR_Link.STL", + "bytes": 3733184, + "sha256": "4bf080c0908855a21de278d5c3d356f9a3e04bc7e967671bf21fdd91b220cc6a", + "reasons": [ + "mesh referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_head_link_2.png", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_head_link_2.png", + "bytes": 245361, + "sha256": "9a9b16978f8d857c74383f61af9487e30157e9d1d559c99de6530b2004c93502", + "reasons": [ + "texture referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_torso_base_link.png", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_torso_base_link.png", + "bytes": 562140, + "sha256": "5857003d2083766116a8bbe292c37ec0af390ac73ae4355a5df6b179a872d72c", + "reasons": [ + "texture referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_torso_link_2.png", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_torso_link_2.png", + "bytes": 502245, + "sha256": "5edecacd88d04d38cc28ae2cbbf2dbd172f9996c1575b0762cea33b5795f84f7", + "reasons": [ + "texture referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml" + ] + }, + { + "path": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_torso_link_4.png", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_torso_link_4.png", + "bytes": 41498, + "sha256": "a314b1341074cca6aa64ec00e0b0d23a91431a360535b7f0fdc9729d6bfccd15", + "reasons": [ + "texture referenced by implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml" + ] + }, + { + "path": "source/models/trackc/astribot_s1_ik/astribot_s1_ik.xml", + "original_path": "/pfs/yichen/r2r/models/trackc/astribot_s1_ik/astribot_s1_ik.xml", + "bytes": 7375, + "sha256": "4bafaec28873be6736f2f3b7e88215190d43c45ed2589b0bef840c3bffee0fbd", + "reasons": [ + "MJCF model or include" + ] + }, + { + "path": "source/models/trackc/piper_isaac_sim/piper_description/meshes/base_link.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/piper_isaac_sim/piper_description/meshes/base_link.STL", + "bytes": 607384, + "sha256": "fd4a3d6d0266205fe3f725f048645be66592c23564db22e08b0807d5569b2c64", + "reasons": [ + "mesh referenced by source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml" + ] + }, + { + "path": "source/models/trackc/piper_isaac_sim/piper_description/meshes/gripper_base.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/piper_isaac_sim/piper_description/meshes/gripper_base.STL", + "bytes": 649484, + "sha256": "2895bfa6f1eef2d0ad2cb9dfdedd5f6c760ec07388bcde2b4d1e412e1189c9cb", + "reasons": [ + "mesh referenced by source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml" + ] + }, + { + "path": "source/models/trackc/piper_isaac_sim/piper_description/meshes/link1.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/piper_isaac_sim/piper_description/meshes/link1.STL", + "bytes": 447784, + "sha256": "9ee6e1d67c0241f42a0dbaf5c676d19230375ed078ee1943bb8c4c37ab303d14", + "reasons": [ + "mesh referenced by source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml" + ] + }, + { + "path": "source/models/trackc/piper_isaac_sim/piper_description/meshes/link2.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/piper_isaac_sim/piper_description/meshes/link2.STL", + "bytes": 3658384, + "sha256": "0d37675b699b643f2e15348de99aed535fac10dc5f09a79b8e4b0acfaf4e0378", + "reasons": [ + "mesh referenced by source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml" + ] + }, + { + "path": "source/models/trackc/piper_isaac_sim/piper_description/meshes/link3.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/piper_isaac_sim/piper_description/meshes/link3.STL", + "bytes": 1845784, + "sha256": "e8ae51f17c0c7f6d67b753922e2cc269f5e8372a65734f859231639a64fe8fad", + "reasons": [ + "mesh referenced by source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml" + ] + }, + { + "path": "source/models/trackc/piper_isaac_sim/piper_description/meshes/link4.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/piper_isaac_sim/piper_description/meshes/link4.STL", + "bytes": 877984, + "sha256": "efa33022976218f246f736a6133494b5d0e5486e8b50b52900c42f285ae85558", + "reasons": [ + "mesh referenced by source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml" + ] + }, + { + "path": "source/models/trackc/piper_isaac_sim/piper_description/meshes/link5.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/piper_isaac_sim/piper_description/meshes/link5.STL", + "bytes": 833684, + "sha256": "a1c69d1c7f6f8c60e2c82331c0f444725200ed4053d3e5ec23aa82cb5db5b29f", + "reasons": [ + "mesh referenced by source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml" + ] + }, + { + "path": "source/models/trackc/piper_isaac_sim/piper_description/meshes/link6.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/piper_isaac_sim/piper_description/meshes/link6.STL", + "bytes": 58884, + "sha256": "88374973bc3bd9e7389b5853cd6e555af9731c30b658b1ee6f85be34a126cb92", + "reasons": [ + "mesh referenced by source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml" + ] + }, + { + "path": "source/models/trackc/piper_isaac_sim/piper_description/meshes/link7.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/piper_isaac_sim/piper_description/meshes/link7.STL", + "bytes": 104384, + "sha256": "475a7d8db056524d7659fadf5a2c307d62791047b6214d733dfc7846ed1c613d", + "reasons": [ + "mesh referenced by source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml" + ] + }, + { + "path": "source/models/trackc/piper_isaac_sim/piper_description/meshes/link8.STL", + "original_path": "/pfs/yichen/r2r/models/trackc/piper_isaac_sim/piper_description/meshes/link8.STL", + "bytes": 104384, + "sha256": "3f88d534a85e28a33ef7d2061adacbd1d25214aa9325f9e464aad0f9e4b74606", + "reasons": [ + "mesh referenced by source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml" + ] + }, + { + "path": "source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml", + "original_path": "/pfs/yichen/r2r/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml", + "bytes": 6423, + "sha256": "3c2e4bf29dd7fc80acfbb056ad711548bdd57f5c26f2e0fcb43f179b8e02f726", + "reasons": [ + "MJCF model or include" + ] + }, + { + "path": "source/scene/s1_tabletop.json", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/scene/s1_tabletop.json", + "bytes": 3709, + "sha256": "cfc5b762890cbca7654212eb78428b3a38bc4a0249fc60ccce49bef00f8f8f31", + "reasons": [ + "Scene metadata and provenance" + ] + }, + { + "path": "source/scene/s1_tabletop.xml", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/scene/s1_tabletop.xml", + "bytes": 14508, + "sha256": "b06105a8999dd7564f73b2811d7ef6708488a45ae4e575fd4ed755702c26d035", + "reasons": [ + "MJCF model or include" + ] + }, + { + "path": "source/scene/task_frame_contract.json", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/scene/task_frame_contract.json", + "bytes": 4892, + "sha256": "7d4b2933aa4f4e97c9b7a2272fa36136c0fd4989dbe44e6b76d3dc062bd14e33", + "reasons": [ + "Scene metadata and provenance" + ] + }, + { + "path": "source/scene_binding.py", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/scene_binding.py", + "bytes": 2230, + "sha256": "0595b20e102f2d0a2fe2fdcf86156249397e1e11ccdae9d687231f31df0c311b", + "reasons": [ + "Agent package or transitive local Python import" + ] + }, + { + "path": "source/table_clearance_ik.py", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/table_clearance_ik.py", + "bytes": 5141, + "sha256": "d392b7d809aa12d497bc2acc2469de5111b771ce3a8384ff0a2c23da0182dc18", + "reasons": [ + "Agent package or transitive local Python import" + ] + }, + { + "path": "source/tabletop_scene.py", + "original_path": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/tabletop_scene.py", + "bytes": 6414, + "sha256": "3f389aa08c1f7b166ae7ca359164d52012fb9bb75581e770b8643202b41e982f", + "reasons": [ + "Agent package or transitive local Python import" + ] + } + ], + "xml_dependencies": [ + { + "xml": "source/scene/s1_tabletop.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_base_link.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_base_link.STL" + }, + { + "xml": "source/scene/s1_tabletop.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_link_2.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_link_2.STL" + }, + { + "xml": "source/scene/s1_tabletop.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_1.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_1.STL" + }, + { + "xml": "source/scene/s1_tabletop.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_3.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_3.STL" + }, + { + "xml": "source/scene/s1_tabletop.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_4.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_4.STL" + }, + { + "xml": "source/scene/s1_tabletop.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_5.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_5.STL" + }, + { + "xml": "source/scene/s1_tabletop.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_6.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_6.STL" + }, + { + "xml": "source/scene/s1_tabletop.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_7.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_7.STL" + }, + { + "xml": "source/scene/s1_tabletop.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_base_link.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_base_link.STL" + }, + { + "xml": "source/scene/s1_tabletop.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_link_2.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_link_2.STL" + }, + { + "xml": "source/scene/s1_tabletop.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_base_link.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_base_link.STL" + }, + { + "xml": "source/scene/s1_tabletop.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_base_link.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_base_link.STL" + }, + { + "xml": "source/scene/s1_tabletop.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_1.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_1.STL" + }, + { + "xml": "source/scene/s1_tabletop.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_2.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_2.STL" + }, + { + "xml": "source/scene/s1_tabletop.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_3.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_3.STL" + }, + { + "xml": "source/scene/s1_tabletop.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_4.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_4.STL" + }, + { + "xml": "source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml", + "tag": "mesh", + "original_reference": "../meshes/base_link.STL", + "packaged_target": "source/models/trackc/piper_isaac_sim/piper_description/meshes/base_link.STL" + }, + { + "xml": "source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml", + "tag": "mesh", + "original_reference": "../meshes/link1.STL", + "packaged_target": "source/models/trackc/piper_isaac_sim/piper_description/meshes/link1.STL" + }, + { + "xml": "source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml", + "tag": "mesh", + "original_reference": "../meshes/link2.STL", + "packaged_target": "source/models/trackc/piper_isaac_sim/piper_description/meshes/link2.STL" + }, + { + "xml": "source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml", + "tag": "mesh", + "original_reference": "../meshes/link3.STL", + "packaged_target": "source/models/trackc/piper_isaac_sim/piper_description/meshes/link3.STL" + }, + { + "xml": "source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml", + "tag": "mesh", + "original_reference": "../meshes/link4.STL", + "packaged_target": "source/models/trackc/piper_isaac_sim/piper_description/meshes/link4.STL" + }, + { + "xml": "source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml", + "tag": "mesh", + "original_reference": "../meshes/link5.STL", + "packaged_target": "source/models/trackc/piper_isaac_sim/piper_description/meshes/link5.STL" + }, + { + "xml": "source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml", + "tag": "mesh", + "original_reference": "../meshes/link6.STL", + "packaged_target": "source/models/trackc/piper_isaac_sim/piper_description/meshes/link6.STL" + }, + { + "xml": "source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml", + "tag": "mesh", + "original_reference": "../meshes/gripper_base.STL", + "packaged_target": "source/models/trackc/piper_isaac_sim/piper_description/meshes/gripper_base.STL" + }, + { + "xml": "source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml", + "tag": "mesh", + "original_reference": "../meshes/link7.STL", + "packaged_target": "source/models/trackc/piper_isaac_sim/piper_description/meshes/link7.STL" + }, + { + "xml": "source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml", + "tag": "mesh", + "original_reference": "../meshes/link8.STL", + "packaged_target": "source/models/trackc/piper_isaac_sim/piper_description/meshes/link8.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "texture", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_torso_base_link.png", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_torso_base_link.png" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "texture", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_torso_link_2.png", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_torso_link_2.png" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "texture", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_torso_link_4.png", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_torso_link_4.png" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "texture", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_head_link_2.png", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_head_link_2.png" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_base_link.obj", + "packaged_target": "implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_base_link.obj" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_2.obj", + "packaged_target": "implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_2.obj" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_4.obj", + "packaged_target": "implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_4.obj" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_head_link_2.obj", + "packaged_target": "implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_head_link_2.obj" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_RF_Link.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_RF_Link.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_LF_Link.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_LF_Link.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_RR_Link.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_RR_Link.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_LR_Link.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_LR_Link.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_1.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_1.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_3.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_3.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_base_link.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_base_link.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_link_1.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_link_1.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_base_link.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_base_link.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_base_link.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_base_link.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_1.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_1.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_link_2.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_link_2.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_3.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_3.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_4.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_4.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_5.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_5.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_6.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_6.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_7.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_7.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_link_2.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_link_2.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_base_link.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_base_link.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_L1_Link.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_L1_Link.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_L11_Link.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_L11_Link.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_L2_Link.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_L2_Link.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_R1_Link.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_R1_Link.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_R11_Link.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_R11_Link.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_R2_Link.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_R2_Link.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_base_link.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_base_link.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_link_2.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_link_2.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_1.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_1.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_3.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_3.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_4.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_4.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_5.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_5.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_6.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_6.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_7.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_7.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_base_link.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_base_link.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_link_2.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_link_2.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_base_link.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_base_link.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_base_link.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_base_link.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_1.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_1.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_2.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_2.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_3.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_3.STL" + }, + { + "xml": "implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "tag": "mesh", + "original_reference": "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_4.STL", + "packaged_target": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_4.STL" + } + ], + "optional_builder_pointer_metadata": [ + { + "pointer": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_base_link.obj", + "actual_stl_fallback": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_base_link.STL" + }, + { + "pointer": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_2.obj", + "actual_stl_fallback": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_2.STL" + }, + { + "pointer": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_4.obj", + "actual_stl_fallback": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_4.STL" + }, + { + "pointer": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_head_link_2.obj", + "actual_stl_fallback": "source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_link_2.STL" + } + ], + "external_python_import_roots": [ + "h5py", + "mimicgen", + "mujoco", + "numpy", + "pyarrow", + "robosuite" + ], + "file_count": 80, + "total_original_bytes": 217568930 +} diff --git a/1500case/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_head_link_2.obj b/1500case/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_head_link_2.obj new file mode 100644 index 0000000000000000000000000000000000000000..c86008ce5bd20b5886511aa339110f18f3ca3f70 --- /dev/null +++ b/1500case/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_head_link_2.obj @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a6dc2fa33de59fd0502c6482eaabc48d846c1ecc863d74f1ec33f83fcd96360 +size 38496139 diff --git a/1500case/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_base_link.obj b/1500case/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_base_link.obj new file mode 100644 index 0000000000000000000000000000000000000000..1be8ef51bca623ee18d204d0890b51f995e6c5f3 --- /dev/null +++ b/1500case/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_base_link.obj @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd7b42ad341963e0aaa7e898411078173ba2613a5eff60140232c7d04d0b36da +size 40001354 diff --git a/1500case/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_2.obj b/1500case/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_2.obj new file mode 100644 index 0000000000000000000000000000000000000000..2a11a10911cbfe5baf9d5fa80a3a1ca7007d8bc8 --- /dev/null +++ b/1500case/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_2.obj @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3f639a37cc63757da571bbeeedd130c98afd798af6ba33f1a7960884549b1e3 +size 33347575 diff --git a/1500case/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_4.obj b/1500case/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_4.obj new file mode 100644 index 0000000000000000000000000000000000000000..cb23e49277aec820046763e9703280b05de791c0 --- /dev/null +++ b/1500case/implementation_revisions/physical_backend_preflight_16/recovered_assets/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_4.obj @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:955db3acb335e179d35a0ad76f537109f6d2ab0b74fd6d9d5d0db7ed7ef14a32 +size 28906301 diff --git a/1500case/implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml b/1500case/implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml new file mode 100644 index 0000000000000000000000000000000000000000..c7978e6c93168cb4ef8d8e8096f20621ee52d634 --- /dev/null +++ b/1500case/implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml @@ -0,0 +1,457 @@ + + + \ No newline at end of file diff --git a/1500case/implementation_revisions/physical_constraints_17/scene_manifest.json b/1500case/implementation_revisions/physical_constraints_17/scene_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..40fd75ff04ba7af9cbc67be856cda2d434c17342 --- /dev/null +++ b/1500case/implementation_revisions/physical_constraints_17/scene_manifest.json @@ -0,0 +1,48 @@ +{ + "scope": "physical_scene_adapter_not_task_verified", + "scene": "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/implementation_revisions/physical_constraints_17/s1_tabletop_physical.xml", + "scene_sha256": "32080253a239bb695fca4076a52fcf7d7ca328da8ac988a275658b9d28f77cae", + "inputs": { + "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/implementation_revisions/physical_backend_preflight_16/s1_component_candidate_2ms.xml": "02d96dd36c7c430dda5aac047f92ef401876e02714cded192bcd09769509227b", + "/pfs/yichen/r2r/results/iclr2027_v21_cobot_all1500_fromzero_ops_memory20_20260913/source/scene/s1_tabletop.xml": "b06105a8999dd7564f73b2811d7ef6708488a45ae4e575fd4ed755702c26d035" + }, + "locked_joints": { + "astribot_torso_joint_3": 0.28834, + "astribot_torso_joint_4": -0.00123 + }, + "coupled_joint_sum_rad": -0.28403, + "coupling": "MuJoCo joint equality, finite residual measured separately", + "table": "Exact fixed synthetic v21 table, not real calibration", + "arm_collision": "Per-link convex hulls copied from v21; environment contacts enabled", + "robot_self_collision": "Not enabled in dynamics; separate body-surface checking still required", + "gripper_collision": "Official moving box contact primitives", + "physical_robot_geoms": [ + "physical_robot_chassis_base_0", + "physical_robot_astribot_torso_link_1_0", + "physical_robot_astribot_torso_link_2_0", + "physical_robot_astribot_torso_link_3_0", + "physical_robot_astribot_torso_link_4_0", + "physical_robot_astribot_torso_link_4_1", + "physical_robot_astribot_torso_link_4_2", + "physical_robot_astribot_torso_link_4_3", + "physical_robot_astribot_arm_left_link_1_0", + "physical_robot_astribot_arm_left_link_2_0", + "physical_robot_astribot_arm_left_link_3_0", + "physical_robot_astribot_arm_left_link_4_0", + "physical_robot_astribot_arm_left_link_5_0", + "physical_robot_astribot_arm_left_link_6_0", + "physical_robot_astribot_arm_left_link_7_0", + "physical_robot_astribot_arm_right_link_1_0", + "physical_robot_astribot_arm_right_link_2_0", + "physical_robot_astribot_arm_right_link_3_0", + "physical_robot_astribot_arm_right_link_4_0", + "physical_robot_astribot_arm_right_link_5_0", + "physical_robot_astribot_arm_right_link_6_0", + "physical_robot_astribot_arm_right_link_7_0" + ], + "task_objects_present": false, + "task_verifier_present": false, + "task_success": null, + "source_episode_evaluations_added": 0, + "api_requests_added": 0 +} \ No newline at end of file diff --git a/1500case/relocate_dependency_bundle.py b/1500case/relocate_dependency_bundle.py new file mode 100644 index 0000000000000000000000000000000000000000..728a0e5b582998f1cd41156d792332df82bfa5f7 --- /dev/null +++ b/1500case/relocate_dependency_bundle.py @@ -0,0 +1,49 @@ +"""Create a separate portable copy of the manifest-listed RSSR dependencies.""" +from pathlib import Path +import argparse +import hashlib +import json + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--destination', type=Path, required=True) + args = parser.parse_args() + source = Path(__file__).resolve().parent + target = args.destination.absolute() + if target.exists() or target == source or target in source.parents: + raise ValueError('Destination must be a new directory, separate from the original download') + manifest = json.loads((source / 'dependency_bundle_manifest.json').read_text()) + replacements = [ + (manifest['source_experiment_root'], str(target)), + ('/pfs/yichen/r2r/models', str(target / 'source/models')), + ] + replacements.sort(key=lambda item: len(item[0]), reverse=True) + receipt = [] + for row in manifest['files']: + relative = Path(row['path']) + if relative.is_absolute() or '..' in relative.parts: + raise ValueError('Invalid manifest path') + original = source / relative + data = original.read_bytes() + if hashlib.sha256(data).hexdigest() != row['sha256']: + raise ValueError('Original dependency checksum mismatch: ' + str(relative)) + if relative.suffix.lower() in ('.py', '.xml', '.json'): + text = data.decode('utf-8') + for old, new in replacements: + text = text.replace(old, new) + data = text.encode('utf-8') + destination = target / relative + destination.parent.mkdir(parents=True, exist_ok=True) + destination.write_bytes(data) + receipt.append({'path': str(relative), 'original_sha256': row['sha256'], + 'portable_sha256': hashlib.sha256(data).hexdigest()}) + (target / 'relocation_receipt.json').write_text(json.dumps( + {'original_download': str(source), 'destination': str(target), + 'path_replacements': replacements, 'files': receipt}, indent=2) + '\n') + print(json.dumps({'destination': str(target), 'files': len(receipt), + 'originals_modified': False})) + + +if __name__ == '__main__': + main() diff --git a/1500case/source/agent_retarget/__init__.py b/1500case/source/agent_retarget/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ef8b04ab2f20e78f5c2a087c5bec4a385f6aaa59 --- /dev/null +++ b/1500case/source/agent_retarget/__init__.py @@ -0,0 +1 @@ +from .config import RetargetConfig, SEARCH_SPACE # noqa: F401 diff --git a/1500case/source/agent_retarget/config.py b/1500case/source/agent_retarget/config.py new file mode 100644 index 0000000000000000000000000000000000000000..682d2dbf2a27d2496caf4e518cdddbee2748c682 --- /dev/null +++ b/1500case/source/agent_retarget/config.py @@ -0,0 +1,125 @@ +""" +retarget 配置空间 Θ。 + +设计原则(对应 agent 设计文档): + · core_params:数值/离散型参数,CEM / 随机搜索 与 agent 搜索的是同一个空间 + · 每个字段都标注了它对应六类问题里的哪一类,便于 agent 做诊断→修复的关联 + · 默认值 = 朴素转换(identity retarget),即"什么都不修"的 baseline +""" +from dataclasses import dataclass, field, asdict +from typing import Tuple + +# JOINT_POSITION 控制器单个策略步能命令的关节角增量上限(rad)。 +# 实测:源演示在 20Hz 下有 13~27% 的帧需要超过 0.05rad(robosuite 默认值)的关节位移, +# 峰值 0.25rad。沿用默认值会让手臂持续落后、误差累积成 179mm 的末端偏差, +# 于是"IK 解得好不好"被执行层的限速掩盖。取 0.3rad 让执行层不再是瓶颈。 +JOINT_OUTPUT_MAX = 0.3 + + +@dataclass +class RetargetConfig: + # ---------- ① 几何标定类(Class I,闭式可解) ---------- + # 控制点偏移:在目标本体的夹爪坐标系下施加,用于补偿 flange→TCP 距离差异 + # (UR5e+Robotiq85 为 0.145m,Panda+PandaGripper 为 0.097m) + tcp_offset: Tuple[float, float, float] = (0.0, 0.0, 0.0) + # 控制点固定旋转偏移(轴角,夹爪坐标系):补偿末端坐标轴朝向约定差异 + tcp_rotation_offset: Tuple[float, float, float] = (0.0, 0.0, 0.0) + # 基座外参偏移(世界系):本例两本体基座相同,保留字段以支持其它本体对 + base_offset: Tuple[float, float, float] = (0.0, 0.0, 0.0) + # 仅作用于抓取之后的末端偏移(夹爪坐标系):补偿"物体被夹在手里的相对位姿"差异。 + # 这类偏移不能作用于全程,否则会破坏接近阶段的抓取几何。 + post_grasp_offset: Tuple[float, float, float] = (0.0, 0.0, 0.0) + + # ---------- ② 运动学结构类(Class II,无闭式解,仅 ik_joint 模式下生效) ---------- + # 位置/姿态残差权重:目标位姿在目标本体上够不到时,决定牺牲哪一个 + ik_pos_weight: float = 1.0 + ik_rot_weight: float = 1.0 + # Levenberg-Marquardt 阻尼 λ:大 = 近奇异位形稳定但收敛慢,小 = 收敛快但易发散 + ik_damping: float = 0.05 + # 冗余消解的零空间二级目标构型: + # "none"=不施加(朴素做法,7-DoF 的一维零空间被任意消解 -> 臂形漂移/肘部翻转) + # "init"=目标本体默认构型 "mid"=关节行程中点(最大化离限位距离) + # "prev"=上一帧的解(直接惩罚臂形变化,抑制跳变最有效) + ik_nullspace_target: str = "none" + ik_nullspace_gain: float = 0.0 + # 每帧求解的初值:"prev"=上一帧解(连续),"init"=每帧从默认构型重解(各帧独立) + ik_warm_start: str = "prev" + # 关节限位安全边界(rad):把可行区间从两端各收缩这么多 + ik_joint_limit_margin: float = 0.0 + # 上游共享自由度(躯干 / 升降柱 / 移动底座)参与冗余消解的权重。 + # 0 = 冻结上游,只用手臂求解(朴素做法:目标本体多出的自由度被浪费) + # 0~1 = 上游参与但移动得比手臂少("底座慢、手臂快"的优先级) + # >1 = 优先动上游 + # 目标位姿落在手臂可达集之外时,这是唯一能真正扩大可达集的参数 —— + # 放松姿态权重只是牺牲精度,并不能把末端送到更远的地方。 + upstream_weight: float = 0.0 + # 收敛预算 + ik_max_iters: int = 50 + ik_tol: float = 1.0 + + # ---------- ③ 末端执行器/抓取适配类 ---------- + # 夹爪指令线性重映射:cmd' = clip(scale * cmd + bias, -1, 1) + gripper_command_scale: float = 1.0 + gripper_command_bias: float = 0.0 + # 抓取时序提前/延后的控制步数(正数=提前闭合),补偿夹爪行程/闭合速度差异 + grasp_lead_steps: int = 0 + + # ---------- ④ 动作表示/控制类 ---------- + # 位姿伺服增益(1.0=一步走完全部误差,<1 更保守) + pos_gain: float = 1.0 + ori_gain: float = 1.0 + # 每个源时间步允许消耗的控制步数(>1 给目标本体更多时间收敛到位) + steps_per_source_step: int = 1 + # 在首次闭合夹爪的那一步额外停留的控制步数(让夹爪完全合拢再移动) + settle_steps_at_grasp: int = 0 + # 时间重采样倍率(<1 拉长轨迹,>1 压缩) + time_scale: float = 1.0 + + # ---------- ⑤ 接触动力学类 ---------- + # OSC 位置/姿态刚度缩放(相对于源本体使用的 kp=150) + kp_scale: float = 1.0 + + # ---------- 元信息 ---------- + # 由 agent 填写的修复历史,仅用于日志与表4统计,不影响执行 + notes: list = field(default_factory=list) + + def to_dict(self): + return asdict(self) + + @classmethod + def from_dict(cls, d): + d = {k: v for k, v in d.items() if k in cls.__dataclass_fields__} + return cls(**d) + + +# CEM / 随机搜索可搜索的字段及其取值范围(与 operators.PARAM_RANGES 保持一致, +# 保证 agent 与无推理基线搜索的是同一个空间,对比才公平) +SEARCH_SPACE = { + "tcp_offset": ((-0.10, -0.10, -0.10), (0.10, 0.10, 0.10)), + "tcp_rotation_offset": ((-0.6, -0.6, -0.6), (0.6, 0.6, 0.6)), + "post_grasp_offset": ((-0.10, -0.10, -0.10), (0.10, 0.10, 0.10)), + "gripper_command_scale": (0.2, 3.0), + "gripper_command_bias": (-1.0, 1.0), + "grasp_lead_steps": (-15, 15), + "pos_gain": (0.2, 2.0), + "ori_gain": (0.2, 2.0), + "steps_per_source_step": (1, 4), + "settle_steps_at_grasp": (0, 30), + # 上界放到 10:实测 ik_joint 模式下 kp_scale 1→3 把末端跟踪误差从 49mm 单调降到 + # 28mm 仍未见底,卡在 3.0 会让"执行层跟不上参考轨迹"这类问题没有出路可走 + "kp_scale": (0.3, 10.0), + # ② 运动学结构类(只在 ik_joint 模式下生效) + "ik_pos_weight": (0.2, 3.0), + "ik_rot_weight": (0.0, 3.0), + "ik_damping": (0.001, 0.5), + "ik_nullspace_gain": (0.0, 1.0), + "ik_joint_limit_margin": (0.0, 0.3), + "upstream_weight": (0.0, 2.0), + "ik_nullspace_target": ("none", "init", "mid", "prev"), + "ik_warm_start": ("prev", "init"), +} + +# 枚举型字段(随机搜索/CEM 要按类别采样,不能当连续量插值) +ENUM_FIELDS = { + k: v for k, v in SEARCH_SPACE.items() if isinstance(v[0], str) +} diff --git a/1500case/source/agent_retarget/embodiment.py b/1500case/source/agent_retarget/embodiment.py new file mode 100644 index 0000000000000000000000000000000000000000..c82d1baf69ed71e4a70cb361e39cfa1311cab24a --- /dev/null +++ b/1500case/source/agent_retarget/embodiment.py @@ -0,0 +1,211 @@ +""" +本体尺度与无量纲描述符。 + +为什么需要这一层 +---------------- +retarget 的诊断量大多是**长度**(mm)。绝对长度在不同本体上含义完全不同: +50mm 残差对臂展 0.3m 的桌面臂是 17%、对 0.7m 的六轴臂是 7%、对 1.2m 的人形臂是 4%。 +只要阈值写成 mm,规则就绑死在某一类机器人的尺度上,经验也无法跨本体检索。 + +因此本模块提供两件事: + · scale_m —— 目标本体的内在长度尺度(臂展),由运动学结构算出,不来自机型表 + · *_rel —— 把长度类诊断量除以 scale_m 得到的无量纲量 + +所有守卫、参数范围与经验签名都应使用无量纲量,这样: + · 同一条经验可以在尺度不同的本体对之间检索命中 + · "偏置大不大"变成"相对臂展百分之几",与机器人大小无关 + +注意:**成功判据仍然保留绝对 mm**。任务容差由被操作物体的尺寸决定, +与机器人臂展无关(真机验收也是看绝对精度),不能归一化掉。 +""" +from dataclasses import dataclass, field, asdict + +import numpy as np + +#: 缺少运动学信息时的兜底臂展(m)。取值使长度类参数范围在 +#: 六轴桌面臂(Piper/Panda 一类)上与历史绝对范围基本一致,保证旧实验可比。 +DEFAULT_REACH_M = 0.7 + +#: 长度类诊断字段 -> 无量纲字段名。值为向量时取 L2 范数。 +LENGTH_FIELDS_MM = { + "pos_err_mean_mm": "pos_err_rel", + "pos_err_max_mm": "pos_err_max_rel", + "ik_pos_residual_mean_mm": "ik_pos_residual_rel", + "ik_pos_residual_max_mm": "ik_pos_residual_max_rel", + "pos_bias_world_mm": "pos_bias_world_rel", + "pos_bias_gripper_frame_mm": "pos_bias_gripper_rel", + "left_pos_err_mean_mm": "left_pos_err_rel", + "right_pos_err_mean_mm": "right_pos_err_rel", +} + + +def chain_reach(model, data, joint_names, site_name=None): + """ + 用运动学链算臂展(m):沿关节锚点依次累加间距,末端接到工具 site。 + + 这是"完全伸展时末端能离肩多远"的上界估计。选它而不是采样工作空间, + 因为它 O(n)、确定性,且对连杆整体缩放严格线性 —— 正是尺度归一化需要的性质。 + + site_name 为空或模型里没有该 site 时(源本体模型常常只有连杆、不带工具 site), + 退化到链末关节所在连杆的几何末端,仍是同一个量纲的臂展估计。 + """ + import mujoco + + mujoco.mj_resetData(model, data) + mujoco.mj_forward(model, data) + + jnt_ids = [] + for name in joint_names: + jid = mujoco.mj_name2id(model, mujoco.mjtObj.mjOBJ_JOINT, name) + if jid >= 0: + jnt_ids.append(jid) + sid = mujoco.mj_name2id(model, mujoco.mjtObj.mjOBJ_SITE, + site_name) if site_name else -1 + return chain_reach_by_ids(model, data, jnt_ids, sid) + + +def chain_reach_by_ids(model, data, jnt_ids, site_id=-1): + """chain_reach 的按索引版本:给只有关节/site 索引(例如 robosuite 里)的调用方用。""" + import mujoco + + mujoco.mj_resetData(model, data) + mujoco.mj_forward(model, data) + + pts, last_bid = [], -1 + for jid in jnt_ids: + last_bid = int(model.jnt_bodyid[jid]) + pts.append(np.array(data.xpos[last_bid], dtype=float)) + + if site_id is not None and site_id >= 0: + pts.append(np.array(data.site_xpos[site_id], dtype=float)) + elif last_bid >= 0: + tip = _body_tip(model, data, last_bid) + if tip is not None: + pts.append(tip) + + if len(pts) < 2: + return None + return float(sum(np.linalg.norm(pts[i + 1] - pts[i]) for i in range(len(pts) - 1))) + + +def _body_tip(model, data, bid): + """连杆上离其原点最远的几何中心,用来给没有工具 site 的链补上末端。""" + origin = np.array(data.xpos[bid], dtype=float) + best, best_d = None, -1.0 + for gid in range(model.body_geomadr[bid], + model.body_geomadr[bid] + model.body_geomnum[bid]): + p = np.array(data.geom_xpos[gid], dtype=float) + d = float(np.linalg.norm(p - origin)) + if d > best_d: + best, best_d = p, d + return best + + +def trajectory_extent(traj_list): + """ + 用末端轨迹的包围盒对角长度估计源本体的动作尺度(m)。 + + 在拿不到源本体模型时作为 scale 的替代:它测的是"这段演示用掉多大空间", + 与臂展同量纲,足以支撑 reach_ratio 这类比值型描述符。 + """ + vals = [] + for traj in traj_list: + if traj is None or len(traj) == 0: + continue + arr = np.asarray(traj, dtype=float) + vals.append(float(np.linalg.norm(arr.max(axis=0) - arr.min(axis=0)))) + return float(np.mean(vals)) if vals else None + + +@dataclass +class Embodiment: + """ + 一次 retarget 的本体对描述符。 + + 刻意**不含**机器人名字:agent 与经验签名只应看到这些可测量、无量纲的量, + 这样"在什么样的本体对上适用"才是可判定、可跨对迁移的。 + 名字只用于人读的日志。 + """ + scale_m: float = DEFAULT_REACH_M # 目标本体臂展,长度归一化的分母 + source_scale_m: float = None # 源本体臂展 + #: source_scale_m 是否真的量自源本体运动学。拿不到源模型时它会退化成任务跨度, + #: 此时 reach_ratio 混了两种量,必须让下游知道,不能悄悄当臂展比用。 + source_scale_is_reach: bool = True + task_extent_m: float = None # 演示末端轨迹跨度:任务尺度,不是本体尺度 + dof_target: int = None # 目标单链自由度 + dof_source: int = None # 源单链自由度 + n_chains: int = 1 # 运动链数量(单臂=1,双臂=2) + #: 手臂上游、被各链共享的自由度数:躯干/升降柱=固定底座,底盘=移动底座。 + #: 它是"可达集能否被扩大"的结构性前提,也是固定底座与移动底座的唯一差别。 + upstream_dof: int = 0 + source_name: str = "" # 仅用于日志 + target_name: str = "" + + @property + def reach_ratio(self): + """目标/源 尺度比。>1 表示目标本体更大。""" + if not self.source_scale_m or not self.scale_m: + return None + return round(self.scale_m / self.source_scale_m, 4) + + @property + def task_extent_rel(self): + """任务跨度 / 目标臂展。>1 表示这段演示要求的活动范围超出单臂可达半径。""" + if not self.task_extent_m or not self.scale_m: + return None + return round(self.task_extent_m / self.scale_m, 4) + + @property + def dof_diff(self): + """目标比源多出的自由度数,等于 IK 零空间维数的上界。""" + if self.dof_target is None or self.dof_source is None: + return None + return int(self.dof_target - self.dof_source) + + def descriptor_fields(self): + """ + 进入诊断报告、可被经验签名引用的无量纲描述符。 + + 这些字段让一条经验能表达"我适用于目标本体明显更大、且多一个冗余自由度 + 的这类本体对",而不是"我适用于 S1"。 + """ + return { + "embodiment_scale_m": round(float(self.scale_m), 4) if self.scale_m else None, + "embodiment_reach_ratio": self.reach_ratio, + "embodiment_reach_ratio_is_exact": bool(self.source_scale_is_reach), + "embodiment_task_extent_rel": self.task_extent_rel, + "embodiment_dof_diff": self.dof_diff, + "embodiment_n_chains": int(self.n_chains), + "upstream_dof": int(self.upstream_dof), + } + + def to_dict(self): + d = asdict(self) + d.update(self.descriptor_fields()) + return d + + +def normalize_report(report, scale_m): + """ + 就地补上长度类诊断量的无量纲版本。 + + 向量字段取 L2 范数后归一化:守卫关心的是"偏得多不多",方向信息仍保留在原字段里。 + """ + if not scale_m or scale_m <= 0: + scale_m = DEFAULT_REACH_M + scale_mm = scale_m * 1000.0 + for src, dst in LENGTH_FIELDS_MM.items(): + v = report.get(src) + if v is None: + continue + arr = np.asarray(v, dtype=float) + mag = float(np.linalg.norm(arr)) if arr.ndim else float(arr) + report[dst] = round(mag / scale_mm, 6) + return report + + +def rel_to_mm(rel, scale_m): + """把无量纲阈值换回 mm,用于人读的错误信息。""" + if not scale_m or scale_m <= 0: + scale_m = DEFAULT_REACH_M + return rel * scale_m * 1000.0 diff --git a/1500case/source/agent_retarget/envs.py b/1500case/source/agent_retarget/envs.py new file mode 100644 index 0000000000000000000000000000000000000000..b47bdfaa4d2c82f9e560fceead99fed8acdf2260 --- /dev/null +++ b/1500case/source/agent_retarget/envs.py @@ -0,0 +1,103 @@ +"""环境构建,以及在两个本体之间同步物体初始状态。""" +import json + +import h5py +import numpy as np +import robosuite +import mimicgen # noqa: F401 -- 注册 Square_D0 / Threading_D0 等环境 +from robosuite.controllers import load_controller_config + +from .config import JOINT_OUTPUT_MAX + +# 各任务里"被操作物体"的自由关节名(用于跨本体同步初始状态 + 提取物体轨迹 GT) +TASK_OBJECT_JOINTS = { + "Square": ["SquareNut_joint0", "RoundNut_joint0"], + "Threading": ["needle_joint0", "tripod_joint0"], +} + +# 任务里"任务相关"的那个物体(GT 物体轨迹只看它) +TASK_PRIMARY_OBJECT = { + "Square": "SquareNut", + "Threading": "needle", +} + + +def task_family(env_name): + """Square_D0 -> Square, Threading_D1 -> Threading""" + return env_name.split("_D")[0] + + +def read_env_args(dataset_path): + with h5py.File(dataset_path, "r") as f: + return json.loads(f["data"].attrs["env_args"]) + + +def make_env(env_name, robot, kp_scale=1.0, controller="OSC_POSE"): + """ + 创建低维(无图像)环境。 + + controller 由执行方式决定: + · OSC_POSE 任务空间闭环跟踪(与 MimicGen 数据集一致),IK 隐含在控制器内 + · JOINT_POSITION 关节空间回放,用于执行显式 IK 解出的关节轨迹 + + initialization_noise=None 是刻意设置:robosuite 默认会给机器人初始关节角加 + 高斯噪声(magnitude=0.02),会让同一份配置的 rollout 结果在不同次运行间变化。 + agent 的搜索必须建立在确定性评测之上,否则无法区分"修复生效"和"运气好"。 + """ + ctrl = load_controller_config(default_controller=controller) + if controller == "OSC_POSE": + ctrl["kp"] = 150.0 * kp_scale + else: + # 关节空间控制器只接受 delta 关节角,上限见 JOINT_OUTPUT_MAX 的说明 + ctrl["kp"] = float(np.asarray(ctrl["kp"], dtype=float).mean()) * kp_scale + ctrl["output_max"], ctrl["output_min"] = JOINT_OUTPUT_MAX, -JOINT_OUTPUT_MAX + return robosuite.make( + env_name=env_name, + robots=robot, + has_renderer=False, + has_offscreen_renderer=False, + use_camera_obs=False, + use_object_obs=True, + ignore_done=True, + control_freq=20, + initialization_noise=None, + controller_configs=ctrl, + ) + + +def object_joint_names(env_name): + fam = task_family(env_name) + if fam in TASK_OBJECT_JOINTS: + return TASK_OBJECT_JOINTS[fam] + # 兜底:所有自由关节 + return None + + +def discover_object_joints(env): + """从环境里发现所有自由关节(type==0 即 mjJNT_FREE),用作物体关节名。""" + return [ + env.sim.model.joint_id2name(i) + for i in range(env.sim.model.njnt) + if env.sim.model.jnt_type[i] == 0 + ] + + +def get_object_state(env, joint_names): + """读取物体自由关节的 (pos, quat)。""" + return {name: np.array(env.sim.data.get_joint_qpos(name)) for name in joint_names} + + +def set_object_state(env, obj_state): + """把物体摆到指定位姿,并清零速度,使目标本体的场景与源演示初始场景一致。""" + for name, qpos in obj_state.items(): + env.sim.data.set_joint_qpos(name, qpos) + env.sim.data.set_joint_qvel(name, np.zeros(6)) + env.sim.forward() + + +def eef_pose(env): + """当前末端控制点(grip_site)在世界系下的位姿。""" + site_id = env.sim.model.site_name2id(env.robots[0].controller.eef_name) + pos = np.array(env.sim.data.site_xpos[site_id]) + mat = np.array(env.sim.data.site_xmat[site_id]).reshape(3, 3) + return pos, mat diff --git a/1500case/source/agent_retarget/evaluate.py b/1500case/source/agent_retarget/evaluate.py new file mode 100644 index 0000000000000000000000000000000000000000..66f40954518d8f3f71843075a38d03a114985cb9 --- /dev/null +++ b/1500case/source/agent_retarget/evaluate.py @@ -0,0 +1,365 @@ +""" +确定性 Evaluator:给一个配置 Θ,返回在一批 demo 上的聚合诊断报告。 + +agent 搜索、随机搜索、CEM 都通过这一个接口评测,保证对比公平。 +两个工程要点: + · 源演示的状态重放(提取 GT)很慢但与 Θ 无关,因此缓存到 npz,评测只跑目标本体 + · 环境关掉了 initialization_noise,同一个 Θ 重复评测结果完全一致 +""" +import hashlib +import json +import os +import pickle +from collections import Counter + +import numpy as np + +from . import envs as E +from .config import RetargetConfig +from .embodiment import DEFAULT_REACH_M +from .instrument import diagnose, rollout +from .retarget import Retargeter +from .source import GTTrace, SourceDemo, load_demo + +CACHE_DIR = os.environ["ICLR_DEMO_CACHE"] +EVAL_CACHE_DIR = os.environ["ICLR_EVAL_CACHE"] + +# 磁盘缓存的版本号。缓存键只包含 (Θ, 模式, 故障, 数据集, 本体, demo 集合), +# 因此**任何不体现在 Θ 里的管线改动都必须 +1**,否则会静默读到过期结果: +# · 新增/改名诊断报告字段(旧缓存里读不到新字段) +# · 改动执行层语义(曾因改了 JOINT_OUTPUT_MAX 而没升版本,读到旧的 179mm 结果) +# · 改动 IK 求解器的数值行为 +PIPELINE_VERSION = 7 # v7: 位姿信任域配平(ROT_BALANCE),改变 IK 的数值行为 + +# 各执行模式对应的目标本体控制器 +MODE_CONTROLLER = { + "open_loop": "OSC_POSE", + "pose_tracking": "OSC_POSE", + "ik_joint": "JOINT_POSITION", +} + + +def _cache_path(dataset, demo_key): + tag = os.path.basename(dataset).replace(".hdf5", "") + return os.path.join(CACHE_DIR, "native_source_unchecked_v11", tag, f"{demo_key}.pkl") + + +def load_demo_cached(dataset, demo_key, source_env_factory): + """带磁盘缓存的源演示加载。source_env_factory 只在缓存缺失时被调用。""" + path = _cache_path(dataset, demo_key) + if os.path.exists(path): + with open(path, "rb") as f: + d = pickle.load(f) + return SourceDemo(**d["demo"]), GTTrace(**d["gt"]) + + demo, gt = load_demo(dataset, demo_key, source_env_factory()) + os.makedirs(os.path.dirname(path), exist_ok=True) + tmp = path + f".tmp{os.getpid()}" + with open(tmp, "wb") as f: + pickle.dump({"demo": demo.__dict__, "gt": gt.__dict__}, f) + os.replace(tmp, path) + return demo, gt + + +class Evaluator: + """ + 对固定的 (数据集, 目标本体, 执行模式, demo 集合) 评测任意 Θ。 + + 用法: + ev = Evaluator(dataset, "Panda", mode="pose_tracking", demo_ids=range(10)) + report = ev(cfg) # 聚合诊断报告 + """ + + def __init__(self, dataset, target_robot, mode="pose_tracking", demo_ids=range(10), + perturb=None, cache_evals=True): + from .perturb import Perturbation + + self.dataset = dataset + self.target_robot = target_robot + self.mode = mode + # 注入的已知故障:影响执行,但不出现在 agent 的观测里 + self.perturb = perturb or Perturbation() + self.demo_ids = list(demo_ids) + self.env_args = E.read_env_args(dataset) + self.env_name = self.env_args["env_name"] + self.source_robot = self.env_args["env_kwargs"]["robots"][0] + + if mode not in MODE_CONTROLLER: + raise ValueError(f"未知模式 '{mode}',可用:{sorted(MODE_CONTROLLER)}") + + self._source_env = None + self._target_env = None + self._target_kp = None + self._ik_solver = None + self._eval_cache = {} if cache_evals else None + self.n_rollouts = 0 # 统计真实仿真开销(论文里报"评测预算") + + all_demos = [ + load_demo_cached(dataset, f"demo_{i}", self._get_source_env) + for i in self.demo_ids + ] + # Keep every selected public demonstration; source success is not assessed. + self.demos = all_demos + self.n_skipped_gt_fail = 0 + if not self.demos: + raise ValueError("Empty source demonstration selection") + + # ---------- 环境惰性构建与复用 ---------- + def _get_source_env(self): + if self._source_env is None: + self._source_env = E.make_env(self.env_name, self.source_robot) + return self._source_env + + def _get_target_env(self, kp_scale): + # kp 写在 controller 配置里,改动需要重建环境 + if self._target_env is None or self._target_kp != kp_scale: + if self._target_env is not None: + self._target_env.close() + self._target_env = E.make_env( + self.env_name, self.target_robot, kp_scale=kp_scale, + controller=MODE_CONTROLLER[self.mode], + ) + self._target_kp = kp_scale + self._ik_solver = None # 环境重建后求解器持有的模型句柄失效 + return self._target_env + + def _get_ik_solver(self, env): + if self._ik_solver is None: + from .ik import IKSolver + + self._ik_solver = IKSolver(env) + return self._ik_solver + + # ---------- 评测 ---------- + def __call__(self, cfg: RetargetConfig, mode=None): + mode = mode or self.mode + key = self.config_key(cfg, mode, self.perturb) + if self._eval_cache is not None and key in self._eval_cache: + return self._eval_cache[key] + + # 磁盘缓存跨进程共享:同一设置下的 4 种策略都会先评测默认 Θ, + # 不共享就要重复跑 4 遍相同的仿真 + disk = self._disk_get(key) + if disk is not None: + if self._eval_cache is not None: + self._eval_cache[key] = disk + return disk + + env = self._get_target_env(cfg.kp_scale) + solver = self._get_ik_solver(env) if mode == "ik_joint" else None + reports = [] + for demo, gt in self.demos: + rt = Retargeter(demo, cfg, mode=mode, perturb=self.perturb, ik_solver=solver) + rec = rollout(env, demo, rt, gt) + rep = diagnose(rec, demo, gt) + rep["demo"] = demo.demo_key + reports.append(rep) + self.n_rollouts += 1 + + agg = aggregate(reports) + agg["mode"] = mode + agg["env"] = self.env_name + agg["source_robot"] = self.source_robot + agg["target_robot"] = self.target_robot + agg["n_demos"] = len(reports) + agg["_per_demo"] = reports + if self._eval_cache is not None: + self._eval_cache[key] = agg + self._disk_put(key, agg) + return agg + + # ---------- 跨进程磁盘评测缓存 ---------- + def _disk_tag(self): + """同一 tag 下的评测结果才可互换:数据集、本体、模式、故障、demo 集合都要一致。""" + ids = hashlib.sha256(json.dumps(self.demo_ids).encode()).hexdigest()[:20] + return ( + f"v{PIPELINE_VERSION}" + f"__{os.path.basename(self.dataset).replace('.hdf5', '')}" + f"__{self.target_robot}__{self.mode}__{self.perturb.name}__{ids}" + ) + + def _disk_path(self, key): + return os.path.join(EVAL_CACHE_DIR, self._disk_tag(), f"{key}.json") + + def _disk_get(self, key): + path = self._disk_path(key) + if not os.path.exists(path): + return None + try: + with open(path) as f: + return json.load(f) + except (json.JSONDecodeError, OSError): + return None # 缓存损坏(例如上次被中断)则重算 + + def _disk_put(self, key, agg): + path = self._disk_path(key) + os.makedirs(os.path.dirname(path), exist_ok=True) + tmp = path + f".tmp{os.getpid()}" + try: + with open(tmp, "w") as f: + json.dump(agg, f, default=float) + os.replace(tmp, path) # 原子替换,避免并行进程读到半截文件 + except OSError: + pass + + @staticmethod + def config_key(cfg, mode, perturb=None): + d = cfg.to_dict() + d.pop("notes", None) + pt = perturb.to_dict() if perturb is not None else {"name": "F0_none"} + return hashlib.md5( + json.dumps({"cfg": d, "mode": mode, "perturb": pt}, sort_keys=True).encode() + ).hexdigest() + + def close(self): + for env in (self._source_env, self._target_env): + if env is not None: + env.close() + + +def _mean(reports, key): + vals = [r[key] for r in reports if r.get(key) is not None] + return float(np.mean(vals)) if vals else None + + +def _vec_mean(reports, key): + vals = [r[key] for r in reports if r.get(key) is not None] + return np.array(vals).mean(axis=0).round(4).tolist() if vals else None + + +def _vec_std(reports, key): + vals = [r[key] for r in reports if r.get(key) is not None] + return np.array(vals).std(axis=0).round(4).tolist() if vals else None + + +def aggregate(reports): + """把逐 demo 报告压成一份聚合诊断报告(这就是喂给 agent 的观测)。""" + return { + "success_rate": float(np.mean([r["success"] for r in reports])), + "gt_success_rate": None, # Deliberately unmeasured, not assumed successful. + "grasp_rate": float(np.mean([r["grasp_achieved"] for r in reports])), + "failure_phases": dict(Counter(r["failure_phase"] for r in reports)), + "pos_err_mean_mm": _mean(reports, "pos_err_mean_mm"), + "pos_err_max_mm": _mean(reports, "pos_err_max_mm"), + "pos_bias_gripper_frame_mm": _vec_mean(reports, "pos_bias_gripper_frame_mm"), + "pos_bias_gripper_frame_std_across_demos_mm": _vec_std( + reports, "pos_bias_gripper_frame_mm" + ), + "ori_err_mean_deg": _mean(reports, "ori_err_mean_deg"), + "ori_err_max_deg": _mean(reports, "ori_err_max_deg"), + "ori_bias_gripper_frame_deg": _vec_mean(reports, "ori_bias_gripper_frame_deg"), + "ori_bias_gripper_frame_std_deg": _vec_std(reports, "ori_bias_gripper_frame_deg"), + "object_residual_gripper_frame_mm": _vec_mean( + reports, "object_residual_gripper_frame_mm" + ), + "object_residual_gripper_frame_std_mm": _vec_std( + reports, "object_residual_gripper_frame_mm" + ), + "object_orientation_residual_gripper_frame_deg": _vec_mean( + reports, "object_orientation_residual_gripper_frame_deg" + ), + "object_orientation_residual_gripper_frame_std_deg": _vec_std( + reports, "object_orientation_residual_gripper_frame_deg" + ), + "grasp_geometry_gap_m": _vec_mean(reports, "grasp_geometry_gap_m"), + "grasp_geometry_gap_std_m": _vec_std(reports, "grasp_geometry_gap_m"), + "grasp_orientation_gap_deg": _vec_mean(reports, "grasp_orientation_gap_deg"), + "grasp_orientation_gap_std_deg": _vec_std(reports, "grasp_orientation_gap_deg"), + "grasp_step_delta": _mean(reports, "grasp_step_delta"), + "grasp_duration_ratio": _mean(reports, "grasp_duration_ratio"), + "object_pos_err_mean_mm": _mean(reports, "object_pos_err_mean_mm"), + "object_pos_err_final_mm": _mean(reports, "object_pos_err_final_mm"), + "object_displacement_m": _mean(reports, "object_displacement_m"), + "gt_object_displacement_m": _mean(reports, "gt_object_displacement_m"), + "joint_limit_saturated_ratio": _mean(reports, "joint_limit_saturated_ratio"), + "joint_limit_saturated_joints": sorted( + {j for r in reports for j in r["joint_limit_saturated_joints"]} + ), + "joint_vel_max": _vec_mean(reports, "joint_vel_max"), + # ---- IK 阶段(② 运动学结构类的直接证据,仅 ik_joint 模式非空)---- + "ik_pos_residual_mean_mm": _mean(reports, "ik_pos_residual_mean_mm"), + "ik_pos_residual_max_mm": _mean(reports, "ik_pos_residual_max_mm"), + "ik_rot_residual_mean_deg": _mean(reports, "ik_rot_residual_mean_deg"), + "ik_rot_residual_max_deg": _mean(reports, "ik_rot_residual_max_deg"), + "ik_unconverged_ratio": _mean(reports, "ik_unconverged_ratio"), + "ik_iters_mean": _mean(reports, "ik_iters_mean"), + "ik_joint_jump_max_rad": _mean(reports, "ik_joint_jump_max_rad"), + "ik_joint_jump_per_joint_rad": _vec_mean(reports, "ik_joint_jump_per_joint_rad"), + "ik_n_large_joint_jumps": _mean(reports, "ik_n_large_joint_jumps"), + "ik_min_singular_value": _mean(reports, "ik_min_singular_value"), + "ik_solution_min_slack_rad": _vec_mean(reports, "ik_solution_min_slack_rad"), + "ik_solution_limit_hit_ratio": _mean(reports, "ik_solution_limit_hit_ratio"), + "ik_joint_track_err_mean_rad": _mean(reports, "ik_joint_track_err_mean_rad"), + "ik_joint_track_err_max_rad": _mean(reports, "ik_joint_track_err_max_rad"), + } + + +#: 保真度项的半衰尺度与权重。 +#: 半衰尺度取臂展的 5%(0.7m 臂上约 35mm):误差到这个量级时保真度减半, +#: 与"抓取级精度"同量级,所以分数的敏感区正好压在有意义的误差范围上。 +FIDELITY_TAU_REL = 0.05 +FIDELITY_WEIGHT = 200.0 + +#: 姿态保真度的半衰角与权重。角度本身已无量纲,不需要按臂展归一。 +#: 权重取位置项的四分之一:姿态错了通常仍能完成任务,位置错了不能。 +ORI_FIDELITY_TAU_DEG = 10.0 +ORI_FIDELITY_WEIGHT = 50.0 + +#: 旋转角的物理上限。越界只可能来自数值发散,截断以免污染分数。 +ORI_ERR_MAX_DEG = 180.0 + + +def pos_err_rel(agg): + """位置误差相对目标臂展的无量纲值。Track C 已直接给出;Track A/B 用尺度换算。""" + rel = agg.get("pos_err_rel") + if rel is not None: + return float(rel) + mm = agg.get("pos_err_mean_mm") + if mm is None: + return None + scale_m = agg.get("embodiment_scale_m") or DEFAULT_REACH_M + return float(mm) / (float(scale_m) * 1000.0) + + +def score(agg): + """ + 标量目标:任务成功率为主,retarget 保真度为稠密项。 + + 为什么保真度不能写成 "−误差×小系数" + ---------------------------------- + 100 条 demo 下多成功 1 条就是 +10 分,而线性误差项每毫米只值 0.02 分, + 于是"精度换成功率"永远划算:实测出现过均值误差从 118mm 劣化到 230mm、 + 分数却因为多成功 3 条而上升的情况 —— 优化器报告进步,retarget 质量反而退了一倍。 + 这里改成有界、无量纲、且在整个误差范围内都保留梯度的洛伦兹型保真度: + · 无量纲(除以臂展)—— 换个尺寸的本体,同一分数含义不变 + · 有界(0~FIDELITY_WEIGHT)—— 不会喧宾夺主盖过成功率 + · 长尾不饱和 —— 成功率还是 0 的平台期仍有方向,这正是最需要梯度的时候 + + 姿态项同理必须有界。它原先写成 "−ori_err_mean_deg × 0.01",看着无害, + 但一旦姿态误差因数值问题发散(曾读到 6.37e9 度),这一项就能把 1000 量级的 + 成功率项彻底淹没:实测有一次复用做到了 success_rate=1.00、位置误差 1.8mm + (全实验最好),却因为一个假的姿态读数被判为退步而丢弃。 + + 接触类字段(grasp_rate 等)只在评测器真正测到时计入 —— 缺省/None + 表示纯运动学评测,避免把假的 grasp_rate=1 写进分数。 + """ + s = (agg.get("success_rate") or 0.0) * 1000.0 + grasp = agg.get("grasp_rate") + if grasp is not None: + s += float(grasp) * 100.0 + s += (agg.get("grasp_duration_ratio") or 0.0) * 20.0 + s -= (agg.get("object_pos_err_final_mm") or 0.0) * 0.05 + rel = pos_err_rel(agg) + if rel is not None: + s += FIDELITY_WEIGHT / (1.0 + max(rel, 0.0) / FIDELITY_TAU_REL) + ori = agg.get("ori_err_mean_deg") + if ori is not None: + ori = min(max(float(ori), 0.0), ORI_ERR_MAX_DEG) + s += ORI_FIDELITY_WEIGHT / (1.0 + ori / ORI_FIDELITY_TAU_DEG) + if agg.get("ik_unconverged_ratio") is not None: + s -= float(agg["ik_unconverged_ratio"]) * 15.0 + if agg.get("table_collision_fraction") is not None: + s -= 200.0 * agg["table_collision_fraction"] + s -= min(100., float(agg.get("table_penetration_max_mm") or 0.)) + s -= 50.0 * min(2., max(0., float(agg.get("joint_path_jump_max_rad") or 0.) - .3)) + return float(s) diff --git a/1500case/source/agent_retarget/ik.py b/1500case/source/agent_retarget/ik.py new file mode 100644 index 0000000000000000000000000000000000000000..b96f4ed6c79661b3a42c895cfa690a840be8afdb --- /dev/null +++ b/1500case/source/agent_retarget/ik.py @@ -0,0 +1,284 @@ +""" +显式逆运动学阶段:把源本体的末端位姿轨迹解成目标本体的关节轨迹。 + +为什么要自己写而不用 robosuite 自带的 IK_POSE: + agent 要修的就是 IK 的配置本身(零空间二级目标、位置/姿态权重、阻尼、warm start、 + 限位边界)。现成控制器把这些旋钮封在内部,agent 无从下手。这里把它们全部提到 + Θ 里,于是"运动学结构类"(Class II)问题才真正可诊断、可修复。 + +这一阶段产生的故障与几何标定类故障性质不同,**没有闭式解**: + · 源本体 6-DoF 的位姿轨迹交给 7-DoF 的目标本体,有一维零空间。朴素逐帧 IK + 任意消解它 —— 相邻帧可能落到完全不同的臂形上(肘部翻转),关节轨迹出现跳变 + · 零空间目标选得不好会把手臂推向关节限位,末端跟着失真 + · 近奇异位形下阻尼不足 -> 关节速度爆炸;阻尼过大 -> 跟不上 +这些只能靠"观测遥测 -> 调整策略 -> 重解 -> 验证"的循环处理,正是 agent 的用武之地。 + +求解器:带零空间投影与限位回避的阻尼最小二乘(Levenberg-Marquardt)。 +""" +import os + +import mujoco +import numpy as np + +from .embodiment import DEFAULT_REACH_M, chain_reach_by_ids + +# 收敛判据(与 Θ 里的 ik_tol 相乘得到实际阈值)。长度类常数以臂展为单位表示, +# 否则同一份 Θ 换个尺寸的机器人就会隐式变松或变紧。参考臂展下与原先的 1mm 等价。 +POS_TOL_REL = 1e-3 / DEFAULT_REACH_M +BASE_ROT_TOL = np.radians(1.0) + +# 数值安全限幅(求解器内部实现细节,不属于 Θ)。 +# 不做限幅的裸 DLS 在近奇异位形下会发散:实测 λ=0.005 时残差从 9.5mm 恶化到 105mm、 +# 关节跳变达 2rad —— 那是数值发散,不是"阻尼太小"这个物理结论。 +POS_STEP_REL = 0.05 / DEFAULT_REACH_M # 单次迭代最多消除 7% 臂展的位置误差 +MAX_ROT_STEP = np.radians(30.0) # 角度天然无量纲,无需归一化 +MAX_DQ_STEP = 0.2 # 单次迭代任一关节最多转 0.2rad + +#: 位置与姿态的信任域必须在**关节空间**里等价,否则位姿等权只是名义上的。 +#: 位置步长 POS_STEP_REL·L 米对应的关节增量约为 POS_STEP_REL·L / L = POS_STEP_REL +#: 弧度(位置雅可比幅值 ~L),而姿态步长 MAX_ROT_STEP 弧度对应的关节增量就是它本身。 +#: 两者相差 MAX_ROT_STEP / POS_STEP_REL ≈ 8.2 倍,dq 随后又被 MAX_DQ_STEP 统一裁剪, +#: 于是姿态需求吃掉整个步长预算、位置几乎不动 —— 表现为位置和姿态同时收敛失败。 +#: 这个因子把两个信任域拉平,使 ik_rot_weight=1.0 真正表示"位姿等权"。 +#: 它由两个无量纲常数之比构成,因此本身不随本体大小变化,与 ik_damping 按臂展缩放 +#: 属于同一类归一化修正。 +#: 设 R2R_LEGACY_ROT_WEIGHT=1 可退回修正前的行为,用于复现 2026-08-21 之前的结果。 +ROT_BALANCE = POS_STEP_REL / MAX_ROT_STEP +if os.environ.get("R2R_LEGACY_ROT_WEIGHT") == "1": + ROT_BALANCE = 1.0 + + +def _clip_norm(v, max_norm): + n = np.linalg.norm(v) + return v * (max_norm / n) if n > max_norm else v + + +def _axisangle_from_mat(R): + """ + 旋转矩阵 -> 轴角向量(模长为旋转角,rad,恒 ≤ π)。 + + ang→π 时 sin(ang) 下溢,反对称部分 [R21-R12, ...] 的真值 2·sin(ang)·a 会退化到 + 与浮点噪声同量级,再除以 2·sin(ang) 就会放大出天文数字(实测姿态误差读到过 + 6.37e9 度)。因此接近 π 时改从对称部分取轴:ang=π 处 (R+I)/2 = a·aᵀ, + 取对角元最大的列归一化即得 ±a(此时 ±a 表示同一个旋转,符号无所谓)。 + 最后统一"单位轴 × 角度",模长由构造保证等于 ang。 + """ + c = (np.trace(R) - 1.0) / 2.0 + ang = float(np.arccos(np.clip(c, -1.0, 1.0))) + if ang < 1e-9: + return np.zeros(3) + + v = np.array([R[2, 1] - R[1, 2], R[0, 2] - R[2, 0], R[1, 0] - R[0, 1]]) + if np.sin(ang) > 1e-6: + axis = v + else: + M = (R + np.eye(3)) / 2.0 + axis = M[:, int(np.argmax(np.diag(M)))] + if float(axis @ v) < 0.0: + axis = -axis + + n = float(np.linalg.norm(axis)) + if n < 1e-12: + return np.zeros(3) + return axis / n * ang + + +class IKSolver: + """ + 对固定的(目标本体模型, 末端 site)求解逐帧 IK。 + + 用法: + soc = IKSolver(env) + q_traj, telem = solver.solve_trajectory(targets_pos, targets_mat, cfg) + """ + + def __init__(self, env): + self.model = env.sim.model._model + self.data = mujoco.MjData(self.model) + robot = env.robots[0] + + self.site_id = env.sim.model.site_name2id(robot.controller.eef_name) + self.jnt_idx = list(robot._ref_joint_indexes) + self.qpos_adr = np.array( + [env.sim.model.jnt_qposadr[i] for i in self.jnt_idx], dtype=int + ) + self.dof_adr = np.array( + [env.sim.model.jnt_dofadr[i] for i in self.jnt_idx], dtype=int + ) + self.n = len(self.jnt_idx) + self.jnt_range = np.array(env.sim.model.jnt_range[self.jnt_idx], dtype=float) + self.q_init = np.array(robot.init_qpos, dtype=float) + # 关节行程中点:ik_nullspace_target="mid" 时用它,最大化离限位的距离 + self.q_mid = self.jnt_range.mean(axis=1) + # 求解基准 qpos(含物体与夹爪),只改机械臂关节 + self.qpos0 = np.array(env.sim.data.qpos, dtype=float) + self.scale_m = (chain_reach_by_ids(self.model, self.data, + self.jnt_idx, self.site_id) + or DEFAULT_REACH_M) + + self._jacp = np.zeros((3, self.model.nv)) + self._jacr = np.zeros((3, self.model.nv)) + + # ---------------------------------------------------------- 正运动学 + def _fk(self, q): + self.data.qpos[:] = self.qpos0 + self.data.qpos[self.qpos_adr] = q + mujoco.mj_kinematics(self.model, self.data) + mujoco.mj_comPos(self.model, self.data) + pos = np.array(self.data.site_xpos[self.site_id]) + mat = np.array(self.data.site_xmat[self.site_id]).reshape(3, 3) + return pos, mat + + def _jacobian(self): + mujoco.mj_jacSite(self.model, self.data, self._jacp, self._jacr, self.site_id) + return self._jacp[:, self.dof_adr], self._jacr[:, self.dof_adr] + + def forward_kinematics(self, q): + return self._fk(q) + + # ---------------------------------------------------------- 单帧求解 + def solve_frame(self, tgt_pos, tgt_mat, q_seed, cfg): + """ + 返回 (q, 单帧遥测)。 + 遥测里的残差是**求解器自己知道的**误差,与执行阶段的跟踪误差是两回事: + 残差大 = 目标位姿在目标本体上够不到(结构性不可达),不是控制问题。 + """ + w_p = float(cfg.ik_pos_weight) + w_r = float(cfg.ik_rot_weight) * ROT_BALANCE + # 雅可比元素量纲 m/rad 随臂展线性增长,JJᵀ ~ L²,阻尼必须同步缩放, + # 否则同一个 λ 在大本体上等效欠阻尼、在小本体上过阻尼 + lam = float(cfg.ik_damping) * self.scale_m / DEFAULT_REACH_M + k_ns = float(cfg.ik_nullspace_gain) + margin = float(cfg.ik_joint_limit_margin) + pos_tol = POS_TOL_REL * self.scale_m * float(cfg.ik_tol) + pos_step = POS_STEP_REL * self.scale_m + rot_tol = BASE_ROT_TOL * float(cfg.ik_tol) + + q_ns = self._nullspace_reference(q_seed, cfg) + lo = self.jnt_range[:, 0] + margin + hi = self.jnt_range[:, 1] - margin + # 边界过宽会导致区间反转,此时退回原始限位 + bad = lo >= hi + lo[bad], hi[bad] = self.jnt_range[bad, 0], self.jnt_range[bad, 1] + + q = np.clip(np.array(q_seed, dtype=float), lo, hi) + n_iters, converged = 0, False + min_sv = np.inf + for n_iters in range(1, int(cfg.ik_max_iters) + 1): + cur_pos, cur_mat = self._fk(q) + e_pos = tgt_pos - cur_pos + e_rot = _axisangle_from_mat(tgt_mat @ cur_mat.T) + # 收敛判据只检查**权重非零**的分量:把姿态权重降到 0 就等于宣布不再管姿态, + # 此时仍要求姿态达标会让每一帧都判为"未收敛",掩盖真实的求解质量 + if (np.linalg.norm(e_pos) < pos_tol or w_p == 0.0) and \ + (np.linalg.norm(e_rot) < rot_tol or w_r == 0.0): + converged = True + break + + Jp, Jr = self._jacobian() + J = np.vstack([w_p * Jp, w_r * Jr]) + # 限幅后再进 DLS:一次迭代只朝目标走一小步,避免远距离/近奇异下的发散 + e = np.concatenate([ + w_p * _clip_norm(e_pos, pos_step), + w_r * _clip_norm(e_rot, MAX_ROT_STEP), + ]) + + sv = np.linalg.svd(J, compute_uv=False) + min_sv = min(min_sv, float(sv[-1])) + + # 阻尼最小二乘:dq = J^T (J J^T + λ²I)^-1 e + JJt = J @ J.T + (lam ** 2) * np.eye(6) + dq = J.T @ np.linalg.solve(JJt, e) + + # 零空间二级目标:在不影响末端位姿的子空间里把关节拉向参考构型 + if k_ns > 0.0 and q_ns is not None: + J_pinv = J.T @ np.linalg.solve(JJt, np.eye(6)) + N = np.eye(self.n) - J_pinv @ J + dq = dq + N @ (k_ns * (q_ns - q)) + + dq = np.clip(dq, -MAX_DQ_STEP, MAX_DQ_STEP) + q = np.clip(q + dq, lo, hi) + + cur_pos, cur_mat = self._fk(q) + telem = { + "pos_residual_m": float(np.linalg.norm(tgt_pos - cur_pos)), + "rot_residual_rad": float( + np.linalg.norm(_axisangle_from_mat(tgt_mat @ cur_mat.T)) + ), + "n_iters": n_iters, + "converged": converged, + "min_singular_value": float(min_sv) if np.isfinite(min_sv) else None, + } + return q, telem + + def _nullspace_reference(self, q_seed, cfg): + """零空间二级目标的参考构型。这是 7-DoF 冗余消解的核心选择。""" + mode = cfg.ik_nullspace_target + if mode == "none": + return None + if mode == "init": + return self.q_init + if mode == "mid": + return self.q_mid + if mode == "prev": + # 拉向上一帧的解:直接惩罚臂形变化,是抑制肘部翻转最直接的手段 + return np.array(q_seed, dtype=float) + raise ValueError(f"未知的 ik_nullspace_target='{mode}'") + + # ---------------------------------------------------------- 整条轨迹 + def solve_trajectory(self, targets_pos, targets_mat, cfg): + """ + 逐帧求解并返回 (关节轨迹, 轨迹级遥测)。 + + warm start 决定每帧的初值: + · "prev" 用上一帧的解(连续,但一旦跳到别的臂形就会一路错下去) + · "init" 每帧都从默认构型重解(各帧独立,最容易出现相邻帧臂形突变) + """ + q_traj, telems = [], [] + q_seed = self.q_init.copy() + for tgt_pos, tgt_mat in zip(targets_pos, targets_mat): + q, telem = self.solve_frame(tgt_pos, tgt_mat, q_seed, cfg) + q_traj.append(q) + telems.append(telem) + q_seed = q if cfg.ik_warm_start == "prev" else self.q_init.copy() + + q_traj = np.array(q_traj) + return q_traj, self._aggregate(q_traj, telems) + + def _aggregate(self, q_traj, telems): + pos_res = np.array([t["pos_residual_m"] for t in telems]) + rot_res = np.array([t["rot_residual_rad"] for t in telems]) + n_iters = np.array([t["n_iters"] for t in telems]) + conv = np.array([t["converged"] for t in telems]) + svs = [t["min_singular_value"] for t in telems + if t["min_singular_value"] is not None] + + # 相邻帧关节角跳变:零空间漂移/肘部翻转的直接证据。 + # 末端位姿是连续的,所以关节轨迹本应连续;出现大跳变只能是冗余消解跳到了 + # 另一个臂形(对 6-DoF 源 -> 7-DoF 目标,这是本体差异固有的结构型故障) + if len(q_traj) > 1: + dq = np.abs(np.diff(q_traj, axis=0)) + jump_max = float(dq.max()) + jump_per_joint = dq.max(axis=0).round(4).tolist() + # 一帧内某关节动超过 0.5rad,在 20Hz 下已经不是可执行的平滑运动 + n_jumps = int((dq.max(axis=1) > 0.5).sum()) + else: + jump_max, jump_per_joint, n_jumps = 0.0, [0.0] * self.n, 0 + + slack = np.minimum( + q_traj - self.jnt_range[:, 0], self.jnt_range[:, 1] - q_traj + ) + return { + "ik_pos_residual_mean_mm": float(pos_res.mean() * 1000), + "ik_pos_residual_max_mm": float(pos_res.max() * 1000), + "ik_rot_residual_mean_deg": float(np.degrees(rot_res).mean()), + "ik_rot_residual_max_deg": float(np.degrees(rot_res).max()), + "ik_unconverged_ratio": float(1.0 - conv.mean()), + "ik_iters_mean": float(n_iters.mean()), + "ik_joint_jump_max_rad": jump_max, + "ik_joint_jump_per_joint_rad": jump_per_joint, + "ik_n_large_joint_jumps": n_jumps, + "ik_min_singular_value": float(np.min(svs)) if svs else None, + "ik_solution_min_slack_rad": slack.min(axis=0).round(4).tolist(), + "ik_solution_limit_hit_ratio": float((slack < 0.05).any(axis=1).mean()), + } diff --git a/1500case/source/agent_retarget/instrument.py b/1500case/source/agent_retarget/instrument.py new file mode 100644 index 0000000000000000000000000000000000000000..d9785e216a80b728829ffe88b9206fe59d2d9e25 --- /dev/null +++ b/1500case/source/agent_retarget/instrument.py @@ -0,0 +1,259 @@ +""" +Instrumentation:在目标本体上执行转换后的轨迹,并产出**结构化诊断报告**。 + +这是整个 agent 设计的地基:agent 能不能推理,取决于喂给它的是"物理上有意义的残差" +还是"一个黑箱成功率"。因此这里刻意不只记 success,而是记录能直接支撑诊断的量: + · 位姿跟踪残差(含在夹爪坐标系下的**恒定偏置**,这是 flange→TCP 类问题的直接证据) + · 抓取时刻的"末端↔物体"相对位姿与 GT 的差(抓取几何不匹配的直接证据) + · 关节触限、关节速度尖峰(近奇异)、非预期碰撞(结构型问题的证据) + · 失败发生在哪个阶段(never_reached / no_grasp / grasp_lost / task_failed) +""" +from dataclasses import dataclass, field +from typing import Dict, List + +import numpy as np + +from . import envs as E +from .source import collision_geoms_of + + +def _rot_angle(R): + """旋转矩阵对应的旋转角(rad)。""" + c = (np.trace(R) - 1.0) / 2.0 + return float(np.arccos(np.clip(c, -1.0, 1.0))) + + +def _axisangle(R): + """旋转矩阵 -> 轴角向量(模长为旋转角,rad)。""" + ang = _rot_angle(R) + if ang < 1e-8: + return np.zeros(3) + axis = np.array([R[2, 1] - R[1, 2], R[0, 2] - R[2, 0], R[1, 0] - R[0, 1]]) + return axis / (2.0 * np.sin(ang)) * ang + + +def _quat_wxyz_to_mat(q): + """MuJoCo 自由关节的四元数是 (w,x,y,z) 顺序,转旋转矩阵。""" + w, x, y, z = q + n = w * w + x * x + y * y + z * z + if n < 1e-12: + return np.eye(3) + s = 2.0 / n + return np.array([ + [1 - s * (y * y + z * z), s * (x * y - w * z), s * (x * z + w * y)], + [s * (x * y + w * z), 1 - s * (x * x + z * z), s * (y * z - w * x)], + [s * (x * z - w * y), s * (y * z + w * x), 1 - s * (x * x + y * y)], + ]) + + +def _mean_axisangle(mats): + """一组旋转矩阵的平均轴角向量(小角度下等价于旋转向量取均值)。""" + return np.mean([_axisangle(m) for m in mats], axis=0) + + +def rollout(target_env, demo, retargeter, gt=None): + """在目标本体上执行,返回逐步的原始记录。""" + cfg = retargeter.cfg + from scene_binding import bind_scene + bind_scene(target_env,demo) + + robot = target_env.robots[0] + arm_joint_idx = robot._ref_joint_indexes + jnt_range = target_env.sim.model.jnt_range[arm_joint_idx] + # 关节 id 与 qpos 下标在 Panda 上恰好一致,但不能依赖这点:显式取 qpos 地址 + qpos_adr = np.array( + [target_env.sim.model.jnt_qposadr[i] for i in arm_joint_idx], dtype=int + ) + + obj_joints = list(demo.object_init.keys()) + primary_joint = gt.primary_joint if gt is not None else obj_joints[0] + primary_geoms = collision_geoms_of(target_env, primary_joint.split("_joint")[0]) + + rec = dict( + target_pos=[], achieved_pos=[], achieved_mat=[], pos_err=[], pos_err_gripper_frame=[], + ori_err_angle=[], ori_err_axisangle_gripper_frame=[], + joint_qpos=[], joint_vel=[], limit_slack=[], + grasp=[], object_pose=[], eef_to_obj_gripper_frame=[], gripper_cmd=[], + ) + + n_ctrl_steps = max(1, int(cfg.steps_per_source_step)) + for t in range(retargeter.n_steps): + for _ in range(n_ctrl_steps + retargeter.extra_settle_steps(t)): + cur_pos, cur_mat = E.eef_pose(target_env) + cur_q = np.array(target_env.sim.data.qpos[qpos_adr]) + action = retargeter.action(t, cur_pos, cur_mat, cur_q) + target_env.step(action) + + cur_pos, cur_mat = E.eef_pose(target_env) + tgt_pos, tgt_mat = retargeter.targets_pos[t], retargeter.targets_mat[t] + + err_world = cur_pos - tgt_pos + rec["target_pos"].append(tgt_pos.copy()) + rec["achieved_pos"].append(cur_pos.copy()) + rec["achieved_mat"].append(cur_mat.copy()) + rec["pos_err"].append(err_world) + # 把误差旋到夹爪坐标系:若是 flange→TCP 类问题,这里会呈现恒定偏置 + rec["pos_err_gripper_frame"].append(cur_mat.T @ err_world) + R_err = tgt_mat @ cur_mat.T + rec["ori_err_angle"].append(_rot_angle(R_err)) + # 姿态误差写成夹爪系下的轴角向量,便于识别"恒定坐标轴约定偏差" + rec["ori_err_axisangle_gripper_frame"].append(_axisangle(cur_mat.T @ R_err @ cur_mat)) + + q = np.array(target_env.sim.data.qpos[qpos_adr]) + rec["joint_qpos"].append(q) + rec["joint_vel"].append(np.array(target_env.sim.data.qvel[arm_joint_idx])) + # 距最近关节限位的余量(rad),越小越危险 + rec["limit_slack"].append(np.minimum(q - jnt_range[:, 0], jnt_range[:, 1] - q)) + + rec["grasp"].append( + bool(target_env._check_grasp(gripper=robot.gripper, object_geoms=primary_geoms)) + ) + obj_qpos = np.array(target_env.sim.data.get_joint_qpos(primary_joint)) + rec["object_pose"].append(obj_qpos) + rec["eef_to_obj_gripper_frame"].append(cur_mat.T @ (obj_qpos[:3] - cur_pos)) + rec["gripper_cmd"].append(float(retargeter.gripper_seq[t])) + + rec = {k: np.array(v) for k, v in rec.items()} + rec["success"] = bool(target_env._check_success()) + rec["primary_joint"] = primary_joint + rec["ik_telemetry"] = retargeter.ik_telemetry + # IK 规划的关节轨迹 vs 实际执行到的关节角:区分"IK 解错了"和"关节轨迹跟不上" + if retargeter.q_traj is not None: + n = min(len(retargeter.q_traj), len(rec["joint_qpos"])) + rec["joint_track_err"] = rec["joint_qpos"][:n] - retargeter.q_traj[:n] + else: + rec["joint_track_err"] = None + return rec + + +def diagnose(rec, demo, gt): + """把逐步记录压缩成结构化诊断报告(喂给 agent 的就是这个 dict)。""" + pos_err = rec["pos_err"] + err_gf = rec["pos_err_gripper_frame"] + + grasp = rec["grasp"] + grasp_idx = np.where(grasp)[0] + grasp_step = int(grasp_idx[0]) if len(grasp_idx) else -1 + + # 抓取几何不匹配:在 GT 抓取时刻,"末端→物体"的相对位置 与 目标本体上的对应量之差 + grasp_geometry_gap = None + grasp_orientation_gap = None + if 0 <= gt.grasp_step < len(rec["eef_to_obj_gripper_frame"]): + s = gt.grasp_step + gt_traj = gt.object_traj[rec["primary_joint"]] + gt_obj = gt_traj[s][:3] + gt_eef = demo.eef_pos[s] + gt_mat = demo.eef_mat[s] + gt_rel = gt_mat.T @ (gt_obj - gt_eef) + tgt_rel = rec["eef_to_obj_gripper_frame"][s] + grasp_geometry_gap = (tgt_rel - gt_rel).tolist() + + # 抓取瞬间的**朝向**差:位置量的旋转对偶。 + # 必须测在抓取瞬间而不是抓取后的平均 —— 物体夹住后会自对齐, + # 平均量会把真实的朝向偏差冲淡(实测 17° 注入只剩 5°)。 + R_rel_gt = gt_mat.T @ _quat_wxyz_to_mat(gt_traj[s][3:7]) + R_rel_tgt = rec["achieved_mat"][s].T @ _quat_wxyz_to_mat(rec["object_pose"][s, 3:7]) + grasp_orientation_gap = np.degrees( + _axisangle(R_rel_tgt @ R_rel_gt.T) + ).round(3).tolist() + + # 物体轨迹与 GT 的偏差 + gt_obj_traj = gt.object_traj[rec["primary_joint"]] + n = min(len(gt_obj_traj), len(rec["object_pose"])) + obj_resid = rec["object_pose"][:n, :3] - gt_obj_traj[:n, :3] + obj_pos_err = np.linalg.norm(obj_resid, axis=1) + + # 抓取后阶段的物体位置残差(旋到夹爪系):反映"物体被夹在手里的相对位姿"差异, + # 是 fit_post_grasp_offset_from_object_residual 的输入 + object_residual_gf = None + object_ori_residual_gf = None + if grasp_step >= 0: + held = np.where(grasp[:n])[0] + if len(held) >= 3: + mats = rec["achieved_mat"][held] + object_residual_gf = ( + np.einsum("tji,tj->ti", mats, obj_resid[held]).mean(axis=0) * 1000 + ).tolist() + # 被夹持物体的**姿态**残差(夹爪系轴角,度)。 + # 参考轨迹里的旋转约定偏差在闭环跟踪下不会出现在姿态跟踪残差里 + # (控制器忠实跟随了被污染的参考),只能靠物体在手内的姿态偏差观测到。 + object_ori_residual_gf = np.degrees( + _mean_axisangle([ + mats[i].T + @ (_quat_wxyz_to_mat(rec["object_pose"][t, 3:7]) + @ _quat_wxyz_to_mat(gt_obj_traj[t, 3:7]).T) + @ mats[i] + for i, t in enumerate(held) + ]) + ).round(3).tolist() + + limit_slack = rec["limit_slack"] + saturated = limit_slack < 0.05 # 距限位 < 0.05rad 视为触限 + joint_vel_max = np.abs(rec["joint_vel"]).max(axis=0) + + # 失败阶段判定(确定性规则,不用 LLM —— LLM 绝不评判自己是否成功) + if rec["success"]: + phase = "success" + elif grasp_step < 0: + # 从未抓住:是没走到位,还是走到位了但抓不住 + near = np.linalg.norm(err_gf, axis=1).min() < 0.02 + phase = "no_grasp_despite_reaching" if near else "never_reached" + elif not grasp[-1]: + phase = "grasp_lost" + else: + phase = "task_failed_while_holding" + + report = { + # ---- 结果 ---- + "success": rec["success"], + "failure_phase": phase, + "gt_success": gt.success, + # ---- 位姿跟踪残差(① 几何标定类的证据)---- + "pos_err_mean_mm": float(np.linalg.norm(pos_err, axis=1).mean() * 1000), + "pos_err_max_mm": float(np.linalg.norm(pos_err, axis=1).max() * 1000), + # 夹爪坐标系下的恒定偏置:若三个分量里某个显著非零且方差小 => 典型 TCP 偏移问题 + "pos_bias_gripper_frame_mm": (err_gf.mean(axis=0) * 1000).tolist(), + "pos_bias_gripper_frame_std_mm": (err_gf.std(axis=0) * 1000).tolist(), + "ori_err_mean_deg": float(np.degrees(rec["ori_err_angle"]).mean()), + "ori_err_max_deg": float(np.degrees(rec["ori_err_angle"]).max()), + # 夹爪系下的姿态误差轴角均值:恒定分量说明是坐标轴约定问题 + "ori_bias_gripper_frame_deg": np.degrees( + rec["ori_err_axisangle_gripper_frame"].mean(axis=0) + ).round(3).tolist(), + # ---- 抓取(③ 抓取适配类的证据)---- + "grasp_achieved": grasp_step >= 0, + "grasp_step": grasp_step, + "gt_grasp_step": gt.grasp_step, + "grasp_step_delta": (grasp_step - gt.grasp_step) if grasp_step >= 0 else None, + "grasp_geometry_gap_m": grasp_geometry_gap, + "grasp_orientation_gap_deg": grasp_orientation_gap, + "grasp_duration_ratio": float(np.mean(grasp)), + # ---- 物体轨迹(与 GT 比对,形态无关的任务不变量)---- + "object_pos_err_mean_mm": float(obj_pos_err.mean() * 1000), + "object_pos_err_final_mm": float(obj_pos_err[-1] * 1000), + "object_residual_gripper_frame_mm": object_residual_gf, + "object_orientation_residual_gripper_frame_deg": object_ori_residual_gf, + "object_displacement_m": float( + np.linalg.norm(rec["object_pose"][-1, :3] - rec["object_pose"][0, :3]) + ), + "gt_object_displacement_m": float( + np.linalg.norm(gt_obj_traj[-1, :3] - gt_obj_traj[0, :3]) + ), + # ---- 关节/结构(② 运动学结构类的证据)---- + "joint_limit_saturated_ratio": float(saturated.any(axis=1).mean()), + "joint_limit_saturated_joints": np.where(saturated.any(axis=0))[0].tolist(), + "joint_min_slack_rad": limit_slack.min(axis=0).round(4).tolist(), + "joint_vel_max": joint_vel_max.round(3).tolist(), + "n_steps": int(len(pos_err)), + } + + # ---- IK 阶段遥测(仅 ik_joint 模式)---- + # 与上面的执行残差是两类不同证据:IK 残差大 = 目标位姿在目标本体上够不到(结构不可达), + # 关节跟踪误差大 = IK 解出来了但关节轨迹执行不下去(通常是关节跳变被限幅) + if rec["ik_telemetry"] is not None: + report.update(rec["ik_telemetry"]) + jte = rec["joint_track_err"] + report["ik_joint_track_err_mean_rad"] = float(np.abs(jte).mean()) + report["ik_joint_track_err_max_rad"] = float(np.abs(jte).max()) + + return report diff --git a/1500case/source/agent_retarget/perturb.py b/1500case/source/agent_retarget/perturb.py new file mode 100644 index 0000000000000000000000000000000000000000..15ab0deee23e418533b0385106fc803dd22a512a --- /dev/null +++ b/1500case/source/agent_retarget/perturb.py @@ -0,0 +1,151 @@ +""" +受控故障注入。 + +朴素 retarget 在 robosuite 里的 UR5e→Panda 上已经能拿到不低的成功率(Square 0.62), +失败模式也比较单一。更重要的是:只看成功率无法回答"agent 的推理买到了什么"—— +CEM 也能提高成功率。 + +因此在转换管线里注入**已知的**本体差异/标定错误:故障真因、以及理论上的正确补偿 +都是已知的,于是可以确定性地度量两件事: + · 诊断准确率:agent 给出的故障类别是否命中真因 + · 修复精度:agent 最终的 Θ 与理论正确补偿的距离 + +注入的量不属于 Θ,agent 在 prompt 里看不到它,只能从诊断报告里的残差反推。 +这正是真实场景的处境:URDF 里的 flange 偏移写错了、末端坐标轴约定不一致、 +夹爪行程映射没标定、控制频率与录制频率不一致 —— 都是"看不见但有迹可循"的。 +""" +from dataclasses import dataclass, field, asdict +from typing import Tuple + + +@dataclass +class Perturbation: + """注入到转换管线里的已知故障。默认为不注入。""" + + name: str = "F0_none" + # 管线误以为的控制点位置(等价于 URDF flange→TCP 偏移写错) + tcp_offset_error: Tuple[float, float, float] = (0.0, 0.0, 0.0) + # 末端坐标轴约定错误(轴角,夹爪坐标系) + rotation_error: Tuple[float, float, float] = (0.0, 0.0, 0.0) + # 夹爪指令映射未标定 + gripper_scale_error: float = 1.0 + gripper_bias_error: float = 0.0 + # 录制频率与执行频率不一致 + time_scale_error: float = 1.0 + + # ---- 评估用(agent 看不到)---- + ground_truth_category: str = "" + ground_truth_fix: dict = field(default_factory=dict) + description: str = "" + + def to_dict(self): + return asdict(self) + + @property + def is_identity(self): + return ( + not any(self.tcp_offset_error) + and not any(self.rotation_error) + and self.gripper_scale_error == 1.0 + and self.gripper_bias_error == 0.0 + and self.time_scale_error == 1.0 + ) + + +FAULT_SUITE = { + "F0_none": Perturbation( + name="F0_none", + ground_truth_category="", + ground_truth_fix={}, + description="不注入故障,只有两个本体固有的形态差异", + ), + "F1_tcp_offset": Perturbation( + name="F1_tcp_offset", + tcp_offset_error=(0.0, 0.0, 0.04), + ground_truth_category="C1_geometric_calibration", + ground_truth_fix={"tcp_offset": (0.0, 0.0, -0.04)}, + description="控制点沿夹爪 z 轴写错 4cm(flange→TCP 偏移标定错误)", + ), + "F2_axis_convention": Perturbation( + name="F2_axis_convention", + rotation_error=(0.0, 0.0, 0.30), + ground_truth_category="C1_geometric_calibration", + ground_truth_fix={"tcp_rotation_offset": (0.0, 0.0, -0.30)}, + description="末端绕夹爪 z 轴存在 17 度的坐标轴约定偏差", + ), + "F3_gripper_mapping": Perturbation( + name="F3_gripper_mapping", + gripper_scale_error=0.30, + ground_truth_category="C3_gripper_grasp", + ground_truth_fix={"gripper_command_scale": 1 / 0.30}, + description="夹爪指令行程映射未标定,闭合指令被压缩到 30%", + ), + "F4_time_scale": Perturbation( + name="F4_time_scale", + time_scale_error=1.6, + ground_truth_category="C4_action_representation", + ground_truth_fix={"time_scale": 1 / 1.6}, + description="录制频率与执行频率不一致,轨迹被压缩 1.6 倍", + ), + "F5_tcp_and_gripper": Perturbation( + name="F5_tcp_and_gripper", + tcp_offset_error=(0.0, 0.03, 0.03), + gripper_scale_error=0.4, + ground_truth_category="C1_geometric_calibration+C3_gripper_grasp", + ground_truth_fix={ + "tcp_offset": (0.0, -0.03, -0.03), + "gripper_command_scale": 1 / 0.4, + }, + description="复合故障:控制点偏移 + 夹爪映射未标定(需要多步修复)", + ), +} + + +def get(name): + if name not in FAULT_SUITE: + raise KeyError(f"未知故障 '{name}',可用:{sorted(FAULT_SUITE)}") + return FAULT_SUITE[name] + + +def fix_distance(cfg, perturb): + """ + agent 最终的 Θ 与理论正确补偿之间的距离(越小越准)。 + 只比较 ground_truth_fix 里出现的字段。 + """ + import numpy as np + + if not perturb.ground_truth_fix: + return None + out = {} + for k, target in perturb.ground_truth_fix.items(): + got = np.atleast_1d(np.asarray(getattr(cfg, k), dtype=float)) + want = np.atleast_1d(np.asarray(target, dtype=float)) + out[k] = { + "target": np.round(want, 5).tolist(), + "got": np.round(got, 5).tolist(), + "l2": float(np.linalg.norm(got - want)), + "relative": float( + np.linalg.norm(got - want) / max(np.linalg.norm(want), 1e-9) + ), + } + out["mean_relative_error"] = float( + np.mean([v["relative"] for k, v in out.items() if isinstance(v, dict)]) + ) + return out + + +def category_hit(predicted_categories, perturb): + """诊断是否命中真因。复合故障只要命中其中之一即算部分命中。""" + truth = perturb.ground_truth_category + if not truth: + return None + truth_set = set(truth.split("+")) + pred_set = set(predicted_categories) + inter = truth_set & pred_set + return { + "ground_truth": sorted(truth_set), + "predicted": sorted(pred_set), + "hit": len(inter) > 0, + "full_hit": truth_set <= pred_set, + "n_hit": len(inter), + } diff --git a/1500case/source/agent_retarget/retarget.py b/1500case/source/agent_retarget/retarget.py new file mode 100644 index 0000000000000000000000000000000000000000..765ffb7c7360a8451dd993ff7b602d9adbd91c4b --- /dev/null +++ b/1500case/source/agent_retarget/retarget.py @@ -0,0 +1,148 @@ +""" +把源本体(UR5e)演示转换成目标本体(Panda)的动作序列。 + +三种执行模式(对应实验方案表2里的几种执行方式): + · open_loop :直接把源演示的 delta 动作照搬给目标本体(最朴素的下限参照) + · pose_tracking :任务空间闭环伺服,IK 隐含在 OSC 控制器内部 + · ik_joint :**显式解 IK** 得到关节轨迹,再在关节空间回放。 + 这是"朴素 IK"基线,也是 agent 修复 IK 配置时使用的模式 —— + 只有在这个模式下,运动学结构类(Class II)问题才真正存在 + +Θ(RetargetConfig)里的参数在这里生效,默认值等价于"什么都不修"的朴素转换。 +""" +import numpy as np +import robosuite.utils.transform_utils as T + +from .config import JOINT_OUTPUT_MAX, RetargetConfig + +# OSC_POSE 的动作缩放(与 MimicGen 数据集的控制器配置一致) +POS_OUTPUT_MAX = 0.05 # action=1 对应 5cm 位移 +ORI_OUTPUT_MAX = 0.5 # action=1 对应 0.5rad 旋转 + + +class Retargeter: + """按 Θ 把源演示映射为目标本体每一步的动作。""" + + def __init__(self, demo, cfg: RetargetConfig = None, mode="pose_tracking", perturb=None, + ik_solver=None): + from .perturb import Perturbation + + self.demo = demo + self.cfg = cfg or RetargetConfig() + self.mode = mode + # 注入的已知故障:先施加故障,再施加 Θ 的补偿。agent 看不到它。 + self.perturb = perturb or Perturbation() + self.targets_pos, self.targets_mat = self._build_targets() + self.gripper_seq = self._build_gripper_seq() + self.n_steps = len(self.targets_pos) + # 夹爪首次发出闭合指令的时间步,作为"抓取后阶段"的分界 + closing = np.where(self.gripper_seq > 0)[0] + self.grasp_close_step = int(closing[0]) if len(closing) else -1 + self._apply_post_grasp_offset() + + # ik_joint 模式:在执行之前就把整条关节轨迹解出来。 + # 求解遥测(残差/未收敛率/关节跳变)是 Class II 诊断的主要证据来源。 + self.q_traj, self.ik_telemetry = None, None + if self.mode == "ik_joint": + if ik_solver is None: + raise ValueError("ik_joint 模式需要传入 ik_solver") + self.q_traj, self.ik_telemetry = ik_solver.solve_trajectory( + self.targets_pos, self.targets_mat, self.cfg + ) + + # ---------- 目标轨迹构造(含 Θ 里的几何标定与时间重采样) ---------- + def _build_targets(self): + cfg, pt = self.cfg, self.perturb + pos = np.array(self.demo.eef_pos) + mats = np.array(self.demo.eef_mat) + + # 姿态:先注入约定错误,再叠加 Θ 的补偿(两者都在夹爪坐标系下) + rot_total = np.array(pt.rotation_error) + np.array(cfg.tcp_rotation_offset) + if np.any(rot_total != 0): + R_off = T.quat2mat(T.axisangle2quat(rot_total)) + mats = np.array([m @ R_off for m in mats]) + + # ① 控制点平移:注入的标定错误 + Θ 的补偿(夹爪坐标系下,随姿态旋转) + off_total = np.array(pt.tcp_offset_error) + np.array(cfg.tcp_offset) + if np.any(off_total != 0): + pos = pos + np.einsum("tij,j->ti", mats, off_total) + + # ① 基座外参偏移(世界系) + if np.any(np.array(cfg.base_offset) != 0): + pos = pos + np.array(cfg.base_offset) + + # ④ 时间重采样:注入的频率错配与 Θ 的补偿相乘 + time_scale = cfg.time_scale * pt.time_scale_error + if time_scale != 1.0: + T_src = len(pos) + T_dst = max(2, int(round(T_src / time_scale))) + idx = np.clip(np.round(np.linspace(0, T_src - 1, T_dst)).astype(int), 0, T_src - 1) + pos, mats = pos[idx], mats[idx] + self._resample_idx = idx + else: + self._resample_idx = np.arange(len(pos)) + + return pos, mats + + def _build_gripper_seq(self): + cfg, pt = self.cfg, self.perturb + cmd = np.array(self.demo.gripper_cmd)[self._resample_idx] + # 先施加注入的夹爪映射错误 + if pt.gripper_scale_error != 1.0 or pt.gripper_bias_error != 0.0: + cmd = np.clip(pt.gripper_scale_error * cmd + pt.gripper_bias_error, -1.0, 1.0) + # ③ 抓取时序提前/延后 + if cfg.grasp_lead_steps != 0: + cmd = np.roll(cmd, -cfg.grasp_lead_steps) + if cfg.grasp_lead_steps > 0: + cmd[-cfg.grasp_lead_steps:] = cmd[-cfg.grasp_lead_steps - 1] + else: + cmd[: -cfg.grasp_lead_steps] = cmd[-cfg.grasp_lead_steps] + # ③ 夹爪指令线性重映射 + cmd = np.clip(cfg.gripper_command_scale * cmd + cfg.gripper_command_bias, -1.0, 1.0) + return cmd + + def _apply_post_grasp_offset(self): + """把只作用于抓取后阶段的末端偏移叠加到目标轨迹上(夹爪坐标系)。""" + off = np.asarray(self.cfg.post_grasp_offset, dtype=float) + if self.grasp_close_step < 0 or not np.any(off): + return + s = self.grasp_close_step + self.targets_pos[s:] = self.targets_pos[s:] + np.einsum( + "tij,j->ti", self.targets_mat[s:], off + ) + + def extra_settle_steps(self, t): + """在首次闭合夹爪那一步额外停留的控制步数(让夹爪完全合拢再移动)。""" + if t == self.grasp_close_step: + return int(self.cfg.settle_steps_at_grasp) + return 0 + + # ---------- 每步动作 ---------- + def action(self, t, cur_pos=None, cur_mat=None, cur_q=None): + """ + open_loop : 忽略当前状态,照搬源动作 + pose_tracking : 用当前状态与目标位姿的差算 delta 动作(任务空间) + ik_joint : 用当前关节角与 IK 解的差算 delta 关节角(关节空间) + """ + if self.mode == "open_loop": + a = np.array(self.demo.raw_actions[min(t, len(self.demo.raw_actions) - 1)], dtype=float) + a[-1] = self.gripper_seq[min(t, self.n_steps - 1)] + return a + + if self.mode == "ik_joint": + ti = min(t, self.n_steps - 1) + d_q = (self.q_traj[ti] - cur_q) * self.cfg.pos_gain / JOINT_OUTPUT_MAX + return np.concatenate([np.clip(d_q, -1, 1), [self.gripper_seq[ti]]]) + + ti = min(t, self.n_steps - 1) + tgt_pos, tgt_mat = self.targets_pos[ti], self.targets_mat[ti] + + d_pos = (tgt_pos - cur_pos) * self.cfg.pos_gain / POS_OUTPUT_MAX + + R_err = tgt_mat @ cur_mat.T + d_ori = T.quat2axisangle(T.mat2quat(R_err)) * self.cfg.ori_gain / ORI_OUTPUT_MAX + + action = np.concatenate( + [np.clip(d_pos, -1, 1), np.clip(d_ori, -1, 1), [self.gripper_seq[ti]]] + ) + return action diff --git a/1500case/source/agent_retarget/source.py b/1500case/source/agent_retarget/source.py new file mode 100644 index 0000000000000000000000000000000000000000..10337d6d183136094305ed600ce24e253fb80549 --- /dev/null +++ b/1500case/source/agent_retarget/source.py @@ -0,0 +1,156 @@ +""" +读取 MimicGen 源本体(UR5e)演示,并提取 Track A 需要的 GT。 + +实现要点:把演示里的完整 MuJoCo 状态在源本体环境里**一次性重放**,同时拿到 + · 源末端控制点(grip_site)的位姿轨迹 —— 这是要被 retarget 的东西 + · 物体位姿轨迹、抓取事件时序、任务成功判定 —— 这是与本体形态无关的 GT + +注意不要用 hdf5 里的 `robot0_eef_quat` 观测:它是 right_hand **body** 的姿态, +而 OSC 控制器控制的是 grip_**site**,两者相差一个 90° 固定旋转。混用会引入 +一个恒定姿态偏置(这本身就是"帧约定不一致"类 retarget 失败的典型形态)。 +""" +import json +from dataclasses import dataclass +from typing import Dict, Optional + +import h5py +import numpy as np + +from . import envs as E + + +@dataclass +class SourceDemo: + """源本体演示里、retarget 所需要的全部输入。""" + + demo_key: str + env_name: str + source_robot: str + eef_pos: np.ndarray # (T, 3) grip_site 位置(世界系) + eef_mat: np.ndarray # (T, 3, 3) grip_site 姿态(世界系) + gripper_cmd: np.ndarray # (T,) +1 闭合 / -1 张开 + raw_actions: np.ndarray # (T, 7) 源演示原始动作(open_loop baseline 用) + object_init: Dict[str, np.ndarray] + n_steps: int + scene_xml: str = None + + +@dataclass +class GTTrace: + """源演示自身产生的 GT(形态无关的任务不变量)。""" + + object_traj: Dict[str, np.ndarray] # {joint_name: (T, 7)} + primary_joint: str # 位移最大的物体自由关节(任务相关物体) + grasp_flags: np.ndarray # (T,) 是否处于稳定抓取 + grasp_step: int + release_step: int + success: Optional[bool] # None: source success was not measured + + +def collision_geoms_of(env, prefix): + """按名字前缀取物体的碰撞几何体(排除 _visual)。""" + return [ + env.sim.model.geom_id2name(i) + for i in range(env.sim.model.ngeom) + if (env.sim.model.geom_id2name(i) or "").startswith(prefix) + and not (env.sim.model.geom_id2name(i) or "").endswith("_visual") + ] + + +def _pick_primary_joint(traj, grasp): + """ + 判定"被操作的物体"。 + + 不能简单用位移最大:robosuite 在 single_object_mode 下会把任务无关的物体 + (如 Square_D0 里的 RoundNut)停放在 (10,10,10) 之外,它掉落产生的位移 + 高达 10m,会盖过真正被操作物体的 0.35m。 + 因此优先用"在源演示中被夹爪稳定抓取过"来判定,抓取时长最久者胜; + 若都没抓取记录,则退化为在工作空间内(|xy| < 3m)位移最大者。 + """ + grasped = {j: int(g.sum()) for j, g in grasp.items() if g.any()} + if grasped: + return max(grasped, key=grasped.get) + in_ws = { + j: float(np.linalg.norm(v[-1, :3] - v[0, :3])) + for j, v in traj.items() + if np.abs(v[0, :2]).max() < 3.0 + } + pool = in_ws or {j: float(np.linalg.norm(v[-1, :3] - v[0, :3])) for j, v in traj.items()} + return max(pool, key=pool.get) + + +def load_demo(dataset_path, demo_key, source_env): + """一次重放,同时返回 SourceDemo 与 GTTrace。""" + with h5py.File(dataset_path, "r") as f: + d = f["data"][demo_key] + raw_actions = np.array(d["actions"]) + states = np.array(d["states"]) + model_xml = d.attrs["model_file"] + env_args = json.loads(f["data"].attrs["env_args"]) + + source_env.reset() + scene_xml = source_env.edit_model_xml(model_xml) + source_env.reset_from_xml_string(scene_xml) + source_env.sim.reset() + obj_joints = E.discover_object_joints(source_env) + obj_geoms = { + j: collision_geoms_of(source_env, j.split("_joint")[0]) for j in obj_joints + } + + T_len = len(states) + eef_pos = np.zeros((T_len, 3)) + eef_mat = np.zeros((T_len, 3, 3)) + traj = {j: np.zeros((T_len, 7)) for j in obj_joints} + grasp = {j: np.zeros(T_len, dtype=bool) for j in obj_joints} + + for t in range(T_len): + source_env.sim.set_state_from_flattened(states[t]) + source_env.sim.forward() + source_env._get_observations(force_update=True) + p, m = E.eef_pose(source_env) + eef_pos[t], eef_mat[t] = p, m + for j in obj_joints: + traj[j][t] = source_env.sim.data.get_joint_qpos(j) + grasp[j][t] = bool( + source_env._check_grasp( + gripper=source_env.robots[0].gripper, object_geoms=obj_geoms[j] + ) + ) + + # Public demonstrations are accepted without a source-task success check. + from scene_binding import nonrobot_joint_state + source_env.sim.set_state_from_flattened(states[0]);source_env.sim.forward() + object_init = nonrobot_joint_state(source_env) + primary_joint = _pick_primary_joint(traj, grasp) + gflags = grasp[primary_joint] + gidx = np.where(gflags)[0] + grasp_step = int(gidx[0]) if len(gidx) else -1 + release_step = -1 + if grasp_step >= 0: + after = np.where(~gflags[grasp_step:])[0] + release_step = int(grasp_step + after[0]) if len(after) else -1 + + source_env.sim.set_state_from_flattened(states[-1]) + source_env.sim.forward() + + demo = SourceDemo( + demo_key=demo_key, + env_name=env_args["env_name"], + source_robot=env_args["env_kwargs"]["robots"][0], + eef_pos=eef_pos, + eef_mat=eef_mat, + gripper_cmd=raw_actions[:, -1], + raw_actions=raw_actions, + object_init=object_init, + scene_xml=scene_xml, + n_steps=T_len, + ) + gt = GTTrace( + object_traj=traj, + primary_joint=primary_joint, + grasp_flags=gflags, + grasp_step=grasp_step, + release_step=release_step, + success=None, + ) + return demo, gt diff --git a/1500case/source/agent_retarget/trackc/__init__.py b/1500case/source/agent_retarget/trackc/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..cb5869d9b121b3c0cf8e4a843cb978e25ce06fc5 --- /dev/null +++ b/1500case/source/agent_retarget/trackc/__init__.py @@ -0,0 +1,6 @@ +"""Track C: 跨形态双臂 retarget (Cobot Magic → Astribot S1)""" + +from .robots import cobot_magic_robot, astribot_s1_robot +from .eval_dualarm import DualArmEvaluator +from .config_dualarm import DualArmRetargetConfig +from .source_dualarm import DualArmDemo, load_atombench_episode, load_task_episodes diff --git a/1500case/source/agent_retarget/trackc/config_dualarm.py b/1500case/source/agent_retarget/trackc/config_dualarm.py new file mode 100644 index 0000000000000000000000000000000000000000..eb2f0fb22555b33b45a076b47e446a205429468d --- /dev/null +++ b/1500case/source/agent_retarget/trackc/config_dualarm.py @@ -0,0 +1,123 @@ +""" +多运动链 retarget 配置空间 Θ。 + +为什么要"按链"而不是"左右臂" +-------------------------- +retarget 的失败往往是**不对称**的:两条链的目标轨迹落在目标本体工作空间的不同位置, +一条够得到、另一条够不到。如果参数只有一份、被复制给所有链,agent 就只能输出 +对称修复,无法处理这种情况(实测左臂 91.5mm / 右臂 8.0mm 的差距就修不了)。 + +因此配置分成两层: + · 按链参数(chains):几何标定、TCP、基座平移、该链的 IK 位姿权重 + · 共享参数(shared):上游链权重、阻尼、迭代预算等 —— 上游只有一份实体, + 两条链不可能各自给它一个构型,因此这些量必须共享 + +链用名字索引而不是 left/right 固定字段,这样单臂、双臂、以及将来更多链 +(例如再加一个头部相机链)用同一套代码。 +""" +from dataclasses import dataclass, field + +from ..config import RetargetConfig + +#: 共享参数:作用于整个求解而非某一条链。上游链是物理上唯一的实体, +#: 阻尼/迭代预算/零空间策略也属于整个耦合求解,因此不按链拆分。 +SHARED_IK_FIELDS = ( + "upstream_weight", + "ik_damping", + "ik_nullspace_target", + "ik_nullspace_gain", + "ik_warm_start", + "ik_joint_limit_margin", + "ik_max_iters", + "ik_tol", +) + + +@dataclass +class MultiChainRetargetConfig: + """N 条运动链各一套 RetargetConfig + 一组共享参数。""" + + chains: dict = field(default_factory=dict) # name -> RetargetConfig + shared: RetargetConfig = field(default_factory=RetargetConfig) + #: 各链之间的时序同步偏移(正 = 第一条链提前),单位是源时间步 + sync_delay: int = 0 + #: agent 填写的修复历史,仅用于日志 + notes: list = field(default_factory=list) + + # ------------------------------------------------------------ 链访问 + @property + def chain_names(self): + return list(self.chains.keys()) + + def chain(self, name): + if name not in self.chains: + raise KeyError(f"没有名为 '{name}' 的运动链,可用:{self.chain_names}") + return self.chains[name] + + def with_chain(self, name, new_cfg): + """返回替换了某条链参数的新配置(不修改原对象)。""" + chains = dict(self.chains) + chains[name] = new_cfg + return MultiChainRetargetConfig( + chains=chains, shared=self.shared, + sync_delay=self.sync_delay, notes=list(self.notes), + ) + + def with_shared(self, new_shared): + return MultiChainRetargetConfig( + chains=dict(self.chains), shared=new_shared, + sync_delay=self.sync_delay, notes=list(self.notes), + ) + + def effective(self, name): + """ + 某条链实际生效的完整参数:该链自己的按链参数 + 共享参数覆盖。 + + 求解器与评测器都用这个视图,于是"哪些量是共享的"只在这里定义一次。 + """ + d = self.chain(name).to_dict() + sd = self.shared.to_dict() + for k in SHARED_IK_FIELDS: + d[k] = sd[k] + return RetargetConfig.from_dict(d) + + # ------------------------------------------------------------ 序列化 + def to_dict(self): + return { + "chains": {k: v.to_dict() for k, v in self.chains.items()}, + "shared": self.shared.to_dict(), + "sync_delay": self.sync_delay, + } + + @classmethod + def from_dict(cls, d): + return cls( + chains={k: RetargetConfig.from_dict(v) + for k, v in (d.get("chains") or {}).items()}, + shared=RetargetConfig.from_dict(d.get("shared", {})), + sync_delay=d.get("sync_delay", 0), + ) + + @classmethod + def uniform(cls, chain_names, base=None): + """所有链取同一份初始参数。""" + base = base or RetargetConfig() + return cls( + chains={n: RetargetConfig.from_dict(base.to_dict()) for n in chain_names}, + shared=RetargetConfig.from_dict(base.to_dict()), + ) + + +# ------------------------------------------------------------------ 兼容别名 +#: 双臂是 N=2 的特例。保留这个名字是为了不改动已有的调用点。 +DualArmRetargetConfig = MultiChainRetargetConfig + + +def dual_arm_config(left=None, right=None, **kw): + """按左右臂构造一个两链配置。""" + left = left or RetargetConfig() + right = right or RetargetConfig() + shared = kw.pop("shared", None) or RetargetConfig.from_dict(left.to_dict()) + return MultiChainRetargetConfig( + chains={"left": left, "right": right}, shared=shared, **kw + ) diff --git a/1500case/source/agent_retarget/trackc/eval_dualarm.py b/1500case/source/agent_retarget/trackc/eval_dualarm.py new file mode 100644 index 0000000000000000000000000000000000000000..cfbf57aa13d60ba766b823f4bed3f3feae8c92bc --- /dev/null +++ b/1500case/source/agent_retarget/trackc/eval_dualarm.py @@ -0,0 +1,701 @@ +""" +DualArmEvaluator: 在 MuJoCo 仿真中评测双臂 retarget 质量。 + +核心流程: + 1. 加载 S1 的 MJCF 模型 + 2. 对每条 CobotMagic 演示,用 IK 把源末端轨迹解成 S1 的关节轨迹 + 3. 在 MuJoCo 中回放关节轨迹,记录末端跟踪误差 + 4. 聚合诊断报告 + +与 Track A 的 Evaluator 的差异: + - 纯 MuJoCo(无 robosuite),不依赖 task-specific 成功判定 + - 双臂独立 IK + 合并报告 + - "成功" 定义为末端跟踪误差低于阈值(retarget fidelity) +""" +import hashlib +import json +import multiprocessing as mp +import os +from collections import Counter + +import mujoco +import numpy as np + +from ..config import RetargetConfig +from ..embodiment import Embodiment, chain_reach, normalize_report, trajectory_extent +from .config_dualarm import DualArmRetargetConfig, MultiChainRetargetConfig + +#: 本评测器的运动链名字。算子的 scope 就取这些值(外加 "all")。 +CHAIN_NAMES = ("left", "right") +from .ik_dualarm import DualArmIKSolver, _axisangle_from_mat +from .robots import DualArmRobot +from .source_dualarm import DualArmDemo + +#: 任务成功阈值保持绝对量纲,这是有意的:能否抓住取决于物体尺寸和夹爪开口, +#: 与手臂多长无关 —— 一条 1.1m 的臂并不因为臂长就有资格用 110mm 的误差抓 30mm 的块。 +POS_SUCCESS_THRESH_M = 0.05 +ORI_SUCCESS_THRESH_DEG = 30.0 + +#: retarget 保真度回答的是另一个问题:"相对本体自身尺度偏了多少"。它只用于跨本体 +#: 比较和喂给 agent 做判据,因此必须无量纲。参考臂展 0.7m 下 ≈70mm / 140mm。 +FIDELITY_TIGHT_REL = 0.10 +FIDELITY_LOOSE_REL = 0.20 + +#: 保真度必须同时约束姿态,否则 ik_rot_weight → 0 是一个免费的退化解: +#: 求解器彻底放弃姿态后位置能收敛到 0.4mm,位置类判据给满分,而实测夹爪朝向偏 147°。 +#: 实测(dm6/dm7,修正后):cfg=0.15~0.25 时位置 1~3mm、姿态 4°,是真正的内部最优; +#: cfg→0 时位置继续变好而姿态崩溃。只看位置的判据无法区分这两者,任何搜索都会 +#: 收敛到退化解。角度阈值取绝对量纲,与位置成功阈值同理:能否抓住取决于物体几何。 +FIDELITY_TIGHT_ORI_DEG = 15.0 +FIDELITY_LOOSE_ORI_DEG = 30.0 + +JOINT_OUTPUT_MAX = 0.3 # 关节位置控制单步上限 rad + + +#: 子进程里的评测器。用模块级变量而不是闭包,是因为 Pool 的任务函数必须可 pickle。 +_POOL_CTX = {} + + +def _pool_init(source_robot, target_robot, demos, mode, alignment): + _POOL_CTX["ev"] = DualArmEvaluator( + source_robot, target_robot, demos, mode=mode, + cache_evals=False, n_workers=1, verbose=False, alignment=alignment, + ) + + +def _pool_eval(payload): + idx, cfg = payload + ev = _POOL_CTX["ev"] + demo = ev.demos[idx] + rep = ev._eval_one(demo, cfg) + rep["demo"] = demo.demo_key + return idx, rep + + +class DualArmEvaluator: + """ + 评测接口:ev(cfg) -> 聚合报告。 + + 与 SelfEvolvingAgent 兼容所需的接口: + - __call__(cfg) -> agg dict + - config_key(cfg, mode, perturb) -> str + - .mode, .perturb, .n_rollouts, .env_name, .source_robot, .target_robot, .demos + """ + + def __init__(self, source_robot, target_robot, demos, + mode="ik_joint", cache_evals=True, n_workers=1, verbose=True, alignment=None): + self.source_robot = source_robot.name + self.source_robot_obj = source_robot + self.target_robot_obj = target_robot + self.target_robot = target_robot.name + self.env_name = "mujoco_dualarm_retarget" + self.mode = mode + self.demos = demos + self.n_rollouts = 0 + #: 逐 demo 评测互相独立,可以并行。默认 1(串行)—— 只有显式要求并行的 + #: 调用方才会付出建进程池的代价,其余脚本行为完全不变。 + self.n_workers = max(1, int(n_workers or 1)) + self.verbose = verbose + self._pool = None + + # 兼容 agent 代码中对 perturb 的访问 + self.perturb = _DummyPerturb() + + self._model = None + self._data = None + self._ik_solver = None + self._eval_cache = {} if cache_evals else None + + self._load_model(target_robot) + self.embodiment = self._describe_embodiment(source_robot, target_robot, demos) + self.init_base_offset_left, self.init_base_offset_right = ( + self._compute_init_base_offset(demos) if alignment is None else + (tuple(alignment["left"]), tuple(alignment["right"]))) + + def _say(self, msg): + """构造期日志。子进程里的评测器静音,否则每个 worker 都会重复刷一遍。""" + if self.verbose: + print(msg, flush=True) + + def _upstream_qpos_adr(self): + """上游链在 qpos 里的下标;没有上游自由度时返回 None。""" + up = self._ik_solver.coupled.upstream + return up.qpos_adr if up.n else None + + def _describe_embodiment(self, source_robot, target_robot, demos): + """ + 量出本体对的无量纲描述符。全部来自运动学与演示数据,不查机型表。 + + 两端的尺度都用运动学链算的臂展,reach_ratio 才是真正的"臂展比"。拿不到源模型 + 时才退化成演示轨迹跨度,并把 source_scale_is_reach 置 False 如实标注 —— 那种 + 情况下比值混了本体尺度和任务尺度,下游不该当臂展比用。 + 演示跨度另存为 task_extent_m:它描述任务而非本体,是另一个维度的信息。 + """ + reaches = [ + chain_reach(self._model, self._data, arm.joint_names, arm.ee_site_name) + for arm in (target_robot.left_arm, target_robot.right_arm) + ] + reaches = [r for r in reaches if r] + target_scale = float(np.mean(reaches)) if reaches else None + + task_extent = trajectory_extent( + [d.left_eef_pos for d in demos if d.left_eef_pos is not None] + + [d.right_eef_pos for d in demos if d.right_eef_pos is not None] + ) + source_scale = self._source_reach(source_robot) + source_is_reach = source_scale is not None + if not source_is_reach: + source_scale = task_extent + + emb = Embodiment( + scale_m=target_scale or Embodiment.scale_m, + source_scale_m=source_scale, + source_scale_is_reach=source_is_reach, + task_extent_m=task_extent, + dof_target=target_robot.left_arm.n_joints, + dof_source=source_robot.left_arm.n_joints, + n_chains=2, + upstream_dof=self._ik_solver.n_upstream, + source_name=source_robot.name, + target_name=target_robot.name, + ) + src_kind = "源臂展" if source_is_reach else "源尺度(退化=任务跨度)" + self._say(f"[DualArmEvaluator] 本体描述符: 臂展={emb.scale_m:.3f}m " + f"{src_kind}={source_scale and round(source_scale, 3)} " + f"reach_ratio={emb.reach_ratio} dof_diff={emb.dof_diff} " + f"任务跨度/臂展={emb.task_extent_rel} " + f"上游自由度={emb.upstream_dof}") + return emb + + @staticmethod + def _source_reach(source_robot): + """从源本体 MJCF 量臂展。源模型常常只给单臂、关节名也与双臂命名不同, + 因此按名字取不到时退回到模型里的全部铰接关节。""" + path = getattr(source_robot, "mjcf_path", None) + if not path or not os.path.exists(path): + return None + try: + model = mujoco.MjModel.from_xml_path(path) + except Exception: + return None + data = mujoco.MjData(model) + + reaches = [] + for arm in (source_robot.left_arm, source_robot.right_arm): + names = [n for n in arm.joint_names + if mujoco.mj_name2id(model, mujoco.mjtObj.mjOBJ_JOINT, n) >= 0] + if len(names) < 2: + names = [mujoco.mj_id2name(model, mujoco.mjtObj.mjOBJ_JOINT, j) + for j in range(model.njnt) + if model.jnt_type[j] in (mujoco.mjtJoint.mjJNT_HINGE, + mujoco.mjtJoint.mjJNT_SLIDE)] + names = names[:arm.n_joints] + r = chain_reach(model, data, names, arm.ee_site_name) + if r: + reaches.append(r) + return float(np.mean(reaches)) if reaches else None + + def _compute_init_base_offset(self, demos): + """自动计算左/右臂各自的初始 base_offset,将源轨迹中心对齐到目标 EE 默认位置。 + + 跨形态 retarget 的核心难点:两个机器人的工作空间在世界坐标系下完全不同, + 且左右臂的偏移量也不同(机器人结构不同导致)。 + """ + mujoco.mj_resetData(self._model, self._data) + mujoco.mj_forward(self._model, self._data) + + left_sid = mujoco.mj_name2id( + self._model, mujoco.mjtObj.mjOBJ_SITE, + self.target_robot_obj.left_arm.ee_site_name) + right_sid = mujoco.mj_name2id( + self._model, mujoco.mjtObj.mjOBJ_SITE, + self.target_robot_obj.right_arm.ee_site_name) + tgt_left = self._data.site_xpos[left_sid].copy() + tgt_right = self._data.site_xpos[right_sid].copy() + + src_left = np.mean([d.left_eef_pos.mean(axis=0) for d in demos + if d.left_eef_pos is not None], axis=0) + src_right = np.mean([d.right_eef_pos.mean(axis=0) for d in demos + if d.right_eef_pos is not None], axis=0) + + left_offset = tuple(np.round(tgt_left - src_left, 4).tolist()) + right_offset = tuple(np.round(tgt_right - src_right, 4).tolist()) + + self._say(f"[DualArmEvaluator] 自动 base_offset: " + f"左={list(left_offset)}, 右={list(right_offset)}") + return left_offset, right_offset + + def make_init_cfg(self): + """ + 初始 Θ:每条链一份默认参数 + 一份共享参数。 + + base_offset 从 0 起步 —— 两个本体之间的大尺度工作空间错位由 + _apply_offsets 里的分链初始偏移承担,agent 的 base_offset 是在此之上的增量。 + """ + return MultiChainRetargetConfig.uniform(CHAIN_NAMES) + + def _load_model(self, robot): + mjcf_path = robot.mjcf_path + if not os.path.exists(mjcf_path): + raise FileNotFoundError(f"MJCF 不存在: {mjcf_path}") + self._model = mujoco.MjModel.from_xml_path(mjcf_path) + self._data = mujoco.MjData(self._model) + self._ik_solver = DualArmIKSolver( + self._model, self._data, robot, + ) + + def __call__(self, cfg, mode=None): + """评测一个配置。cfg 可以是多链配置,也可以是单份 RetargetConfig(各链取同值)。""" + if isinstance(cfg, RetargetConfig): + cfg = MultiChainRetargetConfig.uniform(CHAIN_NAMES, cfg) + + mode = mode or self.mode + key = self.config_key(cfg, mode, self.perturb) + if self._eval_cache is not None and key in self._eval_cache: + return self._eval_cache[key] + + if self.n_workers > 1 and len(self.demos) > 1: + reports = self._eval_all_parallel(cfg) + else: + reports = [] + for demo in self.demos: + rep = self._eval_one(demo, cfg) + rep["demo"] = demo.demo_key + reports.append(rep) + self.n_rollouts += len(reports) + + agg = self._aggregate(reports) + agg["mode"] = mode + agg["env"] = self.env_name + agg["source_robot"] = self.source_robot + agg["target_robot"] = self.target_robot + agg["n_demos"] = len(reports) + # 本体描述符 + 长度量的无量纲版本:守卫、参数范围与经验签名都以它们为准 + agg.update(self.embodiment.descriptor_fields()) + normalize_report(agg, self.embodiment.scale_m) + agg["_per_demo"] = reports + if self._eval_cache is not None: + self._eval_cache[key] = agg + return agg + + # ------------------------------------------------------------ 并行评测 + def _get_pool(self): + """惰性建池。子进程各自持有一份 MuJoCo 模型 —— MjData 是可变状态,不能共享。""" + if self._pool is None: + ctx = mp.get_context("fork") + self._pool = ctx.Pool( + self.n_workers, initializer=_pool_init, + initargs=(self.source_robot_obj, self.target_robot_obj, + self.demos, self.mode, {"left": self.init_base_offset_left, "right": self.init_base_offset_right}), + ) + return self._pool + + def _eval_all_parallel(self, cfg): + """并行跑完所有 demo。按下标回排,保证与串行完全同序、可复现。""" + pool = self._get_pool() + payload = [(i, cfg) for i in range(len(self.demos))] + out = pool.map(_pool_eval, payload, chunksize=1) + out.sort(key=lambda t: t[0]) + return [rep for _, rep in out] + + def close(self): + if self._pool is not None: + self._pool.terminate() + self._pool.join() + self._pool = None + + def _apply_offsets(self, eef_pos, eef_mat, arm_cfg, arm_init_offset): + """将偏置应用到目标末端轨迹上。 + + arm_init_offset: 自动计算的分臂初始偏移(常数,补偿两个机器人的基座位置差异) + arm_cfg.base_offset: agent 设置的额外增量 + arm_cfg.tcp_offset: TCP 偏移(补偿末端工具坐标系差异) + arm_cfg.tcp_rotation_offset: TCP 旋转偏移 + """ + pos = eef_pos.copy() + mat = eef_mat.copy() + + total_base_off = np.array(arm_init_offset) + np.array(arm_cfg.base_offset) + tcp_off = np.array(arm_cfg.tcp_offset) + tcp_rot = np.array(arm_cfg.tcp_rotation_offset) + + if np.any(total_base_off != 0): + pos = pos + total_base_off + + if np.any(tcp_off != 0): + for t in range(len(pos)): + pos[t] = pos[t] + mat[t] @ tcp_off + + if np.any(tcp_rot != 0): + from .ik_dualarm import _euler_to_mat_rpy + R_tcp = _euler_to_mat_rpy(tcp_rot) + for t in range(len(mat)): + mat[t] = mat[t] @ R_tcp + + return pos, mat + + def _eval_one(self, demo, cfg): + """评测单条演示""" + if demo.left_eef_pos is None or demo.right_eef_pos is None: + return self._empty_report(demo, "no_eef_data") + + # 重置 MuJoCo 状态 + mujoco.mj_resetData(self._model, self._data) + mujoco.mj_forward(self._model, self._data) + + # 各链实际生效的参数 = 该链自己的按链参数 + 共享参数覆盖 + left_cfg = cfg.effective("left") + right_cfg = cfg.effective("right") + + # 应用坐标变换(先叠加自动计算的分链初始偏移,再叠加 agent 的增量) + left_pos, left_mat = self._apply_offsets( + demo.left_eef_pos, demo.left_eef_mat, left_cfg, + self.init_base_offset_left) + right_pos, right_mat = self._apply_offsets( + demo.right_eef_pos, demo.right_eef_mat, right_cfg, + self.init_base_offset_right) + + # 上游链被两条臂共享,必须耦合求解;各链的位姿权重仍然独立 + left_q, right_q, left_telem, right_telem, up_q, up_telem = \ + self._ik_solver.solve_dual( + left_pos, left_mat, right_pos, right_mat, + cfg.shared, left_cfg, right_cfg) + + if not (np.isfinite(left_q).all() and np.isfinite(right_q).all() and np.isfinite(up_q).all()): + return self._empty_report(demo, "safety_nonfinite") + + # 在 MuJoCo 中回放 IK 解出的关节轨迹(使用变换后的目标轨迹计算误差) + left_rec = self._replay_arm( + left_q, left_pos, left_mat, + self._ik_solver.left, left_cfg, up_q, + ) + right_rec = self._replay_arm( + right_q, right_pos, right_mat, + self._ik_solver.right, right_cfg, up_q, + ) + + # 组装报告 + left_ori_ok = left_rec["ori_err_mean_deg"] < ORI_SUCCESS_THRESH_DEG + right_ori_ok = right_rec["ori_err_mean_deg"] < ORI_SUCCESS_THRESH_DEG + # 成功必须位置与姿态同时达标。只看位置的话 ik_rot_weight → 0 是免费的退化解: + # 位置收敛到 0.4mm、姿态偏 147°,而 score() 里 success_rate 权重 1000 远大于 + # 有界的姿态保真度项,于是任何搜索都会主动放弃姿态去换成功率。 + left_success = (left_rec["pos_err_mean_mm"] < POS_SUCCESS_THRESH_M * 1000 + and left_ori_ok) + right_success = (right_rec["pos_err_mean_mm"] < POS_SUCCESS_THRESH_M * 1000 + and right_ori_ok) + from tabletop_scene import check_trajectory + constraints = check_trajectory(self, left_q, right_q, up_q) + safety_reject = left_rec["safety_reject"] or right_rec["safety_reject"] or constraints["deployment_constraint_reject"] + success = left_success and right_success and not safety_reject + worst_pos_rel = max(left_rec["pos_err_mean_mm"], + right_rec["pos_err_mean_mm"]) / ( + self.embodiment.scale_m * 1000.0) + worst_ori_deg = max(left_rec["ori_err_mean_deg"], + right_rec["ori_err_mean_deg"]) + + if success: + phase = "success" + elif not left_success and not right_success: + phase = "both_arms_failed" + elif not left_success: + phase = "left_arm_failed" + else: + phase = "right_arm_failed" + + world_bias = [ + (l + r) / 2 for l, r in + zip(left_rec["pos_bias_world_mm"], right_rec["pos_bias_world_mm"]) + ] + + if constraints["deployment_constraint_reject"]: + phase = "table_collision" if constraints["table_collision_fraction"] else "joint_path_discontinuity_or_waist" + report = { + "success": success, + "safety_reject": safety_reject, + "gripper_event_timing_steps": None, + "gripper_timing_status": "not_simulated", + "gt_success": True, + "failure_phase": phase, + "success_ori_ok": left_ori_ok and right_ori_ok, + "fidelity_tight": (worst_pos_rel < FIDELITY_TIGHT_REL + and worst_ori_deg < FIDELITY_TIGHT_ORI_DEG), + "fidelity_loose": (worst_pos_rel < FIDELITY_LOOSE_REL + and worst_ori_deg < FIDELITY_LOOSE_ORI_DEG), + # 只看位置的旧判据留作诊断:与保真度的差值直接暴露"位置好但姿态崩"的退化解 + "fidelity_tight_pos_only": worst_pos_rel < FIDELITY_TIGHT_REL, + "worst_pos_err_rel": round(worst_pos_rel, 6), + "worst_ori_err_deg": round(worst_ori_deg, 4), + # 左臂 + "left_pos_err_mean_mm": left_rec["pos_err_mean_mm"], + "left_pos_err_max_mm": left_rec["pos_err_max_mm"], + "left_ori_err_mean_deg": left_rec["ori_err_mean_deg"], + "left_ori_err_max_deg": left_rec["ori_err_max_deg"], + "left_pos_bias_gripper_frame_mm": left_rec["pos_bias_gf_mm"], + "left_pos_bias_world_mm": left_rec["pos_bias_world_mm"], + # 右臂 + "right_pos_err_mean_mm": right_rec["pos_err_mean_mm"], + "right_pos_err_max_mm": right_rec["pos_err_max_mm"], + "right_ori_err_mean_deg": right_rec["ori_err_mean_deg"], + "right_ori_err_max_deg": right_rec["ori_err_max_deg"], + "right_pos_bias_gripper_frame_mm": right_rec["pos_bias_gf_mm"], + "right_pos_bias_world_mm": right_rec["pos_bias_world_mm"], + # 综合 + "pos_err_mean_mm": (left_rec["pos_err_mean_mm"] + right_rec["pos_err_mean_mm"]) / 2, + "pos_err_max_mm": max(left_rec["pos_err_max_mm"], right_rec["pos_err_max_mm"]), + "ori_err_mean_deg": (left_rec["ori_err_mean_deg"] + right_rec["ori_err_mean_deg"]) / 2, + "ori_err_max_deg": max(left_rec["ori_err_max_deg"], right_rec["ori_err_max_deg"]), + "pos_bias_gripper_frame_mm": [ + (l + r) / 2 for l, r in + zip(left_rec["pos_bias_gf_mm"], right_rec["pos_bias_gf_mm"]) + ], + "pos_bias_world_mm": world_bias, + # 关节 + "joint_limit_saturated_ratio": ( + left_rec["joint_limit_sat_ratio"] + right_rec["joint_limit_sat_ratio"] + ) / 2, + "joint_limit_saturated_joints": ( + left_rec["sat_joints"] + right_rec["sat_joints"] + ), + "joint_vel_max": left_rec.get("joint_vel_max", []) + right_rec.get("joint_vel_max", []), + # IK 遥测 + **{f"left_{k}": v for k, v in left_telem.items()}, + **{f"right_{k}": v for k, v in right_telem.items()}, + # 上游链(躯干 / 将来的移动底座)使用情况 + **up_telem, + # 合并 IK 遥测 + "ik_pos_residual_mean_mm": ( + left_telem["ik_pos_residual_mean_mm"] + right_telem["ik_pos_residual_mean_mm"] + ) / 2, + "ik_pos_residual_max_mm": max( + left_telem["ik_pos_residual_max_mm"], right_telem["ik_pos_residual_max_mm"] + ), + "ik_rot_residual_mean_deg": ( + left_telem["ik_rot_residual_mean_deg"] + right_telem["ik_rot_residual_mean_deg"] + ) / 2, + "ik_unconverged_ratio": ( + left_telem["ik_unconverged_ratio"] + right_telem["ik_unconverged_ratio"] + ) / 2, + "ik_iters_mean": ( + left_telem["ik_iters_mean"] + right_telem["ik_iters_mean"] + ) / 2, + "ik_joint_jump_max_rad": max( + left_telem["ik_joint_jump_max_rad"], right_telem["ik_joint_jump_max_rad"] + ), + "ik_n_large_joint_jumps": ( + left_telem["ik_n_large_joint_jumps"] + right_telem["ik_n_large_joint_jumps"] + ), + "ik_min_singular_value": min( + left_telem["ik_min_singular_value"] or float("inf"), + right_telem["ik_min_singular_value"] or float("inf"), + ), + "ik_solution_limit_hit_ratio": ( + left_telem["ik_solution_limit_hit_ratio"] + + right_telem["ik_solution_limit_hit_ratio"] + ) / 2, + "n_steps": demo.n_steps, + "ori_bias_gripper_frame_deg": [0.0, 0.0, 0.0], + } + report.update(constraints) + return report + + def _replay_arm(self, q_traj, tgt_pos, tgt_mat, arm_ik, cfg, up_q=None): + """ + 回放一条臂的 IK 关节轨迹并记录跟踪误差。 + + up_q 是同一帧的上游(躯干/底座)构型。必须一起写进 qpos 再算正运动学 —— + 上游被启用后手臂基座已经被搬动过,若按零位做 FK,测出来的会是另一台机器人的误差。 + """ + pos_errs, ori_errs = [], [] + pos_errs_gf = [] + pos_errs_world = [] + T = len(q_traj) + up_adr = self._upstream_qpos_adr() + + for t in range(T): + if up_adr is not None and up_q is not None and len(up_q) > t: + self._data.qpos[up_adr] = up_q[t] + pos, mat = arm_ik.forward_kinematics(q_traj[t]) + err = pos - tgt_pos[t] + pos_errs.append(np.linalg.norm(err)) + pos_errs_gf.append(mat.T @ err) + pos_errs_world.append(err) + R_err = tgt_mat[t] @ mat.T + ori_errs.append(np.linalg.norm(_axisangle_from_mat(R_err))) + + pos_errs = np.array(pos_errs) + ori_errs = np.array(ori_errs) + pos_errs_gf = np.array(pos_errs_gf) + pos_errs_world = np.array(pos_errs_world) + + # 关节限位 + slack = np.minimum( + q_traj - arm_ik.jnt_range[:, 0], + arm_ik.jnt_range[:, 1] - q_traj, + ) + sat = slack < 0.05 + sat_ratio = float(sat.any(axis=1).mean()) if T > 0 else 0.0 + sat_joints = np.where(sat.any(axis=0))[0].tolist() + + # 关节速度 + if T > 1: + dq = np.diff(q_traj, axis=0) + joint_vel_max = np.abs(dq).max(axis=0).round(3).tolist() + else: + joint_vel_max = [0.0] * arm_ik.n + + return { + "pos_err_mean_mm": float(pos_errs.mean() * 1000), + "pos_err_max_mm": float(pos_errs.max() * 1000), + "ori_err_mean_deg": float(np.degrees(ori_errs).mean()), + "ori_err_max_deg": float(np.degrees(ori_errs).max()), + "pos_bias_gf_mm": (pos_errs_gf.mean(axis=0) * 1000).round(3).tolist(), + "pos_bias_gf_std_mm": (pos_errs_gf.std(axis=0) * 1000).round(3).tolist(), + "pos_bias_world_mm": (pos_errs_world.mean(axis=0) * 1000).round(3).tolist(), + "joint_limit_sat_ratio": sat_ratio, + "sat_joints": sat_joints, + "safety_reject": bool(np.any(slack < -1e-6)), + "joint_vel_max": joint_vel_max, + } + + def _empty_report(self, demo, reason): + return { + "success": False, + "safety_reject": reason.startswith("safety_"), + "gt_success": True, + "failure_phase": reason, + "pos_err_mean_mm": 999.0, + "pos_err_max_mm": 999.0, + "ori_err_mean_deg": 999.0, + "ori_err_max_deg": 999.0, + "pos_bias_gripper_frame_mm": [0.0, 0.0, 0.0], + "pos_bias_world_mm": [0.0, 0.0, 0.0], + "ori_bias_gripper_frame_deg": [0.0, 0.0, 0.0], + "fidelity_tight": False, + "fidelity_loose": False, + "fidelity_tight_pos_only": False, + "worst_ori_err_deg": 999.0, + "success_ori_ok": False, + "joint_limit_saturated_ratio": 0.0, + "joint_limit_saturated_joints": [], + "joint_vel_max": [], + "n_steps": demo.n_steps, + } + + @staticmethod + def _aggregate(reports): + """聚合多条 demo 的报告""" + def _mean(key): + vals = [r[key] for r in reports if r.get(key) is not None] + return float(np.mean(vals)) if vals else None + + def _vec_mean(key): + vals = [r[key] for r in reports if r.get(key) is not None] + return np.array(vals).mean(axis=0).round(4).tolist() if vals else None + + def _vec_std(key): + vals = [r[key] for r in reports if r.get(key) is not None] + return np.array(vals).std(axis=0).round(4).tolist() if vals else None + + return { + "table_collision_fraction": _mean("table_collision_fraction"), + "table_penetration_max_mm": max((r.get("table_penetration_max_mm",0.) for r in reports),default=0.), + "joint_path_jump_max_rad": max((r.get("joint_path_jump_max_rad",0.) for r in reports),default=0.), + "waist_constraint_residual_rad": max((r.get("waist_constraint_residual_rad",0.) for r in reports),default=0.), + "deployment_constraint_reject_rate": _mean("deployment_constraint_reject"), + "scene_version": "v14_assumed_table", + "success_rate": float(np.mean([r["success"] for r in reports])), + "safety_reject_rate": float(np.mean([r.get("safety_reject", False) for r in reports])), + "gripper_event_timing_steps": None, + "gt_success_rate": float(np.mean([r["gt_success"] for r in reports])), + "grasp_rate": None, + "failure_phases": dict(Counter(r["failure_phase"] for r in reports)), + "worst_pos_err_rel": float(np.mean( + [r.get("worst_pos_err_rel") or 0.0 for r in reports])), + "worst_ori_err_deg": float(np.mean( + [r.get("worst_ori_err_deg") or 0.0 for r in reports])), + "fidelity_rate_tight": float(np.mean( + [r.get("fidelity_tight", False) for r in reports])), + "fidelity_rate_loose": float(np.mean( + [r.get("fidelity_loose", False) for r in reports])), + "fidelity_rate_tight_pos_only": float(np.mean( + [r.get("fidelity_tight_pos_only", False) for r in reports])), + "success_rate_ori_ok": float(np.mean( + [r.get("success_ori_ok", False) for r in reports])), + # 综合 + "pos_err_mean_mm": _mean("pos_err_mean_mm"), + "pos_err_max_mm": _mean("pos_err_max_mm"), + "ori_err_mean_deg": _mean("ori_err_mean_deg"), + "ori_err_max_deg": _mean("ori_err_max_deg"), + "pos_bias_gripper_frame_mm": _vec_mean("pos_bias_gripper_frame_mm"), + "pos_bias_gripper_frame_std_across_demos_mm": _vec_std("pos_bias_gripper_frame_mm"), + "pos_bias_world_mm": _vec_mean("pos_bias_world_mm"), + "pos_bias_world_std_across_demos_mm": _vec_std("pos_bias_world_mm"), + "ori_bias_gripper_frame_deg": _vec_mean("ori_bias_gripper_frame_deg"), + "ori_bias_gripper_frame_std_deg": _vec_std("ori_bias_gripper_frame_deg"), + # 左臂 + "left_pos_err_mean_mm": _mean("left_pos_err_mean_mm"), + "left_ori_err_mean_deg": _mean("left_ori_err_mean_deg"), + "left_pos_bias_world_mm": _vec_mean("left_pos_bias_world_mm"), + "left_pos_bias_world_std_across_demos_mm": _vec_std("left_pos_bias_world_mm"), + # 右臂 + "right_pos_err_mean_mm": _mean("right_pos_err_mean_mm"), + "right_ori_err_mean_deg": _mean("right_ori_err_mean_deg"), + "right_pos_bias_world_mm": _vec_mean("right_pos_bias_world_mm"), + "right_pos_bias_world_std_across_demos_mm": _vec_std("right_pos_bias_world_mm"), + # 关节 + "joint_limit_saturated_ratio": _mean("joint_limit_saturated_ratio"), + "joint_limit_saturated_joints": sorted( + {j for r in reports for j in r.get("joint_limit_saturated_joints", [])} + ), + # IK + "ik_pos_residual_mean_mm": _mean("ik_pos_residual_mean_mm"), + "ik_pos_residual_max_mm": _mean("ik_pos_residual_max_mm"), + "ik_rot_residual_mean_deg": _mean("ik_rot_residual_mean_deg"), + "ik_rot_residual_max_deg": _mean("ik_rot_residual_max_deg"), + "ik_unconverged_ratio": _mean("ik_unconverged_ratio"), + "ik_iters_mean": _mean("ik_iters_mean"), + "ik_joint_jump_max_rad": _mean("ik_joint_jump_max_rad"), + "ik_joint_jump_per_joint_rad": _vec_mean("ik_joint_jump_per_joint_rad"), + "ik_n_large_joint_jumps": _mean("ik_n_large_joint_jumps"), + "ik_min_singular_value": _mean("ik_min_singular_value"), + "ik_solution_min_slack_rad": _vec_mean("ik_solution_min_slack_rad"), + "ik_solution_limit_hit_ratio": _mean("ik_solution_limit_hit_ratio"), + "ik_joint_track_err_mean_rad": None, + "ik_joint_track_err_max_rad": None, + # 上游链(躯干 / 将来的移动底座) + "upstream_engaged": bool(any( + r.get("upstream_engaged") for r in reports)), + "upstream_range_used_ratio": _mean("upstream_range_used_ratio"), + "upstream_travel_rad": _mean("upstream_travel_rad"), + "upstream_step_max_rad": _mean("upstream_step_max_rad"), + } + + @staticmethod + def config_key(cfg, mode=None, perturb=None): + if isinstance(cfg, DualArmRetargetConfig): + d = cfg.to_dict() + elif isinstance(cfg, RetargetConfig): + d = cfg.to_dict() + else: + d = cfg + d_clean = {k: v for k, v in d.items() if k != "notes"} + pt = perturb.name if perturb is not None else "F0_none" + return hashlib.md5( + json.dumps({"cfg": d_clean, "mode": mode or "ik_joint", "perturb": pt}, + sort_keys=True, default=str).encode() + ).hexdigest() + + def close(self): + if self._pool is not None: + self._pool.terminate() + self._pool.join() + self._pool = None + self._model = None + self._data = None + + +class _DummyPerturb: + """兼容 agent 代码中对 perturb 属性的访问""" + name = "F0_none" + is_identity = True diff --git a/1500case/source/agent_retarget/trackc/ik_dualarm.py b/1500case/source/agent_retarget/trackc/ik_dualarm.py new file mode 100644 index 0000000000000000000000000000000000000000..a8cf82bc7eb4a3fcc2711be73419ddf6d31fbd8b --- /dev/null +++ b/1500case/source/agent_retarget/trackc/ik_dualarm.py @@ -0,0 +1,479 @@ +""" +双臂 IK 求解器:在原生 MuJoCo 模型上对左右臂各做逆运动学。 + +与 Track A 的 IKSolver 共享算法核心(阻尼最小二乘 + 零空间投影), +但直接操作 MuJoCo model/data 而非 robosuite env。 +""" +import mujoco +import numpy as np + +from ..config import RetargetConfig +from ..embodiment import DEFAULT_REACH_M, chain_reach +#: 轴角换算与位姿信任域配平因子都与单臂求解器共用同一份实现, +#: 避免两处副本在数值细节上悄悄分叉。 +from ..ik import ROT_BALANCE, _axisangle_from_mat # noqa: F401 + +#: 求解器里的长度常数一律以臂展为单位。写成绝对米数会让同一份配置在 0.5m 的臂上 +#: 相对更粗、在 1.5m 的臂上相对更细,本体一换精度就漂移;按臂展表达后 IK 的收敛 +#: 行为只取决于形状而不取决于大小。参考臂展下与原先的 1mm 容差 / 5cm 步长等价。 +POS_TOL_REL = 1e-3 / DEFAULT_REACH_M +POS_STEP_REL = 0.05 / DEFAULT_REACH_M + +#: 角度与关节增量本身就是无量纲的(弧度不随连杆缩放而变),无需归一化。 +BASE_ROT_TOL = np.radians(1.0) +MAX_ROT_STEP = np.radians(30.0) +MAX_DQ_STEP = 0.2 + + +def _euler_to_mat_rpy(rpy): + """(roll, pitch, yaw) → 3x3 旋转矩阵""" + r, p, y = rpy + cr, sr = np.cos(r), np.sin(r) + cp, sp = np.cos(p), np.sin(p) + cy, sy = np.cos(y), np.sin(y) + return np.array([ + [cy*cp, cy*sp*sr - sy*cr, cy*sp*cr + sy*sr], + [sy*cp, sy*sp*sr + cy*cr, sy*sp*cr - cy*sr], + [-sp, cp*sr, cp*cr], + ]) + + +def _clip_norm(v, max_norm): + n = np.linalg.norm(v) + return v * (max_norm / n) if n > max_norm else v + + +class SingleArmIK: + """对 MuJoCo 模型中的一条臂做 IK(不经过 robosuite)。""" + + def __init__(self, model, data, joint_names, site_name): + self.model = model + self.data = data + + self.site_id = mujoco.mj_name2id(model, mujoco.mjtObj.mjOBJ_SITE, site_name) + if self.site_id < 0: + raise ValueError(f"Site '{site_name}' not found in model") + + self.jnt_ids = [] + self.qpos_adr = [] + self.dof_adr = [] + for name in joint_names: + jid = mujoco.mj_name2id(model, mujoco.mjtObj.mjOBJ_JOINT, name) + if jid < 0: + raise ValueError(f"Joint '{name}' not found in model") + self.jnt_ids.append(jid) + self.qpos_adr.append(model.jnt_qposadr[jid]) + self.dof_adr.append(model.jnt_dofadr[jid]) + + self.qpos_adr = np.array(self.qpos_adr, dtype=int) + self.dof_adr = np.array(self.dof_adr, dtype=int) + self.n = len(self.jnt_ids) + self.jnt_range = np.array([model.jnt_range[j] for j in self.jnt_ids], dtype=float) + self.q_init = np.zeros(self.n) + self.q_mid = self.jnt_range.mean(axis=1) + self.scale_m = chain_reach(model, data, joint_names, site_name) + + self._jacp = np.zeros((3, model.nv)) + self._jacr = np.zeros((3, model.nv)) + + def _fk(self, q): + self.data.qpos[self.qpos_adr] = q + mujoco.mj_kinematics(self.model, self.data) + mujoco.mj_comPos(self.model, self.data) + pos = np.array(self.data.site_xpos[self.site_id]) + mat = np.array(self.data.site_xmat[self.site_id]).reshape(3, 3) + return pos, mat + + def _jacobian(self): + mujoco.mj_jacSite(self.model, self.data, self._jacp, self._jacr, self.site_id) + return self._jacp[:, self.dof_adr], self._jacr[:, self.dof_adr] + + def forward_kinematics(self, q): + return self._fk(q) + + def solve_frame(self, tgt_pos, tgt_mat, q_seed, cfg): + w_p = float(cfg.ik_pos_weight) + w_r = float(cfg.ik_rot_weight) * ROT_BALANCE + lam = float(cfg.ik_damping) * self.scale_m / DEFAULT_REACH_M + k_ns = float(cfg.ik_nullspace_gain) + margin = float(cfg.ik_joint_limit_margin) + pos_tol = POS_TOL_REL * self.scale_m * float(cfg.ik_tol) + pos_step = POS_STEP_REL * self.scale_m + rot_tol = BASE_ROT_TOL * float(cfg.ik_tol) + + q_ns = self._nullspace_reference(q_seed, cfg) + lo = self.jnt_range[:, 0] + margin + hi = self.jnt_range[:, 1] - margin + bad = lo >= hi + lo[bad], hi[bad] = self.jnt_range[bad, 0], self.jnt_range[bad, 1] + + q = np.clip(np.array(q_seed, dtype=float), lo, hi) + n_iters, converged = 0, False + min_sv = np.inf + for n_iters in range(1, int(cfg.ik_max_iters) + 1): + cur_pos, cur_mat = self._fk(q) + e_pos = tgt_pos - cur_pos + e_rot = _axisangle_from_mat(tgt_mat @ cur_mat.T) + if (np.linalg.norm(e_pos) < pos_tol or w_p == 0.0) and \ + (np.linalg.norm(e_rot) < rot_tol or w_r == 0.0): + converged = True + break + + Jp, Jr = self._jacobian() + J = np.vstack([w_p * Jp, w_r * Jr]) + e = np.concatenate([ + w_p * _clip_norm(e_pos, pos_step), + w_r * _clip_norm(e_rot, MAX_ROT_STEP), + ]) + + sv = np.linalg.svd(J, compute_uv=False) + min_sv = min(min_sv, float(sv[-1])) + + JJt = J @ J.T + (lam ** 2) * np.eye(6) + dq = J.T @ np.linalg.solve(JJt, e) + + if k_ns > 0.0 and q_ns is not None: + J_pinv = J.T @ np.linalg.solve(JJt, np.eye(6)) + N = np.eye(self.n) - J_pinv @ J + dq = dq + N @ (k_ns * (q_ns - q)) + + dq = np.clip(dq, -MAX_DQ_STEP, MAX_DQ_STEP) + q = np.clip(q + dq, lo, hi) + + cur_pos, cur_mat = self._fk(q) + telem = { + "pos_residual_m": float(np.linalg.norm(tgt_pos - cur_pos)), + "rot_residual_rad": float( + np.linalg.norm(_axisangle_from_mat(tgt_mat @ cur_mat.T)) + ), + "n_iters": n_iters, + "converged": converged, + "min_singular_value": float(min_sv) if np.isfinite(min_sv) else None, + } + return q, telem + + def _nullspace_reference(self, q_seed, cfg): + mode = cfg.ik_nullspace_target + if mode == "none": + return None + if mode == "init": + return self.q_init + if mode == "mid": + return self.q_mid + if mode == "prev": + return np.array(q_seed, dtype=float) + return None + + def solve_trajectory(self, targets_pos, targets_mat, cfg): + q_traj, telems = [], [] + q_seed = self.q_init.copy() + for tgt_pos, tgt_mat in zip(targets_pos, targets_mat): + q, telem = self.solve_frame(tgt_pos, tgt_mat, q_seed, cfg) + q_traj.append(q) + telems.append(telem) + q_seed = q if cfg.ik_warm_start == "prev" else self.q_init.copy() + q_traj = np.array(q_traj) + return q_traj, self._aggregate(q_traj, telems) + + def _aggregate(self, q_traj, telems): + pos_res = np.array([t["pos_residual_m"] for t in telems]) + rot_res = np.array([t["rot_residual_rad"] for t in telems]) + n_iters = np.array([t["n_iters"] for t in telems]) + conv = np.array([t["converged"] for t in telems]) + svs = [t["min_singular_value"] for t in telems + if t["min_singular_value"] is not None] + + if len(q_traj) > 1: + dq = np.abs(np.diff(q_traj, axis=0)) + jump_max = float(dq.max()) + jump_per_joint = dq.max(axis=0).round(4).tolist() + n_jumps = int((dq.max(axis=1) > 0.5).sum()) + else: + jump_max, jump_per_joint, n_jumps = 0.0, [0.0] * self.n, 0 + + slack = np.minimum( + q_traj - self.jnt_range[:, 0], self.jnt_range[:, 1] - q_traj + ) + return { + "ik_pos_residual_mean_mm": float(pos_res.mean() * 1000), + "ik_pos_residual_max_mm": float(pos_res.max() * 1000), + "ik_rot_residual_mean_deg": float(np.degrees(rot_res).mean()), + "ik_rot_residual_max_deg": float(np.degrees(rot_res).max()), + "ik_unconverged_ratio": float(1.0 - conv.mean()), + "ik_iters_mean": float(n_iters.mean()), + "ik_joint_jump_max_rad": jump_max, + "ik_joint_jump_per_joint_rad": jump_per_joint, + "ik_n_large_joint_jumps": n_jumps, + "ik_min_singular_value": float(np.min(svs)) if svs else None, + "ik_solution_min_slack_rad": slack.min(axis=0).round(4).tolist(), + "ik_solution_limit_hit_ratio": float((slack < 0.05).any(axis=1).mean()), + } + + +def aggregate_ik_telemetry(q_traj, telems, jnt_range): + """把逐帧 IK 遥测聚合成诊断字段。与 SingleArmIK._aggregate 同构,供耦合求解器复用。""" + q_traj = np.asarray(q_traj, dtype=float) + n = q_traj.shape[1] if q_traj.ndim == 2 else 0 + pos_res = np.array([t["pos_residual_m"] for t in telems]) + rot_res = np.array([t["rot_residual_rad"] for t in telems]) + n_iters = np.array([t["n_iters"] for t in telems]) + conv = np.array([t["converged"] for t in telems]) + svs = [t["min_singular_value"] for t in telems + if t.get("min_singular_value") is not None] + + if len(q_traj) > 1: + dq = np.abs(np.diff(q_traj, axis=0)) + jump_max = float(dq.max()) + jump_per_joint = dq.max(axis=0).round(4).tolist() + n_jumps = int((dq.max(axis=1) > 0.5).sum()) + else: + jump_max, jump_per_joint, n_jumps = 0.0, [0.0] * n, 0 + + slack = np.minimum(q_traj - jnt_range[:, 0], jnt_range[:, 1] - q_traj) + return { + "ik_pos_residual_mean_mm": float(pos_res.mean() * 1000), + "ik_pos_residual_max_mm": float(pos_res.max() * 1000), + "ik_rot_residual_mean_deg": float(np.degrees(rot_res).mean()), + "ik_rot_residual_max_deg": float(np.degrees(rot_res).max()), + "ik_unconverged_ratio": float(1.0 - conv.mean()), + "ik_iters_mean": float(n_iters.mean()), + "ik_joint_jump_max_rad": jump_max, + "ik_joint_jump_per_joint_rad": jump_per_joint, + "ik_n_large_joint_jumps": n_jumps, + "ik_min_singular_value": float(np.min(svs)) if svs else None, + "ik_solution_min_slack_rad": slack.min(axis=0).round(4).tolist(), + "ik_solution_limit_hit_ratio": float((slack < 0.05).any(axis=1).mean()), + } + + +class _Chain: + """一段关节序列在 MuJoCo 里的索引与限位。""" + + def __init__(self, model, joint_names): + self.jnt_ids, self.qpos_adr, self.dof_adr = [], [], [] + for name in joint_names: + jid = mujoco.mj_name2id(model, mujoco.mjtObj.mjOBJ_JOINT, name) + if jid < 0: + raise ValueError(f"Joint '{name}' not found in model") + self.jnt_ids.append(jid) + self.qpos_adr.append(model.jnt_qposadr[jid]) + self.dof_adr.append(model.jnt_dofadr[jid]) + self.qpos_adr = np.array(self.qpos_adr, dtype=int) + self.dof_adr = np.array(self.dof_adr, dtype=int) + self.n = len(self.jnt_ids) + self.jnt_range = (np.array([model.jnt_range[j] for j in self.jnt_ids], dtype=float) + if self.n else np.zeros((0, 2))) + self.q_mid = self.jnt_range.mean(axis=1) if self.n else np.zeros(0) + + +class CoupledChainIK: + """ + 上游共享链 + N 条末端链的耦合 IK。 + + 为什么要"上游链"这个抽象 + ------------------------ + 手臂之外还有一些自由度位于手臂上游、能整体重新安置手臂基座: + 躯干、升降柱、以及**移动底座**。它们的共同性质是被所有手臂共享, + 因此不能各臂独立求解 —— 两条臂会要求互相冲突的上游构型。 + + 把它们统一成"上游链"之后: + · 现在填躯干关节 + · 将来给 MJCF 加上平面关节(x/y/yaw)即得到移动底座,本类不必改动 + 这是固定底座与移动底座之间唯一的结构差异,其余诊断与修复逻辑完全共用。 + + 求解:加权阻尼最小二乘,任务是各链位姿误差的堆叠 + dq = W Jᵀ (J W Jᵀ + λ²I)⁻¹ e + 权重 W 对上游自由度取 upstream_weight、对末端链取 1。 + upstream_weight=0 时上游被完全冻结,退化成"各链独立求解",与旧行为一致; + 调大则上游参与消解,代价是它移动得更多。这个权衡正是移动底座需要的旋钮 + (底座慢、上游中、手臂快),因此现在就用它表达,而不是等到 C2 再造一个。 + """ + + def __init__(self, model, data, upstream_joint_names, arm_chains): + """ + arm_chains: [(joint_names, site_name), ...],顺序与 solve_trajectories 的输入一致。 + """ + self.model = model + self.data = data + self.upstream = _Chain(model, list(upstream_joint_names or [])) + self.arms, self.site_ids, self.arm_scales = [], [], [] + for joint_names, site_name in arm_chains: + sid = mujoco.mj_name2id(model, mujoco.mjtObj.mjOBJ_SITE, site_name) + if sid < 0: + raise ValueError(f"Site '{site_name}' not found in model") + self.arms.append(_Chain(model, joint_names)) + self.site_ids.append(sid) + # 逐链自己的臂展:长短不一的链(例如一臂一夹爪杆)各按自己的尺度定容差。 + self.arm_scales.append(chain_reach(model, data, joint_names, site_name)) + valid_scales = [s for s in self.arm_scales if s] + self.scale_m = float(np.mean(valid_scales)) if valid_scales else DEFAULT_REACH_M + self.arm_scales = [s or self.scale_m for s in self.arm_scales] + + self.n_up = self.upstream.n + self.n_arms = len(self.arms) + self.slices = [] + off = self.n_up + for a in self.arms: + self.slices.append(slice(off, off + a.n)) + off += a.n + self.n_total = off + self.n_task = 6 * self.n_arms + + self._jacp = np.zeros((3, model.nv)) + self._jacr = np.zeros((3, model.nv)) + + # ------------------------------------------------------------ 运动学 + def _set_q(self, q): + if self.n_up: + self.data.qpos[self.upstream.qpos_adr] = q[:self.n_up] + for a, sl in zip(self.arms, self.slices): + self.data.qpos[a.qpos_adr] = q[sl] + mujoco.mj_kinematics(self.model, self.data) + mujoco.mj_comPos(self.model, self.data) + + def _site_pose(self, i): + pos = np.array(self.data.site_xpos[self.site_ids[i]]) + mat = np.array(self.data.site_xmat[self.site_ids[i]]).reshape(3, 3) + return pos, mat + + def _site_jac(self, i): + mujoco.mj_jacSite(self.model, self.data, self._jacp, self._jacr, self.site_ids[i]) + return self._jacp, self._jacr + + def limits(self, cfg): + margin = float(cfg.ik_joint_limit_margin) + rng = [self.upstream.jnt_range] + [a.jnt_range for a in self.arms] + rng = np.vstack([r for r in rng if len(r)]) + lo, hi = rng[:, 0] + margin, rng[:, 1] - margin + bad = lo >= hi + lo[bad], hi[bad] = rng[bad, 0], rng[bad, 1] + return lo, hi, rng + + def q_default(self): + q = np.zeros(self.n_total) + if self.n_up == 4: + q[:4] = [0., -.28403, .28834, -.00123] + return q + + # ------------------------------------------------------------ 求解 + def solve_frame(self, targets, q_seed, cfg, chain_cfgs=None): + from constrained_waist import solve_frame + return solve_frame(self, targets, q_seed, cfg, chain_cfgs) + + def _nullspace_reference(self, q_seed, cfg): + mode = cfg.ik_nullspace_target + if mode == "none": + return None + if mode == "init": + return self.q_default() + if mode == "mid": + parts = ([self.upstream.q_mid] if self.n_up else []) + \ + [a.q_mid for a in self.arms] + return np.concatenate(parts) + if mode == "prev": + return np.array(q_seed, dtype=float) + return None + + def solve_trajectories(self, targets_per_arm, cfg, chain_cfgs=None): + """ + targets_per_arm: [(pos_seq, mat_seq), ...] 与 arm_chains 同序。 + + 返回 (各臂关节轨迹 list, 各臂遥测 list, 上游轨迹, 上游遥测)。 + 上游轨迹单独返回:它是"手臂被搬到哪里"的直接证据, + 对移动底座而言就是底座轨迹本身。 + """ + n_steps = min(len(p) for p, _ in targets_per_arm) + q_seed = self.q_default() + q_all = [] + telem_frames = [[] for _ in self.arms] + self._last_trajectory_solver_diagnostics = [] + try: + for t in range(n_steps): + # The existing 0.3-rad path constraint belongs in the feasible set. + # This is distinct from the seed: reseeding cannot bypass it. + self._continuity_reference = q_all[-1] if q_all else None + targets = [(p[t], m[t]) for p, m in targets_per_arm] + q, telems = self.solve_frame(targets, q_seed, cfg, chain_cfgs) + q_all.append(q) + self._last_trajectory_solver_diagnostics.append(dict(getattr(self, '_last_frame_diagnostics', {}))) + for i, tl in enumerate(telems): + telem_frames[i].append(tl) + q_seed = q if cfg.ik_warm_start == "prev" else self.q_default() + finally: + self._continuity_reference = None + + q_all = np.array(q_all) + arm_qs, arm_telems = [], [] + for i, (a, sl) in enumerate(zip(self.arms, self.slices)): + arm_qs.append(q_all[:, sl]) + arm_telems.append(aggregate_ik_telemetry( + q_all[:, sl], telem_frames[i], a.jnt_range)) + + up_q = q_all[:, :self.n_up] if self.n_up else np.zeros((len(q_all), 0)) + return arm_qs, arm_telems, up_q, self._upstream_telemetry(up_q) + + def _upstream_telemetry(self, up_q): + """ + 上游链的使用情况。这些量对固定底座是"躯干用了多少", + 对移动底座就是"底座走了多远、多快",因此字段名不绑定具体部件。 + """ + if not self.n_up or len(up_q) == 0: + return {"upstream_dof": 0, "upstream_engaged": False} + rng = self.upstream.jnt_range + span = np.maximum(rng[:, 1] - rng[:, 0], 1e-9) + used = (up_q.max(axis=0) - up_q.min(axis=0)) / span + step = np.abs(np.diff(up_q, axis=0)) if len(up_q) > 1 else np.zeros((1, self.n_up)) + return { + "upstream_dof": int(self.n_up), + "upstream_engaged": bool(np.abs(up_q).max() > 1e-6), + "upstream_range_used_ratio": float(used.max()), + "upstream_travel_rad": float(np.abs(np.diff(up_q, axis=0)).sum()) + if len(up_q) > 1 else 0.0, + "upstream_step_max_rad": float(step.max()), + } + + +class DualArmIKSolver: + """ + 双臂 IK。上游链(躯干 / 将来的移动底座)由两条臂共享,因此走耦合求解; + upstream_weight=0 时上游冻结,等价于两臂独立求解。 + """ + + def __init__(self, model, data, target_robot): + self.coupled = CoupledChainIK( + model, data, + getattr(target_robot, "upstream_joint_names", None) + or getattr(target_robot, "torso_joint_names", None) or [], + [(target_robot.left_arm.joint_names, target_robot.left_arm.ee_site_name), + (target_robot.right_arm.joint_names, target_robot.right_arm.ee_site_name)], + ) + # 保留单臂求解器:初始对齐等场景只需要一条链的正运动学 + self.left = SingleArmIK( + model, data, + target_robot.left_arm.joint_names, + target_robot.left_arm.ee_site_name, + ) + self.right = SingleArmIK( + model, data, + target_robot.right_arm.joint_names, + target_robot.right_arm.ee_site_name, + ) + + @property + def n_upstream(self): + return self.coupled.n_up + + def solve_dual(self, left_pos, left_mat, right_pos, right_mat, cfg, + left_cfg=None, right_cfg=None): + """ + 返回 (left_q, right_q, left_telem, right_telem, up_q, up_telem)。 + + cfg 提供共享参数;left_cfg/right_cfg 提供各链自己的位姿权重。 + """ + chain_cfgs = None + if left_cfg is not None and right_cfg is not None: + chain_cfgs = [left_cfg, right_cfg] + (lq, rq), (lt, rt), up_q, up_telem = self.coupled.solve_trajectories( + [(left_pos, left_mat), (right_pos, right_mat)], cfg, chain_cfgs, + ) + return lq, rq, lt, rt, up_q, up_telem diff --git a/1500case/source/agent_retarget/trackc/robots.py b/1500case/source/agent_retarget/trackc/robots.py new file mode 100644 index 0000000000000000000000000000000000000000..fbd5f8b61f3a59fb85427dba2e9fd1602dbc588e --- /dev/null +++ b/1500case/source/agent_retarget/trackc/robots.py @@ -0,0 +1,88 @@ +""" +Track C 的机器人模型配置。 + +源本体: Cobot Magic (Piper 6-DoF × 2) +目标本体: Astribot S1 (7-DoF × 2 + 4-DoF torso) +""" +import os +from dataclasses import dataclass, field +from typing import List, Tuple + +MODELS_DIR = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), + "models", "trackc") + + +@dataclass +class ArmSpec: + """单臂运动学规格""" + n_joints: int + joint_names: List[str] + ee_site_name: str + gripper_actuator_name: str = "" + + @property + def n_arm_dof(self): + return self.n_joints + + +@dataclass +class DualArmRobot: + """双臂机器人配置""" + name: str + mjcf_path: str + left_arm: ArmSpec + right_arm: ArmSpec + #: 位于手臂上游、被两条臂共享的自由度。固定底座本体上是躯干/升降柱, + #: 移动底座本体上再把底盘的平面关节加进来 —— 求解器不区分二者。 + upstream_joint_names: List[str] = field(default_factory=list) + + +PIPER_LEFT = ArmSpec( + n_joints=6, + joint_names=[f"left_joint{i}" for i in range(1, 7)], + ee_site_name="left_ee_site", + gripper_actuator_name="left_gripper", +) + +PIPER_RIGHT = ArmSpec( + n_joints=6, + joint_names=[f"right_joint{i}" for i in range(1, 7)], + ee_site_name="right_ee_site", + gripper_actuator_name="right_gripper", +) + +S1_LEFT = ArmSpec( + n_joints=7, + joint_names=[f"astribot_arm_left_joint_{i}" for i in range(1, 8)], + ee_site_name="arm_left_tool", + gripper_actuator_name="astribot_gripper_left_joint_L1", +) + +S1_RIGHT = ArmSpec( + n_joints=7, + joint_names=[f"astribot_arm_right_joint_{i}" for i in range(1, 8)], + ee_site_name="arm_right_tool", + gripper_actuator_name="astribot_gripper_right_joint_L1", +) + +S1_TORSO = [f"astribot_torso_joint_{i}" for i in range(1, 5)] + + +def cobot_magic_robot(): + return DualArmRobot( + name="CobotMagic", + mjcf_path=os.path.join(MODELS_DIR, "piper_isaac_sim", "piper_description", + "mujoco_model", "piper_description.xml"), + left_arm=PIPER_LEFT, + right_arm=PIPER_RIGHT, + ) + + +def astribot_s1_robot(): + return DualArmRobot( + name="AstribotS1", + mjcf_path=os.path.join(MODELS_DIR, "astribot_s1_ik", "astribot_s1_ik.xml"), + left_arm=S1_LEFT, + right_arm=S1_RIGHT, + upstream_joint_names=S1_TORSO, + ) diff --git a/1500case/source/agent_retarget/trackc/source_dualarm.py b/1500case/source/agent_retarget/trackc/source_dualarm.py new file mode 100644 index 0000000000000000000000000000000000000000..18c825fadd45ae614cdfb080091a0ef71e243123 --- /dev/null +++ b/1500case/source/agent_retarget/trackc/source_dualarm.py @@ -0,0 +1,177 @@ +""" +从 LeRobot 格式的 AtomBench/CobotMagic 数据集加载双臂演示。 + +AtomBench CobotMagic 数据格式 (LeRobot v2.1): + action: (14,) = 右臂6关节 + 右夹爪 + 左臂6关节 + 左夹爪 + observation.state: (26,) = 右臂6关节 + 右夹爪 + 右末端6D + 左臂6关节 + 左夹爪 + 左末端6D + +注意:原始数据中是 **右臂在前、左臂在后** 的顺序。 +""" +import json +import os +from dataclasses import dataclass +from typing import Dict, List, Optional + +import numpy as np + +# 任务短名 → 实际目录名前缀 +TASK_DIR_MAP = { + "dm1": "dm1_Pick_the_basket_and_put_the_cube_into_the_basket", + "dm2": "dm2_Put_the_ball_in_the_basket", + "dm3": "dm3_Place_the_bottles_upright_on_the_tray", + "dm4": "dm4_Push_two_cubes_into_the_marked_area", + "dm5": "dm5_Pick_the_bowl_pour_the_coffee_beans_into_bowl", + "dm6": "dm6_Open_drawer_put_block_into_drawer_close_drawer", + "dm7": "dm7_Stack_two_blocks_in_target_position", + "dm8": "dm8_Open_lid_place_the_block_into_box_close_lid", + "di1": "di1_Pick_up_basket_place_blue_block_into_basket", + "di2": "di2_Pick_up_basket_put_triangular_block_intobasket", + "di3": "di3_Pick_up_basket_place_largest_block_into_basket", + "di4": "di4_Pick_object_to_left_of_cylinder_place_basket", + "di5": "di5_Pick_up_two_cubes_place_into_basket_leave_one", + "di6": "di6_Pick_up_two_cubes_place_into_two_baskets", + "di7": "di7_Place_objects_except_the_red_block_into_basket", +} + + +@dataclass +class DualArmDemo: + """双臂演示数据""" + demo_key: str + task_name: str + + left_joint_traj: np.ndarray # (T, 6) 左臂关节角 + right_joint_traj: np.ndarray # (T, 6) 右臂关节角 + left_gripper_cmd: np.ndarray # (T,) 左夹爪 0~1 + right_gripper_cmd: np.ndarray # (T,) 右夹爪 0~1 + + left_eef_pos: Optional[np.ndarray] = None # (T, 3) 左末端位置 + left_eef_mat: Optional[np.ndarray] = None # (T, 3,3) 左末端姿态 + right_eef_pos: Optional[np.ndarray] = None # (T, 3) 右末端位置 + right_eef_mat: Optional[np.ndarray] = None # (T, 3,3) 右末端姿态 + + n_steps: int = 0 + + +def _euler_to_mat(euler): + """(roll, pitch, yaw) → 3x3 旋转矩阵""" + r, p, y = euler + cr, sr = np.cos(r), np.sin(r) + cp, sp = np.cos(p), np.sin(p) + cy, sy = np.cos(y), np.sin(y) + return np.array([ + [cy*cp, cy*sp*sr - sy*cr, cy*sp*cr + sy*sr], + [sy*cp, sy*sp*sr + cy*cr, sy*sp*cr - cy*sr], + [-sp, cp*sr, cp*cr], + ]) + + +def _resolve_task_dir(dataset_dir, task_name): + """把短任务名 (dm1) 解析为实际的数据目录路径""" + if task_name in TASK_DIR_MAP: + task_dir = os.path.join(dataset_dir, TASK_DIR_MAP[task_name]) + else: + task_dir = os.path.join(dataset_dir, task_name) + if not os.path.isdir(task_dir): + candidates = [d for d in os.listdir(dataset_dir) + if d.startswith(task_name + "_")] + if candidates: + task_dir = os.path.join(dataset_dir, candidates[0]) + return task_dir + + +def load_atombench_episode(dataset_dir, episode_idx, task_name="unknown"): + """ + 从 AtomBench/CobotMagic 本地目录加载一个 episode。 + + 数据结构: + {dataset_dir}/{task_full_name}/data/chunk-000/episode_XXXXXX.parquet + """ + try: + import pyarrow.parquet as pq + except ImportError: + raise ImportError("需要 pyarrow: pip install pyarrow") + + task_dir = _resolve_task_dir(dataset_dir, task_name) + parquet_path = os.path.join( + task_dir, "data", "chunk-000", + f"episode_{episode_idx:06d}.parquet" + ) + if not os.path.exists(parquet_path): + raise FileNotFoundError(f"Episode 文件不存在: {parquet_path}") + + table = pq.read_table(parquet_path) + df = table.to_pandas() + + if "observation.state" in df.columns: + states = np.stack(df["observation.state"].values) + else: + state_keys = sorted([c for c in df.columns if c.startswith("observation.state.")]) + states = df[state_keys].values.astype(np.float32) + + if "action" in df.columns: + actions = np.stack(df["action"].values) + else: + action_keys = sorted([c for c in df.columns if c.startswith("action.")]) + actions = df[action_keys].values.astype(np.float32) + + T = len(states) + + # action: (14,) = [right_j1..j6, right_gripper, left_j1..j6, left_gripper] + right_joint_traj = actions[:, 0:6] + right_gripper = actions[:, 6] + left_joint_traj = actions[:, 7:13] + left_gripper = actions[:, 13] + + # state: (26,) = [right_j1..j6, right_gripper, right_eef_6D, + # left_j1..j6, left_gripper, left_eef_6D] + right_eef_pos, right_eef_mat = None, None + left_eef_pos, left_eef_mat = None, None + if states.shape[1] >= 26: + # 右臂 EEF:state[7:13] = [x,y,z,rx,ry,rz] + right_eef_6d = states[:, 7:13] + right_eef_pos = right_eef_6d[:, :3] + right_eef_mat = np.array([_euler_to_mat(e) for e in right_eef_6d[:, 3:6]]) + # 左臂 EEF:state[20:26] = [x,y,z,rx,ry,rz] + left_eef_6d = states[:, 20:26] + left_eef_pos = left_eef_6d[:, :3] + left_eef_mat = np.array([_euler_to_mat(e) for e in left_eef_6d[:, 3:6]]) + + return DualArmDemo( + demo_key=f"episode_{episode_idx:06d}", + task_name=task_name, + left_joint_traj=left_joint_traj, + right_joint_traj=right_joint_traj, + left_gripper_cmd=left_gripper, + right_gripper_cmd=right_gripper, + left_eef_pos=left_eef_pos, + left_eef_mat=left_eef_mat, + right_eef_pos=right_eef_pos, + right_eef_mat=right_eef_mat, + n_steps=T, + ) + + +def load_task_episodes(dataset_dir, task_name, episode_ids): + """批量加载指定任务的多个 episodes""" + demos = [] + for eid in episode_ids: + try: + demo = load_atombench_episode(dataset_dir, eid, task_name) + demos.append(demo) + except Exception as e: + print(f"Warning: 加载 episode {eid} 失败: {e}") + return demos + + +def get_dataset_info(dataset_dir, task_name=None): + """读取数据集 meta 信息""" + if task_name: + task_dir = _resolve_task_dir(dataset_dir, task_name) + info_path = os.path.join(task_dir, "meta", "info.json") + else: + info_path = os.path.join(dataset_dir, "meta", "info.json") + if os.path.exists(info_path): + with open(info_path) as f: + return json.load(f) + return None diff --git a/1500case/source/constrained_waist.py b/1500case/source/constrained_waist.py new file mode 100644 index 0000000000000000000000000000000000000000..c5fb7897775779a5cd7408351ae29d4d6e739571 --- /dev/null +++ b/1500case/source/constrained_waist.py @@ -0,0 +1,136 @@ +"""S1 reduced IK with primary-task descent and an exact secondary nullspace. + +The physical waist constraint and acceptance thresholds are unchanged. A supplied +continuity reference restricts the next configuration during solving, not by +post-processing an unconstrained trajectory. +""" +import numpy as np + +VERSION='reduced_ik_primary_descent_table_metric_v4' +JOINT_STEP_LIMIT=.3 + +def project_q(q,lo,hi): + q=np.asarray(q,dtype=float).copy() + lower=max(lo[0],-.28403-hi[1]);upper=min(hi[0],-.28403-lo[1]) + if lower>upper:raise ValueError('No feasible coupled waist') + q=np.clip(q,lo,hi);q[0]=np.clip(q[0],lower,upper);q[1]=-.28403-q[0];q[2]=.28834;q[3]=-.00123 + return q + +def solve_frame(self,targets,q_seed,cfg,chain_cfgs=None): + from table_clearance_ik import get_constraint,MARGIN_M + from agent_retarget.trackc.ik_dualarm import ROT_BALANCE,DEFAULT_REACH_M,POS_TOL_REL,POS_STEP_REL,BASE_ROT_TOL,MAX_ROT_STEP,MAX_DQ_STEP,_axisangle_from_mat,_clip_norm + assert self.n_up==4 + cfgs=list(chain_cfgs) if chain_cfgs else [cfg]*self.n_arms + wps=[float(c.ik_pos_weight) for c in cfgs];wrs=[float(c.ik_rot_weight)*ROT_BALANCE for c in cfgs] + base_lam=float(cfg.ik_damping)*self.scale_m/DEFAULT_REACH_M;lam=base_lam;k=float(cfg.ik_nullspace_gain) + lo,hi,physical=self.limits(cfg) + assert physical[2,0]<=.28834<=physical[2,1] and physical[3,0]<=-.00123<=physical[3,1] + ref=getattr(self,'_continuity_reference',None) + if ref is not None: + radius=JOINT_STEP_LIMIT-1e-9 + lo=np.maximum(lo,np.asarray(ref)-radius);hi=np.minimum(hi,np.asarray(ref)+radius) + if np.any(lo>hi):raise ValueError('Empty physical/temporal constraint intersection') + q=project_q(q_seed,lo,hi);ns=self._nullspace_reference(q_seed,cfg) + n=self.n_total;B=np.zeros((n,n-3));B[0,0]=1;B[1,0]=-1;B[4:,1:]=np.eye(n-4) + weights=np.ones(n-3);weights[0]=max(0.,float(cfg.upstream_weight)) + active=np.flatnonzero(weights>0);root_weights=np.sqrt(weights[active]) + minimum=np.inf;converged=False;iterations=0;accepted=0;rejected=0;fallbacks=0;stalls=0;reason='iteration_limit' + clearance=get_constraint(self);restorations=0;projected=0;path_backoff=False;feasible_increases=0;small_feasible_steps=0 + + def observe(x,jacobian=False): + self._set_q(x);rows=[];errors=[];residuals=[];objective=0.;ok=True + for i,(tp,tm) in enumerate(targets): + p,m=self._site_pose(i);ep=tp-p;er=_axisangle_from_mat(tm@m.T);wp,wr=wps[i],wrs[i] + pe=float(np.linalg.norm(ep));re=float(np.linalg.norm(er));residuals.append((pe,re)) + objective+=(wp*pe)**2+(wr*re)**2 + ok=ok and ((pe=MARGIN_M-1e-6 + if ok and feasible:converged=True;reason='tolerance';break + J=np.vstack(rows);e=np.concatenate(errors) + U,sv,Vh=np.linalg.svd(J,full_matrices=True);minimum=min(minimum,float(sv[-1])) + coeff=sv/(sv*sv+lam*lam) + task=root_weights*(Vh[:len(sv)].T@(coeff*(U[:,:len(sv)].T@e))) + secondary=np.zeros_like(task) + if k>0 and ns is not None: + reference=project_q(ns,lo,hi);delta=np.r_[reference[0]-q[0],reference[4:]-q[4:]] + # Damped I-J#J leaks into the task. V's actual kernel does not. + rank=int(np.sum(sv>max(J.shape)*np.finfo(float).eps*sv[0])) if len(sv) else 0 + kernel=Vh[rank:].T + secondary=root_weights*(kernel@(kernel.T@(k*delta[active]/root_weights))) + # A large second-order nullspace excursion otherwise causes six + # rejected FK trials before the primary-only fallback on most steps. + # Bound the secondary displacement by actual primary progress. + secondary*=min(1.,np.linalg.norm(task)/max(np.linalg.norm(secondary),1e-15)) + directions=[task+secondary] + if np.linalg.norm(secondary)>1e-12:directions.append(task) + # Reuse the DLS SVD for an inverse Hessian in actual reduced-joint + # coordinates. Euclidean clipping can fight the pose objective and take + # hundreds of tiny steps along the same table boundary. + eig=np.full(len(active),lam*lam);eig[:len(sv)]+=sv*sv + inverse_metric=(Vh.T/eig)@Vh + inverse_metric=root_weights[:,None]*inverse_metric*root_weights[None,:] + found=False + for direction_index,direction in enumerate(directions): + self._set_q(q) + direction,count,linear_feasible=clearance.projected_step(direction,B,active,inverse_metric) + projected+=count + # Uniform scaling preserves direction; per-component clipping does not. + direction=direction*min(1.,MAX_DQ_STEP/max(np.max(np.abs(direction)),1e-15)) + du=np.zeros(n-3);du[active]=direction + for alpha in [1.,.5,.25,.125,.0625,.03125]: + candidate=project_q(q+B@(alpha*du),lo,hi) + trial=observe(candidate)[0] + trial_clearance=clearance.minimum() + restored=(not feasible and trial_clearance>current_clearance+1e-7) + improved=trial=MARGIN_M-1e-6 and improved) or restored): + # Once a hard surface prevents exact tracking, micrometre + # objective gains should not consume the remaining 150-200 + # iterations. This uses objective convergence, not the task + # success threshold, and only applies with active clearance. + tiny=(feasible and count>0 and objective-trial<=max(1e-12,objective*1e-4)) + small_feasible_steps=small_feasible_steps+1 if tiny else 0 + restorations+=int(restored);feasible_increases+=int(feasible and trial>objective+1e-12) + q=candidate;accepted+=1;trace.append(trial);found=True;fallbacks+=int(direction_index>0) + lam=max(base_lam,lam*.5);stalls=0;break + rejected+=1 + if found:break + if not found: + stalls+=1;lam=max(lam*4.,1e-5) + if stalls>=3:reason='stationary_or_constraint_limited';break + elif small_feasible_steps>=3: + reason='constrained_objective_stationary';break + path_feasible=True + if ref is not None and clearance.capsules and not clearance.path_safe(np.asarray(ref),q): + candidate=q.copy();path_backoff=True + path_feasible=False + for alpha in [.5,.25,.125,.0625,0.]: + trial=np.asarray(ref)+(candidate-np.asarray(ref))*alpha + if clearance.path_safe(np.asarray(ref),trial):q=trial;path_feasible=True;break + final_objective,converged,final,_,_=observe(q) + final_clearance=clearance.minimum();converged=converged and final_clearance>=MARGIN_M-1e-6 and path_feasible + if converged:reason='tolerance' + diagnostics={'solver_version':VERSION,'primary_objective_initial':initial_objective,'primary_objective_final':final_objective, + 'accepted_steps':accepted,'rejected_trials':rejected,'nullspace_fallbacks':fallbacks,'stop_reason':reason, + 'accepted_objective_increases':sum(int(b>a+1e-12) for a,b in zip(trace,trace[1:])), + 'accepted_feasible_objective_increases':feasible_increases,'constraint_restoration_steps':restorations, + 'table_clearance_projection_count':projected,'initial_capsule_table_clearance_m':initial_clearance, + 'final_capsule_table_clearance_m':final_clearance,'table_clearance_margin_m':MARGIN_M, + 'frame_path_feasibility_backoff':path_backoff, + 'frame_path_capsule_constraint_feasible':path_feasible, + 'small_feasible_objective_steps':small_feasible_steps, + 'continuity_constraint_active':ref is not None} + self._last_frame_diagnostics=diagnostics + telemetry=[{'pos_residual_m':pe,'rot_residual_rad':re,'n_iters':iterations,'converged':converged, + 'min_singular_value':float(minimum) if np.isfinite(minimum) else None,**diagnostics} for pe,re in final] + return q,telemetry diff --git a/1500case/source/models/trackc/astribot_descriptions/mjcf/astribot_s1_mjcf/assets/astribot_s1_asset_for_gripper.xml b/1500case/source/models/trackc/astribot_descriptions/mjcf/astribot_s1_mjcf/assets/astribot_s1_asset_for_gripper.xml new file mode 100644 index 0000000000000000000000000000000000000000..cdbadf54b73b7bfe0fc239ccb9865872cadb63ce --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/mjcf/astribot_s1_mjcf/assets/astribot_s1_asset_for_gripper.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/1500case/source/models/trackc/astribot_descriptions/mjcf/astribot_s1_mjcf/model_with_effector/astribot_s1_model_with_gripper.xml b/1500case/source/models/trackc/astribot_descriptions/mjcf/astribot_s1_mjcf/model_with_effector/astribot_s1_model_with_gripper.xml new file mode 100644 index 0000000000000000000000000000000000000000..2405f31fcde6a612c0101e9182f276d02059137f --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/mjcf/astribot_s1_mjcf/model_with_effector/astribot_s1_model_with_gripper.xml @@ -0,0 +1,182 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_head_link_2.obj b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_head_link_2.obj new file mode 100644 index 0000000000000000000000000000000000000000..c86008ce5bd20b5886511aa339110f18f3ca3f70 --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_head_link_2.obj @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a6dc2fa33de59fd0502c6482eaabc48d846c1ecc863d74f1ec33f83fcd96360 +size 38496139 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_base_link.obj b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_base_link.obj new file mode 100644 index 0000000000000000000000000000000000000000..1be8ef51bca623ee18d204d0890b51f995e6c5f3 --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_base_link.obj @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd7b42ad341963e0aaa7e898411078173ba2613a5eff60140232c7d04d0b36da +size 40001354 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_2.obj b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_2.obj new file mode 100644 index 0000000000000000000000000000000000000000..2a11a10911cbfe5baf9d5fa80a3a1ca7007d8bc8 --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_2.obj @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3f639a37cc63757da571bbeeedd130c98afd798af6ba33f1a7960884549b1e3 +size 33347575 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_4.obj b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_4.obj new file mode 100644 index 0000000000000000000000000000000000000000..cb23e49277aec820046763e9703280b05de791c0 --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/obj/astribot_torso_link_4.obj @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:955db3acb335e179d35a0ad76f537109f6d2ab0b74fd6d9d5d0db7ed7ef14a32 +size 28906301 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_base_link.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_base_link.STL new file mode 100644 index 0000000000000000000000000000000000000000..8ada1fe25c57dab5cfa2d1ebd2c514ed55c90981 --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_base_link.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f5ce4a1ca6343fa73aac37e9ab1581224eae72b13e906592e253f5b9ff71b7e7 +size 393484 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_link_2.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_link_2.STL new file mode 100644 index 0000000000000000000000000000000000000000..85af66233275f634b4ed42d08ac11ec709279e64 --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_link_2.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:29a31a52440708e5257005fcaa766d782b6e9895a7d641cf96818db5939b72b5 +size 1168184 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_1.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_1.STL new file mode 100644 index 0000000000000000000000000000000000000000..d8b90c07edb2f2515a2bb02440f94bb65034cccc --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_1.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b6c9d2fb9539f3865c15f86dae8bfd88e23daab3a8136775a7f5e840519a9ccf +size 160984 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_3.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_3.STL new file mode 100644 index 0000000000000000000000000000000000000000..523b949826d3333ae11a66621ff10abf5cbf7aa1 --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_3.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a8d48fa6ed9eae1d1b85be42937c9f162fb9039a630943f8fae9b511c1fb711a +size 1431884 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_4.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_4.STL new file mode 100644 index 0000000000000000000000000000000000000000..8b514592223a88bf61b843ff8495ca13086edfc4 --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_4.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf0ae423d242e076a628c4181afcd0f42c677d94f5b31582e79997b5620ac043 +size 325584 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_5.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_5.STL new file mode 100644 index 0000000000000000000000000000000000000000..9ba517c30ec38769689a785b6adabb5adf86e373 --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_5.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a8301d519a7cac044de0e9b1dda82147382aed2d0b64b5c2d7035461464a21ae +size 1988484 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_6.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_6.STL new file mode 100644 index 0000000000000000000000000000000000000000..56866ec428677d333046300bc3c7cd6d57411c42 --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_6.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c2a3a57e115c59006eb37ac8dbc28736e2366a048ea2e1545731910ad4c897f7 +size 626484 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_7.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_7.STL new file mode 100644 index 0000000000000000000000000000000000000000..cd56056bd2db845d4cf9884c4465b997f67bf440 --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_7.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:650d570d2e0d2978fc8b870adf2495e8cd24944b6e3a2da3c0fad0a48db2fd8f +size 216184 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_base_link.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_base_link.STL new file mode 100644 index 0000000000000000000000000000000000000000..1c3a4489772b1f09fde1b3fc4569cbf7c05b393c --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_base_link.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2d63475f85bf98fc0e7569ee5aeb554ff9dc0d6abe10e85b5e58d17c822946e +size 394684 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_link_2.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_link_2.STL new file mode 100644 index 0000000000000000000000000000000000000000..53395f14e6033dac6f0c6e63c555768684f9d1ff --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_link_2.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9074ba1114c0d0fb9f950c678689f5e2536beadf84c8b24a872165c84066583d +size 1170384 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_L11_Link.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_L11_Link.STL new file mode 100644 index 0000000000000000000000000000000000000000..cc77b1bc139d0887da38896d169a0809f8dd6381 --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_L11_Link.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c2ac3e5c2039b5e3e9127f1e612520b4e76863619e6d4853d5f640e988df401 +size 455284 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_L1_Link.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_L1_Link.STL new file mode 100644 index 0000000000000000000000000000000000000000..6db487434ca443561d317232e573b4ebba6b1d62 Binary files /dev/null and b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_L1_Link.STL differ diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_L2_Link.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_L2_Link.STL new file mode 100644 index 0000000000000000000000000000000000000000..03d1ce2c8dce73b4ace152d6df49a49a86184a09 Binary files /dev/null and b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_L2_Link.STL differ diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_R11_Link.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_R11_Link.STL new file mode 100644 index 0000000000000000000000000000000000000000..5ec669e53451e0dfd31fd946a875d2acb3f96134 --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_R11_Link.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:10ce463e0fb7bfb632b310f9f47ce746be98383ed2538f118c4fb4ce69971c55 +size 455284 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_R1_Link.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_R1_Link.STL new file mode 100644 index 0000000000000000000000000000000000000000..b01289c0e59775da7cd45d073e05ec09a5168d08 Binary files /dev/null and b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_R1_Link.STL differ diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_R2_Link.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_R2_Link.STL new file mode 100644 index 0000000000000000000000000000000000000000..64e7b31b309c1b5e40d267a432dc7c85b64c58c7 Binary files /dev/null and b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_R2_Link.STL differ diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_base_link.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_base_link.STL new file mode 100644 index 0000000000000000000000000000000000000000..0f919b41423edb7a06630039c46e75e41cf058a6 --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_gripper/astribot_gripper_base_link.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:887e309b8db7285917c26d272a84a3c56b30638e1f4e71e2b23930a9d3244db1 +size 1086384 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_base_link.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_base_link.STL new file mode 100644 index 0000000000000000000000000000000000000000..9bacaefe0f40810472eb712a2dc486aa0b8344bb --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_base_link.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82a65945d782623b806f4c59f53bfaef39d14bdd5a84f2e21a25867122493242 +size 148284 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_link_1.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_link_1.STL new file mode 100644 index 0000000000000000000000000000000000000000..a8fc869f20949363bfab211f021bce7f55920b62 Binary files /dev/null and b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_link_1.STL differ diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_link_2.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_link_2.STL new file mode 100644 index 0000000000000000000000000000000000000000..64273baa800f3685b87ce41db2b7c9fcc5766624 --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_link_2.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:94170698aea56450148d63cfff41daf899de7eab03d9fe716ff22959cca73306 +size 9665084 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_base_link.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_base_link.STL new file mode 100644 index 0000000000000000000000000000000000000000..997d92f29645197b2fda44148bfa6641129be083 --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_base_link.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:88d76fa4c7834bb756298db81907c204cfcb7a918eb4e1380fbc07bc894a2a2c +size 9484534 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_1.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_1.STL new file mode 100644 index 0000000000000000000000000000000000000000..78cc16d1ad89aa6884e80b53c12642e3516e1a53 --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_1.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a35f95371318c34c2b61b5003ded18d9bd5af7910a42a052974e1ac02f639783 +size 2927384 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_2.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_2.STL new file mode 100644 index 0000000000000000000000000000000000000000..4b085228312b9c08b72017e08318d12f1258f3bf --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_2.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:30237e4da5116ada620cdeccea5766fc1a3cf152f6f7892ded49f52ae71878a6 +size 8721384 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_3.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_3.STL new file mode 100644 index 0000000000000000000000000000000000000000..2f03ec0a1aeb1725ffa660db46ef2912a805dd92 --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_3.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eab30e56b62eb82c185fd601f73d28b3c948975ea427b250a5ce0ff58b2aeaab +size 2721384 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_4.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_4.STL new file mode 100644 index 0000000000000000000000000000000000000000..12e7dff89298622f2ed337527c800b9e06c570fe --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_4.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f0a1e9860d36598beec63562a27f88733216cc7d8db9796274e381b5d90c362c +size 7149984 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_LF_Link.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_LF_Link.STL new file mode 100644 index 0000000000000000000000000000000000000000..dda59974b8c3a2117d929c8d2f01945d0c28c0ba --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_LF_Link.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4bf080c0908855a21de278d5c3d356f9a3e04bc7e967671bf21fdd91b220cc6a +size 3733184 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_LR_Link.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_LR_Link.STL new file mode 100644 index 0000000000000000000000000000000000000000..dda59974b8c3a2117d929c8d2f01945d0c28c0ba --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_LR_Link.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4bf080c0908855a21de278d5c3d356f9a3e04bc7e967671bf21fdd91b220cc6a +size 3733184 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_RF_Link.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_RF_Link.STL new file mode 100644 index 0000000000000000000000000000000000000000..dda59974b8c3a2117d929c8d2f01945d0c28c0ba --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_RF_Link.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4bf080c0908855a21de278d5c3d356f9a3e04bc7e967671bf21fdd91b220cc6a +size 3733184 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_RR_Link.STL b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_RR_Link.STL new file mode 100644 index 0000000000000000000000000000000000000000..dda59974b8c3a2117d929c8d2f01945d0c28c0ba --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/wheel_RR_Link.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4bf080c0908855a21de278d5c3d356f9a3e04bc7e967671bf21fdd91b220cc6a +size 3733184 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_head_link_2.png b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_head_link_2.png new file mode 100644 index 0000000000000000000000000000000000000000..ae8d981517de18916f605c66a36de2d6d4358778 --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_head_link_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a9b16978f8d857c74383f61af9487e30157e9d1d559c99de6530b2004c93502 +size 245361 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_torso_base_link.png b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_torso_base_link.png new file mode 100644 index 0000000000000000000000000000000000000000..7ec37be6e3e5281fa8f9e9707994afcb556b54d9 --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_torso_base_link.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5857003d2083766116a8bbe292c37ec0af390ac73ae4355a5df6b179a872d72c +size 562140 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_torso_link_2.png b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_torso_link_2.png new file mode 100644 index 0000000000000000000000000000000000000000..79dbfde9cbcef67238d9e21466368b6f4fce9d05 --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_torso_link_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5edecacd88d04d38cc28ae2cbbf2dbd172f9996c1575b0762cea33b5795f84f7 +size 502245 diff --git a/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_torso_link_4.png b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_torso_link_4.png new file mode 100644 index 0000000000000000000000000000000000000000..fa3ea71eed4fc2bf1491b988859821e290eee99f --- /dev/null +++ b/1500case/source/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/textures/astribot_torso_link_4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a314b1341074cca6aa64ec00e0b0d23a91431a360535b7f0fdc9729d6bfccd15 +size 41498 diff --git a/1500case/source/models/trackc/astribot_s1_ik/astribot_s1_ik.xml b/1500case/source/models/trackc/astribot_s1_ik/astribot_s1_ik.xml new file mode 100644 index 0000000000000000000000000000000000000000..098f92ec042c2cdac42d47a9ea275526edd56c21 --- /dev/null +++ b/1500case/source/models/trackc/astribot_s1_ik/astribot_s1_ik.xml @@ -0,0 +1,94 @@ + + + \ No newline at end of file diff --git a/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/base_link.STL b/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/base_link.STL new file mode 100644 index 0000000000000000000000000000000000000000..e724054b9e42ad82538d846b522c4f6f169665d0 --- /dev/null +++ b/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/base_link.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fd4a3d6d0266205fe3f725f048645be66592c23564db22e08b0807d5569b2c64 +size 607384 diff --git a/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/gripper_base.STL b/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/gripper_base.STL new file mode 100644 index 0000000000000000000000000000000000000000..6a0556748c79e86dfb58ac7376317e9b3a3abc55 --- /dev/null +++ b/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/gripper_base.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2895bfa6f1eef2d0ad2cb9dfdedd5f6c760ec07388bcde2b4d1e412e1189c9cb +size 649484 diff --git a/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link1.STL b/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link1.STL new file mode 100644 index 0000000000000000000000000000000000000000..310339a83fc0bc6469e533a41829978d55808a77 --- /dev/null +++ b/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link1.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ee6e1d67c0241f42a0dbaf5c676d19230375ed078ee1943bb8c4c37ab303d14 +size 447784 diff --git a/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link2.STL b/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link2.STL new file mode 100644 index 0000000000000000000000000000000000000000..cc15d933b71b34ecaa8e0405e97697ee6e67e2f2 --- /dev/null +++ b/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link2.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0d37675b699b643f2e15348de99aed535fac10dc5f09a79b8e4b0acfaf4e0378 +size 3658384 diff --git a/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link3.STL b/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link3.STL new file mode 100644 index 0000000000000000000000000000000000000000..68b71f1234208f68c17a057f7aaae19627d98115 --- /dev/null +++ b/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link3.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e8ae51f17c0c7f6d67b753922e2cc269f5e8372a65734f859231639a64fe8fad +size 1845784 diff --git a/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link4.STL b/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link4.STL new file mode 100644 index 0000000000000000000000000000000000000000..51b3f7776786000debae109e420bc9d68e2b1922 --- /dev/null +++ b/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link4.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:efa33022976218f246f736a6133494b5d0e5486e8b50b52900c42f285ae85558 +size 877984 diff --git a/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link5.STL b/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link5.STL new file mode 100644 index 0000000000000000000000000000000000000000..81a4bf92edbf836ba08b5b7dac2a156d77e119ea --- /dev/null +++ b/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link5.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a1c69d1c7f6f8c60e2c82331c0f444725200ed4053d3e5ec23aa82cb5db5b29f +size 833684 diff --git a/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link6.STL b/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link6.STL new file mode 100644 index 0000000000000000000000000000000000000000..b879dc1ed61aa4503ccd50561d52cb22b13237fd Binary files /dev/null and b/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link6.STL differ diff --git a/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link7.STL b/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link7.STL new file mode 100644 index 0000000000000000000000000000000000000000..2d9553b127fc66e4f055acfba0acd44b9b45c5ea --- /dev/null +++ b/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link7.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:475a7d8db056524d7659fadf5a2c307d62791047b6214d733dfc7846ed1c613d +size 104384 diff --git a/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link8.STL b/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link8.STL new file mode 100644 index 0000000000000000000000000000000000000000..dafd14e9c393d7b3ff3992a65194f03435cdaa2b --- /dev/null +++ b/1500case/source/models/trackc/piper_isaac_sim/piper_description/meshes/link8.STL @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3f88d534a85e28a33ef7d2061adacbd1d25214aa9325f9e464aad0f9e4b74606 +size 104384 diff --git a/1500case/source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml b/1500case/source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml new file mode 100644 index 0000000000000000000000000000000000000000..6929448f168c49a4af82f1282ed1baf7a2dbdb70 --- /dev/null +++ b/1500case/source/models/trackc/piper_isaac_sim/piper_description/mujoco_model/piper_description.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/1500case/source/scene/s1_tabletop.json b/1500case/source/scene/s1_tabletop.json new file mode 100644 index 0000000000000000000000000000000000000000..dc9f974cd0a91880d6dffd722cffcbea9ce5dae6 --- /dev/null +++ b/1500case/source/scene/s1_tabletop.json @@ -0,0 +1,40 @@ +{ + "table": { + "width_m": 1.2, + "depth_m": 0.8, + "height_m": 0.75, + "thickness_m": 0.05, + "center_xy_world_m": [ + 0.0, + -0.75 + ], + "assumed_not_measured": true + }, + "robot_meshes": 16, + "robot_mesh_geoms": 22, + "nq": 18, + "mesh_collision": "MuJoCo convex hulls of per-link visual meshes; conservative approximation", + "gripper_collision": "Fixed capsule envelope, no actuated finger/contact model", + "robot_self_collision_checked": false, + "robot_table_collision_checked": true, + "task_object_dynamics": false, + "mesh_sha256": { + "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_base_link.STL": "f5ce4a1ca6343fa73aac37e9ab1581224eae72b13e906592e253f5b9ff71b7e7", + "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_left_link_2.STL": "29a31a52440708e5257005fcaa766d782b6e9895a7d641cf96818db5939b72b5", + "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_1.STL": "b6c9d2fb9539f3865c15f86dae8bfd88e23daab3a8136775a7f5e840519a9ccf", + "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_3.STL": "a8d48fa6ed9eae1d1b85be42937c9f162fb9039a630943f8fae9b511c1fb711a", + "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_4.STL": "cf0ae423d242e076a628c4181afcd0f42c677d94f5b31582e79997b5620ac043", + "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_5.STL": "a8301d519a7cac044de0e9b1dda82147382aed2d0b64b5c2d7035461464a21ae", + "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_6.STL": "c2a3a57e115c59006eb37ac8dbc28736e2366a048ea2e1545731910ad4c897f7", + "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_link_7.STL": "650d570d2e0d2978fc8b870adf2495e8cd24944b6e3a2da3c0fad0a48db2fd8f", + "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_base_link.STL": "a2d63475f85bf98fc0e7569ee5aeb554ff9dc0d6abe10e85b5e58d17c822946e", + "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_arm/astribot_arm_right_link_2.STL": "9074ba1114c0d0fb9f950c678689f5e2536beadf84c8b24a872165c84066583d", + "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_head/astribot_head_base_link.STL": "82a65945d782623b806f4c59f53bfaef39d14bdd5a84f2e21a25867122493242", + "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_base_link.STL": "88d76fa4c7834bb756298db81907c204cfcb7a918eb4e1380fbc07bc894a2a2c", + "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_1.STL": "a35f95371318c34c2b61b5003ded18d9bd5af7910a42a052974e1ac02f639783", + "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_2.STL": "30237e4da5116ada620cdeccea5766fc1a3cf152f6f7892ded49f52ae71878a6", + "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_3.STL": "eab30e56b62eb82c185fd601f73d28b3c948975ea427b250a5ce0ff58b2aeaab", + "/pfs/yichen/r2r/models/trackc/astribot_descriptions/urdf/astribot_s1_urdf/meshes/s1_torso/astribot_torso_link_4.STL": "f0a1e9860d36598beec63562a27f88733216cc7d8db9796274e381b5d90c362c" + }, + "model_sha256": "b06105a8999dd7564f73b2811d7ef6708488a45ae4e575fd4ed755702c26d035" +} \ No newline at end of file diff --git a/1500case/source/scene/s1_tabletop.xml b/1500case/source/scene/s1_tabletop.xml new file mode 100644 index 0000000000000000000000000000000000000000..5a792d7192dc8f3cea59eccb6940ff809f08fff2 --- /dev/null +++ b/1500case/source/scene/s1_tabletop.xml @@ -0,0 +1,110 @@ + + + \ No newline at end of file diff --git a/1500case/source/scene/task_frame_contract.json b/1500case/source/scene/task_frame_contract.json new file mode 100644 index 0000000000000000000000000000000000000000..8031b71d46bae75c248a4f6de50f497a905857ed --- /dev/null +++ b/1500case/source/scene/task_frame_contract.json @@ -0,0 +1,235 @@ +{ + "version": "source_stack_registration_v1_fixed_synthetic_table_v1", + "units": "m", + "rotation_convention": "right_handed_rotation_matrix", + "world_from_task": [ + [ + 2.220446049250313e-16, + 1.0, + 0.0, + 0.0 + ], + [ + -1.0, + 2.220446049250313e-16, + -0.0, + -0.75 + ], + [ + -0.0, + 0.0, + 1.0, + 0.75 + ], + [ + 0.0, + 0.0, + 0.0, + 1.0 + ] + ], + "chains": { + "left": { + "task_from_source_base": [ + [ + 1.0, + 0.0, + 0.0, + -0.40709275024330716 + ], + [ + 0.0, + 1.0, + 0.0, + 0.308223982056 + ], + [ + 0.0, + 0.0, + 1.0, + 0.03473801229812054 + ], + [ + 0.0, + 0.0, + 0.0, + 1.0 + ] + ], + "source_reference_from_grasp": [ + [ + -0.0, + -1.0, + 0.0, + 0.0 + ], + [ + 1.0, + 0.0, + 0.0, + 0.0 + ], + [ + -0.0, + 0.0, + 1.0, + 0.13366940357801368 + ], + [ + 0.0, + 0.0, + 0.0, + 1.0 + ] + ], + "target_site_from_grasp": [ + [ + 1.0, + -8.180830114382886e-38, + 0.0, + 0.0 + ], + [ + -2.720210018003498e-29, + 2.6794896468285145e-08, + -0.9999999999999997, + 0.0 + ], + [ + 8.106857591877872e-37, + 0.9999999999999997, + 2.6794896468285145e-08, + 0.0 + ], + [ + 0.0, + 0.0, + 0.0, + 1.0 + ] + ] + }, + "right": { + "task_from_source_base": [ + [ + 0.999462342916746, + -0.032787575259063215, + 0.0, + -0.3929072497566929 + ], + [ + 0.032787575259063215, + 0.999462342916746, + 0.0, + -0.308223982056 + ], + [ + 0.0, + 0.0, + 1.0, + 0.03473801229812054 + ], + [ + 0.0, + 0.0, + 0.0, + 1.0 + ] + ], + "source_reference_from_grasp": [ + [ + -0.0, + -1.0, + 0.0, + 0.0 + ], + [ + 1.0, + 0.0, + 0.0, + 0.0 + ], + [ + -0.0, + 0.0, + 1.0, + 0.13366940357801368 + ], + [ + 0.0, + 0.0, + 0.0, + 1.0 + ] + ], + "target_site_from_grasp": [ + [ + 1.0, + -8.180830114382886e-38, + 0.0, + 0.0 + ], + [ + -2.720210018003498e-29, + 2.6794896468285145e-08, + -0.9999999999999997, + 0.0 + ], + [ + 8.106857591877872e-37, + 0.9999999999999997, + 2.6794896468285145e-08, + 0.0 + ], + [ + 0.0, + 0.0, + 0.0, + 1.0 + ] + ] + } + }, + "source_registration_status": "estimated planar extrinsics and shared axial virtual grasp from 99 stacking release pairs; not measured calibration", + "source_analysis_sha256": "fe837bcb1d2edb90852924bafc15629f339b54f4632e97b5d241d9fae915ec91", + "source_model_hashes": { + "source": "3c2e4bf29dd7fc80acfbb056ad711548bdd57f5c26f2e0fcb43f179b8e02f726", + "target": "53fd2c3d4f892edd219c2ea3a0ff7639b697f78286a75f4df85cf4e9bf897452", + "gripper": "9a411382c625b12287a3e13b727de8550810ac4e977d2ccde8b7bec31036ea96" + }, + "source_registration_cross_validation_p90_mm": 14.676522765629208, + "synthetic_placement": { + "table_size_m": [ + 1.2, + 0.8, + 0.05 + ], + "table_top_world_m": [ + 0, + -0.75, + 0.75 + ], + "source_table_height_gauge": { + "virtual_cube_side_m": 0.048969959046310185, + "table_z_in_source_left_base_m": -0.03473801229812054, + "assumptions": [ + "source bases are coplanar and share +Z up", + "virtual grasp origin approximates cube centre at both releases", + "median release-height difference approximates cube side" + ], + "not_identified_from_xy_data": true, + "not_hardware_calibration": true + }, + "placement_rule": "source +X forward maps to world -Y; source +Y left maps to world +X; source-base midpoint lies at near table edge; no per-episode centroid or IK-score fit" + }, + "unknowns": [ + "measured source table/base extrinsics", + "actual source and target contact TCP origins", + "whether source mounts are identical across task recordings", + "source object poses and task dynamics" + ], + "hardware_ready": false, + "task_goal_or_object_success_verified": false, + "geometry_fields_editable": false, + "frozen_before_target_ik_test": true +} \ No newline at end of file diff --git a/1500case/source/scene_binding.py b/1500case/source/scene_binding.py new file mode 100644 index 0000000000000000000000000000000000000000..949ae4c08c0a914613d5d41e7ff1fd3ec0f7283e --- /dev/null +++ b/1500case/source/scene_binding.py @@ -0,0 +1,48 @@ +"""Restore recorded non-robot scene while retaining target embodiment and actuators.""" +import copy,xml.etree.ElementTree as ET +import numpy as np + +PREFIXES=('robot0_','gripper0_','mount0_') +def robot_element(element): + return any(e.get('name','').startswith(PREFIXES) for e in element.iter()) + +def merge_scene(target_xml,source_xml): + target=ET.fromstring(target_xml);source=ET.fromstring(source_xml) + tw=target.find('worldbody');sw=source.find('worldbody') + assert tw is not None and sw is not None + for el in list(tw): + if not robot_element(el):tw.remove(el) + for el in sw: + if not robot_element(el):tw.append(copy.deepcopy(el)) + ta=target.find('asset');sa=source.find('asset') + if ta is not None and sa is not None: + for el in sa: + if el.get('name','').startswith(PREFIXES):continue + for old in list(ta): + if old.tag==el.tag and old.get('name')==el.get('name'):ta.remove(old) + ta.append(copy.deepcopy(el)) + for tag in ['contact','equality']: + ts=target.find(tag);ss=source.find(tag) + if ss is None:continue + if ts is None:ts=ET.SubElement(target,tag) + def has_robot_ref(el):return any(v.startswith(PREFIXES) for v in el.attrib.values()) + for el in list(ts): + if not has_robot_ref(el):ts.remove(el) + for el in ss: + if not has_robot_ref(el):ts.append(copy.deepcopy(el)) + return ET.tostring(target,encoding='unicode') + +def nonrobot_joint_state(env): + return {env.sim.model.joint_id2name(i):np.array(env.sim.data.get_joint_qpos(env.sim.model.joint_id2name(i))).copy() + for i in range(env.sim.model.njnt) if not env.sim.model.joint_id2name(i).startswith(PREFIXES)} + +def bind_scene(env,demo): + env.reset() + if getattr(demo,'scene_xml',None): + xml=merge_scene(env.sim.model.get_xml(),demo.scene_xml) + env.reset_from_xml_string(xml);env.sim.reset() + for name,value in demo.object_init.items(): + env.sim.data.set_joint_qpos(name,value) + velocity=np.asarray(env.sim.data.get_joint_qvel(name)) + env.sim.data.set_joint_qvel(name,np.zeros_like(velocity)) + env.sim.forward();env._get_observations(force_update=True) diff --git a/1500case/source/table_clearance_ik.py b/1500case/source/table_clearance_ik.py new file mode 100644 index 0000000000000000000000000000000000000000..b25575a804bbc12f39b29eb28220b46d4326f63f --- /dev/null +++ b/1500case/source/table_clearance_ik.py @@ -0,0 +1,101 @@ +"""Capsule/tabletop inequalities for IK; the full scene verifier remains separate. + +Uses model geometry and point Jacobians, never changes targets, table or shapes. +The rectangular footprint is expanded by capsule radius, conservatively treating +edge/corner proximity as a top-plane constraint. Mesh/leg/self contacts are still +checked by the original trajectory verifier and are not claimed solved here. +""" +import numpy as np +import mujoco + +VERSION='capsule_tabletop_feasible_ik_metric_v2' +MARGIN_M=.002 +ACTIVATION_M=.03 + +def clipped_interval(a,b,half): + lo,hi=0.,1.;v=b-a + for axis in range(2): + if abs(v[axis])<1e-12: + if abs(a[axis])>half[axis]:return None + else: + u0=(-half[axis]-a[axis])/v[axis];u1=(half[axis]-a[axis])/v[axis] + lo=max(lo,min(u0,u1));hi=min(hi,max(u0,u1)) + if lo>hi:return None + return lo,hi + +def project_halfspaces(direction,a,b,iterations=24,inverse_metric=None): + """Projection in the supplied positive-definite metric, using Hildreth updates.""" + x=np.asarray(direction,dtype=float).copy() + if not len(a):return x,True + a=np.asarray(a);b=np.asarray(b) + normals=a if inverse_metric is None else a@np.asarray(inverse_metric).T + norms=np.einsum('ij,ij->i',a,normals);dual=np.zeros(len(a)) + for _ in range(iterations): + for i in range(len(a)): + if norms[i]<1e-16:continue + value=max(0.,dual[i]+(b[i]-a[i]@x)/norms[i]);x+=(value-dual[i])*normals[i];dual[i]=value + slack=a@x-b + if np.all(slack>=-1e-8) and np.all(np.abs(slack[dual>1e-10])<1e-8):return x,True + return x,bool(np.all(a@x>=b-1e-6)) + +class CapsuleTableConstraint: + def __init__(self,solver): + self.solver=solver;self.model=solver.model;self.data=solver.data + self.table=mujoco.mj_name2id(self.model,mujoco.mjtObj.mjOBJ_GEOM,'worktable_top') + self.capsules=[] + if self.table>=0: + if self.model.geom_type[self.table]!=mujoco.mjtGeom.mjGEOM_BOX:raise ValueError('Worktable top must be an explicit box') + for i in range(self.model.ngeom): + if self.model.geom_type[i]!=mujoco.mjtGeom.mjGEOM_CAPSULE:continue + if self.model.geom_bodyid[i]==self.model.geom_bodyid[self.table]:continue + collide=(self.model.geom_contype[i]&self.model.geom_conaffinity[self.table]) or (self.model.geom_contype[self.table]&self.model.geom_conaffinity[i]) + if collide:self.capsules.append(i) + self.dofs=np.concatenate([solver.upstream.dof_adr]+[a.dof_adr for a in solver.arms]) + self.jp=np.zeros((3,self.model.nv)) + + def records(self,jacobian=False,activation=np.inf): + if self.table<0:return [] + table_r=self.data.geom_xmat[self.table].reshape(3,3);center=self.data.geom_xpos[self.table] + half=self.model.geom_size[self.table];normal=table_r[:,2];out=[] + for i in self.capsules: + radius,length=self.model.geom_size[i,:2];axis=self.data.geom_xmat[i].reshape(3,3)[:,2] + ends=np.array([self.data.geom_xpos[i]-length*axis,self.data.geom_xpos[i]+length*axis]) + local=(ends-center)@table_r + interval=clipped_interval(local[0],local[1],half[:2]+radius) + if interval is None:continue + alpha=interval[0] if local[1,2]>=local[0,2] else interval[1] + point=(1-alpha)*ends[0]+alpha*ends[1] + clearance=float(((point-center)@normal)-radius-half[2]) + if clearance>activation:continue + rec={'geom_id':int(i),'geom_name':mujoco.mj_id2name(self.model,mujoco.mjtObj.mjOBJ_GEOM,i), + 'clearance_m':clearance,'axis_point_world':point,'radius_m':float(radius)} + if jacobian: + mujoco.mj_jac(self.model,self.data,self.jp,None,point,int(self.model.geom_bodyid[i])) + rec['gradient']=normal@self.jp[:,self.dofs] + out.append(rec) + return out + + def minimum(self): + return min((r['clearance_m'] for r in self.records()),default=1.) + + def projected_step(self,direction,basis,active,inverse_metric=None): + records=self.records(jacobian=True,activation=ACTIVATION_M) + if not records:return direction,0,True + a=np.array([(r['gradient']@basis)[active] for r in records]) + b=np.array([MARGIN_M-r['clearance_m'] for r in records]) + out,ok=project_halfspaces(direction,a,b,inverse_metric=inverse_metric) + return out,len(records),ok + + def path_safe(self,start,end): + # Same 0.05 rad interpolation density as the final scene check. This is + # a capsule/top optimizer guard, not a claim of continuous/full collision safety. + samples=max(1,int(np.ceil(np.max(np.abs(end-start))/.05))) + for alpha in np.arange(1,samples+1)/samples: + self.solver._set_q(start+(end-start)*alpha) + if self.minimum()=-1e-5:continue + a=mujoco.mj_id2name(model,mujoco.mjtObj.mjOBJ_GEOM,c.geom1) or '' + b=mujoco.mj_id2name(model,mujoco.mjtObj.mjOBJ_GEOM,c.geom2) or '' + if a.startswith('worktable_') or b.startswith('worktable_'): + pairs.append([a,b]);worst=max(worst,-float(c.dist)) + return pairs,worst + +def check_trajectory(ev,left_q,right_q,up_q): + q=np.concatenate([up_q,left_q,right_q],axis=1);solver=ev._ik_solver.coupled + adr=np.concatenate([solver.upstream.qpos_adr]+[a.qpos_adr for a in solver.arms]) + data=mujoco.MjData(ev._model);count=0;hits=0;worst=0.;pairs=set() + for i,end in enumerate(q): + start=q[i-1] if i else end + sub=max(1,int(np.ceil(np.max(np.abs(end-start))/.05))) + for alpha in np.arange(1,sub+1)/sub: + data.qpos[adr]=start+(end-start)*alpha;mujoco.mj_forward(ev._model,data) + contacts,penetration=contact_summary(ev._model,data);count+=1;hits+=bool(contacts);worst=max(worst,penetration) + for p in contacts:pairs.add(tuple(p)) + jump=float(np.max(np.abs(np.diff(q,axis=0)))) if len(q)>1 else 0. + residual=float(max(np.max(np.abs(up_q[:,0]+up_q[:,1]+.28403)),np.max(np.abs(up_q[:,2]-.28834)),np.max(np.abs(up_q[:,3]+.00123)))) + return {'table_collision_fraction':hits/max(count,1),'table_collision_checks':count,'table_penetration_max_mm':worst*1000, + 'table_collision_pairs':[list(x) for x in sorted(pairs)],'waist_constraint_residual_rad':residual, + 'joint_path_jump_max_rad':jump,'deployment_constraint_reject':bool(hits or residual>1e-8 or jump>.3), + 'scene_version':'v14_assumed_table','collision_sampling_max_joint_step_rad':.05, + 'collision_check_kind':'discrete interpolated mesh-hull robot/table; not certified continuous collision checking'} + +if __name__=='__main__': + import sys + print(json.dumps(build_scene(sys.argv[1]),indent=2))