From 6ae3c3fbed4a99689f3b45e8dc3baab6b8971b0c Mon Sep 17 00:00:00 2001 From: Mayank Mittal <12863862+Mayankm96@users.noreply.github.com> Date: Fri, 27 Oct 2023 13:45:16 +0200 Subject: [PATCH] Fixes typo in constructor for physics events (#217) # Description This MR fixes a bug introduced in #207 which was assigning tuples to the `invalidate_handle` member in `AssetBase` and `SensorBase`. ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Checklist - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./orbit.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 --- .../omni.isaac.orbit/config/extension.toml | 2 +- .../extensions/omni.isaac.orbit/docs/CHANGELOG.rst | 10 ++++++++++ .../omni/isaac/orbit/assets/asset_base.py | 14 ++++++-------- .../omni/isaac/orbit/sensors/sensor_base.py | 14 ++++++-------- .../test/assets/check_external_force.py | 2 +- .../test/assets/test_articulation.py | 4 ++-- 6 files changed, 26 insertions(+), 20 deletions(-) diff --git a/source/extensions/omni.isaac.orbit/config/extension.toml b/source/extensions/omni.isaac.orbit/config/extension.toml index a1a8390772..10c55de245 100644 --- a/source/extensions/omni.isaac.orbit/config/extension.toml +++ b/source/extensions/omni.isaac.orbit/config/extension.toml @@ -1,7 +1,7 @@ [package] # Note: Semantic Versioning is used: https://semver.org/ -version = "0.9.22" +version = "0.9.23" # Description title = "ORBIT framework for Robot Learning" diff --git a/source/extensions/omni.isaac.orbit/docs/CHANGELOG.rst b/source/extensions/omni.isaac.orbit/docs/CHANGELOG.rst index 9c07bd058a..f73af2cf92 100644 --- a/source/extensions/omni.isaac.orbit/docs/CHANGELOG.rst +++ b/source/extensions/omni.isaac.orbit/docs/CHANGELOG.rst @@ -1,6 +1,16 @@ Changelog --------- +0.9.23 (2023-10-27) +~~~~~~~~~~~~~~~~~~~ + +Fixed +^^^^^ + +* Fixed a typo in the :class:`AssetBase` and :class:`SensorBase` that effected the class destructor. + Earlier, a tuple was being created in the constructor instead of the actual object. + + 0.9.22 (2023-10-26) ~~~~~~~~~~~~~~~~~~~ diff --git a/source/extensions/omni.isaac.orbit/omni/isaac/orbit/assets/asset_base.py b/source/extensions/omni.isaac.orbit/omni/isaac/orbit/assets/asset_base.py index 2defad1653..22d070aa83 100644 --- a/source/extensions/omni.isaac.orbit/omni/isaac/orbit/assets/asset_base.py +++ b/source/extensions/omni.isaac.orbit/omni/isaac/orbit/assets/asset_base.py @@ -57,18 +57,16 @@ def __init__(self, cfg: AssetBaseCfg): # note: Use weakref on all callbacks to ensure that this object can be deleted when its destructor is called. # add callbacks for stage play/stop # The order is set to 10 which is arbitrary but should be lower priority than the default order of 0 - physx_interface = omni.physx.acquire_physx_interface() - self._initialize_handle = physx_interface.get_simulation_event_stream_v2().create_subscription_to_pop_by_type( + physx_event_stream = omni.physx.acquire_physx_interface().get_simulation_event_stream_v2() + self._initialize_handle = physx_event_stream.create_subscription_to_pop_by_type( int(omni.physx.bindings._physx.SimulationEvent.RESUMED), lambda event, obj=weakref.proxy(self): obj._initialize_callback(event), order=10, ) - self._invalidate_initialize_handle = ( - physx_interface.get_simulation_event_stream_v2().create_subscription_to_pop_by_type( - int(omni.physx.bindings._physx.SimulationEvent.STOPPED), - lambda event, obj=weakref.proxy(self): obj._invalidate_initialize_callback(event), - order=10, - ), + self._invalidate_initialize_handle = physx_event_stream.create_subscription_to_pop_by_type( + int(omni.physx.bindings._physx.SimulationEvent.STOPPED), + lambda event, obj=weakref.proxy(self): obj._invalidate_initialize_callback(event), + order=10, ) # add callback for debug visualization if self.cfg.debug_vis: diff --git a/source/extensions/omni.isaac.orbit/omni/isaac/orbit/sensors/sensor_base.py b/source/extensions/omni.isaac.orbit/omni/isaac/orbit/sensors/sensor_base.py index 388b08a4cd..e069387ef9 100644 --- a/source/extensions/omni.isaac.orbit/omni/isaac/orbit/sensors/sensor_base.py +++ b/source/extensions/omni.isaac.orbit/omni/isaac/orbit/sensors/sensor_base.py @@ -54,18 +54,16 @@ def __init__(self, cfg: SensorBaseCfg): # note: Use weakref on callbacks to ensure that this object can be deleted when its destructor is called. # add callbacks for stage play/stop # The order is set to 10 which is arbitrary but should be lower priority than the default order of 0 - physx_interface = omni.physx.acquire_physx_interface() - self._initialize_handle = physx_interface.get_simulation_event_stream_v2().create_subscription_to_pop_by_type( + physx_event_stream = omni.physx.acquire_physx_interface().get_simulation_event_stream_v2() + self._initialize_handle = physx_event_stream.create_subscription_to_pop_by_type( int(omni.physx.bindings._physx.SimulationEvent.RESUMED), lambda event, obj=weakref.proxy(self): obj._initialize_callback(event), order=10, ) - self._invalidate_initialize_handle = ( - physx_interface.get_simulation_event_stream_v2().create_subscription_to_pop_by_type( - int(omni.physx.bindings._physx.SimulationEvent.STOPPED), - lambda event, obj=weakref.proxy(self): obj._invalidate_initialize_callback(event), - order=10, - ), + self._invalidate_initialize_handle = physx_event_stream.create_subscription_to_pop_by_type( + int(omni.physx.bindings._physx.SimulationEvent.STOPPED), + lambda event, obj=weakref.proxy(self): obj._invalidate_initialize_callback(event), + order=10, ) # add callback for debug visualization if self.cfg.debug_vis: diff --git a/source/extensions/omni.isaac.orbit/test/assets/check_external_force.py b/source/extensions/omni.isaac.orbit/test/assets/check_external_force.py index 8075a7e243..5619b6b613 100644 --- a/source/extensions/omni.isaac.orbit/test/assets/check_external_force.py +++ b/source/extensions/omni.isaac.orbit/test/assets/check_external_force.py @@ -115,7 +115,7 @@ def main(): robot.set_joint_position_target(robot.data.default_joint_pos.clone()) robot.write_data_to_sim() # perform step - sim.step(render=app_launcher.RENDER) + sim.step() # update sim-time sim_time += sim_dt count += 1 diff --git a/source/extensions/omni.isaac.orbit/test/assets/test_articulation.py b/source/extensions/omni.isaac.orbit/test/assets/test_articulation.py index 13ba0433f5..433cb04b71 100644 --- a/source/extensions/omni.isaac.orbit/test/assets/test_articulation.py +++ b/source/extensions/omni.isaac.orbit/test/assets/test_articulation.py @@ -147,7 +147,7 @@ def test_external_force_on_single_body(self): robot.set_joint_position_target(robot.data.default_joint_pos.clone()) robot.write_data_to_sim() # perform step - self.sim.step(render=app_launcher.RENDER) + self.sim.step() # update buffers robot.update(self.dt) # check condition that the robots have fallen down @@ -194,7 +194,7 @@ def test_external_force_on_multiple_bodies(self): robot.set_joint_position_target(robot.data.default_joint_pos.clone()) robot.write_data_to_sim() # perform step - self.sim.step(render=app_launcher.RENDER) + self.sim.step() # update buffers robot.update(self.dt) # check condition