Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes infinite loop in repeated_objects_terrain: respawn only wrong object samples #1612

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion source/extensions/omni.isaac.lab/config/extension.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

# Note: Semantic Versioning is used: https://semver.org/
version = "0.30.4"
version = "0.30.5"

# Description
title = "Isaac Lab framework for Robot Learning"
Expand Down
9 changes: 9 additions & 0 deletions source/extensions/omni.isaac.lab/docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Changelog
---------

0.30.5 (2025-01-14)
~~~~~~~~~~~~~~~~~~~

Fixed
^^^^^

* Fixed the respawn of only wrong object samples in :func:`repeated_objects_terrain` of :mod:`omni.isaac.lab.terrains.trimesh` module. Previously, the function was respawning all objects in the scene instead of only the wrong object samples, which in worst case could lead to infinite respawn loop.


0.30.4 (2025-01-08)
~~~~~~~~~~~~~~~~~~~

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -816,21 +816,22 @@ def repeated_objects_terrain(
platform_corners[0, :] *= 1 - platform_clearance
platform_corners[1, :] *= 1 + platform_clearance
# sample center for objects
while True:
object_centers = np.zeros((num_objects, 3))
object_centers[:, 0] = np.random.uniform(0, cfg.size[0], num_objects)
object_centers[:, 1] = np.random.uniform(0, cfg.size[1], num_objects)
object_centers = np.zeros((num_objects, 3))
mask_objects_left = np.ones((num_objects,), dtype=bool)
while np.any(mask_objects_left):
num_objects_left = mask_objects_left.sum()
object_centers[mask_objects_left, 0] = np.random.uniform(0, cfg.size[0], num_objects_left)
object_centers[mask_objects_left, 1] = np.random.uniform(0, cfg.size[1], num_objects_left)
# filter out the centers that are on the platform
is_within_platform_x = np.logical_and(
object_centers[:, 0] >= platform_corners[0, 0], object_centers[:, 0] <= platform_corners[1, 0]
object_centers[mask_objects_left, 0] >= platform_corners[0, 0],
object_centers[mask_objects_left, 0] <= platform_corners[1, 0],
)
is_within_platform_y = np.logical_and(
object_centers[:, 1] >= platform_corners[0, 1], object_centers[:, 1] <= platform_corners[1, 1]
object_centers[mask_objects_left, 1] >= platform_corners[0, 1],
object_centers[mask_objects_left, 1] <= platform_corners[1, 1],
)
masks = np.logical_and(is_within_platform_x, is_within_platform_y)
# if there are no objects on the platform, break
if not np.any(masks):
break
mask_objects_left[mask_objects_left] = np.logical_and(is_within_platform_x, is_within_platform_y)
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the enhancement. Could you please add some comments on the logic of the loop and how mask_objects_left acts as the mask here?


# generate obstacles (but keep platform clean)
for index in range(len(object_centers)):
Expand Down
Loading