-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add Fii mobile manipulator for teleoperation and locomanipulation SDG #4191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jaybdub
wants to merge
16
commits into
isaac-sim:main
Choose a base branch
from
jaybdub:dev-fii-locomanip-base-environment
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+962
−21
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
9c05904
add fii mobile manipulator task
jaybdub 0ea8d23
format code
jaybdub a422f64
swap object for green block
jaybdub dc0903d
format code
jaybdub f3c2295
remove no-op in retargeter
jaybdub c43b46d
add v0 suffix to fii env
jaybdub b9162de
remove broken content references
jaybdub 148090b
fix retargeter
jaybdub 0bf8f4e
cleanup
jaybdub 4338080
fix linting errors
jaybdub d3ffa3e
move fiibot to assets
jaybdub 42d3f2d
format
jaybdub f746e86
add locomanipulation SDG env
jaybdub 14f6ad6
add occ map buffer size to args
jaybdub 9a90f3b
run format
jaybdub 87076fe
fix unused imports
jaybdub File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
source/isaaclab/isaaclab/devices/openxr/retargeters/humanoid/fii/fii_retargeter.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| # Copyright (c) 2022-2025, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md). | ||
| # All rights reserved. | ||
| # | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| import numpy as np | ||
| import torch | ||
| from dataclasses import dataclass | ||
|
|
||
| import isaaclab.utils.math as PoseUtils | ||
| from isaaclab.devices import OpenXRDevice | ||
| from isaaclab.devices.retargeter_base import RetargeterBase, RetargeterCfg | ||
|
|
||
|
|
||
| class FiiRetargeter(RetargeterBase): | ||
|
|
||
| def __init__(self, cfg: "FiiRetargeterCfg"): | ||
| """Initialize the retargeter.""" | ||
| self.cfg = cfg | ||
| self._sim_device = cfg.sim_device | ||
|
|
||
| def retarget(self, data: dict) -> torch.Tensor: | ||
|
|
||
| base_vel = torch.tensor([0.0, 0.0, 0.0], dtype=torch.float32, device=self._sim_device) | ||
| base_height = torch.tensor([0.7], dtype=torch.float32, device=self._sim_device) | ||
|
|
||
| left_eef_pose = torch.tensor( | ||
| [-0.3, 0.3, 0.72648, 1.0, 0.0, 0.0, 0.0], dtype=torch.float32, device=self._sim_device | ||
| ) | ||
| right_eef_pose = torch.tensor( | ||
| [-0.3, 0.3, 0.72648, 1.0, 0.0, 0.0, 0.0], dtype=torch.float32, device=self._sim_device | ||
| ) | ||
|
|
||
| left_hand_poses = data[OpenXRDevice.TrackingTarget.HAND_LEFT] | ||
| right_hand_poses = data[OpenXRDevice.TrackingTarget.HAND_RIGHT] | ||
| left_wrist = left_hand_poses.get("wrist") | ||
| right_wrist = right_hand_poses.get("wrist") | ||
|
|
||
| left_eef_pose_np = self._retarget_abs(left_wrist, is_left=True) | ||
| right_eef_pose_np = self._retarget_abs(right_wrist, is_left=False) | ||
|
|
||
| if left_wrist is not None: | ||
| left_eef_pose = torch.from_numpy(left_eef_pose_np).to(dtype=torch.float32, device=self._sim_device) | ||
| if right_wrist is not None: | ||
| right_eef_pose = torch.from_numpy(right_eef_pose_np).to(dtype=torch.float32, device=self._sim_device) | ||
|
|
||
| gripper_value_left = self._hand_data_to_gripper_values(data[OpenXRDevice.TrackingTarget.HAND_LEFT]) | ||
| gripper_value_right = self._hand_data_to_gripper_values(data[OpenXRDevice.TrackingTarget.HAND_RIGHT]) | ||
|
|
||
| return torch.cat( | ||
| [left_eef_pose, right_eef_pose, gripper_value_left, gripper_value_right, base_vel, base_height] | ||
| ) | ||
|
|
||
| def _hand_data_to_gripper_values(self, hand_data): | ||
| thumb_tip = hand_data["thumb_tip"] | ||
| index_tip = hand_data["index_tip"] | ||
|
|
||
| distance = np.linalg.norm(thumb_tip[:3] - index_tip[:3]) | ||
|
|
||
| finger_dist_closed = 0.00 | ||
| finger_dist_open = 0.06 | ||
|
|
||
| gripper_value_closed = 0.06 | ||
| gripper_value_open = 0.00 | ||
|
|
||
| t = np.clip((distance - finger_dist_closed) / (finger_dist_open - finger_dist_closed), 0, 1) | ||
| # t = 1 -> open | ||
| # t = 0 -> closed | ||
| gripper_joint_value = (1.0 - t) * gripper_value_closed + t * gripper_value_open | ||
|
|
||
| return torch.tensor([gripper_joint_value, gripper_joint_value], dtype=torch.float32, device=self._sim_device) | ||
|
|
||
| def _retarget_abs(self, wrist: np.ndarray, is_left: bool) -> np.ndarray: | ||
| """Handle absolute pose retargeting. | ||
|
|
||
| Args: | ||
| wrist: Wrist pose data from OpenXR. | ||
| is_left: True for the left hand, False for the right hand. | ||
|
|
||
| Returns: | ||
| Retargeted wrist pose in USD control frame. | ||
| """ | ||
| wrist_pos = torch.tensor(wrist[:3], dtype=torch.float32) | ||
| wrist_quat = torch.tensor(wrist[3:], dtype=torch.float32) | ||
|
|
||
| openxr_pose = PoseUtils.make_pose(wrist_pos, PoseUtils.matrix_from_quat(wrist_quat)) | ||
|
|
||
| if is_left: | ||
| # Corresponds to a rotation of (0, 90, 90) in euler angles (x,y,z) | ||
| combined_quat = torch.tensor([0, 0.7071, 0, 0.7071], dtype=torch.float32) | ||
| else: | ||
| # Corresponds to a rotation of (0, -90, -90) in euler angles (x,y,z) | ||
| combined_quat = torch.tensor([0, -0.7071, 0, 0.7071], dtype=torch.float32) | ||
|
|
||
| offset = torch.tensor([0.0, 0.25, -0.15]) | ||
| transform_pose = PoseUtils.make_pose(offset, PoseUtils.matrix_from_quat(combined_quat)) | ||
|
|
||
| result_pose = PoseUtils.pose_in_A_to_pose_in_B(transform_pose, openxr_pose) | ||
| pos, rot_mat = PoseUtils.unmake_pose(result_pose) | ||
| quat = PoseUtils.quat_from_matrix(rot_mat) | ||
|
|
||
| return np.concatenate([pos.numpy(), quat.numpy()]) | ||
|
|
||
|
|
||
| @dataclass | ||
| class FiiRetargeterCfg(RetargeterCfg): | ||
| retargeter_type: type[RetargeterBase] = FiiRetargeter | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing
super().__init__(cfg)to properly handle the sim_device