Skip to content

Adds In hand direct env to develop - #4827

Merged
kellyguo11 merged 6 commits into
isaac-sim:developfrom
ooctipus:feature/develop/in_hand_direct_env
Mar 5, 2026
Merged

kellyguo11 merged 6 commits into
isaac-sim:developfrom
ooctipus:feature/develop/in_hand_direct_env

Conversation

@ooctipus

@ooctipus ooctipus commented Mar 5, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR fixes bugs and brings inhand direct envs into isaaclab, notably, we have to migrate to newer newton, and
fixes bugs that the new usd importer brings.

Fixes # (issue)

Type of change

  • New feature (non-breaking change which adds functionality)

Screenshots

Please attach before and after screenshots of the change if applicable.

Checklist

  • I have read and understood the contribution guidelines
  • 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

@ooctipus
ooctipus changed the base branch from main to develop March 5, 2026 05:59
@github-actions github-actions Bot added enhancement New feature or request isaac-lab Related to Isaac Lab team labels Mar 5, 2026
@ooctipus
ooctipus marked this pull request as ready for review March 5, 2026 06:00
@ooctipus
ooctipus requested a review from kellyguo11 as a code owner March 5, 2026 06:00
@greptile-apps

greptile-apps Bot commented Mar 5, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds Newton physics backend support to the Allegro Hand and Shadow Hand in-hand manipulation environments, migrates to mujoco-warp==3.5.0.2, and fixes several USD-importer related bugs (env-origin double-counting in newton_replicate, joint-limits and force-sensor API calls in the env).

Key changes:

  • newton_replicate.py: Removes the get_inverse_env_xform helper; prototypes are now built in absolute env_0 coordinates and placed using delta positions from env_0, eliminating double-counting of environment offsets.
  • interactive_scene.py: _default_env_origins is now bundled into replicate_args and forwarded positionally, removing the former keyword-argument inconsistency.
  • newton_manager_cfg.py: Adds ccd_iterations (default 35) to MJWarpSolverCfg for multi-finger collision geometry.
  • inhand_manipulation_env.py: Dispatches write calls to either mask-based (Newton) or index-based (PhysX) methods at __init__ time; migrates root_view.get_dof_limits() → data.joint_limits and root_view.get_link_incoming_joint_force() → data.body_incoming_joint_wrench_b.
  • allegro_hand_env_cfg.py / shadow_hand_env_cfg.py: Object and physics configs are factored into PresetCfg subclasses enabling backend selection. Shadow Hand gets a dedicated Newton USD asset and a separate EventCfg that omits PhysX-only randomizers (tendon, material friction).
  • setup.py: mujoco-warp bumped to 3.5.0.2.

Issues found:

  • A syntax bug in shadow_hand_env_cfg.py causes PhysicsCfg.physx to be a tuple rather than a PhysxCfg instance (trailing comma inside the outer parentheses), which will break the default/PhysX execution path at runtime.
  • When the Newton backend is selected, the in-hand manipulation object is instantiated as an Articulation but is still registered under scene.rigid_objects["object"] — this mismatches the Newton EventCfg's object_scale_mass term which targets SceneEntityCfg("object") via the rigid-objects registry.

Confidence Score: 2/5

  • Not safe to merge as-is — a syntax bug will break the default PhysX path for Shadow Hand at runtime.
  • The tuple-wrapping bug in PhysicsCfg.physx inside shadow_hand_env_cfg.py will cause an immediate runtime failure whenever the Shadow Hand environment is launched with the PhysX (default) backend, since the preset machinery will receive a tuple where a PhysxCfg object is expected. The secondary concern — registering a Newton Articulation as a rigid_object — may silently misroute event randomization for the Newton path. Both issues need to be resolved before merging.
  • source/isaaclab_tasks/isaaclab_tasks/direct/shadow_hand/shadow_hand_env_cfg.py (tuple bug in PhysicsCfg) and source/isaaclab_tasks/isaaclab_tasks/direct/inhand_manipulation/inhand_manipulation_env.py (Articulation registered as rigid object)

Important Files Changed

Filename Overview
source/isaaclab_tasks/isaaclab_tasks/direct/shadow_hand/shadow_hand_env_cfg.py Major refactor to add Newton backend support; contains a syntax bug where physx in PhysicsCfg is accidentally a tuple instead of a bare PhysxCfg instance (trailing comma), which will break the PhysX path at runtime.
source/isaaclab_tasks/isaaclab_tasks/direct/inhand_manipulation/inhand_manipulation_env.py Backend dispatch and object creation updated to support both Newton and PhysX; Newton Articulation object is still registered under rigid_objects dict which may cause event-manager mismatches. Also migrates joint-limit API and fingertip force-sensor API to newer interfaces.
source/isaaclab_newton/isaaclab_newton/cloner/newton_replicate.py Refactored to build prototypes in absolute env_0 world coordinates and pass delta positions to add_builder instead of computing inverse xforms; removes get_inverse_env_xform helper. Logic is cleaner and more correct for multi-env replication.
source/isaaclab/isaaclab/scene/interactive_scene.py Positions (_default_env_origins) are now included in replicate_args tuple and passed positionally to both physics_clone_fn and usd_replicate, removing the former keyword argument approach. Clean, low-risk change.
source/isaaclab_tasks/isaaclab_tasks/direct/allegro_hand/allegro_hand_env_cfg.py Adds ObjectCfg and PhysicsCfg PresetCfg wrappers for Newton/PhysX backend selection in the Allegro Hand environment; straightforward and correct.
source/isaaclab_newton/isaaclab_newton/physics/newton_manager_cfg.py Adds ccd_iterations field (default 35) to MJWarpSolverCfg to allow users to raise the GJK/EPA iteration cap for complex geometries like multi-finger hands; well-documented.
source/isaaclab_newton/setup.py Bumps mujoco-warp dependency from 3.5.0 to 3.5.0.2 to pick up a bug-fix patch release; minimal risk.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[InHandManipulationEnv.__init__] --> B{physics_manager is Newton?}
    B -- Yes --> C[Bind mask-based write methods\nset_joint_position_target\nwrite_root_pose_to_sim\nwrite_root_velocity_to_sim\nwrite_joint_position_to_sim\nwrite_joint_velocity_to_sim]
    B -- No --> D[Bind index-based write methods\nset_joint_position_target_index\nwrite_root_pose_to_sim_index\nwrite_root_velocity_to_sim_index\nwrite_joint_position_to_sim_index\nwrite_joint_velocity_to_sim_index]

    A --> E[_setup_scene]
    E --> F{object_cfg.class_type?}
    F -- Newton --> G[Articulation object]
    F -- PhysX --> H[RigidObject object]
    G --> I[scene.rigid_objects --- object --- = self.object]
    H --> I
    I --> J[⚠️ Articulation registered as rigid_object\nwhen Newton is active]

    subgraph Newton Cloning Pipeline
        K[newton_replicate called\nwith positions in replicate_args] --> L[Build prototype from env_0\nin absolute world coords]
        L --> M[For each env: delta_pos = positions - env0_pos]
        M --> N[add_builder with delta xform]
    end

    subgraph PresetCfg Resolution
        O[PhysicsCfg / ObjectCfg / EventCfg\nsubclass PresetCfg] --> P{CLI override?}
        P -- No --> Q[Use default field]
        P -- Yes --> R[Use named field e.g. newton or physx]
    end
Loading

Last reviewed commit: 4c96558

Comments Outside Diff (1)

  1. undefined, line undefined (link)

    Newton Articulation object registered under rigid_objects

    When the Newton backend is active, self.cfg.object_cfg.class_type resolves to Articulation, so self.object is an Articulation. However, it is still registered under self.scene.rigid_objects["object"] (line 106) rather than self.scene.articulations["object"].

    The Newton EventCfg includes an object_scale_mass event that targets SceneEntityCfg("object"). The event manager resolves entity names by looking up the scene registries; because the object is stored in rigid_objects instead of articulations, mdp.randomize_rigid_body_mass may silently use the wrong view or raise a KeyError/AttributeError at runtime when it tries to treat an Articulation as a RigidObject.

    Consider checking the object type and registering it in the correct dict:

    if isinstance(self.object, Articulation):
        self.scene.articulations["object"] = self.object
    else:
        self.scene.rigid_objects["object"] = self.object

Comment on lines +8 to +9
^^^^^^^

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.

RST bullet-point continuation needs indentation

The cloning logic. continuation line starts at column 0, so RST parsers will treat it as a new paragraph outside the bullet list rather than the end of the same sentence. The continuation should be indented to align with the text that follows * :

Suggested change
^^^^^^^
* Passed ``default_env_origins`` to the Newton replication pipeline so environment offsets to adapt new newton
cloning logic.

@ooctipus
ooctipus force-pushed the feature/develop/in_hand_direct_env branch 2 times, most recently from fe84520 to 39cbad1 Compare March 5, 2026 06:07
@ooctipus
ooctipus force-pushed the feature/develop/in_hand_direct_env branch from 39cbad1 to d7833d3 Compare March 5, 2026 06:08
Comment thread source/isaaclab/docs/CHANGELOG.rst Resolved
kellyguo11 and others added 3 commits March 4, 2026 22:54
…_hand_env_cfg.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Signed-off-by: Kelly Guo <[email protected]>
@kellyguo11
kellyguo11 merged commit bf78573 into isaac-sim:develop Mar 5, 2026
4 of 5 checks passed
@ooctipus
ooctipus deleted the feature/develop/in_hand_direct_env branch October 14, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants