Repository navigation
[Core] Refactor and cleanup core subpackage for 3.0 [15/N] - #8101
Conversation
|
There was a problem hiding this comment.
Isaac Lab Review Bot
Reviewed the refactor across SimulationContext, USD utilities, and UsdFrameView. The extracted private helpers preserve module ownership and the rewritten paths retain the existing observable contracts in the supplied context.
- Design and architecture: The new helpers remain internal to their owning modules. USD-specific transform extraction stays in UsdFrameView, while the canonical transform-op order is shared locally between standardization and validation without changing backend boundaries.
- API: No public API is added, removed, renamed, or intentionally changed. The reviewed return shapes, exception paths, Fabric-stage behavior, and material/query utility contracts remain consistent with the replaced code. The package-level .skip fragment is appropriate for this non-user-visible refactor.
- Implementation: The visualizer-config normalization, stage predicates, semantics traversal, material-binding token selection, transform-op handling, and pose extraction paths were traced against the removed implementations. Short-circuit behavior, canonical ordering, precision preservation, and log output remain equivalent. The main residual dependency is that calls delegated to existing helpers, such as set_prim_visibility and _coerce_color, continue to honor the behavior previously implemented inline.
No blocking issues. No inline issue met the actionable-evidence threshold; the assessment above records the review feedback.
Automated review; human maintainers own approval decisions.
# Conflicts: # source/isaaclab/isaaclab/sim/utils/stage.py
AntoineRichard
left a comment
There was a problem hiding this comment.
Looks good, a lot of these are more comestic than anything, and I'm not sure they're easier to read. But from what I could see it looks good! :D
|
run-ci |
Description
Part 15 of the split of #7949. It cleans up the simulation context, the USD prim, stage, query, semantics and transform utilities, and the USD frame view. It changes no public API or behavior. Every kept hunk was checked against
developfor identical outputs and no slowdown; hunks that failed either check were dropped.SimulationContext:cfg.visualizer_cfgsto a list" now share_configured_visualizer_cfgs().importlib/warningsimports moved to module level, andgetattr(mod, "KitVisualizerCfg")becamemod.KitVisualizerCfg._physics_step_countcomment and added a docstring toget_scene_data_provider.sim.utils.transforms:standardize_xform_opssets up the translate/orient/scale ops in one loop. Existing ops keep their precision and missing ones are created as double, as before.validate_standard_xform_ops.resolve_prim_pose,resolve_prim_scaleandconvert_world_pose_to_localare shorter, with the frame-convention comments kept.sim.utils.semantics:add_labels,remove_labels,check_missing_labelsandcount_total_labelsare simplified.sim.utils.prims:set_prim_visibility.bind_visual_materialandbind_physics_materialpick the binding-strength token with an inline conditional.change_prim_propertyandget_usd_references.sim.utils.stage,sim.utils.queries,sim.utils.newton_model_utils:_is_prim_deletable,clear_stage,get_current_stage, the breadth-first child searches andfind_global_fixed_joint_primare shorter.Nonecheck around_coerce_color, which already handlesNone.UsdFrameView:_poses_from_transforms().scales_np[idx, 0]).getattr/hasattrcalls with direct attribute access:visualizer_type,max_visible_envsandenable_live_plotsare fields onVisualizerCfg,default_visualizer_cfgonSimulationCfg, andUsdFrameViewnow initializes_prim_paths = Noneinstead of checkinghasattr. The remaining uses are dynamic by design (thread-local stage state, dataclass-field copying, USDCreate{X}Attrlookups, optional visualizer-package fields, duck typing on Newton builders and array-likes).resolve_physics_cfg(simulation_context) andto_tuple(sim.utils.prims) drop their_prefix because other files use them.Not ported from #7949:
sim/__init__.py.develop's relative imports.FrameView.__new__, which matches the other backend factories.delete_primno longer inserting the stage into theStageCache: an observable side effect.logger.errorbefore theTypeErrorinsafe_set_attribute_on_usd_schema.MaterialBindingAPI.Applyinbind_physics_material: it could author an extra API schema.bind_physics_materialerror message.Noneguard inregister_interactive_scene: tests passNonethrough it.Gf.Vec3d(*scale)instandardize_xform_ops:Gf.Vec3d(scale)also accepts other inputs.develophas since added timing around it.develop: world-scale reads and a shared matrix-scale helper.Type of change
Verification
Develop vs this branch (the same script runs against each source tree with a fixed seed): 659 outputs, 0 differences (rerun against the latest
developafter the reflection and rename changes), compared exactly (dtype, shape and bytes for arrays;float.hexfor floats). Covered:standardize_xform_ops,validate_standard_xform_ops,resolve_prim_pose(world, prim-relative and root-relative),resolve_prim_scaleandconvert_world_pose_to_localon 60 prims. The prims cover float and double precision, out-of-order ops, matrix ops,unitsResolve, reset-xform-stack and no ops.UsdFrameViewworld and local poses and scales (all and selected indices) on 512 nested prims, before and after a world-space scale write.Jointschema) and first/all/depth-limited child searches.change_prim_property(missing, create, clear, invalid prim), visual and physics material binding,create_primwith world and local poses,get_usd_references._is_prim_deletable,clear_stagewith and without a predicate,delete_prim.Performance (latest
develop, median of 5 alternating runs; USD frame view with 512 prims):standardize_xform_opsresolve_prim_poseUsdFrameViewworld-spaceset_scalesUsdFrameView.get_world_posesUsdFrameView.get_local_posesUsdFrameView.get_local_scalesUsdFrameView.get_world_scalesTests, all passing:
test_utils_transforms(28),test_utils_prims(19),test_utils_queries(11),test_utils_semantics(6),test_utils_stage(15)test_views_xform_prim(45),test_newton_model_utils(13)test_simulation_context(30),test_simulation_context_visualizers(44, run inside Kit),test_simulation_stage_in_memory(3)ruff checkandruff formatare clean.Checklist
pre-commitchecks with./isaaclab.sh --formatsource/<package>/changelog.d/for each changed package (see Changelog)Release backport
develop