Unverified Commit b3b45484 authored by Toni-SM's avatar Toni-SM Committed by GitHub

Caches PhysX view's joint paths when processing fixed articulation tendons (#1347)

# Description

Cache PhysX view's DOF paths before looping when processing fixed
articulation tendons to improve loading time.

For the Shadow Hand task, calling `self.root_physx_view.dof_paths` when
iterating over all joints to find tendons attached (in
`Articulation._process_fixed_tendons` method) is an "expensive"
operation. Timing can be reduced from 2.2 seconds to 300 milliseconds
(13th Gen Intel® Core i9-13950HX × 32, RTX 5000) by calling
`self.root_physx_view.dof_paths` once

## Screenshots

Without any change
![Screenshot from 2024-10-28
13-30-07](https://github.com/user-attachments/assets/0bd61f3d-3013-49fb-8540-c08236b974cf)

After cache PhysX view's DOF paths before looping
(`self.root_physx_view.dof_paths` called only once)
![Screenshot from 2024-10-28
13-26-02](https://github.com/user-attachments/assets/6c2af86e-bd21-4b65-9c13-9610e6648e8d)


## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
parent 05f5d1eb
[package] [package]
# Note: Semantic Versioning is used: https://semver.org/ # Note: Semantic Versioning is used: https://semver.org/
version = "0.27.9" version = "0.27.10"
# Description # Description
title = "Isaac Lab framework for Robot Learning" title = "Isaac Lab framework for Robot Learning"
......
Changelog Changelog
--------- ---------
0.27.10 (2024-11-01)
~~~~~~~~~~~~~~~~~~~~
Changed
^^^^^^^
* Cached the PhysX view's joint paths before looping over them when processing fixed joint tendons
inside the :class:`Articulation` class. This helps improve the processing time for the tendons.
0.27.9 (2024-11-01) 0.27.9 (2024-11-01)
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
......
...@@ -1190,10 +1190,11 @@ class Articulation(AssetBase): ...@@ -1190,10 +1190,11 @@ class Articulation(AssetBase):
# parse fixed tendons properties if they exist # parse fixed tendons properties if they exist
if self.num_fixed_tendons > 0: if self.num_fixed_tendons > 0:
stage = stage_utils.get_current_stage() stage = stage_utils.get_current_stage()
joint_paths = self.root_physx_view.dof_paths[0]
# iterate over all joints to find tendons attached to them # iterate over all joints to find tendons attached to them
for j in range(self.num_joints): for j in range(self.num_joints):
usd_joint_path = self.root_physx_view.dof_paths[0][j] usd_joint_path = joint_paths[j]
# check whether joint has tendons - tendon name follows the joint name it is attached to # check whether joint has tendons - tendon name follows the joint name it is attached to
joint = UsdPhysics.Joint.Get(stage, usd_joint_path) joint = UsdPhysics.Joint.Get(stage, usd_joint_path)
if joint.GetPrim().HasAPI(PhysxSchema.PhysxTendonAxisRootAPI): if joint.GetPrim().HasAPI(PhysxSchema.PhysxTendonAxisRootAPI):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment