fix: resolve camera aperture warnings and collision error
- Fix camera aperture mismatch: set aperture/focal_length before initialize() - Replace deprecated set_projection_type with set_lens_distortion_model - Fix lifting_link collision: meshSimplification -> convexHull in robot USD - Add runtime_warnings.md documenting all warnings analysis and fixes - Remove temporary debug script 1.py Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
116
1.py
116
1.py
@@ -1,116 +0,0 @@
|
||||
# from pxr import Usd, UsdGeom
|
||||
# stage = Usd.Stage.Open('workflows/simbox/example_assets/task/sort_the_rubbish/recyclable_garbage/bottle_0/Aligned_obj.usd')
|
||||
# print('metersPerUnit:', UsdGeom.GetStageMetersPerUnit(stage))
|
||||
# print('upAxis:', UsdGeom.GetStageUpAxis(stage))
|
||||
# dp = stage.GetDefaultPrim()
|
||||
# print('defaultPrim:', dp.GetPath() if dp else 'None')
|
||||
# xf = UsdGeom.Xformable(dp)
|
||||
# for op in xf.GetOrderedXformOps():
|
||||
# print(f' xformOp: {op.GetName()} = {op.Get()}')
|
||||
# for child in dp.GetChildren():
|
||||
# cxf = UsdGeom.Xformable(child)
|
||||
# ops = cxf.GetOrderedXformOps()
|
||||
# if ops:
|
||||
# for op in ops:
|
||||
# print(f' child {child.GetPath()} xformOp: {op.GetName()} = {op.Get()}')
|
||||
|
||||
# from pxr import Usd, UsdGeom
|
||||
# stage = Usd.Stage.Open('workflows/simbox/example_assets/task/sort_the_rubbish/recyclable_garbage/bottle_0/Aligned_obj.usd')
|
||||
# print('metersPerUnit:', UsdGeom.GetStageMetersPerUnit(stage))
|
||||
# print('upAxis:', UsdGeom.GetStageUpAxis(stage))
|
||||
# for prim in stage.Traverse():
|
||||
# print(f' {prim.GetPath()} type={prim.GetTypeName()}')
|
||||
# xf = UsdGeom.Xformable(prim)
|
||||
# if xf:
|
||||
# for op in xf.GetOrderedXformOps():
|
||||
# print(f' {op.GetName()} = {op.Get()}')
|
||||
|
||||
from pxr import Usd, UsdGeom
|
||||
import yaml, os
|
||||
|
||||
with open('workflows/simbox/core/configs/tasks/example/sort_the_rubbish.yaml') as f:
|
||||
cfg = yaml.safe_load(f)
|
||||
|
||||
tasks = cfg.get('tasks', [cfg])
|
||||
for task in tasks:
|
||||
asset_root = task.get('asset_root', '')
|
||||
for obj in task.get('objects', []):
|
||||
name = obj['name']
|
||||
path = obj.get('path', '')
|
||||
full = os.path.join(asset_root, path)
|
||||
print(f'=== {name}: {full} ===')
|
||||
try:
|
||||
stage = Usd.Stage.Open(full)
|
||||
print(f' metersPerUnit: {UsdGeom.GetStageMetersPerUnit(stage)}')
|
||||
print(f' upAxis: {UsdGeom.GetStageUpAxis(stage)}')
|
||||
except Exception as e:
|
||||
print(f' ERROR: {e}')
|
||||
|
||||
# ===== Check mesh vertex ranges =====
|
||||
print("\n===== Mesh vertex ranges =====")
|
||||
import numpy as np
|
||||
usd_files = {
|
||||
'pick_object_right': 'workflows/simbox/example_assets/task/sort_the_rubbish/recyclable_garbage/bottle_0/Aligned_obj.usd',
|
||||
'gso_box_right': 'workflows/simbox/example_assets/task/sort_the_rubbish/garbage_can/recyclable_can/Aligned_obj.usd',
|
||||
}
|
||||
for name, path in usd_files.items():
|
||||
stage = Usd.Stage.Open(path)
|
||||
for prim in stage.Traverse():
|
||||
if prim.GetTypeName() == 'Mesh':
|
||||
mesh = UsdGeom.Mesh(prim)
|
||||
pts = mesh.GetPointsAttr().Get()
|
||||
if pts:
|
||||
pts = np.array(pts)
|
||||
print(f'{name} mesh={prim.GetPath()} npts={len(pts)}')
|
||||
print(f' X: [{pts[:,0].min():.4f}, {pts[:,0].max():.4f}]')
|
||||
print(f' Y: [{pts[:,1].min():.4f}, {pts[:,1].max():.4f}] (upAxis=Y, this is height)')
|
||||
print(f' Z: [{pts[:,2].min():.4f}, {pts[:,2].max():.4f}]')
|
||||
print(f' Y_max * 0.01 = {pts[:,1].max()*0.01:.6f} m')
|
||||
print(f' Y_extent = {pts[:,1].max()-pts[:,1].min():.4f}')
|
||||
print(f' Y_max (raw cm) = {pts[:,1].max():.4f}')
|
||||
# 109.75 / Y_max ?
|
||||
if pts[:,1].max() > 0:
|
||||
print(f' 109.75 / Y_max = {109.75 / pts[:,1].max():.4f}')
|
||||
print(f' 109.75 / (Y_max*0.01) = {109.75 / (pts[:,1].max()*0.01):.4f}')
|
||||
|
||||
# ===== Fix USD metadata: set metersPerUnit=1.0 and upAxis=Z =====
|
||||
print("\n===== Fixing USD metadata =====")
|
||||
import shutil
|
||||
|
||||
fix_files = [
|
||||
'workflows/simbox/example_assets/task/sort_the_rubbish/recyclable_garbage/bottle_0/Aligned_obj.usd',
|
||||
'workflows/simbox/example_assets/task/sort_the_rubbish/garbage_can/recyclable_can/Aligned_obj.usd',
|
||||
'workflows/simbox/example_assets/task/sort_the_rubbish/garbage_can/nonrecyclable_can/Aligned_obj.usd',
|
||||
]
|
||||
# Also try to find pick_object_left USD
|
||||
pick_left_path = 'workflows/simbox/example_assets/task/sort_the_rubbish/non_recyclable_garbage/obj_0/Aligned_obj.usd'
|
||||
if os.path.exists(pick_left_path):
|
||||
fix_files.append(pick_left_path)
|
||||
|
||||
for fpath in fix_files:
|
||||
if not os.path.exists(fpath):
|
||||
print(f' SKIP (not found): {fpath}')
|
||||
continue
|
||||
# Backup
|
||||
bak = fpath + '.bak'
|
||||
if not os.path.exists(bak):
|
||||
shutil.copy2(fpath, bak)
|
||||
print(f' Backed up: {fpath} -> {bak}')
|
||||
else:
|
||||
print(f' Backup already exists: {bak}')
|
||||
|
||||
stage = Usd.Stage.Open(fpath)
|
||||
old_mpu = UsdGeom.GetStageMetersPerUnit(stage)
|
||||
old_up = UsdGeom.GetStageUpAxis(stage)
|
||||
print(f' {fpath}: old metersPerUnit={old_mpu}, upAxis={old_up}')
|
||||
|
||||
UsdGeom.SetStageMetersPerUnit(stage, 1.0)
|
||||
UsdGeom.SetStageUpAxis(stage, UsdGeom.Tokens.z)
|
||||
stage.GetRootLayer().Save()
|
||||
|
||||
# Verify
|
||||
stage2 = Usd.Stage.Open(fpath)
|
||||
print(f' -> new metersPerUnit={UsdGeom.GetStageMetersPerUnit(stage2)}, upAxis={UsdGeom.GetStageUpAxis(stage2)}')
|
||||
|
||||
print("\nDone! Now run launcher to test if Z is normal.")
|
||||
print("To restore: for each .bak file, copy it back over the .usd file")
|
||||
222
migerate/runtime_warnings.md
Normal file
222
migerate/runtime_warnings.md
Normal file
@@ -0,0 +1,222 @@
|
||||
# Runtime Warnings & Errors Analysis
|
||||
|
||||
Pipeline: `python launcher.py --config configs/simbox/de_plan_and_render_template.yaml`
|
||||
Environment: IS 5.0.0, RTX PRO 6000 Blackwell, conda `banana500`
|
||||
Date: 2026-04-03
|
||||
|
||||
---
|
||||
|
||||
## Errors
|
||||
|
||||
### 1. PhysicsUSD: triangle mesh collision on dynamic body
|
||||
|
||||
```
|
||||
[Error] PhysicsUSD: Parse collision - triangle mesh collision (approximation None/MeshSimplification)
|
||||
cannot be a part of a dynamic body, falling back to convexHull approximation:
|
||||
/World/task_0/split_aloha/.../lifting_link/collisions
|
||||
```
|
||||
|
||||
**Severity:** Medium (PhysX auto-fallback, but logs error every reset)
|
||||
**Root cause:** Robot USD `lifting_link/collisions` mesh 使用 `meshSimplification` 碰撞近似,PhysX 不支持动态物体使用 triangle mesh collision。
|
||||
**Fix:** 修改 robot USD 将 `MeshCollisionAPI.approximation` 从 `meshSimplification` 改为 `convexHull`。
|
||||
|
||||
```python
|
||||
from pxr import Usd, UsdPhysics
|
||||
stage = Usd.Stage.Open('workflows/simbox/example_assets/split_aloha_mid_360/robot.usd')
|
||||
prim = stage.GetPrimAtPath('/Root/.../lifting_link/collisions')
|
||||
UsdPhysics.MeshCollisionAPI(prim).GetApproximationAttr().Set('convexHull')
|
||||
stage.GetRootLayer().Save()
|
||||
```
|
||||
|
||||
**Status:** FIXED. Backup: `robot.usd.bak`
|
||||
|
||||
---
|
||||
|
||||
### 2. Physics scenes stepping mismatch
|
||||
|
||||
```
|
||||
[Error] Physics scenes stepping is not the same, step subscription will be send with later step,
|
||||
per scene step is not yet supported.
|
||||
```
|
||||
|
||||
**Severity:** Low (仅首次 reset 时出现一次)
|
||||
**Root cause:** IS 5.0.0 内部 physics scene 步进调度问题。physics_dt 和 rendering_dt 均为 1/30,配置一致。
|
||||
**Status:** IGNORED. IS 内部行为,不影响仿真结果。
|
||||
|
||||
---
|
||||
|
||||
## Warnings — Fixed
|
||||
|
||||
### 3. Camera aperture inconsistent with resolution
|
||||
|
||||
```
|
||||
[Warning] 'verticalAperture' (1.529) and 'horizontalAperture' (2.095) are inconsistent with
|
||||
the pixel resolution aspect ratio (1.333). Setting 'verticalAperture' to 1.572 to ensure square pixels.
|
||||
```
|
||||
|
||||
**Severity:** Low (IS 自动修正,但每个相机打 2 条 warning)
|
||||
**Root cause:** `custom_camera.py` 在 `self.initialize()` 之后才设置 aperture/focal_length,但 `initialize()` 时就用默认 aperture 做一致性检查。
|
||||
**Fix:** 重构 `custom_camera.py`,将 aperture/focal_length 设置移到 `initialize()` 之前。
|
||||
|
||||
```python
|
||||
# Before (wrong order):
|
||||
super().__init__(...)
|
||||
self.initialize() # <-- checks aperture here with default values
|
||||
# ... later ...
|
||||
self.set_horizontal_aperture(...) # too late, warning already printed
|
||||
|
||||
# After (correct order):
|
||||
super().__init__(...)
|
||||
self.set_horizontal_aperture(...) # set aperture first
|
||||
self.set_vertical_aperture(...)
|
||||
self.set_focal_length(...)
|
||||
self.initialize() # now checks with correct values
|
||||
```
|
||||
|
||||
**Status:** FIXED in `workflows/simbox/core/cameras/custom_camera.py`
|
||||
|
||||
---
|
||||
|
||||
### 4. Camera.set_projection_type deprecated
|
||||
|
||||
```
|
||||
[Warning] Camera.set_projection_type is deprecated and will be removed in a future release.
|
||||
Please use Camera.set_lens_distortion_model instead.
|
||||
```
|
||||
|
||||
**Severity:** Low
|
||||
**Fix:** 替换 API 调用,带 fallback 兼容旧版本。
|
||||
|
||||
```python
|
||||
# Before:
|
||||
self.set_projection_type("pinhole")
|
||||
# After:
|
||||
try:
|
||||
self.set_lens_distortion_model("pinhole")
|
||||
except AttributeError:
|
||||
self.set_projection_type("pinhole")
|
||||
```
|
||||
|
||||
**Status:** FIXED in `workflows/simbox/core/cameras/custom_camera.py`
|
||||
|
||||
---
|
||||
|
||||
## Warnings — Requires Manual Action
|
||||
|
||||
### 5. CPU powersave mode
|
||||
|
||||
```
|
||||
[Warning] CPU performance profile is set to powersave. This profile sets the CPU to the
|
||||
lowest frequency reducing performance.
|
||||
```
|
||||
|
||||
**Severity:** Medium (影响整体性能)
|
||||
**Fix:** 需要 sudo 权限手动设置。
|
||||
|
||||
```bash
|
||||
# 临时切换到 performance 模式 (重启后恢复)
|
||||
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
||||
|
||||
# 永久设置 (Ubuntu)
|
||||
sudo apt install cpufrequtils
|
||||
echo 'GOVERNOR="performance"' | sudo tee /etc/default/cpufrequtils
|
||||
sudo systemctl restart cpufrequtils
|
||||
```
|
||||
|
||||
**Status:** MANUAL. 需要用户自行设置。
|
||||
|
||||
---
|
||||
|
||||
## Warnings — Ignored (Safe)
|
||||
|
||||
### 6. IS 5.0 API deprecation warnings (~100 条)
|
||||
|
||||
```
|
||||
[Warning] omni.isaac.core has been deprecated in favor of isaacsim.core.api.
|
||||
Please update your code accordingly.
|
||||
```
|
||||
|
||||
**Severity:** None
|
||||
**说明:** IS 5.0 对所有 `omni.isaac.*` 模块重命名为 `isaacsim.*`。旧 API 仍然可用,仅打印 deprecation 提示。不影响功能,无需修改。如果将来升级到 IS 6.x 可能需要迁移。
|
||||
|
||||
---
|
||||
|
||||
### 7. Curobo warp cache warnings
|
||||
|
||||
```
|
||||
[Warning] [curobo] Object already in warp cache, using existing instance for:
|
||||
/World/task_0/pick_object_left/Aligned/mesh
|
||||
```
|
||||
|
||||
**Severity:** None
|
||||
**说明:** Curobo 内部 warp kernel 缓存机制。同一 mesh 在多次 world update 中被重复加载时复用缓存。完全正常,无害。
|
||||
|
||||
---
|
||||
|
||||
### 8. Robot dummy_base inertia tensor warnings
|
||||
|
||||
```
|
||||
[Warning] The rigid body at .../dummy_base_rotate has a possibly invalid inertia tensor of
|
||||
{1.0, 1.0, 1.0} and a negative mass, small sphere approximated inertia was used.
|
||||
```
|
||||
|
||||
**Severity:** None
|
||||
**说明:** Robot USD 中 `dummy_base_rotate/x/y` 是虚拟关节(用于全局位移),不需要真实质量属性。PhysX 自动使用球体近似惯性张量,功能正常。
|
||||
|
||||
---
|
||||
|
||||
### 9. Table mesh corrupted normal primvar
|
||||
|
||||
```
|
||||
[Warning] Mesh '/World/task_0/table/Instance/Group_default_00/SM_08_component6_0' has corrupted
|
||||
data in primvar 'normal': buffer size 14880 doesn't match expected size 2482
|
||||
```
|
||||
|
||||
**Severity:** Low
|
||||
**说明:** Table USD 中一个子网格的 normal 数据大小不匹配。IS 会忽略损坏的 normal 并自动计算。不影响渲染和物理。如需修复,需在 DCC 工具(Blender/Maya)中重新导出 table USD。
|
||||
|
||||
---
|
||||
|
||||
### 10. GPU / Hardware warnings
|
||||
|
||||
```
|
||||
[Warning] Skipping unsupported non-NVIDIA GPU: AMD Ryzen 7 9800X3D (RADV RAPHAEL_MENDOCINO)
|
||||
[Warning] ECC is enabled on physical device 0
|
||||
[Warning] IOMMU is enabled.
|
||||
```
|
||||
|
||||
**Severity:** None
|
||||
**说明:** 系统有 AMD 集显(跳过正常)。RTX PRO 6000 默认开启 ECC(牺牲约 6% 显存带宽换数据可靠性)。IOMMU 已启用。均为信息提示。
|
||||
|
||||
---
|
||||
|
||||
### 11. SdRenderVarPtr missing LdrColorSDhost
|
||||
|
||||
```
|
||||
[Warning] SdRenderVarPtr missing valid input renderVar LdrColorSDhost
|
||||
```
|
||||
|
||||
**Severity:** None
|
||||
**说明:** Synthetic data pipeline 中 LDR color 渲染变量在 headless 模式下首帧未就绪。后续帧正常。不影响输出。
|
||||
|
||||
---
|
||||
|
||||
### 12. trimesh sampling warning
|
||||
|
||||
```
|
||||
[Warning] [trimesh] only got 3/4 samples!
|
||||
```
|
||||
|
||||
**Severity:** Low
|
||||
**说明:** Grasp pose 采样时某个物体只获得 3 个(期望 4 个)抓取采样点。不影响功能,pipeline 会使用获得的采样继续运行。
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
| Category | Count | Fixed | Ignored | Manual |
|
||||
|----------|-------|-------|---------|--------|
|
||||
| Errors | 2 | 1 | 1 | 0 |
|
||||
| Warnings (actionable) | 3 | 2 | 0 | 1 |
|
||||
| Warnings (safe to ignore) | 7 | 0 | 7 | 0 |
|
||||
| **Total** | **12** | **3** | **8** | **1** |
|
||||
@@ -40,6 +40,34 @@ class CustomCamera(Camera):
|
||||
*args,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
# ===== From cfg =====
|
||||
pixel_size = cfg["params"].get("pixel_size")
|
||||
f_number = cfg["params"].get("f_number")
|
||||
focus_distance = cfg["params"].get("focus_distance")
|
||||
fx, fy, cx, cy = cfg["params"].get("camera_params")
|
||||
width = cfg["params"].get("resolution_width")
|
||||
height = cfg["params"].get("resolution_height")
|
||||
self.output_mode = cfg.get("output_mode", "rgb")
|
||||
|
||||
# ===== Compute and set camera parameters (before initialize to avoid aperture mismatch warnings) =====
|
||||
horizontal_aperture = pixel_size * 1e-3 * width
|
||||
vertical_aperture = pixel_size * 1e-3 * height
|
||||
focal_length_x = fx * pixel_size * 1e-3
|
||||
focal_length_y = fy * pixel_size * 1e-3
|
||||
focal_length = (focal_length_x + focal_length_y) / 2
|
||||
|
||||
self.set_focal_length(focal_length / 10.0)
|
||||
self.set_focus_distance(focus_distance)
|
||||
self.set_lens_aperture(f_number * 100.0)
|
||||
self.set_horizontal_aperture(horizontal_aperture / 10.0)
|
||||
self.set_vertical_aperture(vertical_aperture / 10.0)
|
||||
self.set_clipping_range(0.05, 1.0e5)
|
||||
try:
|
||||
self.set_lens_distortion_model("pinhole")
|
||||
except AttributeError:
|
||||
self.set_projection_type("pinhole")
|
||||
|
||||
self.initialize()
|
||||
self.with_distance = cfg["params"].get("with_distance", True)
|
||||
self.with_semantic = cfg["params"].get("with_semantic", False)
|
||||
@@ -61,30 +89,6 @@ class CustomCamera(Camera):
|
||||
if self.with_motion_vector:
|
||||
self.add_motion_vectors_to_frame()
|
||||
|
||||
# ===== From cfg =====
|
||||
pixel_size = cfg["params"].get("pixel_size")
|
||||
f_number = cfg["params"].get("f_number")
|
||||
focus_distance = cfg["params"].get("focus_distance")
|
||||
fx, fy, cx, cy = cfg["params"].get("camera_params")
|
||||
width = cfg["params"].get("resolution_width")
|
||||
height = cfg["params"].get("resolution_height")
|
||||
self.output_mode = cfg.get("output_mode", "rgb")
|
||||
|
||||
# ===== Compute and set camera parameters =====
|
||||
horizontal_aperture = pixel_size * 1e-3 * width
|
||||
vertical_aperture = pixel_size * 1e-3 * height
|
||||
focal_length_x = fx * pixel_size * 1e-3
|
||||
focal_length_y = fy * pixel_size * 1e-3
|
||||
focal_length = (focal_length_x + focal_length_y) / 2
|
||||
|
||||
self.set_focal_length(focal_length / 10.0)
|
||||
self.set_focus_distance(focus_distance)
|
||||
self.set_lens_aperture(f_number * 100.0)
|
||||
self.set_horizontal_aperture(horizontal_aperture / 10.0)
|
||||
self.set_vertical_aperture(vertical_aperture / 10.0)
|
||||
self.set_clipping_range(0.05, 1.0e5)
|
||||
self.set_projection_type("pinhole")
|
||||
|
||||
fx = width * self.get_focal_length() / self.get_horizontal_aperture()
|
||||
fy = height * self.get_focal_length() / self.get_vertical_aperture()
|
||||
self.is_camera_matrix = np.array([[fx, 0.0, cx], [0.0, fy, cy], [0.0, 0.0, 1.0]])
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user