Skip to content

[RL] Normalize unbounded SB3 action spaces - #7910

Merged
StafaH merged 4 commits into
isaac-sim:developfrom
StafaH:fix/rl-action-bounds
Sep 20, 2026
Merged

StafaH merged 4 commits into
isaac-sim:developfrom
StafaH:fix/rl-action-bounds

Conversation

@StafaH

@StafaH StafaH commented Sep 20, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Fix Stable-Baselines3 off-policy training on Isaac Lab environments with unbounded continuous action spaces without changing the underlying environment semantics.

  • Replace the SB3 wrapper's artificial [-100, 100] fallback with normalized [-1, 1] bounds.
  • Keep manager-based and direct environments unbounded and leave their action processing unchanged.
  • Add Sb3VecEnvWrapper.action_bounds so policies using a different finite domain can override the fallback.
  • Preserve already-bounded environment action spaces unchanged.

This gives SAC and TD3 a useful finite scaling domain while limiting the behavior change to the SB3 adapter.

Fixes #5080

No new dependencies.

Type of change

  • Bug fix
  • Breaking change
  • Documentation update

Release backport

  • Backport this pull request to the active release branch after it merges into develop

Screenshots

Not applicable.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with uv run isaaclab -f
  • I have made corresponding documentation changes
  • My changes generate no new warnings
  • I have added regression tests
  • I have added changelog fragments for every touched package
  • My name already exists in CONTRIBUTORS.md

Validation

  • uv run --extra sb3 --extra test pytest -q source/isaaclab_rl/test/test_wrappers.py -k sb3
  • uv run python tools/changelog/cli.py check develop
  • uv run isaaclab -f

@StafaH
StafaH requested a review from a team September 20, 2026 02:09
@github-actions github-actions Bot added bug Something isn't working documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team labels Sep 20, 2026
@StafaH StafaH mentioned this pull request Sep 20, 2026
7 of 8 tasks
@greptile-apps

greptile-apps Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with the intended breaking behavior documented and covered by focused regression tests.

Summary

This PR makes raw continuous policy-action bounds an environment-owned contract and applies those bounds consistently before task-specific action processing.

  • Adds per-term raw bounds and composes them into manager-based Gymnasium action spaces.
  • Enforces bounded actions in manager-based and direct environments.
  • Requires finite continuous action spaces in the Stable-Baselines3 adapter instead of substituting artificial bounds.
  • Declares normalized bounds for the maintained SB3 task configurations and adds regression coverage and migration documentation.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    P[Policy action] --> S[Environment action space]
    S --> B{Finite raw bounds?}
    B -- Yes --> C[Clamp raw action]
    B -- No --> U[Keep action unbounded]
    C --> T[Term-specific scaling and offsets]
    U --> T
    T --> X[Simulator control]
    S --> W[RL adapter]
    W --> Q{SB3 and continuous?}
    Q -- Finite --> A[Initialize SB3 VecEnv]
    Q -- Unbounded --> E[Raise configuration error]
Loading

Reviews (1) · Last reviewed commit: "Define raw action bounds for RL environm..."

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

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.

Isaac Lab Review Bot

The PR consistently introduces environment-owned raw action bounds, composes manager-based term bounds into Gymnasium spaces, enforces declared bounds before term processing, and rejects unsupported unbounded continuous spaces in the SB3 wrapper. The proposed A1 finding is not supported because the supplied context does not establish that its normalized action domain is incorrect or identify a broken consumer.

  • Design and architecture: The action manager is the coherent source of truth for manager-based action bounds, while direct environments derive enforcement from DirectRLEnvCfg.action_space. Bounds declared by a task are intentionally enforced at the environment layer and therefore apply independently of the RL wrapper; this is a documented breaking design choice rather than an evidenced defect in the A1 configuration.
  • API: The new ActionTermCfg.raw_action_bounds and ActionManager.action_space APIs preserve unbounded behavior when bounds are omitted, validate malformed bound pairs, expose composed bounds through ManagerBasedRLEnv, and provide SB3 with an explicit finite-space requirement. Documentation and changelog fragments describe the new contract and migration requirement.
  • Implementation: The changed producer and consumer paths are internally aligned: manager actions are moved to the expected device and dtype, clamped into the manager buffer before term slicing, direct-environment actions are clamped before preprocessing, and SB3 rejects fully or partially unbounded Box spaces instead of substituting artificial bounds. Tests cover composition, enforcement, invalid bounds, environment-space propagation, and SB3 rejection behavior.

No blocking issues. No inline issue met the actionable-evidence threshold; the assessment above records the review feedback.

Automated review; human maintainers own approval decisions.

@StafaH StafaH changed the title [RL] Define raw action bounds for RL environments [RL] Normalize unbounded SB3 action spaces Sep 20, 2026
@ooctipus

Copy link
Copy Markdown
Collaborator

run-ci

1 similar comment
@StafaH

StafaH commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator Author

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Sep 20, 2026
@StafaH
StafaH merged commit e5a1779 into isaac-sim:develop Sep 20, 2026
55 of 84 checks passed
@StafaH
StafaH deleted the fix/rl-action-bounds branch September 20, 2026 03:36
@isaaclab-bot

isaaclab-bot Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Backported to release/3.0.0 as 24f7b48.

isaaclab-bot Bot pushed a commit that referenced this pull request Sep 20, 2026
# Description

Fix Stable-Baselines3 off-policy training on Isaac Lab environments with
unbounded continuous action spaces without changing the underlying
environment semantics.

- Replace the SB3 wrapper's artificial `[-100, 100]` fallback with
normalized `[-1, 1]` bounds.
- Keep manager-based and direct environments unbounded and leave their
action processing unchanged.
- Add `Sb3VecEnvWrapper.action_bounds` so policies using a different
finite domain can override the fallback.
- Preserve already-bounded environment action spaces unchanged.

This gives SAC and TD3 a useful finite scaling domain while limiting the
behavior change to the SB3 adapter.

Fixes #5080

No new dependencies.

## Type of change

- Bug fix
- Breaking change
- Documentation update

## Release backport

- [x] <!-- backport-active-release --> Backport this pull request to the
active release branch after it merges into `develop`

## Screenshots

Not applicable.

## Checklist

- [x] I have read and understood the contribution guidelines
- [x] I have run the pre-commit checks with `uv run isaaclab -f`
- [x] I have made corresponding documentation changes
- [x] My changes generate no new warnings
- [x] I have added regression tests
- [x] I have added changelog fragments for every touched package
- [x] My name already exists in `CONTRIBUTORS.md`

## Validation

- `uv run --extra sb3 --extra test pytest -q
source/isaaclab_rl/test/test_wrappers.py -k sb3`
- `uv run python tools/changelog/cli.py check develop`
- `uv run isaaclab -f`

(cherry picked from commit e5a1779)
ooctipus added a commit that referenced this pull request Sep 21, 2026
…7530, #7899) (#7926)

## Description

Backports the two changes merged into `develop` since September 19 that
are still missing from `release/3.0.0`:

| Source PR | Change | Source commit |
| --- | --- | --- |
| #7530 | Validate camera outputs against renderer capabilities before
simulator startup | `31d1c53510490c76841e9c35a329574b357d9900` |
| #7899 | Share native resources by construction cfg and centralize
ownership and teardown | `c90c3a1097a0a669a823b880b1c8d0654d7fd267` |

Includes the original regression tests, API documentation, and changelog
fragments. #7530 applied without changes. #7899 required two conflict
resolutions to retain the release branch's OVRTX mapping API,
documentation, and tests. Of its 62 files, 59 match the merged source
exactly; the other three retain those existing release additions.
Release versions, lockfile entries, compiled changelogs, and
documentation routing are preserved.

## Audit

Checked all **33 PRs** merged from September 19, 2026 00:00
America/Los_Angeles through `develop` commit `c90c3a1097` (September 20,
21:29 Pacific), against release base `75e9c8ce12`. **31 are already
backported; the remaining two are included here.** Git first-parent
history and GitHub's merged PR list agree. Automatic changelog/version
compilation remains branch-specific.

<details>
<summary>31 PRs already recorded in release</summary>

| Source PRs | Existing release commit |
| --- | --- |
| #7777, #7608, #7895, #7872, #7831, #7834, #7838, #7840, #7903, #7674 |
[`ff22c52891`](ff22c52)
|
| #7886 |
[`41bfaee5f0`](41bfaee)
|
| #7042 |
[`970d21ef48`](970d21e)
|
| #7905 |
[`f0563d1f9e`](f0563d1)
|
| #7604 |
[`dca7cfe984`](dca7cfe)
|
| #7610, #7603 |
[`5dd2220243`](5dd2220)
|
| #7839 |
[`b8b93bb96e`](b8b93bb)
|
| #6851 |
[`baa025ad90`](baa025a)
|
| #7250 |
[`f86b33e6b1`](f86b33e)
|
| #7910 |
[`24f7b4842b`](24f7b48)
|
| #7810 |
[`9738e096c8`](9738e09)
|
| #7832 |
[`be270ed88b`](be270ed)
|
| #4679 |
[`80157aa22d`](80157aa)
|
| #7914 |
[`01b59b5a22`](01b59b5)
|
| #7502 |
[`db7db61f60`](db7db61)
|
| #7918 |
[`bca9dba8bb`](bca9dba)
|
| #7919 |
[`ef1514c97c`](ef1514c)
|
| #7922 |
[`7d6979a19e`](7d6979a)
|
| #7923 |
[`a1dd560b98`](a1dd560)
|
| #7924 |
[`892e51dc1d`](892e51d)
|
| #7925 |
[`75e9c8ce12`](75e9c8c)
|

</details>

## Validation

**745 tests passed** on the combined backport:

- Core registry, configclass, replication, camera contracts, and task
presets: 158 passed.
- Newton manager/model/reset and coupling suites: 299 passed.
- OVPhysX/OVRTX lifecycle, scene data, bindings, and material contracts:
141 passed on CPU.
- Clone-plan algebra: 83 passed.
- All 8 OV CUDA cases skipped in the CPU run: 8 passed on GPU.
- OVPhysX ray-caster regression: 1 passed.
- Kit simulation-context and PhysX scene-data tests: 54 passed.
- Newton solver reset integration: 1 passed.

The registry-identity and borrowed-config-field regressions both fail
with the pre-backport implementations and pass with this change.
Backport file-scope validation, source-file comparison, `git diff
--check`, and `uv run isaaclab -f` passed.

Local validation used PyTorch 2.12.0/CUDA 13.0, Isaac Sim 6.0.1.0,
Newton 1.6.0rc1, and an RTX 5090. Existing deprecation/runtime warnings
occurred. Full Docker CI is requested separately against the pinned
environment; local checks do not claim a startup or runtime speedup.

## Checklist

- [x] Read the contribution guidelines and ran formatting/changelog
checks.
- [x] Included source tests, documentation, and changelog fragments.
- [x] Verified regression behavior and preserved release-specific
changes.
- [x] Recorded source commit hashes and audited the requested merge
window.

---------

Co-authored-by: Antoine RICHARD <[email protected]>
Co-authored-by: ooctipus <[email protected]>
@araffin

araffin commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

@ooctipus @StafaH @AntoineRichard
I think this PR broke SB3 PPO behavior for velocity envs (see #5080 (comment) and related blog post: https://araffin.github.io/post/sac-massive-sim/)

also, [-2, 2] (or even [-3, 3], see blog post) might be a better default to be consistent with #8866 for instance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Report] SB3 wrapper's unbounded action space fallback breaks off-policy algorithms (SAC)

3 participants