Skip to content

Fix physics sensor create return type annotation - #777

Open
sylvesterkaczmarek wants to merge 4 commits into
isaac-sim:mainfrom
sylvesterkaczmarek:fix/imu-create-return-type
Open

Fix physics sensor create return type annotation#777
sylvesterkaczmarek wants to merge 4 commits into
isaac-sim:mainfrom
sylvesterkaczmarek:fix/imu-create-return-type

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown

Description

Fix the static return type of physics sensor authoring factories, including IMU.create().

_PhysicsSensorAuthoring.create() constructs cls(...), but its return annotation names the private _PhysicsSensorAuthoring base class. Static type checkers therefore infer calls such as IMU.create(...) as the base type even though the runtime object is an IMU.

Use typing.Self for the shared classmethod return type. This preserves the existing implementation and runtime behavior while allowing type checkers to infer the concrete subclass correctly for IMU and the other physics sensor authoring classes.

Validation

  • final production diff is two annotation/import lines in the shared sensor base
  • no runtime creation logic or public API behavior changes
  • the annotation now matches the existing return cls(...) implementation

Fixes #771.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] (Minor) IMU type checking failing

1 participant