Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions general_motion_retargeting/ik_configs/bvh_fzmotion_to_g1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"robot_root_name": "pelvis",
"human_root_name": "Hips",
"ground_height": 0.0,
"human_height_assumption": 1.8,
"use_ik_match_table1": true,
"use_ik_match_table2": true,

"human_scale_table": {
"Hips": 0.9,
"Chest": 0.9,

"LeftUpLeg": 0.9,
"RightUpLeg": 0.9,
"LeftLeg": 0.9,
"RightLeg": 0.9,
"LeftFoot": 0.9,
"RightFoot": 0.9,

"LeftArm": 0.75,
"RightArm": 0.75,
"LeftForeArm": 0.75,
"RightForeArm": 0.75,
"LeftHand": 0.75,
"RightHand": 0.75
},

"ik_match_table1": {
"pelvis": ["Hips", 0, 10, [0.0, 0.0, 0.0], [0.5, -0.5, -0.5, -0.5]],
"left_hip_yaw_link": ["LeftUpLeg", 0, 10, [0.0, 0.0, 0.0], [0.5, -0.5, -0.5, -0.5]],
"left_knee_link": ["LeftLeg", 0, 10, [0.0, 0.0, 0.0], [0.5, -0.5, -0.5, -0.5]],
"left_ankle_roll_link": ["LeftFoot", 50, 10, [0.0, 0.0, 0.0], [0.5, -0.5, -0.5, -0.5]],

"right_hip_yaw_link": ["RightUpLeg", 0, 10, [0.0, 0.0, 0.0], [0.5, -0.5, -0.5, -0.5]],
"right_knee_link": ["RightLeg", 0, 10, [0.0, 0.0, 0.0], [0.5, -0.5, -0.5, -0.5]],
"right_ankle_roll_link": ["RightFoot", 50, 10, [0.0, 0.0, 0.0], [0.5, -0.5, -0.5, -0.5]],

"torso_link": ["Chest", 0, 100, [0.0, 0.0, 0.0], [0.5, -0.5, -0.5, -0.5]],

"left_shoulder_yaw_link": ["LeftArm", 0, 100, [0.0, 0.0, 0.0], [0.70710678, 0.0, -0.70710678, 0.0]],
"left_elbow_link": ["LeftForeArm", 0, 10, [0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0]],
"left_wrist_yaw_link": ["LeftHand", 0, 10, [0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0]],

"right_shoulder_yaw_link": ["RightArm", 0, 100, [0.0, 0.0, 0.0], [0.0, 0.707106781, 0.0, 0.707106781]],
"right_elbow_link": ["RightForeArm", 0, 10, [0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 1.0]],
"right_wrist_yaw_link": ["RightHand", 0, 10, [0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 1.0]]
},

"ik_match_table2": {
"pelvis": ["Hips", 100, 5, [0.0, 0.0, 0.0], [0.5, -0.5, -0.5, -0.5]],
"left_hip_yaw_link": ["LeftUpLeg", 10, 5, [0.0, 0.0, 0.0], [0.5, -0.5, -0.5, -0.5]],
"left_knee_link": ["LeftLeg", 10, 5, [0.0, 0.0, 0.0], [0.5, -0.5, -0.5, -0.5]],
"left_ankle_roll_link": ["LeftFoot", 50, 10, [0.0, 0.0, 0.0], [0.5, -0.5, -0.5, -0.5]],

"right_hip_yaw_link": ["RightUpLeg", 10, 5, [0.0, 0.0, 0.0], [0.5, -0.5, -0.5, -0.5]],
"right_knee_link": ["RightLeg", 10, 5, [0.0, 0.0, 0.0], [0.5, -0.5, -0.5, -0.5]],
"right_ankle_roll_link": ["RightFoot", 50, 10, [0.0, 0.0, 0.0], [0.5, -0.5, -0.5, -0.5]],

"torso_link": ["Chest", 0, 10, [0.0, 0.0, 0.0], [0.5, -0.5, -0.5, -0.5]],

"left_shoulder_yaw_link": ["LeftArm", 5, 100, [0.0, 0.0, 0.0], [0.70710678, 0.0, -0.70710678, 0.0]],
"left_elbow_link": ["LeftForeArm", 10, 5, [0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0]],
"left_wrist_yaw_link": ["LeftHand", 10, 5, [0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0]],

"right_shoulder_yaw_link": ["RightArm", 5, 100, [0.0, 0.0, 0.0], [0.0, 0.707106781, 0.0, 0.707106781]],
"right_elbow_link": ["RightForeArm", 10, 5, [0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 1.0]],
"right_wrist_yaw_link": ["RightHand", 10, 5, [0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 1.0]]
}
}
3 changes: 3 additions & 0 deletions general_motion_retargeting/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
"bvh_nokov":{
"unitree_g1": IK_CONFIG_ROOT / "bvh_nokov_to_g1.json",
},
"bvh_fzmotion":{
"unitree_g1": IK_CONFIG_ROOT / "bvh_fzmotion_to_g1.json",
},
"bvh_xsens":{
"unitree_g1": IK_CONFIG_ROOT / "bvh_xsens_to_g1.json",
"unitree_h1_2": IK_CONFIG_ROOT / "bvh_xsens_to_h1_2.json",
Expand Down
10 changes: 5 additions & 5 deletions scripts/bvh_to_robot_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import torch
import pickle

from general_motion_retargeting.utils.lafan1 import load_lafan1_file
from general_motion_retargeting.utils.lafan1 import load_bvh_file
from general_motion_retargeting.kinematics_model import KinematicsModel
from general_motion_retargeting import GeneralMotionRetargeting as GMR
from rich import print
Expand Down Expand Up @@ -73,16 +73,16 @@

# Load LAFAN1 trajectory
try:
lafan1_data_frames, actual_human_height = load_lafan1_file(bvh_file_path)
src_fps = 30 # LAFAN1 data is typically 30 FPS
lafan1_data_frames, actual_human_height = load_bvh_file(bvh_file_path)
src_fps = 120 # LAFAN1 data is typically 30 FPS
except Exception as e:
print(f"Error loading {bvh_file_path}: {e}")
continue


# Initialize the retargeting system
retarget = GMR(
src_human="bvh",
src_human="bvh_fzmotion",
tgt_robot=args.robot,
actual_human_height=actual_human_height,
)
Expand All @@ -93,7 +93,7 @@

# retarget to get all qpos
qpos_list = []
for curr_frame in range(len(lafan1_data_frames)):
for curr_frame in tqdm(range(len(lafan1_data_frames))):
smplx_data = lafan1_data_frames[curr_frame]

# Retarget till convergence
Expand Down