Unverified Commit 6ae3c3fb authored by Mayank Mittal's avatar Mayank Mittal Committed by GitHub

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

<!-- As you go through the list, delete the ones that are not
applicable. -->

- 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
parent bac97356
[package] [package]
# Note: Semantic Versioning is used: https://semver.org/ # Note: Semantic Versioning is used: https://semver.org/
version = "0.9.22" version = "0.9.23"
# Description # Description
title = "ORBIT framework for Robot Learning" title = "ORBIT framework for Robot Learning"
......
Changelog 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) 0.9.22 (2023-10-26)
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
......
...@@ -57,18 +57,16 @@ class AssetBase(ABC): ...@@ -57,18 +57,16 @@ class AssetBase(ABC):
# note: Use weakref on all callbacks to ensure that this object can be deleted when its destructor is called. # 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 # 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 # 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() physx_event_stream = omni.physx.acquire_physx_interface().get_simulation_event_stream_v2()
self._initialize_handle = physx_interface.get_simulation_event_stream_v2().create_subscription_to_pop_by_type( self._initialize_handle = physx_event_stream.create_subscription_to_pop_by_type(
int(omni.physx.bindings._physx.SimulationEvent.RESUMED), int(omni.physx.bindings._physx.SimulationEvent.RESUMED),
lambda event, obj=weakref.proxy(self): obj._initialize_callback(event), lambda event, obj=weakref.proxy(self): obj._initialize_callback(event),
order=10, order=10,
) )
self._invalidate_initialize_handle = ( self._invalidate_initialize_handle = physx_event_stream.create_subscription_to_pop_by_type(
physx_interface.get_simulation_event_stream_v2().create_subscription_to_pop_by_type( int(omni.physx.bindings._physx.SimulationEvent.STOPPED),
int(omni.physx.bindings._physx.SimulationEvent.STOPPED), lambda event, obj=weakref.proxy(self): obj._invalidate_initialize_callback(event),
lambda event, obj=weakref.proxy(self): obj._invalidate_initialize_callback(event), order=10,
order=10,
),
) )
# add callback for debug visualization # add callback for debug visualization
if self.cfg.debug_vis: if self.cfg.debug_vis:
......
...@@ -54,18 +54,16 @@ class SensorBase(ABC): ...@@ -54,18 +54,16 @@ class SensorBase(ABC):
# note: Use weakref on callbacks to ensure that this object can be deleted when its destructor is called. # note: Use weakref on callbacks to ensure that this object can be deleted when its destructor is called.
# add callbacks for stage play/stop # 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 # 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() physx_event_stream = omni.physx.acquire_physx_interface().get_simulation_event_stream_v2()
self._initialize_handle = physx_interface.get_simulation_event_stream_v2().create_subscription_to_pop_by_type( self._initialize_handle = physx_event_stream.create_subscription_to_pop_by_type(
int(omni.physx.bindings._physx.SimulationEvent.RESUMED), int(omni.physx.bindings._physx.SimulationEvent.RESUMED),
lambda event, obj=weakref.proxy(self): obj._initialize_callback(event), lambda event, obj=weakref.proxy(self): obj._initialize_callback(event),
order=10, order=10,
) )
self._invalidate_initialize_handle = ( self._invalidate_initialize_handle = physx_event_stream.create_subscription_to_pop_by_type(
physx_interface.get_simulation_event_stream_v2().create_subscription_to_pop_by_type( int(omni.physx.bindings._physx.SimulationEvent.STOPPED),
int(omni.physx.bindings._physx.SimulationEvent.STOPPED), lambda event, obj=weakref.proxy(self): obj._invalidate_initialize_callback(event),
lambda event, obj=weakref.proxy(self): obj._invalidate_initialize_callback(event), order=10,
order=10,
),
) )
# add callback for debug visualization # add callback for debug visualization
if self.cfg.debug_vis: if self.cfg.debug_vis:
......
...@@ -115,7 +115,7 @@ def main(): ...@@ -115,7 +115,7 @@ def main():
robot.set_joint_position_target(robot.data.default_joint_pos.clone()) robot.set_joint_position_target(robot.data.default_joint_pos.clone())
robot.write_data_to_sim() robot.write_data_to_sim()
# perform step # perform step
sim.step(render=app_launcher.RENDER) sim.step()
# update sim-time # update sim-time
sim_time += sim_dt sim_time += sim_dt
count += 1 count += 1
......
...@@ -147,7 +147,7 @@ class TestArticulation(unittest.TestCase): ...@@ -147,7 +147,7 @@ class TestArticulation(unittest.TestCase):
robot.set_joint_position_target(robot.data.default_joint_pos.clone()) robot.set_joint_position_target(robot.data.default_joint_pos.clone())
robot.write_data_to_sim() robot.write_data_to_sim()
# perform step # perform step
self.sim.step(render=app_launcher.RENDER) self.sim.step()
# update buffers # update buffers
robot.update(self.dt) robot.update(self.dt)
# check condition that the robots have fallen down # check condition that the robots have fallen down
...@@ -194,7 +194,7 @@ class TestArticulation(unittest.TestCase): ...@@ -194,7 +194,7 @@ class TestArticulation(unittest.TestCase):
robot.set_joint_position_target(robot.data.default_joint_pos.clone()) robot.set_joint_position_target(robot.data.default_joint_pos.clone())
robot.write_data_to_sim() robot.write_data_to_sim()
# perform step # perform step
self.sim.step(render=app_launcher.RENDER) self.sim.step()
# update buffers # update buffers
robot.update(self.dt) robot.update(self.dt)
# check condition # check condition
......
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