What must change before a generated room becomes a simulation?
- InputChoose a coordinate and scale convention
WorldGen RGB + distance → 80k-vertex textured meshFit a floor plane; assume a 1.5 m camera height. This establishes a simulation scale, not measured truth.
- ProcessCheck what can collide
static generated mesh / 5×4 m floor / added crateCompare real cube drops and raycasts. The robot run uses explicit proxy collisions.
- OutputClose the control loop through physics
pose + waypoint → v, ω → wheel drives → PhysX poseA hand-authored route guides the AMR. Native GUI recording shows live joint and contact simulation.
The laboratory in the previous lesson is a generated RGB-distance surface. This lesson imports that surface into Isaac Sim 6.2, establishes an explicit scale, checks collisions and drives an articulated mobile robot through a small test area. The room supplies appearance; authored collision geometry supplies predictable contacts.
1. Establish coordinates and an assumed scale
WorldGen's maximum distance of 20 is a normalization, not 20 measured meters. prepare.py selects a visible near-camera floor patch, repeatedly fits a plane and rejects points more than 0.025 source units away. The fitted upward normal is approximately [0.00942, -0.99985, -0.01474] in WorldGen coordinates. A rotation aligns it with Isaac Sim's +Z axis, and a translation places the plane at Z=0.
We then assume the source camera is 1.5 m above the floor. Its fitted distance from the plane is 0.789658 source units, giving 1.899556 meters per source unit. Every room vertex receives that same transform. The stage uses metersPerUnit=1 and Z up. A 1 m bar and the 0.55 m robot chassis provide references in this chosen simulation scale. They do not establish the real size of the invented room.
source points [x, y, z]
→ subtract the fitted floor origin
→ rotate the fitted up direction to +Z
→ multiply by 1.899556
→ Isaac Sim points in the chosen meter scale
The selected floor points have 16.0 mm RMS residual after this transformation. This is agreement with the fitted plane, not ground-truth scene accuracy. The full transformed room spans roughly 44 m across X; remote surfaces remain distorted and uncalibrated. The robot exercise only validates an authored 5 × 4 m test floor near the original viewpoint.
The prepared arrays are points: float32[80000,3], indices: int32[158802,3] and uv: float32[80000,2]. Points are positions in the chosen meter scale; each index row selects the three corners of one triangle; UV coordinates locate its colors in the panorama.
2. Separate appearance from contact geometry
The imported render mesh has 80,000 vertices and 158,802 triangles, sampled from the generated distance map at stride 4. A UV texture preserves the panorama's appearance. It is a genuine 3D mesh, rather than a flat background image. A small gap remains at the panorama seam. Gaussian splats are not the physical representation used in this lesson.
We compare three actual physics setups:
| Setup | What supports the dropped cubes? | Meaning |
|---|---|---|
| Visual surface only | Nothing | A rendered floor does not imply a collider |
| Static generated mesh collider | The nonflat inferred surface | It can collide, but its shape is still estimated |
| Authored floor proxy | A flat cuboid with top Z=0 | A controlled surface for the local robot experiment |
The imported mesh can use a static triangle-mesh collider for the comparison. Do not make the entire room one dynamic convex hull: a convex hull does not preserve a hollow interior. Our robot runs disable collisions on the visual shell and use an explicit floor plus an added orange test crate, 0.45 × 0.80 × 0.60 m. The crate is authored for this exercise; it was not detected automatically in the generated image. Furniture elsewhere has no validated collision coverage. NVIDIA collision fundamentals

3. Turn wheel commands into physical motion
The robot is an original, simple differential-drive AMR assembled from USD rigid bodies and revolute joints. It is not Jetbot or a GR00T policy. The chassis mass is 8 kg, each driven wheel is 0.3 kg, wheel radius is 0.11 m and axle width is 0.52 m. A low-friction rear support keeps it balanced.
current chassis pose + next waypoint
→ heading error
→ forward speed v [m/s] and yaw rate ω [rad/s]
→ left/right wheel angular speeds [rad/s]
→ USD angular drives [degrees/s]
→ PhysX joint, friction and collision response
→ measured chassis pose for the next command
At v=0.32 m/s and ω=0, both wheels target about 2.91 rad/s, or 166.7 degrees/s. Turning uses a difference between the wheel speeds. The controller reads the simulator's pose and follows hand-authored waypoints; it does not see camera pixels, learn a policy or discover a path itself. The simulator resolves contact, rather than code directly moving the chassis to the desired coordinates. NVIDIA differential-drive explanation
The dashed line is the blocked run; the green path is the contact/recovery run. These are measured chassis centers. A stop at X=-0.50 m places the chassis front, 0.275 m ahead, at the crate face X=-0.225 m.
First time? Get the lab files
Open a terminal on the Isaac Sim machine for GPU labs, or on your own computer for CPU-only steps. Press Enter after each line. You can copy a multi-line command block as a whole.
cd "$HOME"
git clone https://github.com/james-joobs/awesome-nvidia-physical-ai.git
cd awesome-nvidia-physical-ai
pwd
This example clones into your home folder. If you already cloned the repo, skip git clone and enter your project folder. In each new terminal, check that pwd ends in awesome-nvidia-physical-ai so commands can find the labs/ files.
Run the import, checks and robot example
1. Check the machine and copy the prepared room
Use an NVIDIA Linux machine with Isaac Sim 6.2 container support. Start with the NVIDIA Linux onboarding guide if nvidia-smi or Docker GPU support is unfamiliar. These commands run from this repository's root:
nvidia-smi
mkdir -p runs/worldgen-isaac
cp -R labs/worldgen-isaac/assets runs/worldgen-isaac/assets

Download the prepared USD scene (ZIP). Open combined/scene.usdc in Isaac Sim 6.2, keeping assets/ beside it.
The bundled room is the reduced output of our own WorldGen run. You do not need FLUX access or model weights to run this prepared scene. To rebuild it from your own generation, use the separate WorldGen Python environment:
runs/worldgen-runtime/.venv/bin/python labs/worldgen-isaac/prepare.py \
--source runs/worldgen/robot-lab --output runs/worldgen-isaac/assets \
--camera-height 1.5 --stride 4
The --camera-height flag is your scale assumption. Change it deliberately and regenerate the mesh before judging dimensions. The camera matrix from the image-expansion example is not used to recover metric scale here.
2. Inspect the floor before driving
After accepting the NVIDIA Omniverse agreement, set ACCEPT_EULA=Y in your terminal. This declares your own acceptance; the script requires it explicitly. The same shell also selects where output will be written:
export ACCEPT_EULA=Y
export WORLDGEN_DATA_ROOT="$PWD/runs/worldgen-isaac"
bash labs/worldgen-isaac/run.sh probes --headless
Four 10 cm cubes should rest with centers near Z=0.05 m. Open runs/worldgen-isaac/probes/result.json. It contains actual body poses, stage units and downward raycasts. Try the other two setups in distinct output folders:
bash labs/worldgen-isaac/run.sh probes --headless --no-floor \
--output /work/no-floor
bash labs/worldgen-isaac/run.sh probes --headless --no-floor --raw-collider \
--output /work/raw-mesh
/work is the container's mapping of WORLDGEN_DATA_ROOT. It is not a path you must create at the Linux filesystem root. Without a collider the cubes fall through the visible room. With the static generated mesh their center heights differ from the flat-proxy result, and they slightly tilt. The independent floor proxy gives the controlled reference.
3. Compare driving straight with driving around the crate
bash labs/worldgen-isaac/run.sh combined
# Separate comparison runs:
bash labs/worldgen-isaac/run.sh blocked
bash labs/worldgen-isaac/run.sh detour
The main recording uses combined: 4 s of forward commands, 1.6 s reversing, then the waypoint route. These phase changes are scheduled, not triggered by a learned detector. PhysX produces the actual stall, contact and recovery. The complete run reached the goal after about 24.3 simulation seconds.
Each command opens the real Isaac Sim GUI, runs one scenario and closes after saving the result. In blocked, both wheels keep receiving a forward command, but contact stops the chassis near X=-0.50 m. In detour, a simple pose-feedback controller follows [-0.85,0] → [-0.85,-0.95] → [0.85,-0.95] → [1.3,0]. The final target tolerance is 0.12 m. These are two different control choices in the same geometry, not an AI-policy comparison.
To view the authored collision geometry alone, add --collision-view. This hides the generated render mesh and reveals the physical floor and crate. Each output includes scene.usdc, the initial scene setup, not a prerecorded trajectory. In a separately opened Isaac Sim GUI, use File → Open to inspect this file. Keep the sibling assets/ directory so its texture resolves. Pressing Play on the saved USD simulates the configured bodies; the waypoint controller runs only through run.sh.
4. Record the native GUI
On an X11 desktop, with ffmpeg built with x11grab and xwininfo installed:
mkdir -p runs/worldgen-recording
cp -R labs/worldgen-isaac/assets runs/worldgen-recording/assets
python3 labs/worldgen-isaac/record_gui.py \
--work "$PWD/runs/worldgen-recording" --scenario combined --ffmpeg /path/to/ffmpeg
Use a fresh output directory for a new recording. The helper waits until the simulator is ready, records its native window, then starts the control loop. It leaves native-gui.mp4, window.txt, logs and the physical trajectory together. Published viewport clips are crops of these real GUI pixels. Check the recording's wall duration separately from simulation time; rendering does not always keep up with the physics step rate.
The 6.2 example uses SimulationManager.step() and RenderingManager.render() to separate physical steps from drawing. Our GPU GUI recipe uses the documented per-frame rendering compatibility flag --/rtx/hydra/supportMultiTickRate=false; this lab does not validate multi-rate camera or LiDAR capture. Initial shader/viewport preparation can take one to two minutes. Recording starts only after a real viewport frame is saved. NVIDIA multi-tick settings
Room appearance uses the panorama through native OmniPBR, with an emission display setting to make the baked colors visible. This is not a recovered, physically calibrated illumination model. The recorded control pose is [position_xyz, quaternion_xyzw]; wheel speed commands act at the axle midpoint, 0.10 m in front of the chassis frame.
Check the result without a GPU
python3 labs/worldgen-isaac/check.py
This verifies the bundled scale metadata, cube-drop results, raycasts, physical obstacle contacts, successful waypoint endpoint, source hashes and published video hashes. The recordings below link back to code and full evidence. To inspect a new run:
python3 labs/worldgen-isaac/check.py --run runs/worldgen-isaac/detour
A successful import is not a validated digital twin. This lesson demonstrates a generated visual environment plus a checked local physics setup. Scale is assumed, the surface is estimated, collisions are authored only for the test area, and the robot uses a simple state-feedback controller. WorldGen generation lab · Isaac Sim concepts · Media provenance.
Example run and recording
A forward command does not pass through a collider
The same physical robot receives equal wheel-speed targets and stops against the crate. Contact events and measured poses are saved.
A closer view of waypoint control
An independent run follows the detour directly. The camera is closer and the generated-room emission is lower than in the main overview. No crate contact was reported.
Check contact before you drive
Four 10 cm cubes drop onto the explicit floor. Compare their saved heights with the no-collider and generated-mesh tests in the lab.
Source code
prepare.py
View files on GitHub"""Calibrate WorldGen's arbitrary scale and prepare a small textured USD mesh input.
CPU-only. The anchor is an explicit assumption, not recovered metric geometry.
"""
import argparse,hashlib,json
from pathlib import Path
import numpy as np
from PIL import Image
def prepare(source, output, camera_height=1.5, stride=4):
output.mkdir(parents=True,exist_ok=True)
depth=np.load(source/'distance.npy');h,w=depth.shape
rgb=Image.open(source/'panorama.png').convert('RGB')
assert rgb.size==(w,h) and np.isfinite(depth).all() and depth.min()>0
phi,theta=np.meshgrid((np.arange(w)+.5)/w*2*np.pi-np.pi,(np.arange(h)+.5)/h*np.pi-np.pi/2)
rays=np.stack([np.cos(theta)*np.sin(phi),np.sin(theta),np.cos(theta)*np.cos(phi)],-1)
points=rays*depth[...,None]
candidate=points[(theta>.8)&(theta<1.35)&(depth<3)][::8]
# Near-camera lower hemisphere supplies a repeatable, visible floor patch.
selected=np.ones(len(candidate),dtype=bool)
for _ in range(5):
q=candidate[selected]
A=np.column_stack([q[:,0],q[:,2],np.ones(len(q))])
a,b,c=np.linalg.lstsq(A,q[:,1],rcond=None)[0]
residual=candidate[:,1]-(a*candidate[:,0]+b*candidate[:,2]+c)
selected=np.abs(residual)<.025
up=np.array([a,-1.,b]);up/=np.linalg.norm(up)
d=c/np.linalg.norm([a,-1,b])
scale=camera_height/d
right=np.array([1.,0,0]);right-=up*right.dot(up);right/=np.linalg.norm(right)
forward=np.cross(up,right)
R=np.stack([right,forward,up])
origin=-d*up
world=(points-origin)@R.T*scale
ys=np.arange(0,h,stride);xs=np.arange(0,w,stride)
small=world[np.ix_(ys,xs)]
sy,sx=small.shape[:2]
# Preserve the panorama seam. Each UV is at the center of its source pixel.
yy,xx=np.meshgrid(ys,xs,indexing='ij')
uv=np.stack([(xx+.5)/w,1-(yy+.5)/h],-1)
ids=np.arange(sy*sx).reshape(sy,sx)
tl=ids[:-1,:-1];tr=ids[:-1,1:];bl=ids[1:,:-1];br=ids[1:,1:]
faces=np.concatenate([np.stack([tl,bl,tr],-1).reshape(-1,3),np.stack([tr,bl,br],-1).reshape(-1,3)])
# The unwrapped seam remains an explicit small gap instead of an incorrect UV bridge.
np.savez_compressed(output/'room-mesh.npz',points=small.reshape(-1,3).astype('f4'),indices=faces.astype('i4'),uv=uv.reshape(-1,2).astype('f4'))
rgb.save(output/'panorama.jpg',quality=94)
residual_m=((candidate-origin)@up*scale)[selected]
manifest={'source':'WorldGen robot-lab, seed 42; generated 2026-11-20',
'source_sha256':{n:hashlib.sha256((source/n).read_bytes()).hexdigest() for n in ['distance.npy','panorama.png']},
'metric_scale':'assumed camera-to-floor height; not a measured scale recovery',
'assumed_camera_height_m':camera_height,'meters_per_worldgen_unit':float(scale),
'source_floor_plane':{'normal':up.tolist(),'offset':float(d),'inliers':int(selected.sum()),'candidates':len(candidate),'threshold_source_units':.025},
'source_to_isaac':{'rotation_rows':R.tolist(),'source_origin':origin.tolist(),'formula':'p_isaac = scale * R @ (p_source - source_origin); Z up, metersPerUnit=1'},
'floor_inlier_rms_m':float(np.sqrt(np.mean(residual_m**2))),
'full_bounds_m':[world.reshape(-1,3).min(0).tolist(),world.reshape(-1,3).max(0).tolist()],
'render_mesh':{'stride':stride,'vertices':len(small.reshape(-1,3)),'triangles':len(faces),'collision_enabled':False,'small_uv_seam_gap':True},
'physics_proxy':{'floor_center':[0,0,-.05],'floor_size':[5,4,.1],
'obstacle_center':[0,0,.3],'obstacle_size':[.45,.8,.6],
'scope':'authored test floor and added crate only; not automatically inferred furniture collisions'},
'robot':{'type':'authored differential-drive AMR','body_size':[.55,.40,.18],'wheel_radius_m':.11,'wheel_base_m':.52,'mass_chassis_kg':8},
'route':{'start':[-1.3,0,.24],'goal':[1.3,0],'detour_waypoints':[[-.85,0],[-.85,-.95],[.85,-.95],[1.3,0]]}}
(output/'calibration.json').write_text(json.dumps(manifest,indent=2)+'\n')
print(json.dumps({'scale':scale,'floor_rms_m':manifest['floor_inlier_rms_m'],'mesh':manifest['render_mesh']}))
if __name__=='__main__':
p=argparse.ArgumentParser();p.add_argument('--source',type=Path,required=True);p.add_argument('--output',type=Path,required=True)
p.add_argument('--camera-height',type=float,default=1.5);p.add_argument('--stride',type=int,default=4)
a=p.parse_args();prepare(a.source,a.output,a.camera_height,a.stride)
run.sh
View files on GitHub#!/usr/bin/env bash
# Start an isolated Isaac Sim 6.2 container. ACCEPT_EULA must be supplied by the user.
set -euo pipefail
: "${ACCEPT_EULA:?Set ACCEPT_EULA=Y only after accepting the NVIDIA Omniverse agreement.}"
[[ "$ACCEPT_EULA" == Y ]] || { echo "ACCEPT_EULA must be Y after your own acceptance." >&2; exit 1; }
worldgen_lab_root="$(cd "$(dirname "$0")" && pwd)"
worldgen_data_root="${WORLDGEN_DATA_ROOT:-$worldgen_lab_root}"
mkdir -p "$worldgen_data_root/cache"
worldgen_scenario="${1:-detour}"
shift || true
worldgen_xauth="${XAUTHORITY:-/run/user/$(id -u)/gdm/Xauthority}"
worldgen_display="${DISPLAY:-:1}"
worldgen_desktop_args=()
worldgen_headless=false
for worldgen_arg in "$@"; do
[[ "$worldgen_arg" == --headless ]] && worldgen_headless=true
done
if ! "$worldgen_headless"; then
[[ -f "$worldgen_xauth" ]] || { echo "Set XAUTHORITY to your X11 desktop authority file for GUI use." >&2; exit 1; }
worldgen_desktop_args=(-e "DISPLAY=$worldgen_display" -e XAUTHORITY=/tmp/isaac-xauthority
-v "$worldgen_xauth:/tmp/isaac-xauthority:ro" -v /tmp/.X11-unix:/tmp/.X11-unix:rw)
fi
exec docker run --rm --user 0:0 --gpus all --shm-size=2g \
-e ACCEPT_EULA="$ACCEPT_EULA" -e PRIVACY_CONSENT=N -e NVIDIA_DRIVER_CAPABILITIES=all \
"${worldgen_desktop_args[@]}" \
-v "$worldgen_data_root/cache:/root/.cache:rw" \
-v "$worldgen_lab_root:/lab:ro" -v "$worldgen_data_root:/work:rw" \
--entrypoint /isaac-sim/python.sh nvcr.io/nvidia/isaac-sim:6.2.0 \
/lab/run.py --assets /work/assets --output "/work/$worldgen_scenario" --scenario "$worldgen_scenario" \
--allow-root --/omni/client/omniverse/use_omnihub=false --/renderer/multiGpu/enabled=false --/rtx/hydra/supportMultiTickRate=false "$@"
run.py
View files on GitHub"""Import the calibrated WorldGen visual mesh and simulate a real wheeled AMR.
Run inside Isaac Sim 6.2, outside the WorldGen Python environment.
The visual shell is not a collider. The test floor and crate are explicit proxies.
"""
import argparse,json,math,os,time,traceback
from pathlib import Path
from importlib.metadata import version, PackageNotFoundError
p=argparse.ArgumentParser()
p.add_argument('--assets',type=Path,required=True);p.add_argument('--output',type=Path,required=True)
p.add_argument('--scenario',choices=['probes','blocked','detour','combined'],default='detour')
p.add_argument('--room-emission',type=float,default=400.);p.add_argument('--headless',action='store_true');p.add_argument('--collision-view',action='store_true')
p.add_argument('--raw-collider',action='store_true');p.add_argument('--no-floor',action='store_true');p.add_argument('--record-handshake',action='store_true')
a,kit_args=p.parse_known_args();a.assets=a.assets.resolve();a.output=a.output.resolve();a.output.mkdir(parents=True,exist_ok=True)
(a.output/'FAILED').unlink(missing_ok=True)
from isaacsim import SimulationApp
app=SimulationApp({'headless':a.headless,'width':1280,'height':720,'window_width':1440,'window_height':900,
'renderer':'RaytracedLighting','anti_aliasing':2,'fast_shutdown':True})
failed=True
try:
import numpy as np
import carb,omni.usd,omni.physx
from pxr import Gf,Sdf,UsdGeom,UsdShade,UsdLux,UsdPhysics,PhysxSchema,PhysicsSchemaTools
from isaacsim.core.simulation_manager import SimulationManager
import isaacsim.core.experimental.utils.stage as stage_utils
from isaacsim.core.rendering_manager import RenderingManager, ViewportManager
from omni.kit.viewport.utility import get_active_viewport
settings=carb.settings.get_settings()
settings.set_bool('/physics/updateToUsd',True)
settings.set_bool('/rtx/hydra/readTransformsFromFabricInRenderDelegate',False)
settings.set_bool('/persistent/app/viewport/Viewport/Viewport0/scene/cameras/visible',False)
stage_utils.create_new_stage()
class SimulationLoop:
@property
def current_time(self):return SimulationManager.get_simulation_time()
def initialize(self):
SimulationManager.setup_simulation(dt=1/60)
SimulationManager.initialize_physics()
RenderingManager.set_dt(1/60)
def step(self,render=True):
SimulationManager.step()
if render:RenderingManager.render()
simulation=SimulationLoop()
stage=omni.usd.get_context().get_stage();UsdGeom.SetStageUpAxis(stage,'Z');UsdGeom.SetStageMetersPerUnit(stage,1.)
root=UsdGeom.Xform.Define(stage,'/World');stage.SetDefaultPrim(root.GetPrim())
manifest=json.loads((a.assets/'calibration.json').read_text())
config=manifest['physics_proxy'];robot_cfg=manifest['robot']
def xform(path,pos):
obj=UsdGeom.Xform.Define(stage,path);obj.AddTranslateOp().Set(Gf.Vec3d(*pos));return obj
def material(name,rgb,emission=0):
mat=UsdShade.Material.Define(stage,'/World/Looks/'+name);shader=UsdShade.Shader.Define(stage,mat.GetPath().AppendChild('Surface'))
shader.CreateIdAttr('UsdPreviewSurface');shader.CreateInput('diffuseColor',Sdf.ValueTypeNames.Color3f).Set(Gf.Vec3f(*rgb))
shader.CreateInput('roughness',Sdf.ValueTypeNames.Float).Set(.65)
shader.CreateInput('emissiveColor',Sdf.ValueTypeNames.Color3f).Set(Gf.Vec3f(*(np.array(rgb)*emission)))
mat.CreateSurfaceOutput().ConnectToSource(shader.ConnectableAPI(),'surface');return mat
def bind(obj,mat):UsdShade.MaterialBindingAPI.Apply(obj.GetPrim()).Bind(mat)
green=material('RobotGreen',(.30,.65,.025),.15);dark=material('Rubber',(.045,.05,.055),.05)
steel=material('Steel',(.35,.39,.42));orange=material('TestCrate',(.96,.34,.025),.1);gray=material('ProxyFloor',(.33,.40,.42),.1)
blue=material('Probe',(.03,.35,.95),.2);white=material('Ruler',(.94,.94,.85),.3)
def physics_material(name,friction):
mat=UsdShade.Material.Define(stage,'/World/Looks/'+name);api=UsdPhysics.MaterialAPI.Apply(mat.GetPrim())
api.CreateStaticFrictionAttr(friction);api.CreateDynamicFrictionAttr(friction);api.CreateRestitutionAttr(0.)
return mat
traction=physics_material('Traction',.9);caster_mat=physics_material('Caster',.015)
def box(path,pos,size,mat,collision=False):
o=UsdGeom.Cube.Define(stage,path);o.CreateSizeAttr(1.);o.AddTranslateOp().Set(Gf.Vec3d(*pos));o.AddScaleOp().Set(Gf.Vec3d(*size));bind(o,mat)
if collision:UsdPhysics.CollisionAPI.Apply(o.GetPrim())
return o
def rigid(obj,mass):
UsdPhysics.RigidBodyAPI.Apply(obj.GetPrim());UsdPhysics.MassAPI.Apply(obj.GetPrim()).CreateMassAttr(mass)
# The render mesh is a decimation of the generated RGB-distance shell.
mesh_data=np.load(a.assets/'room-mesh.npz');mesh=UsdGeom.Mesh.Define(stage,'/World/GeneratedRoom')
mesh.CreatePointsAttr(mesh_data['points']);mesh.CreateFaceVertexCountsAttr([3]*len(mesh_data['indices']));mesh.CreateFaceVertexIndicesAttr(mesh_data['indices'].reshape(-1))
mesh.CreateSubdivisionSchemeAttr('none');mesh.CreateDoubleSidedAttr(True)
UsdGeom.PrimvarsAPI(mesh).CreatePrimvar('st',Sdf.ValueTypeNames.TexCoord2fArray,UsdGeom.Tokens.vertex).Set(mesh_data['uv'])
mesh.CreateExtentAttr([Gf.Vec3f(*mesh_data['points'].min(0).tolist()),Gf.Vec3f(*mesh_data['points'].max(0).tolist())])
# Native OmniPBR avoids the PreviewSurface texture-graph translation on RTX.
room_mat=UsdShade.Material.Define(stage,'/World/Looks/Room')
room_shader=UsdShade.Shader.Define(stage,'/World/Looks/Room/Shader')
room_shader.CreateIdAttr('OmniPBR')
room_shader.GetImplementationSourceAttr().Set(UsdShade.Tokens.sourceAsset)
room_shader.SetSourceAsset(Sdf.AssetPath('OmniPBR.mdl'),'mdl')
room_shader.SetSourceAssetSubIdentifier('OmniPBR','mdl')
out=room_shader.CreateOutput('out',Sdf.ValueTypeNames.Token)
room_mat.CreateSurfaceOutput('mdl').ConnectToSource(out)
for name in ['diffuse_texture','emissive_color_texture']:
room_shader.CreateInput(name,Sdf.ValueTypeNames.Asset).Set(Sdf.AssetPath(str(a.assets/'panorama.jpg')))
room_shader.CreateInput('project_uvw',Sdf.ValueTypeNames.Bool).Set(False)
room_shader.CreateInput('texture_scale',Sdf.ValueTypeNames.Float2).Set(Gf.Vec2f(1,1))
room_shader.CreateInput('diffuse_color_constant',Sdf.ValueTypeNames.Color3f).Set(Gf.Vec3f(1))
room_shader.CreateInput('reflection_roughness_constant',Sdf.ValueTypeNames.Float).Set(1.)
room_shader.CreateInput('enable_emission',Sdf.ValueTypeNames.Bool).Set(True)
room_shader.CreateInput('emissive_color',Sdf.ValueTypeNames.Color3f).Set(Gf.Vec3f(1))
room_shader.CreateInput('emissive_intensity',Sdf.ValueTypeNames.Float).Set(a.room_emission)
bind(mesh,room_mat)
if a.raw_collider:
UsdPhysics.CollisionAPI.Apply(mesh.GetPrim())
UsdPhysics.MeshCollisionAPI.Apply(mesh.GetPrim()).CreateApproximationAttr('none')
if a.collision_view:mesh.CreateVisibilityAttr('invisible')
if not a.no_floor:
floor=box('/World/ProxyFloor',config['floor_center'],config['floor_size'],gray,True)
UsdShade.MaterialBindingAPI.Apply(floor.GetPrim()).Bind(traction,materialPurpose='physics')
if not a.collision_view:floor.CreateVisibilityAttr('invisible')
crate=box('/World/TestCrate',config['obstacle_center'],config['obstacle_size'],orange,True)
# One metre, in the chosen simulation scale, rather than a claim about the generated simulation.
box('/World/OneMetreBar',(0,.95,.06),(1,.015,.01),white)
for x in np.linspace(-.5,.5,11):box(f'/World/Tick{int(round((x+.5)*10))}',(float(x),.95,.065),(.01,.06 if abs(x)>.49 else .035,.01),white)
paths=[];drives=[]
if a.scenario=='probes':
for i,(x,y) in enumerate([(-1,-.7),(-1,.7),(1,-.7),(1,.7)]):
obj=xform(f'/World/Probe{i}',(x,y,.75));rigid(obj,.1)
if not a.headless:PhysxSchema.PhysxRigidBodyAPI.Apply(obj.GetPrim()).CreateDisableGravityAttr(True)
box(str(obj.GetPath())+'/Geometry',(0,0,0),(.1,.1,.1),blue,True);paths.append(str(obj.GetPath()))
else:
robot=xform('/World/Robot',(0,0,0));UsdPhysics.ArticulationRootAPI.Apply(robot.GetPrim())
PhysxSchema.PhysxArticulationAPI.Apply(robot.GetPrim()).CreateEnabledSelfCollisionsAttr(False)
start=np.array(manifest['route']['start']);chassis=xform('/World/Robot/Chassis',start);rigid(chassis,8.)
PhysxSchema.PhysxContactReportAPI.Apply(chassis.GetPrim()).CreateThresholdAttr(0)
box('/World/Robot/Chassis/Body',(0,0,0),robot_cfg['body_size'],green,True)
box('/World/Robot/Chassis/Top',(0,0,.13),(.38,.30,.08),steel)
box('/World/Robot/Chassis/Front',(.28,0,.035),(.012,.22,.04),white)
caster=UsdGeom.Sphere.Define(stage,'/World/Robot/Chassis/Caster');caster.CreateRadiusAttr(.05);caster.AddTranslateOp().Set(Gf.Vec3d(-.21,0,-.18));bind(caster,dark)
UsdPhysics.CollisionAPI.Apply(caster.GetPrim());UsdShade.MaterialBindingAPI.Apply(caster.GetPrim()).Bind(caster_mat,materialPurpose='physics')
for i,y in enumerate([.26,-.26]):
path=f'/World/Robot/Wheel{i}';local=np.array([.10,y,-.12]);wheel=xform(path,start+local);rigid(wheel,.3)
cylinder=UsdGeom.Cylinder.Define(stage,path+'/Tyre');cylinder.CreateAxisAttr('Y');cylinder.CreateRadiusAttr(.11);cylinder.CreateHeightAttr(.06);bind(cylinder,dark)
UsdPhysics.CollisionAPI.Apply(cylinder.GetPrim());UsdShade.MaterialBindingAPI.Apply(cylinder.GetPrim()).Bind(traction,materialPurpose='physics')
for j in range(3):
spoke=box(path+f'/Spoke{j}',(0,(-.031 if y<0 else .031),0),(.16,.006,.015),white)
spoke.AddRotateYOp().Set(j*60.)
joint=UsdPhysics.RevoluteJoint.Define(stage,f'/World/Robot/Joint{i}');joint.CreateAxisAttr('Y')
joint.CreateBody0Rel().SetTargets([chassis.GetPath()]);joint.CreateBody1Rel().SetTargets([wheel.GetPath()])
joint.CreateLocalPos0Attr(Gf.Vec3f(*local));joint.CreateLocalPos1Attr(Gf.Vec3f(0))
drive=UsdPhysics.DriveAPI.Apply(joint.GetPrim(),'angular');drive.CreateTypeAttr('force');drive.CreateStiffnessAttr(0);drive.CreateDampingAttr(20);drive.CreateMaxForceAttr(6);drive.CreateTargetVelocityAttr(0)
drives.append(drive)
paths=['/World/Robot/Chassis']
# Save the source scene before stepping. The exported state can be inspected in the GUI.
def aim(camera,eye,target):
matrix=Gf.Matrix4d(1).SetLookAt(Gf.Vec3d(*eye),Gf.Vec3d(*target),Gf.Vec3d(0,0,1)).GetInverse()
UsdGeom.Xformable(camera).AddTransformOp().Set(matrix)
camera=UsdGeom.Camera.Define(stage,'/World/FilmCamera');camera.GetPrim().ApplyAPI('OmniSensorAPI');aim(camera,(0,-1.8,1.35),(0,.6,.45));camera.CreateFocalLengthAttr(11);camera.CreateHorizontalApertureAttr(36);camera.CreateClippingRangeAttr(Gf.Vec2f(.03,120))
dome=UsdLux.DomeLight.Define(stage,'/World/Dome');dome.CreateIntensityAttr(450)
key=UsdLux.SphereLight.Define(stage,'/World/Light');key.AddTranslateOp().Set(Gf.Vec3d(-.3,-.5,2.1));key.CreateIntensityAttr(1800);key.CreateRadiusAttr(.7)
stage.Export(str(a.output/'scene.usdc'))
portable=Sdf.Layer.FindOrOpen(str(a.output/'scene.usdc'))
for name in ['diffuse_texture','emissive_color_texture']:
portable.GetAttributeAtPath('/World/Looks/Room/Shader.inputs:'+name).default=Sdf.AssetPath(os.path.relpath(a.assets/'panorama.jpg',a.output))
portable.Save()
simulation.initialize()
if not a.headless:
viewport=get_active_viewport();ViewportManager.set_camera(camera)
import asyncio
from omni.kit.viewport.utility import capture_viewport_to_file
from PIL import Image
for _ in range(8):
simulation.step()
capture=capture_viewport_to_file(viewport,str(a.output/'initial-rgb.png'))
async def wait_for_frame():
return await asyncio.wait_for(capture.wait_for_result(),timeout=120)
app.run_coroutine(wait_for_frame())
image_deadline=time.monotonic()+10
while True:
try:
with Image.open(a.output/'initial-rgb.png') as frame:
pixels=np.array(frame)
break
except (FileNotFoundError,OSError):
if time.monotonic()>image_deadline:raise
RenderingManager.render();time.sleep(.02)
(a.output/'initial-rgb.png').chmod(0o644)
assert pixels.ndim==3 and pixels[:,:,:3].mean()>5,'Native viewport remained black'
print('RENDER_CHECK',pixels.shape,float(pixels[:,:,:3].mean()),flush=True)
if a.scenario=='probes':
for _ in range(40):RenderingManager.render()
else:
for _ in range(40):simulation.step(render=True)
inspector=omni.physx.get_physx_interface()
def pose(path):
v=inspector.get_rigidbody_transformation(path);assert v['ret_val'],path
return list(v['position']),list(v['rotation'])
raycasts={}
for name,xy in [('floor_left',[-1,-1]),('floor_right',[1,-1]),('crate',[0,0])]:
hit=omni.physx.get_physx_scene_query_interface().raycast_closest((xy[0],xy[1],2.),(0.,0.,-1.),5.)
raycasts[name]={'hit':bool(hit['hit']),'collider':str(hit.get('collision','')),'position':list(hit.get('position',[]))}
contacts=[]
def on_contact(headers,data):
for header in headers:
actor0=str(PhysicsSchemaTools.intToSdfPath(header.actor0));actor1=str(PhysicsSchemaTools.intToSdfPath(header.actor1))
if 'TestCrate' in actor0+actor1 and 'Chassis' in actor0+actor1:
contacts.append({'actor0':actor0,'actor1':actor1,'type':int(header.type),'time':simulation.current_time})
subscription=omni.physx.get_physx_simulation_interface().subscribe_contact_report_events(on_contact)
if a.record_handshake:
(a.output/'ready.json').write_text(json.dumps({'camera':str(camera.GetPath()),'application':'Isaac Sim 6.2 native window'}))
deadline=time.monotonic()+60
while not (a.output/'record-go').exists():
if time.monotonic()>deadline:raise TimeoutError('Native recorder did not start')
RenderingManager.render()
if a.scenario!='probes':
for _ in range(45):simulation.step(render=True)
print('NATIVE_GUI_RECORDING_STARTED',flush=True)
if a.scenario=='probes' and not a.headless:
for path in paths:PhysxSchema.PhysxRigidBodyAPI.Get(stage,path).GetDisableGravityAttr().Set(False)
samples=[];waypoints=manifest['route']['detour_waypoints'];waypoint=0
steps={'probes':180,'blocked':600,'detour':1800,'combined':2400}[a.scenario]
start_wall=time.monotonic();start_sim=simulation.current_time;reached=False
for step in range(steps):
v=omega=0.
if drives:
position,rotation=pose(paths[0]);x,y,z=position;qx,qy,qz,qw=rotation
yaw=math.atan2(2*(qw*qz+qx*qy),1-2*(qy*qy+qz*qz))
elapsed=simulation.current_time-start_sim
if a.scenario=='blocked' or (a.scenario=='combined' and elapsed<4):v=.32
elif a.scenario=='combined' and elapsed<5.6:v=-.25
else:
target=np.array(waypoints[waypoint]);distance=float(np.linalg.norm(target-np.array([x,y])))
if distance<.12:
if waypoint<len(waypoints)-1:waypoint+=1
else:reached=True
if not reached:
target=np.array(waypoints[waypoint]);delta=target-np.array([x,y]);error=math.atan2(math.sin(math.atan2(delta[1],delta[0])-yaw),math.cos(math.atan2(delta[1],delta[0])-yaw))
omega=float(np.clip(2.8*error,-1.1,1.1));v=min(.32,.9*distance)*max(0.,math.cos(error)) if abs(error)<.65 else 0.
wheel_speeds=[(v-.26*omega)/.11,(v+.26*omega)/.11]
for drive,speed in zip(drives,wheel_speeds):drive.GetTargetVelocityAttr().Set(math.degrees(speed))
simulation.step(render=True)
if step%60==0:print('SIM_STEP',step,simulation.current_time,flush=True)
if step%6==0:
sample={'step':step,'sim_time_s':simulation.current_time-start_sim,'wall_s':time.monotonic()-start_wall,'poses':{path:pose(path) for path in paths},'command':[v,omega],'waypoint':waypoint,'phase':('contact' if elapsed<4 else 'reverse' if elapsed<5.6 else 'detour') if a.scenario=='combined' else a.scenario}
samples.append(sample)
if reached and step>60:
if samples[-1].get('goal_hold') is None:samples[-1]['goal_hold']=True
if sum(s.get('goal_hold',False) for s in samples)>15:break
# Preserve real simulation time in the window recording whenever the renderer keeps up.
if not a.headless:time.sleep(max(0,(step+1)/60-(time.monotonic()-start_wall)))
for drive in drives:drive.GetTargetVelocityAttr().Set(0)
try: sim_version=version('isaacsim')
except PackageNotFoundError:
from isaacsim.core.version import get_version
sim_version=get_version()[0]
result={'status':'complete','scenario':a.scenario,'collision_view':a.collision_view,'no_floor':a.no_floor,'raw_collider':a.raw_collider,
'isaacsim_version':sim_version,'physics':'live PhysX; joint velocity drives; not a USD trajectory replay',
'control':'pose-feedback waypoint controller with initial contact and recovery' if a.scenario=='combined' else 'pose-feedback waypoint controller' if a.scenario=='detour' else 'fixed wheel commands' if drives else 'gravity probes',
'start_sim_s':start_sim,'duration_sim_s':simulation.current_time-start_sim,'duration_wall_s':time.monotonic()-start_wall,'reached_goal':reached,
'stage':{'up_axis':str(UsdGeom.GetStageUpAxis(stage)),'meters_per_unit':UsdGeom.GetStageMetersPerUnit(stage),'render_mesh_collision':mesh.GetPrim().HasAPI(UsdPhysics.CollisionAPI),'multitick_rendering':settings.get_as_bool('/rtx/hydra/supportMultiTickRate'),'room_emission_display_setting':a.room_emission,'proxy_floor':not a.no_floor},'raycasts':raycasts,'crate_contact_events':contacts,'samples':samples,'final_poses':{path:pose(path) for path in paths}}
(a.output/'result.json').write_text(json.dumps(result,indent=2)+'\n')
print('RUN_RESULT',json.dumps({k:v for k,v in result.items() if k not in ['samples','crate_contact_events']}),flush=True)
failed=False
except BaseException:
traceback.print_exc()
finally:
if failed:(a.output/'FAILED').touch()
app.close()
if failed:raise SystemExit(1)
record_gui.py
View files on GitHub"""Record the real native Isaac Sim window while run.py performs live physics."""
import argparse,json,os,signal,subprocess,time
from pathlib import Path
p=argparse.ArgumentParser();p.add_argument('--work',type=Path,required=True)
p.add_argument('--scenario',choices=['blocked','detour','probes','combined'],default='detour')
p.add_argument('--ffmpeg',type=Path,required=True);p.add_argument('--collision-view',action='store_true')
a=p.parse_args();root=Path(__file__).resolve().parent;a.work=a.work.resolve()
output=a.work/a.scenario;output.mkdir(parents=True,exist_ok=True)
assert not (output/'ready.json').exists(),'Use a new output folder for a fresh recording'
env=dict(os.environ,WORLDGEN_DATA_ROOT=str(a.work),DISPLAY=os.environ.get('DISPLAY',':1'),XAUTHORITY=os.environ.get('XAUTHORITY',f'/run/user/{os.getuid()}/gdm/Xauthority'))
command=['bash',str(root/'run.sh'),a.scenario,'--record-handshake']+(['--collision-view'] if a.collision_view else [])
recorder=None
with (output/'simulator.log').open('w') as log:
process=subprocess.Popen(command,env=env,stdout=log,stderr=subprocess.STDOUT)
try:
deadline=time.monotonic()+240
while not (output/'ready.json').exists():
if process.poll() is not None:raise RuntimeError('Isaac Sim stopped before the viewport was ready; see simulator.log')
if time.monotonic()>deadline:raise TimeoutError('Isaac Sim startup timed out')
time.sleep(.3)
listing=subprocess.check_output(['xwininfo','-root','-tree'],env=env,text=True)
window=next(row.split()[0] for row in listing.splitlines() if ('"Isaac Sim' in row or '"Isaac-Sim' in row) and 'mutter-x11-frames' not in row)
metadata=subprocess.check_output(['xwininfo','-id',window],env=env,text=True)
(output/'window.txt').write_text(metadata)
with (output/'recorder.log').open('w') as recordlog:
recorder=subprocess.Popen([str(a.ffmpeg),'-nostdin','-hide_banner','-loglevel','warning','-y','-f','x11grab','-draw_mouse','0','-framerate','30','-window_id',str(int(window,16)),'-i',env['DISPLAY']+'.0','-an','-vf','scale=trunc(iw/2)*2:trunc(ih/2)*2','-c:v','libx264','-preset','ultrafast','-crf','18','-pix_fmt','yuv420p','-movflags','+faststart',str(output/'native-gui.mp4')],env=env,stdout=recordlog,stderr=subprocess.STDOUT)
time.sleep(.5);assert recorder.poll() is None,'X11 recorder could not start'
(output/'record-go').touch()
process.wait(timeout=300)
if (output/'FAILED').exists() or not (output/'result.json').exists():raise RuntimeError('Simulation failed; keep the logs for diagnosis')
finally:
if recorder and recorder.poll() is None:
recorder.send_signal(signal.SIGINT);recorder.wait(timeout=15)
if process.poll() is None:process.terminate()
print('Native GUI recording:',output/'native-gui.mp4')
package.py
View files on GitHub"""Crop actual X11 window recordings into lightweight viewport clips.
No offline renderer or animation is substituted for the native GUI footage.
"""
import argparse,hashlib,json,subprocess,shutil,re
from pathlib import Path
p=argparse.ArgumentParser();p.add_argument('--source',type=Path,required=True);p.add_argument('--output',type=Path,required=True)
p.add_argument('--ffmpeg',default='ffmpeg');p.add_argument('--ffprobe',default='ffprobe');a=p.parse_args();a.output.mkdir(parents=True,exist_ok=True)
# Fixed geometry from our 1440×900 native Kit window; inspect window.txt on other layouts.
for scenario,stem in [('combined','worldgen-isaac'),('blocked','worldgen-isaac-blocked'),('detour','worldgen-isaac-detour'),('probes','worldgen-isaac-probes')]:
folder=a.source/scenario
if not (folder/'native-gui.mp4').exists():continue
window=(folder/'window.txt').read_text()
assert 'Width: 1440' in window and 'Height: 900' in window,'Reinspect the viewport crop for another layout'
result=json.loads((folder/'result.json').read_text());duration=result['duration_wall_s']+(.75 if scenario!='probes' else 0)+.2
output=a.output/f'{stem}.mp4'
subprocess.run([a.ffmpeg,'-hide_banner','-loglevel','error','-y','-ss','0.4','-i',str(folder/'native-gui.mp4'),'-t',str(duration),'-an',
'-vf','crop=952:536:50:64,scale=960:540','-c:v','libx264','-preset','slow','-crf','23','-pix_fmt','yuv420p','-movflags','+faststart',str(output)],check=True)
subprocess.run([a.ffmpeg,'-hide_banner','-loglevel','error','-y','-ss','1.4' if scenario=='probes' else '3','-i',str(output),'-frames:v','1',str(a.output/f'{stem}.jpg')],check=True)
if shutil.which(a.ffprobe):
probe=json.loads(subprocess.check_output([a.ffprobe,'-v','error','-show_format','-of','json',str(output)]))
duration_s=float(probe['format']['duration'])
else:
info=subprocess.run([a.ffmpeg,'-hide_banner','-i',str(output)],capture_output=True,text=True).stderr
hh,mm,ss=re.search(r'Duration: (\d+):(\d+):([\d.]+)',info).groups()
duration_s=int(hh)*3600+int(mm)*60+float(ss)
metadata={'source':'native X11 Isaac Sim window, 1440x900','crop_xywh':[50,64,952,536],'trim_start_s':.4,'speed':1.,'published_resolution':[960,540],
'duration_s':duration_s,'bytes':output.stat().st_size,'sha256':hashlib.sha256(output.read_bytes()).hexdigest(),
'source_sha256':hashlib.sha256((folder/'native-gui.mp4').read_bytes()).hexdigest(),'physical_simulation_s':result['duration_sim_s']}
(a.output/f'{stem}.edit.json').write_text(json.dumps(metadata,indent=2)+'\n');print(stem,metadata['duration_s'],metadata['bytes'])
plot.py
View files on GitHub"""Plot measured chassis paths, not the requested waypoint polyline (CPU)."""
import argparse,json
from pathlib import Path
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
from matplotlib.font_manager import FontProperties
p=argparse.ArgumentParser();p.add_argument('--evidence',type=Path,required=True);p.add_argument('--output',type=Path,required=True);p.add_argument('--font',type=Path);a=p.parse_args();a.output.mkdir(parents=True,exist_ok=True)
if a.font:plt.rcParams['font.family']=FontProperties(fname=str(a.font)).get_name()
plt.rcParams.update({'svg.fonttype':'path','axes.unicode_minus':False,'font.size':11})
runs={name:json.loads((a.evidence/name/'result.json').read_text()) for name in ['combined','blocked']}
for lang in ['en','ko']:
fig,ax=plt.subplots(figsize=(9,5),layout='constrained');fig.patch.set_facecolor('#f6f8fa');ax.set_facecolor('white')
ax.add_patch(Rectangle((-.225,-.4),.45,.8,facecolor='#f4a340',edgecolor='#9d5c05',label='Test crate' if lang=='en' else '시험 상자'))
for name,color,label in [('combined','#659f00','Contact, reverse, detour' if lang=='en' else '접촉·후진 후 우회'),('blocked','#ce5a46','Straight drive' if lang=='en' else '직진')]:
xy=[s['poses']['/World/Robot/Chassis'][0][:2] for s in runs[name]['samples']]
ax.plot([q[0] for q in xy],[q[1] for q in xy],color=color,lw=2.5,label=label,zorder=4 if name=='blocked' else 3,linestyle='--' if name=='blocked' else '-')
ax.scatter([-1.3,1.3],[0,0],s=75,marker='o',color=['#416a94','#659f00'],zorder=4)
ax.annotate('Start' if lang=='en' else '출발',(-1.3,0),xytext=(-16,14),textcoords='offset points')
ax.annotate('Goal' if lang=='en' else '목표',(1.3,0),xytext=(-10,14),textcoords='offset points')
ax.set(xlim=(-1.8,1.8),ylim=(-1.4,.8),xlabel='X (chosen simulation metres)' if lang=='en' else 'X (정한 시뮬레이션 크기, m)',ylabel='Y (m)',title='Measured chassis motion · live PhysX' if lang=='en' else '실제 몸체 이동 기록 · PhysX 실행')
ax.set_aspect('equal');ax.grid(alpha=.18);ax.legend(loc='upper center',ncol=3,fontsize=10)
for spine in ax.spines.values():spine.set_edgecolor('#c8d0d7')
fig.savefig(a.output/f'paths.{lang}.svg');plt.close(fig)
check.py
View files on GitHub"""Validate saved calibration, physical outcomes and media without CUDA or NumPy."""
import argparse,hashlib,json,math
from pathlib import Path
def check_run(folder):
r=json.loads((folder/'result.json').read_text())
assert r['status']=='complete' and r['isaacsim_version'].startswith('6.2')
assert r['stage']['up_axis']=='Z' and r['stage']['meters_per_unit']==1
assert r['samples'] and all(math.isfinite(v) for s in r['samples'] for pose in s['poses'].values() for values in pose for v in values)
if r['scenario']=='probes':
heights=[p[0][2] for p in r['final_poses'].values()]
if r['no_floor'] and not r['raw_collider']:assert max(heights)<-1
elif r['raw_collider']:assert all(.0<z<.20 for z in heights)
else:assert all(abs(z-.05)<.002 for z in heights)
else:
path='/World/Robot/Chassis';position=r['final_poses'][path][0]
assert all(.20<s['poses'][path][0][2]<.28 for s in r['samples'])
assert r['stage']['render_mesh_collision'] is False and r['stage']['proxy_floor'] is True
assert r['raycasts']['floor_left']['collider']=='/World/ProxyFloor'
assert abs(r['raycasts']['crate']['position'][2]-.6)<1e-4
if r['scenario']=='blocked':
assert abs(position[0]+.5)<.025 and r['crate_contact_events']
assert position[0]-r['samples'][0]['poses'][path][0][0]>.6
else:
assert r['reached_goal'] and math.hypot(position[0]-1.3,position[1])<.12
assert min(s['poses'][path][0][1] for s in r['samples'])<-.8
if r['scenario']=='detour':assert not r['crate_contact_events'],'The detour touched the crate'
else:
assert r['crate_contact_events']
assert {'contact','reverse','detour'}=={sample['phase'] for sample in r['samples']}
print(folder.name,r['scenario'],'physical outcome verified')
return r
def main():
p=argparse.ArgumentParser();p.add_argument('--run',type=Path);a=p.parse_args()
if a.run:check_run(a.run);return
folder=Path(__file__).resolve().parent;root=folder.parents[1]
record=json.loads((folder/'recorded.json').read_text())
calibration=json.loads((folder/'assets/calibration.json').read_text())
assert calibration['metric_scale'].startswith('assumed')
assert abs(calibration['meters_per_worldgen_unit']*calibration['source_floor_plane']['offset']-1.5)<1e-6
rows=calibration['source_to_isaac']['rotation_rows']
for i in range(3):
for j in range(3):assert abs(sum(a*b for a,b in zip(rows[i],rows[j]))-int(i==j))<1e-6
assert calibration['floor_inlier_rms_m']<.025
assert calibration['render_mesh']=={'stride':4,'vertices':80000,'triangles':158802,'collision_enabled':False,'small_uv_seam_gap':True}
for case in record['runs']:check_run(folder/'evidence'/case)
for rel,meta in record['files'].items():
data=(root/rel).read_bytes();assert len(data)==meta['bytes'] and hashlib.sha256(data).hexdigest()==meta['sha256'],rel
print('Calibrated assets, contact tests, live robot runs and native-GUI media hashes verified.')
if __name__=='__main__':main()



