Repository navigation
[Core] Refactor and cleanup core subpackage for 3.0 [5D/N] - #7992
Conversation
…Featherstone inertia changes
|
| if isinstance(coms, wp.array) and coms.dtype == wp.transformf: | ||
| coms = wp.to_torch(coms) | ||
| if isinstance(coms, torch.Tensor) and coms.shape[-1] == 7: | ||
| return coms[..., :3].contiguous() |
There was a problem hiding this comment.
The new CoM conversion supports Torch pose tensors and wp.transformf arrays across six index and mask methods, but the added regression test covers only a Torch pose passed to Articulation.set_coms_index. The Warp conversion branch and the mask, rigid-object, and rigid-object-collection paths remain untested, so regressions in the newly supported input paths may go unnoticed. Please add focused coverage for wp.transformf and the remaining public setters.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Isaac Lab Review Bot
The backend-routing refactor consistently moves CoM and friction handling behind asset APIs, but the new Newton CoM conversion helper exposes an input type that its consumers cannot handle.
- Design and architecture: Backend-specific CoM pose narrowing is appropriately localized at the Newton asset boundary. No architectural issue was identified in the routing change itself.
- API: The widened Newton
set_coms_indexandset_coms_maskcontracts remain backward compatible. However,com_positionsis annotated to accept and returnfloat, despite its documented tensor/array contract and downstream shape validation rejecting scalar inputs; removefloatfrom both annotations. - Implementation: The tensor and
wp.transformfconversion paths are coherent, and existing position inputs remain unchanged. The required fix is limited to aligning the new helper's type signature with its actual supported inputs.
Minor fixes needed. Posted 1 actionable finding inline.
Automated review; human maintainers own approval decisions.
| ) | ||
|
|
||
|
|
||
| def com_positions(coms: float | torch.Tensor | wp.array) -> float | torch.Tensor | wp.array: |
There was a problem hiding this comment.
🔵 Suggestion · Api — Helper annotation advertises unsupported float input
com_positions is annotated float | torch.Tensor | wp.array for both parameter and return, but every caller declares coms: torch.Tensor | wp.array, and a scalar would fall through both branches and then fail the subsequent assert_shape_and_dtype(..., wp.vec3f, "coms"). The documented contract only covers trailing-dim-3/wp.vec3f and trailing-dim-7/wp.transformf inputs, so drop float from the annotations.
|
run-ci |
Signed-off-by: Octi Zhang <[email protected]>
Signed-off-by: Octi Zhang <[email protected]>
|
run-ci |
# Description Part of the series that splits the core cleanup in #7949 into small, reviewable pieces. Following #7985, event terms and task code should not branch on the physics manager's class name; they should call the asset API and let each backend handle (or reject) what it supports. An audit found the remaining places that branched on the backend name, plus one Newton solver gap. This PR fixes them. It is independent of #7985 / #7990 / #7991. ## Changes - **`randomize_joint_parameters`** chose the friction write path with `"newton" in manager_name`, treating every other backend (including OVPhysX) as PhysX. It now randomizes dynamic friction whenever the asset data exposes `joint_dynamic_friction_coeff` (PhysX, OVPhysX; not Newton), and makes one `write_joint_friction_coefficient_to_sim_index` call on every backend. Newton's writer already applies the viscous part and ignores dynamic friction. Its invalid-operation error also named `'randomize_fixed_tendon_parameters'`; it now names the right term. - **`randomize_rigid_body_com`** sliced the pose to a position on Newton (`"newton" in manager_name`) because Newton's `set_coms_*` accepted positions only, unlike the base API, PhysX, and OVPhysX, which take poses. Newton's `set_coms_index` / `set_coms_mask` (articulation, rigid object, rigid object collection) now also accept poses (trailing dimension 7 or `wp.transformf`) and ignore the orientation, since Newton models the center of mass as a position. The event passes poses on every backend. - **`randomize_rigid_body_scale`** detected articulations with `cls.__name__ == "Articulation"` over the MRO; it now uses `isinstance(asset, BaseArticulation)`. - **NIST `reset_end_effector_around_asset`** (`isaaclab_tasks` contrib) no longer performs a backend-specific Jacobian refresh. Joint writes invalidate articulation data, and subsequent body-pose reads refresh forward kinematics on demand. This also removes the invalid `root_physx_view` access on OVPhysX. - **Newton Featherstone inertia changes.** `SolverFeatherstone` derives its inertia data (`body_I_m`, `body_X_com`) from the model only in its constructor, and its `notify_model_changed` ignores `ModelFlags.BODY_INERTIAL_PROPERTIES`. So `set_masses_*`, `set_coms_*`, `set_inertias_*`, and the mass/CoM/inertia randomization events silently had no effect on Featherstone. The real fix is upstream in Newton. Until then, a manager can declare model changes its solver does not apply (`NewtonManager._ignored_model_changes`). Featherstone declares `BODY_INERTIAL_PROPERTIES`, and the manager logs a warning the first time such a change is flushed. - **Pretrained checkpoints** (`isaaclab_rl`): OVPhysX configs resolve to the PhysX checkpoints through the `"physx"` substring match. This is intended, since they run the same PhysX engine, so it is only documented. Not changed: Newton ignores `joint_velocity_limit` on MJWarp (documented by Newton). A warning was considered, but actuator setup writes velocity limits for every articulation, so it would fire on every MJWarp run. ## Tests - `isaaclab_physx/test/assets/test_articulation.py`: the two CUDA cases of `test_write_joint_state_data_consistency` pass, verifying fresh body state after manual joint writes without a simulation step or explicit Jacobian read. - `test/envs/test_articulation_ordering_events.py`: the Newton joint-parameter randomization test no longer gives the term a physics manager. It fails on `develop`, where the term reads `env.sim`. The fake Newton articulation now forwards viscous friction the way Newton's writer does. - `isaaclab_newton/test/assets/test_articulation.py`: `test_randomize_rigid_body_com` also sets CoMs from full poses (fails on `develop` with a shape mismatch). - `isaaclab_newton/test/physics/test_newton_manager_abstraction.py`: `test_initialize_solver_populates_canonical_state` checks that only Featherstone registers `BODY_INERTIAL_PROPERTIES` as ignored (8 solver variants). - Also passing: the full Newton manager abstraction tests (199) and the Newton articulation / rigid object / collection CoM and friction tests. ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Release backport - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `develop` ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have added a changelog fragment under `source/<pkg>/changelog.d/` for every touched package (do **not** edit `CHANGELOG.rst` or bump `extension.toml` — CI handles that) - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Signed-off-by: Octi Zhang <[email protected]> Co-authored-by: Octi Zhang <[email protected]> (cherry picked from commit 8835a34)
|
Backported to |
Description
Part of the series that splits the core cleanup in #7949 into small, reviewable pieces. Following #7985, event terms and task code should not branch on the physics manager's class name; they should call the asset API and let each backend handle (or reject) what it supports. An audit found the remaining places that branched on the backend name, plus one Newton solver gap. This PR fixes them. It is independent of #7985 / #7990 / #7991.
Changes
randomize_joint_parameterschose the friction write path with"newton" in manager_name, treating every other backend (including OVPhysX) as PhysX. It now randomizes dynamic friction whenever the asset data exposesjoint_dynamic_friction_coeff(PhysX, OVPhysX; not Newton), and makes onewrite_joint_friction_coefficient_to_sim_indexcall on every backend. Newton's writer already applies the viscous part and ignores dynamic friction. Its invalid-operation error also named'randomize_fixed_tendon_parameters'; it now names the right term.randomize_rigid_body_comsliced the pose to a position on Newton ("newton" in manager_name) because Newton'sset_coms_*accepted positions only, unlike the base API, PhysX, and OVPhysX, which take poses. Newton'sset_coms_index/set_coms_mask(articulation, rigid object, rigid object collection) now also accept poses (trailing dimension 7 orwp.transformf) and ignore the orientation, since Newton models the center of mass as a position. The event passes poses on every backend.randomize_rigid_body_scaledetected articulations withcls.__name__ == "Articulation"over the MRO; it now usesisinstance(asset, BaseArticulation).reset_end_effector_around_asset(isaaclab_taskscontrib) no longer performs a backend-specific Jacobian refresh. Joint writes invalidate articulation data, and subsequent body-pose reads refresh forward kinematics on demand. This also removes the invalidroot_physx_viewaccess on OVPhysX.SolverFeatherstonederives its inertia data (body_I_m,body_X_com) from the model only in its constructor, and itsnotify_model_changedignoresModelFlags.BODY_INERTIAL_PROPERTIES. Soset_masses_*,set_coms_*,set_inertias_*, and the mass/CoM/inertia randomization events silently had no effect on Featherstone. The real fix is upstream in Newton. Until then, a manager can declare model changes its solver does not apply (NewtonManager._ignored_model_changes). Featherstone declaresBODY_INERTIAL_PROPERTIES, and the manager logs a warning the first time such a change is flushed.isaaclab_rl): OVPhysX configs resolve to the PhysX checkpoints through the"physx"substring match. This is intended, since they run the same PhysX engine, so it is only documented.Not changed: Newton ignores
joint_velocity_limiton MJWarp (documented by Newton). A warning was considered, but actuator setup writes velocity limits for every articulation, so it would fire on every MJWarp run.Tests
isaaclab_physx/test/assets/test_articulation.py: the two CUDA cases oftest_write_joint_state_data_consistencypass, verifying fresh body state after manual joint writes without a simulation step or explicit Jacobian read.test/envs/test_articulation_ordering_events.py: the Newton joint-parameter randomization test no longer gives the term a physics manager. It fails ondevelop, where the term readsenv.sim. The fake Newton articulation now forwards viscous friction the way Newton's writer does.isaaclab_newton/test/assets/test_articulation.py:test_randomize_rigid_body_comalso sets CoMs from full poses (fails ondevelopwith a shape mismatch).isaaclab_newton/test/physics/test_newton_manager_abstraction.py:test_initialize_solver_populates_canonical_statechecks that only Featherstone registersBODY_INERTIAL_PROPERTIESas ignored (8 solver variants).Type of change
Release backport
developChecklist
pre-commitchecks with./isaaclab.sh --formatsource/<pkg>/changelog.d/for every touched package (do not editCHANGELOG.rstor bumpextension.toml— CI handles that)CONTRIBUTORS.mdor my name already exists there