Skip to content

Adds action clipping to rsl-rl wrapper - #2019

Merged
kellyguo11 merged 3 commits into
mainfrom
fix/rsl-rl-clip
Mar 13, 2025
Merged

kellyguo11 merged 3 commits into
mainfrom
fix/rsl-rl-clip

Conversation

@Mayankm96

@Mayankm96 Mayankm96 commented Mar 5, 2025 •

Copy link
Copy Markdown
Contributor

Description

Currently, the actions from the policy are directly applied to the environment and also often fed back to the policy using the last action as observation.

Doing this can lead to instability during training since applying a large action can introduce a negative feedback loop.
More specifically, applying a very large action leads to a large last_action observations, which often results in a large error in the critic, which can lead to even larger actions being sampled in the future.

This PR aims to fix this for RSL-RL library, by clipping the actions to (large) hard limits before applying them to the environment. This prohibits the actions from growing continuously and greatly improves training stability.

Fixes #984, #1732, #1999

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have run the pre-commit checks 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

@pascal-roth pascal-roth left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@Mayankm96 Mayankm96 added the bug Something isn't working label Mar 10, 2025
@kellyguo11
kellyguo11 merged commit f774425 into main Mar 13, 2025
@kellyguo11
kellyguo11 deleted the fix/rsl-rl-clip branch March 13, 2025 02:17
jtigue-bdai pushed a commit that referenced this pull request Apr 14, 2025
# Description

Currently, the actions from the policy are directly applied to the
environment and also often fed back to the policy using the last action
as observation.

Doing this can lead to instability during training since applying a
large action can introduce a negative feedback loop.
More specifically, applying a very large action leads to a large
last_action observations, which often results in a large error in the
critic, which can lead to even larger actions being sampled in the
future.

This PR aims to fix this for RSL-RL library, by clipping the actions to
(large) hard limits before applying them to the environment. This
prohibits the actions from growing continuously and greatly improves
training stability.

Fixes #984, #1732, #1999

## Type of change

- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
ToxicNS pushed a commit to ToxicNS/IsaacLab that referenced this pull request Apr 24, 2025
# Description

Currently, the actions from the policy are directly applied to the
environment and also often fed back to the policy using the last action
as observation.

Doing this can lead to instability during training since applying a
large action can introduce a negative feedback loop.
More specifically, applying a very large action leads to a large
last_action observations, which often results in a large error in the
critic, which can lead to even larger actions being sampled in the
future.

This PR aims to fix this for RSL-RL library, by clipping the actions to
(large) hard limits before applying them to the environment. This
prohibits the actions from growing continuously and greatly improves
training stability.

Fixes isaac-sim#984, isaac-sim#1732, isaac-sim#1999

## Type of change

- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
LJones-alt pushed a commit to LJones-alt/IsaacLab-Laura that referenced this pull request Jul 1, 2026
# Description

Currently, the actions from the policy are directly applied to the
environment and also often fed back to the policy using the last action
as observation.

Doing this can lead to instability during training since applying a
large action can introduce a negative feedback loop.
More specifically, applying a very large action leads to a large
last_action observations, which often results in a large error in the
critic, which can lead to even larger actions being sampled in the
future.

This PR aims to fix this for RSL-RL library, by clipping the actions to
(large) hard limits before applying them to the environment. This
prohibits the actions from growing continuously and greatly improves
training stability.

Fixes isaac-sim#984, isaac-sim#1732, isaac-sim#1999

## Type of change

- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
AntoineRichard pushed a commit that referenced this pull request Nov 16, 2026
# Description

Follow-up to #8715 for the two action terms it didn't cover.
`RMPFlowAction` and `NonHolonomicAction` still resolved
`ActionTermCfg.clip` keys against joint names and then indexed the
action vector with those joint indices:

- `RMPFlowAction` has a task-space action (6-D relative, 7-D absolute
pose). With a 7-joint arm in relative mode, `clip={".*": ...}` raised
`IndexError: index 6 is out of bounds for dimension 0 with size 6`; with
fewer joints, joint ranges were applied to pose components.
- `NonHolonomicAction` has a 2-D action (forward velocity, turning rate)
but matched the keys against its three dummy base joints.

Both terms now expose `action_names` and resolve `clip` against them, as
#8715 did for DiffIK and OSC:

- RMPFlow: `pos_x`, `pos_y`, `pos_z`, then `rot_x`, `rot_y`, `rot_z`
(relative) or `quat_x`, `quat_y`, `quat_z`, `quat_w` (absolute). It
reuses `_resolve_task_space_clip`, so keys that match nothing or a
quaternion component raise.
- Non-holonomic: `lin_vel_x`, `ang_vel_z`. Unmatched keys raise through
the strict name resolver.

No task in the repo sets `clip` on either term.

Fixes #1732 (together with #2019 for raw-action clipping in the RL
wrappers and #8715 for the other task-space terms).

## Type of change

- Bug fix
- Breaking change: `clip` keys that name joints on these two terms now
raise a `ValueError`; use the action names listed above (recorded as
**Breaking** in the changelog, with a major bump)

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`uv run isaaclab --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have validated the changed behavior with focused coverage and
applied the [test-audit
criteria](https://github.com/isaac-sim/IsaacLab/blob/HEAD/skills/developer/test-audit/SKILL.md)
to any test changes
- [x] I have added a changelog fragment under
`source/<pkg>/changelog.d/` for every touched package (do **not** edit
`CHANGELOG.rst` or bump package versions — CI handles that)
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

Testing: the existing DiffIK clip tests are parametrized over RMPFlow:
valid keys clip the processed pose actions, joint-name keys raise, and
quaternion keys raise. On `main` the RMPFlow cases fail (joint-name keys
hit `IndexError: index 6 is out of bounds for dimension 0 with size 6`;
the other keys don't match any joint name). With this change all 20
tests in `source/isaaclab/test/envs/mdp/test_actions.py` pass. The
non-holonomic change has no test coverage here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants