Skip to content

Commit

Permalink
Fixes loading of ContactSensor when using it in an extension (#529)
Browse files Browse the repository at this point in the history
# Description

This MR initializes `self._body_physx_view = None` in the init method of the
`ContactSensor` class.

This is needed to use ContactSensors with `debug_vis=True` while running
Orbit as an extension, such as EvalSim.

Currently, `ContactSensor._initialize_impl` initializes and sets the
value of `self._body_physx_view`. However, when running in extension
mode, `ContactSensor._initialize_impl` is called _after_
`ContactSensor._debug_vis_callback`, which causes an error to appear
upon loading an environment because `ContactSensor._debug_vis_callback`
references `self._body_physx_view` that have not been initialized.

With `self._body_physx_vew` initialized to None in the init method of
`ContactSensor`, it allows `ContactSensor._debug_vis_callback` to be
safely called before `ContactSensor._initialize_impl`.

## 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 run all the tests with `./orbit.sh --test` and they pass
- [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
  • Loading branch information
fyu-bdai authored May 22, 2024
1 parent 2dfc463 commit 1928161
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion source/extensions/omni.isaac.orbit/config/extension.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

# Note: Semantic Versioning is used: https://semver.org/
version = "0.16.4"
version = "0.16.5"

# Description
title = "ORBIT framework for Robot Learning"
Expand Down
16 changes: 14 additions & 2 deletions source/extensions/omni.isaac.orbit/docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
Changelog
---------

0.16.5 (2024-05-22)
~~~~~~~~~~~~~~~~~~~

Fixed
^^^^^

* Fixed :class:`omni.isaac.orbit.sensor.ContactSensor` not loading correctly in extension mode.
Earlier, the :attr:`omni.isaac.orbit.sensor.ContactSensor.body_physx_view` was not initialized when
:meth:`omni.isaac.orbit.sensor.ContactSensor._debug_vis_callback` is called which references it.


0.16.4 (2024-05-15)
~~~~~~~~~~~~~~~~~~~

Fixed
^^^^^

* Fixed compound classes being directly assigned in ``default_factory`` generator method :meth:`omni.isaac.orbit.utils.configclass._return_f`,
which resulted in shared references such that modifications to compound objects were reflected across all instances generated from the same ``default_factory`` method.
* Fixed compound classes being directly assigned in ``default_factory`` generator method
:meth:`omni.isaac.orbit.utils.configclass._return_f`, which resulted in shared references such that modifications to
compound objects were reflected across all instances generated from the same ``default_factory`` method.


0.16.3 (2024-05-13)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ def __init__(self, cfg: ContactSensorCfg):
super().__init__(cfg)
# Create empty variables for storing output data
self._data: ContactSensorData = ContactSensorData()
# initialize self._body_physx_view for running in extension mode
self._body_physx_view = None

def __str__(self) -> str:
"""Returns: A string containing information about the instance."""
Expand Down

0 comments on commit 1928161

Please sign in to comment.