Unverified Commit 1928161b authored by fyu-bdai's avatar fyu-bdai Committed by GitHub

Fixes loading of ContactSensor when using it in an extension (#529)

# 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
parent 2dfc463a
[package]
# Note: Semantic Versioning is used: https://semver.org/
version = "0.16.4"
version = "0.16.5"
# Description
title = "ORBIT framework for Robot Learning"
......
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)
......
......@@ -58,6 +58,8 @@ class ContactSensor(SensorBase):
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."""
......
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