Skip to content

fix: correct joint position sampling range in dexterous hand envs - #4680

Closed
alltheseas wants to merge 3 commits into
isaac-sim:mainfrom
alltheseas:fix/inhand-manipulation-sampling-range
Closed

alltheseas wants to merge 3 commits into
isaac-sim:mainfrom
alltheseas:fix/inhand-manipulation-sampling-range

Conversation

@alltheseas

Copy link
Copy Markdown
Contributor

Summary

Fix incorrect reset joint position sampling in InHandManipulationEnv and ShadowHandOverEnv.

The sampling logic used sample_uniform(-1, 1) combined with delta_min + (delta_max - delta_min) * 0.5 * noise, which produces a range of [1.5*delta_min - 0.5*delta_max, midpoint] instead of the intended [delta_min, delta_max]. This means:

  • Joints can be sampled past their lower limits
  • Joints never sample near their upper limits (only reaches the midpoint)

Use sample_uniform(0, 1) with standard linear interpolation to correctly cover the full [delta_min, delta_max] range.

Fixes #4404

Changes

  • inhand_manipulation_env.py — fix sampling in _reset_idx
  • shadow_hand_over_env.py — fix sampling in _reset_idx for both right and left hands

Signed-off-by: alltheseas alltheseas@users.noreply.github.com

The docstring for `resolve_matching_names` incorrectly described the
behavior of the `preserve_order` parameter — the descriptions for
True and False were swapped.

Fixes isaac-sim#4493

Signed-off-by: alltheseas <alltheseas@users.noreply.github.com>
The inline comments in process_actions stated "true: close, false:
open" which describes the binary_mask variable but reads as describing
the action convention, contradicting actual behavior.

Also fix class docstring: "positive" -> "non-negative" for float
actions, since zero maps to open (the mask uses < 0, not <= 0).

Fixes isaac-sim#4670

Signed-off-by: alltheseas <alltheseas@users.noreply.github.com>
The reset sampling logic used `sample_uniform(-1, 1)` with
`delta_min + (delta_max - delta_min) * 0.5 * noise`, which produces
a range of [1.5*delta_min - 0.5*delta_max, midpoint] instead of the
intended [delta_min, delta_max]. This could push joints past their
lower limits and never sample near the upper limits.

Use `sample_uniform(0, 1)` with standard linear interpolation
`delta_min + (delta_max - delta_min) * noise` to correctly sample
the full [delta_min, delta_max] range.

Applied to all 3 occurrences:
- InHandManipulationEnv._reset_idx
- ShadowHandOverEnv._reset_idx (right hand)
- ShadowHandOverEnv._reset_idx (left hand)

Fixes isaac-sim#4404

Signed-off-by: alltheseas <alltheseas@users.noreply.github.com>
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Feb 21, 2026
@greptile-apps

greptile-apps Bot commented Feb 21, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Fixes critical joint position sampling bug in dexterous hand environments. The old formula sample_uniform(-1, 1) * 0.5 * (delta_max - delta_min) incorrectly produced range [1.5*delta_min - 0.5*delta_max, midpoint], causing joints to sample past lower limits and never reach upper limits. The corrected formula sample_uniform(0, 1) * (delta_max - delta_min) properly covers the full [delta_min, delta_max] range.

  • Fixed sampling in InHandManipulationEnv._reset_idx
  • Fixed sampling for both hands in ShadowHandOverEnv._reset_idx
  • Corrected misleading comments in BinaryJointAction about open/close convention
  • Fixed inverted preserve_order docstring in resolve_matching_names

Confidence Score: 5/5

  • This PR is safe to merge - fixes critical mathematical error with straightforward, well-tested correction
  • The mathematical fix is correct and addresses a real bug that could cause joint limit violations. All changes are minimal, localized, and follow standard linear interpolation patterns. The additional comment/docstring corrections improve code clarity without changing behavior.
  • No files require special attention

Important Files Changed

Filename Overview
source/isaaclab_tasks/isaaclab_tasks/direct/inhand_manipulation/inhand_manipulation_env.py Fixed joint position sampling to correctly cover full [delta_min, delta_max] range by changing noise from [-1,1] to [0,1] and removing 0.5 scaling factor
source/isaaclab_tasks/isaaclab_tasks/direct/shadow_hand_over/shadow_hand_over_env.py Fixed joint position sampling for both right and left hands using same correction as inhand_manipulation_env.py
source/isaaclab/isaaclab/envs/mdp/actions/binary_joint_actions.py Corrected misleading comments to clarify binary action convention (non-negative = open, negative = close)
source/isaaclab/isaaclab/utils/string.py Fixed inverted docstring for preserve_order parameter - corrected description of True vs False behavior

Last reviewed commit: c3c33f8

@greptile-apps greptile-apps 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.

4 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@StafaH

StafaH commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

Closing as this was fixed by #6413 during the in-hand manipulation overhaul

@StafaH StafaH closed this Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Report] inhand_manipulation _reset_idx might be sampling from a wrong range

2 participants