Running this code does not result in the occupancy map detecting the cube we create (even though the physics is correctly applied and can be verified within the UI resources tab)
Switching to manual debugging led to the utilisation of the omap.ui which saw that when i set bounds greater than 1.0 or -1.0 for any occupancy map parameters and then save, the file crashes with an output I will share below.
This is the script
Using the correct SimulationApp launcher for the user’s Isaac Sim version
from isaacsim.simulation_app import SimulationApp
# Configuration for the application
config = {“headless”: False}
# Create an instance of the SimulationApp
simulation_app = SimulationApp(config)
import logging
from isaacsim.core.utils import extensions
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(“OccupancyMapDebug”)
# Enable required extensions
extensions.enable_extension(“omni.physx”)
extensions.enable_extension(“isaacsim.asset.gen.omap”)
extensions.enable_extension(“isaacsim.asset.gen.omap.ui”)
from isaacsim.core.api.world import World
from isaacsim.core.utils.prims import create_prim
from isaacsim.asset.gen.omap.bindings import _omap
import omni
import numpy as np
from pxr import PhysxSchema, UsdPhysics, Gf, UsdShade, Sdf
try:
from PIL import Image
PIL_AVAILABLE = True
except ImportError:
PIL_AVAILABLE = False
if _name_ == “_main_”:
\# Get the stage and create a world object
stage = omni.usd.get_context().get_stage()
world = World()
world.reset()
\# Define a physics scene and enable scene queries
scene_prim = stage.DefinePrim("/World/physicsScene", "PhysicsScene")
PhysxSchema.PhysxSceneAPI.Apply(scene_prim)
scene_prim.CreateAttribute("physxScene:enableSceneQueries", Sdf.ValueTypeNames.Bool, False).Set(True)
scene_prim.CreateAttribute("physics:gravityDirection", Sdf.ValueTypeNames.Vector3f, False).Set(Gf.Vec3f(0.0, 0.0, -1.0))
scene_prim.CreateAttribute("physics:gravityMagnitude", Sdf.ValueTypeNames.Float, False).Set(9.81)
logger.info("Defined PhysicsScene and enabled scene queries.")
CUBE_PRIM_PATH = "/World/TestCube"
PHYSICS_MATERIAL_PATH = "/World/PhysicsMaterial"
try:
\# Create the cube and apply all necessary physics APIs and attributes
cube_prim = create_prim(
CUBE_PRIM_PATH, "Cube", position=Gf.Vec3d(0.0, 0.0, 0.5), scale=Gf.Vec3d(1.0, 1.0, 1.0)
)
UsdPhysics.CollisionAPI.Apply(cube_prim)
material_prim = UsdShade.Material.Define(stage, Sdf.Path(PHYSICS_MATERIAL_PATH)).GetPrim()
PhysxSchema.PhysxMaterialAPI.Apply(material_prim)
material_prim.CreateAttribute("physx:staticFriction", Sdf.ValueTypeNames.Float, False).Set(0.5)
material_prim.CreateAttribute("physx:dynamicFriction", Sdf.ValueTypeNames.Float, False).Set(0.5)
material_prim.CreateAttribute("physx:restitution", Sdf.ValueTypeNames.Float, False).Set(0.0)
shade_material = UsdShade.Material(material_prim)
binding_api = UsdShade.MaterialBindingAPI.Apply(cube_prim)
binding_api.Bind(shade_material, materialPurpose="physics")
PhysxSchema.PhysxCollisionAPI.Apply(cube_prim)
cube_prim.CreateAttribute("physics:collisionEnabled", Sdf.ValueTypeNames.Bool, False).Set(True)
cube_prim.CreateAttribute("physxCollision:approximation", Sdf.ValueTypeNames.Token, False).Set("convexHull")
logger.info("Successfully created and configured the test cube.")
except Exception as e:
logger.error(f"Failed to spawn and configure Test Cube: {e}", exc_info=True)
simulation_app.close()
exit(1)
\# Add the ground plane
world.scene.add_default_ground_plane()
\# Start the simulation and step it to initialize the physics scene
world.play()
logger.info("Stepping simulation to initialize physics scene...")
for \_ in range(120):
simulation_app.update()
\# Generate the occupancy grid
try:
physx = omni.physx.get_physx_interface()
stage_id = omni.usd.get_context().get_stage_id()
generator = \_omap.Generator(physx, stage_id)
generator.update_settings(0.1, 0, 100, -1)
generator.set_transform((0,0,0), (-5,-5,0), (5,5,2))
logger.info("Generating occupancy map...")
generator.generate2d()
buffer = generator.get_buffer()
dims = generator.get_dimensions()
if dims and dims\[0\] > 0 and dims\[1\] > 0 and buffer:
grid = np.array(buffer, dtype=np.int8).reshape((dims\[1\], dims\[0\]))
if 0 in grid:
logger.info("SUCCESS: Obstacle was detected in the grid. ✅")
else:
logger.warning("FAILURE: No obstacles were detected. ⚠️")
if PIL_AVAILABLE:
img_array = np.zeros_like(grid, dtype=np.uint8)
img_array.fill(255) # White background for unoccupied
img_array\[grid == 0\] = 0 # Black for occupied
Image.fromarray(img_array, mode='L').save("occupancy_grid.png")
logger.info("Saved grid image to occupancy_grid.png")
else:
logger.error("Grid generation failed: Invalid dimensions or empty buffer. ❌")
except Exception as e:
logger.error(f"An error occurred during grid generation: {e}", exc_info=True)
logger.info("Setup complete. Close the Isaac Sim window to exit.")
while simulation_app.is_running():
simulation_app.update()
\# Cleanup
simulation_app.close()
This is the error:
[13.578s] Simulation App Startup Complete
[13.605s] [ext: isaacsim.asset.gen.omap-2.0.28] startup
[13.631s] [ext: isaacsim.asset.gen.omap.ui-2.2.1] startup
2025-10-01T22:53:23Z [15,524ms] [Warning] [usdrt.hydra.fabric_scene_delegate.plugin] using high frequency span with attrs is disabled
2025-10-01T22:53:25Z [17,628ms] [Warning] [carb] Client gpu.foundation.plugin has acquired [gpu::unstable::IMemoryBudgetManagerFactory v0.1] 100 times. Consider accessing this interface with carb::getCachedInterface() (Performance warning)
2025-10-01T22:53:25Z [17,646ms] [Warning] [OccupancyMapDebug] FAILURE: No obstacles were detected. ⚠️
Windows fatal exception: code 0xc0000374
Thread 0x00001f8c (most recent call first):
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\concurrent\futures\thread.py”, line 81 in _worker
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\threading.py”, line 982 in run
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\threading.py”, line 1045 in _bootstrap_inner
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\threading.py”, line 1002 in _bootstrap
Thread 0x00006f94 (most recent call first):
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\concurrent\futures\thread.py”, line 81 in _worker
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\threading.py”, line 982 in run
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\threading.py”, line 1045 in _bootstrap_inner
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\threading.py”, line 1002 in _bootstrap
Thread 0x00006340 (most recent call first):
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\concurrent\futures\thread.py”, line 81 in _worker
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\threading.py”, line 982 in run
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\threading.py”, line 1045 in _bootstrap_inner
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\threading.py”, line 1002 in _bootstrap
Thread 0x000045f0 (most recent call first):
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\concurrent\futures\thread.py”, line 81 in _worker
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\threading.py”, line 982 in run
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\threading.py”, line 1045 in _bootstrap_inner
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\threading.py”, line 1002 in _bootstrap
Thread 0x000039cc (most recent call first):
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\concurrent\futures\thread.py”, line 81 in _worker
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\threading.py”, line 982 in run
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\threading.py”, line 1045 in _bootstrap_inner
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\threading.py”, line 1002 in _bootstrap
Thread 0x00009200 (most recent call first):
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\concurrent\futures\thread.py”, line 81 in _worker
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\threading.py”, line 982 in run
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\threading.py”, line 1045 in _bootstrap_inner
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\kit\python\Lib\threading.py”, line 1002 in _bootstrap
Current thread 0x00008a2c (most recent call first):
File “c:/users/tauru/downloads/isaac-sim-standalone-5.0.0-windows-x86_64/exts/isaacsim.asset.gen.omap.ui/isaacsim/asset/gen/omap/ui/extension.py”, line 497 in _fill_image
File “c:/users/tauru/downloads/isaac-sim-standalone-5.0.0-windows-x86_64/exts/isaacsim.asset.gen.omap.ui/isaacsim/asset/gen/omap/ui/extension.py”, line 601 in _generate_image
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\exts\isaacsim.simulation_app\isaacsim\simulation_app\simulation_app.py”, line 574 in update
File “C:\Users\tauru\Downloads\isaac-sim-standalone-5.0.0-windows-x86_64\maps\test-map.py”, line 117 in
Any thoughts on why the occupancy map can’t detect the cube I created would also be appreciated. I do wonder if it is connected to the UI crashing