Download bosch800/source/extract_geometry.py from shu4dev/dishsim-assets: direct link, hf CLI and curl.
- Browser
- Download file 3.76 kB
-
https://huggingface.co/datasets/shu4dev/dishsim-assets/resolve/main/bosch800/source/extract_geometry.py
- Command line
-
hf download hf://datasets/shu4dev/dishsim-assets/bosch800/source/extract_geometry.py
-
curl -L -o extract_geometry.py https://huggingface.co/datasets/shu4dev/dishsim-assets/resolve/main/bosch800/source/extract_geometry.py
3.76 kB
| # Copyright (c) 2026, dishsim project. | |
| # | |
| # SPDX-License-Identifier: BSD-3-Clause | |
| """Kit side: dump the settled scene's geometry into the collision-world cache. | |
| Builds the locked statics scene, settles it, then writes per-rigid-body meshes (statics + | |
| the active object's body-frame OBJ) + ``scene_state.json`` to ``data/assets/<machine>/cache/<state>/<object>/``. Runs with | |
| ``use_fabric=False`` so live USD prim transforms are trustworthy (the Fabric staleness trap). | |
| Run with: | |
| code/util/run_kit.sh data/assets/bosch800/source/extract_geometry.py --headless | |
| """ | |
| """Launch Isaac Sim Simulator first.""" | |
| import argparse | |
| import os | |
| from isaaclab.app import AppLauncher | |
| PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))) # data/assets/bosch800/source/<file>.py | |
| parser = argparse.ArgumentParser(description="Dump the collision-world cache from the settled scene.") | |
| parser.add_argument("--settle_steps", type=int, default=200) | |
| parser.add_argument("--placement", type=str, default=None, | |
| help="Named base placement (see config.BASE_PLACEMENTS); default: the machine's.") | |
| parser.add_argument("--machine", type=str, default=None, | |
| help="Machine name (see config.MACHINES); default: the v1 baseline.") | |
| parser.add_argument("--object", type=str, default="mug", help="Object class (see config.OBJECTS).") | |
| parser.add_argument("--scenario", type=str, default="both_out", | |
| help="Rack-state scenario (see config.SCENARIOS).") | |
| AppLauncher.add_app_launcher_args(parser) | |
| args_cli = parser.parse_args() | |
| app_launcher = AppLauncher(args_cli) | |
| simulation_app = app_launcher.app | |
| """Rest everything follows.""" | |
| import sys | |
| import isaaclab.sim as sim_utils | |
| from isaaclab.scene import InteractiveScene | |
| from isaaclab.sim import SimulationContext | |
| sys.path.insert(0, os.path.join(PROJECT_ROOT, "code", "src")) | |
| from dishsim import config # noqa: E402 | |
| # scenario BEFORE scene/machine imports — they bind rack targets + the derived USD at import | |
| if args_cli.machine: | |
| config.apply_machine(args_cli.machine) # first: it resets scenario + base placement | |
| config.set_active_object(args_cli.object) | |
| config.apply_scenario(args_cli.scenario) | |
| if args_cli.placement: | |
| config.apply_base_placement(args_cli.placement) # after machine/scenario — they reset it | |
| import cache_dump as dgeom # noqa: E402 (this folder: dump_cache) | |
| from dishsim.media import release_sim_for_close # noqa: E402 | |
| from dishsim import scene as dscene # noqa: E402 | |
| def main() -> None: | |
| sim = SimulationContext( | |
| sim_utils.SimulationCfg(dt=config.SIM_DT, device=args_cli.device, use_fabric=False) | |
| ) | |
| scene = InteractiveScene(dscene.make_scene_cfg()) | |
| sim.reset() | |
| dscene.write_default_states(scene) | |
| dt = sim.get_physics_dt() | |
| for _ in range(args_cli.settle_steps): | |
| dscene.hold_targets(scene) | |
| scene.write_data_to_sim() | |
| sim.step() | |
| scene.update(dt) | |
| dscene.assert_frames(scene) | |
| # the settled racks must sit at the scenario targets — also catches a stale derived USD | |
| # whose baked drive targets fight the configured scenario | |
| sr = dscene.statics_report(scene) | |
| rack_err = max(sr["rack_lower_err_m"], sr["rack_upper_err_m"]) | |
| assert rack_err < 5e-3, f"racks off scenario targets by {rack_err * 1e3:.1f} mm: {sr}" | |
| manifest_path = dgeom.dump_cache(scene, sim, cache_dir=config.scenario_cache_dir()) | |
| print(f"[INFO] scenario {config.SCENARIO_NAME}: rack_lower {sr['rack_lower_m']:+.3f} m, " | |
| f"rack_upper {sr['rack_upper_m']:+.3f} m") | |
| print(f"[RESULT] PASS ({manifest_path})") | |
| if __name__ == "__main__": | |
| main() | |
| release_sim_for_close() | |
| simulation_app.close() | |