Unverified Commit 818ff410 authored by Mayank Mittal's avatar Mayank Mittal Committed by GitHub

Fixes no update of outdated sensors (#315)

# Description

Our previous reasoning of not updating the sensors since the 'scene' is
not updated does not work well on resets. It was done assuming the
update is called right after reset. However, nowhere in the code, this
seems to be the case anymore.

This MR makes sure sensors are always updated when they are reset. The
reset method should set values to zeros or defaults when the sensor data
is invalid.

## Type of change

- Bug fix (non-breaking change which fixes an issue)
- This change requires a documentation update

## 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
- [ ] 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 204d1744
......@@ -79,8 +79,8 @@ frame of the robot. The offset is specified as a translation and rotation relati
and the :attr:`~sensors.CameraCfg.OffsetCfg.convention` in which the offset is specified.
In the following, we show the configuration of the camera sensor used in this tutorial. We set the
update period to 0s to update the sensor at simulation frequency. The prim path is set to
``{ENV_REGEX_NS}/Robot/base/front_cam`` where the ``{ENV_REGEX_NS}`` is the namespace of the environment,
update period to 0.1s, which means that the camera sensor is updated at 10Hz. The prim path expression is
set to ``{ENV_REGEX_NS}/Robot/base/front_cam`` where the ``{ENV_REGEX_NS}`` is the environment namespace,
``"Robot"`` is the name of the robot, ``"base"`` is the name of the prim to which the camera is attached,
and ``"front_cam"`` is the name of the prim associated with the camera sensor.
......
......@@ -320,8 +320,6 @@ class Camera(SensorBase):
# note: this recomputation is useful if one performs randomization on the camera poses.
self._update_poses(env_ids)
self._update_intrinsic_matrices(env_ids)
# Set all reset sensors to not outdated since their value won't be updated till next sim step.
self._is_outdated[env_ids] = False
# Reset the frame count
self._frame[env_ids] = 0
......
......@@ -134,8 +134,6 @@ class ContactSensor(SensorBase):
if self.cfg.track_air_time:
self._data.current_air_time[env_ids] = 0.0
self._data.last_air_time[env_ids] = 0.0
# Set all reset sensors to not outdated since their value won't be updated till next sim step.
self._is_outdated[env_ids] = False
def find_bodies(self, name_keys: str | Sequence[str]) -> tuple[list[int], list[str]]:
"""Find bodies in the articulation based on the name keys.
......
......@@ -102,8 +102,6 @@ class FrameTransformer(SensorBase):
# resolve None
if env_ids is None:
env_ids = ...
# Set all reset sensors to not outdated since their value won't be updated till next sim step.
self._is_outdated[env_ids] = False
"""
Implementation.
......
......@@ -146,8 +146,6 @@ class RayCasterCamera(RayCaster):
pos_w, quat_w = self._compute_camera_world_poses(env_ids)
self._data.pos_w[env_ids] = pos_w
self._data.quat_w_world[env_ids] = quat_w
# Set all reset sensors to not outdated since their value won't be updated till next sim step.
self._is_outdated[env_ids] = False
# Reset the frame count
self._frame[env_ids] = 0
......
......@@ -73,7 +73,7 @@ class SensorsSceneCfg(InteractiveSceneCfg):
# sensors
camera = CameraCfg(
prim_path="{ENV_REGEX_NS}/Robot/base/front_cam",
update_period=0.0,
update_period=0.1,
height=480,
width=640,
data_types=["rgb", "distance_to_image_plane"],
......
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