Files

64 lines
1.9 KiB
Python

#!/usr/bin/env python3
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Interactive 3D Viewer for Phase 2 Warehouse Scene.
Launches Isaac Sim with GUI enabled so the user can orbit, pan, zoom,
and interactively inspect the storage racks, shelves, and randomized objects.
"""
import sys
from pathlib import Path
project_root = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(project_root))
from isaacsim import SimulationApp
# Launch with GUI enabled for interactive 3D viewport viewing
print("Launching interactive Isaac Sim GUI viewer...")
simulation_app = SimulationApp({"headless": False})
import omni.usd
import omni.kit.app
from isaacsim.core.utils.viewports import set_camera_view
from src.core.config import ConfigManager
from src.core.simulation_manager import CoreSimulationManager
from src.environment.scene_builder import WarehouseSceneBuilder
def view_scene():
cfg = ConfigManager()
sim_mgr = CoreSimulationManager(cfg)
sim_mgr.setup_stage()
stage = omni.usd.get_context().get_stage()
builder = WarehouseSceneBuilder(stage, cfg)
builder.build_warehouse_environment()
# Position viewport camera for optimal viewing of both racks and shelves
set_camera_view(
eye=[1.9, 0.0, 1.25],
target=[0.46, 0.0, 0.55],
camera_prim_path="/OmniverseKit_Persp"
)
sim_mgr.play()
print("\n" + "=" * 70)
print(" INTERACTIVE 3D VIEWER RUNNING")
print(" - Left click + drag: Orbit camera")
print(" - Right click + drag: Zoom in/out")
print(" - Middle click + drag: Pan camera")
print(" - Close the window or press Ctrl+C to exit.")
print("=" * 70 + "\n")
app = omni.kit.app.get_app()
while simulation_app.is_running():
app.update()
sim_mgr.stop()
simulation_app.close()
if __name__ == "__main__":
view_scene()