Asset Preview#
The preview_asset script loads a USD or mesh asset into the simulation for visual inspection and debugging, without requiring a full gym environment. It supports both rigid objects (meshes) and articulations (robot-like assets), with an optional interactive session for manipulation.
Quick Start#
Preview a rigid object from a USD file:
python -m embodichain.lab.scripts.preview_asset \
--asset_path /path/to/sugar_box.usda \
--asset_type rigid
Preview an articulation:
python -m embodichain.lab.scripts.preview_asset \
--asset_path /path/to/robot.usd \
--asset_type articulation
Asset Type Detection#
The asset type is determined as follows:
Explicit: use
--asset_type rigidor--asset_type articulation.URDF files: automatically treated as articulations.
USD files: the USD stage is inspected for
UsdPhysicsArticulationRootprims. If found, the file is loaded as an articulation; otherwise as a rigid object.Other mesh formats (
.obj,.stl,.glb, etc.): always loaded as rigid objects.
Interactive Preview Mode#
Pass --preview to enter an interactive REPL after the asset is loaded:
python -m embodichain.lab.scripts.preview_asset \
--asset_path /path/to/robot.usd \
--asset_type articulation \
--preview
Available commands inside the REPL:
Command |
Description |
|---|---|
|
Enter an IPython embed session. |
|
Step the simulation N times (default 10). |
|
Quit the simulation. |
Inside the IPython embed session you can freely inspect and manipulate the asset:
# Inspect articulation joint positions
asset.get_qpos()
# Step the simulation
sim.update(step=10)
# Change asset position
asset.set_root_pose(pos=[0, 0, 1.0], rot=[0, 0, 0])
Command-Line Arguments#
Argument |
Description |
Default |
|---|---|---|
|
Path to the asset file ( |
required |
|
Type of asset: |
Auto-detected (fallback: |
|
Unique identifier in the scene |
Derived from filename |
|
Initial position as |
|
|
Initial rotation in degrees as |
|
|
Body type for rigid objects: |
|
|
Use physical properties from the USD file instead of defaults |
|
|
Fix the base of articulations |
|
|
Simulation device |
|
|
Run without rendering window |
|
|
Enable ray tracing |
|
|
Enter interactive embed mode after loading |
|
Examples#
Headless smoke test (no render window):
python -m embodichain.lab.scripts.preview_asset \
--asset_path /path/to/asset.usda \
--headless
Custom position and rotation:
python -m embodichain.lab.scripts.preview_asset \
--asset_path /path/to/robot.usd \
--asset_type articulation \
--init_pos 0.5 0 0.0 \
--init_rot 0 0 90 \
--preview
Dynamic rigid body (falls under gravity):
python -m embodichain.lab.scripts.preview_asset \
--asset_path /path/to/box.obj \
--body_type dynamic \
--preview