Skip to content

Commit

Permalink
[update] update config for locked dexpilot retargeting
Browse files Browse the repository at this point in the history
  • Loading branch information
yzqin committed May 23, 2024
1 parent 52d22a4 commit 3567c98
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dex_retargeting/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.3.1"
__version__ = "0.3.2"
4 changes: 3 additions & 1 deletion dex_retargeting/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ def __init__(
target_joint_names: List[str],
finger_tip_link_names: List[str],
wrist_link_name: str,
target_link_human_indices: Optional[np.ndarray] = None,
huber_delta=0.03,
norm_delta=4e-3,
# DexPilot parameters
Expand All @@ -329,7 +330,8 @@ def __init__(
task_link_index = [1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 1, 2, 3, 4, 5]
self.num_fingers = 5

target_link_human_indices = (np.stack([origin_link_index, task_link_index], axis=0) * 4).astype(int)
if target_link_human_indices is None:
target_link_human_indices = (np.stack([origin_link_index, task_link_index], axis=0) * 4).astype(int)
link_names = [wrist_link_name] + finger_tip_link_names
target_origin_link_names = [link_names[index] for index in origin_link_index]
target_task_link_names = [link_names[index] for index in task_link_index]
Expand Down
8 changes: 8 additions & 0 deletions dex_retargeting/retargeting_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ def __post_init__(self):
elif self.type == "dexpilot":
if self.finger_tip_link_names is None or self.wrist_link_name is None:
raise ValueError(f"Position retargeting requires: finger_tip_link_names + wrist_link_name")
if self.target_link_human_indices is not None:
print(
"\033[33m",
"Target link human indices is provided in the DexPilot retargeting config, which is uncommon.\n"
"If you do not know exactly how it is used, please leave it to None for default.\n"
"\033[00m",
)

# URDF path check
urdf_path = Path(self.urdf_path)
Expand Down Expand Up @@ -181,6 +188,7 @@ def build(self) -> SeqRetargeting:
joint_names,
finger_tip_link_names=self.finger_tip_link_names,
wrist_link_name=self.wrist_link_name,
target_link_human_indices=self.target_link_human_indices,
scaling=self.scaling_factor,
)
else:
Expand Down
2 changes: 1 addition & 1 deletion example/vector_retargeting/render_robot_hand.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def render_by_sapien(
headless: Optional[bool] = False,
):
# Generate rendering config
use_rt = True
use_rt = headless
if not use_rt:
sapien.render.set_viewer_shader_dir("default")
sapien.render.set_camera_shader_dir("default")
Expand Down

0 comments on commit 3567c98

Please sign in to comment.