Repository navigation
Accelerate and strengthen asset tests [6/13] - #8144
AntoineRichard wants to merge 28 commits into
Conversation
RigidObjectCollection.set_coms_index passed wp.transformf data to the PhysX tensor API, which raises a KeyError. It also marked the lazily filled body_com_pose_b cache as fresh after a partial write, so the unselected entries read back as zeros when the cache had not been read before. set_inertias_index flattened the (num_instances, num_bodies, 9) inertias with the 2D reshape, which the backend rejects. Pass the COM poses as float32, let the next read refresh the COM cache from the view as RigidObject does, and reshape the inertias with the 3D helper. A new test writes both properties to a non-sorted subset of (env, body) cells and checks the PhysX view and the data buffers.
Move the mocked cross-backend asset interface tests into a contract package with api, data, and write entry modules. An explicit capability table gives every backend a visible row: unavailable backends and unsupported branches collect as skips with their reason instead of silently dropping out. A kitless usdrt/carb stub and an availability guard keep PhysX articulations in the matrix, where they previously were skipped without notice. Factory manager patches are scoped to one test and restored afterwards. PhysX views apply TensorAPI writes so partial writers are checked against unselected backend rows, Newton joins the fixed-tendon contract, the deprecated command aliases are checked against the actuator collection, and one enforced inventory classifies the public base-class surface.
Take over what the removed OVPhysX real-backend joint-state test checked, on every backend: unsorted int64 environment and joint selectors on the fused writer, the finite-difference baseline it restarts for the written joints, skip_forward leaving body caches to the caller, and the deprecated combined writer producing the same state as the public writers.
Check that joint_effort_out_of_limit terminates exactly the environments whose applied effort differs from the computed effort on the selected joints, including an environment that clips only unselected joints. The term is backend independent; this replaces an all-or-nothing check that built a Nucleus Franka scene in the PhysX articulation suite.
Add a module-scoped scene built from the local branching fixture with two-environment islands: fixed with MJWarp ordering and USD drive gains and limits, floating with configured gains and a root discovered below the spawned prim, floating with an explicit root path and a root-moving body order, and fixed with a reversed joint and a spatial tendon. Its nodes cover structure and orderings, joint-state writes, joint and body properties, drives, efforts and dynamics, and floating-root writes, wrenches, and resets. Partial writes target environment 1 and prove that environment 0 is preserved in the real PhysX state. Remove the Nucleus-robot tests these nodes cover and move the PhysX articulation kernel tests under unit/.
Add the spatial-tendon node and the Jacobian and mass-matrix refresh check to the composite scene, check initialization failures on the local fixture with their error messages, and keep the Shadow Hand fixed-tendon, Franka gravity-compensation, and Franka IK tests on their shipped assets. Remove the remaining Nucleus-robot articulation tests; the joint-effort termination term and the deprecated torque aliases now have their own unit and contract owners.
|
| if fixed_base: | ||
| fixed_joint = UsdPhysics.FixedJoint.Define(stage, f"{robot_path}/fixed_root") | ||
| fixed_joint.GetBody1Rel().SetTargets([f"{robot_path}/base"]) |
There was a problem hiding this comment.
Runtime root conversion coverage lost
The removed tests used spawn.fix_root_link to convert real assets between floating and fixed bases, then checked the resulting PhysX articulation. This replacement defines a fixed joint directly, so it cannot catch a regression between the spawner's conversion and PhysX initialization. Please retain a runtime test of that path.
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!
| @@ -877,85 +528,10 @@ def test_out_of_range_default_joint_vel(sim, device): | |||
|
|
|||
|
|
|||
| @pytest.mark.parametrize("num_articulations", [2]) | |||
| @pytest.mark.parametrize("device", test_devices()) | |||
| @pytest.mark.parametrize("device", test_devices(DeviceScope.CUDA)) | |||
There was a problem hiding this comment.
CPU termination coverage removed
This decorator drops the existing CPU check of joint_effort_out_of_limit. The new composite tests check effort limits and motion, but do not call the termination function, so a CPU-specific regression there would go unnoticed. Please keep the CPU parameter.
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!
Replace the static-method fixture helper with a module function, read backend storage through bound getters instead of getattr on known names, share one context for suppressing Newton model-change notifications, reuse the timestamped-cache helpers in the joint-state case, complete return annotations, and word comments by their current constraint.
Allocate per-joint expectations directly, map the islands and read the Jacobians through explicit attributes, read the implicit-model class flag directly, drop redundant contiguous copies, and document the kinematics helpers with units and shapes.
Inline the one-line Warp-to-torch helper, read the implicit-model class flag directly, and annotate the scene-owning tests and the fixture.
…r/asset-tests-p01-contract
Run the index-resolution cases on OVPhysX, which implements the joint and body helpers, and drop the capability every backend now shares. Make the PhysX recording setters reject compact data instead of accepting it. Move the tendon shape negatives into their own case so the Newton mask xfail covers exactly the torch or warp oversized input it pins.
- Give the moving links of the floating island center-of-mass offsets before checking its Jacobians, so the link-origin shift is observable. - Check the cold direct-view mass and inertia read on the reordered island, whose inertial buffers no other test reads, so the check does not depend on test order; restore the properties the drive test uses. - Compare the multi-body wrench response of the reordered island with the identity-ordered island body by body, using the same actuators. - Mark the drive and dynamics test for the Isaac Sim CI selection. - Remove the single-joint articulation configs no remaining test uses.
Direct tensor-view mass and inertia writes must be visible on the first read of a buffer that no update has primed. The composite fixture now takes that read on the identity-order floating island right after sim.reset(), so the check no longer depends on which tests ran first.
…antoiner/asset-tests-p12-physx-articulation-regressions # Conflicts: # source/isaaclab_physx/test/assets/test_articulation.py
…set-tests-p12-physx-articulation-regressions
The spatial tendon node writes rows through unsorted int64 environment ids, which the deleted spatial tendon test covered. The Shadow Hand fixed tendon test runs on every available device again.
Read the friction, inertial, and wrench-response buffers through their properties instead of getattr on attribute names.
…antoiner/asset-tests-p12-physx-articulation-regressions
Replace the getattr lookups of setters and data buffers in the spatial tendon node with a helper that calls each setter, and share one loop for the environment 1 and unsorted int64 partial writes.
Description
Part 6/13 of the asset-test series (tracker: #7282). Scope: PhysX articulation. Depends on #8134, which brings in #8131; this branch contains their commits until they merge.
What changed
source/isaaclab_physx/test/assets/test_articulation.pynow runs most checks on one module-scoped scene built from the local branching fixture (data/articulation_ordering_branching.usda) instead of per-test Nucleus robots. The test authors link geometry, USD drives, limits, and optional structure at runtime. The scene has four two-environment islands, so partial writes target environment 1 and prove environment 0 is preserved in the real PhysX state:ordered: fixed base, MJWarp joint and body ordering, gains and limits loaded from USD.floating: articulation root discovered on the base link below the spawned prim; configured dict gains and limits.reordered: floating, with an explicit root path and a non-involutive body order that moves the root link.tendon: fixed base, with a reversed joint and a spatial tendon.Six composite nodes:
floatingisland right aftersim.reset(), so the check does not depend on which nodes ran first. The node restores the properties the drive node uses.developJacobian and mass-matrix refresh loop after a manual joint write runs verbatim on the fixed and floating islands.[1, 0]), each read back from the PhysX view.Tests that need their own simulation context run above the composite section, because a new context would replace the composite stage:
Also in this PR:
test_articulation_kernels.pymoves unchanged tounit/test_physx_articulation.py.source/isaaclab/test/envs/mdp/test_terminations.py: a unit test forjoint_effort_out_of_limit. With two of three joints selected, it checks that the term terminates exactly the environments whose applied effort differs from the computed effort on any selected joint: one selected joint clipped terminates, both clipped terminates, none clipped does not, and only the unselected joint clipped does not. The term is backend independent, so this unit replaces the Nucleus Frankatest_joint_effort_limits, which only tested all-clipped and none-clipped for every environment at once.computed_torque/applied_torquealiases thattest_joint_effort_limitsexercised implicitly (test_deprecated_command_aliases_return_actuator_collection_buffers).Disposition
Keepers are in this PR unless stated. "Mutation" means a one-line production change that turns the keeper red; each was checked red on the keeper and reverted.
test_live_manual_root_preserving_ordering_reorders_backend_reads_and_writestest_reversed_joint_dynamics_use_public_joint_basistendon)test_live_floating_root_writers_match_identity_after_body_reorderingtest_live_direct_view_mass_inertia_writes_become_visibletest_branching_fixture_resolves_distinct_conventionstest_initialization_floating_base,test_initialization_fixed_baseis_fixed_basenegatedtest_initialization_floating_base_made_fixed_base,test_initialization_fixed_base_made_floating_baseisaaclab/test/sim/test_articulation_fragments.py(develop)fix_articulation_rootskipped; fixed joint left enabledtest_joint_pos_limitsset_dof_limitsskipped; default clamp disabledtest_external_force_on_single_body,test_external_force_on_single_body_at_position,test_external_force_on_multiple_bodies,test_external_force_on_multiple_bodies_at_positionis_globalnegated; torques zeroed; wrench body reorder inverted (red on cpu and cuda:0)test_loading_gains_from_usd,test_setting_gains_from_cfgset_dof_stiffnessesskippedtest_setting_velocity_limit_writes_to_solver,test_setting_effort_limit_writes_to_solvertest_resettest_apply_joint_commandtest_body_root_statetest_write_root_stateitest_write_joint_state_data_consistencytest_write_joint_frictions_to_simtest_get_jacobians_link_origin_contracttest_dynamics_refresh_after_manual_joint_writetest_spatial_tendons_resolve_env_idssorts tensor selectorstest_out_of_range_default_joint_pos,test_out_of_range_default_joint_veltest_out_of_range_default_joint_state_raisestest_setting_articulation_root_prim_path,test_setting_invalid_articulation_root_prim_pathtest_setting_invalid_articulation_root_prim_path; explicit root path on thereorderedislandarticulation_root_prim_pathignoredtest_joint_effort_limitstest_terminations.py; #8134 alias contracttorch.isclosenegation dropped;torch.anyreduced withtorch.alltest_fixed_tendon_position_target_writes_offsettest_get_gravity_compensation_forces_static_equilibrium,test_franka_ik_tracking_accuracyThe raw articulation material round trip from the original PR is not added: it only reads back what it wrote through the PhysX view.
Devices and CI selection
developdevice scope: the Shadow Hand test runs on every device, the initialization-failure and Franka tests on CUDA.@pytest.mark.isaacsim_ciis on the drives-and-dynamics node, which keeps the two markeddevelopteststest_get_jacobians_link_origin_contractandtest_dynamics_refresh_after_manual_joint_write, and on the two Franka tests, as ondevelop.Timing
Warm Warp cache, repository orchestrator (
pytest tools), one process per file, second of two runs, RTX 5090.developis 09b1d54; this branch is 0e24859.Times are the per-file process wall times the orchestrator reports, including interpreter and Kit startup.
developtest_articulation.pytest_articulation_kernels.py→unit/test_physx_articulation.py(moved)source/isaaclab/test/envs/mdp/test_terminations.py(new)About 5 s of what remains in
test_articulation.pyis the three shipped-asset tests (Shadow Hand, Franka gravity compensation, Franka IK).Found while writing this (not fixed, not pinned)
get_jacobians) leaves the other articulations' body poses stale until the next step, althoughupdate_kinematicsruns. The drives node reads body state before Jacobians to avoid this.set_comswrite reaches kinematic velocity updates only on the next step. The node steps once after its COM write.body_link_pose_wbefore the step avoids it; the multi-body wrench check does that.Type of change
Release backport
developChecklist
Docker and GPU tests run on demand. Push the commits you want tested, then
comment
run-cion the pull request.pre-commitchecks withuv run isaaclab --formatsource/<pkg>/changelog.d/for every touched package (do not editCHANGELOG.rstor bump package versions — CI handles that)CONTRIBUTORS.mdor my name already exists there