You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Consistent resetting through np.random.Generator #232
Taking this one. Plan (minimal, backward-compatible): add an optional np.random.Generator (or RandomState) rng that is threaded Environment(rng=...) -> Scene(rng=...) -> SpawnBoundary(boundaries, rng=...), so reset-time boundary sampling no longer depends on global numpy state; when rng=None the behavior stays exactly as today (np.random global). The global-np.random draws are at rlbench/backend/spawn_boundary.py:72-83 (_get_position_within_boundary), spawn_boundary.py:103 (rotation) and spawn_boundary.py:159 (choice), consumed via Scene.init_episode/_place_task (rlbench/backend/scene.py:127-146, 529-537) which is what makes repeated resets non-reproducible even with a fixed global seed when max_attempts retries occur.
Will include a unit test for SpawnBoundary determinism (same seed => identical placements, different seed => different) plus unchanged fallback behavior.
Disclosure: I'm an AI-assisted contributor (account used by an automated coding agent); the fix and tests are prepared with AI assistance and reviewed by me before submission.
Opened PR #300 with a fix: an optional rng (e.g. np.random.default_rng(seed)) is threaded Environment → Scene → SpawnBoundary, so reset-time placement sampling is reproducible independent of the global numpy state; the default (rng=None) keeps the existing global-np.random behavior for all current callers. Includes CoppeliaSim-free regression tests.
Activity
xsw1208 commentedon Jun 23, 2024
Great, I also find that even if I have set global random seed, the boundary and object position varies.
vonHartz commentedon Jul 30, 2025
Is this still active?
akushonkamen commentedon Oct 17, 2026
Taking this one. Plan (minimal, backward-compatible): add an optional
np.random.Generator(orRandomState)rngthat is threadedEnvironment(rng=...) -> Scene(rng=...) -> SpawnBoundary(boundaries, rng=...), so reset-time boundary sampling no longer depends on global numpy state; whenrng=Nonethe behavior stays exactly as today (np.randomglobal). The global-np.randomdraws are atrlbench/backend/spawn_boundary.py:72-83(_get_position_within_boundary),spawn_boundary.py:103(rotation) andspawn_boundary.py:159(choice), consumed viaScene.init_episode/_place_task(rlbench/backend/scene.py:127-146, 529-537) which is what makes repeated resets non-reproducible even with a fixed global seed whenmax_attemptsretries occur.Will include a unit test for
SpawnBoundarydeterminism (same seed => identical placements, different seed => different) plus unchanged fallback behavior.Disclosure: I'm an AI-assisted contributor (account used by an automated coding agent); the fix and tests are prepared with AI assistance and reviewed by me before submission.
akushonkamen commentedon Oct 17, 2026
Opened PR #300 with a fix: an optional
rng(e.g.np.random.default_rng(seed)) is threadedEnvironment → Scene → SpawnBoundary, so reset-time placement sampling is reproducible independent of the global numpy state; the default (rng=None) keeps the existing global-np.randombehavior for all current callers. Includes CoppeliaSim-free regression tests.