Unverified Commit 4565902f authored by renezurbruegg's avatar renezurbruegg Committed by GitHub

Updates sensor data always if visualization enabled

# Description

This MR ensures that the sensor buffers are always updated in
visualization mode. Otherwise, the sensors are not visualizable without
someone accessing the `data` property.

## Type of change

- New feature (non-breaking change which adds functionality)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./orbit.sh --format`
- [x] 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
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
parent 7b0db156
[package]
# Note: Semantic Versioning is used: https://semver.org/
version = "0.9.50"
version = "0.9.51"
# Description
title = "ORBIT framework for Robot Learning"
......
Changelog
---------
0.9.51 (2023-11-29)
~~~~~~~~~~~~~~~~~~~
Changed
^^^^^^^
* Changed the :meth:`omni.isaac.orbit.sensor.SensorBase.update` method to always recompute the buffers if
the sensor is in visualization mode.
Added
^^^^^
* Added available entities to the error message when accessing a non-existent entity in the
:class:`InteractiveScene` class.
* Added a warning message when the user tries to reference an invalid prim in the :class:`FrameTransformer` sensor.
0.9.50 (2023-11-28)
~~~~~~~~~~~~~~~~~~~
......
......@@ -306,14 +306,17 @@ class InteractiveScene:
# check if it is a terrain
if key == "terrain":
return self.terrain
all_keys = ["terrain"]
# check if it is in other dictionaries
for asset_family in [self.articulations, self.rigid_objects, self.sensors, self.extras]:
out = asset_family.get(key)
# if found, return
if out is not None:
return out
all_keys += list(asset_family.keys())
# if not found, raise error
raise KeyError(f"Scene entity with key '{key}' not found.")
raise KeyError(f"Scene entity with key '{key}' not found. Available Entities: '{all_keys}'")
"""
Internal methods.
......
......@@ -151,7 +151,13 @@ class FrameTransformer(SensorBase):
frame_offsets = [None] + [target_frame.offset for target_frame in self.cfg.target_frames]
for frame, prim_path, offset in zip(frames, frame_prim_paths, frame_offsets):
# Find correct prim
for matching_prim_path in prim_utils.find_matching_prim_paths(prim_path):
matching_prims = prim_utils.find_matching_prim_paths(prim_path)
if len(matching_prims) == 0:
raise ValueError(
f"Failed to create frame transformer for frame '{frame}' with path '{prim_path}'."
" No matching prims were found."
)
for matching_prim_path in matching_prims:
prim = prim_utils.get_prim_at_path(matching_prim_path)
# check if it is a rigid prim
if not prim.HasAPI(UsdPhysics.RigidBodyAPI):
......
......@@ -51,6 +51,8 @@ class SensorBase(ABC):
self.cfg = cfg
# flag for whether the sensor is initialized
self._is_initialized = False
# flag for whether the sensor is in visualization mode
self._is_visualizing = False
# note: Use weakref on callbacks to ensure that this object can be deleted when its destructor is called.
# add callbacks for stage play/stop
......@@ -140,6 +142,8 @@ class SensorBase(ABC):
return False
# toggle debug visualization objects
self._set_debug_vis_impl(debug_vis)
# toggle debug visualization flag
self._is_visualizing = debug_vis
# toggle debug visualization handles
if debug_vis:
# create a subscriber for the post update event if it doesn't exist
......@@ -178,7 +182,7 @@ class SensorBase(ABC):
# Update the buffers
# TODO (from @mayank): Why is there a history length here when it doesn't mean anything in the sensor base?!?
# It is only for the contact sensor but there we should redefine the update function IMO.
if force_recompute or (self.cfg.history_length > 0):
if force_recompute or self._is_visualizing or (self.cfg.history_length > 0):
self._update_outdated_buffers()
"""
......
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