Skip to content

Conversation

@rwiltz
Copy link
Contributor

@rwiltz rwiltz commented Dec 3, 2025

Description

Added a retargeter for G1 upper body which takes in controller input and outputs a bool for hand open/close in addition to the left and right EE targets based on the controller position.

Fixes # (issue)

Type of change

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

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

@github-actions github-actions bot added isaac-mimic Related to Isaac Mimic team isaac-lab Related to Isaac Lab team labels Dec 3, 2025
@rwiltz rwiltz changed the title Adding Arean G1 locomanipulation retargeters Adding Arena G1 locomanipulation retargeters Dec 3, 2025
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 3, 2025

Greptile Overview

Greptile Summary

Added G1TriHandUpperBodyMotionControllerGripperRetargeter for mapping VR motion controller inputs to G1 robot gripper states and wrist poses.

  • Implemented hysteresis-based gripper control using controller trigger input to prevent flickering at threshold boundaries
  • Added wrist pose retargeting with fixed rotation offset (-75° Y, 90° Z) for ergonomic alignment
  • Output format: [left_gripper_state(1), right_gripper_state(1), left_wrist(7), right_wrist(7)]
  • Comprehensive unit tests added covering basic functionality and different trigger states
  • Version bumped to 0.49.1 with proper changelog documentation

Confidence Score: 4/5

  • This PR is safe to merge with minor cleanup recommended
  • Score reflects well-structured implementation following existing patterns, comprehensive test coverage, and proper documentation. The unused is_left parameter is a minor style issue that doesn't affect functionality. The hysteresis logic is sound and the pose transformation follows the established pattern from similar retargeters.
  • source/isaaclab/isaaclab/devices/openxr/retargeters/humanoid/unitree/trihand/g1_upper_body_motion_ctrl_gripper.py - remove unused is_left parameter

Important Files Changed

File Analysis

Filename Score Overview
source/isaaclab/isaaclab/devices/openxr/retargeters/humanoid/unitree/trihand/g1_upper_body_motion_ctrl_gripper.py 4/5 New retargeter implementation for G1 gripper control with hysteresis logic and wrist pose retargeting; unused parameter is_left in _retarget_abs method
source/isaaclab/test/devices/test_retargeters.py 4/5 Comprehensive test suite added for retargeters including the new G1TriHandUpperBodyMotionControllerGripperRetargeter; good coverage but limited edge case testing for hysteresis

Sequence Diagram

sequenceDiagram
    participant User as VR Controller
    participant Retargeter as G1TriHandUpperBodyMotionControllerGripperRetargeter
    participant Device as DeviceBase
    participant PoseUtils as isaaclab.utils.math
    participant Robot as G1 Robot

    User->>Device: Trigger Input (0.0-1.0)
    User->>Device: Controller Pose [x,y,z,qw,qx,qy,qz]
    
    Device->>Retargeter: retarget(data)
    
    Note over Retargeter: Extract Controller Data
    Retargeter->>Retargeter: _extract_hand_state(left_controller, prev_state)
    Note over Retargeter: Apply Hysteresis Logic<br/>threshold_high=0.6, threshold_low=0.4
    Retargeter->>Retargeter: Update prev_left_state
    
    Retargeter->>Retargeter: _extract_hand_state(right_controller, prev_state)
    Retargeter->>Retargeter: Update prev_right_state
    
    Note over Retargeter: Process Wrist Poses
    Retargeter->>Retargeter: _extract_wrist_pose(left_controller)
    Retargeter->>Retargeter: _extract_wrist_pose(right_controller)
    
    Retargeter->>Retargeter: _retarget_abs(left_wrist)
    Retargeter->>PoseUtils: make_pose(pos, rot_matrix)
    Retargeter->>PoseUtils: pose_in_A_to_pose_in_B(transform, openxr_pose)
    Note over Retargeter: Apply -75° Y + 90° Z rotation
    PoseUtils-->>Retargeter: transformed_pose
    
    Retargeter->>Retargeter: _retarget_abs(right_wrist)
    Retargeter->>PoseUtils: Transform pose
    PoseUtils-->>Retargeter: transformed_pose
    
    Note over Retargeter: Concatenate Results
    Retargeter->>Retargeter: torch.cat([gripper(2), left_wrist(7), right_wrist(7)])
    
    Retargeter->>Robot: [left_gripper_state, right_gripper_state, left_wrist_pose, right_wrist_pose]
    Note over Robot: Total: 16 values<br/>2 gripper + 14 pose

Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

5 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

return controller_data[DeviceBase.MotionControllerDataRowIndex.POSE.value]
return default_pose

def _retarget_abs(self, wrist: np.ndarray, is_left: bool) -> np.ndarray:
Copy link
Contributor

Choose a reason for hiding this comment

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

style: is_left parameter is unused in this method

Suggested change
def _retarget_abs(self, wrist: np.ndarray, is_left: bool) -> np.ndarray:
def _retarget_abs(self, wrist: np.ndarray) -> np.ndarray:

Copy link
Contributor

@peterd-NV peterd-NV left a comment

Choose a reason for hiding this comment

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

Thanks @rwiltz @hougantc-nvda for helping get teleop for G1 Arena.

I recall trying out the full body teleop with Quest on the Arena G1 env during the onsite. Was that setup using this upper body retargeting?

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

Labels

isaac-lab Related to Isaac Lab team isaac-mimic Related to Isaac Mimic team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants