Commit 4afb31b
committed
Rework FabricFrameView to use indexedfabricarray + Fabric localMatrix
Adopts the prototype design from bareya/pbarejko/camera-update for
FabricFrameView's transform handling, and replaces the previous
software composition of local poses (which forced a Python USD parent
loop and made get_local_poses 3x slower than USD).
Architecture changes:
* Three persistent ``PrimSelection`` instances (trans_ro, world_rw,
local_rw), differing only in per-attribute access mode. Replaces
the single selection that required a custom ``isaaclab:view_index``
attribute on every prim.
* Path-based view -> fabric index computation: the integer mapping is
derived once from ``selection.GetPaths()`` and stored as a Warp
array. No prim attributes are added to the stage.
* All transform reads and writes go through ``wp.indexedfabricarray``,
so kernels just dereference ``ifa[view_index]`` without a separate
mapping argument. The two new indexed kernels live next to the
existing ones in ``isaaclab.utils.warp.fabric``.
* Stage-level ``IFabricHierarchy`` cache and dirty-stage set: multiple
FabricFrameView instances on the same stage share one hierarchy.
Local-pose path:
* ``set_local_poses`` writes ``omni:fabric:localMatrix`` directly
through Fabric and marks the stage dirty. The next ``get_world_poses``
fires a Warp kernel that recomputes ``child_world = parent_world *
child_local`` (we cannot rely on ``IFabricHierarchy.update_world_xforms``
-- in practice it re-reads USD's authored xformOps and overwrites the
Fabric matrices we just authored).
* Symmetrically, ``set_world_poses`` runs a kernel that recomputes
``child_local = inv(parent_world) * child_world`` so subsequent
``get_local_poses`` calls return consistent values.
* Initial Fabric population reads through the internal ``UsdFrameView``
(children) and ``UsdGeom.XformCache`` (parents) and writes via the
same compose kernel set used at runtime. ``SetWorldXformFromUsd`` /
``SetLocalXformFromUsd`` are no-ops on author-then-query stages, so
we do this manually.
Performance impact (1024 prims, 50 iterations, A6000):
Operation USD (ms) Fabric (ms) Speedup
Get World Poses 13.56 0.067 201x
Set World Poses 29.97 0.123 244x
Interleaved Set->Get 43.78 0.159 276x
Get Local Poses 6.15 0.064 96x (was 0.31x SLOWER)
Set Local Poses 8.61 0.053 163x (was 0.42x SLOWER)
The two new indexed kernels added to ``isaaclab.utils.warp.fabric``:
* ``decompose_indexed_fabric_transforms`` -- like the existing
``decompose_fabric_transformation_matrix_to_warp_arrays`` but takes a
``wp.indexedfabricarray`` so the view->fabric mapping is baked in.
* ``compose_indexed_fabric_transforms`` -- mirror.
* ``update_indexed_local_matrix_from_world`` -- new: recomputes
``child_local = inv(parent_world) * child_world`` per child.
* ``update_indexed_world_matrix_from_local`` -- new: mirror.
Tests updated:
* ``test_fabric_rebuild_after_topology_change`` no longer monkey-patches
the removed ``_prepare_for_reuse`` / ``_rebuild_fabric_arrays`` helpers;
it now exercises ``_compute_fabric_indices`` and ``_build_indexed_array``
directly to simulate a rebuild.
* ``test_prepare_for_reuse_detects_topology_change`` verifies all three
persistent selections respond to ``PrepareForReuse`` (instead of the
removed single ``_fabric_selection``).
All 41 tests in ``test_views_xform_prim_fabric.py`` pass.1 parent a1183e9 commit 4afb31b
4 files changed
Lines changed: 677 additions & 379 deletions
File tree
- source
- isaaclab_physx
- changelog.d
- isaaclab_physx/sim/views
- test/sim
- isaaclab/isaaclab/utils/warp
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
163 | 165 | | |
164 | 166 | | |
165 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
166 | 340 | | |
167 | 341 | | |
168 | 342 | | |
| |||
Lines changed: 16 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
12 | 19 | | |
13 | | - | |
14 | | - | |
15 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
0 commit comments