GR00T로 큐브를 집어 그릇에 놓기

그리퍼가 큐브를 들고 옮긴 뒤 그릇 위에서 열리는 동작을 볼 수 있습니다.

  • GR00T N1.6-DROID
  • Isaac Lab-Arena
  • Isaac Sim
GR00T가 큐브를 그릇에 놓기까지
실행 영상실행 영상과 기록

브라우저 실습 · 설치 필요 없음

로봇은 과제를 끝냈을까요?

Arena 실행 기록 세 건을 읽어 보세요. 큐브를 들어 올리는 건 중간 단계입니다. 그릇에 안정적으로 놓아야 과제가 끝납니다.

24초 설정에서 기록한 실행
시도들기그릇에 놓기
1성공실패
2성공실패
3실패실패
다른 설정에서 나온 결과

24초 설정에서는 3건 중 0건, 70초 설정에서는 2건 중 2건이 놓기에 성공했습니다. 시작 배치도 달랐기 때문에 시간 제한만의 영향은 이 기록으로 판단하기 어렵습니다.

다음 실습 · GPU 없이 작업대 데이터 검사하기

동작 원리

데이터는 어떻게 흐를까요?
  1. 입력로봇이 보는 것카메라 영상 + 관절 상태 + 지시문

    Arena가 가상 로봇의 관측을 DROID 체크포인트가 읽을 수 있는 형태로 묶습니다.

  2. 처리모델이 제안하는 동작관절·그리퍼 목표의 시퀀스

    동작 예측의 일부를 실행한 뒤 새 관측으로 다시 예측합니다.

  3. 출력시뮬레이터가 남기는 기록episode_results_*.jsonl

    Isaac Sim이 팔을 움직입니다. Arena는 시도마다 한 줄을 쓰고, 들기와 놓기를 따로 기록합니다.

팔이 움직이면 카메라 영상과 관절 위치가 바뀝니다. 그 정보로 다음 동작을 정합니다.

카메라 영상이 어떻게 로봇 동작으로 바뀔까요?

Isaac Sim이 가상 카메라 영상과 로봇 상태를 만들고, Arena가 GR00T N1.6-DROID가 받는 형식으로 관측값을 묶습니다. 여기에 “큐브를 집어 그릇에 놓아라”라는 작업 지시를 더합니다. 담당하는 역할을 나눠 보면 흐름이 보입니다.

전달하는 데이터 하는 일 다음 단계에서 쓰는 곳
카메라 영상 손, 큐브, 그릇의 상대 위치를 파악할 단서를 제공합니다. GR00T의 시각 입력
로봇 상태와 작업 지시 팔의 현재 자세와 달성해야 할 작업을 알려줍니다. DROID 체크포인트의 상태·언어 입력
예측한 동작 시퀀스 팔 관절과 그리퍼의 목표를 여러 제어 시점에 걸쳐 제안합니다. Arena 어댑터를 거쳐 Isaac Sim의 제어 입력

GR00T 내부에서는 어떤 계산을 할까요?

이 실습의 DROID 체크포인트는 GR00T N1.6-3B를 DROID 데이터로 미세 조정한 모델입니다. 먼저 시각·언어 모델이 카메라 영상과 지시문을 숫자 표현으로 바꿉니다. 행동을 생성하는 부분은 그 표현과 로봇 상태를 조건으로 받아, 처음에 샘플링한 노이즈를 여러 번 갱신해 연속적인 동작 시퀀스를 만듭니다. 이런 방식으로 입력과 맞는 행동을 생성하도록 학습하는 기법이 **플로 매칭(flow matching)**입니다. 모델 내부의 갱신은 한 번의 행동 예측을 만드는 과정이고, 아래 로그의 스텝은 시뮬레이터가 실제로 동작을 적용한 제어 시점입니다. NVIDIA N1.6 모델 구조 · DROID 체크포인트

정책이 여러 시점의 동작을 한꺼번에 제안해도, 실행기는 설정된 구간만 적용한 뒤 새 관측을 받아 다시 추론합니다. 팔이 움직이면 카메라에 보이는 장면과 관절 상태가 달라지므로, 화면에 나온 행동을 그대로 재생하는 것과 달리 이후 동작을 다시 정할 수 있습니다. 관절 순서와 정규화는 체크포인트의 설정 및 어댑터가 맞춰야 합니다. Arena의 GR00T 실행 구조 · GR00T 입력·출력 설정

저장된 로그에서 ‘들기’와 ‘놓기’ 읽기

70초 설정의 첫 기록에서 일부 필드만 뽑으면 다음과 같습니다. JSONL은 한 줄이 한 시도를 나타내는 텍스트 파일입니다. progress.events에 한 시도에서 통과한 조건과 시점이 들어 있습니다.

JSON
{
  "success": true,
  "episode_length": 521,
  "progress": { "events": [{ "step": 1 }, { "step": 442 }, { "step": 521 }] }
}

1은 물체가 안정된 조건, 442는 큐브가 기준 높이를 넘은 조건, 521은 물체가 목적지에 놓인 조건을 통과한 제어 스텝입니다. 스텝 수를 그대로 초로 읽으면 안 됩니다. 이 실습의 판정 코드는 15Hz를 기준으로 442 ÷ 15 ≈ 29.47초를 구합니다. 앞선 24초 설정 기록에서는 들어 올리는 데 성공한 시도도 최종 배치 조건을 통과하지 못했습니다. 재현할 때는 그리퍼가 닫혔는지와 함께 object_on_destination 이벤트까지 확인합니다. 판정 코드

처음이면 실습 파일부터 받기

GPU 실습은 Isaac Sim을 실행할 머신에서 터미널을 엽니다. CPU 실습은 지금 쓰는 컴퓨터에서 해도 됩니다. 아래 명령은 한 줄씩 입력하고 Enter를 누르세요. 여러 줄짜리 명령 블록은 통째로 복사해도 됩니다.

Shell
cd "$HOME"
git clone https://github.com/james-joobs/awesome-nvidia-physical-ai.git
cd awesome-nvidia-physical-ai
pwd

홈 폴더에 받는 예입니다. 이미 내려받았다면 git clone은 건너뛰고 내 실습 폴더로 이동합니다. 새 터미널을 열 때마다 pwd의 출력 끝이 awesome-nvidia-physical-ai인지 확인하세요. 그래야 labs/로 시작하는 파일을 찾을 수 있습니다.

따라 하기

준비물 · 화면을 띄울 수 있는 RTX Linux 환경과 uv가 필요합니다. Isaac Sim 환경과 Arena 공식 설치·GR00T 가이드의 Native uv 환경을 준비하세요. 이 예제는 Arena c7edf3a, GR00T 서브모듈 e29d8fc를 기준으로 합니다. 아래에서는 두 레포를 홈 폴더에 내려받았다고 가정합니다. 다른 곳에 받았다면 cd와 ARENA_DIR의 경로를 바꾸세요.

1. 터미널 A에서 GR00T 켜 두기

Arena 폴더로 이동해 GR00T 코드를 받은 뒤 모델을 실행합니다. 아래 블록을 한 번에 붙여 넣어도 됩니다. 첫 실행에서는 모델 파일을 내려받습니다. 모델이 준비되면 이 터미널은 그대로 둡니다.

Shell
cd "$HOME/IsaacLab-Arena"
git submodule update --init submodules/Isaac-GR00T
cd submodules/Isaac-GR00T
uv run python gr00t/eval/run_gr00t_server.py --model-path nvidia/GR00T-N1.6-DROID \
  --embodiment-tag OXE_DROID --device cuda --host 127.0.0.1 --port 5555

2. 같은 머신의 터미널 B에서 로봇 움직이기

Arena의 Python을 활성화하되, 실행할 스크립트는 이 레포에 있으므로 cd로 이동합니다. 아래의 70은 한 시도에 70초를 주는 설정입니다. 실행하면 Isaac Sim 창이 열리고 팔이 움직입니다. Arena는 같은 머신의 127.0.0.1:5555에서 터미널 A의 모델에 동작을 요청합니다.

Shell
ARENA_DIR="$HOME/IsaacLab-Arena"
source "$ARENA_DIR/.venv/bin/activate"
cd "$HOME/awesome-nvidia-physical-ai"
bash labs/gr00t-placement/run_arena.sh "$ARENA_DIR" 70 ./runs/gr00t

Arena가 스테이징 에셋 주소에서 404를 반환한다면, 에셋 주소 패치를 Arena 폴더에서 git apply --unidiff-zero로 적용한 뒤 2단계를 다시 실행합니다.

3. 터미널 B에서 내 실행 기록 읽기

창이 닫히고 터미널 입력이 가능해지면 아래 명령을 실행합니다. 파일 이름이 다르면 find가 보여준 경로를 두 번째 줄에 넣으세요. lift는 들어 올린 때, placed는 그릇에 놓였다는 판정을 받은 때를 뜻합니다. no는 해당 단계에 도달하지 못했다는 뜻입니다.

Shell
find ./runs/gr00t -name 'episode_results_*.jsonl'
python labs/gr00t-placement/check_result.py ./runs/gr00t/droid_pnp_gr00t/episode_results_rebuild0.jsonl

실제 GUI 화면도 함께 녹화하기

터미널 A의 정책 서버는 그대로 두고, 터미널 B에서는 2단계 대신 아래 명령을 실행합니다. 실제로 움직이는 Isaac Sim 창과 시작 시점의 USD 장면, 물체 위치 기록을 저장합니다. X11 데스크톱과 ffmpeg, xwininfo가 필요하며, 앞서 성공한 동작을 재생하는 방식이 아닙니다.

Shell
export GR00T_GUI_FFMPEG="$(command -v ffmpeg)"
bash labs/gr00t-placement/run_recorded.sh "$ARENA_DIR" 70 ./runs/gr00t-gui
python labs/gr00t-placement/check_result.py \
  ./runs/gr00t-gui/evaluation/droid_pnp_gr00t/episode_results_rebuild0.jsonl

GUI 녹화 코드는 gr00t-gui.mp4, gr00t-arena.usda, viewport-timing.jsonl, capture.json을 만듭니다. USD에는 시작 장면이 들어 있고 공식 외부 에셋을 참조할 수 있습니다. 정책 가중치나 로봇의 전체 동작을 독립적으로 재생하는 파일은 아닙니다. 실제 모델 입력과 행동 배열도 보고 싶다면 GR00T Python 환경에서 정책 기록 코드를 사용할 수 있습니다. GR00T_MODEL_PATH에 체크포인트 경로를, GR00T_POLICY_OUTPUT에 새 저장 폴더를 지정합니다.

테스트 결과

24초 설정에서는 세 번 중 두 번이 들기 판정을 받았고, 그릇에 놓은 경우는 없었습니다. 70초 설정에서는 두 번 모두 성공했고, 시뮬레이션 시간으로 34.73초와 38.27초가 걸렸습니다. 시작 배치도 달랐으므로 이 기록으로 시간 제한의 효과만 따로 판단하기는 어렵습니다.

11월 19일 재실행: 들었다고 작업이 끝난 것은 아닙니다

RTX 5090에서 실제 GR00T N1.6-DROID 정책으로 다시 실행했습니다. Arena는 c7edf3a, GR00T는 e29d8fc, Isaac Sim은 6.1.0.0이며, 체크포인트 리비전은 ae3ebe8d288971ac53aa30c756ea5cba0f52611b입니다. 두 번 모두 70초 안에 들기 조건은 통과했지만, 목적지에 놓는 조건은 통과하지 못했습니다. 프로그램은 정상 종료했어도 작업 결과는 2회 중 배치 성공 0회입니다.

시도 들기 시점, 시뮬레이션 시간 그릇에 놓기 전체 제어 스텝
1 55.87초 미도달 1,050
2 28.47초 미도달 1,050

새 시도 영상 보기: 두 번째 시도의 실제 뷰포트를 잘라 2배속으로 만든 20초 영상입니다. 큐브를 들어 올린 뒤 그릇을 지나 옮기는 장면을 볼 수 있습니다. 전체 에피소드 기록에는 두 번의 실패 결과를 앞선 성공 기록과 별도로 남겼습니다. 실행마다 시작 배치가 달랐으므로, 이 몇 번의 시도만으로 일반적인 성공률이나 실패 원인을 단정할 수는 없습니다.

정책 기록 코드가 받은 RGB 카메라 입력은 두 개이며, 각각 [1, 1, 180, 320, 3] 형태입니다. 축은 배치·시간·높이·너비·RGB 채널 순서로, 카메라 하나당 320×180 프레임 한 장을 전달했습니다. 행동 출력은 joint_position이 [1, 32, 7], gripper_position이 [1, 32, 1]입니다. 행동 배열의 축은 배치·예측 시점·제어 관절을 뜻합니다. 32는 한 번에 예측한 행동 시퀀스의 길이이고, 한 시도 전체의 길이가 아닙니다.

Shell
python3 labs/gr00t-placement/check_result.py labs/gr00t-placement/recorded-2026-11-19.jsonl

GPU 없이 기록 다시 확인하기

레포 최상위 폴더에서 두 명령을 실행합니다. Python으로 동봉한 24초 기록과 70초 기록을 읽어 들기와 놓기 시점을 확인할 수 있습니다.

Shell
python3 labs/gr00t-placement/check_result.py labs/gr00t-placement/recorded-24s.jsonl
python3 labs/gr00t-placement/check_result.py labs/gr00t-placement/recorded-70s.jsonl

실행 영상과 기록

들었다고 그릇에 놓은 것은 아닙니다

11월 19일 GR00T 정책 실행을 2배속으로 담았습니다. 새 시도 두 번 모두 큐브를 들었지만 그릇 배치에는 실패했습니다.

실습 소스 코드

droid-70s.yamlGitHub에서 파일 보기
YAML
# Copyright (c) 2026, The Isaac Lab Arena Project Developers (https://github.com/isaac-sim/IsaacLab-Arena/blob/main/CONTRIBUTORS.md).
# All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
# Adapted from the Arena DROID example to record two 70-second trials.

runs:
  droid_pnp_gr00t:
    environment:
      type: pick_and_place_maple_table
      enable_cameras: true
      episode_length_s: 70.0
      embodiment: droid_abs_joint_pos
      pick_up_object: rubiks_cube_hot3d_robolab
      destination_location: bowl_ycb_robolab
      hdr: home_office_robolab
    environment_builder:
      language_instruction: Pick up the Rubik's cube and place it in the bowl.
    policy:
      type: isaaclab_arena_gr00t.policy.gr00t_remote_closedloop_policy.Gr00tRemoteClosedloopPolicy
      policy_config_yaml_path: isaaclab_arena_gr00t/policy/config/droid_manip_gr00t_closedloop_config.yaml
      policy_device: cuda:0
      remote_host: 127.0.0.1
      remote_port: 5555
    rollout_limit:
      num_episodes: 2
droid-24s.yamlGitHub에서 파일 보기
YAML
# Copyright (c) 2026, The Isaac Lab Arena Project Developers (https://github.com/isaac-sim/IsaacLab-Arena/blob/main/CONTRIBUTORS.md).
# All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
# Adapted from the Arena DROID example with a 24-second episode limit.

runs:
  droid_pnp_gr00t:
    environment:
      type: pick_and_place_maple_table
      enable_cameras: true
      episode_length_s: 24.0
      embodiment: droid_abs_joint_pos
      pick_up_object: rubiks_cube_hot3d_robolab
      destination_location: bowl_ycb_robolab
      hdr: home_office_robolab
    environment_builder:
      language_instruction: Pick up the Rubik's cube and place it in the bowl.
    policy:
      type: isaaclab_arena_gr00t.policy.gr00t_remote_closedloop_policy.Gr00tRemoteClosedloopPolicy
      policy_config_yaml_path: isaaclab_arena_gr00t/policy/config/droid_manip_gr00t_closedloop_config.yaml
      policy_device: cuda:0
      remote_host: 127.0.0.1
      remote_port: 5555
    rollout_limit:
      num_episodes: 3
run_arena.shGitHub에서 파일 보기
Shell
#!/usr/bin/env bash
set -euo pipefail
if [[ $# -lt 3 || ! "$2" =~ ^(24|70)$ ]]; then
  printf 'Usage: bash %s ARENA_CHECKOUT 24|70 OUTPUT_DIRECTORY [ARENA_OVERRIDES...]\n' "$0" >&2
  exit 2
fi
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
config="$here/droid-${2}s.yaml"
mkdir -p "$3"
output="$(cd "$3" && pwd -P)"
cd "$1"
shift 3
# Start the official loopback GR00T server before running this script.
python -m isaaclab_arena.evaluation.experiment_runner --viz kit --record_camera_video \
  --experiment_config "$config" --experiment_output_directory "$output" "$@"
check_result.pyGitHub에서 파일 보기
Python
"""Read Arena's episode JSONL and distinguish lifting from stable placement."""

import argparse
import json
from pathlib import Path


def read_episodes(path):
    episodes = []
    for line in path.read_text().splitlines():
        if not line.strip():
            continue
        row = json.loads(line)
        milestones = {event["predicate_name"]: event["step"] for event in row["progress"]["events"]}
        lift = next((step for name, step in milestones.items() if "object_is_above_height" in name), None)
        placed = next((step for name, step in milestones.items() if "object_on_destination" in name), None)
        if bool(row["success"]) != (placed is not None):
            raise ValueError(f"Arena success and placement event disagree in episode {len(episodes) + 1}")
        episodes.append({"steps": row["episode_length"], "lift_step": lift, "placement_step": placed})
    if not episodes:
        raise ValueError("No episodes in the Arena report")
    return episodes


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("episode_report", type=Path)
    parser.add_argument("--rate", type=float, default=15, help="Arena environment control steps per second")
    args = parser.parse_args()
    if args.rate <= 0:
        parser.error("--rate must be positive")
    for index, episode in enumerate(read_episodes(args.episode_report), start=1):
        lifted = episode["lift_step"]
        placed = episode["placement_step"]
        print(f"Trial {index}: {episode['steps']} steps,"
              f" lift {format(lifted / args.rate, '.2f') + ' s' if lifted is not None else 'no'},"
              f" placed {format(placed / args.rate, '.2f') + ' s' if placed is not None else 'no'}")
arena-production-assets.patchGitHub에서 파일 보기
텍스트
diff --git a/isaaclab_arena/assets/nucleus.py b/isaaclab_arena/assets/nucleus.py
index a7da76a..7d8ac2c 100644
--- a/isaaclab_arena/assets/nucleus.py
+++ b/isaaclab_arena/assets/nucleus.py
@@ -14 +14 @@ ARENA_STAGING_NUCLEUS_DIR: str = "omniverse://isaac-dev.ov.nvidia.com/Isaac/Isaa
-ARENA_NUCLEUS_DIR: str = ISAACLAB_NUCLEUS_DIR.replace("omniverse-content-production", "omniverse-content-staging")
+ARENA_NUCLEUS_DIR: str = ISAACLAB_NUCLEUS_DIR
record_gui.pyGitHub에서 파일 보기
Python
"""Record the native Isaac Sim window during a real GR00T/Arena rollout.

Use run_recorded.sh after starting the official GR00T policy server. The USD
snapshot preserves the scene setup; the MP4 records the live policy rollout,
not an animation authored from a known successful trajectory.
"""

from datetime import datetime, timezone
from importlib.metadata import version
import json
import os
from pathlib import Path
import signal
import subprocess
import time

from isaaclab_arena.evaluation import experiment_runner


output = Path(os.environ["GR00T_GUI_OUTPUT"]).resolve()
output.mkdir(parents=True, exist_ok=True)
original_enter = experiment_runner.SimulationAppContext.__enter__


def window_id():
    listing = subprocess.check_output(["xwininfo", "-root", "-tree"], text=True)
    for line in listing.splitlines():
        if '"Isaac Lab ' in line and "mutter-x11-frames" not in line:
            return str(int(line.split()[0], 16))
    raise RuntimeError("The native Isaac Sim GUI window was not found")


class ObservedEnvironment:
    def __init__(self, original):
        self.original = original
        self.camera = None
        self.started = None
        self.frame_number = 0
        self.window = None
        self.wall_log = (output / "viewport-timing.jsonl").open("w", buffering=1)
        self.ffmpeg_log = (output / "viewport-ffmpeg.log").open("w")

    def __getattr__(self, name):
        return getattr(self.original, name)

    def reset(self, *args, **kwargs):
        observation = self.original.reset(*args, **kwargs)
        if self.camera is not None:
            return observation
        from omni.usd import get_context

        stage = get_context().get_stage()
        assert stage and stage.GetRootLayer().Export(str(output / "gr00t-arena.usda"))
        self.window = window_id()
        self.camera = subprocess.Popen([
            os.environ["GR00T_GUI_FFMPEG"], "-hide_banner", "-loglevel", "warning", "-y",
            "-f", "x11grab", "-framerate", "30", "-draw_mouse", "0",
            "-window_id", self.window, "-i", f"{os.environ['DISPLAY']}.0", "-an",
            "-c:v", "libx264", "-preset", "ultrafast", "-crf", "18", "-pix_fmt", "yuv420p",
            "-movflags", "+faststart", str(output / "gr00t-gui.mp4"),
        ], stdin=subprocess.DEVNULL, stdout=self.ffmpeg_log, stderr=subprocess.STDOUT)
        self.started = time.monotonic()
        self.started_utc = datetime.now(timezone.utc).isoformat()
        print("GR00T_GUI_START: scene exported; recording the live policy rollout", flush=True)
        self.sample()
        return observation

    def sample(self):
        env = self.original.unwrapped
        self.wall_log.write(json.dumps({
            "wall_s": time.monotonic() - self.started,
            "global_step": self.frame_number,
            "episodes_completed": int(env.completed_episode_count),
            "positions_m": {name: asset.data.root_pos_w[0].tolist()
                            for name, asset in env.scene.rigid_objects.items()},
        }) + "\n")

    def step(self, actions):
        result = self.original.step(actions)
        self.frame_number += 1
        if self.frame_number % 5 == 0:
            self.sample()
        return result

    def finish(self):
        try:
            if self.camera is not None:
                self.sample()
                if self.camera.poll() is None:
                    self.camera.send_signal(signal.SIGINT)
                self.camera.wait(timeout=20)
                video = output / "gr00t-gui.mp4"
                if not video.exists() or video.stat().st_size < 50_000:
                    raise RuntimeError("The GUI recording is missing or unexpectedly small")
                (output / "capture.json").write_text(json.dumps({
                    "application": "Isaac Sim GUI launched through Isaac Lab-Arena",
                    "isaacsim_version": version("isaacsim"),
                    "recording_mode": "live_policy_native_x11_window",
                    "video": video.name,
                    "scene": "gr00t-arena.usda",
                    "window_id": self.window,
                    "started_utc": self.started_utc,
                    "ended_utc": datetime.now(timezone.utc).isoformat(),
                    "wall_seconds": round(time.monotonic() - self.started, 3),
                    "control_steps": self.frame_number,
                    "ffmpeg_exit_code": self.camera.returncode,
                    "bytes": video.stat().st_size,
                }, indent=2) + "\n")
        finally:
            self.ffmpeg_log.close()
            self.wall_log.close()


def enter(context):
    value = original_enter(context)
    from isaaclab_arena.evaluation import run_execution

    rollout = run_execution.rollout_policy

    def observed_rollout(env, policy, *args, **kwargs):
        instrumented = ObservedEnvironment(env)
        try:
            return rollout(instrumented, policy, *args, **kwargs)
        finally:
            instrumented.finish()

    run_execution.rollout_policy = observed_rollout
    return value


if __name__ == "__main__":
    experiment_runner.SimulationAppContext.__enter__ = enter
    try:
        experiment_runner.main()
    except BaseException:
        # Some Kit shutdown paths mask a Python failure with exit code zero.
        (output / "capture-failed").touch()
        raise
record_policy.pyGitHub에서 파일 보기
Python
"""Run the official GR00T policy and save one real observation/action per reset.

Set GR00T_MODEL_PATH to a prepared checkpoint and GR00T_POLICY_OUTPUT to the
output directory. No robot actions are synthesized by this recorder.
"""

import json
import os
from pathlib import Path
import time

import numpy as np
from PIL import Image
import torch

from gr00t.data.embodiment_tags import EmbodimentTag
from gr00t.policy.gr00t_policy import Gr00tPolicy
from gr00t.policy.server_client import PolicyServer


output = Path(os.environ["GR00T_POLICY_OUTPUT"]).resolve()
output.mkdir(parents=True, exist_ok=True)
policy = Gr00tPolicy(
    embodiment_tag=EmbodimentTag.OXE_DROID,
    model_path=os.environ["GR00T_MODEL_PATH"],
    device="cuda",
    strict=True,
)
print(f"GR00T N1.6-DROID | torch {torch.__version__} | {torch.cuda.get_device_name(0)}", flush=True)
get_action = policy.get_action
reset = policy.reset
episode = 0
count = 0
saved = set()


def record_reset(*args, **kwargs):
    global episode
    response = reset(*args, **kwargs)
    episode += 1
    return response


def record_action(observation, options=None):
    global count
    started = time.perf_counter()
    action, info = get_action(observation, options)
    elapsed = 1000 * (time.perf_counter() - started)
    count += 1
    arrays = {key: np.asarray(values) for key, values in action.items()}
    if not all(np.isfinite(a).all() and a.size > 0 for a in arrays.values()):
        raise RuntimeError("GR00T returned an invalid action")
    if count <= 3 or count % 25 == 0:
        print(f"ACTION {count} | reset {episode} | {elapsed:.1f} ms | {list(action)}", flush=True)
    if episode not in saved:
        save_dir = output / f"request-{count:04d}"
        save_dir.mkdir(parents=True, exist_ok=True)
        cameras = {}
        for index, (name, values) in enumerate(observation.get("video", {}).items()):
            array = np.asarray(values)
            if array.ndim != 5 or array.shape[-1] != 3:
                continue
            frame = array[0, -1]
            if frame.dtype != np.uint8:
                frame = (frame * 255 if frame.max() <= 1.0 else frame).clip(0, 255).astype(np.uint8)
            filename = f"camera-{index + 1}.png"
            Image.fromarray(frame).save(save_dir / filename)
            cameras[name] = {"file": filename, "shape": list(array.shape)}
        record = {
            "model": "GR00T N1.6-DROID",
            "observation_origin": "Isaac Lab-Arena DROID simulator",
            "request": count,
            "server_reset_count": episode,
            "instruction": observation.get("language", {}),
            "cameras": cameras,
            "observed_state": {k: np.asarray(v).tolist() for k, v in observation.get("state", {}).items()},
            "actions": {k: v.tolist() for k, v in arrays.items()},
            "action_shapes": {k: list(v.shape) for k, v in arrays.items()},
            "server_inference_ms": round(elapsed, 2),
        }
        (save_dir / "observation-action.json").write_text(json.dumps(
            record, indent=2, default=lambda value: np.asarray(value).tolist()) + "\n")
        saved.add(episode)
    return action, info


policy.get_action = record_action
policy.reset = record_reset
PolicyServer(policy, host="127.0.0.1", port=int(os.environ.get("GR00T_POLICY_PORT", "5555"))).run()
run_recorded.shGitHub에서 파일 보기
Shell
#!/usr/bin/env bash
set -euo pipefail
if [[ $# -lt 3 || ! "$2" =~ ^(24|70)$ ]]; then
  printf 'Usage: bash %s ARENA_CHECKOUT 24|70 OUTPUT_DIRECTORY [ARENA_OVERRIDES...]\n' "$0" >&2
  exit 2
fi
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
config="$here/droid-${2}s.yaml"
mkdir -p "$3"
export GR00T_GUI_OUTPUT="$(cd "$3" && pwd -P)"
export GR00T_GUI_FFMPEG="${GR00T_GUI_FFMPEG:-$(command -v ffmpeg)}"
if [[ ! -x "$GR00T_GUI_FFMPEG" ]]; then
  printf 'Set GR00T_GUI_FFMPEG to an executable ffmpeg binary.\n' >&2
  exit 2
fi
command -v xwininfo >/dev/null
: "${DISPLAY:?Run this from a Linux desktop session with DISPLAY set.}"
cd "$1"
shift 3
# Start the official loopback GR00T server separately before running this script.
"${GR00T_ARENA_PYTHON:-python}" -u "$here/record_gui.py" --viz kit --record_camera_video \
  --experiment_config "$config" --experiment_output_directory "$GR00T_GUI_OUTPUT/evaluation" "$@"
if [[ -e "$GR00T_GUI_OUTPUT/capture-failed" || ! -s "$GR00T_GUI_OUTPUT/capture.json" ]]; then
  printf 'The GUI run did not finish cleanly; keep the logs and inspect the failure.\n' >&2
  exit 1
fi