Unverified Commit f3c54041 authored by Pascal Roth's avatar Pascal Roth Committed by GitHub

Fixes pose update in `Camera` and `TiledCamera` (#2316)

# Description

Fixed `return_latest_camera_pose` option in `TiledCameraCfg` from not
being used to the argument `update_latest_camera_pose` in `CameraCfg`
with application in both `Camera` and `TiledCamera`.

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Checklist

- [ ] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.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
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [ ] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

---------
Signed-off-by: 's avatarKelly Guo <kellyg@nvidia.com>
Signed-off-by: 's avatarKelly Guo <kellyguo123@hotmail.com>
Co-authored-by: 's avatarKelly Guo <kellyg@nvidia.com>
Co-authored-by: 's avatarKelly Guo <kellyguo123@hotmail.com>
parent a52e0276
[package]
# Note: Semantic Versioning is used: https://semver.org/
version = "0.36.22"
version = "0.36.23"
# Description
title = "Isaac Lab framework for Robot Learning"
......
Changelog
---------
0.36.23 (2025-04-24)
~~~~~~~~~~~~~~~~~~~~
Fixed
^^^^^
* Fixed ``return_latest_camera_pose`` option in :class:`~isaaclab.sensors.TiledCameraCfg` from not being used to the
argument ``update_latest_camera_pose`` in :class:`~isaaclab.sensors.CameraCfg` with application in both
:class:`~isaaclab.sensors.Camera` and :class:`~isaaclab.sensors.TiledCamera`.
0.36.22 (2025-04-23)
~~~~~~~~~~~~~~~~~~~~
......
......@@ -510,7 +510,8 @@ class Camera(SensorBase):
# Increment frame count
self._frame[env_ids] += 1
# -- pose
self._update_poses(env_ids)
if self.cfg.update_latest_camera_pose:
self._update_poses(env_ids)
# -- read the data from annotator registry
# check if buffer is called for the first time. If so then, allocate the memory
if len(self._data.output) == 0:
......
......@@ -73,6 +73,14 @@ class CameraCfg(SensorBaseCfg):
height: int = MISSING
"""Height of the image in pixels."""
update_latest_camera_pose: bool = False
"""Whether to update the latest camera pose when fetching the camera's data. Defaults to False.
If True, the latest camera pose is updated in the camera's data which will slow down performance
due to the use of :class:`XformPrimView`.
If False, the pose of the camera during initialization is returned.
"""
semantic_filter: str | list[str] = "*:*"
"""A string or a list specifying a semantic filter predicate. Defaults to ``"*:*"``.
......
......@@ -235,6 +235,10 @@ class TiledCamera(Camera):
# Increment frame count
self._frame[env_ids] += 1
# update latest camera pose
if self.cfg.update_latest_camera_pose:
self._update_poses(env_ids)
# Extract the flattened image buffer
for data_type, annotator in self._annotators.items():
# check whether returned data is a dict (used for segmentation)
......
......@@ -14,11 +14,3 @@ class TiledCameraCfg(CameraCfg):
"""Configuration for a tiled rendering-based camera sensor."""
class_type: type = TiledCamera
return_latest_camera_pose: bool = False
"""Whether to return the latest camera pose when fetching the camera's data. Defaults to False.
If True, the latest camera pose is returned in the camera's data which will slow down performance
due to the use of :class:`XformPrimView`.
If False, the pose of the camera during initialization is returned.
"""
......@@ -129,6 +129,7 @@ class TestCamera(unittest.TestCase):
# define the same offset in all conventions
# -- ROS convention
cam_cfg_offset_ros = copy.deepcopy(self.camera_cfg)
cam_cfg_offset_ros.update_latest_camera_pose = True
cam_cfg_offset_ros.offset = CameraCfg.OffsetCfg(
pos=POSITION,
rot=QUAT_ROS,
......@@ -138,6 +139,7 @@ class TestCamera(unittest.TestCase):
camera_ros = Camera(cam_cfg_offset_ros)
# -- OpenGL convention
cam_cfg_offset_opengl = copy.deepcopy(self.camera_cfg)
cam_cfg_offset_opengl.update_latest_camera_pose = True
cam_cfg_offset_opengl.offset = CameraCfg.OffsetCfg(
pos=POSITION,
rot=QUAT_OPENGL,
......@@ -147,6 +149,7 @@ class TestCamera(unittest.TestCase):
camera_opengl = Camera(cam_cfg_offset_opengl)
# -- World convention
cam_cfg_offset_world = copy.deepcopy(self.camera_cfg)
cam_cfg_offset_world.update_latest_camera_pose = True
cam_cfg_offset_world.offset = CameraCfg.OffsetCfg(
pos=POSITION,
rot=QUAT_WORLD,
......@@ -317,6 +320,8 @@ class TestCamera(unittest.TestCase):
def test_camera_set_world_poses(self):
"""Test camera function to set specific world pose."""
# enable update latest camera pose
self.camera_cfg.update_latest_camera_pose = True
camera = Camera(self.camera_cfg)
# play sim
self.sim.reset()
......@@ -339,6 +344,8 @@ class TestCamera(unittest.TestCase):
def test_camera_set_world_poses_from_view(self):
"""Test camera function to set specific world pose from view."""
# enable update latest camera pose
self.camera_cfg.update_latest_camera_pose = True
camera = Camera(self.camera_cfg)
# play sim
self.sim.reset()
......
......@@ -715,6 +715,7 @@ class TestWarpCamera(unittest.TestCase):
focal_length=24.0, focus_distance=400.0, horizontal_aperture=20.955, clipping_range=(1e-6, 1.0e5)
),
offset=CameraCfg.OffsetCfg(pos=(0, 0, 2.0), rot=offset_rot, convention="ros"),
update_latest_camera_pose=True,
)
prim_usd = prim_utils.create_prim("/World/Camera_usd", "Xform")
prim_usd.GetAttribute("xformOp:translate").Set(tuple(POSITION))
......
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