Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion source/isaaclab_ov/isaaclab_ov/renderers/ovrtx_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@
# By setting OVRTX_SKIP_USD_CHECK, we prevent the C library from loading the pxr Python package.
os.environ["OVRTX_SKIP_USD_CHECK"] = "1"

import ovrtx
from ovrtx import Device, PrimMode, Renderer, RendererConfig, Semantic
from packaging.version import Version

# In previous versions of ovrtx, there was a bug where we would have to set read_gpu_transforms to False.
# In later versions, we can read transforms from GPU.
_OVRTX_READ_GPU_TRANSFORMS = Version(ovrtx.__version__) > Version("0.2.0")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Version boundary may be off-by-one

The comment states the bug existed in "previous versions," but the threshold > Version("0.2.0") treats 0.2.0 itself as a buggy version (leaves read_gpu_transforms=False). If the GPU-transform fix was introduced in 0.2.0 (rather than strictly after it), the condition should be >= Version("0.2.0"). Worth confirming the exact release that introduced the fix.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 No guard against malformed or missing __version__

Version(ovrtx.__version__) is evaluated at module-import time. If ovrtx doesn't expose __version__ (AttributeError) or its value isn't a valid PEP 440 string (packaging.version.InvalidVersion), the entire module fails to import. Consider wrapping this in a try/except so a version-parsing failure degrades gracefully (e.g. falls back to False):

try:
    _OVRTX_READ_GPU_TRANSFORMS = Version(ovrtx.__version__) > Version("0.2.0")
except Exception:
    _OVRTX_READ_GPU_TRANSFORMS = False


from isaaclab.renderers.base_renderer import BaseRenderer
from isaaclab.utils.math import convert_camera_frame_orientation_convention
Expand Down Expand Up @@ -171,7 +177,7 @@ def initialize(self, sensor: SensorBase):
OVRTX_CONFIG = RendererConfig(
log_file_path=self.cfg.log_file_path,
log_level=self.cfg.log_level,
read_gpu_transforms=False,
read_gpu_transforms=_OVRTX_READ_GPU_TRANSFORMS,
)
self._renderer = Renderer(OVRTX_CONFIG)
assert self._renderer, "Renderer should be valid after creation"
Expand Down
Loading