-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Real2Sim Eval Digital Twins (#536)
* work * work * Update base_env.py * greenscreen trick added * code refactors * work * Update widowx.py * fixes * fixes * updates * bug fixes * align sim configs * fixes * Update demo_octo_eval.py * debugged * work * bug fixes * attempt to support IK * work * cleanup * work * work * cleaned up code * evals * fixes * spoon task * Update demo_octo_eval.py * work * update widowx model download link and cleanup code * fixes * work * bug fixes * rt1 inference example * bug fixes * less eggplant rolling * code cleanup * GPU IK no delta controller implemented * gpu fixes * bug fixes * work * fixes * work * w * cleanup * code cleanup, assets added * docs * Delete demo_real2sim_eval.py * f * Update base_env.py * Update base_env.py * Delete README.md * Update index.md
- Loading branch information
1 parent
532bb97
commit 3543565
Showing
23 changed files
with
1,176 additions
and
58 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1 +1,47 @@ | ||
# Digital Twins (WIP) | ||
# Digital Twins | ||
|
||
ManiSkill supports both training and evaluation types of digital twins and provides a simple framework for building them. Training digital twins are tasks designed to train a robot in simulation to then be deployed in the real world (sim2real). Evaluation digital twins are tasks designed to evaluate the performance of a robot trained on real world data (real2sim) and not for training. | ||
|
||
|
||
## Training Digital Twins (WIP) | ||
|
||
Coming soon. | ||
|
||
## BridgeData v2 (Evaluation) | ||
|
||
We currently support evaluation digital twins of some tasks in the [BridgeData v2](https://rail-berkeley.github.io/bridgedata/) environments in simulation based on [SimplerEnv](https://simpler-env.github.io/) by Xuanlin Li, Kyle Hsu, Jiayuan Gu et al. These digital twins are also GPU parallelized enabling large-scale, fast, evaluation of real-world generalist robotics policies. GPU simulation + rendering enables evaluating up to 60x faster than the real-world and 10x faster than CPU simulation, all without human supervision. ManiSkill only provides the environments, to run policy inference of models like Octo and RT see https://github.com/simpler-env/SimplerEnv/tree/maniskill3 | ||
|
||
If you use the BridgeData v2 digital twins please cite the following in addition to ManiSkill 3: | ||
|
||
``` | ||
@article{li24simpler, | ||
title={Evaluating Real-World Robot Manipulation Policies in Simulation}, | ||
author={Xuanlin Li and Kyle Hsu and Jiayuan Gu and Karl Pertsch and Oier Mees and Homer Rich Walke and Chuyuan Fu and Ishikaa Lunawat and Isabel Sieh and Sean Kirmani and Sergey Levine and Jiajun Wu and Chelsea Finn and Hao Su and Quan Vuong and Ted Xiao}, | ||
journal = {arXiv preprint arXiv:2405.05941}, | ||
year={2024}, | ||
} | ||
``` | ||
|
||
### PutCarrotOnPlateInScene-v1 | ||
|
||
<video preload="auto" controls="True" width="100%"> | ||
<source src="https://github.com/haosulab/ManiSkill/raw/main/figures/environment_demos/digital_twins/bridge_data_v2/PutCarrotOnPlateInScene-v1.mp4" type="video/mp4"> | ||
</video> | ||
|
||
### PutSpoonOnTableClothInScene-v1 | ||
|
||
<video preload="auto" controls="True" width="100%"> | ||
<source src="https://github.com/haosulab/ManiSkill/raw/main/figures/environment_demos/digital_twins/bridge_data_v2/PutSpoonOnTableClothInScene-v1.mp4" type="video/mp4"> | ||
</video> | ||
|
||
### StackGreenCubeOnYellowCubeBakedTexInScene-v1 | ||
|
||
<video preload="auto" controls="True" width="100%"> | ||
<source src="https://github.com/haosulab/ManiSkill/raw/main/figures/environment_demos/digital_twins/bridge_data_v2/StackGreenCubeOnYellowCubeBakedTexInScene-v1.mp4" type="video/mp4"> | ||
</video> | ||
|
||
### PutEggplantInBasketScene-v1 | ||
|
||
<video preload="auto" controls="True" width="100%"> | ||
<source src="https://github.com/haosulab/ManiSkill/raw/main/figures/environment_demos/digital_twins/bridge_data_v2/PutEggplantInBasketScene-v1.mp4" type="video/mp4"> | ||
</video> |
This file contains 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
Binary file added
BIN
+137 KB
figures/environment_demos/digital_twins/bridge_data_v2/PutCarrotOnPlateInScene-v1.mp4
Binary file not shown.
Binary file added
BIN
+124 KB
figures/environment_demos/digital_twins/bridge_data_v2/PutEggplantInBasketScene-v1.mp4
Binary file not shown.
Binary file added
BIN
+131 KB
figures/environment_demos/digital_twins/bridge_data_v2/PutSpoonOnTableClothInScene-v1.mp4
Binary file not shown.
Binary file added
BIN
+110 KB
...nment_demos/digital_twins/bridge_data_v2/StackGreenCubeOnYellowCubeBakedTexInScene-v1.mp4
Binary file not shown.
This file contains 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 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 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 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 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 |
---|---|---|
@@ -1,16 +1,62 @@ | ||
import numpy as np | ||
import sapien | ||
import torch | ||
|
||
from mani_skill import ASSET_DIR | ||
from mani_skill.agents.base_agent import BaseAgent | ||
from mani_skill.agents.controllers import * | ||
from mani_skill.agents.registration import register_agent | ||
from mani_skill.sensors.camera import CameraConfig | ||
from mani_skill.utils import common | ||
from mani_skill.utils.structs.actor import Actor | ||
|
||
|
||
# TODO (stao) (xuanlin): model it properly based on real2sim | ||
@register_agent(asset_download_ids=["widowx250s"]) | ||
class WidowX250S(BaseAgent): | ||
uid = "widowx250s" | ||
urdf_path = f"{ASSET_DIR}/robots/widowx250s/wx250s.urdf" | ||
urdf_path = f"{ASSET_DIR}/robots/widowx/wx250s.urdf" | ||
urdf_config = dict() | ||
|
||
arm_joint_names = [ | ||
"waist", | ||
"shoulder", | ||
"elbow", | ||
"forearm_roll", | ||
"wrist_angle", | ||
"wrist_rotate", | ||
] | ||
gripper_joint_names = ["left_finger", "right_finger"] | ||
|
||
def _after_loading_articulation(self): | ||
self.finger1_link = self.robot.links_map["left_finger_link"] | ||
self.finger2_link = self.robot.links_map["right_finger_link"] | ||
|
||
def is_grasping(self, object: Actor, min_force=0.5, max_angle=85): | ||
"""Check if the robot is grasping an object | ||
Args: | ||
object (Actor): The object to check if the robot is grasping | ||
min_force (float, optional): Minimum force before the robot is considered to be grasping the object in Newtons. Defaults to 0.5. | ||
max_angle (int, optional): Maximum angle of contact to consider grasping. Defaults to 85. | ||
""" | ||
l_contact_forces = self.scene.get_pairwise_contact_forces( | ||
self.finger1_link, object | ||
) | ||
r_contact_forces = self.scene.get_pairwise_contact_forces( | ||
self.finger2_link, object | ||
) | ||
lforce = torch.linalg.norm(l_contact_forces, axis=1) | ||
rforce = torch.linalg.norm(r_contact_forces, axis=1) | ||
|
||
# direction to open the gripper | ||
ldirection = self.finger1_link.pose.to_transformation_matrix()[..., :3, 1] | ||
rdirection = -self.finger2_link.pose.to_transformation_matrix()[..., :3, 1] | ||
langle = common.compute_angle_between(ldirection, l_contact_forces) | ||
rangle = common.compute_angle_between(rdirection, r_contact_forces) | ||
lflag = torch.logical_and( | ||
lforce >= min_force, torch.rad2deg(langle) <= max_angle | ||
) | ||
rflag = torch.logical_and( | ||
rforce >= min_force, torch.rad2deg(rangle) <= max_angle | ||
) | ||
return torch.logical_and(lflag, rflag) |
This file contains 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 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.