Fix ovphysx reset-velocity cache staleness and slow ASCII warmup export#6628
Fix ovphysx reset-velocity cache staleness and slow ASCII warmup export#6628ClemensSchwarke wants to merge 1 commit into
Conversation
Greptile SummaryThis PR fixes two independent bugs in the
Confidence Score: 4/5Both fixes are minimal and targeted — the cache invalidation change mirrors an identical pattern already in The core changes are straightforward and well-understood. The regression test covers the angular velocity path but leaves the linear and com-frame counterparts untested; a future regression on those three buffers would go undetected by this test suite. The regression test in Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Caller
participant Articulation
participant ArticulationData
participant TimestampedBuffer
Note over Caller,TimestampedBuffer: Velocity write path (after fix)
Caller->>Articulation: write_root_velocity_to_sim_index(root_velocity)
Articulation->>ArticulationData: "_reset_velocity(from_com=True)"
ArticulationData->>TimestampedBuffer: reset_timestamps([..., _root_link_lin_vel_b, _root_link_ang_vel_b, _root_com_lin_vel_b, _root_com_ang_vel_b, ...])
Note over TimestampedBuffer: timestamps set below sim_timestamp
Caller->>ArticulationData: root_ang_vel_b (property read)
ArticulationData->>TimestampedBuffer: "check _root_link_ang_vel_b.timestamp < sim_timestamp"
TimestampedBuffer-->>ArticulationData: stale, recompute
ArticulationData->>ArticulationData: wp.launch(_world_vel_to_body_ang, root_link_pose_w, root_link_vel_w)
ArticulationData-->>Caller: fresh body-frame angular velocity
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Caller
participant Articulation
participant ArticulationData
participant TimestampedBuffer
Note over Caller,TimestampedBuffer: Velocity write path (after fix)
Caller->>Articulation: write_root_velocity_to_sim_index(root_velocity)
Articulation->>ArticulationData: "_reset_velocity(from_com=True)"
ArticulationData->>TimestampedBuffer: reset_timestamps([..., _root_link_lin_vel_b, _root_link_ang_vel_b, _root_com_lin_vel_b, _root_com_ang_vel_b, ...])
Note over TimestampedBuffer: timestamps set below sim_timestamp
Caller->>ArticulationData: root_ang_vel_b (property read)
ArticulationData->>TimestampedBuffer: "check _root_link_ang_vel_b.timestamp < sim_timestamp"
TimestampedBuffer-->>ArticulationData: stale, recompute
ArticulationData->>ArticulationData: wp.launch(_world_vel_to_body_ang, root_link_pose_w, root_link_vel_w)
ArticulationData-->>Caller: fresh body-frame angular velocity
Reviews (1): Last reviewed commit: "fix ovphysx reset-velocity cache stalene..." | Re-trigger Greptile |
| # the body-frame angular velocity must reflect the write; its norm is rotation-invariant (= 5) | ||
| ang_after = articulation.data.root_ang_vel_b.torch | ||
| torch.testing.assert_close( | ||
| ang_after.norm(dim=-1), torch.full((num_articulations,), 5.0, device=device), atol=1e-3, rtol=1e-3 | ||
| ) | ||
| # and it must actually differ from the stale pre-write value | ||
| assert not torch.allclose(ang_after, ang_before) |
There was a problem hiding this comment.
root_lin_vel_b and root_com_* cache invalidations not exercised
The test verifies root_ang_vel_b after the velocity write but skips root_lin_vel_b, root_com_lin_vel_b, and root_com_ang_vel_b, all of which received matching invalidation entries in _reset_velocity. Linear velocity norm is equally rotation-invariant (3.0 in the test setup), so adding assert_close(lin_after.norm(dim=-1), torch.full(..., 3.0, ...)) and the analogous root_com_* assertions would give full coverage of the four newly-invalidated buffers.
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.
If we do this tests here we should probably add it to the other backends.
|
Working on a PR that will fix it on all backend. |
Description
Fixes two issues I encountered in the velocity env cleanup.
Type of change