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
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ temp/
data/AMASS/Transitions/
data/g1_29dof/
data/smpl/

data/Transitions
# Pickle files
# *.pkl

homework.md
homework.md

11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,18 @@ Then we need to fit the motion data to the humanoid robot:
```bash
uv run scripts/3-fit_smpl_motion_mp.py +motion_path=./data/AMASS +target_fps=30 +output_name=<motion_file>
```
fit motion with quat
```bash
uv run scripts/3-fit_smpl_motion_withquat.py +motion_path=./data/AMASS +target_fps=30 +output_name=<motion_file>
```

It will save the fitted motion data in the `data/g1_29dof/<output_name>.pkl` file.

Finally, we can visualize the fitted motion data:
```bash
uv run scripts/3-vis_q_mj.py +motion_file=./data/g1_29dof/<output_name>.pkl
uv run scripts/4-vis_mj.py +motion_file=./data/g1_29dof/<output_name>.pkl
```
find orit offset
```bash
uv run 5-findoffset.py
```
48 changes: 48 additions & 0 deletions cfg/unitree_g1_fitting copy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
humanoid_type: g1_29dof

asset:
assetFileName: "assets/robot/unitree_g1/g1_29dof_rev_1_0.xml"


extend_config:
- joint_name: "head_link"
parent_name: "pelvis"
pos: [0.0, 0.0, 0.4]
rot: [1.0, 0.0, 0.0, 0.0]

- joint_name: "left_toe_link"
parent_name: "left_ankle_roll_link"
pos: [0.08, 0.0, 0.0]
rot: [1.0, 0.0, 0.0, 0.0]

- joint_name: "right_toe_link"
parent_name: "right_ankle_roll_link"
pos: [0.08, 0.0, 0.0]
rot: [1.0, 0.0, 0.0, 0.0]

base_link: "torso_link"
joint_matches:
- ["pelvis", "Pelvis"]
- ["left_hip_pitch_link", "L_Hip"]
- ["left_knee_link", "L_Knee"]
- ["left_ankle_roll_link", "L_Ankle"]
- ["right_hip_pitch_link", "R_Hip"]
- ["right_knee_link", "R_Knee"]
- ["right_ankle_roll_link", "R_Ankle"]
- ["left_shoulder_roll_link", "L_Shoulder"]
- ["left_elbow_link", "L_Elbow"]
- ["left_wrist_yaw_link", "L_Hand"]
- ["right_shoulder_roll_link", "R_Shoulder"]
- ["right_elbow_link", "R_Elbow"]
- ["right_wrist_yaw_link", "R_Hand"]
- ["head_link", "Head"]
- ["left_toe_link", "L_Toe"]
- ["right_toe_link", "R_Toe"]


smpl_pose_modifier:
Pelvis: "[np.pi/2, 0, np.pi/2]"
L_Shoulder: "[0, 0, -np.pi/2]"
R_Shoulder: "[0, 0, np.pi/2]"
L_Elbow: "[0, -np.pi/2, 0]"
R_Elbow: "[0, np.pi/2, 0]"
40 changes: 39 additions & 1 deletion cfg/unitree_g1_fitting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,42 @@ smpl_pose_modifier:
L_Shoulder: "[0, 0, -np.pi/2]"
R_Shoulder: "[0, 0, np.pi/2]"
L_Elbow: "[0, -np.pi/2, 0]"
R_Elbow: "[0, np.pi/2, 0]"
R_Elbow: "[0, np.pi/2, 0]"


orit_offset:
Pelvis: "[np.pi/2, 0, np.pi/2]"
L_Hip: "[np.pi/2, 0, np.pi/2]"
R_Hip: "[np.pi/2, 0, np.pi/2]"
L_Knee: "[np.pi/2, 0, np.pi/2]"
R_Knee: "[np.pi/2, 0, np.pi/2]"
L_Ankle: "[np.pi/2, 0, np.pi/2]"
R_Ankle: "[np.pi/2, 0, np.pi/2]"
L_Toe: "[np.pi/2, 0, np.pi/2]"
R_Toe: "[np.pi/2, 0, np.pi/2]"
Head: "[np.pi/2, 0, np.pi/2]"
L_Shoulder: "[0, np.pi/2, 0]"
R_Shoulder: "[-np.pi, -np.pi/2, 0]"
L_Elbow: "[np.pi * 0.25, 0, 0]"
R_Elbow: "[0 , 0, -np.pi]"
L_Hand: "[0, 0, 0]"
R_Hand: "[0.0, 0, -np.pi ]"

quat_offset:
Pelvis: "[0.5, -0.5, -0.5, -0.5]"
L_Hip: "[0.4267755048530407,-0.5637931078484661,-0.5637931078484661,-0.4267755048530407]"
L_Knee: "[0.5, -0.5, -0.5, -0.5]"
L_Ankle: "[0.5, -0.5, -0.5, -0.5]"
R_Hip: "[0.4267755048530407,-0.5637931078484661,-0.5637931078484661,-0.4267755048530407]"
R_Knee: "[0.5, -0.5, -0.5, -0.5]"
R_Ankle: "[0.5, -0.5, -0.5, -0.5]"
L_Toe: "[0.5, -0.5, -0.5, -0.5]"
R_Toe: "[0.5, -0.5, -0.5, -0.5]"
Head: "[0.5, -0.5, -0.5, -0.5]"
L_Shoulder: "[0.7071, 0, -0.7071, 0]"
#L_Elbow: "[0.924, -0.383, 0, 0]"
L_Elbow: "[1, 0, 0, 0]"
L_Hand: "[1, 0, 0, 0]"
R_Shoulder: "[0, 0.7071, 0, 0.7071]"
R_Elbow: "[0, 0, 0, -1]"
R_Hand: "[0, 0, 0, -1]"
Binary file removed data/AMASS/SFU/0005/0005_Walking001_poses.npz
Binary file not shown.
Binary file added data/AMASS/SFU/0005/twistdance_kick_stageii.npz
Binary file not shown.
62 changes: 62 additions & 0 deletions data/Transitions/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
License
Dataset Copyright License for non-commercial scientific research purposes

Please read carefully the following terms and conditions and any accompanying documentation before you download and/or use the AMASS Dataset and the accompanying materials (jointly referred to as the "Dataset"). By downloading and/or using the Dataset, you acknowledge that you have read these terms and conditions, understand them, and agree to be bound by them. If you do not agree with these terms and conditions, you must not download and/or use the Dataset. Any infringement of the terms of this agreement will automatically terminate your rights under this License.

Ownership / Licensees
The Dataset and the associated materials has been developed at the

Max Planck Institute for Intelligent Systems (hereinafter "MPI") and the Max Planck Institute for Biological Cybernetics (hereinafter “KYB”).

Any copyright or patent right is owned by and proprietary material of the

Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (hereinafter “MPG”; MPI and MPG hereinafter collectively “Max-Planck”)

hereinafter the “Licensor”.

License Grant
Licensor grants you (Licensee) personally a single-user, non-exclusive, non-transferable, free of charge right:

To obtain and install the Dataset on computers owned, leased or otherwise controlled by you and/or your organization;
To use the Dataset for the sole purpose of performing non-commercial scientific research, non-commercial education, or non-commercial artistic projects;
To modify, adapt, translate or create derivative works based upon the Dataset.
Any other use, in particular any use for commercial, pornographic, military, or surveillance, purposes is prohibited. This includes, without limitation, incorporation in a commercial product, use in a commercial service, or production of other artifacts for commercial purposes. The Data & Software may not be used to create fake, libelous, misleading, or defamatory content of any kind excluding analyses in peer-reviewed scientific research. The Data & Software may not be reproduced, modified and/or made available in any form to any third party without Max-Planck’s prior written permission.

The Data & Software may not be used for pornographic purposes or to generate pornographic material whether commercial or not. This license also prohibits the use of the Software to train methods/algorithms/neural networks/etc. for commercial, pornographic, military, surveillance, or defamatory use of any kind. By downloading the Data & Software, you agree not to reverse engineer it.

No Distribution
The Dataset and the license herein granted shall not be copied, shared, distributed, re-sold, offered for re-sale, transferred or sub-licensed in whole or in part except that you may make one copy for archive purposes only.

Disclaimer of Representations and Warranties
You expressly acknowledge and agree that the Dataset results from basic research, is provided “AS IS”, may contain errors, and that any use of the Dataset is at your sole risk. LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE SOFTWARE, NEITHER EXPRESS NOR IMPLIED, AND THE ABSENCE OF ANY LEGAL OR ACTUAL DEFECTS, WHETHER DISCOVERABLE OR NOT. Specifically, and not to limit the foregoing, licensor makes no representations or warranties (i) regarding the merchantability or fitness for a particular purpose of the Dataset, (ii) that the use of the Dataset will not infringe any patents, copyrights or other intellectual property rights of a third party, and (iii) that the use of the Dataset will not cause any damage of any kind to you or a third party.

Limitation of Liability
Because this Software License Agreement qualifies as a donation, according to Section 521 of the German Civil Code (Bürgerliches Gesetzbuch – BGB) Licensor as a donor is liable for intent and gross negligence only. If the Licensor fraudulently conceals a legal or material defect, they are obliged to compensate the Licensee for the resulting damage.
Licensor shall be liable for loss of data only up to the amount of typical recovery costs which would have arisen had proper and regular data backup measures been taken. For the avoidance of doubt Licensor shall be liable in accordance with the German Product Liability Act in the event of product liability. The foregoing applies also to Licensor’s legal representatives or assistants in performance. Any further liability shall be excluded.
Patent claims generated through the usage of the Dataset cannot be directed towards the copyright holders.
The contractor points out that add-ons as well as minor modifications to the Dataset may lead to unforeseeable and considerable disruptions.

No Maintenance Services
You understand and agree that Licensor is under no obligation to provide either maintenance services, update services, notices of latent defects, or corrections of defects with regard to the Dataset. Licensor nevertheless reserves the right to update, modify, or discontinue the Dataset at any time.

Defects of the Dataset must be notified in writing to the Licensor with a comprehensible description of the error symptoms. The notification of the defect should enable the reproduction of the error. The Licensee is encouraged to communicate any use, results, modification or publication.

Publications using the Dataset
You acknowledge that the Dataset is a valuable scientific resource and agree to appropriately reference the following paper in any publication making use of the Dataset.

Citation:

@inproceedings{AMASS:2019,
title={AMASS: Archive of Motion Capture as Surface Shapes},
author={Mahmood, Naureen and Ghorbani, Nima and F. Troje, Nikolaus and Pons-Moll, Gerard and Black, Michael J.},
booktitle = {The IEEE International Conference on Computer Vision (ICCV)},
year={2019},
month = {Oct},
url = {https://amass.is.tue.mpg.de},
month_numeric = {10}
}

Commercial licensing opportunities
For commercial uses of the Dataset, please send email to ps-license@tue.mpg.de

This Agreement shall be governed by the laws of the Federal Republic of Germany except for the UN Sales Convention.
Binary file added data/g1_29dof_offsets.npz
Binary file not shown.
2 changes: 2 additions & 0 deletions scripts/3-fit_smpl_motion_mp.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ def mat_rotate(rotmat, v):
opt.step()
# if i % 10 == 0:
# print(f"iter {i}, loss {100 * loss.item():.3f}")
if i % 490 == 0:
print(f"iter {i}, loss {100 * loss.item():.3f}, keypoint_error {100 * keypoints_pos_error.item():.3f}, joint_limit_violation {L_limit.item():.6f}")

with torch.no_grad():
robot_keypoints_b = torch.stack([
Expand Down
Loading