Skip to content

Commit 4730373

Browse files
authored
Merge pull request #24 from facebookresearch:chaoyi/sam3
Chaoyi/sam3
2 parents e92a2c9 + b557785 commit 4730373

File tree

15 files changed

+1160
-74
lines changed

15 files changed

+1160
-74
lines changed

docs/guide/quick-start.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,19 @@ uv run examples/run_mjwp.py \
115115
Set environment variables:
116116

117117
```bash
118+
# humanoid only
118119
export TASK=dance
119120
export HAND_TYPE=humanoid
120121
export DATA_ID=0
121122
export ROBOT_TYPE=unitree_g1
122123
export DATASET_NAME=lafan
124+
125+
# humanoid + object
126+
export TASK=move_largebox
127+
export HAND_TYPE=humanoid_object
128+
export DATA_ID=0
129+
export ROBOT_TYPE=unitree_g1
130+
export DATASET_NAME=omomo
123131
```
124132

125133
### Run IK
@@ -141,18 +149,32 @@ uv run spider/process_datasets/locomujoco.py \
141149
--data-id=${DATA_ID} \
142150
--robot-type=${ROBOT_TYPE} \
143151
--embodiment-type=${HAND_TYPE}
152+
153+
# for humanoid + object, we don't have a pipeline yet
154+
# you can directly download data from omniretarget
155+
# https://huggingface.co/datasets/omniretarget/OmniRetarget_Dataset
144156
```
145157

146158
### Run Physics-Based Retargeting
147159

148160
```bash
161+
# for humanoid only
149162
uv run examples/run_mjwp.py \
150163
+override=humanoid \
151164
dataset_name=${DATASET_NAME} \
152165
task=${TASK} \
153166
data_id=${DATA_ID} \
154167
robot_type=${ROBOT_TYPE} \
155168
embodiment_type=${HAND_TYPE}
169+
170+
# for humanoid + object, we don't have a pipeline yet
171+
uv run examples/run_mjwp.py \
172+
+override=humanoid_object \
173+
dataset_name=${DATASET_NAME} \
174+
task=${TASK} \
175+
data_id=${DATA_ID} \
176+
robot_type=${ROBOT_TYPE} \
177+
embodiment_type=${HAND_TYPE}
156178
```
157179

158180
## Understanding the Output

docs/usage/viewers.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,42 @@ SPIDER supports the following viewer configurations:
1010
|--------|-------------|----------|
1111
| `mujoco` | Native MuJoCo viewer | Fast local visualization |
1212
| `rerun` | Rerun.io viewer | Remote development, rich logging |
13+
| `viser` | Viser web viewer | Lightweight remote visualization |
1314

14-
To enable both, try `mujoco-rerun` viewer.
15+
To enable both, try `mujoco-rerun` or `mujoco-viser` viewer.
16+
17+
## Viser Viewer
18+
19+
[Viser](https://github.com/nerfstudio-project/viser) provides a lightweight web-based viewer for 3D scenes.
20+
21+
### Local Usage
22+
23+
```bash
24+
uv run examples/run_mjwp.py viewer=viser
25+
```
26+
27+
This will:
28+
1. Start a Viser server
29+
2. Log simulation data in real-time
30+
3. Print a URL to open in your browser
31+
32+
::: warning
33+
If you run headless (no X display), you may need to set a display before launching:
34+
35+
```bash
36+
export DISPLAY=:1
37+
# or
38+
export MUJOCO_GL=egl
39+
```
40+
:::
41+
42+
::: info
43+
If you see an import error, install the dependency:
44+
45+
```bash
46+
pip install viser
47+
```
48+
:::
1549

1650
## Rerun Viewer
1751

examples/config/default.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ num_samples: 1024
4343
temperature: 0.1
4444
max_num_iterations: 32
4545
improvement_threshold: 0.01
46+
improvement_check_steps: 1
4647
# Noise scheduling
4748
first_ctrl_noise_scale: 0.5
4849
last_ctrl_noise_scale: 1.0
@@ -68,7 +69,7 @@ object_rot_threshold: 0.3 # radians
6869

6970
# === VISUALIZATION CONFIGURATION ===
7071
show_viewer: true
71-
viewer: mujoco-rerun # "mujoco" | "rerun" | "isaac"
72+
viewer: mujoco-rerun # "mujoco" | "rerun" | "viser" | "isaac"
7273
rerun_spawn: true
7374
save_video: true
7475
save_rerun: false
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# @package _global_
2+
# Override configuration for gigahand dataset
3+
dataset_name: gigahand
4+
robot_type: xhand
5+
embodiment_type: bimanual
6+
task: p36-tea
7+
data_id: 10
8+
horizon: 2.0
9+
temperature: 1.0
10+
pos_noise_scale: 0.05
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# @package _global_
2+
task: pick_spoon_bowl
3+
robot_type: xhand
4+
embodiment_type: bimanual
5+
data_id: 0
6+
temperature: 1.0
7+
horizon: 2.0
8+
base_pos_rew_scale: 0.1
9+
base_rot_rew_scale: 0.03
10+
rot_rew_scale: 0.1
11+
joint_noise_scale: 0.03

examples/run_hdmi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@
4545
sync_env,
4646
)
4747
from spider.viewers import (
48+
log_frame,
4849
render_image,
4950
setup_renderer,
5051
setup_viewer,
5152
update_viewer,
5253
)
53-
from spider.viewers.rerun_viewer import log_frame
5454

5555

5656
def main(config: Config):
@@ -221,7 +221,7 @@ def main(config: Config):
221221
config, renderer, mj_model, mj_data, mj_data_ref
222222
)
223223
images.append(image)
224-
if "rerun" in config.viewer:
224+
if "rerun" in config.viewer or "viser" in config.viewer:
225225
# manually log the state
226226
log_frame(
227227
mj_data,

examples/run_mjwp.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,13 @@
4949
step_env,
5050
sync_env,
5151
)
52-
from spider.viewers import render_image, setup_renderer, setup_viewer, update_viewer
53-
from spider.viewers.rerun_viewer import log_frame
52+
from spider.viewers import (
53+
log_frame,
54+
render_image,
55+
setup_renderer,
56+
setup_viewer,
57+
update_viewer,
58+
)
5459

5560

5661
def main(config: Config):
@@ -174,7 +179,7 @@ def main(config: Config):
174179
config, renderer, mj_model, mj_data, mj_data_ref
175180
)
176181
images.append(image)
177-
if "rerun" in config.viewer:
182+
if "rerun" in config.viewer or "viser" in config.viewer:
178183
# manually log the state
179184
log_frame(
180185
mj_data,

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ dependencies = [
2121
"opencv-python",
2222
"newton[examples] @ git+https://github.com/newton-physics/newton.git",
2323
"rerun-sdk==0.26.2",
24+
"viser",
2425
"ipdb",
2526
"pymeshlab",
2627
"open3d",

spider/assets/robots/xhand/left.xml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,15 @@
108108
<geom name="left_thumb_rota2_visual" type="mesh" contype="0" conaffinity="0"
109109
group="1" density="0" rgba="0.384314 0.384314 0.384314 1"
110110
mesh="left_hand_thumb_rota_link2" />
111-
<geom name="collision_hand_left_thumb_0" type="capsule" size="0.008"
112-
fromto="0 0 0 0.045 0 0"
111+
<geom name="collision_hand_left_thumb_0" type="capsule" size="0.015"
112+
fromto="0 0 0 0.04 0 0"
113113
rgba="0 1 0 1"
114114
group="3" />
115115
<geom size="0.001" pos="0.0504017 0 0" contype="0" conaffinity="0" group="1"
116116
density="0" rgba="0.698039 0.698039 0.698039 1" />
117-
<site name="left_thumb_tip" pos="0.0504017 0 0" />
118-
<site name="track_hand_left_thumb_tip" pos="0.0504017 0 0" />
119-
<site name="trace_hand_left_thumb_tip" pos="0.0504017 0 0" />
117+
<site name="left_thumb_tip" pos="0.045 0 -0.015" />
118+
<site name="track_hand_left_thumb_tip" pos="0.045 0 -0.015" />
119+
<site name="trace_hand_left_thumb_tip" pos="0.045 0 -0.015" />
120120
</body>
121121
</body>
122122
</body>
@@ -153,9 +153,9 @@
153153
fromto="0 0 0 0 0 -0.03" rgba="0 1 0 1" group="3" />
154154
<geom size="0.001" pos="0 0 -0.0425" contype="0" conaffinity="0" group="1"
155155
density="0" rgba="0.698039 0.698039 0.698039 1" />
156-
<site name="left_index_tip" pos="0 0 -0.0425" />
157-
<site name="track_hand_left_index_tip" pos="0 0 -0.0425" />
158-
<site name="trace_hand_left_index_tip" pos="0 0 -0.0425" />
156+
<site name="left_index_tip" pos="0 -0.005 -0.03" />
157+
<site name="track_hand_left_index_tip" pos="0 -0.005 -0.03" />
158+
<site name="trace_hand_left_index_tip" pos="0 -0.005 -0.03" />
159159
</body>
160160
</body>
161161
</body>
@@ -182,9 +182,9 @@
182182
fromto="0 0 0 0 0 -0.03" rgba="0 1 0 1" group="3" />
183183
<geom size="0.001" pos="0 0 -0.0425" contype="0" conaffinity="0" group="1"
184184
density="0" rgba="0.698039 0.698039 0.698039 1" />
185-
<site name="left_middle_tip" pos="0 0 -0.0425" />
186-
<site name="track_hand_left_middle_tip" pos="0 0 -0.0425" />
187-
<site name="trace_hand_left_middle_tip" pos="0 0 -0.0425" />
185+
<site name="left_middle_tip" pos="0 -0.005 -0.03" />
186+
<site name="track_hand_left_middle_tip" pos="0 -0.005 -0.03" />
187+
<site name="trace_hand_left_middle_tip" pos="0 -0.005 -0.03" />
188188
</body>
189189
</body>
190190
<body name="left_hand_ring_link1" pos="-0.016 -0.0065 -0.1052">
@@ -210,9 +210,9 @@
210210
fromto="0 0 0 0 0 -0.03" rgba="0 1 0 1" group="3" />
211211
<geom size="0.001" pos="0 0 -0.0425" contype="0" conaffinity="0" group="1"
212212
density="0" rgba="0.698039 0.698039 0.698039 1" />
213-
<site name="left_ring_tip" pos="0 0 -0.0425" />
214-
<site name="track_hand_left_ring_tip" pos="0 0 -0.0425" />
215-
<site name="trace_hand_left_ring_tip" pos="0 0 -0.0425" />
213+
<site name="left_ring_tip" pos="0 -0.005 -0.03" />
214+
<site name="track_hand_left_ring_tip" pos="0 -0.005 -0.03" />
215+
<site name="trace_hand_left_ring_tip" pos="0 -0.005 -0.03" />
216216
</body>
217217
</body>
218218
<body name="left_hand_pinky_link1" pos="-0.036 -0.0065 -0.1022">
@@ -238,9 +238,9 @@
238238
fromto="0 0 0 0 0 -0.03" rgba="0 1 0 1" group="3" />
239239
<geom size="0.001" pos="0 0 -0.0425" contype="0" conaffinity="0" group="1"
240240
density="0" rgba="0.698039 0.698039 0.698039 1" />
241-
<site name="left_pinky_tip" pos="0 0 -0.0425" />
242-
<site name="track_hand_left_pinky_tip" pos="0 0 -0.0425" />
243-
<site name="trace_hand_left_pinky_tip" pos="0 0 -0.0425" />
241+
<site name="left_pinky_tip" pos="0 -0.005 -0.03" />
242+
<site name="track_hand_left_pinky_tip" pos="0 -0.005 -0.03" />
243+
<site name="trace_hand_left_pinky_tip" pos="0 -0.005 -0.03" />
244244
</body>
245245
</body>
246246
</body>
@@ -282,4 +282,4 @@
282282
<position name="left_pinky_joint1_position" joint="left_hand_pinky_joint1" />
283283
<position name="left_pinky_joint2_position" joint="left_hand_pinky_joint2" />
284284
</actuator>
285-
</mujoco>
285+
</mujoco>

spider/assets/robots/xhand/right.xml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,16 @@
101101
<geom name="right_thumb_rota2_visual" type="mesh" contype="0" conaffinity="0"
102102
group="1" density="0" rgba="0.792157 0.819608 0.933333 1"
103103
mesh="right_hand_thumb_rota_link2" />
104-
<geom name="collision_hand_right_thumb_0" type="capsule" size="0.008"
105-
fromto="0 0 0 0.045 0 0"
104+
<geom name="collision_hand_right_thumb_0" type="capsule" size="0.015"
105+
fromto="0 0 0 0.04 0 0"
106106
rgba="0 1 0 1"
107107
group="3" />
108+
108109
<geom size="0.001" pos="0.0504025 0 0" contype="0" conaffinity="0" group="1"
109110
density="0" rgba="0.698039 0.698039 0.698039 1" />
110-
<site name="right_thumb_tip" pos="0.0504025 0 0" />
111-
<site name="track_hand_right_thumb_tip" pos="0.0504025 0 0" />
112-
<site name="trace_hand_right_thumb_tip" pos="0.0504025 0 0" />
111+
<site name="right_thumb_tip" pos="0.045 0 -0.015" />
112+
<site name="track_hand_right_thumb_tip" pos="0.045 0 -0.015" />
113+
<site name="trace_hand_right_thumb_tip" pos="0.045 0 -0.015" />
113114
</body>
114115
</body>
115116
</body>
@@ -145,9 +146,9 @@
145146
fromto="0 0 0 0 0 -0.03" rgba="0 1 0 1" group="3" />
146147
<geom size="0.001" pos="0 0 -0.0425" contype="0" conaffinity="0" group="1"
147148
density="0" rgba="0.698039 0.698039 0.698039 1" />
148-
<site name="right_index_tip" pos="0 0 -0.0425" />
149-
<site name="track_hand_right_index_tip" pos="0 0 -0.0425" />
150-
<site name="trace_hand_right_index_tip" pos="0 0 -0.0425" />
149+
<site name="right_index_tip" pos="0 0.005 -0.03" />
150+
<site name="track_hand_right_index_tip" pos="0 0.005 -0.03" />
151+
<site name="trace_hand_right_index_tip" pos="0 0.005 -0.03" />
151152
</body>
152153
</body>
153154
</body>
@@ -174,9 +175,9 @@
174175
fromto="0 0 0 0 0 -0.03" rgba="0 1 0 1" group="3" />
175176
<geom size="0.001" pos="0 0 -0.042107" contype="0" conaffinity="0" group="1"
176177
density="0" rgba="0.698039 0.698039 0.698039 1" />
177-
<site name="right_middle_tip" pos="0 0 -0.042107" />
178-
<site name="track_hand_right_middle_tip" pos="0 0 -0.042107" />
179-
<site name="trace_hand_right_middle_tip" pos="0 0 -0.042107" />
178+
<site name="right_middle_tip" pos="0 0.005 -0.03" />
179+
<site name="track_hand_right_middle_tip" pos="0 0.005 -0.03" />
180+
<site name="trace_hand_right_middle_tip" pos="0 0.005 -0.03" />
180181
</body>
181182
</body>
182183
<body name="right_hand_ring_link1" pos="-0.016 0.0065 -0.1052">
@@ -202,9 +203,9 @@
202203
fromto="0 0 0 0 0 -0.03" rgba="0 1 0 1" group="3" />
203204
<geom size="0.001" pos="0 0 -0.0425" contype="0" conaffinity="0" group="1"
204205
density="0" rgba="0.698039 0.698039 0.698039 1" />
205-
<site name="right_ring_tip" pos="0 0 -0.0425" />
206-
<site name="track_hand_right_ring_tip" pos="0 0 -0.0425" />
207-
<site name="trace_hand_right_ring_tip" pos="0 0 -0.0425" />
206+
<site name="right_ring_tip" pos="0 0.005 -0.03" />
207+
<site name="track_hand_right_ring_tip" pos="0 0.005 -0.03" />
208+
<site name="trace_hand_right_ring_tip" pos="0 0.005 -0.03" />
208209
</body>
209210
</body>
210211
<body name="right_hand_pinky_link1" pos="-0.036 0.0065 -0.1022">
@@ -230,9 +231,9 @@
230231
fromto="0 0 0 0 0 -0.03" rgba="0 1 0 1" group="3" />
231232
<geom size="0.001" pos="0 0 -0.0425" contype="0" conaffinity="0" group="1"
232233
density="0" rgba="0.698039 0.698039 0.698039 1" />
233-
<site name="right_pinky_tip" pos="0 0 -0.0425" />
234-
<site name="track_hand_right_pinky_tip" pos="0 0 -0.0425" />
235-
<site name="trace_hand_right_pinky_tip" pos="0 0 -0.0425" />
234+
<site name="right_pinky_tip" pos="0 0.005 -0.03" />
235+
<site name="track_hand_right_pinky_tip" pos="0 0.005 -0.03" />
236+
<site name="trace_hand_right_pinky_tip" pos="0 0.005 -0.03" />
236237
</body>
237238
</body>
238239
</body>

0 commit comments

Comments
 (0)