-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[Newton]Replaces PhysxSchema API call with string Token get and set #4102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Newton]Replaces PhysxSchema API call with string Token get and set #4102
Conversation
Greptile OverviewGreptile SummaryThis PR removes the dependency on Key Changes:
Critical Issue Found:
Confidence Score: 2/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Client as Client Code
participant Utils as sim/utils.py
participant Schemas as sim/schemas/schemas.py
participant Prim as USD Prim
Note over Client,Prim: PhysxSchema API Removal Pattern
Client->>Schemas: modify_articulation_root_properties()
Schemas->>Prim: GetAppliedSchemas()
Prim-->>Schemas: List of schema names
Schemas->>Schemas: Check "PhysxArticulationAPI" in list
alt Schema not applied
Schemas->>Prim: AddAppliedSchema(Tf.Token("PhysxArticulationAPI"))
end
Schemas->>Utils: safe_set_attribute_on_usd_prim(prim, "PhysxArticulationAPI:attr", value)
Utils->>Utils: Convert to camel case if needed
Utils->>Utils: Determine SDF type from value
Utils->>Prim: GetAttribute(attr_name)
alt Attribute doesn't exist
Utils->>Prim: CreateAttribute(attr_name, sdf_type)
end
Utils->>Prim: attr.Set(value)
Note over Client,Prim: Schema Removal Pattern
Client->>Prim: RemoveAppliedSchema(Tf.Token("PhysxArticulationAPI"))
Note over Client,Prim: Before: Used PhysxSchema.PhysxArticulationAPI
Note over Client,Prim: After: Uses string tokens to avoid omni.physx dependency
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7 files reviewed, 1 comment
| for attr_name, value in cfg.items(): | ||
| safe_set_attribute_on_usd_prim(parent_prim, f"PhysxArticulationAPI:{attr_name}", value, camel_case=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: copies only cfg attributes, not existing PhysX attributes from articulation_prim
original code iterated over all schema attributes from the prim, this only sets attributes in cfg. any existing PhysX articulation attributes not in cfg will be lost
| for attr_name, value in cfg.items(): | |
| safe_set_attribute_on_usd_prim(parent_prim, f"PhysxArticulationAPI:{attr_name}", value, camel_case=True) | |
| # -- physx attributes | |
| for attr in articulation_prim.GetAttributes(): | |
| if not attr.GetName().startswith("physxArticulation:"): | |
| continue | |
| parent_attr = parent_prim.GetAttribute(attr.GetName()) | |
| if not parent_attr: | |
| parent_attr = parent_prim.CreateAttribute(attr.GetName(), attr.GetTypeName()) | |
| parent_attr.Set(attr.Get()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Let's get the merges in quickly and see what breaks later :D
|
@ooctipus Could you resolve the merge conflicts? It's not straight forward, and I don't have time to do it. Thanks! :D |
217b510 to
8cb922d
Compare
|
Done : )) |
Description
PhysxSchema requires omni.physx packages which is not available if ov is not available. Since it is not a pxr pacakge, we use string rather than api to avoid dependency on ov.
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there