# SO-101 失敗から学ぶアームを作る Log#6 | 模倣学習へ、SO-101 でお手本を10回録った

- 記録: LOG565（フィジカルAI研究室）
- 公開: 2026/11/23
- 記事のページ: https://pixelstomotors.com/record/so101-record-ten-demonstrations-for-imitation-learning
- サイト: Pixels to Motors（ADAPT DESIGN / 島津 栄一） https://pixelstomotors.com/
- 要約: ロボットアーム SO-101 で、赤いブロックを白い箱に入れるお手本を LeRobot のテレオペで10回録り、8回が箱に入った。途中で Python が落ちた原因は、キー入力の見張りが macOS に止められることだった。

> AI が読むための記事の全文です（コード・実行ログを含む）。引用するときは上の「記事のページ」の住所を使ってください。

---

**ロボットアーム SO-101 で、赤いブロックをつかんで白い箱に入れる「お手本」を、Hugging Face の LeRobot でテレオペして10回録れた。10回で 9分56秒かかり、箱に入ったのは8回だった。** 記録を始めた直後に一度 Python ごと落ちたが、原因は LeRobot がキー入力を見張るために立てる仕組み（pynput）が、macOS に止められることだった。

これで変わること。

- 模倣学習（人がやって見せた動きを AI にまねさせる学習）に使えるお手本のデータが、SO-101 で初めてできた。カメラ2台の映像と、6つの関節の角度が、1秒30コマでそろっている（10回・5,602コマ）
- 1回の記録は、20秒以内の動きと、ブロックの置き直し・保存の約10秒で、だいたい1分。本番であと40回録るなら、およそ40分の見込み（前のやり方と比べた時間は測っていない）
- 箱に入らなかった2回は消さずに残し、「失敗」の印を付けた。学習のときに外せるし、あとで失敗の例としても使える
- 記録した動きの再生（replay）では、箱に入った3回目をもう一度再生して、ブロックがまた箱に入った

意外だったのは、落ち方のほうだ。Python が強制終了した瞬間、アームは力が入ったまま残っていた。ふつうに止めたときは力を抜く後始末が動くが、強制終了ではそこを通らない。次に起動したとき、始める前の確かめで「力が入ったまま」を見つけて止まったので、電源を切ってから直した。

| やったこと | なぜ | 結果 |
|---|---|---|
| お手本を10回録る依頼を出した（依頼274） | 模倣学習のデータを集め始める | 1回目は始める合図を20分待って時間切れ。2回目は記録を始めた直後に Python が落ちた |
| 落ちた原因を Mac のクラッシュレポートで調べて直した | 落ちたままでは1回も録れない | LeRobot のキー入力の見張りを立てず、手順の画面でキーを受ける形にした |
| 直したあと10回録った | お手本を集める | 9分56秒で10回。箱に入ったのは8回。映像の欠け・角度の飛びは 0 |
| 1回目と3回目を再生した（依頼274・276） | 録った動きがそのまま再生されるかを見る | 2回とも録ったとおりに動いた。3回目はブロックも箱に入った |
| 失敗の印を付けて、KIOXIA にコピーした | 学習で失敗を外せるようにし、置き場所の決まりに合わせる | 8ファイル・約38 MiB、Mac 側と中身まで一致 |

[図解: LOG565_so101_ten_demos.html](https://pixelstomotors.com/embeds/LOG565_so101_ten_demos.html)

GPU を買うか借りるかの判断は、Runpod で実際に借りて学習させた費用をもとに、別のページにまとめています。

[ロボットAIの学習用GPU、買うか借りるか](https://pixelstomotors.com/gpu-buy-or-rent)


## 作業ログ ― お手本を10回録る依頼を出した（依頼274）

[ファイル一式: https://pixelstomotors.com/files/LOG565/index.json](https://pixelstomotors.com/files/LOG565/index.json)


前の記録（LOG556）で、力が入った瞬間のアームの飛びを止め、カメラ2台の明るさをそろえた。立ち会っての確かめも通ったので、お手本の記録に進んだ。依頼は、Mac の上で Claude Code に仕事を渡す「依頼箱」というフォルダで出している。依頼の文を書いたファイルを置くと、Mac が Claude Code を起動して作業させ、終わると報告を返す。

### この記録で使う言葉

| 言葉 | 意味 |
|---|---|
| [SO-101](https://github.com/TheRobotStudio/SO-ARM100) | 部品を組み立てて作る、6つの関節を持つロボットアーム。2台1組で使う |
| リーダー・フォロワー | 人が手で動かす側がリーダー、それと同じ動きをする側がフォロワー |
| テレオペ | リーダーを動かして、フォロワーに同じ動きをさせること |
| [LeRobot](https://github.com/huggingface/lerobot) | Hugging Face が出している、ロボットのデータ集め・学習・推論の道具一式。ここでは 0.7.1 を使う |
| record・replay | LeRobot のお手本の記録（record）と、記録した動きの再生（replay） |
| お手本（エピソード） | record で録る1回分。カメラの映像と関節の角度が、1コマずつ組になって入る。LeRobot の中では 0 から数える番号（index）で呼ぶので、1回目は index 0 |
| データセット | お手本を集めたもの。LeRobot の形（角度は parquet という表のファイル、映像は AV1 の mp4）で、1つのフォルダにまとまる |
| [pynput](https://pynput.readthedocs.io/) | Python でキーボードの入力を見張るためのライブラリ。LeRobot の record は、これで→・←キーを受けている |
| クラッシュレポート | Mac がアプリの強制終了のときに書き残す記録。どのスレッドの、どの関数で止まったかが分かる |

### 録るものと、置き場所を決めた

課題は、今の机の配置のまま、赤いブロックをつかんで白い箱に入れること。1回20秒を目安にし、入れ終わったら→キーで早めに次へ進める形にした。失敗した回は←キーで捨てて録り直せる。

置き場所には1つ引っかかりがあった。データの置き場所の決まりでは、学習用のデータは外付けの SSD（KIOXIA）の `datasets/` に置く。ところが、前の記録で作った飛び止めの入口（`lerobot_safe_259.py`）は、KIOXIA の下に記録を作らせない作りになっている。入口は変えずに、まず Mac の中（`~/so101_datasets/`）に録り、確かめてから KIOXIA に**コピー**する形にした。

### 依頼274 の依頼文

```markdown
---
作業フォルダ: /Users/shimazueiichi/r2r2r-scripts
上限時間: 60
---
# SO-101 のお手本（record）を10回録る（依頼274・エイイチ立ち会い）

依頼268（`so101/check_268/REPORT.md`）で実機の確かめが全部通った。エイイチは「始めの寄せは飛んで見えなかった（今のまま）」と答え、record に進むと決めた。カメラは依頼265・266 の固定（机側：露出101・gain 0・WB 自動／手首：露出自動・WB 4600）。アーム・カメラ2台・KIOXIA はつながっている。**フォロワーを動かしてよい。**

## 録るもの
- 課題：今の机の配置のまま、赤いブロックをつかんで白い箱に入れる（`--dataset.single_task="Put the red block into the white box"`）
- 10回。1回の長さは20秒を目安に、エイイチが入れ終わったら次へ進める形にする（LeRobot の→キーで早めに終われることを画面に出す）
- 入口は `so101/lerobot_safe_259.py record`（包まない lerobot は使わない）。`--fps=30`、カメラは wrist・desk の2台
- repo_id：`local/so101_redblock_box_teleop_v1`

## 置き場所
- `lerobot_safe_259.py` は KIOXIA の下に記録を作らせない。これは変えない。まず Mac の `~/so101_datasets/so101_redblock_box_teleop_v1/` に録る（git の外）
- 10回の確かめが済んだら、KIOXIA の `r2r2r-data/datasets/so101_redblock_box_teleop_v1/` に**コピー**する（Mac 側は消さない）。コピーの前に KIOXIA のマウントを確かめ、なければ止めて報告。同じ名前がすでにあれば止める
- 実行の記録（画面の文・キー・各回の時間）と run スクリプトは `so101/check_274/` に（git には入れない。check_268 と同じ扱い）

## 画面（run_268.py を元に run_274.py を作る。run_268.py は書き換えない）
- 始める前：Torque_Enable が全軸 0 を確かめる。「ブロックを机の決まった所に置く・リーダーとフォロワーの姿勢を近づける」→ スペース
- 各回：「◯回目／10　スペースで始める」→ 録っている間は回数と残り秒を大きな字で。→ 「◯回目 終わり。ブロックを元の所に置き直して、腕を休みの姿勢へ」→ スペースで次へ
- うまくいかなかった回は ←キーで録り直せることを画面に出す
- 終わり：依頼268 と同じく「爪を閉じる・腕を机の上まで下ろしてたたむ」を先に出し、休みの姿勢の待ちで幅の外の関節を赤い大きな字で出す

## 録ったあとに確かめること
- 回数が10、各回のコマ数と長さ、1秒あたりのコマ数（30 に近いか）
- 映像2台が全部の回にあり、真っ黒・白飛び・止まったコマがないか。各回の最初・真ん中・最後の1コマずつを `so101/check_274/frames/` に保存
- 角度（observation.state・action）が全部の回にあり、飛び（1コマ10° を超える差）がないか。切られたコマの数
- replay で1回目を再生できるか（手順どおり休みの姿勢まで自動で戻す）。エイイチの合図で始める

## エイイチに聞くこと（見た物で答える形・y/n）
- 10回とも、ブロックが箱に入った？（入らなかった回の番号も聞く）
- 録っている最中に、フォロワーがガクッと飛んだ回はあった？
- replay で、フォロワーは録ったとおりに動いた？

## しないこと
- 包まない lerobot、rollout、Hugging Face への送信、EEPROM・キャリブレーションの書き換え、`~/lerobot`・`lerobot_safe_259.py`・カメラの設定ファイルの書き換え
- KIOXIA の既存のファイルの上書き・移動・削除、`git add .`・`git clean`
- 確認や停止の条件を新しく重ねる

## 報告
- 10回の表（回・長さ・コマ数・切られたコマ・エイイチの判定）
- 映像と角度の確かめの結果、replay の結果
- KIOXIA にコピーした場所とサイズ
- 本番の回数に進めるか、直すことがあるか
- 最後の1行に「判定：合格／止めた（決めてほしいことあり）／失敗」
```


## 作業ログ ― 記録を始めた直後に Python が落ちた（依頼274）

依頼274 は 16:40 に始まった。Claude Code が手順の画面のスクリプト（`run_274.py`）を作り、16:45 に Mac に「0. 始める前」の画面が出た。

### 1回目：始める合図を20分待って時間切れになった

画面は「準備ができたら スペース」で待つ作りで、20分たつと自分で終わる。この回はスペースが押されないまま 17:05 に終わった。アームにはつないでいないので、力は入っていない。

#### run_274_stdout_try1_timeout.log

```text
[274] 16:45:12 start {"dry": false}
W1123 16:45:15.077000 29375 site-packages/torch/distributed/elastic/multiprocessing/redirects.py:35] NOTE: Redirects are currently not supported in MacOs.
objc[29375]: Class AVFFrameReceiver is implemented in both /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/cv2/.dylibs/libavdevice.61.3.100.dylib (0x1073943a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x15eb343a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[29375]: Class AVFAudioReceiver is implemented in both /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/cv2/.dylibs/libavdevice.61.3.100.dylib (0x1073943f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x15eb343f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[274] 16:45:20 read_servos {"follower": [[1, 1992, 0], [2, 898, 0], [3, 3024, 0], [4, 2319, 0], [5, 2145, 0], [6, 2061, 0]], "leader": [[1, 1936, 0], [2, 958, 0], [3, 3114, 0], [4, 2501, 0], [5, 2009, 0], [6, 2010, 0]], "ok": true}
[274] 16:45:20 screen {"title": "0. 始める前", "lines": ["ブロックを机の決まった所に置く", "リーダーとフォロワーの姿勢を近づける", "フォロワーのまわりを空ける・電源をすぐ切れるようにする", "次のスペースで つなぐ (力が入る. まだ録らない)", "(止めたいとき: q キー = Ctrl-C)", "", "準備ができたら スペース"]}
[274] 17:05:20 timeout {"title": "0. 始める前"}
[274] 17:05:20 end {}
```

#### events_274_try1_timeout.jsonl

```json
{"t": 1795419912.180552, "clock": "16:45:12", "kind": "start", "dry": false}
{"t": 1795419920.771641, "clock": "16:45:20", "kind": "read_servos", "follower": [[1, 1992, 0], [2, 898, 0], [3, 3024, 0], [4, 2319, 0], [5, 2145, 0], [6, 2061, 0]], "leader": [[1, 1936, 0], [2, 958, 0], [3, 3114, 0], [4, 2501, 0], [5, 2009, 0], [6, 2010, 0]], "ok": true}
{"t": 1795419920.783566, "clock": "16:45:20", "kind": "screen", "title": "0. 始める前", "lines": ["ブロックを机の決まった所に置く", "リーダーとフォロワーの姿勢を近づける", "フォロワーのまわりを空ける・電源をすぐ切れるようにする", "次のスペースで つなぐ (力が入る. まだ録らない)", "(止めたいとき: q キー = Ctrl-C)", "", "準備ができたら スペース"]}
{"t": 1795421120.782238, "clock": "17:05:20", "kind": "timeout", "title": "0. 始める前"}
{"t": 1795421120.785299, "clock": "17:05:20", "kind": "end"}
```

#### results_274_try1_timeout.json

```json
{
 "0": {
  "torque_zero": true,
  "follower": [
   [
    1,
    1992,
    0
   ],
   [
    2,
    898,
    0
   ],
   [
    3,
    3024,
    0
   ],
   [
    4,
    2319,
    0
   ],
   [
    5,
    2145,
    0
   ],
   [
    6,
    2061,
    0
   ]
  ]
 }
}
```

### 2回目：力が入って7秒後に、Python ごと落ちた

17:12:33 にスペースが押され、record が始まった。17:12:42 にフォロワーに力が入り（差は全軸 0.0°）、その直後に画面が消えた。Mac には「Python が予期しない理由で終了しました」が出た。ログはフォロワーがつながった行で途切れていて、エラーの文は1行もない。

起動のときに、OpenCV と PyAV が同じ動画の部品（libavdevice）を2つ読み込んでいるという警告が出ていた。最初はこれも原因の候補にしたが、クラッシュレポートを見ると関係がなかった。

#### run_274_stdout_try2_crash.log

```text
[274] 17:05:35 start {"dry": false}
W1123 17:05:38.039000 30333 site-packages/torch/distributed/elastic/multiprocessing/redirects.py:35] NOTE: Redirects are currently not supported in MacOs.
objc[30333]: Class AVFFrameReceiver is implemented in both /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/cv2/.dylibs/libavdevice.61.3.100.dylib (0x103df83a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1299783a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[30333]: Class AVFAudioReceiver is implemented in both /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/cv2/.dylibs/libavdevice.61.3.100.dylib (0x103df83f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1299783f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[274] 17:05:42 read_servos {"follower": [[1, 1992, 0], [2, 898, 0], [3, 3024, 0], [4, 2319, 0], [5, 2145, 0], [6, 2061, 0]], "leader": [[1, 1936, 0], [2, 958, 0], [3, 3114, 0], [4, 2501, 0], [5, 2009, 0], [6, 2010, 0]], "ok": true}
[274] 17:05:42 screen {"title": "0. 始める前", "lines": ["ブロックを机の決まった所に置く", "リーダーとフォロワーの姿勢を近づける", "フォロワーのまわりを空ける・電源をすぐ切れるようにする", "次のスペースで つなぐ (力が入る. まだ録らない)", "(止めたいとき: q キー = Ctrl-C)", "", "準備ができたら スペース"]}
[274] 17:12:33 key {"title": "0. 始める前", "key": " "}
[274] 17:12:33 run_start {"run": "step1_record", "argv": ["record", "--dataset.repo_id=local/so101_redblock_box_teleop_v1", "--dataset.root=/Users/shimazueiichi/so101_datasets/so101_redblock_box_teleop_v1", "--dataset.single_task=Put the red block into the white box", "--dataset.fps=30", "--dataset.num_episodes=10", "--dataset.episode_time_s=20", "--dataset.reset_time_s=3600", "--dataset.no_stamp=true"]}
INFO 2026-11-23 17:12:35 t_record.py:401 {'dataset': {'depth_encoder': {'crf': 30,
                               'depth_max': 10.0,
                               'depth_min': 0.01,
                               'extra_options': {'x265-params': 'lossless=1'},
                               'fast_decode': 0,
                               'g': 2,
                               'pix_fmt': 'gray12le',
                               'preset': None,
                               'shift': 3.5,
                               'use_log': True,
                               'vcodec': 'hevc',
                               'video_backend': 'pyav'},
             'encoder_queue_maxsize': 30,
             'encoder_threads': None,
             'episode_time_s': 20,
             'fps': 30,
             'no_stamp': True,
             'num_episodes': 10,
             'num_image_writer_processes': 0,
             'num_image_writer_threads_per_camera': 4,
             'private': None,
             'push_to_hub': False,
             'repo_id': 'local/so101_redblock_box_teleop_v1',
             'reset_time_s': 3600,
             'rgb_encoder': {'crf': 30,
                             'extra_options': {},
                             'fast_decode': 0,
                             'g': 2,
                             'pix_fmt': 'yuv420p',
                             'preset': 12,
                             'vcodec': 'libsvtav1',
                             'video_backend': 'pyav'},
             'root': '/Users/shimazueiichi/so101_datasets/so101_redblock_box_teleop_v1',
             'single_task': 'Put the red block into the white box',
             'streaming_encoding': False,
             'tags': None,
             'video': True,
             'video_encoding_batch_size': 1},
 'display_compressed_images': False,
 'display_data': False,
 'display_ip': None,
 'display_mode': 'rerun',
 'display_port': None,
 'play_sounds': True,
 'resume': False,
 'robot': {'calibration_dir': None,
           'cameras': {'desk': {'backend': <Cv2Backends.ANY: 0>,
                                'color_mode': <ColorMode.RGB: 'rgb'>,
                                'fourcc': 'MJPG',
                                'fps': 30,
                                'height': 480,
                                'index_or_path': 0,
                                'rotation': <Cv2Rotation.NO_ROTATION: 0>,
                                'warmup_s': 1,
                                'width': 640},
                       'wrist': {'backend': <Cv2Backends.ANY: 0>,
                                 'color_mode': <ColorMode.RGB: 'rgb'>,
                                 'fourcc': 'MJPG',
                                 'fps': 30,
                                 'height': 480,
                                 'index_or_path': 1,
                                 'rotation': <Cv2Rotation.NO_ROTATION: 0>,
                                 'warmup_s': 1,
                                 'width': 640}},
           'disable_torque_on_disconnect': True,
           'id': 'ptm_follower',
           'max_relative_target': None,
           'num_read_retries': 2,
           'port': '/dev/tty.usbmodem5CBC4321631',
           'position_d_coefficient': 32,
           'position_i_coefficient': 0,
           'position_p_coefficient': 16,
           'use_degrees': True},
 'teleop': {'calibration_dir': None,
            'id': 'ptm_leader',
            'num_read_retries': 2,
            'port': '/dev/tty.usbmodem5CBC4323581',
            'use_degrees': True}}
objc[30333]: Class AVFFrameReceiver is implemented in both /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/cv2/.dylibs/libavdevice.61.3.100.dylib (0x103df83a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x1491f8778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[30333]: Class AVFAudioReceiver is implemented in both /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/cv2/.dylibs/libavdevice.61.3.100.dylib (0x103df83f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x1491f87c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
INFO 2026-11-23 17:12:36 so_leader.py:95 ptm_leader SOLeader connected.
INFO 2026-11-23 17:12:36 safe_259.py:115 [A] follower: connect の直後に目標を今の位置にした
WARNING 2026-11-23 17:12:36 a_opencv.py:284 OpenCVCamera(1) failed to set fourcc=MJPG (actual=    , success=False). Continuing with default format.
INFO 2026-11-23 17:12:38 a_opencv.py:198 OpenCVCamera(1) connected.
WARNING 2026-11-23 17:12:38 a_opencv.py:284 OpenCVCamera(0) failed to set fourcc=MJPG (actual=    , success=False). Continuing with default format.
INFO 2026-11-23 17:12:41 a_opencv.py:198 OpenCVCamera(0) connected.
INFO 2026-11-23 17:12:41 safe_259.py:663 [CAM] 露出・ホワイトバランスを固定した: {'wrist': {'auto-exposure-mode': '8', 'auto-white-balance-temp': 'false', 'white-balance-temp': '4600', 'brightness': '0', 'contrast': '38', 'gamma': '400'}, 'desk': {'auto-exposure-mode': '1', 'auto-white-balance-temp': 'true', 'exposure-time-abs': '101', 'gain': '0'}}
INFO 2026-11-23 17:12:41 safe_259.py:125 [A] follower: 力を入れる直前に目標を今の位置にした (全部)
[274] 17:12:42 torque_on {"run": "step1_record", "max_diff_deg": {"shoulder_pan": 0.0, "shoulder_lift": 0.0, "elbow_flex": 0.0, "wrist_flex": 0.0, "wrist_roll": 0.0, "gripper": 0.0}}
INFO 2026-11-23 17:12:42 follower.py:128 ptm_follower SOFollower connected.
```

#### events_274_try2_crash.jsonl

```json
{"t": 1795421135.2996328, "clock": "17:05:35", "kind": "start", "dry": false}
{"t": 1795421142.8854, "clock": "17:05:42", "kind": "read_servos", "follower": [[1, 1992, 0], [2, 898, 0], [3, 3024, 0], [4, 2319, 0], [5, 2145, 0], [6, 2061, 0]], "leader": [[1, 1936, 0], [2, 958, 0], [3, 3114, 0], [4, 2501, 0], [5, 2009, 0], [6, 2010, 0]], "ok": true}
{"t": 1795421142.906008, "clock": "17:05:42", "kind": "screen", "title": "0. 始める前", "lines": ["ブロックを机の決まった所に置く", "リーダーとフォロワーの姿勢を近づける", "フォロワーのまわりを空ける・電源をすぐ切れるようにする", "次のスペースで つなぐ (力が入る. まだ録らない)", "(止めたいとき: q キー = Ctrl-C)", "", "準備ができたら スペース"]}
{"t": 1795421553.788265, "clock": "17:12:33", "kind": "key", "title": "0. 始める前", "key": " "}
{"t": 1795421553.789171, "clock": "17:12:33", "kind": "run_start", "run": "step1_record", "argv": ["record", "--dataset.repo_id=local/so101_redblock_box_teleop_v1", "--dataset.root=/Users/shimazueiichi/so101_datasets/so101_redblock_box_teleop_v1", "--dataset.single_task=Put the red block into the white box", "--dataset.fps=30", "--dataset.num_episodes=10", "--dataset.episode_time_s=20", "--dataset.reset_time_s=3600", "--dataset.no_stamp=true"]}
{"t": 1795421562.4492018, "clock": "17:12:42", "kind": "torque_on", "run": "step1_record", "max_diff_deg": {"shoulder_pan": 0.0, "shoulder_lift": 0.0, "elbow_flex": 0.0, "wrist_flex": 0.0, "wrist_roll": 0.0, "gripper": 0.0}}
```

### Mac のクラッシュレポート：止まったのは、キー入力を見張るスレッドだった

Claude Code が Mac のクラッシュレポート（`crash_171249.ips`）を読んだ。止まったのは Python の別スレッド（73番）で、その中で macOS の入力の関数（`TSMGetInputSourceProperty`）が呼ばれ、`dispatch_assert_queue` の確かめで落ちていた。macOS は、この関数をメインのキュー（画面の処理をする本筋）からしか呼ばせない。別のスレッドから呼ばれると、その場でプロセスを止める（`EXC_BREAKPOINT`・`SIGTRAP`）。

呼んでいたのは pynput だった。LeRobot の record は、→キー（早めに終える）・←キー（録り直す）・Esc（止める）を受けるために、始めるときに pynput の見張りを別のスレッドで立てる。前の記録のテレオペ（teleoperate）にはこの見張りがなく、落ちなかった。差はここだった。

レポートは 228 KB あり、ほかのスレッドと読み込んだ部品の一覧、この Mac を見分ける値が入っている。ここには、落ちた理由と、落ちたスレッドの呼び出しの順番だけを書き出して載せる。

#### crash_171249.ips（落ちた理由と、落ちたスレッドの部分）

```text
app_name: python3.12 / timestamp: 2026-11-23 17:12:49.00 +0900 / os_version: macOS 26.6.2 (25G83)
captureTime: 2026-11-23 17:12:42.5230 +0900
exception: {"codes": "0x0000000000000001, 0x00000001849c14fc", "rawCodes": [1, 6519788796], "type": "EXC_BREAKPOINT", "signal": "SIGTRAP"}
termination: {"flags": 0, "code": 5, "namespace": "SIGNAL", "indicator": "Trace/BPT trap: 5", "byProc": "exc handler", "byPid": 30333}
faultingThread: 73

Thread 73 (crashed) frames:
 0  libdispatch.dylib                _dispatch_assert_queue_fail + 120
 1  libdispatch.dylib                dispatch_assert_queue$V2.cold.1 + 116
 2  libdispatch.dylib                dispatch_assert_queue + 108
 3  HIToolbox                        islGetInputSourceListWithAdditions + 160
 4  HIToolbox                        isValidateInputSourceRef + 88
 5  HIToolbox                        TSMGetInputSourceProperty + 36
 6  libffi.8.dylib                   ffi_call_SYSV + 80
 7  libffi.8.dylib                   ffi_call_int + 1516
 8  _ctypes.cpython-312-darwin.so    _ctypes_callproc + 1028
 9  _ctypes.cpython-312-darwin.so    PyCFuncPtr_call + 212
10  python3.12                       _PyEval_EvalFrameDefault + 205608
11  python3.12                       gen_iternext + 144
12  python3.12                       builtin_next + 72
13  python3.12                       _PyEval_EvalFrameDefault + 217000
14  python3.12                       method_vectorcall + 356
15  python3.12                       _PyEval_EvalFrameDefault + 200512
16  python3.12                       method_vectorcall + 356
17  python3.12                       thread_run + 196
18  python3.12                       pythread_wrapper + 48
19  libsystem_pthread.dylib          _pthread_start + 136
20  libsystem_pthread.dylib          thread_start + 8
```

### 強制終了では、アームの力が抜けなかった

落ちたとき、フォロワーには力が入ったままだった。飛び止めの入口は、Ctrl-C や Python の例外で止まったときには力を抜いてからポートを閉じる。ところが強制終了は Python の外で起きるので、この後始末を通らない。

3回目の起動（17:23）で、始める前にサーボを読むと、Torque_Enable が全軸 1（力が入っている）だった。手順の画面は、これを見て記録を始めず、「支える → 電源を切る」と出した。ここで電源を切ってもらった。

**ソフトの後始末だけでは、強制終了のときにアームの力を抜けない。始める前の確かめが、それを拾った。**

#### run_274_stdout_try3_torque_on.log

```text
[274] 17:23:45 start {"dry": false}
W1123 17:23:48.102000 31513 site-packages/torch/distributed/elastic/multiprocessing/redirects.py:35] NOTE: Redirects are currently not supported in MacOs.
objc[31513]: Class AVFFrameReceiver is implemented in both /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/cv2/.dylibs/libavdevice.61.3.100.dylib (0x105e083a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1618d83a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[31513]: Class AVFAudioReceiver is implemented in both /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/cv2/.dylibs/libavdevice.61.3.100.dylib (0x105e083f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1618d83f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[274] 17:23:52 read_servos {"follower": [[1, 1992, 1], [2, 898, 1], [3, 3024, 1], [4, 2319, 1], [5, 2145, 1], [6, 2061, 1]], "leader": [[1, 2098, 0], [2, 889, 0], [3, 3115, 0], [4, 2590, 0], [5, 2009, 0], [6, 2010, 0]], "ok": false}
[274] 17:23:52 screen {"title": "力が入っている (始めない)", "lines": ["フォロワーの Torque が 0 ではない", "[(1, 1992, 1), (2, 898, 1), (3, 3024, 1), (4, 2319, 1), (5, 2145, 1), (6, 2061, 1)]", "支える → 電源を切る", "", "スペースで終える"]}
[274] 17:24:37 key {"title": "力が入っている (始めない)", "key": " "}
[274] 17:24:37 end {}
```

#### events_274_try3_torque_on.jsonl

```json
{"t": 1795422225.935313, "clock": "17:23:45", "kind": "start", "dry": false}
{"t": 1795422232.555072, "clock": "17:23:52", "kind": "read_servos", "follower": [[1, 1992, 1], [2, 898, 1], [3, 3024, 1], [4, 2319, 1], [5, 2145, 1], [6, 2061, 1]], "leader": [[1, 2098, 0], [2, 889, 0], [3, 3115, 0], [4, 2590, 0], [5, 2009, 0], [6, 2010, 0]], "ok": false}
{"t": 1795422232.567402, "clock": "17:23:52", "kind": "screen", "title": "力が入っている (始めない)", "lines": ["フォロワーの Torque が 0 ではない", "[(1, 1992, 1), (2, 898, 1), (3, 3024, 1), (4, 2319, 1), (5, 2145, 1), (6, 2061, 1)]", "支える → 電源を切る", "", "スペースで終える"]}
{"t": 1795422277.079934, "clock": "17:24:37", "kind": "key", "title": "力が入っている (始めない)", "key": " "}
{"t": 1795422277.085046, "clock": "17:24:37", "kind": "end"}
```

#### results_274_try3_torque_on.json

```json
{
 "0": {
  "torque_zero": false,
  "follower": [
   [
    1,
    1992,
    1
   ],
   [
    2,
    898,
    1
   ],
   [
    3,
    3024,
    1
   ],
   [
    4,
    2319,
    1
   ],
   [
    5,
    2145,
    1
   ],
   [
    6,
    2061,
    1
   ]
  ]
 }
}
```

### 直しの依頼275 は、出したあと取り下げた

落ちたと聞いた時点では、依頼274 の Claude Code が原因に気づいているか分からなかった。そこで、クラッシュレポートを読んで直す依頼275 を依頼箱に入れた。ところがその間に、依頼274 の Claude Code が自分でクラッシュレポートを読み、直して起動し直していた。依頼275 は始まる前に取り下げた。

#### 依頼275 の依頼文（取り下げ）

```markdown
---
作業フォルダ: /Users/shimazueiichi/r2r2r-scripts
上限時間: 75
---
# SO-101 の record が落ちた原因を直し、お手本を10回録る（依頼275・依頼274 の続き・エイイチ立ち会い）

依頼274（`so101/check_274/`）で、record を始めてフォロワーに力が入った直後（17:12:42）に Python が強制終了した。Mac に「Python が予期しない理由で終了しました」が出たとエイイチが確かめた。stdout にはエラーの文がない。1回も録れていない。依頼274 の結果がまだなら、依頼274 の作業は打ち切ってこの依頼で続ける。

## まず原因を決める
1. `~/Library/Logs/DiagnosticReports/` の 17:12〜17:13 の Python のクラッシュレポート（.ips）を読み、落ちたスレッドと呼び出し元（pynput・tkinter など画面・AVFoundation/OpenCV・libavdevice・torchcodec など）を特定する。報告にはレポートの該当部分を貼る
2. 候補（確かめてから決める。決め打ちしない）
   - LeRobot の record が立てるキー入力の見張り（pynput）と、run_274.py の画面のキー入力がぶつかった（依頼268 の teleoperate には pynput がなく、落ちていない）
   - 動画の部品（libavdevice）が版違いで2重に読み込まれた（stdout に cv2 の 61.3 と env の 59.7 の objc の警告。依頼274 の1回目は cv2 と av の重なりだった）
3. 原因を直す。直しは `check_275/run_275.py`（run_274.py を元にする。run_274.py は書き換えない）の側で済ませる。たとえばキー入力の見張りなら、LeRobot の見張りを立てずに、run_275.py の画面のキー（→ 早めに終える・← 録り直す・Esc 止める）を LeRobot の events に渡す形にする
4. `lerobot_safe_259.py`・`~/lerobot`・conda の環境を変えないと直らないときは、変える前に止めて、何をなぜ変えるかを書いて報告する（判定：止めた）

## 直ったことを確かめる（力を入れずに）
- アームに力を入れない形（ロボットに触らない、カメラと画面と動画の書き出しだけ、または LeRobot の偽のロボット）で、record と同じ組み合わせを1回5秒ほど回し、落ちないことを確かめる。テスト（64件）が通ることも確かめる

## 確かめが通ったら、依頼274 の中身のとおり10回録る
- エイイチは落ちたあとフォロワーの電源を切っている。録る前の画面の最初に「フォロワーの電源を入れて スペース」と出して待ち、サーボが返事をするのを確かめてから依頼274 の「0. 始める前」に進む（返事がないまま進まない）
- 課題・回数・repo_id（`local/so101_redblock_box_teleop_v1`）・置き場所（Mac の `~/so101_datasets/` → 確かめ後 KIOXIA の `r2r2r-data/datasets/` にコピー）・画面の流れ・録ったあとの確かめ・replay・エイイチへの問いは、依頼274 の依頼文（`依頼箱/実行中` か `済み` の 274）のとおり
- `~/so101_datasets/so101_redblock_box_teleop_v1/` に依頼274 の途中のものが残っていれば、中身を見て報告し、別の名前（`_v1_try1`）に移してから録る（消さない）
- 録っている途中でまた落ちたら、録り直さずに止めて、クラッシュレポートを読んで報告する

## しないこと
- 包まない lerobot、rollout、Hugging Face への送信、EEPROM・キャリブレーションの書き換え、カメラの設定ファイルの書き換え
- KIOXIA の既存のファイルの上書き・移動・削除、`git add .`・`git clean`
- 確認や停止の条件を新しく重ねる

## 報告
- 落ちた原因（クラッシュレポートの該当部分）と直したこと
- 10回の表（回・長さ・コマ数・切られたコマ・エイイチの判定）、映像と角度の確かめ、replay の結果、KIOXIA にコピーした場所とサイズ
- 最後の1行に「判定：合格／止めた（決めてほしいことあり）／失敗」
```


## 作業ログ ― キーを手順の画面で受ける形に直して、10回録った

### LeRobot のキーの見張りを立てず、手順の画面のキーを渡した

直したのは手順の画面のスクリプト（`run_274.py`）の中だけで、LeRobot の `lerobot_record.py` と飛び止めの入口は書き換えていない。LeRobot が見張りを立てる関数（`init_keyboard_listener`）を、何もしない関数に差し替えた。→・←・スペース・q は、もともと手順の画面（OpenCV のウィンドウ）で受けていたので、そのキーを LeRobot の events（早めに終える・録り直す）に渡す。

- ねらい：macOS が別スレッドからの入力の関数を止める問題を、LeRobot を書き換えずに避ける
- 変わったこと：キーを受けるのが pynput の見張りから、手順の画面の1か所になった
- 見込める効果：直したあとの10回は最後まで落ちなかった。pynput は macOS で「入力の監視」の許可も求めるので、その設定もいらなくなる（許可の話は見込みで、確かめていない）

#### run_274.py の直した所（install_record_hooks）

```python
def install_record_hooks():
    """LeRobot の record_loop・save_episode を包む (lerobot_record.py は書き換えない)."""
    import lerobot.scripts.lerobot_record as rec
    from lerobot.datasets.lerobot_dataset import LeRobotDataset
    orig_loop = rec.record_loop

    def wait(kw, phase):
        REC["phase"], REC["wait"] = phase, {"exit_early": False, "rerecord_episode": False, "stop_recording": False}
        ev("phase", phase=phase, ep=REC["ep"] + 1)
        t = time.perf_counter()
        orig_loop(**dict(kw, dataset=None, events=REC["wait"], control_time_s=3600 * 4, timer=None))
        ev("phase_end", phase=phase, ep=REC["ep"] + 1, dur_s=round(time.perf_counter() - t, 2))
        REC["wait"] = None

    def record_loop(*a, **kw):
        assert not a, "record_loop はキーワード引数で呼ばれる想定"
        events, ds = kw["events"], kw.get("dataset")
        REC["events"] = events
        if ds is None:  # LeRobot の reset の間
            return wait(kw, "reset")
        ep = ds.num_episodes
        REC["try"] = REC["try"] + 1 if ep == REC["ep"] and REC["attempts"] else 1
        REC["ep"] = ep
        wait(kw, "start")
        if events["stop_recording"]:
            REC["phase"] = None
            return None
        events["exit_early"] = events["rerecord_episode"] = False  # 待ちの間のキーは持ち越さない
        REC["phase"], REC["t"] = "episode", time.perf_counter()
        ev("episode_start", ep=ep + 1, try_=REC["try"])
        try:
            ret = orig_loop(*a, **kw)
        finally:
            dur = time.perf_counter() - REC["t"]
            size = (getattr(ds, "writer", None) and ds.writer.episode_buffer or {}).get("size")
            how = ("left" if events["rerecord_episode"] else "esc" if events["stop_recording"]
                   else "right" if dur < EP_S - 0.2 else "time")
            att = {"ep": ep + 1, "try": REC["try"], "dur_s": round(dur, 2), "buffer_frames": size, "end": how,
                   "label": f"ep{ep + 1}_try{REC['try']}"}
            REC["attempts"].append(att)
            ev("episode_end", **att)
            REC["phase"] = None
        if ep == N_EP - 1 and not events["rerecord_episode"] and not events["stop_recording"]:
            wait(kw, "end")  # 10回目のあと: たたんでから保存・力を抜く (例外で抜けたときは通らない)
        return ret

    rec.record_loop = record_loop

    def init_keyboard_listener():
        # LeRobot のキー読み取り (pynput) は別スレッドから macOS の入力の関数を呼び, macOS がプロセスを止める
        # (2回目の実行 17:12:49 に SIGTRAP. crash_171249.ips). 読み取りは始めず, →・← は手順のウィンドウで受ける
        ev("keyboard_listener", note="pynput を使わない (手順のウィンドウで →・← を受ける)")
        return None, {"exit_early": False, "rerecord_episode": False, "stop_recording": False}

    rec.init_keyboard_listener = init_keyboard_listener

    orig_save, orig_clear = LeRobotDataset.save_episode, LeRobotDataset.clear_episode_buffer

    def save_episode(self, *a, **kw):
        sc = CUR["run"].screen if CUR["run"] else None
        n = self.num_episodes + 1
        if sc is not None:
            sc.render(f"{n}回目 を保存中", ["動画を書いている (数秒)", "腕はそのまま"], log=False)
            sc.poll(1)
        t = time.perf_counter()
        out = orig_save(self, *a, **kw)
        ev("saved", ep=n, dur_s=round(time.perf_counter() - t, 2), num_episodes=self.num_episodes)
        if REC["attempts"]:
            REC["attempts"][-1]["saved_as"] = self.num_episodes - 1
        return out

    def clear_episode_buffer(self, *a, **kw):
        ev("discarded", ep=self.num_episodes + 1)
        if REC["attempts"]:
            REC["attempts"][-1]["saved_as"] = None
        return orig_clear(self, *a, **kw)

    LeRobotDataset.save_episode, LeRobotDataset.clear_episode_buffer = save_episode, clear_episode_buffer
```

### 10回を 9分56秒で録った

直したあとの起動で、17:27:24 にフォロワーに力が入り（差は全軸 0.0°）、17:37:20 に10回目の保存が終わった。録った最中の試しは14回で、←で捨てたのは4回（3回目・4回目が1回ずつ、6回目が2回）。1回の保存には、動画を書き出すため 7〜10秒かかった。

| 回 | 試し | 録った長さ（秒） | 終わり方 | 次の準備（秒） | 保存（秒） |
|---|---|---|---|---|---|
| 1 | 1 | 20.02 | 時間切れ | 4.1 | 9.8 |
| 2 | 1 | 20.01 | 時間切れ | 98.6 | 9.4 |
| 3 | 1 | 2.27 | → | 13.9 | （捨てた） |
| 3 | 2 | 18.37 | → | 9.8 | 9.1 |
| 4 | 1 | 16.57 | ←（捨てた） | 7.9 | （捨てた） |
| 4 | 2 | 20.01 | 時間切れ | 9.2 | 9.5 |
| 5 | 1 | 18.41 | → | 5.3 | 9.1 |
| 6 | 1 | 14.57 | ←（捨てた） | 6.9 | （捨てた） |
| 6 | 2 | 20.01 | 時間切れ | 11.8 | （捨てた） |
| 6 | 3 | 19.87 | 時間切れ | 3.9 | 8.9 |
| 7 | 1 | 20.01 | 時間切れ | 5.8 | 8.2 |
| 8 | 1 | 14.70 | → | 5.6 | 6.9 |
| 9 | 1 | 17.11 | → | 5.4 | 7.6 |
| 10 | 1 | 18.31 | → | 8.5 | 7.9 |

録っている最中に、1コマ 10° の上限で切られたコマは 0 だった。切られたのは、回と回の間の待ちの間だけ（始める前1・始める合図の待ち1・置き直しの間3）。

![3回目の机側カメラ。左から、始め（ブロックは奥、箱は右手前）・途中（ブロックをつかんで運ぶ）・終わり（ブロックが箱の中）](https://pixelstomotors.com/media/LOG565_01_ep3_desk_first_mid_last.png)

![3回目の手首カメラ。左から、始め（爪の先に机）・途中（爪の間に赤いブロック）・終わり（ブロックを放したあと）](https://pixelstomotors.com/media/LOG565_02_ep3_wrist_first_mid_last.png)

[動画: 3回目の記録をそのまま並べた映像。左が机側カメラ、右が手首カメラ。18.4秒・1秒30コマ](https://pixelstomotors.com/media/LOG565_04_ep3_desk_wrist.mp4)

[動画: 10回を録っているところを横から撮った映像。手前で黒いリーダーを動かし、白いフォロワーが同じ動きで赤いブロックを箱へ運ぶ](https://pixelstomotors.com/media/LOG565_05_recording_session.mp4)

### 1・2回目は、ブロックが箱に入らなかった

録り終えた画面の問いで、1回目と2回目はブロックが箱に入らなかったと答えた。2つの回は、どちらも20秒の時間切れで終わっている。机側カメラのコマを見ると、1・2回目は箱が画面の左奥にあり、3回目からは右手前に置いてあった。2回目のあとの置き直しには 98.6秒かかっている。

![左と中は1回目の始めと終わり（箱は左奥、ブロックは動いていない）。右は3回目の終わり（箱は右手前、ブロックは箱の中）](https://pixelstomotors.com/media/LOG565_03_ep1_fail_vs_ep3.png)

### 録ったデータを確かめた：映像の欠けも角度の飛びも 0

Claude Code が、録ったデータを読むだけのスクリプト（`analyze_274.py`）で10回を確かめた。

| 見たこと | 結果 |
|---|---|
| 回数とコマ | 10回・5,602コマ。1回 441〜600コマ |
| 1秒あたりのコマ | 29.91〜29.99 |
| カメラ2台の映像 | 全部の回にあり、コマ数は角度の行数と同じ。真っ黒・白飛び 0、止まったコマが続いたのは最長1コマ |
| 角度（observation.state・action） | 全部の回にある。1コマ 10°（爪は 20）を超える差は 0 |

#### analysis_274.json

```json
{
 "root": "/Users/shimazueiichi/so101_datasets/so101_redblock_box_teleop_v1",
 "fps": 30,
 "total_episodes": 10,
 "total_frames": 5602,
 "cameras": [
  "observation.images.wrist",
  "observation.images.desk"
 ],
 "episodes": [
  {
   "ep": 1,
   "length": 600,
   "rows": 600,
   "dur_s": 20.0,
   "ts_step_ms": [
    33.33,
    33.33
   ],
   "real_hz": 29.91,
   "real_dur_s": 20.02,
   "cut_frames": 0,
   "try": 1,
   "end": "time",
   "observation.state": {
    "present": true,
    "step_max": {
     "shoulder_pan": 1.49,
     "shoulder_lift": 4.13,
     "elbow_flex": 2.99,
     "wrist_flex": 4.75,
     "wrist_roll": 3.08,
     "gripper": 3.12
    },
    "jumps": {}
   },
   "action": {
    "present": true,
    "step_max": {
     "shoulder_pan": 1.32,
     "shoulder_lift": 4.57,
     "elbow_flex": 3.16,
     "wrist_flex": 3.69,
     "wrist_roll": 1.49,
     "gripper": 3.95
    },
    "jumps": {}
   },
   "observation.images.wrist": {
    "file": "videos/observation.images.wrist/chunk-000/file-000.mp4",
    "frames": 600,
    "black": 0,
    "white": 0,
    "still": 154,
    "still_run_max": 1,
    "mean": [
     102.6,
     153.8,
     195.8
    ]
   },
   "observation.images.desk": {
    "file": "videos/observation.images.desk/chunk-000/file-000.mp4",
    "frames": 600,
    "black": 0,
    "white": 0,
    "still": 172,
    "still_run_max": 1,
    "mean": [
     172.0,
     187.2,
     191.5
    ]
   }
  },
  {
   "ep": 2,
   "length": 600,
   "rows": 600,
   "dur_s": 20.0,
   "ts_step_ms": [
    33.33,
    33.33
   ],
   "real_hz": 29.95,
   "real_dur_s": 20.01,
   "cut_frames": 0,
   "try": 1,
   "end": "time",
   "observation.state": {
    "present": true,
    "step_max": {
     "shoulder_pan": 0.7,
     "shoulder_lift": 3.52,
     "elbow_flex": 2.55,
     "wrist_flex": 1.49,
     "wrist_roll": 2.02,
     "gripper": 1.49
    },
    "jumps": {}
   },
   "action": {
    "present": true,
    "step_max": {
     "shoulder_pan": 0.97,
     "shoulder_lift": 3.52,
     "elbow_flex": 2.64,
     "wrist_flex": 1.58,
     "wrist_roll": 2.46,
     "gripper": 1.89
    },
    "jumps": {}
   },
   "observation.images.wrist": {
    "file": "videos/observation.images.wrist/chunk-000/file-000.mp4",
    "frames": 600,
    "black": 0,
    "white": 0,
    "still": 107,
    "still_run_max": 1,
    "mean": [
     139.7,
     159.9,
     165.1
    ]
   },
   "observation.images.desk": {
    "file": "videos/observation.images.desk/chunk-000/file-000.mp4",
    "frames": 600,
    "black": 0,
    "white": 0,
    "still": 142,
    "still_run_max": 1,
    "mean": [
     183.2,
     185.1,
     189.9
    ]
   }
  },
  {
   "ep": 3,
   "length": 551,
   "rows": 551,
   "dur_s": 18.37,
   "ts_step_ms": [
    33.33,
    33.33
   ],
   "real_hz": 29.93,
   "real_dur_s": 18.37,
   "cut_frames": 0,
   "try": 2,
   "end": "right",
   "observation.state": {
    "present": true,
    "step_max": {
     "shoulder_pan": 1.85,
     "shoulder_lift": 3.52,
     "elbow_flex": 2.73,
     "wrist_flex": 3.43,
     "wrist_roll": 1.49,
     "gripper": 3.66
    },
    "jumps": {}
   },
   "action": {
    "present": true,
    "step_max": {
     "shoulder_pan": 1.85,
     "shoulder_lift": 3.52,
     "elbow_flex": 2.81,
     "wrist_flex": 4.13,
     "wrist_roll": 2.37,
     "gripper": 4.93
    },
    "jumps": {}
   },
   "observation.images.wrist": {
    "file": "videos/observation.images.wrist/chunk-000/file-000.mp4",
    "frames": 551,
    "black": 0,
    "white": 0,
    "still": 120,
    "still_run_max": 1,
    "mean": [
     141.4,
     158.7,
     169.0
    ]
   },
   "observation.images.desk": {
    "file": "videos/observation.images.desk/chunk-000/file-000.mp4",
    "frames": 551,
    "black": 0,
    "white": 0,
    "still": 138,
    "still_run_max": 1,
    "mean": [
     183.5,
     186.3,
     189.2
    ]
   }
  },
  {
   "ep": 4,
   "length": 600,
   "rows": 600,
   "dur_s": 20.0,
   "ts_step_ms": [
    33.33,
    33.33
   ],
   "real_hz": 29.94,
   "real_dur_s": 20.01,
   "cut_frames": 0,
   "try": 2,
   "end": "time",
   "observation.state": {
    "present": true,
    "step_max": {
     "shoulder_pan": 2.81,
     "shoulder_lift": 4.13,
     "elbow_flex": 3.08,
     "wrist_flex": 2.46,
     "wrist_roll": 1.32,
     "gripper": 3.32
    },
    "jumps": {}
   },
   "action": {
    "present": true,
    "step_max": {
     "shoulder_pan": 2.9,
     "shoulder_lift": 4.22,
     "elbow_flex": 3.25,
     "wrist_flex": 2.55,
     "wrist_roll": 1.76,
     "gripper": 4.36
    },
    "jumps": {}
   },
   "observation.images.wrist": {
    "file": "videos/observation.images.wrist/chunk-000/file-000.mp4",
    "frames": 600,
    "black": 0,
    "white": 0,
    "still": 112,
    "still_run_max": 1,
    "mean": [
     140.1,
     156.3,
     173.8
    ]
   },
   "observation.images.desk": {
    "file": "videos/observation.images.desk/chunk-000/file-000.mp4",
    "frames": 600,
    "black": 0,
    "white": 0,
    "still": 145,
    "still_run_max": 1,
    "mean": [
     180.1,
     185.2,
     189.5
    ]
   }
  },
  {
   "ep": 5,
   "length": 552,
   "rows": 552,
   "dur_s": 18.4,
   "ts_step_ms": [
    33.33,
    33.33
   ],
   "real_hz": 29.94,
   "real_dur_s": 18.41,
   "cut_frames": 0,
   "try": 1,
   "end": "right",
   "observation.state": {
    "present": true,
    "step_max": {
     "shoulder_pan": 1.85,
     "shoulder_lift": 3.87,
     "elbow_flex": 3.6,
     "wrist_flex": 2.11,
     "wrist_roll": 1.67,
     "gripper": 3.73
    },
    "jumps": {}
   },
   "action": {
    "present": true,
    "step_max": {
     "shoulder_pan": 1.85,
     "shoulder_lift": 3.78,
     "elbow_flex": 3.87,
     "wrist_flex": 2.2,
     "wrist_roll": 2.37,
     "gripper": 6.0
    },
    "jumps": {}
   },
   "observation.images.wrist": {
    "file": "videos/observation.images.wrist/chunk-000/file-000.mp4",
    "frames": 552,
    "black": 0,
    "white": 0,
    "still": 92,
    "still_run_max": 1,
    "mean": [
     140.9,
     156.4,
     171.3
    ]
   },
   "observation.images.desk": {
    "file": "videos/observation.images.desk/chunk-000/file-000.mp4",
    "frames": 552,
    "black": 0,
    "white": 0,
    "still": 124,
    "still_run_max": 1,
    "mean": [
     180.0,
     186.0,
     189.1
    ]
   }
  },
  {
   "ep": 6,
   "length": 596,
   "rows": 596,
   "dur_s": 19.87,
   "ts_step_ms": [
    33.33,
    33.33
   ],
   "real_hz": 29.96,
   "real_dur_s": 19.87,
   "cut_frames": 0,
   "try": 3,
   "end": "time",
   "observation.state": {
    "present": true,
    "step_max": {
     "shoulder_pan": 1.85,
     "shoulder_lift": 4.57,
     "elbow_flex": 3.6,
     "wrist_flex": 2.2,
     "wrist_roll": 1.41,
     "gripper": 3.52
    },
    "jumps": {}
   },
   "action": {
    "present": true,
    "step_max": {
     "shoulder_pan": 1.93,
     "shoulder_lift": 4.48,
     "elbow_flex": 3.6,
     "wrist_flex": 2.37,
     "wrist_roll": 2.02,
     "gripper": 4.93
    },
    "jumps": {}
   },
   "observation.images.wrist": {
    "file": "videos/observation.images.wrist/chunk-000/file-000.mp4",
    "frames": 596,
    "black": 0,
    "white": 0,
    "still": 95,
    "still_run_max": 1,
    "mean": [
     134.1,
     158.9,
     184.6
    ]
   },
   "observation.images.desk": {
    "file": "videos/observation.images.desk/chunk-000/file-000.mp4",
    "frames": 596,
    "black": 0,
    "white": 0,
    "still": 131,
    "still_run_max": 1,
    "mean": [
     179.9,
     186.4,
     189.2
    ]
   }
  },
  {
   "ep": 7,
   "length": 600,
   "rows": 600,
   "dur_s": 20.0,
   "ts_step_ms": [
    33.33,
    33.33
   ],
   "real_hz": 29.96,
   "real_dur_s": 20.01,
   "cut_frames": 0,
   "try": 1,
   "end": "time",
   "observation.state": {
    "present": true,
    "step_max": {
     "shoulder_pan": 2.81,
     "shoulder_lift": 4.31,
     "elbow_flex": 3.25,
     "wrist_flex": 2.11,
     "wrist_roll": 1.41,
     "gripper": 3.25
    },
    "jumps": {}
   },
   "action": {
    "present": true,
    "step_max": {
     "shoulder_pan": 2.99,
     "shoulder_lift": 4.31,
     "elbow_flex": 3.16,
     "wrist_flex": 2.37,
     "wrist_roll": 1.76,
     "gripper": 4.69
    },
    "jumps": {}
   },
   "observation.images.wrist": {
    "file": "videos/observation.images.wrist/chunk-000/file-000.mp4",
    "frames": 600,
    "black": 0,
    "white": 0,
    "still": 98,
    "still_run_max": 1,
    "mean": [
     141.0,
     156.8,
     172.6
    ]
   },
   "observation.images.desk": {
    "file": "videos/observation.images.desk/chunk-000/file-000.mp4",
    "frames": 600,
    "black": 0,
    "white": 0,
    "still": 132,
    "still_run_max": 1,
    "mean": [
     182.4,
     185.3,
     188.8
    ]
   }
  },
  {
   "ep": 8,
   "length": 441,
   "rows": 441,
   "dur_s": 14.7,
   "ts_step_ms": [
    33.33,
    33.33
   ],
   "real_hz": 29.95,
   "real_dur_s": 14.7,
   "cut_frames": 0,
   "try": 1,
   "end": "right",
   "observation.state": {
    "present": true,
    "step_max": {
     "shoulder_pan": 1.41,
     "shoulder_lift": 4.4,
     "elbow_flex": 3.25,
     "wrist_flex": 1.93,
     "wrist_roll": 1.49,
     "gripper": 3.59
    },
    "jumps": {}
   },
   "action": {
    "present": true,
    "step_max": {
     "shoulder_pan": 1.49,
     "shoulder_lift": 4.4,
     "elbow_flex": 3.16,
     "wrist_flex": 2.11,
     "wrist_roll": 1.93,
     "gripper": 5.02
    },
    "jumps": {}
   },
   "observation.images.wrist": {
    "file": "videos/observation.images.wrist/chunk-000/file-000.mp4",
    "frames": 441,
    "black": 0,
    "white": 0,
    "still": 62,
    "still_run_max": 1,
    "mean": [
     139.1,
     157.7,
     168.5
    ]
   },
   "observation.images.desk": {
    "file": "videos/observation.images.desk/chunk-000/file-000.mp4",
    "frames": 441,
    "black": 0,
    "white": 0,
    "still": 89,
    "still_run_max": 1,
    "mean": [
     182.5,
     185.6,
     189.2
    ]
   }
  },
  {
   "ep": 9,
   "length": 513,
   "rows": 513,
   "dur_s": 17.1,
   "ts_step_ms": [
    33.33,
    33.33
   ],
   "real_hz": 29.95,
   "real_dur_s": 17.11,
   "cut_frames": 0,
   "try": 1,
   "end": "right",
   "observation.state": {
    "present": true,
    "step_max": {
     "shoulder_pan": 3.43,
     "shoulder_lift": 4.75,
     "elbow_flex": 4.22,
     "wrist_flex": 2.64,
     "wrist_roll": 0.97,
     "gripper": 3.73
    },
    "jumps": {}
   },
   "action": {
    "present": true,
    "step_max": {
     "shoulder_pan": 3.96,
     "shoulder_lift": 4.84,
     "elbow_flex": 4.22,
     "wrist_flex": 2.9,
     "wrist_roll": 1.32,
     "gripper": 5.18
    },
    "jumps": {}
   },
   "observation.images.wrist": {
    "file": "videos/observation.images.wrist/chunk-000/file-000.mp4",
    "frames": 513,
    "black": 0,
    "white": 0,
    "still": 56,
    "still_run_max": 1,
    "mean": [
     135.1,
     155.6,
     170.6
    ]
   },
   "observation.images.desk": {
    "file": "videos/observation.images.desk/chunk-000/file-000.mp4",
    "frames": 513,
    "black": 0,
    "white": 0,
    "still": 75,
    "still_run_max": 1,
    "mean": [
     180.7,
     185.8,
     189.4
    ]
   }
  },
  {
   "ep": 10,
   "length": 549,
   "rows": 549,
   "dur_s": 18.3,
   "ts_step_ms": [
    33.33,
    33.33
   ],
   "real_hz": 29.99,
   "real_dur_s": 18.31,
   "cut_frames": 0,
   "try": 1,
   "end": "right",
   "observation.state": {
    "present": true,
    "step_max": {
     "shoulder_pan": 1.85,
     "shoulder_lift": 4.22,
     "elbow_flex": 4.4,
     "wrist_flex": 2.73,
     "wrist_roll": 1.41,
     "gripper": 3.05
    },
    "jumps": {}
   },
   "action": {
    "present": true,
    "step_max": {
     "shoulder_pan": 1.93,
     "shoulder_lift": 4.22,
     "elbow_flex": 4.66,
     "wrist_flex": 3.16,
     "wrist_roll": 1.58,
     "gripper": 4.19
    },
    "jumps": {}
   },
   "observation.images.wrist": {
    "file": "videos/observation.images.wrist/chunk-000/file-000.mp4",
    "frames": 549,
    "black": 0,
    "white": 0,
    "still": 93,
    "still_run_max": 1,
    "mean": [
     143.3,
     156.3,
     166.8
    ]
   },
   "observation.images.desk": {
    "file": "videos/observation.images.desk/chunk-000/file-000.mp4",
    "frames": 549,
    "black": 0,
    "white": 0,
    "still": 113,
    "still_run_max": 1,
    "mean": [
     180.5,
     185.2,
     188.9
    ]
   }
  }
 ]
}
```

#### run_274_stdout_record.log

```text
[274] 17:24:44 start {"dry": false}
W1123 17:24:46.795000 31622 site-packages/torch/distributed/elastic/multiprocessing/redirects.py:35] NOTE: Redirects are currently not supported in MacOs.
objc[31622]: Class AVFFrameReceiver is implemented in both /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/cv2/.dylibs/libavdevice.61.3.100.dylib (0x1028b03a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13a0883a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[31622]: Class AVFAudioReceiver is implemented in both /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/cv2/.dylibs/libavdevice.61.3.100.dylib (0x1028b03f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13a0883f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[274] 17:24:51 read_servos {"follower": [[1, 1993, 0], [2, 898, 0], [3, 3025, 0], [4, 2320, 0], [5, 2145, 0], [6, 2061, 0]], "leader": [[1, 2098, 0], [2, 889, 0], [3, 3115, 0], [4, 2590, 0], [5, 2009, 0], [6, 2010, 0]], "ok": true}
[274] 17:24:51 screen {"title": "0. 始める前", "lines": ["ブロックを机の決まった所に置く", "リーダーとフォロワーの姿勢を近づける", "フォロワーのまわりを空ける・電源をすぐ切れるようにする", "次のスペースで つなぐ (力が入る. まだ録らない)", "(止めたいとき: q キー = Ctrl-C)", "", "準備ができたら スペース"]}
[274] 17:27:15 key {"title": "0. 始める前", "key": " "}
[274] 17:27:15 run_start {"run": "step1_record", "argv": ["record", "--dataset.repo_id=local/so101_redblock_box_teleop_v1", "--dataset.root=/Users/shimazueiichi/so101_datasets/so101_redblock_box_teleop_v1", "--dataset.single_task=Put the red block into the white box", "--dataset.fps=30", "--dataset.num_episodes=10", "--dataset.episode_time_s=20", "--dataset.reset_time_s=3600", "--dataset.no_stamp=true"]}
INFO 2026-11-23 17:27:18 t_record.py:401 {'dataset': {'depth_encoder': {'crf': 30,
                               'depth_max': 10.0,
                               'depth_min': 0.01,
                               'extra_options': {'x265-params': 'lossless=1'},
                               'fast_decode': 0,
                               'g': 2,
                               'pix_fmt': 'gray12le',
                               'preset': None,
                               'shift': 3.5,
                               'use_log': True,
                               'vcodec': 'hevc',
                               'video_backend': 'pyav'},
             'encoder_queue_maxsize': 30,
             'encoder_threads': None,
             'episode_time_s': 20,
             'fps': 30,
             'no_stamp': True,
             'num_episodes': 10,
             'num_image_writer_processes': 0,
             'num_image_writer_threads_per_camera': 4,
             'private': None,
             'push_to_hub': False,
             'repo_id': 'local/so101_redblock_box_teleop_v1',
             'reset_time_s': 3600,
             'rgb_encoder': {'crf': 30,
                             'extra_options': {},
                             'fast_decode': 0,
                             'g': 2,
                             'pix_fmt': 'yuv420p',
                             'preset': 12,
                             'vcodec': 'libsvtav1',
                             'video_backend': 'pyav'},
             'root': '/Users/shimazueiichi/so101_datasets/so101_redblock_box_teleop_v1',
             'single_task': 'Put the red block into the white box',
             'streaming_encoding': False,
             'tags': None,
             'video': True,
             'video_encoding_batch_size': 1},
 'display_compressed_images': False,
 'display_data': False,
 'display_ip': None,
 'display_mode': 'rerun',
 'display_port': None,
 'play_sounds': True,
 'resume': False,
 'robot': {'calibration_dir': None,
           'cameras': {'desk': {'backend': <Cv2Backends.ANY: 0>,
                                'color_mode': <ColorMode.RGB: 'rgb'>,
                                'fourcc': 'MJPG',
                                'fps': 30,
                                'height': 480,
                                'index_or_path': 0,
                                'rotation': <Cv2Rotation.NO_ROTATION: 0>,
                                'warmup_s': 1,
                                'width': 640},
                       'wrist': {'backend': <Cv2Backends.ANY: 0>,
                                 'color_mode': <ColorMode.RGB: 'rgb'>,
                                 'fourcc': 'MJPG',
                                 'fps': 30,
                                 'height': 480,
                                 'index_or_path': 1,
                                 'rotation': <Cv2Rotation.NO_ROTATION: 0>,
                                 'warmup_s': 1,
                                 'width': 640}},
           'disable_torque_on_disconnect': True,
           'id': 'ptm_follower',
           'max_relative_target': None,
           'num_read_retries': 2,
           'port': '/dev/tty.usbmodem5CBC4321631',
           'position_d_coefficient': 32,
           'position_i_coefficient': 0,
           'position_p_coefficient': 16,
           'use_degrees': True},
 'teleop': {'calibration_dir': None,
            'id': 'ptm_leader',
            'num_read_retries': 2,
            'port': '/dev/tty.usbmodem5CBC4323581',
            'use_degrees': True}}
objc[31622]: Class AVFFrameReceiver is implemented in both /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/cv2/.dylibs/libavdevice.61.3.100.dylib (0x1028b03a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x154c4c778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[31622]: Class AVFAudioReceiver is implemented in both /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/cv2/.dylibs/libavdevice.61.3.100.dylib (0x1028b03f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x154c4c7c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
INFO 2026-11-23 17:27:18 so_leader.py:95 ptm_leader SOLeader connected.
INFO 2026-11-23 17:27:18 safe_259.py:115 [A] follower: connect の直後に目標を今の位置にした
WARNING 2026-11-23 17:27:18 a_opencv.py:284 OpenCVCamera(1) failed to set fourcc=MJPG (actual=    , success=False). Continuing with default format.
INFO 2026-11-23 17:27:20 a_opencv.py:198 OpenCVCamera(1) connected.
WARNING 2026-11-23 17:27:21 a_opencv.py:284 OpenCVCamera(0) failed to set fourcc=MJPG (actual=    , success=False). Continuing with default format.
INFO 2026-11-23 17:27:23 a_opencv.py:198 OpenCVCamera(0) connected.
INFO 2026-11-23 17:27:24 safe_259.py:663 [CAM] 露出・ホワイトバランスを固定した: {'wrist': {'auto-exposure-mode': '8', 'auto-white-balance-temp': 'false', 'white-balance-temp': '4600', 'brightness': '0', 'contrast': '38', 'gamma': '400'}, 'desk': {'auto-exposure-mode': '1', 'auto-white-balance-temp': 'true', 'exposure-time-abs': '101', 'gain': '0'}}
INFO 2026-11-23 17:27:24 safe_259.py:125 [A] follower: 力を入れる直前に目標を今の位置にした (全部)
[274] 17:27:24 torque_on {"run": "step1_record", "max_diff_deg": {"shoulder_pan": 0.0, "shoulder_lift": 0.0, "elbow_flex": 0.0, "wrist_flex": 0.0, "wrist_roll": 0.0, "gripper": 0.0}}
INFO 2026-11-23 17:27:24 follower.py:128 ptm_follower SOFollower connected.
[274] 17:27:24 keyboard_listener {"note": "pynput を使わない (手順のウィンドウで →・← を受ける)"}
INFO 2026-11-23 17:27:24 t_record.py:504 Streaming encoding is disabled. If you have capable hardware, consider enabling it for way faster episode saving. --dataset.streaming_encoding=true --dataset.encoder_threads=2 # --dataset.rgb_encoder.vcodec=auto. More info in the documentation: https://huggingface.co/docs/lerobot/streaming_video_encoding
INFO 2026-11-23 17:27:24 ls/utils.py:151 Recording episode 0
[274] 17:27:24 phase {"phase": "start", "ep": 1}
[274] 17:27:24 screen {"title": "1回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
[274] 17:27:24 key {"phase": "start", "ep": 1, "key": "space"}
[274] 17:27:24 phase_end {"phase": "start", "ep": 1, "dur_s": 0.07}
[274] 17:27:24 episode_start {"ep": 1, "try_": 1}
WARNING 2026-11-23 17:27:26 le_timer.py:407 Control loop is running slower (22.5 Hz) than the target FPS (30 Hz). Dataset frames might be dropped and robot control might be unstable. Common causes are: 1) Camera FPS not keeping up 2) Policy inference (action or text) taking too long 3) CPU starvation
[274] 17:27:44 episode_end {"ep": 1, "try": 1, "dur_s": 20.02, "buffer_frames": 600, "end": "time", "label": "ep1_try1"}
INFO 2026-11-23 17:27:44 ls/utils.py:151 Reset the environment
[274] 17:27:44 phase {"phase": "reset", "ep": 1}
[274] 17:27:44 screen {"title": "1回目 終わり", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで次へ", "うまくいかなかった回は ← で録り直す"]}
[274] 17:27:48 key {"phase": "reset", "ep": 1, "key": "space", "rerecord": false}
[274] 17:27:49 phase_end {"phase": "reset", "ep": 1, "dur_s": 4.07}

Map:   0%|          | 0/600 [00:00<?, ? examples/s]
Map: 100%|██████████| 600/600 [00:00<00:00, 5555.91 examples/s]
Map: 100%|██████████| 600/600 [00:00<00:00, 5453.50 examples/s]
Svt[info]: Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
Svt[info]: LIB Build date: Jul  3 2025 03:06:26
Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
Svt[info]: LIB Build date: Jul  3 2025 03:06:26
Svt[info]: -------------------------------------------
Svt[warn]: Preset M12 is mapped to M10.
Svt[warn]: Preset M12 is mapped to M10.
Svt[info]: Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[info]: Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[info]: [asm level on system : up to neon_dotprod]
Svt[info]: [asm level selected : up to neon_dotprod]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: -------------------------------------------
Svt[info]: [asm level on system : up to neon_dotprod]
Svt[info]: [asm level selected : up to neon_dotprod]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: -------------------------------------------
[274] 17:27:58 saved {"ep": 1, "dur_s": 9.83, "num_episodes": 1}
INFO 2026-11-23 17:27:58 ls/utils.py:151 Recording episode 1
[274] 17:27:58 phase {"phase": "start", "ep": 2}
[274] 17:27:58 screen {"title": "2回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
[274] 17:28:05 key {"phase": "start", "ep": 2, "key": "space"}
[274] 17:28:05 phase_end {"phase": "start", "ep": 2, "dur_s": 6.8}
[274] 17:28:05 episode_start {"ep": 2, "try_": 1}
INFO 2026-11-23 17:28:05 le_timer.py:570 Cadence (episode 0): 29.96 Hz vs 30 Hz target · 600 ticks, 20.0 s measured · 1/599 ticks over the 33.3 ms budget (work mean 17.1 ms, worst 44.4 ms)
[274] 17:28:25 episode_end {"ep": 2, "try": 1, "dur_s": 20.01, "buffer_frames": 600, "end": "time", "label": "ep2_try1"}
INFO 2026-11-23 17:28:25 ls/utils.py:151 Reset the environment
[274] 17:28:25 phase {"phase": "reset", "ep": 2}
[274] 17:28:25 screen {"title": "2回目 終わり", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで次へ", "うまくいかなかった回は ← で録り直す"]}
[274] 17:30:04 key {"phase": "reset", "ep": 2, "key": "space", "rerecord": false}
[274] 17:30:04 phase_end {"phase": "reset", "ep": 2, "dur_s": 98.6}

Map:   0%|          | 0/600 [00:00<?, ? examples/s]
Map: 100%|██████████| 600/600 [00:00<00:00, 5964.12 examples/s]
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
Svt[info]: Svt[info]: LIB Build date: Jul  3 2025 03:06:26
-------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
Svt[info]: LIB Build date: Jul  3 2025 03:06:26
Svt[info]: -------------------------------------------
Svt[info]: -------------------------------------------
Svt[warn]: Preset M12 is mapped to M10.
Svt[info]: Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[warn]: Preset M12 is mapped to M10.
Svt[info]: [asm level on system : up to neon_dotprod]
Svt[info]: [asm level selected : up to neon_dotprod]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: -------------------------------------------
Svt[info]: Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[info]: [asm level on system : up to neon_dotprod]
Svt[info]: [asm level selected : up to neon_dotprod]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: -------------------------------------------
[mp4 @ 0x313d608f0] Starting second pass: moving the moov atom to the beginning of the file
[mp4 @ 0x313d5fdd0] Starting second pass: moving the moov atom to the beginning of the file
[274] 17:30:13 saved {"ep": 2, "dur_s": 9.38, "num_episodes": 2}
INFO 2026-11-23 17:30:13 ls/utils.py:151 Recording episode 2
[274] 17:30:13 phase {"phase": "start", "ep": 3}
[274] 17:30:13 screen {"title": "3回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
[274] 17:30:42 key {"phase": "start", "ep": 3, "key": "space"}
[274] 17:30:42 phase_end {"phase": "start", "ep": 3, "dur_s": 29.08}
[274] 17:30:42 episode_start {"ep": 3, "try_": 1}
INFO 2026-11-23 17:30:42 le_timer.py:570 Cadence (episode 1): 29.99 Hz vs 30 Hz target · 600 ticks, 20.0 s measured · 0/599 ticks over the 33.3 ms budget (work mean 16.8 ms, worst 25.0 ms)
[274] 17:30:45 key {"phase": "episode", "ep": 3, "key": "right"}
[274] 17:30:45 episode_end {"ep": 3, "try": 1, "dur_s": 2.27, "buffer_frames": 68, "end": "right", "label": "ep3_try1"}
INFO 2026-11-23 17:30:45 ls/utils.py:151 Reset the environment
[274] 17:30:45 phase {"phase": "reset", "ep": 3}
[274] 17:30:45 screen {"title": "3回目 終わり", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで次へ", "うまくいかなかった回は ← で録り直す"]}
[274] 17:30:55 key {"phase": "reset", "ep": 3, "key": "left"}
[274] 17:30:55 screen {"title": "3回目 を録り直す", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで もう一度 3回目へ"]}
[274] 17:30:58 key {"phase": "reset", "ep": 3, "key": "space", "rerecord": true}
[274] 17:30:58 phase_end {"phase": "reset", "ep": 3, "dur_s": 13.87}
INFO 2026-11-23 17:30:58 ls/utils.py:151 Re-record episode
[274] 17:30:59 discarded {"ep": 3}
INFO 2026-11-23 17:30:59 ls/utils.py:151 Recording episode 2
[274] 17:30:59 phase {"phase": "start", "ep": 3}
[274] 17:30:59 screen {"title": "3回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
[274] 17:31:06 key {"phase": "start", "ep": 3, "key": "space"}
[274] 17:31:06 phase_end {"phase": "start", "ep": 3, "dur_s": 7.5}
[274] 17:31:06 episode_start {"ep": 3, "try_": 2}
INFO 2026-11-23 17:31:06 le_timer.py:570 Cadence (discarded episode): 29.99 Hz vs 30 Hz target · 68 ticks, 2.2 s measured · 0/67 ticks over the 33.3 ms budget (work mean 16.9 ms, worst 22.8 ms)
[274] 17:31:24 key {"phase": "episode", "ep": 3, "key": "right"}
[274] 17:31:24 episode_end {"ep": 3, "try": 2, "dur_s": 18.37, "buffer_frames": 551, "end": "right", "label": "ep3_try2"}
INFO 2026-11-23 17:31:24 ls/utils.py:151 Reset the environment
[274] 17:31:24 phase {"phase": "reset", "ep": 3}
[274] 17:31:24 screen {"title": "3回目 終わり", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで次へ", "うまくいかなかった回は ← で録り直す"]}
[274] 17:31:34 key {"phase": "reset", "ep": 3, "key": "space", "rerecord": false}
[274] 17:31:34 phase_end {"phase": "reset", "ep": 3, "dur_s": 9.77}

Map:   0%|          | 0/551 [00:00<?, ? examples/s]
Map: 100%|██████████| 551/551 [00:00<00:00, 5859.59 examples/s]
Svt[info]: Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
Svt[info]: LIB Build date: Jul  3 2025 03:06:26
Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
Svt[info]: LIB Build date: Jul  3 2025 03:06:26
Svt[info]: -------------------------------------------
Svt[warn]: Preset M12 is mapped to M10.
Svt[warn]: Preset M12 is mapped to M10.
Svt[info]: Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[info]: Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[info]: [asm level on system : up to neon_dotprod]
Svt[info]: [asm level selected : up to neon_dotprod]
Svt[info]: Svt[info]: [asm level on system : up to neon_dotprod]
-------------------------------------------
Svt[info]: [asm level selected : up to neon_dotprod]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: -------------------------------------------
[mp4 @ 0x338a2e5f0] Starting second pass: moving the moov atom to the beginning of the file
[mp4 @ 0x313d60cc0] Starting second pass: moving the moov atom to the beginning of the file
[274] 17:31:43 saved {"ep": 3, "dur_s": 9.09, "num_episodes": 3}
INFO 2026-11-23 17:31:43 ls/utils.py:151 Recording episode 3
[274] 17:31:43 phase {"phase": "start", "ep": 4}
[274] 17:31:43 screen {"title": "4回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
[274] 17:31:47 key {"phase": "start", "ep": 4, "key": "space"}
[274] 17:31:47 phase_end {"phase": "start", "ep": 4, "dur_s": 3.37}
[274] 17:31:47 episode_start {"ep": 4, "try_": 1}
INFO 2026-11-23 17:31:47 le_timer.py:570 Cadence (episode 2): 29.99 Hz vs 30 Hz target · 551 ticks, 18.3 s measured · 0/550 ticks over the 33.3 ms budget (work mean 17.0 ms, worst 25.0 ms)
[274] 17:32:03 key {"phase": "episode", "ep": 4, "key": "left"}
[274] 17:32:03 episode_end {"ep": 4, "try": 1, "dur_s": 16.57, "buffer_frames": 497, "end": "left", "label": "ep4_try1"}
INFO 2026-11-23 17:32:03 ls/utils.py:151 Reset the environment
[274] 17:32:03 phase {"phase": "reset", "ep": 4}
[274] 17:32:03 screen {"title": "4回目 を録り直す", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで もう一度 4回目へ"]}
[274] 17:32:11 key {"phase": "reset", "ep": 4, "key": "space", "rerecord": true}
[274] 17:32:11 phase_end {"phase": "reset", "ep": 4, "dur_s": 7.94}
INFO 2026-11-23 17:32:11 ls/utils.py:151 Re-record episode
[274] 17:32:11 discarded {"ep": 4}
INFO 2026-11-23 17:32:11 ls/utils.py:151 Recording episode 3
[274] 17:32:11 phase {"phase": "start", "ep": 4}
[274] 17:32:11 screen {"title": "4回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
[274] 17:32:14 key {"phase": "start", "ep": 4, "key": "space"}
[274] 17:32:14 phase_end {"phase": "start", "ep": 4, "dur_s": 2.8}
[274] 17:32:14 episode_start {"ep": 4, "try_": 2}
INFO 2026-11-23 17:32:14 le_timer.py:570 Cadence (discarded episode): 29.99 Hz vs 30 Hz target · 497 ticks, 16.5 s measured · 0/496 ticks over the 33.3 ms budget (work mean 16.9 ms, worst 24.3 ms)
[274] 17:32:34 episode_end {"ep": 4, "try": 2, "dur_s": 20.01, "buffer_frames": 600, "end": "time", "label": "ep4_try2"}
INFO 2026-11-23 17:32:34 ls/utils.py:151 Reset the environment
[274] 17:32:34 phase {"phase": "reset", "ep": 4}
[274] 17:32:34 screen {"title": "4回目 終わり", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで次へ", "うまくいかなかった回は ← で録り直す"]}
[274] 17:32:43 key {"phase": "reset", "ep": 4, "key": "space", "rerecord": false}
[274] 17:32:43 phase_end {"phase": "reset", "ep": 4, "dur_s": 9.17}

Map:   0%|          | 0/600 [00:00<?, ? examples/s]
Map: 100%|██████████| 600/600 [00:00<00:00, 5936.37 examples/s]
Map: 100%|██████████| 600/600 [00:00<00:00, 5891.08 examples/s]
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
Svt[info]: LIB Build date: Jul  3 2025 03:06:26
Svt[info]: -------------------------------------------
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
Svt[info]: LIB Build date: Jul  3 2025 03:06:26
Svt[info]: -------------------------------------------
Svt[warn]: Preset M12 is mapped to M10.
Svt[info]: Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[warn]: Preset M12 is mapped to M10.
Svt[info]: [asm level on system : up to neon_dotprod]
Svt[info]: [asm level selected : up to neon_dotprod]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: -------------------------------------------
Svt[info]: Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[info]: [asm level on system : up to neon_dotprod]
Svt[info]: [asm level selected : up to neon_dotprod]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: -------------------------------------------
[mp4 @ 0x31917d950] Starting second pass: moving the moov atom to the beginning of the file
[mp4 @ 0x338a2e5f0] Starting second pass: moving the moov atom to the beginning of the file
[274] 17:32:53 saved {"ep": 4, "dur_s": 9.48, "num_episodes": 4}
INFO 2026-11-23 17:32:53 ls/utils.py:151 Recording episode 4
[274] 17:32:53 phase {"phase": "start", "ep": 5}
[274] 17:32:53 screen {"title": "5回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
[274] 17:32:56 key {"phase": "start", "ep": 5, "key": "space"}
[274] 17:32:56 phase_end {"phase": "start", "ep": 5, "dur_s": 2.93}
[274] 17:32:56 episode_start {"ep": 5, "try_": 1}
INFO 2026-11-23 17:32:56 le_timer.py:570 Cadence (episode 3): 29.99 Hz vs 30 Hz target · 600 ticks, 20.0 s measured · 0/599 ticks over the 33.3 ms budget (work mean 16.9 ms, worst 24.1 ms)
[274] 17:33:14 key {"phase": "episode", "ep": 5, "key": "right"}
[274] 17:33:14 episode_end {"ep": 5, "try": 1, "dur_s": 18.41, "buffer_frames": 552, "end": "right", "label": "ep5_try1"}
INFO 2026-11-23 17:33:14 ls/utils.py:151 Reset the environment
[274] 17:33:14 phase {"phase": "reset", "ep": 5}
[274] 17:33:14 screen {"title": "5回目 終わり", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで次へ", "うまくいかなかった回は ← で録り直す"]}
[274] 17:33:20 key {"phase": "reset", "ep": 5, "key": "space", "rerecord": false}
[274] 17:33:20 phase_end {"phase": "reset", "ep": 5, "dur_s": 5.3}

Map:   0%|          | 0/552 [00:00<?, ? examples/s]
Map: 100%|██████████| 552/552 [00:00<00:00, 5658.35 examples/s]
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
Svt[info]: LIB Build date: Jul  3 2025 03:06:26
Svt[info]: -------------------------------------------
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
Svt[info]: LIB Build date: Jul  3 2025 03:06:26
Svt[info]: -------------------------------------------
Svt[warn]: Preset M12 is mapped to M10.
Svt[info]: Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[info]: [asm level on system : up to neon_dotprod]
Svt[info]: [asm level selected : up to neon_dotprod]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: -------------------------------------------
Svt[warn]: Preset M12 is mapped to M10.
Svt[info]: Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[info]: [asm level on system : up to neon_dotprod]
Svt[info]: [asm level selected : up to neon_dotprod]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: -------------------------------------------
[mp4 @ 0x313d60ed0] Starting second pass: moving the moov atom to the beginning of the file
[mp4 @ 0x338a6af10] Starting second pass: moving the moov atom to the beginning of the file
[274] 17:33:29 saved {"ep": 5, "dur_s": 9.08, "num_episodes": 5}
INFO 2026-11-23 17:33:29 ls/utils.py:151 Recording episode 5
[274] 17:33:29 phase {"phase": "start", "ep": 6}
[274] 17:33:29 screen {"title": "6回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
[274] 17:33:31 key {"phase": "start", "ep": 6, "key": "space"}
[274] 17:33:31 phase_end {"phase": "start", "ep": 6, "dur_s": 2.4}
[274] 17:33:31 episode_start {"ep": 6, "try_": 1}
INFO 2026-11-23 17:33:31 le_timer.py:570 Cadence (episode 4): 29.99 Hz vs 30 Hz target · 552 ticks, 18.4 s measured · 0/551 ticks over the 33.3 ms budget (work mean 16.9 ms, worst 23.2 ms)
[274] 17:33:46 key {"phase": "episode", "ep": 6, "key": "left"}
[274] 17:33:46 episode_end {"ep": 6, "try": 1, "dur_s": 14.57, "buffer_frames": 437, "end": "left", "label": "ep6_try1"}
INFO 2026-11-23 17:33:46 ls/utils.py:151 Reset the environment
[274] 17:33:46 phase {"phase": "reset", "ep": 6}
[274] 17:33:46 screen {"title": "6回目 を録り直す", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで もう一度 6回目へ"]}
[274] 17:33:53 key {"phase": "reset", "ep": 6, "key": "space", "rerecord": true}
[274] 17:33:53 phase_end {"phase": "reset", "ep": 6, "dur_s": 6.9}
INFO 2026-11-23 17:33:53 ls/utils.py:151 Re-record episode
[274] 17:33:53 discarded {"ep": 6}
INFO 2026-11-23 17:33:53 ls/utils.py:151 Recording episode 5
[274] 17:33:53 phase {"phase": "start", "ep": 6}
[274] 17:33:53 screen {"title": "6回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
[274] 17:33:54 key {"phase": "start", "ep": 6, "key": "space"}
[274] 17:33:54 phase_end {"phase": "start", "ep": 6, "dur_s": 1.33}
[274] 17:33:54 episode_start {"ep": 6, "try_": 2}
INFO 2026-11-23 17:33:54 le_timer.py:570 Cadence (discarded episode): 29.99 Hz vs 30 Hz target · 437 ticks, 14.5 s measured · 0/436 ticks over the 33.3 ms budget (work mean 16.9 ms, worst 27.6 ms)
[274] 17:34:14 episode_end {"ep": 6, "try": 2, "dur_s": 20.01, "buffer_frames": 600, "end": "time", "label": "ep6_try2"}
INFO 2026-11-23 17:34:14 ls/utils.py:151 Reset the environment
[274] 17:34:14 phase {"phase": "reset", "ep": 6}
[274] 17:34:14 screen {"title": "6回目 終わり", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで次へ", "うまくいかなかった回は ← で録り直す"]}
[274] 17:34:20 key {"phase": "reset", "ep": 6, "key": "left"}
[274] 17:34:20 screen {"title": "6回目 を録り直す", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで もう一度 6回目へ"]}
[274] 17:34:26 key {"phase": "reset", "ep": 6, "key": "space", "rerecord": true}
[274] 17:34:26 phase_end {"phase": "reset", "ep": 6, "dur_s": 11.81}
INFO 2026-11-23 17:34:26 ls/utils.py:151 Re-record episode
[274] 17:34:26 discarded {"ep": 6}
INFO 2026-11-23 17:34:26 ls/utils.py:151 Recording episode 5
[274] 17:34:26 phase {"phase": "start", "ep": 6}
[274] 17:34:26 screen {"title": "6回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
[274] 17:34:28 key {"phase": "start", "ep": 6, "key": "space"}
[274] 17:34:28 phase_end {"phase": "start", "ep": 6, "dur_s": 1.8}
[274] 17:34:28 episode_start {"ep": 6, "try_": 3}
INFO 2026-11-23 17:34:28 le_timer.py:570 Cadence (discarded episode): 29.98 Hz vs 30 Hz target · 600 ticks, 20.0 s measured · 0/599 ticks over the 33.3 ms budget (work mean 16.9 ms, worst 26.2 ms)
[274] 17:34:48 key {"phase": "episode", "ep": 6, "key": "right"}
[274] 17:34:48 episode_end {"ep": 6, "try": 3, "dur_s": 19.87, "buffer_frames": 596, "end": "time", "label": "ep6_try3"}
INFO 2026-11-23 17:34:48 ls/utils.py:151 Reset the environment
[274] 17:34:48 phase {"phase": "reset", "ep": 6}
[274] 17:34:48 screen {"title": "6回目 終わり", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで次へ", "うまくいかなかった回は ← で録り直す"]}
[274] 17:34:52 key {"phase": "reset", "ep": 6, "key": "space", "rerecord": false}
[274] 17:34:52 phase_end {"phase": "reset", "ep": 6, "dur_s": 3.93}

Map:   0%|          | 0/596 [00:00<?, ? examples/s]
Map: 100%|██████████| 596/596 [00:00<00:00, 6145.73 examples/s]
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
Svt[info]: LIB Build date: Jul  3 2025 03:06:26
Svt[info]: -------------------------------------------
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
Svt[info]: LIB Build date: Jul  3 2025 03:06:26
Svt[info]: -------------------------------------------
Svt[warn]: Preset M12 is mapped to M10.
Svt[info]: Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[info]: [asm level on system : up to neon_dotprod]
Svt[info]: [asm level selected : up to neon_dotprod]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: Svt[warn]: SVT [config]: bit-depth / color format 					: 8 / YUV420
Preset M12 is mapped to M10.
Svt[info]: SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: Svt[info]: Level of Parallelism: 4
SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: Svt[info]: Number of PPCS 59
-------------------------------------------
Svt[info]: [asm level on system : up to neon_dotprod]
Svt[info]: [asm level selected : up to neon_dotprod]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: -------------------------------------------
[mp4 @ 0x313d5f9f0] Starting second pass: moving the moov atom to the beginning of the file
[mp4 @ 0x31917d950] Starting second pass: moving the moov atom to the beginning of the file
[274] 17:35:01 saved {"ep": 6, "dur_s": 8.88, "num_episodes": 6}
INFO 2026-11-23 17:35:01 ls/utils.py:151 Recording episode 6
[274] 17:35:01 phase {"phase": "start", "ep": 7}
[274] 17:35:01 screen {"title": "7回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
[274] 17:35:02 key {"phase": "start", "ep": 7, "key": "space"}
[274] 17:35:02 phase_end {"phase": "start", "ep": 7, "dur_s": 1.83}
[274] 17:35:02 episode_start {"ep": 7, "try_": 1}
INFO 2026-11-23 17:35:02 le_timer.py:570 Cadence (episode 5): 29.99 Hz vs 30 Hz target · 596 ticks, 19.8 s measured · 0/595 ticks over the 33.3 ms budget (work mean 16.6 ms, worst 19.9 ms)
[274] 17:35:22 episode_end {"ep": 7, "try": 1, "dur_s": 20.01, "buffer_frames": 600, "end": "time", "label": "ep7_try1"}
INFO 2026-11-23 17:35:22 ls/utils.py:151 Reset the environment
[274] 17:35:22 phase {"phase": "reset", "ep": 7}
[274] 17:35:22 screen {"title": "7回目 終わり", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで次へ", "うまくいかなかった回は ← で録り直す"]}
[274] 17:35:28 key {"phase": "reset", "ep": 7, "key": "space", "rerecord": false}
[274] 17:35:28 phase_end {"phase": "reset", "ep": 7, "dur_s": 5.77}

Map:   0%|          | 0/600 [00:00<?, ? examples/s]
Map: 100%|██████████| 600/600 [00:00<00:00, 6301.92 examples/s]
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
Svt[info]: LIB Build date: Jul  3 2025 03:06:26
Svt[info]: -------------------------------------------
Svt[warn]: Preset M12 is mapped to M10.
Svt[info]: Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
Svt[info]: LIB Build date: Jul  3 2025 03:06:26
Svt[info]: -------------------------------------------
Svt[info]: [asm level on system : up to neon_dotprod]
Svt[info]: [asm level selected : up to neon_dotprod]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: -------------------------------------------
Svt[warn]: Preset M12 is mapped to M10.
Svt[info]: Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[info]: [asm level on system : up to neon_dotprod]
Svt[info]: [asm level selected : up to neon_dotprod]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: -------------------------------------------
[mp4 @ 0x31917e380] Starting second pass: moving the moov atom to the beginning of the file
[mp4 @ 0x31917e380] Starting second pass: moving the moov atom to the beginning of the file
[274] 17:35:36 saved {"ep": 7, "dur_s": 8.25, "num_episodes": 7}
INFO 2026-11-23 17:35:36 ls/utils.py:151 Recording episode 7
[274] 17:35:37 phase {"phase": "start", "ep": 8}
[274] 17:35:37 screen {"title": "8回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
[274] 17:35:39 key {"phase": "start", "ep": 8, "key": "space"}
[274] 17:35:39 phase_end {"phase": "start", "ep": 8, "dur_s": 2.63}
[274] 17:35:39 episode_start {"ep": 8, "try_": 1}
INFO 2026-11-23 17:35:39 le_timer.py:570 Cadence (episode 6): 29.99 Hz vs 30 Hz target · 600 ticks, 20.0 s measured · 0/599 ticks over the 33.3 ms budget (work mean 16.7 ms, worst 20.4 ms)
[274] 17:35:54 key {"phase": "episode", "ep": 8, "key": "right"}
[274] 17:35:54 episode_end {"ep": 8, "try": 1, "dur_s": 14.7, "buffer_frames": 441, "end": "right", "label": "ep8_try1"}
INFO 2026-11-23 17:35:54 ls/utils.py:151 Reset the environment
[274] 17:35:54 phase {"phase": "reset", "ep": 8}
[274] 17:35:54 screen {"title": "8回目 終わり", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで次へ", "うまくいかなかった回は ← で録り直す"]}
[274] 17:35:59 key {"phase": "reset", "ep": 8, "key": "space", "rerecord": false}
[274] 17:35:59 phase_end {"phase": "reset", "ep": 8, "dur_s": 5.57}

Map:   0%|          | 0/441 [00:00<?, ? examples/s]
Map: 100%|██████████| 441/441 [00:00<00:00, 6170.58 examples/s]
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
Svt[info]: LIB Build date: Jul  3 2025 03:06:26
Svt[info]: -------------------------------------------
Svt[warn]: Preset M12 is mapped to M10.
Svt[info]: Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[info]: [asm level on system : up to neon_dotprod]
Svt[info]: [asm level selected : up to neon_dotprod]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: -------------------------------------------
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
Svt[info]: LIB Build date: Jul  3 2025 03:06:26
Svt[info]: -------------------------------------------
Svt[warn]: Preset M12 is mapped to M10.
Svt[info]: Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[info]: [asm level on system : up to neon_dotprod]
Svt[info]: [asm level selected : up to neon_dotprod]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: -------------------------------------------
[mp4 @ 0x31917e380] Starting second pass: moving the moov atom to the beginning of the file
[mp4 @ 0x338a32a90] Starting second pass: moving the moov atom to the beginning of the file
[274] 17:36:06 saved {"ep": 8, "dur_s": 6.94, "num_episodes": 8}
INFO 2026-11-23 17:36:06 ls/utils.py:151 Recording episode 8
[274] 17:36:06 phase {"phase": "start", "ep": 9}
[274] 17:36:06 screen {"title": "9回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
[274] 17:36:09 key {"phase": "start", "ep": 9, "key": "space"}
[274] 17:36:09 phase_end {"phase": "start", "ep": 9, "dur_s": 2.43}
[274] 17:36:09 episode_start {"ep": 9, "try_": 1}
INFO 2026-11-23 17:36:09 le_timer.py:570 Cadence (episode 7): 29.99 Hz vs 30 Hz target · 441 ticks, 14.7 s measured · 0/440 ticks over the 33.3 ms budget (work mean 16.7 ms, worst 20.5 ms)
[274] 17:36:26 key {"phase": "episode", "ep": 9, "key": "right"}
[274] 17:36:26 episode_end {"ep": 9, "try": 1, "dur_s": 17.11, "buffer_frames": 513, "end": "right", "label": "ep9_try1"}
INFO 2026-11-23 17:36:26 ls/utils.py:151 Reset the environment
[274] 17:36:26 phase {"phase": "reset", "ep": 9}
[274] 17:36:26 screen {"title": "9回目 終わり", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで次へ", "うまくいかなかった回は ← で録り直す"]}
[274] 17:36:31 key {"phase": "reset", "ep": 9, "key": "space", "rerecord": false}
[274] 17:36:31 phase_end {"phase": "reset", "ep": 9, "dur_s": 5.37}

Map:   0%|          | 0/513 [00:00<?, ? examples/s]
Map: 100%|██████████| 513/513 [00:00<00:00, 6045.67 examples/s]
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
Svt[info]: LIB Build date: Jul  3 2025 03:06:26
Svt[info]: -------------------------------------------
Svt[warn]: Preset M12 is mapped to M10.
Svt[info]: Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[info]: [asm level on system : up to neon_dotprod]
Svt[info]: [asm level selected : up to neon_dotprod]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: -------------------------------------------
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
Svt[info]: LIB Build date: Jul  3 2025 03:06:26
Svt[info]: -------------------------------------------
Svt[warn]: Preset M12 is mapped to M10.
Svt[info]: Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[info]: [asm level on system : up to neon_dotprod]
Svt[info]: [asm level selected : up to neon_dotprod]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: -------------------------------------------
[mp4 @ 0x168b29f20] Starting second pass: moving the moov atom to the beginning of the file
[mp4 @ 0x338a6af00] Starting second pass: moving the moov atom to the beginning of the file
[274] 17:36:39 saved {"ep": 9, "dur_s": 7.56, "num_episodes": 9}
INFO 2026-11-23 17:36:39 ls/utils.py:151 Recording episode 9
[274] 17:36:39 phase {"phase": "start", "ep": 10}
[274] 17:36:39 screen {"title": "10回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
[274] 17:36:45 key {"phase": "start", "ep": 10, "key": "space"}
[274] 17:36:45 phase_end {"phase": "start", "ep": 10, "dur_s": 6.14}
[274] 17:36:45 episode_start {"ep": 10, "try_": 1}
INFO 2026-11-23 17:36:45 le_timer.py:570 Cadence (episode 8): 29.99 Hz vs 30 Hz target · 513 ticks, 17.1 s measured · 0/512 ticks over the 33.3 ms budget (work mean 16.8 ms, worst 20.7 ms)
[274] 17:37:03 key {"phase": "episode", "ep": 10, "key": "right"}
[274] 17:37:03 episode_end {"ep": 10, "try": 1, "dur_s": 18.31, "buffer_frames": 549, "end": "right", "label": "ep10_try1"}
[274] 17:37:03 phase {"phase": "end", "ep": 10}
[274] 17:37:03 screen {"title": "10回目 終わり (これで10回)", "lines": ["リーダーで 爪を閉じる", "腕を机の上まで下ろして たたむ (休みの姿勢)", "たたんだら スペース (保存して 力が抜ける)", "幅の外だと 赤い字で関節名が出る → そこを戻す", "うまくいかなかったら ← で録り直す"]}
[274] 17:37:12 key {"phase": "end", "ep": 10, "key": "space"}
[274] 17:37:12 phase_end {"phase": "end", "ep": 10, "dur_s": 8.54}

Map:   0%|          | 0/549 [00:00<?, ? examples/s]
Map: 100%|██████████| 549/549 [00:00<00:00, 6219.41 examples/s]
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
Svt[info]: LIB Build date: Jul  3 2025 03:06:26
Svt[info]: -------------------------------------------
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
Svt[info]: LIB Build date: Jul  3 2025 03:06:26
Svt[info]: -------------------------------------------
Svt[warn]: Preset M12 is mapped to M10.
Svt[info]: Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[info]: [asm level on system : up to neon_dotprod]
Svt[info]: [asm level selected : up to neon_dotprod]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: -------------------------------------------
Svt[warn]: Preset M12 is mapped to M10.
Svt[info]: Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[info]: [asm level on system : up to neon_dotprod]
Svt[info]: [asm level selected : up to neon_dotprod]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: -------------------------------------------
[mp4 @ 0x3342a5470] Starting second pass: moving the moov atom to the beginning of the file
[mp4 @ 0x338a6af00] Starting second pass: moving the moov atom to the beginning of the file
[274] 17:37:20 saved {"ep": 10, "dur_s": 7.87, "num_episodes": 10}
INFO 2026-11-23 17:37:20 le_timer.py:570 Cadence (episode 9): 29.99 Hz vs 30 Hz target · 549 ticks, 18.3 s measured · 0/548 ticks over the 33.3 ms budget (work mean 16.9 ms, worst 20.5 ms)
INFO 2026-11-23 17:37:20 le_timer.py:617 Cadence summary — whole run, 14 episodes · target 30 Hz (33.3 ms budget per tick): 7204 ticks, 7190 judged
  effective cadence: 29.99 Hz over 239.8 s measured
  ticks over the 33.3 ms work budget: 1/7190 (0.0%) — work mean 16.8 ms, worst 44.4 ms
  ticks whose cadence slipped outside the loop body (sleep overshoot / CPU starvation while pacing): 2
  loop-body steps (share of measured work):
    observe      mean   1.19 ms · worst   5.47 ms ·   7.1% of work · 7204 calls
    process_obs  mean   0.02 ms · worst   0.60 ms ·   0.1% of work · 7204 calls
    teleop       mean   1.04 ms · worst   7.91 ms ·   6.2% of work · 7204 calls
    send         mean  14.46 ms · worst  42.02 ms ·  85.8% of work · 7204 calls
    record       mean   0.11 ms · worst   3.95 ms ·   0.6% of work · 7204 calls
  pacing headroom: 16.5 ms slept per tick on average (max 30.8 ms) — near zero means the loop is saturated
INFO 2026-11-23 17:37:20 ls/utils.py:151 Stop recording
[274] 17:37:23 lerobot_safe_window {"run": "step1_record", "title": "リーダーで休みの姿勢へ"}
[274] 17:37:23 rest_out_joints {"run": "step1_record", "out": {"wrist_flex": 41.84, "gripper": 22.19}}
[274] 17:37:25 rest_out_joints {"run": "step1_record", "out": {"wrist_flex": 41.84}}
[274] 17:37:34 rest_out_joints {"run": "step1_record", "out": {}}
INFO 2026-11-23 17:37:35 a_opencv.py:637 OpenCVCamera(1) disconnected.
INFO 2026-11-23 17:37:35 a_opencv.py:637 OpenCVCamera(0) disconnected.
INFO 2026-11-23 17:37:35 follower.py:221 ptm_follower SOFollower disconnected.
INFO 2026-11-23 17:37:35 o_leader.py:144 ptm_leader SOLeader disconnected.
INFO 2026-11-23 17:37:35 ls/utils.py:151 Exiting
[274] 17:37:35 run_end {"name": "step1_record", "exc": null, "ret": null, "torque_kept": false, "file": "/Users/shimazueiichi/r2r2r-scripts/so101/check_274/step1_record.json"}
[274] 17:37:35 screen {"title": "見た物で答える  y / n", "lines": ["10回とも, ブロックが箱に入った？", "", "はい = y     いいえ = n"]}
[274] 17:37:39 key {"title": "見た物で答える  y / n", "key": "n"}
[274] 17:37:39 screen {"title": "見た物で答える  番号", "lines": ["ブロックが箱に入らなかった回の番号は？", "1〜9 を押す (10回目は 0)・押し直すと外れる", "選んだ: なし", "", "決めたら Enter"]}
[274] 17:37:46 key {"title": "見た物で答える  番号", "key": "1"}
[274] 17:37:46 screen {"title": "見た物で答える  番号", "lines": ["ブロックが箱に入らなかった回の番号は？", "1〜9 を押す (10回目は 0)・押し直すと外れる", "選んだ: 1", "", "決めたら Enter"]}
[274] 17:37:53 key {"title": "見た物で答える  番号", "key": "2"}
[274] 17:37:53 screen {"title": "見た物で答える  番号", "lines": ["ブロックが箱に入らなかった回の番号は？", "1〜9 を押す (10回目は 0)・押し直すと外れる", "選んだ: 1 2", "", "決めたら Enter"]}
[274] 17:37:57 key {"title": "見た物で答える  番号", "key": "\r"}
[274] 17:37:57 screen {"title": "見た物で答える  y / n", "lines": ["録っている最中に, フォロワーが ガクッと飛んだ回は あった？", "(y = 飛んだ回があった / n = なかった)", "", "はい = y     いいえ = n"]}
[274] 17:38:00 key {"title": "見た物で答える  y / n", "key": "n"}
[274] 17:38:00 screen {"title": "2. replay (1回目を再生)", "lines": ["フォロワーのまわりを空ける", "ブロックを元の所に置く", "スペースで replay を始める (力が入る)", "終わると 休みの姿勢へ自動で戻る", "(止めたいとき: q)", "", "準備ができたら スペース"]}
[274] 17:38:18 key {"title": "2. replay (1回目を再生)", "key": " "}
[274] 17:38:18 run_start {"run": "step2_replay", "argv": ["replay", "--dataset.repo_id=local/so101_redblock_box_teleop_v1", "--dataset.root=/Users/shimazueiichi/so101_datasets/so101_redblock_box_teleop_v1", "--dataset.episode=0", "--dataset.fps=30"]}
INFO 2026-11-23 17:38:18 t_replay.py:108 {'dataset': {'episode': 0,
             'fps': 30,
             'repo_id': 'local/so101_redblock_box_teleop_v1',
             'root': '/Users/shimazueiichi/so101_datasets/so101_redblock_box_teleop_v1'},
 'play_sounds': True,
 'robot': {'calibration_dir': None,
           'cameras': {},
           'disable_torque_on_disconnect': True,
           'id': 'ptm_follower',
           'max_relative_target': None,
           'num_read_retries': 2,
           'port': '/dev/tty.usbmodem5CBC4321631',
           'position_d_coefficient': 32,
           'position_i_coefficient': 0,
           'position_p_coefficient': 16,
           'use_degrees': True}}
[274] 17:38:18 run_end {"name": "step2_replay", "exc": "GuardError(\"カメラは ['desk', 'wrist'] の2台だけ (今 [])\")", "torque_kept": false, "file": "/Users/shimazueiichi/r2r2r-scripts/so101/check_274/step2_replay.json"}
[274] 17:38:18 screen {"title": "支える → 電源を切る", "lines": ["フォロワーを手で支える", "フォロワーの電源を切る", "", "電源を切ったら スペース"]}
[274] 17:38:31 key {"title": "支える → 電源を切る", "key": " "}
[274] 17:38:31 end {}
```

#### events_274_record.jsonl

```json
{"t": 1795422284.1144269, "clock": "17:24:44", "kind": "start", "dry": false}
{"t": 1795422291.836514, "clock": "17:24:51", "kind": "read_servos", "follower": [[1, 1993, 0], [2, 898, 0], [3, 3025, 0], [4, 2320, 0], [5, 2145, 0], [6, 2061, 0]], "leader": [[1, 2098, 0], [2, 889, 0], [3, 3115, 0], [4, 2590, 0], [5, 2009, 0], [6, 2010, 0]], "ok": true}
{"t": 1795422291.851178, "clock": "17:24:51", "kind": "screen", "title": "0. 始める前", "lines": ["ブロックを机の決まった所に置く", "リーダーとフォロワーの姿勢を近づける", "フォロワーのまわりを空ける・電源をすぐ切れるようにする", "次のスペースで つなぐ (力が入る. まだ録らない)", "(止めたいとき: q キー = Ctrl-C)", "", "準備ができたら スペース"]}
{"t": 1795422435.910439, "clock": "17:27:15", "kind": "key", "title": "0. 始める前", "key": " "}
{"t": 1795422435.915701, "clock": "17:27:15", "kind": "run_start", "run": "step1_record", "argv": ["record", "--dataset.repo_id=local/so101_redblock_box_teleop_v1", "--dataset.root=/Users/shimazueiichi/so101_datasets/so101_redblock_box_teleop_v1", "--dataset.single_task=Put the red block into the white box", "--dataset.fps=30", "--dataset.num_episodes=10", "--dataset.episode_time_s=20", "--dataset.reset_time_s=3600", "--dataset.no_stamp=true"]}
{"t": 1795422444.775775, "clock": "17:27:24", "kind": "torque_on", "run": "step1_record", "max_diff_deg": {"shoulder_pan": 0.0, "shoulder_lift": 0.0, "elbow_flex": 0.0, "wrist_flex": 0.0, "wrist_roll": 0.0, "gripper": 0.0}}
{"t": 1795422444.7762828, "clock": "17:27:24", "kind": "keyboard_listener", "note": "pynput を使わない (手順のウィンドウで →・← を受ける)"}
{"t": 1795422444.811462, "clock": "17:27:24", "kind": "phase", "phase": "start", "ep": 1}
{"t": 1795422444.839173, "clock": "17:27:24", "kind": "screen", "title": "1回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
{"t": 1795422444.858892, "clock": "17:27:24", "kind": "key", "phase": "start", "ep": 1, "key": "space"}
{"t": 1795422444.878592, "clock": "17:27:24", "kind": "phase_end", "phase": "start", "ep": 1, "dur_s": 0.07}
{"t": 1795422444.878786, "clock": "17:27:24", "kind": "episode_start", "ep": 1, "try_": 1}
{"t": 1795422464.9039118, "clock": "17:27:44", "kind": "episode_end", "ep": 1, "try": 1, "dur_s": 20.02, "buffer_frames": 600, "end": "time", "label": "ep1_try1"}
{"t": 1795422464.940875, "clock": "17:27:44", "kind": "phase", "phase": "reset", "ep": 1}
{"t": 1795422464.9610171, "clock": "17:27:44", "kind": "screen", "title": "1回目 終わり", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで次へ", "うまくいかなかった回は ← で録り直す"]}
{"t": 1795422468.984086, "clock": "17:27:48", "kind": "key", "phase": "reset", "ep": 1, "key": "space", "rerecord": false}
{"t": 1795422469.0097659, "clock": "17:27:49", "kind": "phase_end", "phase": "reset", "ep": 1, "dur_s": 4.07}
{"t": 1795422478.864474, "clock": "17:27:58", "kind": "saved", "ep": 1, "dur_s": 9.83, "num_episodes": 1}
{"t": 1795422478.886749, "clock": "17:27:58", "kind": "phase", "phase": "start", "ep": 2}
{"t": 1795422478.907855, "clock": "17:27:58", "kind": "screen", "title": "2回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
{"t": 1795422485.66374, "clock": "17:28:05", "kind": "key", "phase": "start", "ep": 2, "key": "space"}
{"t": 1795422485.689882, "clock": "17:28:05", "kind": "phase_end", "phase": "start", "ep": 2, "dur_s": 6.8}
{"t": 1795422485.6900458, "clock": "17:28:05", "kind": "episode_start", "ep": 2, "try_": 1}
{"t": 1795422505.697781, "clock": "17:28:25", "kind": "episode_end", "ep": 2, "try": 1, "dur_s": 20.01, "buffer_frames": 600, "end": "time", "label": "ep2_try1"}
{"t": 1795422505.7198231, "clock": "17:28:25", "kind": "phase", "phase": "reset", "ep": 2}
{"t": 1795422505.7394161, "clock": "17:28:25", "kind": "screen", "title": "2回目 終わり", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで次へ", "うまくいかなかった回は ← で録り直す"]}
{"t": 1795422604.2972438, "clock": "17:30:04", "kind": "key", "phase": "reset", "ep": 2, "key": "space", "rerecord": false}
{"t": 1795422604.322426, "clock": "17:30:04", "kind": "phase_end", "phase": "reset", "ep": 2, "dur_s": 98.6}
{"t": 1795422613.7215848, "clock": "17:30:13", "kind": "saved", "ep": 2, "dur_s": 9.38, "num_episodes": 2}
{"t": 1795422613.741817, "clock": "17:30:13", "kind": "phase", "phase": "start", "ep": 3}
{"t": 1795422613.7624671, "clock": "17:30:13", "kind": "screen", "title": "3回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
{"t": 1795422642.794716, "clock": "17:30:42", "kind": "key", "phase": "start", "ep": 3, "key": "space"}
{"t": 1795422642.820629, "clock": "17:30:42", "kind": "phase_end", "phase": "start", "ep": 3, "dur_s": 29.08}
{"t": 1795422642.820925, "clock": "17:30:42", "kind": "episode_start", "ep": 3, "try_": 1}
{"t": 1795422645.0622442, "clock": "17:30:45", "kind": "key", "phase": "episode", "ep": 3, "key": "right"}
{"t": 1795422645.088743, "clock": "17:30:45", "kind": "episode_end", "ep": 3, "try": 1, "dur_s": 2.27, "buffer_frames": 68, "end": "right", "label": "ep3_try1"}
{"t": 1795422645.118697, "clock": "17:30:45", "kind": "phase", "phase": "reset", "ep": 3}
{"t": 1795422645.138464, "clock": "17:30:45", "kind": "screen", "title": "3回目 終わり", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで次へ", "うまくいかなかった回は ← で録り直す"]}
{"t": 1795422655.863153, "clock": "17:30:55", "kind": "key", "phase": "reset", "ep": 3, "key": "left"}
{"t": 1795422655.869378, "clock": "17:30:55", "kind": "screen", "title": "3回目 を録り直す", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで もう一度 3回目へ"]}
{"t": 1795422658.97017, "clock": "17:30:58", "kind": "key", "phase": "reset", "ep": 3, "key": "space", "rerecord": true}
{"t": 1795422658.991791, "clock": "17:30:58", "kind": "phase_end", "phase": "reset", "ep": 3, "dur_s": 13.87}
{"t": 1795422659.019116, "clock": "17:30:59", "kind": "discarded", "ep": 3}
{"t": 1795422659.046647, "clock": "17:30:59", "kind": "phase", "phase": "start", "ep": 3}
{"t": 1795422659.0723488, "clock": "17:30:59", "kind": "screen", "title": "3回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
{"t": 1795422666.525387, "clock": "17:31:06", "kind": "key", "phase": "start", "ep": 3, "key": "space"}
{"t": 1795422666.55039, "clock": "17:31:06", "kind": "phase_end", "phase": "start", "ep": 3, "dur_s": 7.5}
{"t": 1795422666.5506098, "clock": "17:31:06", "kind": "episode_start", "ep": 3, "try_": 2}
{"t": 1795422684.893991, "clock": "17:31:24", "kind": "key", "phase": "episode", "ep": 3, "key": "right"}
{"t": 1795422684.924976, "clock": "17:31:24", "kind": "episode_end", "ep": 3, "try": 2, "dur_s": 18.37, "buffer_frames": 551, "end": "right", "label": "ep3_try2"}
{"t": 1795422684.960632, "clock": "17:31:24", "kind": "phase", "phase": "reset", "ep": 3}
{"t": 1795422684.9807758, "clock": "17:31:24", "kind": "screen", "title": "3回目 終わり", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで次へ", "うまくいかなかった回は ← で録り直す"]}
{"t": 1795422694.706188, "clock": "17:31:34", "kind": "key", "phase": "reset", "ep": 3, "key": "space", "rerecord": false}
{"t": 1795422694.732307, "clock": "17:31:34", "kind": "phase_end", "phase": "reset", "ep": 3, "dur_s": 9.77}
{"t": 1795422703.845553, "clock": "17:31:43", "kind": "saved", "ep": 3, "dur_s": 9.09, "num_episodes": 3}
{"t": 1795422703.863379, "clock": "17:31:43", "kind": "phase", "phase": "start", "ep": 4}
{"t": 1795422703.883771, "clock": "17:31:43", "kind": "screen", "title": "4回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
{"t": 1795422707.206004, "clock": "17:31:47", "kind": "key", "phase": "start", "ep": 4, "key": "space"}
{"t": 1795422707.231922, "clock": "17:31:47", "kind": "phase_end", "phase": "start", "ep": 4, "dur_s": 3.37}
{"t": 1795422707.232217, "clock": "17:31:47", "kind": "episode_start", "ep": 4, "try_": 1}
{"t": 1795422723.774793, "clock": "17:32:03", "kind": "key", "phase": "episode", "ep": 4, "key": "left"}
{"t": 1795422723.805771, "clock": "17:32:03", "kind": "episode_end", "ep": 4, "try": 1, "dur_s": 16.57, "buffer_frames": 497, "end": "left", "label": "ep4_try1"}
{"t": 1795422723.8278332, "clock": "17:32:03", "kind": "phase", "phase": "reset", "ep": 4}
{"t": 1795422723.847255, "clock": "17:32:03", "kind": "screen", "title": "4回目 を録り直す", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで もう一度 4回目へ"]}
{"t": 1795422731.738731, "clock": "17:32:11", "kind": "key", "phase": "reset", "ep": 4, "key": "space", "rerecord": true}
{"t": 1795422731.7648299, "clock": "17:32:11", "kind": "phase_end", "phase": "reset", "ep": 4, "dur_s": 7.94}
{"t": 1795422731.787412, "clock": "17:32:11", "kind": "discarded", "ep": 4}
{"t": 1795422731.878209, "clock": "17:32:11", "kind": "phase", "phase": "start", "ep": 4}
{"t": 1795422731.904903, "clock": "17:32:11", "kind": "screen", "title": "4回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
{"t": 1795422734.653653, "clock": "17:32:14", "kind": "key", "phase": "start", "ep": 4, "key": "space"}
{"t": 1795422734.6799371, "clock": "17:32:14", "kind": "phase_end", "phase": "start", "ep": 4, "dur_s": 2.8}
{"t": 1795422734.6802392, "clock": "17:32:14", "kind": "episode_start", "ep": 4, "try_": 2}
{"t": 1795422754.688595, "clock": "17:32:34", "kind": "episode_end", "ep": 4, "try": 2, "dur_s": 20.01, "buffer_frames": 600, "end": "time", "label": "ep4_try2"}
{"t": 1795422754.718891, "clock": "17:32:34", "kind": "phase", "phase": "reset", "ep": 4}
{"t": 1795422754.743895, "clock": "17:32:34", "kind": "screen", "title": "4回目 終わり", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで次へ", "うまくいかなかった回は ← で録り直す"]}
{"t": 1795422763.863619, "clock": "17:32:43", "kind": "key", "phase": "reset", "ep": 4, "key": "space", "rerecord": false}
{"t": 1795422763.88996, "clock": "17:32:43", "kind": "phase_end", "phase": "reset", "ep": 4, "dur_s": 9.17}
{"t": 1795422773.39057, "clock": "17:32:53", "kind": "saved", "ep": 4, "dur_s": 9.48, "num_episodes": 4}
{"t": 1795422773.412143, "clock": "17:32:53", "kind": "phase", "phase": "start", "ep": 5}
{"t": 1795422773.4320629, "clock": "17:32:53", "kind": "screen", "title": "5回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
{"t": 1795422776.321079, "clock": "17:32:56", "kind": "key", "phase": "start", "ep": 5, "key": "space"}
{"t": 1795422776.347146, "clock": "17:32:56", "kind": "phase_end", "phase": "start", "ep": 5, "dur_s": 2.93}
{"t": 1795422776.347445, "clock": "17:32:56", "kind": "episode_start", "ep": 5, "try_": 1}
{"t": 1795422794.724333, "clock": "17:33:14", "kind": "key", "phase": "episode", "ep": 5, "key": "right"}
{"t": 1795422794.75527, "clock": "17:33:14", "kind": "episode_end", "ep": 5, "try": 1, "dur_s": 18.41, "buffer_frames": 552, "end": "right", "label": "ep5_try1"}
{"t": 1795422794.7832131, "clock": "17:33:14", "kind": "phase", "phase": "reset", "ep": 5}
{"t": 1795422794.807261, "clock": "17:33:14", "kind": "screen", "title": "5回目 終わり", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで次へ", "うまくいかなかった回は ← で録り直す"]}
{"t": 1795422800.060533, "clock": "17:33:20", "kind": "key", "phase": "reset", "ep": 5, "key": "space", "rerecord": false}
{"t": 1795422800.086424, "clock": "17:33:20", "kind": "phase_end", "phase": "reset", "ep": 5, "dur_s": 5.3}
{"t": 1795422809.187478, "clock": "17:33:29", "kind": "saved", "ep": 5, "dur_s": 9.08, "num_episodes": 5}
{"t": 1795422809.207111, "clock": "17:33:29", "kind": "phase", "phase": "start", "ep": 6}
{"t": 1795422809.227124, "clock": "17:33:29", "kind": "screen", "title": "6回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
{"t": 1795422811.582536, "clock": "17:33:31", "kind": "key", "phase": "start", "ep": 6, "key": "space"}
{"t": 1795422811.608541, "clock": "17:33:31", "kind": "phase_end", "phase": "start", "ep": 6, "dur_s": 2.4}
{"t": 1795422811.6087801, "clock": "17:33:31", "kind": "episode_start", "ep": 6, "try_": 1}
{"t": 1795422826.150719, "clock": "17:33:46", "kind": "key", "phase": "episode", "ep": 6, "key": "left"}
{"t": 1795422826.181718, "clock": "17:33:46", "kind": "episode_end", "ep": 6, "try": 1, "dur_s": 14.57, "buffer_frames": 437, "end": "left", "label": "ep6_try1"}
{"t": 1795422826.2123368, "clock": "17:33:46", "kind": "phase", "phase": "reset", "ep": 6}
{"t": 1795422826.231591, "clock": "17:33:46", "kind": "screen", "title": "6回目 を録り直す", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで もう一度 6回目へ"]}
{"t": 1795422833.0899682, "clock": "17:33:53", "kind": "key", "phase": "reset", "ep": 6, "key": "space", "rerecord": true}
{"t": 1795422833.1158788, "clock": "17:33:53", "kind": "phase_end", "phase": "reset", "ep": 6, "dur_s": 6.9}
{"t": 1795422833.141421, "clock": "17:33:53", "kind": "discarded", "ep": 6}
{"t": 1795422833.222226, "clock": "17:33:53", "kind": "phase", "phase": "start", "ep": 6}
{"t": 1795422833.249473, "clock": "17:33:53", "kind": "screen", "title": "6回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
{"t": 1795422834.530831, "clock": "17:33:54", "kind": "key", "phase": "start", "ep": 6, "key": "space"}
{"t": 1795422834.557157, "clock": "17:33:54", "kind": "phase_end", "phase": "start", "ep": 6, "dur_s": 1.33}
{"t": 1795422834.55743, "clock": "17:33:54", "kind": "episode_start", "ep": 6, "try_": 2}
{"t": 1795422854.568259, "clock": "17:34:14", "kind": "episode_end", "ep": 6, "try": 2, "dur_s": 20.01, "buffer_frames": 600, "end": "time", "label": "ep6_try2"}
{"t": 1795422854.6047769, "clock": "17:34:14", "kind": "phase", "phase": "reset", "ep": 6}
{"t": 1795422854.629549, "clock": "17:34:14", "kind": "screen", "title": "6回目 終わり", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで次へ", "うまくいかなかった回は ← で録り直す"]}
{"t": 1795422860.0817962, "clock": "17:34:20", "kind": "key", "phase": "reset", "ep": 6, "key": "left"}
{"t": 1795422860.085738, "clock": "17:34:20", "kind": "screen", "title": "6回目 を録り直す", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで もう一度 6回目へ"]}
{"t": 1795422866.385189, "clock": "17:34:26", "kind": "key", "phase": "reset", "ep": 6, "key": "space", "rerecord": true}
{"t": 1795422866.411767, "clock": "17:34:26", "kind": "phase_end", "phase": "reset", "ep": 6, "dur_s": 11.81}
{"t": 1795422866.432152, "clock": "17:34:26", "kind": "discarded", "ep": 6}
{"t": 1795422866.52876, "clock": "17:34:26", "kind": "phase", "phase": "start", "ep": 6}
{"t": 1795422866.5567281, "clock": "17:34:26", "kind": "screen", "title": "6回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
{"t": 1795422868.303943, "clock": "17:34:28", "kind": "key", "phase": "start", "ep": 6, "key": "space"}
{"t": 1795422868.330036, "clock": "17:34:28", "kind": "phase_end", "phase": "start", "ep": 6, "dur_s": 1.8}
{"t": 1795422868.330325, "clock": "17:34:28", "kind": "episode_start", "ep": 6, "try_": 3}
{"t": 1795422888.172068, "clock": "17:34:48", "kind": "key", "phase": "episode", "ep": 6, "key": "right"}
{"t": 1795422888.203122, "clock": "17:34:48", "kind": "episode_end", "ep": 6, "try": 3, "dur_s": 19.87, "buffer_frames": 596, "end": "time", "label": "ep6_try3"}
{"t": 1795422888.2248588, "clock": "17:34:48", "kind": "phase", "phase": "reset", "ep": 6}
{"t": 1795422888.2444, "clock": "17:34:48", "kind": "screen", "title": "6回目 終わり", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで次へ", "うまくいかなかった回は ← で録り直す"]}
{"t": 1795422892.133418, "clock": "17:34:52", "kind": "key", "phase": "reset", "ep": 6, "key": "space", "rerecord": false}
{"t": 1795422892.159626, "clock": "17:34:52", "kind": "phase_end", "phase": "reset", "ep": 6, "dur_s": 3.93}
{"t": 1795422901.057605, "clock": "17:35:01", "kind": "saved", "ep": 6, "dur_s": 8.88, "num_episodes": 6}
{"t": 1795422901.080917, "clock": "17:35:01", "kind": "phase", "phase": "start", "ep": 7}
{"t": 1795422901.1016169, "clock": "17:35:01", "kind": "screen", "title": "7回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
{"t": 1795422902.8897889, "clock": "17:35:02", "kind": "key", "phase": "start", "ep": 7, "key": "space"}
{"t": 1795422902.9154959, "clock": "17:35:02", "kind": "phase_end", "phase": "start", "ep": 7, "dur_s": 1.83}
{"t": 1795422902.915817, "clock": "17:35:02", "kind": "episode_start", "ep": 7, "try_": 1}
{"t": 1795422922.9227881, "clock": "17:35:22", "kind": "episode_end", "ep": 7, "try": 1, "dur_s": 20.01, "buffer_frames": 600, "end": "time", "label": "ep7_try1"}
{"t": 1795422922.943997, "clock": "17:35:22", "kind": "phase", "phase": "reset", "ep": 7}
{"t": 1795422922.962954, "clock": "17:35:22", "kind": "screen", "title": "7回目 終わり", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで次へ", "うまくいかなかった回は ← で録り直す"]}
{"t": 1795422928.685809, "clock": "17:35:28", "kind": "key", "phase": "reset", "ep": 7, "key": "space", "rerecord": false}
{"t": 1795422928.7125509, "clock": "17:35:28", "kind": "phase_end", "phase": "reset", "ep": 7, "dur_s": 5.77}
{"t": 1795422936.981577, "clock": "17:35:36", "kind": "saved", "ep": 7, "dur_s": 8.25, "num_episodes": 7}
{"t": 1795422937.002826, "clock": "17:35:37", "kind": "phase", "phase": "start", "ep": 8}
{"t": 1795422937.0237849, "clock": "17:35:37", "kind": "screen", "title": "8回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
{"t": 1795422939.6126919, "clock": "17:35:39", "kind": "key", "phase": "start", "ep": 8, "key": "space"}
{"t": 1795422939.638151, "clock": "17:35:39", "kind": "phase_end", "phase": "start", "ep": 8, "dur_s": 2.63}
{"t": 1795422939.638434, "clock": "17:35:39", "kind": "episode_start", "ep": 8, "try_": 1}
{"t": 1795422954.3163898, "clock": "17:35:54", "kind": "key", "phase": "episode", "ep": 8, "key": "right"}
{"t": 1795422954.34331, "clock": "17:35:54", "kind": "episode_end", "ep": 8, "try": 1, "dur_s": 14.7, "buffer_frames": 441, "end": "right", "label": "ep8_try1"}
{"t": 1795422954.364615, "clock": "17:35:54", "kind": "phase", "phase": "reset", "ep": 8}
{"t": 1795422954.383965, "clock": "17:35:54", "kind": "screen", "title": "8回目 終わり", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで次へ", "うまくいかなかった回は ← で録り直す"]}
{"t": 1795422959.9063811, "clock": "17:35:59", "kind": "key", "phase": "reset", "ep": 8, "key": "space", "rerecord": false}
{"t": 1795422959.933034, "clock": "17:35:59", "kind": "phase_end", "phase": "reset", "ep": 8, "dur_s": 5.57}
{"t": 1795422966.8909929, "clock": "17:36:06", "kind": "saved", "ep": 8, "dur_s": 6.94, "num_episodes": 8}
{"t": 1795422966.912622, "clock": "17:36:06", "kind": "phase", "phase": "start", "ep": 9}
{"t": 1795422966.9340851, "clock": "17:36:06", "kind": "screen", "title": "9回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
{"t": 1795422969.321425, "clock": "17:36:09", "kind": "key", "phase": "start", "ep": 9, "key": "space"}
{"t": 1795422969.34758, "clock": "17:36:09", "kind": "phase_end", "phase": "start", "ep": 9, "dur_s": 2.43}
{"t": 1795422969.347898, "clock": "17:36:09", "kind": "episode_start", "ep": 9, "try_": 1}
{"t": 1795422986.427307, "clock": "17:36:26", "kind": "key", "phase": "episode", "ep": 9, "key": "right"}
{"t": 1795422986.454209, "clock": "17:36:26", "kind": "episode_end", "ep": 9, "try": 1, "dur_s": 17.11, "buffer_frames": 513, "end": "right", "label": "ep9_try1"}
{"t": 1795422986.474833, "clock": "17:36:26", "kind": "phase", "phase": "reset", "ep": 9}
{"t": 1795422986.4949389, "clock": "17:36:26", "kind": "screen", "title": "9回目 終わり", "lines": ["ブロックを元の所に置き直して", "腕を休みの姿勢へ", "スペースで次へ", "うまくいかなかった回は ← で録り直す"]}
{"t": 1795422991.8166158, "clock": "17:36:31", "kind": "key", "phase": "reset", "ep": 9, "key": "space", "rerecord": false}
{"t": 1795422991.843233, "clock": "17:36:31", "kind": "phase_end", "phase": "reset", "ep": 9, "dur_s": 5.37}
{"t": 1795422999.423676, "clock": "17:36:39", "kind": "saved", "ep": 9, "dur_s": 7.56, "num_episodes": 9}
{"t": 1795422999.4448798, "clock": "17:36:39", "kind": "phase", "phase": "start", "ep": 10}
{"t": 1795422999.466337, "clock": "17:36:39", "kind": "screen", "title": "10回目／10　スペースで始める", "lines": ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける", "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える", "(止めたいとき: q)"]}
{"t": 1795423005.555467, "clock": "17:36:45", "kind": "key", "phase": "start", "ep": 10, "key": "space"}
{"t": 1795423005.581585, "clock": "17:36:45", "kind": "phase_end", "phase": "start", "ep": 10, "dur_s": 6.14}
{"t": 1795423005.581813, "clock": "17:36:45", "kind": "episode_start", "ep": 10, "try_": 1}
{"t": 1795423023.8638542, "clock": "17:37:03", "kind": "key", "phase": "episode", "ep": 10, "key": "right"}
{"t": 1795423023.8901398, "clock": "17:37:03", "kind": "episode_end", "ep": 10, "try": 1, "dur_s": 18.31, "buffer_frames": 549, "end": "right", "label": "ep10_try1"}
{"t": 1795423023.890444, "clock": "17:37:03", "kind": "phase", "phase": "end", "ep": 10}
{"t": 1795423023.911833, "clock": "17:37:03", "kind": "screen", "title": "10回目 終わり (これで10回)", "lines": ["リーダーで 爪を閉じる", "腕を机の上まで下ろして たたむ (休みの姿勢)", "たたんだら スペース (保存して 力が抜ける)", "幅の外だと 赤い字で関節名が出る → そこを戻す", "うまくいかなかったら ← で録り直す"]}
{"t": 1795423032.401883, "clock": "17:37:12", "kind": "key", "phase": "end", "ep": 10, "key": "space"}
{"t": 1795423032.4277172, "clock": "17:37:12", "kind": "phase_end", "phase": "end", "ep": 10, "dur_s": 8.54}
{"t": 1795423040.318768, "clock": "17:37:20", "kind": "saved", "ep": 10, "dur_s": 7.87, "num_episodes": 10}
{"t": 1795423043.292864, "clock": "17:37:23", "kind": "lerobot_safe_window", "run": "step1_record", "title": "リーダーで休みの姿勢へ"}
{"t": 1795423043.301215, "clock": "17:37:23", "kind": "rest_out_joints", "run": "step1_record", "out": {"wrist_flex": 41.84, "gripper": 22.19}}
{"t": 1795423045.87056, "clock": "17:37:25", "kind": "rest_out_joints", "run": "step1_record", "out": {"wrist_flex": 41.84}}
{"t": 1795423054.3705778, "clock": "17:37:34", "kind": "rest_out_joints", "run": "step1_record", "out": {}}
{"t": 1795423055.659625, "clock": "17:37:35", "kind": "run_end", "name": "step1_record", "exc": null, "ret": null, "torque_kept": false, "file": "/Users/shimazueiichi/r2r2r-scripts/so101/check_274/step1_record.json"}
{"t": 1795423055.689112, "clock": "17:37:35", "kind": "screen", "title": "見た物で答える  y / n", "lines": ["10回とも, ブロックが箱に入った？", "", "はい = y     いいえ = n"]}
{"t": 1795423059.755264, "clock": "17:37:39", "kind": "key", "title": "見た物で答える  y / n", "key": "n"}
{"t": 1795423059.7606, "clock": "17:37:39", "kind": "screen", "title": "見た物で答える  番号", "lines": ["ブロックが箱に入らなかった回の番号は？", "1〜9 を押す (10回目は 0)・押し直すと外れる", "選んだ: なし", "", "決めたら Enter"]}
{"t": 1795423066.230402, "clock": "17:37:46", "kind": "key", "title": "見た物で答える  番号", "key": "1"}
{"t": 1795423066.235887, "clock": "17:37:46", "kind": "screen", "title": "見た物で答える  番号", "lines": ["ブロックが箱に入らなかった回の番号は？", "1〜9 を押す (10回目は 0)・押し直すと外れる", "選んだ: 1", "", "決めたら Enter"]}
{"t": 1795423073.439614, "clock": "17:37:53", "kind": "key", "title": "見た物で答える  番号", "key": "2"}
{"t": 1795423073.4445472, "clock": "17:37:53", "kind": "screen", "title": "見た物で答える  番号", "lines": ["ブロックが箱に入らなかった回の番号は？", "1〜9 を押す (10回目は 0)・押し直すと外れる", "選んだ: 1 2", "", "決めたら Enter"]}
{"t": 1795423077.5335948, "clock": "17:37:57", "kind": "key", "title": "見た物で答える  番号", "key": "\r"}
{"t": 1795423077.538049, "clock": "17:37:57", "kind": "screen", "title": "見た物で答える  y / n", "lines": ["録っている最中に, フォロワーが ガクッと飛んだ回は あった？", "(y = 飛んだ回があった / n = なかった)", "", "はい = y     いいえ = n"]}
{"t": 1795423080.780808, "clock": "17:38:00", "kind": "key", "title": "見た物で答える  y / n", "key": "n"}
{"t": 1795423080.803531, "clock": "17:38:00", "kind": "screen", "title": "2. replay (1回目を再生)", "lines": ["フォロワーのまわりを空ける", "ブロックを元の所に置く", "スペースで replay を始める (力が入る)", "終わると 休みの姿勢へ自動で戻る", "(止めたいとき: q)", "", "準備ができたら スペース"]}
{"t": 1795423098.3392289, "clock": "17:38:18", "kind": "key", "title": "2. replay (1回目を再生)", "key": " "}
{"t": 1795423098.3395321, "clock": "17:38:18", "kind": "run_start", "run": "step2_replay", "argv": ["replay", "--dataset.repo_id=local/so101_redblock_box_teleop_v1", "--dataset.root=/Users/shimazueiichi/so101_datasets/so101_redblock_box_teleop_v1", "--dataset.episode=0", "--dataset.fps=30"]}
{"t": 1795423098.4604642, "clock": "17:38:18", "kind": "run_end", "name": "step2_replay", "exc": "GuardError(\"カメラは ['desk', 'wrist'] の2台だけ (今 [])\")", "torque_kept": false, "file": "/Users/shimazueiichi/r2r2r-scripts/so101/check_274/step2_replay.json"}
{"t": 1795423098.464146, "clock": "17:38:18", "kind": "screen", "title": "支える → 電源を切る", "lines": ["フォロワーを手で支える", "フォロワーの電源を切る", "", "電源を切ったら スペース"]}
{"t": 1795423111.886512, "clock": "17:38:31", "kind": "key", "title": "支える → 電源を切る", "key": " "}
{"t": 1795423111.88724, "clock": "17:38:31", "kind": "end"}
```

#### results_274_record.json

```json
{
 "0": {
  "torque_zero": true,
  "follower": [
   [
    1,
    1993,
    0
   ],
   [
    2,
    898,
    0
   ],
   [
    3,
    3025,
    0
   ],
   [
    4,
    2320,
    0
   ],
   [
    5,
    2145,
    0
   ],
   [
    6,
    2061,
    0
   ]
  ]
 },
 "1": {
  "run": {
   "name": "step1_record",
   "exc": null,
   "ret": null,
   "torque_kept": false,
   "file": "/Users/shimazueiichi/r2r2r-scripts/so101/check_274/step1_record.json"
  },
  "attempts": [
   {
    "ep": 1,
    "try": 1,
    "dur_s": 20.02,
    "buffer_frames": 600,
    "end": "time",
    "label": "ep1_try1",
    "saved_as": 0,
    "frames": 600,
    "cut_frames": 0,
    "cut_examples": [],
    "hz": 29.91,
    "leader_step_max": {
     "shoulder_pan": 1.32,
     "shoulder_lift": 4.57,
     "elbow_flex": 3.17,
     "wrist_flex": 3.7,
     "wrist_roll": 1.49,
     "gripper": 3.94
    }
   },
   {
    "ep": 2,
    "try": 1,
    "dur_s": 20.01,
    "buffer_frames": 600,
    "end": "time",
    "label": "ep2_try1",
    "saved_as": 1,
    "frames": 600,
    "cut_frames": 0,
    "cut_examples": [],
    "hz": 29.95,
    "leader_step_max": {
     "shoulder_pan": 0.97,
     "shoulder_lift": 3.52,
     "elbow_flex": 2.64,
     "wrist_flex": 1.59,
     "wrist_roll": 2.46,
     "gripper": 1.89
    }
   },
   {
    "ep": 3,
    "try": 1,
    "dur_s": 2.27,
    "buffer_frames": 68,
    "end": "right",
    "label": "ep3_try1",
    "saved_as": null,
    "frames": 68,
    "cut_frames": 0,
    "cut_examples": [],
    "hz": 29.58,
    "leader_step_max": {
     "shoulder_pan": 0.0,
     "shoulder_lift": 0.0,
     "elbow_flex": 0.0,
     "wrist_flex": 0.0,
     "wrist_roll": 0.0,
     "gripper": 0.0
    }
   },
   {
    "ep": 3,
    "try": 2,
    "dur_s": 18.37,
    "buffer_frames": 551,
    "end": "right",
    "label": "ep3_try2",
    "saved_as": 2,
    "frames": 551,
    "cut_frames": 0,
    "cut_examples": [],
    "hz": 29.93,
    "leader_step_max": {
     "shoulder_pan": 1.85,
     "shoulder_lift": 3.52,
     "elbow_flex": 2.82,
     "wrist_flex": 4.13,
     "wrist_roll": 2.37,
     "gripper": 4.94
    }
   },
   {
    "ep": 4,
    "try": 1,
    "dur_s": 16.57,
    "buffer_frames": 497,
    "end": "left",
    "label": "ep4_try1",
    "saved_as": null,
    "frames": 497,
    "cut_frames": 0,
    "cut_examples": [],
    "hz": 29.95,
    "leader_step_max": {
     "shoulder_pan": 1.32,
     "shoulder_lift": 3.6,
     "elbow_flex": 3.34,
     "wrist_flex": 2.98,
     "wrist_roll": 1.49,
     "gripper": 5.51
    }
   },
   {
    "ep": 4,
    "try": 2,
    "dur_s": 20.01,
    "buffer_frames": 600,
    "end": "time",
    "label": "ep4_try2",
    "saved_as": 3,
    "frames": 600,
    "cut_frames": 0,
    "cut_examples": [],
    "hz": 29.94,
    "leader_step_max": {
     "shoulder_pan": 2.9,
     "shoulder_lift": 4.22,
     "elbow_flex": 3.25,
     "wrist_flex": 2.55,
     "wrist_roll": 1.76,
     "gripper": 4.35
    }
   },
   {
    "ep": 5,
    "try": 1,
    "dur_s": 18.41,
    "buffer_frames": 552,
    "end": "right",
    "label": "ep5_try1",
    "saved_as": 4,
    "frames": 552,
    "cut_frames": 0,
    "cut_examples": [],
    "hz": 29.94,
    "leader_step_max": {
     "shoulder_pan": 1.85,
     "shoulder_lift": 3.78,
     "elbow_flex": 3.87,
     "wrist_flex": 2.2,
     "wrist_roll": 2.37,
     "gripper": 6.0
    }
   },
   {
    "ep": 6,
    "try": 1,
    "dur_s": 14.57,
    "buffer_frames": 437,
    "end": "left",
    "label": "ep6_try1",
    "saved_as": null,
    "frames": 437,
    "cut_frames": 0,
    "cut_examples": [],
    "hz": 29.92,
    "leader_step_max": {
     "shoulder_pan": 1.5,
     "shoulder_lift": 3.86,
     "elbow_flex": 4.04,
     "wrist_flex": 2.55,
     "wrist_roll": 2.02,
     "gripper": 3.46
    }
   },
   {
    "ep": 6,
    "try": 2,
    "dur_s": 20.01,
    "buffer_frames": 600,
    "end": "time",
    "label": "ep6_try2",
    "saved_as": null,
    "frames": 600,
    "cut_frames": 0,
    "cut_examples": [],
    "hz": 29.93,
    "leader_step_max": {
     "shoulder_pan": 1.94,
     "shoulder_lift": 3.51,
     "elbow_flex": 2.55,
     "wrist_flex": 2.82,
     "wrist_roll": 1.58,
     "gripper": 3.7
    }
   },
   {
    "ep": 6,
    "try": 3,
    "dur_s": 19.87,
    "buffer_frames": 596,
    "end": "time",
    "label": "ep6_try3",
    "saved_as": 5,
    "frames": 596,
    "cut_frames": 0,
    "cut_examples": [],
    "hz": 29.96,
    "leader_step_max": {
     "shoulder_pan": 1.94,
     "shoulder_lift": 4.48,
     "elbow_flex": 3.61,
     "wrist_flex": 2.38,
     "wrist_roll": 2.02,
     "gripper": 4.93
    }
   },
   {
    "ep": 7,
    "try": 1,
    "dur_s": 20.01,
    "buffer_frames": 600,
    "end": "time",
    "label": "ep7_try1",
    "saved_as": 6,
    "frames": 600,
    "cut_frames": 0,
    "cut_examples": [],
    "hz": 29.96,
    "leader_step_max": {
     "shoulder_pan": 2.99,
     "shoulder_lift": 4.31,
     "elbow_flex": 3.17,
     "wrist_flex": 2.38,
     "wrist_roll": 1.76,
     "gripper": 4.68
    }
   },
   {
    "ep": 8,
    "try": 1,
    "dur_s": 14.7,
    "buffer_frames": 441,
    "end": "right",
    "label": "ep8_try1",
    "saved_as": 7,
    "frames": 441,
    "cut_frames": 0,
    "cut_examples": [],
    "hz": 29.95,
    "leader_step_max": {
     "shoulder_pan": 1.49,
     "shoulder_lift": 4.4,
     "elbow_flex": 3.17,
     "wrist_flex": 2.11,
     "wrist_roll": 1.94,
     "gripper": 5.01
    }
   },
   {
    "ep": 9,
    "try": 1,
    "dur_s": 17.11,
    "buffer_frames": 513,
    "end": "right",
    "label": "ep9_try1",
    "saved_as": 8,
    "frames": 513,
    "cut_frames": 0,
    "cut_examples": [],
    "hz": 29.95,
    "leader_step_max": {
     "shoulder_pan": 3.95,
     "shoulder_lift": 4.83,
     "elbow_flex": 4.22,
     "wrist_flex": 2.9,
     "wrist_roll": 1.32,
     "gripper": 5.18
    }
   },
   {
    "ep": 10,
    "try": 1,
    "dur_s": 18.31,
    "buffer_frames": 549,
    "end": "right",
    "label": "ep10_try1",
    "saved_as": 9,
    "frames": 549,
    "cut_frames": 0,
    "cut_examples": [],
    "hz": 29.99,
    "leader_step_max": {
     "shoulder_pan": 1.93,
     "shoulder_lift": 4.22,
     "elbow_flex": 4.66,
     "wrist_flex": 3.17,
     "wrist_roll": 1.58,
     "gripper": 4.19
    }
   }
  ],
  "cut_frames_by_label": {
   "start": 1,
   "start_wait": 1,
   "reset": 3
  },
  "gate": [
   {
    "what": "rest_gate_start",
    "t": 607.3385700409999,
    "leader": true
   },
   {
    "what": "rest_gate_end",
    "t": 618.9410774999997,
    "result": "leader",
    "dur_s": 11.6
   }
  ],
  "rest_wait_s": 11.6,
  "rest_wait_each_s": [
   [
    "leader",
    11.6
   ]
  ],
  "torque_on": [
   {
    "shoulder_pan": 0.0,
    "shoulder_lift": 0.0,
    "elbow_flex": 0.0,
    "wrist_flex": 0.0,
    "wrist_roll": 0.0,
    "gripper": 0.0
   }
  ],
  "cut_frames_gate": 0,
  "yn_all_in_box": false,
  "not_in_box": [
   1,
   2
  ],
  "yn_jump": false
 },
 "2": {
  "run": {
   "name": "step2_replay",
   "exc": "GuardError(\"カメラは ['desk', 'wrist'] の2台だけ (今 [])\")",
   "torque_kept": false,
   "file": "/Users/shimazueiichi/r2r2r-scripts/so101/check_274/step2_replay.json"
  },
  "replay": {
   "frames": 0,
   "cut_frames": 0,
   "cut_examples": []
  },
  "gate": [],
  "rest_wait_s": null,
  "rest_wait_each_s": [],
  "torque_on": [],
  "cut_frames_gate": 0
 }
}
```


## 作業ログ ― 1回目と3回目を再生した（依頼274・276）

### record と同じプロセスで replay を呼ぶと、カメラの確かめで止まった

10回を録ったあと、同じプロセスのまま replay を呼ぶと、飛び止めの入口が「カメラは desk と wrist の2台だけ（今は0台）」と言って止めた。record で渡したカメラの設定が残っていたためで、力は入れていない。replay だけを新しいプロセスで動かす `--replay-only` を足し、1回目（index 0）を再生した。

#### step2_replay_fail_inprocess.json

```json
{
 "name": "step2_replay",
 "frames": [],
 "obs": [],
 "a_reads": [],
 "torque_on": [],
 "gate": [],
 "big_text": [],
 "rest_checks": [],
 "torque_kept": false,
 "in_gate": false,
 "label": "start",
 "t0": 175603.882531041,
 "stop_sent": false
}
```

#### run_274_stdout_replay.log

```text
[274] 17:38:55 start {"dry": false}
[274] 17:38:56 screen {"title": "replay の前", "lines": ["フォロワーの電源が入っていることを確かめる", "フォロワーのまわりを空ける", "", "準備ができたら スペース"]}
[274] 17:39:42 key {"title": "replay の前", "key": " "}
[274] 17:39:44 read_servos {"follower": [[1, 2058, 0], [2, 861, 0], [3, 3024, 0], [4, 2300, 0], [5, 2065, 0], [6, 2082, 0]], "leader": [[1, 2118, 0], [2, 823, 0], [3, 3110, 0], [4, 2678, 0], [5, 2070, 0], [6, 2024, 0]], "ok": true}
[274] 17:39:44 screen {"title": "2. replay (1回目を再生)", "lines": ["フォロワーのまわりを空ける", "ブロックを元の所に置く", "スペースで replay を始める (力が入る)", "終わると 休みの姿勢へ自動で戻る", "(止めたいとき: q)", "", "準備ができたら スペース"]}
[274] 17:39:47 key {"title": "2. replay (1回目を再生)", "key": " "}
[274] 17:39:47 run_start {"run": "step2_replay", "argv": ["replay", "--dataset.repo_id=local/so101_redblock_box_teleop_v1", "--dataset.root=/Users/shimazueiichi/so101_datasets/so101_redblock_box_teleop_v1", "--dataset.episode=0", "--dataset.fps=30"]}
objc[32850]: Class AVFFrameReceiver is implemented in both /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/cv2/.dylibs/libavdevice.61.3.100.dylib (0x103a5c3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x153f283a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[32850]: Class AVFAudioReceiver is implemented in both /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/cv2/.dylibs/libavdevice.61.3.100.dylib (0x103a5c3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x153f283f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
INFO 2026-11-23 17:39:49 t_replay.py:108 {'dataset': {'episode': 0,
             'fps': 30,
             'repo_id': 'local/so101_redblock_box_teleop_v1',
             'root': '/Users/shimazueiichi/so101_datasets/so101_redblock_box_teleop_v1'},
 'play_sounds': True,
 'robot': {'calibration_dir': None,
           'cameras': {},
           'disable_torque_on_disconnect': True,
           'id': 'ptm_follower',
           'max_relative_target': None,
           'num_read_retries': 2,
           'port': '/dev/tty.usbmodem5CBC4321631',
           'position_d_coefficient': 32,
           'position_i_coefficient': 0,
           'position_p_coefficient': 16,
           'use_degrees': True}}
objc[32850]: Class AVFFrameReceiver is implemented in both /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/cv2/.dylibs/libavdevice.61.3.100.dylib (0x103a5c3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x166340778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[32850]: Class AVFAudioReceiver is implemented in both /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/cv2/.dylibs/libavdevice.61.3.100.dylib (0x103a5c3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x1663407c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
INFO 2026-11-23 17:39:50 safe_259.py:115 [A] follower: connect の直後に目標を今の位置にした
INFO 2026-11-23 17:39:50 safe_259.py:125 [A] follower: 力を入れる直前に目標を今の位置にした (全部)
[274] 17:39:50 torque_on {"run": "step2_replay", "max_diff_deg": {"shoulder_pan": 0.0, "shoulder_lift": 0.0, "elbow_flex": 0.0, "wrist_flex": 0.0, "wrist_roll": 0.0, "gripper": 0.0}}
INFO 2026-11-23 17:39:50 follower.py:128 ptm_follower SOFollower connected.
INFO 2026-11-23 17:39:50 ls/utils.py:151 Replaying episode
INFO 2026-11-23 17:40:13 le_timer.py:617 Cadence summary — whole run · target 30 Hz (33.3 ms budget per tick): 600 ticks, 599 judged
  effective cadence: 29.99 Hz over 20.0 s measured
  ticks over the 33.3 ms work budget: 0/599 (0.0%) — work mean 16.2 ms, worst 19.6 ms
  loop-body steps (share of measured work):
    read_frame  mean   0.14 ms · worst   5.60 ms ·   0.9% of work · 600 calls
    observe     mean   1.16 ms · worst   1.39 ms ·   7.1% of work · 600 calls
    send        mean  14.93 ms · worst  20.47 ms ·  91.8% of work · 600 calls
  pacing headroom: 17.1 ms slept per tick on average (max 21.9 ms) — near zero means the loop is saturated
[274] 17:40:13 lerobot_safe_window {"run": "step2_replay", "title": "休みの姿勢へ自動で戻す"}
[274] 17:40:13 rest_out_joints {"run": "step2_replay", "out": {"elbow_flex": -14.11, "wrist_flex": 31.12}}
[274] 17:40:14 rest_out_joints {"run": "step2_replay", "out": {"wrist_flex": 25.76}}
[274] 17:40:14 rest_out_joints {"run": "step2_replay", "out": {}}
INFO 2026-11-23 17:40:14 follower.py:221 ptm_follower SOFollower disconnected.
[274] 17:40:14 run_end {"name": "step2_replay", "exc": null, "ret": null, "torque_kept": false, "file": "/Users/shimazueiichi/r2r2r-scripts/so101/check_274/step2_replay.json"}
[274] 17:40:14 screen {"title": "見た物で答える  y / n", "lines": ["replay で, フォロワーは 録ったとおりに動いた？", "", "はい = y     いいえ = n"]}
[274] 17:40:19 key {"title": "見た物で答える  y / n", "key": "y"}
[274] 17:40:19 screen {"title": "おわり", "lines": ["手順はすべて終わった", "フォロワーの電源を切ってよい", "", "準備ができたら スペース"]}
[274] 17:40:22 key {"title": "おわり", "key": " "}
[274] 17:40:22 end {}
```

#### events_274_replay.jsonl

```json
{"t": 1795423135.592631, "clock": "17:38:55", "kind": "start", "dry": false}
{"t": 1795423136.841231, "clock": "17:38:56", "kind": "screen", "title": "replay の前", "lines": ["フォロワーの電源が入っていることを確かめる", "フォロワーのまわりを空ける", "", "準備ができたら スペース"]}
{"t": 1795423182.830813, "clock": "17:39:42", "kind": "key", "title": "replay の前", "key": " "}
{"t": 1795423184.6594932, "clock": "17:39:44", "kind": "read_servos", "follower": [[1, 2058, 0], [2, 861, 0], [3, 3024, 0], [4, 2300, 0], [5, 2065, 0], [6, 2082, 0]], "leader": [[1, 2118, 0], [2, 823, 0], [3, 3110, 0], [4, 2678, 0], [5, 2070, 0], [6, 2024, 0]], "ok": true}
{"t": 1795423184.666373, "clock": "17:39:44", "kind": "screen", "title": "2. replay (1回目を再生)", "lines": ["フォロワーのまわりを空ける", "ブロックを元の所に置く", "スペースで replay を始める (力が入る)", "終わると 休みの姿勢へ自動で戻る", "(止めたいとき: q)", "", "準備ができたら スペース"]}
{"t": 1795423187.1242611, "clock": "17:39:47", "kind": "key", "title": "2. replay (1回目を再生)", "key": " "}
{"t": 1795423187.124602, "clock": "17:39:47", "kind": "run_start", "run": "step2_replay", "argv": ["replay", "--dataset.repo_id=local/so101_redblock_box_teleop_v1", "--dataset.root=/Users/shimazueiichi/so101_datasets/so101_redblock_box_teleop_v1", "--dataset.episode=0", "--dataset.fps=30"]}
{"t": 1795423190.6763709, "clock": "17:39:50", "kind": "torque_on", "run": "step2_replay", "max_diff_deg": {"shoulder_pan": 0.0, "shoulder_lift": 0.0, "elbow_flex": 0.0, "wrist_flex": 0.0, "wrist_roll": 0.0, "gripper": 0.0}}
{"t": 1795423213.845475, "clock": "17:40:13", "kind": "lerobot_safe_window", "run": "step2_replay", "title": "休みの姿勢へ自動で戻す"}
{"t": 1795423213.852674, "clock": "17:40:13", "kind": "rest_out_joints", "run": "step2_replay", "out": {"elbow_flex": -14.11, "wrist_flex": 31.12}}
{"t": 1795423214.019099, "clock": "17:40:14", "kind": "rest_out_joints", "run": "step2_replay", "out": {"wrist_flex": 25.76}}
{"t": 1795423214.1858912, "clock": "17:40:14", "kind": "rest_out_joints", "run": "step2_replay", "out": {}}
{"t": 1795423214.875797, "clock": "17:40:14", "kind": "run_end", "name": "step2_replay", "exc": null, "ret": null, "torque_kept": false, "file": "/Users/shimazueiichi/r2r2r-scripts/so101/check_274/step2_replay.json"}
{"t": 1795423214.8804622, "clock": "17:40:14", "kind": "screen", "title": "見た物で答える  y / n", "lines": ["replay で, フォロワーは 録ったとおりに動いた？", "", "はい = y     いいえ = n"]}
{"t": 1795423219.278194, "clock": "17:40:19", "kind": "key", "title": "見た物で答える  y / n", "key": "y"}
{"t": 1795423219.282302, "clock": "17:40:19", "kind": "screen", "title": "おわり", "lines": ["手順はすべて終わった", "フォロワーの電源を切ってよい", "", "準備ができたら スペース"]}
{"t": 1795423222.776012, "clock": "17:40:22", "kind": "key", "title": "おわり", "key": " "}
{"t": 1795423222.776588, "clock": "17:40:22", "kind": "end"}
```

#### results_274_replay.json

```json
{
 "0": {
  "torque_zero": true,
  "follower": [
   [
    1,
    2058,
    0
   ],
   [
    2,
    861,
    0
   ],
   [
    3,
    3024,
    0
   ],
   [
    4,
    2300,
    0
   ],
   [
    5,
    2065,
    0
   ],
   [
    6,
    2082,
    0
   ]
  ]
 },
 "2": {
  "run": {
   "name": "step2_replay",
   "exc": null,
   "ret": null,
   "torque_kept": false,
   "file": "/Users/shimazueiichi/r2r2r-scripts/so101/check_274/step2_replay.json"
  },
  "replay": {
   "frames": 599,
   "cut_frames": 1,
   "cut_examples": [
    {
     "wrist_flex": [
      45.8,
      41.05
     ]
    }
   ],
   "hz": 29.99,
   "leader_step_max": {
    "shoulder_pan": 1.32,
    "shoulder_lift": 4.57,
    "elbow_flex": 3.17,
    "wrist_flex": 3.7,
    "wrist_roll": 1.49,
    "gripper": 3.94
   }
  },
  "gate": [
   {
    "what": "rest_gate_start",
    "t": 26.703301417001057,
    "leader": false
   },
   {
    "what": "auto_return",
    "t": 26.718977167009143,
    "result": true,
    "dur_s": 0.99
   },
   {
    "what": "rest_gate_end",
    "t": 27.724046542018186,
    "result": "auto",
    "dur_s": 1.02
   }
  ],
  "rest_wait_s": 1.02,
  "rest_wait_each_s": [
   [
    "auto",
    1.02
   ]
  ],
  "torque_on": [
   {
    "shoulder_pan": 0.0,
    "shoulder_lift": 0.0,
    "elbow_flex": 0.0,
    "wrist_flex": 0.0,
    "wrist_roll": 0.0,
    "gripper": 0.0
   }
  ],
  "cut_frames_gate": 0,
  "yn_replay_same": true
 }
}
```

### 依頼274 は時間切れで止まり、残りを依頼276 にした

依頼274 は上限の60分（17:40）で止まった。10回の記録・確かめ・1回目の再生は終わっていて、残ったのは報告と KIOXIA へのコピーだった。箱に入らなかった回が1・2回目だったので、入った3回目を再生する依頼276 を出した。

#### 依頼274 の結果（依頼箱の記録）

```markdown
# 結果：20261123_274_SO101のお手本を10回録る_立ち会い

- 状態：時間切れ（途中で止めました）
- 始めた時刻：2026-11-23 16:40
- 終わった時刻：2026-11-23 17:40（60分）
- 作業フォルダ：/Users/shimazueiichi/r2r2r-scripts
- この続きを Claude Code で話すとき：作業フォルダで `claude --resume 39104b4f-ebe6-439d-bfd7-aec936b78a07`

## Claude Code の報告

（報告がありません。終了コード 0。_stderr.txt を見てください。ログインが切れているときは、ターミナルで claude を開いて /login）
```

#### 依頼276 の依頼文

```markdown
---
作業フォルダ: /Users/shimazueiichi/r2r2r-scripts
上限時間: 30
---
# SO-101 のお手本の3回目を replay し、記録を KIOXIA へ写す（依頼276・依頼274 の続き・エイイチ立ち会い）

依頼274（`so101/check_274/`）は時間切れで止まったが、10回の記録・確かめ（`analysis_274.json`）・1回目の replay は終わっている。報告と KIOXIA へのコピーが残っている。record が落ちた原因（pynput の SIGTRAP、`crash_171249.ips`）と run_274.py での直しも、報告に書いてほしい。

エイイチの答え：1回目・2回目はブロックが箱に入らなかった（失敗）。録っている最中の飛びはなかった。1回目の replay は録ったとおりに動いた。

## やること
1. **3回目（dataset の episode index 2）を replay する。** 入口は run_274.py の replay の手順（`lerobot_safe_259.py replay`）。`check_276/run_276.py` を作るか、run_274.py に episode を引数で渡せるならそれを使う（run_274.py の中身は書き換えない）。画面の流れ・休みの姿勢への自動戻りは依頼274 と同じ。始める前に Torque_Enable が全軸 0 か確かめ、フォロワーの電源が切れていれば「フォロワーの電源を入れて スペース」で待つ
2. 終わったら見た物で聞く（y/n）：「replay で、ブロックは箱に入った？」「フォロワーは録ったとおりに動いた？」
3. 失敗の回を記録に残す：dataset 自体は変えず、横に `episode_labels.json`（index ごとに success / fail、判定した人＝エイイチ、日付）を置く。1回目・2回目（index 0・1）は fail、ほかは success
4. KIOXIA のマウントを確かめ、`~/so101_datasets/so101_redblock_box_teleop_v1/` を `/Volumes/KIOXIA/r2r2r-data/datasets/so101_redblock_box_teleop_v1/` に**コピー**する（同じ名前があれば止める。Mac 側は消さない）。コピー後にファイル数とサイズが一致するかを確かめる。`check_274/_crash_1712_dataset` は写さない
5. `so101/check_274/REPORT.md` を書く（10回の表・映像と角度の確かめ・replay・落ちた原因と直し・エイイチの答え）

## しないこと
- 包まない lerobot、record、rollout、Hugging Face への送信、EEPROM・キャリブレーション・カメラの設定ファイル・`lerobot_safe_259.py`・`~/lerobot` の書き換え
- KIOXIA の既存のファイルの上書き・移動・削除、`git add .`・`git clean`

## 報告
- 3回目の replay の結果とエイイチの答え、KIOXIA にコピーした場所とサイズ、本番の回数に進めるか
- 最後の1行に「判定：合格／止めた（決めてほしいことあり）／失敗」
```

### 3回目の再生では、ブロックがまた箱に入った

3回目（index 2）の再生は 550コマ・29.99 Hz で最後まで動き、ブロックは箱に入った。切られたコマは最初の3コマだけで、休みの姿勢から最初のコマへ手首（wrist_flex）が 23.2° → 33.2° → 43.2° → 53.2° と寄った所だった。前の記録で決めた仕様どおりの動きで、目で見ても飛んではいなかった。再生の終わりは 1.18秒で休みの姿勢に戻り、力が抜けた。

| | 1回目（index 0） | 3回目（index 2） |
|---|---|---|
| コマ・速さ | 599・29.99 Hz | 550・29.99 Hz |
| 切られたコマ | 1（最初の寄せ） | 3（最初の寄せ） |
| 力が入った直後 0.5秒の差 | 全軸 0.0° | 全軸 0.0° |
| 休みの姿勢への自動戻り | 1.02秒 | 1.18秒 |
| 録ったとおりに動いた？ | y | y |
| 再生でブロックは箱に入った？ | 聞いていない | y |

#### run_276_stdout.log

```text
[274] 17:43:38 start {"episode": 2}
[274] 17:43:39 screen {"title": "replay の前", "lines": ["フォロワーのまわりを空ける", "次のスペースで 力が入っていないか読む (読むだけ)", "", "準備ができたら スペース"]}
[274] 17:43:49 key {"title": "replay の前", "key": " "}
[274] 17:43:51 read_servos {"follower": [[1, 1958, 0], [2, 950, 0], [3, 3024, 0], [4, 2211, 0], [5, 2030, 0], [6, 2061, 0]], "leader": [[1, 2118, 0], [2, 823, 0], [3, 3110, 0], [4, 2678, 0], [5, 2070, 0], [6, 2024, 0]], "ok": true}
[274] 17:43:51 screen {"title": "replay (3回目を再生)", "lines": ["フォロワーのまわりを空ける", "ブロックを元の所に置く", "スペースで replay を始める (力が入る)", "終わると 休みの姿勢へ自動で戻る", "(止めたいとき: q)", "", "準備ができたら スペース"]}
[274] 17:43:53 key {"title": "replay (3回目を再生)", "key": " "}
[274] 17:43:53 run_start {"run": "step_replay_ep2", "argv": ["replay", "--dataset.repo_id=local/so101_redblock_box_teleop_v1", "--dataset.root=/Users/shimazueiichi/so101_datasets/so101_redblock_box_teleop_v1", "--dataset.episode=2", "--dataset.fps=30"]}
objc[33254]: Class AVFFrameReceiver is implemented in both /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/cv2/.dylibs/libavdevice.61.3.100.dylib (0x1052203a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x15cfac3a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[33254]: Class AVFAudioReceiver is implemented in both /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/cv2/.dylibs/libavdevice.61.3.100.dylib (0x1052203f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x15cfac3f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
INFO 2026-11-23 17:43:57 t_replay.py:108 {'dataset': {'episode': 2,
             'fps': 30,
             'repo_id': 'local/so101_redblock_box_teleop_v1',
             'root': '/Users/shimazueiichi/so101_datasets/so101_redblock_box_teleop_v1'},
 'play_sounds': True,
 'robot': {'calibration_dir': None,
           'cameras': {},
           'disable_torque_on_disconnect': True,
           'id': 'ptm_follower',
           'max_relative_target': None,
           'num_read_retries': 2,
           'port': '/dev/tty.usbmodem5CBC4321631',
           'position_d_coefficient': 32,
           'position_i_coefficient': 0,
           'position_p_coefficient': 16,
           'use_degrees': True}}
objc[33254]: Class AVFFrameReceiver is implemented in both /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/cv2/.dylibs/libavdevice.61.3.100.dylib (0x1052203a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x16caa4778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[33254]: Class AVFAudioReceiver is implemented in both /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/cv2/.dylibs/libavdevice.61.3.100.dylib (0x1052203f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x16caa47c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
INFO 2026-11-23 17:43:57 safe_259.py:115 [A] follower: connect の直後に目標を今の位置にした
INFO 2026-11-23 17:43:57 safe_259.py:125 [A] follower: 力を入れる直前に目標を今の位置にした (全部)
[274] 17:43:57 torque_on {"run": "step_replay_ep2", "max_diff_deg": {"shoulder_pan": 0.0, "shoulder_lift": 0.0, "elbow_flex": 0.0, "wrist_flex": 0.0, "wrist_roll": 0.0, "gripper": 0.0}}
INFO 2026-11-23 17:43:57 follower.py:128 ptm_follower SOFollower connected.
INFO 2026-11-23 17:43:57 ls/utils.py:151 Replaying episode
INFO 2026-11-23 17:44:19 le_timer.py:617 Cadence summary — whole run · target 30 Hz (33.3 ms budget per tick): 551 ticks, 550 judged
  effective cadence: 29.99 Hz over 18.3 s measured
  ticks over the 33.3 ms work budget: 0/550 (0.0%) — work mean 16.1 ms, worst 20.3 ms
  loop-body steps (share of measured work):
    read_frame  mean   0.15 ms · worst   6.49 ms ·   0.9% of work · 551 calls
    observe     mean   1.15 ms · worst   2.25 ms ·   7.1% of work · 551 calls
    send        mean  14.84 ms · worst  20.70 ms ·  91.8% of work · 551 calls
  pacing headroom: 17.2 ms slept per tick on average (max 21.8 ms) — near zero means the loop is saturated
[274] 17:44:19 lerobot_safe_window {"run": "step_replay_ep2", "title": "休みの姿勢へ自動で戻す"}
[274] 17:44:19 rest_out_joints {"run": "step_replay_ep2", "out": {"wrist_flex": 40.79}}
[274] 17:44:19 rest_out_joints {"run": "step_replay_ep2", "out": {}}
INFO 2026-11-23 17:44:20 follower.py:221 ptm_follower SOFollower disconnected.
[274] 17:44:20 run_end {"name": "step_replay_ep2", "exc": null, "ret": null, "torque_kept": false, "file": "/Users/shimazueiichi/r2r2r-scripts/so101/check_276/step_replay_ep2.json"}
[274] 17:44:20 screen {"title": "見た物で答える  y / n", "lines": ["replay で, ブロックは箱に入った？", "", "はい = y     いいえ = n"]}
[274] 17:44:23 key {"title": "見た物で答える  y / n", "key": "y"}
[274] 17:44:23 screen {"title": "見た物で答える  y / n", "lines": ["フォロワーは 録ったとおりに動いた？", "", "はい = y     いいえ = n"]}
[274] 17:44:25 key {"title": "見た物で答える  y / n", "key": "y"}
[274] 17:44:25 screen {"title": "おわり", "lines": ["手順はすべて終わった", "フォロワーの電源を切ってよい", "", "準備ができたら スペース"]}
[274] 17:44:29 key {"title": "おわり", "key": " "}
[274] 17:44:29 end {}
exit=0
```

#### events_276.jsonl

```json
{"t": 1795423418.090497, "clock": "17:43:38", "kind": "start", "episode": 2}
{"t": 1795423419.299693, "clock": "17:43:39", "kind": "screen", "title": "replay の前", "lines": ["フォロワーのまわりを空ける", "次のスペースで 力が入っていないか読む (読むだけ)", "", "準備ができたら スペース"]}
{"t": 1795423429.4367309, "clock": "17:43:49", "kind": "key", "title": "replay の前", "key": " "}
{"t": 1795423431.2683089, "clock": "17:43:51", "kind": "read_servos", "follower": [[1, 1958, 0], [2, 950, 0], [3, 3024, 0], [4, 2211, 0], [5, 2030, 0], [6, 2061, 0]], "leader": [[1, 2118, 0], [2, 823, 0], [3, 3110, 0], [4, 2678, 0], [5, 2070, 0], [6, 2024, 0]], "ok": true}
{"t": 1795423431.2743108, "clock": "17:43:51", "kind": "screen", "title": "replay (3回目を再生)", "lines": ["フォロワーのまわりを空ける", "ブロックを元の所に置く", "スペースで replay を始める (力が入る)", "終わると 休みの姿勢へ自動で戻る", "(止めたいとき: q)", "", "準備ができたら スペース"]}
{"t": 1795423433.181947, "clock": "17:43:53", "kind": "key", "title": "replay (3回目を再生)", "key": " "}
{"t": 1795423433.1822, "clock": "17:43:53", "kind": "run_start", "run": "step_replay_ep2", "argv": ["replay", "--dataset.repo_id=local/so101_redblock_box_teleop_v1", "--dataset.root=/Users/shimazueiichi/so101_datasets/so101_redblock_box_teleop_v1", "--dataset.episode=2", "--dataset.fps=30"]}
{"t": 1795423437.8185441, "clock": "17:43:57", "kind": "torque_on", "run": "step_replay_ep2", "max_diff_deg": {"shoulder_pan": 0.0, "shoulder_lift": 0.0, "elbow_flex": 0.0, "wrist_flex": 0.0, "wrist_roll": 0.0, "gripper": 0.0}}
{"t": 1795423459.39961, "clock": "17:44:19", "kind": "lerobot_safe_window", "run": "step_replay_ep2", "title": "休みの姿勢へ自動で戻す"}
{"t": 1795423459.406922, "clock": "17:44:19", "kind": "rest_out_joints", "run": "step_replay_ep2", "out": {"wrist_flex": 40.79}}
{"t": 1795423459.9066062, "clock": "17:44:19", "kind": "rest_out_joints", "run": "step_replay_ep2", "out": {}}
{"t": 1795423460.595516, "clock": "17:44:20", "kind": "run_end", "name": "step_replay_ep2", "exc": null, "ret": null, "torque_kept": false, "file": "/Users/shimazueiichi/r2r2r-scripts/so101/check_276/step_replay_ep2.json"}
{"t": 1795423460.601892, "clock": "17:44:20", "kind": "screen", "title": "見た物で答える  y / n", "lines": ["replay で, ブロックは箱に入った？", "", "はい = y     いいえ = n"]}
{"t": 1795423463.088141, "clock": "17:44:23", "kind": "key", "title": "見た物で答える  y / n", "key": "y"}
{"t": 1795423463.0916219, "clock": "17:44:23", "kind": "screen", "title": "見た物で答える  y / n", "lines": ["フォロワーは 録ったとおりに動いた？", "", "はい = y     いいえ = n"]}
{"t": 1795423465.9286752, "clock": "17:44:25", "kind": "key", "title": "見た物で答える  y / n", "key": "y"}
{"t": 1795423465.933144, "clock": "17:44:25", "kind": "screen", "title": "おわり", "lines": ["手順はすべて終わった", "フォロワーの電源を切ってよい", "", "準備ができたら スペース"]}
{"t": 1795423469.950189, "clock": "17:44:29", "kind": "key", "title": "おわり", "key": " "}
{"t": 1795423469.951317, "clock": "17:44:29", "kind": "end"}
```

#### results_276.json

```json
{
 "episode_index": 2,
 "read_servos": [
  {
   "ok": true,
   "follower": [
    [
     1,
     1958,
     0
    ],
    [
     2,
     950,
     0
    ],
    [
     3,
     3024,
     0
    ],
    [
     4,
     2211,
     0
    ],
    [
     5,
     2030,
     0
    ],
    [
     6,
     2061,
     0
    ]
   ]
  }
 ],
 "replay": {
  "run": {
   "name": "step_replay_ep2",
   "exc": null,
   "ret": null,
   "torque_kept": false,
   "file": "/Users/shimazueiichi/r2r2r-scripts/so101/check_276/step_replay_ep2.json"
  },
  "replay": {
   "frames": 550,
   "cut_frames": 3,
   "cut_examples": [
    {
     "wrist_flex": [
      54.68,
      33.23
     ]
    },
    {
     "wrist_flex": [
      54.77,
      43.23
     ]
    },
    {
     "wrist_flex": [
      54.77,
      53.23
     ]
    }
   ],
   "hz": 29.99,
   "leader_step_max": {
    "shoulder_pan": 1.85,
    "shoulder_lift": 3.52,
    "elbow_flex": 2.82,
    "wrist_flex": 4.13,
    "wrist_roll": 2.37,
    "gripper": 4.94
   }
  },
  "gate": [
   {
    "what": "rest_gate_start",
    "t": 26.204719125002157,
    "leader": false
   },
   {
    "what": "auto_return",
    "t": 26.21554933299194,
    "result": true,
    "dur_s": 1.16
   },
   {
    "what": "rest_gate_end",
    "t": 27.388389750005445,
    "result": "auto",
    "dur_s": 1.18
   }
  ],
  "rest_wait_s": 1.18,
  "rest_wait_each_s": [
   [
    "auto",
    1.18
   ]
  ],
  "torque_on": [
   {
    "shoulder_pan": 0.0,
    "shoulder_lift": 0.0,
    "elbow_flex": 0.0,
    "wrist_flex": 0.0,
    "wrist_roll": 0.0,
    "gripper": 0.0
   }
  ],
  "cut_frames_gate": 0,
  "yn_block_in_box": true,
  "yn_replay_same": true
 }
}
```

#### read_servos_last.txt（依頼276）

```text

== /dev/tty.usbmodem5CBC4321631
  サーボ 6 個, 電圧の平均 11.9 V
  ID  型番  FW    位置  電圧V  温度C  トルク  Lock
   1  777  3.10   1958   11.8     32       0     0
   2  777  3.10    950   11.8     32       0     0
   3  777  3.10   3024   11.8     31       0     0
   4  777  3.10   2211   11.9     33       0     0
   5  777  3.10   2030   11.9     32       0     0
   6  777  3.10   2061   11.9     37       0     0

== /dev/tty.usbmodem5CBC4323581
  サーボ 6 個, 電圧の平均 4.9 V
  ID  型番  FW    位置  電圧V  温度C  トルク  Lock
   1  777  3.10   2118    4.9     25       0     0
   2  777  3.10    823    4.9     25       0     0
   3  777  3.10   3110    4.9     26       0     0
   4  777  3.10   2678    4.9     24       0     0
   5  777  3.10   2070    4.9     26       0     0
   6  777  3.10   2024    4.9     26       0     0
```


## 作業ログ ― 失敗の印を付けて、KIOXIA にコピーした

データセットの中身は変えずに、横に `episode_labels.json` を置いた。index 0・1 は fail、2〜9 は success で、判定した人と日付も書いてある。LeRobot はこのファイルを読まないので、学習のときは、このファイルを見て失敗の回を外す。

コピー先は KIOXIA の `r2r2r-data/datasets/so101_redblock_box_teleop_v1/`。8ファイル・39,980,625 バイトで、Mac 側と大きさ・sha1 まで一致した。落ちたときに途中まで作られた記録（`_crash_1712_dataset`）は写していない。

#### episode_labels.json

```json
{
 "dataset": "local/so101_redblock_box_teleop_v1",
 "judged_by": "エイイチ",
 "date": "2026-11-23",
 "note": "ブロックが箱に入ったか (エイイチが録った回を見て答えた. 依頼274・276). dataset 本体は変えていない",
 "episodes": [
  {
   "episode_index": 0,
   "label": "fail"
  },
  {
   "episode_index": 1,
   "label": "fail"
  },
  {
   "episode_index": 2,
   "label": "success"
  },
  {
   "episode_index": 3,
   "label": "success"
  },
  {
   "episode_index": 4,
   "label": "success"
  },
  {
   "episode_index": 5,
   "label": "success"
  },
  {
   "episode_index": 6,
   "label": "success"
  },
  {
   "episode_index": 7,
   "label": "success"
  },
  {
   "episode_index": 8,
   "label": "success"
  },
  {
   "episode_index": 9,
   "label": "success"
  }
 ]
}
```

#### meta/info.json（データセットの形）

```json
{
    "codebase_version": "v3.0",
    "fps": 30,
    "features": {
        "action": {
            "dtype": "float32",
            "names": [
                "shoulder_pan.pos",
                "shoulder_lift.pos",
                "elbow_flex.pos",
                "wrist_flex.pos",
                "wrist_roll.pos",
                "gripper.pos"
            ],
            "shape": [
                6
            ]
        },
        "observation.state": {
            "dtype": "float32",
            "names": [
                "shoulder_pan.pos",
                "shoulder_lift.pos",
                "elbow_flex.pos",
                "wrist_flex.pos",
                "wrist_roll.pos",
                "gripper.pos"
            ],
            "shape": [
                6
            ]
        },
        "observation.images.wrist": {
            "dtype": "video",
            "shape": [
                480,
                640,
                3
            ],
            "names": [
                "height",
                "width",
                "channels"
            ],
            "info": {
                "is_depth_map": false,
                "video.height": 480,
                "video.width": 640,
                "video.codec": "av1",
                "video.pix_fmt": "yuv420p",
                "video.fps": 30,
                "video.channels": 3,
                "has_audio": false,
                "video.g": 2,
                "video.crf": 30,
                "video.preset": 12,
                "video.fast_decode": 0,
                "video.video_backend": "pyav",
                "video.extra_options": {}
            }
        },
        "observation.images.desk": {
            "dtype": "video",
            "shape": [
                480,
                640,
                3
            ],
            "names": [
                "height",
                "width",
                "channels"
            ],
            "info": {
                "is_depth_map": false,
                "video.height": 480,
                "video.width": 640,
                "video.codec": "av1",
                "video.pix_fmt": "yuv420p",
                "video.fps": 30,
                "video.channels": 3,
                "has_audio": false,
                "video.g": 2,
                "video.crf": 30,
                "video.preset": 12,
                "video.fast_decode": 0,
                "video.video_backend": "pyav",
                "video.extra_options": {}
            }
        },
        "timestamp": {
            "dtype": "float32",
            "shape": [
                1
            ],
            "names": null
        },
        "frame_index": {
            "dtype": "int64",
            "shape": [
                1
            ],
            "names": null
        },
        "episode_index": {
            "dtype": "int64",
            "shape": [
                1
            ],
            "names": null
        },
        "index": {
            "dtype": "int64",
            "shape": [
                1
            ],
            "names": null
        },
        "task_index": {
            "dtype": "int64",
            "shape": [
                1
            ],
            "names": null
        }
    },
    "total_episodes": 10,
    "total_frames": 5602,
    "total_tasks": 1,
    "chunks_size": 1000,
    "data_files_size_in_mb": 100,
    "video_files_size_in_mb": 200,
    "data_path": "data/chunk-{chunk_index:03d}/file-{file_index:03d}.parquet",
    "video_path": "videos/{video_key}/chunk-{chunk_index:03d}/file-{file_index:03d}.mp4",
    "robot_type": "so_follower",
    "splits": {
        "train": "0:10"
    }
}
```

#### meta/stats.json（角度と映像の統計）

```json
{
    "observation.images.wrist": {
        "min": [
            [
                [
                    0.0
                ]
            ],
            [
                [
                    0.0
                ]
            ],
            [
                [
                    0.0
                ]
            ]
        ],
        "max": [
            [
                [
                    1.0
                ]
            ],
            [
                [
                    1.0
                ]
            ],
            [
                [
                    1.0
                ]
            ]
        ],
        "mean": [
            [
                [
                    0.6174857975658911
                ]
            ],
            [
                [
                    0.6268498266880507
                ]
            ],
            [
                [
                    0.5994894011880475
                ]
            ]
        ],
        "std": [
            [
                [
                    0.10253939164377197
                ]
            ],
            [
                [
                    0.13322608322986781
                ]
            ],
            [
                [
                    0.1308953234334859
                ]
            ]
        ],
        "count": [
            5602
        ],
        "q01": [
            [
                [
                    0.01968871794834123
                ]
            ],
            [
                [
                    0.019708927218807144
                ]
            ],
            [
                [
                    0.015704114334830203
                ]
            ]
        ],
        "q10": [
            [
                [
                    0.4508626598465087
                ]
            ],
            [
                [
                    0.3411912593443262
                ]
            ],
            [
                [
                    0.30580176991135205
                ]
            ]
        ],
        "q50": [
            [
                [
                    0.6274858560085822
                ]
            ],
            [
                [
                    0.6471731169099161
                ]
            ],
            [
                [
                    0.6235578038617673
                ]
            ]
        ],
        "q90": [
            [
                [
                    0.7451890732625592
                ]
            ],
            [
                [
                    0.7687005036939649
                ]
            ],
            [
                [
                    0.7411424827491958
                ]
            ]
        ],
        "q99": [
            [
                [
                    0.8863959736459838
                ]
            ],
            [
                [
                    0.9136636638658705
                ]
            ],
            [
                [
                    0.8785470552522702
                ]
            ]
        ]
    },
    "index": {
        "min": [
            0.0
        ],
        "max": [
            5601.0
        ],
        "mean": [
            2800.5
        ],
        "std": [
            1617.1580782347778
        ],
        "count": [
            5602
        ],
        "q01": [
            5.0315999999016805
        ],
        "q10": [
            59.06139999991972
        ],
        "q50": [
            299.0207999999999
        ],
        "q90": [
            5546.978160000081
        ],
        "q99": [
            5596.0142960000985
        ]
    },
    "timestamp": {
        "min": [
            0.0
        ],
        "max": [
            19.966666666666665
        ],
        "mean": [
            9.392389622753779
        ],
        "std": [
            5.504979750444464
        ],
        "count": [
            5602
        ],
        "q01": [
            0.13320266656848304
        ],
        "q10": [
            1.4669599999200038
        ],
        "q50": [
            7.334800000000019
        ],
        "q90": [
            17.97000000008
        ],
        "q99": [
            19.767000000097998
        ]
    },
    "frame_index": {
        "min": [
            0.0
        ],
        "max": [
            599.0
        ],
        "mean": [
            281.77168868261333
        ],
        "std": [
            165.14939251333388
        ],
        "count": [
            5602
        ],
        "q01": [
            3.996079999901816
        ],
        "q10": [
            44.00879999992
        ],
        "q50": [
            220.044
        ],
        "q90": [
            539.1000000000801
        ],
        "q99": [
            593.010000000098
        ]
    },
    "observation.state": {
        "min": [
            -8.527472496032715,
            -103.78022003173828,
            -88.61538696289062,
            12.439560890197754,
            -20.52747344970703,
            0.8807588219642639
        ],
        "max": [
            41.230770111083984,
            57.978023529052734,
            91.16483306884766,
            100.0,
            16.131868362426758,
            49.051490783691406
        ],
        "mean": [
            6.015010313169152,
            -18.39215972634968,
            20.891753262957582,
            48.44925865314978,
            -4.609813597665748,
            19.77220437090255
        ],
        "std": [
            14.271774419350931,
            60.03027460983604,
            50.61333519935724,
            15.208710131312445,
            6.234844480700281,
            16.090781648422773
        ],
        "count": [
            5602
        ],
        "q01": [
            -8.527472496132715,
            -103.78022003183828,
            -88.36264973387199,
            14.550330088525218,
            -20.52747344980703,
            0.8807588218642639
        ],
        "q10": [
            -6.677433031180914,
            -103.78022003183828,
            -47.29649576199991,
            20.697169372274388,
            -20.443449300185023,
            1.0092301327809658
        ],
        "q50": [
            -3.25626015234337,
            -98.15269029732097,
            -33.921422877967856,
            34.50643234685507,
            -7.162536731063776,
            1.0169996513581432
        ],
        "q90": [
            37.53741544645913,
            57.34881800178096,
            91.16092481620598,
            88.3102744801146,
            6.724418416354434,
            49.048534769598376
        ],
        "q99": [
            41.150770953731275,
            57.90211032751028,
            91.16444224367349,
            99.99741296317997,
            14.906039781663512,
            49.051195182372105
        ]
    },
    "episode_index": {
        "min": [
            0.0
        ],
        "max": [
            9.0
        ],
        "mean": [
            4.359514459121742
        ],
        "std": [
            2.8648586056379632
        ],
        "count": [
            5602
        ],
        "q01": [
            3.9999999999994176e-16
        ],
        "q10": [
            3.999999999999417e-15
        ],
        "q50": [
            1.9999999999997088e-14
        ],
        "q90": [
            9.000000000000037
        ],
        "q99": [
            9.00000000000004
        ]
    },
    "task_index": {
        "min": [
            0.0
        ],
        "max": [
            0.0
        ],
        "mean": [
            0.0
        ],
        "std": [
            0.0
        ],
        "count": [
            5602
        ],
        "q01": [
            3.9999999999994176e-16
        ],
        "q10": [
            3.999999999999417e-15
        ],
        "q50": [
            1.9999999999997088e-14
        ],
        "q90": [
            3.599999999999476e-14
        ],
        "q99": [
            3.9599999999994235e-14
        ]
    },
    "action": {
        "min": [
            -9.186813354492188,
            -105.23076629638672,
            -96.3956069946289,
            8.967033386230469,
            -20.96703338623047,
            0.08223684132099152
        ],
        "max": [
            41.89011001586914,
            57.406593322753906,
            96.48351287841797,
            102.15384674072266,
            16.83516502380371,
            49.5065803527832
        ],
        "mean": [
            6.095342695893256,
            -19.120518186295545,
            20.569890298989364,
            48.26080160573396,
            -4.617471776693203,
            17.638099774550703
        ],
        "std": [
            14.284471551238484,
            59.6391375924208,
            52.88559358821161,
            15.394823276223518,
            6.3840792317058,
            17.944556749765816
        ],
        "count": [
            5602
        ],
        "q01": [
            -9.186813354592188,
            -104.0916013731537,
            -95.86721454482296,
            13.194971768106557,
            -20.967033386330467,
            0.4066974148530855
        ],
        "q10": [
            -6.982381402589326,
            -103.90151862963907,
            -49.95994191243371,
            20.47988022594862,
            -20.876930527862662,
            0.5695766631919544
        ],
        "q50": [
            -3.032966756900678,
            -97.9270585457055,
            -34.13487339714569,
            33.761528024436736,
            -6.548568228529813,
            0.6535486742569696
        ],
        "q90": [
            37.23237007527698,
            56.86671483575715,
            96.47476562605365,
            88.27040590123687,
            6.9919121866946865,
            49.34533034828453
        ],
        "q99": [
            41.70982482975017,
            57.135152498548344,
            96.48263815327154,
            102.15029719202863,
            16.045222172642067,
            49.42146521887686
        ]
    },
    "observation.images.desk": {
        "min": [
            [
                [
                    0.0
                ]
            ],
            [
                [
                    0.0
                ]
            ],
            [
                [
                    0.0
                ]
            ]
        ],
        "max": [
            [
                [
                    1.0
                ]
            ],
            [
                [
                    1.0
                ]
            ],
            [
                [
                    1.0
                ]
            ]
        ],
        "mean": [
            [
                [
                    0.7283205433477292
                ]
            ],
            [
                [
                    0.7374160693535621
                ]
            ],
            [
                [
                    0.7318180283215467
                ]
            ]
        ],
        "std": [
            [
                [
                    0.09105841490827178
                ]
            ],
            [
                [
                    0.09338379759539708
                ]
            ],
            [
                [
                    0.09275829144941782
                ]
            ]
        ],
        "count": [
            5602
        ],
        "q01": [
            [
                [
                    0.25892725856678905
                ]
            ],
            [
                [
                    0.27049352226702644
                ]
            ],
            [
                [
                    0.2704185733510985
                ]
            ]
        ],
        "q10": [
            [
                [
                    0.6666840902600564
                ]
            ],
            [
                [
                    0.670410398359829
                ]
            ],
            [
                [
                    0.6627818864064043
                ]
            ]
        ],
        "q50": [
            [
                [
                    0.7372457561648595
                ]
            ],
            [
                [
                    0.7490258492323962
                ]
            ],
            [
                [
                    0.7411385976629604
                ]
            ]
        ],
        "q90": [
            [
                [
                    0.8038715286438872
                ]
            ],
            [
                [
                    0.8157823170899353
                ]
            ],
            [
                [
                    0.8116798803674891
                ]
            ]
        ],
        "q99": [
            [
                [
                    0.8626928386198734
                ]
            ],
            [
                [
                    0.8822133614038085
                ]
            ],
            [
                [
                    0.8705173152261981
                ]
            ]
        ]
    }
}
```

#### 依頼276 の結果（依頼箱の記録）

```markdown
# 結果：20261123_276_SO101のお手本の3回目を再生しKIOXIAへ写す_立ち会い

- 状態：完了
- 始めた時刻：2026-11-23 17:42
- 終わった時刻：2026-11-23 18:04（22分）
- 作業フォルダ：/Users/shimazueiichi/r2r2r-scripts
- この続きを Claude Code で話すとき：作業フォルダで `claude --resume e25a026d-1ca1-4de0-948e-37b9ed45dc37`

## Claude Code の報告

ログを確かめました。run_276.py は 17:44:29 に終わっています（exit=0）。手順3〜5（ラベル・KIOXIA へのコピー・REPORT.md）もこの前に済ませてあるので、今回は何もしていません。

やったこと：`check_276/run_276_stdout.log` で replay の終わりを確かめただけです。

結果：
- replay は最後まで動きました。止まったところはなく、力を入れたままポートを閉じたこともありません。
- エイイチの答えは「ブロックは箱に入った」が y、「録ったとおりに動いた」も y です。
- KIOXIA へのコピーは済んでいます。8ファイル・39,980,625 バイトで、Mac 側と sha1 まで一致しました。

変えたファイル：なし

決めてほしいこと：前の報告から変わっていません。
- 本番で録る回数
- 失敗した2回（index 0・1）を学習に入れるかどうか
- replay の始めの寄り（1コマ 10°）をこのままにするか
- `episode_labels.json` を dataset のフォルダの中に置いたままでよいか

判定：止めた（決めてほしいことあり）
```

#### so101/check_274/REPORT.md

```markdown
# 依頼274・276 SO-101 のお手本（record）10回と replay・KIOXIA へのコピー 報告（2026-11-23 16:45〜17:44）

入口は `so101/lerobot_safe_259.py` の record・replay（`check_274/run_274.py`・`check_276/run_276.py` が同じプロセスで main() を呼ぶ）。包まない lerobot・rollout は使っていない。EEPROM・キャリブレーション・カメラの設定ファイル・`~/lerobot`・`lerobot_safe_259.py` は書き換えていない。Hugging Face には送っていない。依頼274 は時間切れで止まり、残りの3回目の replay・ラベル・コピー・この報告を依頼276 で行った。

## 実行の経過
| 時刻 | 何をしたか | 結果 |
|---|---|---|
| 16:45〜17:05 | run_274 1回目 | 「0. 始める前」でスペースが20分来ず、時間切れで終わった（腕はつないでいない） |
| 17:05〜17:12 | run_274 2回目 | record を始めた直後 17:12:49 に **プロセスが SIGTRAP で落ちた**（`crash_171249.ips`）。フォロワーは力が入ったまま残った。途中まで作られた記録は `_crash_1712_dataset` に残っている |
| 17:23 | run_274 3回目 | 始める前の読みでフォロワーの Torque_Enable が全軸 1（落ちたときのまま）→ 始めなかった（「支える → 電源を切る」の画面でスペース）|
| 17:27〜17:38 | run_274 4回目（直したあと） | record 10回が通った。続けて同じプロセスで replay を呼ぶとカメラの確かめで止まった（下の「replay を別のプロセスに」） |
| 17:38〜17:40 | `run_274.py --replay-only` | 1回目（index 0）の replay |
| 17:43〜17:44 | `check_276/run_276.py` | 3回目（index 2）の replay（依頼276） |

## 落ちた原因と直し
- `crash_171249.ips`：`EXC_BREAKPOINT (SIGTRAP)`、落ちたのは Python の別スレッド（thread 73）。中身は `TSMGetInputSourceProperty` → `islGetInputSourceListWithAdditions` → `dispatch_assert_queue` の失敗。ctypes から呼ばれていた。
- これは LeRobot の record が始めるキーの読み取り（pynput の keyboard listener）が、別スレッドから macOS の入力ソースの関数を呼んだもの。macOS はこの関数をメインのキューでしか許さず、プロセスを止める。
- 直し（`run_274.py` の `install_record_hooks`）：LeRobot の `init_keyboard_listener` を包み、pynput の読み取りを始めない。→・←・スペース・q は run_274 の手順のウィンドウ（cv2 の waitKeyEx）で受け、LeRobot の `events`（exit_early・rerecord_episode）に渡す。`lerobot_record.py` は書き換えていない。直したあとの4回目は最後まで落ちなかった。
- 落ちたときフォロワーは力が入ったままだった（Ctrl-C・例外でないので lerobot_safe_259 の後始末を通らない）。3回目の読みでこれを見つけて始めなかった。
- replay を別のプロセスに：record のあと同じプロセスで replay の main() を呼ぶと、`GuardError("カメラは ['desk', 'wrist'] の2台だけ (今 [])")` で止まった（record のカメラの設定が残るため。力は入れていない）。`--replay-only` を足し、replay は新しいプロセスで行った。

## 10回の表（`analysis_274.json`。記録は読むだけ）
| 回（index） | コマ | 長さ秒 | 実際の Hz | 何回目で残したか | 終わり方 | 状態の1コマ最大° | 送った目標の1コマ最大° | 10°超え | 映像 wrist / desk のコマ | エイイチの判定 |
|---|---|---|---|---|---|---|---|---|---|---|
| 1（0） | 600 | 20.00 | 29.91 | 1 | 時間 | 4.75 | 4.57 | 0 | 600 / 600 | **fail** |
| 2（1） | 600 | 20.00 | 29.95 | 1 | 時間 | 3.52 | 3.52 | 0 | 600 / 600 | **fail** |
| 3（2） | 551 | 18.37 | 29.93 | 2 | → | 3.66 | 4.93 | 0 | 551 / 551 | success |
| 4（3） | 600 | 20.00 | 29.94 | 2 | 時間 | 4.13 | 4.36 | 0 | 600 / 600 | success |
| 5（4） | 552 | 18.40 | 29.94 | 1 | → | 3.87 | 6.00 | 0 | 552 / 552 | success |
| 6（5） | 596 | 19.87 | 29.96 | 3 | 時間 | 4.57 | 4.93 | 0 | 596 / 596 | success |
| 7（6） | 600 | 20.00 | 29.96 | 1 | 時間 | 4.31 | 4.69 | 0 | 600 / 600 | success |
| 8（7） | 441 | 14.70 | 29.95 | 1 | → | 4.40 | 5.02 | 0 | 441 / 441 | success |
| 9（8） | 513 | 17.10 | 29.95 | 1 | → | 4.75 | 5.18 | 0 | 513 / 513 | success |
| 10（9） | 549 | 18.30 | 29.99 | 1 | → | 4.40 | 4.66 | 0 | 549 / 549 | success |

- 合わせて 10回・5,602コマ・30fps。録った最中の試しは 14回。← で捨てたのは4回（3回目・4回目が1回ずつ、6回目が2回）。
- 録っている最中に B（1コマ 10°）で切られたコマは **0**。切られたのは回の外の待ちだけ（start 1・start_wait 1・reset 3）。休みの姿勢の待ちは 11.6秒（リーダーで戻した）。力が入った直後 0.5秒の差は全軸 0.0°。
- 映像：2台とも全部の回にあり、コマ数は角度の行数と同じ。真っ黒・白飛びのコマは 0。止まったコマが続いたのは最長1コマ。各回の最初・真ん中・最後のコマは `frames/`（60枚）。
- 角度：observation.state・action とも全部の回にある。1コマ 10°（爪 20）を超える差は 0。

## replay
| | 1回目（index 0。依頼274） | 3回目（index 2。依頼276） |
|---|---|---|
| コマ・Hz | 599・29.99 | 550・29.99 |
| 切られたコマ | 1（最初のコマ。wrist_flex 45.8→41.05） | 3（最初の3コマ。wrist_flex が 23.2→33.2→43.2→53.2 と 10° ずつ寄った） |
| 力が入った直後 0.5秒の差 | 全軸 0.0° | 全軸 0.0° |
| 休みの姿勢への自動戻り | 1.02秒 | 1.18秒（幅の外は wrist_flex +40.8° だけ） |
| 力を入れたままポートを閉じた | なし | なし |
| 始める前の Torque_Enable | 全軸 0 | 全軸 0 |

切られたのは始めの寄りだけで、依頼260 で決めた仕様どおり（休みの姿勢から最初のコマへ 10°/コマで寄る）。

## エイイチの答え
| 問い | 答え |
|---|---|
| 10回とも、ブロックが箱に入った？ | n（入らなかったのは 1回目・2回目） |
| 録っている最中に、フォロワーがガクッと飛んだ回はあった？ | n（なかった） |
| 1回目の replay で、フォロワーは録ったとおりに動いた？ | y |
| 3回目の replay で、ブロックは箱に入った？ | **y** |
| 3回目の replay で、フォロワーは録ったとおりに動いた？ | **y** |

## 失敗の回の記録・KIOXIA へのコピー
- `~/so101_datasets/so101_redblock_box_teleop_v1/episode_labels.json`：index 0・1 は fail、2〜9 は success、判定した人はエイイチ、日付は 2026-11-23。dataset の meta・data・videos は変えていない（LeRobot はこのファイルを読まない）。
- コピー先は `/Volumes/KIOXIA/r2r2r-data/datasets/so101_redblock_box_teleop_v1/`（同じ名前はなかった）。Mac 側は消していない。`_crash_1712_dataset` は写していない。
- 確かめ：ファイル 8（dataset の 7 と labels）、合計 39,980,625 バイト（約 38.1 MiB）で両方一致。各ファイルの大きさと sha1 も一致。KIOXIA（exFAT）には macOS が `._*` のファイルを自分で作った（中身のファイルではない）。

## 本番の回数に進めるか
進める状態にある。record・replay は通った。録っている最中の切れ・飛び・映像の欠けは 0 で、replay も録ったとおりに動いた（2回とも y）。3回目の replay ではブロックも箱に入った。ただし、本番の回数・失敗の回を学習に入れるかどうか・始めの寄り（10°/コマ）をこのままにするかは、エイイチが決める。

## 残したもの（git には入れない。check_268 と同じ扱い）
- `check_274/`：run_274.py・analyze_274.py・analysis_274.json・frames/・events・results・stdout（各回）・crash_171249.ips・step1_record.json・step2_replay.json・この REPORT.md
- `check_276/`：run_276.py（run_274.py を読み込み、episode 2 の replay だけを行う）・events_276.jsonl・results_276.json・step_replay_ep2.json・run_276_stdout.log・read_servos_last.txt
```


## 次に決めること ― 本番の回数と、失敗の回の扱い

ここで記録として区切ったので、次の4つはまだ決まっていない。図解の「次に決めること」のタブにも同じ表を載せている。

| 決めること | おすすめ | 理由 |
|---|---|---|
| 本番で録る回数 | あと40回（10回ずつ4回） | 成功した8回と合わせて、成功が約50回になる。1回約1分なので、10回ずつなら1回10分ほどで区切れる |
| 入らなかった2回を学習に使うか | 学習には入れず、記録には残す | このシリーズは失敗から学ぶアームを作るので、あとで失敗の例として使える |
| 再生の始めの寄せ（1コマ 10°） | 今のまま | 目で見て飛んでいなかった |
| 失敗の印のファイルの置き場所 | データセットのフォルダの中のまま | データセットと一緒に動くので、離れてなくなる心配がない |


## 作業ログ ― 使ったコード（全量）

### so101/check_274/run_274.py

```python
"""依頼 274: SO-101 のお手本 (record) を10回録る (エイイチ立ち会い).

check_268/run_268.py を元にした (run_268.py は書き換えない). 入口は so101/lerobot_safe_259.py の main()
(このプロセスの中で record・replay を呼ぶ). 包まない lerobot のコマンドは使わない.
run_268.py から変えたこと:
  - teleoperate の段の代わりに record を 10回. LeRobot の record_loop を包み (lerobot_record.py は書き換えない),
      各回の前: 「◯回目／10 スペースで始める」(リーダーに従うが録らない)
      録っている間: 回数と残り秒を大きく. → で早めに終える, ← で録り直す
      各回のあと (LeRobot の reset の間): 「◯回目 終わり. ブロックを元の所に置き直して, 腕を休みの姿勢へ」→ スペースで次へ
      10回目のあと: 「爪を閉じる・腕を机の上まで下ろしてたたむ」→ スペース (保存して力が抜ける)
    →・← は手順のウィンドウで受ける (LeRobot のキーの読み取り pynput は macOS でプロセスを止めたので始めない)
  - 録ったあと replay で1回目を再生 (エイイチのスペースで始める. 終わりは lerobot_safe_259 が休みの姿勢へ自動で戻す)
  - 問いは見た物で答える形 (はい = y / いいえ = n). 入らなかった回の番号は数字キーで答える
確認や停止の条件は足していない. q キー = Ctrl-C (run_268 と同じ).

使い方 (conda の lerobot 環境で):  python so101/check_274/run_274.py [--dry]
  --dry: アームにつながず, 画面だけ出す (手順の文を確かめる)
"""

import argparse
import json
import os
import re
import signal
import subprocess
import sys
import time
from pathlib import Path

HERE = Path(__file__).resolve().parent
SO101 = HERE.parent
sys.path.insert(0, str(SO101))
PY = sys.executable
FONT = "/System/Library/Fonts/ヒラギノ角ゴシック W6.ttc"
WIN = "依頼274 手順"
W, H = 1440, 860
RAW2DEG = 360.0 / 4096
N_EP = 10
EP_S = 20.0  # 1回の長さの目安 (LeRobot の episode_time_s. → で早めに終われる)
REPO_ID = "local/so101_redblock_box_teleop_v1"
ROOT = Path.home() / "so101_datasets" / "so101_redblock_box_teleop_v1"  # git の外 (KIOXIA には lerobot_safe_259 が作らせない)
TASK = "Put the red block into the white box"
RECORD = [f"--dataset.repo_id={REPO_ID}", f"--dataset.root={ROOT}", f"--dataset.single_task={TASK}",
          "--dataset.fps=30", f"--dataset.num_episodes={N_EP}", f"--dataset.episode_time_s={EP_S:g}",
          "--dataset.reset_time_s=3600", "--dataset.no_stamp=true"]
REPLAY = [f"--dataset.repo_id={REPO_ID}", f"--dataset.root={ROOT}", "--dataset.episode=0", "--dataset.fps=30"]
KEY_RIGHT, KEY_LEFT = (63235, 2555904, 65363), (63234, 2424832, 65361)  # cv2.waitKeyEx の →・← (mac / win / linux)
PROMPT_TIMEOUT_S = 20 * 60  # 手順の前の待ち (アームは動いていない). 過ぎたら終える
MOTORS = ["shoulder_pan", "shoulder_lift", "elbow_flex", "wrist_flex", "wrist_roll", "gripper"]
JA = {"shoulder_pan": "肩の左右", "shoulder_lift": "肩の上げ下げ", "elbow_flex": "ひじ",
      "wrist_flex": "手首の曲げ", "wrist_roll": "手首のひねり", "gripper": "爪"}
EVENTS = HERE / "events_274.jsonl"


def now():
    return time.strftime("%H:%M:%S")


def ev(kind, **kw):
    row = {"t": time.time(), "clock": now(), "kind": kind, **kw}
    with EVENTS.open("a") as fh:
        fh.write(json.dumps(row, ensure_ascii=False, default=str) + "\n")
    print(f"[274] {row['clock']} {kind} {json.dumps(kw, ensure_ascii=False, default=str)[:400]}", flush=True)


# ---- 画面 -------------------------------------------------------------------------------------

class Screen:
    def __init__(self):
        import cv2
        from PIL import ImageFont
        self.cv2 = cv2
        self.f_big = ImageFont.truetype(FONT, 96)
        self.f_mid = ImageFont.truetype(FONT, 50)
        cv2.namedWindow(WIN, cv2.WINDOW_NORMAL)
        cv2.resizeWindow(WIN, W, H)
        cv2.moveWindow(WIN, 30, 30)
        self._key = None
        self._img = None

    def render(self, title, lines, color=(0, 220, 255), log=True):
        key = (title, tuple(lines), color)
        if key != self._key:
            import numpy as np
            from PIL import Image, ImageDraw
            img = Image.new("RGB", (W, H), (0, 0, 0))
            d = ImageDraw.Draw(img)
            d.text((50, 40), title, font=self.f_big, fill=color)
            for i, ln in enumerate(lines):
                d.text((50, 200 + 72 * i), ln, font=self.f_mid, fill=(255, 255, 255))
            self._img = self.cv2.cvtColor(np.asarray(img), self.cv2.COLOR_RGB2BGR)
            self._key = key
            if log:
                ev("screen", title=title, lines=lines)
        self.cv2.imshow(WIN, self._img)

    def poll(self, ms=1):
        return self.cv2.waitKey(ms) & 0xFF

    def poll_ex(self, ms=1):
        """→・← も見分ける (waitKeyEx). 押されていなければ -1."""
        return self.cv2.waitKeyEx(ms)

    def ask(self, title, lines, keys, color=(0, 220, 255), timeout=None):
        """keys (文字) のどれかが押されるまで待つ. 押された文字を返す. timeout を過ぎたら None."""
        t0 = time.time()
        self.render(title, lines, color)
        while True:
            k = self.poll(50)
            if k != 255 and chr(k) in keys:
                ev("key", title=title, key=chr(k))
                return chr(k)
            if timeout is not None and time.time() - t0 > timeout:
                ev("timeout", title=title)
                return None
            self.render(title, lines, color, log=False)

    def space(self, title, lines, color=(0, 220, 255), timeout=PROMPT_TIMEOUT_S):
        return self.ask(title, lines + ["", "準備ができたら スペース"], " ", color, timeout) == " "

    def yn(self, question, extra=()):
        """見た物で答える問い. はい = y, いいえ = n."""
        k = self.ask("見た物で答える  y / n", [question, *extra, "", "はい = y     いいえ = n"], "yn",
                     timeout=PROMPT_TIMEOUT_S)
        return None if k is None else k == "y"


# ---- 実行中の記録 -----------------------------------------------------------------------------

class Run:
    """1回の lerobot_safe_259.main() の記録と, 毎コマの画面."""

    def __init__(self, name, screen, on_frame=None):
        self.name, self.screen, self.on_frame = name, screen, on_frame
        self.frames = []       # step_limit の呼ばれ方 (毎コマ)
        self.obs = []          # get_observation の結果
        self.a_reads = []      # A の前後の読み
        self.torque_on = []    # 力が入った直後 0.5秒の今の位置
        self.gate = []         # rest_gate・_auto_return の出入り
        self.big_text = []     # lerobot_safe_259 のウィンドウに出た字 (変わったときだけ)
        self.rest_checks = []
        self.torque_kept = False
        self.in_gate = False
        self.label = "start"
        self.t0 = time.perf_counter()
        self.stop_sent = False

    def sigint(self, why):
        ev("sigint", run=self.name, why=why)
        self.stop_sent = True
        os.kill(os.getpid(), signal.SIGINT)

    def save(self):
        out = HERE / f"{self.name}.json"
        out.write_text(json.dumps({k: v for k, v in vars(self).items()
                                   if k not in ("screen", "on_frame")}, ensure_ascii=False, indent=1, default=str))
        return out


CUR = {"run": None}


def install_hooks():
    import lerobot_safe_259 as ls
    from lerobot.robots.so_follower.so_follower import SOFollower

    orig_step = ls.step_limit

    def step_limit(goal, last, limit=ls.STEP_LIMIT):
        out = orig_step(goal, last, limit)
        r = CUR["run"]
        if r is not None:
            g = {m: float(v) for m, v in goal.items()}
            cut = {m: (round(g[m], 2), round(out[m], 2)) for m in g if abs(out[m] - g[m]) > 1e-6}
            r.frames.append({"t": time.perf_counter() - r.t0, "label": r.label, "gate": r.in_gate,
                             "goal": {m: round(v, 2) for m, v in g.items()},
                             "last": {m: round(float(last[m]), 2) for m in g},
                             "sent": {m: round(float(out[m]), 2) for m in g},
                             "present": ({m: r.obs[-1].get(f"{m}.pos") for m in g} if r.obs else None),
                             "cut": cut})
            if r.on_frame is not None and not r.in_gate:
                r.on_frame(r)
        return out

    ls.step_limit = step_limit

    orig_hold = ls.hold_goal_at_present

    def hold_goal_at_present(bus, motors=None, retry=ls.A_RETRY):
        r = CUR["run"]
        pre = {}
        if r is not None:
            try:  # 読むだけ (A の前に Goal が何を指していたか = A がなければ力が入る瞬間に向かった先)
                pre["goal"] = bus.sync_read("Goal_Position", motors, normalize=False, num_retry=2)
                pre["present"] = bus.sync_read("Present_Position", motors, normalize=False, num_retry=2)
            except Exception as e:
                pre["error"] = repr(e)
        raw = orig_hold(bus, motors, retry)
        if r is not None:
            row = {"port": bus.port, "t": time.perf_counter() - r.t0, "written": dict(raw), **pre}
            if "goal" in pre:
                row["goal_minus_present_deg"] = {m: round((int(pre["goal"][m]) - int(pre["present"][m])) * RAW2DEG, 2)
                                                 for m in pre["goal"]}
            r.a_reads.append(row)
        return raw

    ls.hold_goal_at_present = hold_goal_at_present

    orig_guard = ls.guard_bus

    def guard_bus(bus, role, on_connect, on_before_torque=None, lock=None):
        orig_guard(bus, role, on_connect, on_before_torque, lock)
        if role != "follower" or getattr(bus, "_p274", False):
            return
        enable = bus.enable_torque

        def enable_torque(motors=None, num_retry=0):
            enable(motors, num_retry=num_retry)
            r = CUR["run"]
            if r is None:
                return
            fa = [a for a in r.a_reads if a["port"] == bus.port]
            base = fa[-1]["written"] if fa else None
            t_on = time.perf_counter()
            samples = []
            while time.perf_counter() - t_on < 0.5:  # 力が入った直後 0.5秒の今の位置 (読むだけ)
                try:
                    p = bus.sync_read("Present_Position", motors, normalize=False, num_retry=2)
                    samples.append({"dt": round(time.perf_counter() - t_on, 3), **{m: int(v) for m, v in p.items()}})
                except Exception as e:
                    samples.append({"error": repr(e)})
                time.sleep(0.02)
            mx = {}
            if base:
                for m in base:
                    vals = [s[m] for s in samples if m in s]
                    if vals:
                        mx[m] = round(max(abs(v - int(base[m])) for v in vals) * RAW2DEG, 2)
            r.torque_on.append({"t": t_on - r.t0, "base": dict(base or {}), "max_diff_deg": mx, "samples": samples})
            ev("torque_on", run=r.name, max_diff_deg=mx)

        bus.enable_torque = enable_torque
        bus._p274 = True

    ls.guard_bus = guard_bus

    orig_gate = ls.rest_gate

    def rest_gate(follower, leader=None, **kw):
        r = CUR["run"]
        t = time.perf_counter()
        if r is not None:
            r.in_gate = True
            r.gate.append({"what": "rest_gate_start", "t": t - r.t0, "leader": leader is not None})
        try:
            res = orig_gate(follower, leader, **kw)
            if r is not None:
                r.gate.append({"what": "rest_gate_end", "t": time.perf_counter() - r.t0, "result": res,
                               "dur_s": round(time.perf_counter() - t, 2)})
            return res
        except BaseException as e:
            if r is not None:
                r.gate.append({"what": "rest_gate_exc", "t": time.perf_counter() - r.t0, "exc": repr(e),
                               "dur_s": round(time.perf_counter() - t, 2)})
            raise
        finally:
            if r is not None:
                r.in_gate = False

    ls.rest_gate = rest_gate

    orig_auto = ls._auto_return

    def _auto_return(follower, ui, center, tol, sleep):
        r = CUR["run"]
        t = time.perf_counter()
        res = orig_auto(follower, ui, center, tol, sleep)
        if r is not None:
            r.gate.append({"what": "auto_return", "t": t - r.t0, "result": res,
                           "dur_s": round(time.perf_counter() - t, 2)})
        return res

    ls._auto_return = _auto_return

    orig_rc = ls.rest_check

    def rest_check(pos, center, tol):
        ok, diff = orig_rc(pos, center, tol)
        r = CUR["run"]
        if r is not None and r.in_gate:
            r.rest_checks.append({"t": round(time.perf_counter() - r.t0, 3), "ok": ok,
                                  "diff": {m: round(v, 2) for m, v in diff.items()}})
        return ok, diff

    ls.rest_check = rest_check

    orig_close = ls.close_without_torque_off

    def close_without_torque_off(follower):
        r = CUR["run"]
        if r is not None:
            r.torque_kept = True
            ev("torque_kept_port_closed", run=r.name)
        return orig_close(follower)

    ls.close_without_torque_off = close_without_torque_off

    orig_show, orig_key = ls.BigTextUI.show, ls.BigTextUI.key

    def show(self, title, lines, color=(0, 200, 255)):
        r = CUR["run"]
        if r is not None and (not r.big_text or r.big_text[-1]["title"] != title):
            r.big_text.append({"t": time.perf_counter() - r.t0, "title": title, "lines": list(lines)})
            ev("lerobot_safe_window", run=r.name, title=title)
        if r is not None and r.in_gate and getattr(self, "cv2", None) is not None and r.rest_checks:
            return show_rest_big(self, title, lines, color, r)
        return orig_show(self, title, lines, color)

    def key(self, ms=1):
        k = orig_key(self, ms)
        r = CUR["run"]
        if r is not None and k in (ord("q"), 27):
            r.sigint("q (lerobot_safe のウィンドウ)")
        return k

    ls.BigTextUI.show, ls.BigTextUI.key = show, key

    orig_obs = SOFollower.get_observation

    def get_observation(self):
        obs = orig_obs(self)
        r = CUR["run"]
        if r is not None:
            r.obs.append({"t": round(time.perf_counter() - r.t0, 3), "label": r.label,
                          **{k: round(float(v), 2) for k, v in obs.items() if k.endswith(".pos")}})
        return obs

    SOFollower.get_observation = get_observation
    return ls


def run_safe(ls, name, argv, screen, on_frame=None):
    r = Run(name, screen, on_frame)
    CUR["run"] = r
    ev("run_start", run=name, argv=argv)
    result = {"name": name, "exc": None}
    try:
        result["ret"] = ls.main(argv)
    except KeyboardInterrupt:
        result["exc"] = "KeyboardInterrupt"
    except BaseException as e:  # 通信が返らない など
        result["exc"] = repr(e)
    finally:
        CUR["run"] = None
        try:
            screen.cv2.destroyWindow(ls.WIN)
        except Exception:
            pass
    result["torque_kept"] = r.torque_kept
    result["file"] = str(r.save())
    ev("run_end", **result)
    return r, result


# ---- 読むだけで力の状態を見る ---------------------------------------------------------------

def torque_all_zero():
    p = subprocess.run([PY, str(SO101 / "read_servos_248.py")], capture_output=True, text=True, timeout=60)
    text = p.stdout
    (HERE / "read_servos_last.txt").write_text(text)
    blocks = {}
    port = None
    for ln in text.splitlines():
        if ln.startswith("== "):
            port = ln[3:].strip()
            blocks[port] = []
        m = re.match(r"^\s+(\d)\s+777\s+\S+\s+(\d+)\s+\S+\s+\d+\s+(\d)\s+\d", ln)
        if m and port:
            blocks[port].append((int(m.group(1)), int(m.group(2)), int(m.group(3))))
    fol = blocks.get("/dev/tty.usbmodem5CBC4321631", [])
    ok = len(fol) == 6 and all(t == 0 for _, _, t in fol)
    ev("read_servos", follower=fol, leader=blocks.get("/dev/tty.usbmodem5CBC4323581", []), ok=ok)
    return ok, fol




# ---- 休みの姿勢の待ちの絵 (lerobot_safe_259 の BigTextUI.show を包む) ---------------------------

_REST_FONTS = {}


def show_rest_big(ui, title, lines, color, r):
    """幅の外の関節名とずれを大きく出す. 値は rest_check の記録 (lerobot_safe_259 の判定そのもの) から取る."""
    import numpy as np
    from PIL import Image, ImageDraw, ImageFont
    import lerobot_safe_259 as ls
    if not _REST_FONTS:
        _REST_FONTS.update(big=ImageFont.truetype(FONT, 64), huge=ImageFont.truetype(FONT, 76),
                           mid=ImageFont.truetype(FONT, 34))
    _, tol = ls.load_rest_pose()
    diff = r.rest_checks[-1]["diff"]
    out = [m for m in MOTORS if abs(diff[m]) > tol[m]]
    img = Image.new("RGB", (1280, 720), (0, 0, 0))
    d = ImageDraw.Draw(img)
    d.text((40, 30), title, font=_REST_FONTS["big"], fill=color)
    y = 130
    if out:
        d.text((40, y), "幅の外 (ここを戻す):", font=_REST_FONTS["mid"], fill=(255, 255, 255))
        y += 50
        for m in out[:4]:
            d.text((40, y), f"{JA[m]}  {diff[m]:+.0f}°  (幅 {tol[m]:.0f})", font=_REST_FONTS["huge"],
                   fill=(60, 60, 255))
            y += 100
    else:
        d.text((40, y + 40), "全部 幅の中. そのまま止める", font=_REST_FONTS["huge"], fill=(80, 255, 80))
        y += 200
    y = max(y + 10, 560)
    d.text((40, y), "爪を閉じる・腕を机の上まで下ろしてたたむ", font=_REST_FONTS["mid"], fill=(255, 255, 255))
    for i, ln in enumerate(lines[-2:]):
        d.text((40, y + 45 + 40 * i), ln, font=_REST_FONTS["mid"], fill=(180, 180, 180))
    ui.cv2.imshow(ls.WIN, ui.cv2.cvtColor(np.asarray(img), ui.cv2.COLOR_RGB2BGR))
    try:
        ui.cv2.moveWindow(ls.WIN, 60, 60)
    except Exception:
        pass
    key = tuple(out)
    if getattr(r, "_rest_out_last", None) != key:  # 幅の外の顔ぶれが変わったときだけ記録
        r._rest_out_last = key
        ev("rest_out_joints", run=r.name, out={m: diff[m] for m in out})


# ---- 手順 -----------------------------------------------------------------------------------

RESULTS = {}
REC = {"phase": None, "ep": 0, "try": 0, "t": None, "events": None, "wait": None, "n": 0, "attempts": []}


def stop_screen(screen):
    """止まった・通信が返らない・力を入れたままポートを閉じた ときの画面."""
    screen.ask("支える → 電源を切る", ["フォロワーを手で支える", "フォロワーの電源を切る",
                                     "", "電源を切ったら スペース"], " ", color=(0, 0, 255), timeout=1800)


def big(sc, top, mid, small, color=(0, 220, 255)):
    """回数と残り秒を大きな字で."""
    import numpy as np
    from PIL import Image, ImageDraw, ImageFont
    if not hasattr(sc, "f_huge"):
        sc.f_huge = ImageFont.truetype(FONT, 200)
    img = Image.new("RGB", (W, H), (0, 0, 0))
    d = ImageDraw.Draw(img)
    d.text((50, 20), top, font=sc.f_huge, fill=color)
    d.text((50, 260), mid, font=sc.f_huge, fill=(255, 255, 255))
    for i, ln in enumerate(small):
        d.text((50, 560 + 66 * i), ln, font=sc.f_mid, fill=(200, 200, 200))
    sc._img = sc.cv2.cvtColor(np.asarray(img), sc.cv2.COLOR_RGB2BGR)
    sc._key = None
    sc.cv2.imshow(WIN, sc._img)


def on_frame(r):
    """毎コマ (send_action のたび) 画面を出し, キーを見る."""
    REC["n"] += 1
    sc = r.screen
    k = sc.poll_ex(1)
    if k in (ord("q"), 27) and not r.stop_sent:
        r.sigint("q (手順のウィンドウ)")
        return
    ph, ev_, w = REC["phase"], REC["events"], REC["wait"]
    n = REC["ep"] + 1
    if ev_ is not None and k in KEY_LEFT and ph in ("episode", "reset", "end"):
        ev("key", phase=ph, ep=n, key="left")
        ev_["rerecord_episode"] = True
        if ph == "episode":
            ev_["exit_early"] = True
        if ph == "end":  # 10回目のあと ← : LeRobot の reset (録り直しの画面) へ進む
            w["exit_early"] = True
    if ev_ is not None and k in KEY_RIGHT and ph == "episode":
        ev("key", phase=ph, ep=n, key="right")
        ev_["exit_early"] = True
    if ph == "start":
        r.label = "start_wait"
        sc.render(f"{n}回目／{N_EP}　スペースで始める",
                  ["ブロックは机の決まった所", "リーダーとフォロワーの姿勢を近づける",
                   "スペースで 録り始める (最長 20秒)", "入れ終わったら → で早めに終える",
                   "(止めたいとき: q)"])
        if k == ord(" ") and w is not None:
            ev("key", phase=ph, ep=n, key="space")
            w["exit_early"] = True
    elif ph == "episode":
        r.label = f"ep{n}_try{REC['try']}"
        if REC["n"] % 3 == 0:
            left = max(0.0, EP_S - (time.perf_counter() - REC["t"]))
            big(sc, f"{n}回目／{N_EP}", f"残り {left:4.1f} 秒",
                ["入れ終わったら → で終える", "うまくいかなかったら ← で録り直す", "(止めたいとき: q)"],
                color=(60, 60, 255))
    elif ph == "reset":
        r.label = "reset"
        if ev_ is not None and ev_["rerecord_episode"]:
            sc.render(f"{n}回目 を録り直す", ["ブロックを元の所に置き直して", "腕を休みの姿勢へ",
                                           f"スペースで もう一度 {n}回目へ"], color=(0, 160, 255))
        else:
            sc.render(f"{n}回目 終わり", ["ブロックを元の所に置き直して", "腕を休みの姿勢へ",
                                       "スペースで次へ", "うまくいかなかった回は ← で録り直す"])
        if k == ord(" "):
            ev("key", phase=ph, ep=n, key="space", rerecord=bool(ev_ and ev_["rerecord_episode"]))
            w["exit_early"] = True
    elif ph == "end":
        r.label = "end_wait"
        sc.render(f"{n}回目 終わり (これで{N_EP}回)", ["リーダーで 爪を閉じる",
                                                 "腕を机の上まで下ろして たたむ (休みの姿勢)",
                                                 "たたんだら スペース (保存して 力が抜ける)",
                                                 "幅の外だと 赤い字で関節名が出る → そこを戻す",
                                                 "うまくいかなかったら ← で録り直す"])
        if k == ord(" "):
            ev("key", phase=ph, ep=n, key="space")
            w["exit_early"] = True
    if w is not None and ev_ is not None and ev_["stop_recording"]:
        w["exit_early"] = True


def install_record_hooks():
    """LeRobot の record_loop・save_episode を包む (lerobot_record.py は書き換えない)."""
    import lerobot.scripts.lerobot_record as rec
    from lerobot.datasets.lerobot_dataset import LeRobotDataset
    orig_loop = rec.record_loop

    def wait(kw, phase):
        REC["phase"], REC["wait"] = phase, {"exit_early": False, "rerecord_episode": False, "stop_recording": False}
        ev("phase", phase=phase, ep=REC["ep"] + 1)
        t = time.perf_counter()
        orig_loop(**dict(kw, dataset=None, events=REC["wait"], control_time_s=3600 * 4, timer=None))
        ev("phase_end", phase=phase, ep=REC["ep"] + 1, dur_s=round(time.perf_counter() - t, 2))
        REC["wait"] = None

    def record_loop(*a, **kw):
        assert not a, "record_loop はキーワード引数で呼ばれる想定"
        events, ds = kw["events"], kw.get("dataset")
        REC["events"] = events
        if ds is None:  # LeRobot の reset の間
            return wait(kw, "reset")
        ep = ds.num_episodes
        REC["try"] = REC["try"] + 1 if ep == REC["ep"] and REC["attempts"] else 1
        REC["ep"] = ep
        wait(kw, "start")
        if events["stop_recording"]:
            REC["phase"] = None
            return None
        events["exit_early"] = events["rerecord_episode"] = False  # 待ちの間のキーは持ち越さない
        REC["phase"], REC["t"] = "episode", time.perf_counter()
        ev("episode_start", ep=ep + 1, try_=REC["try"])
        try:
            ret = orig_loop(*a, **kw)
        finally:
            dur = time.perf_counter() - REC["t"]
            size = (getattr(ds, "writer", None) and ds.writer.episode_buffer or {}).get("size")
            how = ("left" if events["rerecord_episode"] else "esc" if events["stop_recording"]
                   else "right" if dur < EP_S - 0.2 else "time")
            att = {"ep": ep + 1, "try": REC["try"], "dur_s": round(dur, 2), "buffer_frames": size, "end": how,
                   "label": f"ep{ep + 1}_try{REC['try']}"}
            REC["attempts"].append(att)
            ev("episode_end", **att)
            REC["phase"] = None
        if ep == N_EP - 1 and not events["rerecord_episode"] and not events["stop_recording"]:
            wait(kw, "end")  # 10回目のあと: たたんでから保存・力を抜く (例外で抜けたときは通らない)
        return ret

    rec.record_loop = record_loop

    def init_keyboard_listener():
        # LeRobot のキー読み取り (pynput) は別スレッドから macOS の入力の関数を呼び, macOS がプロセスを止める
        # (2回目の実行 17:12:49 に SIGTRAP. crash_171249.ips). 読み取りは始めず, →・← は手順のウィンドウで受ける
        ev("keyboard_listener", note="pynput を使わない (手順のウィンドウで →・← を受ける)")
        return None, {"exit_early": False, "rerecord_episode": False, "stop_recording": False}

    rec.init_keyboard_listener = init_keyboard_listener

    orig_save, orig_clear = LeRobotDataset.save_episode, LeRobotDataset.clear_episode_buffer

    def save_episode(self, *a, **kw):
        sc = CUR["run"].screen if CUR["run"] else None
        n = self.num_episodes + 1
        if sc is not None:
            sc.render(f"{n}回目 を保存中", ["動画を書いている (数秒)", "腕はそのまま"], log=False)
            sc.poll(1)
        t = time.perf_counter()
        out = orig_save(self, *a, **kw)
        ev("saved", ep=n, dur_s=round(time.perf_counter() - t, 2), num_episodes=self.num_episodes)
        if REC["attempts"]:
            REC["attempts"][-1]["saved_as"] = self.num_episodes - 1
        return out

    def clear_episode_buffer(self, *a, **kw):
        ev("discarded", ep=self.num_episodes + 1)
        if REC["attempts"]:
            REC["attempts"][-1]["saved_as"] = None
        return orig_clear(self, *a, **kw)

    LeRobotDataset.save_episode, LeRobotDataset.clear_episode_buffer = save_episode, clear_episode_buffer


def label_stats(frames, label):
    fs = [f for f in frames if f["label"] == label and not f["gate"]]
    out = {"frames": len(fs), "cut_frames": sum(1 for f in fs if f["cut"]),
           "cut_examples": [f["cut"] for f in fs if f["cut"]][:5]}
    if len(fs) > 1:
        out["hz"] = round((len(fs) - 1) / (fs[-1]["t"] - fs[0]["t"]), 2)
        step = {m: 0.0 for m in MOTORS}
        for a, b in zip(fs, fs[1:]):
            for m in MOTORS:
                step[m] = max(step[m], abs(b["goal"][m] - a["goal"][m]))
        out["leader_step_max"] = {m: round(v, 2) for m, v in step.items()}
    return out


def ask_numbers(screen, question):
    """番号を数字キーで答える (1〜9, 10回目は 0). Enter で決める. 押し直すと外れる."""
    chosen = []
    while True:
        k = screen.ask("見た物で答える  番号", [question, "1〜9 を押す (10回目は 0)・押し直すと外れる",
                                               "選んだ: " + (" ".join(str(c) for c in sorted(chosen)) or "なし"),
                                               "", "決めたら Enter"], "0123456789\r\n", timeout=PROMPT_TIMEOUT_S)
        if k is None or k in "\r\n":
            return sorted(chosen)
        v = 10 if k == "0" else int(k)
        chosen.remove(v) if v in chosen else chosen.append(v)


def gate_summary(r, out):
    out["gate"] = r.gate
    waits = [g for g in r.gate if g["what"] in ("rest_gate_end", "rest_gate_exc")]
    out["rest_wait_s"] = round(sum(g["dur_s"] for g in waits), 2) if waits else None
    out["rest_wait_each_s"] = [(g.get("result") or g.get("exc"), g["dur_s"]) for g in waits]
    out["torque_on"] = [x["max_diff_deg"] for x in r.torque_on]
    out["cut_frames_gate"] = sum(1 for f in r.frames if f["gate"] and f["cut"])


def step0(screen):
    ok, fol = torque_all_zero()
    RESULTS["0"] = {"torque_zero": ok, "follower": fol}
    if not ok:
        screen.ask("力が入っている (始めない)", ["フォロワーの Torque が 0 ではない", f"{fol}",
                                            "支える → 電源を切る", "", "スペースで終える"], " ",
                   color=(0, 0, 255), timeout=1800)
        return False
    return screen.space("0. 始める前", ["ブロックを机の決まった所に置く",
                                       "リーダーとフォロワーの姿勢を近づける",
                                       "フォロワーのまわりを空ける・電源をすぐ切れるようにする",
                                       "次のスペースで つなぐ (力が入る. まだ録らない)",
                                       "(止めたいとき: q キー = Ctrl-C)"])


def step1(screen, ls):
    r, res = run_safe(ls, "step1_record", ["record", *RECORD], screen, on_frame)
    out = {"run": res, "attempts": REC["attempts"]}
    for a in REC["attempts"]:
        a.update(label_stats(r.frames, a["label"]))
    out["cut_frames_by_label"] = {}
    for f in r.frames:
        if f["cut"]:
            key = ("gate:" if f["gate"] else "") + f["label"]
            out["cut_frames_by_label"][key] = out["cut_frames_by_label"].get(key, 0) + 1
    gate_summary(r, out)
    RESULTS["1"] = out
    if res["torque_kept"] or res["exc"] not in (None, "KeyboardInterrupt"):
        stop_screen(screen)
        return False
    all_in = screen.yn(f"{N_EP}回とも, ブロックが箱に入った？")
    out["yn_all_in_box"] = all_in
    if all_in is False:
        out["not_in_box"] = ask_numbers(screen, "ブロックが箱に入らなかった回の番号は？")
    out["yn_jump"] = screen.yn("録っている最中に, フォロワーが ガクッと飛んだ回は あった？",
                               ["(y = 飛んだ回があった / n = なかった)"])
    if out["yn_jump"]:
        out["jump_eps"] = ask_numbers(screen, "ガクッと飛んだ回の番号は？ (分からなければ そのまま Enter)")
    return True


def step2(screen, ls):
    if not screen.space("2. replay (1回目を再生)", ["フォロワーのまわりを空ける", "ブロックを元の所に置く",
                                                    "スペースで replay を始める (力が入る)",
                                                    "終わると 休みの姿勢へ自動で戻る", "(止めたいとき: q)"]):
        return False
    st = {"n": 0}

    def on_rep(r):
        st["n"] += 1
        sc = r.screen
        k = sc.poll(1)
        if k in (ord("q"), 27) and not r.stop_sent:
            r.sigint("q (手順のウィンドウ)")
            return
        r.label = "replay"
        if st["n"] % 3 == 1:
            big(sc, "replay 1回目", f"{st['n'] / 30:4.1f} 秒",
                ["終わると 休みの姿勢へ自動で戻る", "当たりそうなら q (= Ctrl-C)"])

    r, res = run_safe(ls, "step2_replay", ["replay", *REPLAY], screen, on_rep)
    out = {"run": res, "replay": label_stats(r.frames, "replay")}
    gate_summary(r, out)
    RESULTS["2"] = out
    if res["torque_kept"] or res["exc"] not in (None, "KeyboardInterrupt"):
        stop_screen(screen)
        return False
    out["yn_replay_same"] = screen.yn("replay で, フォロワーは 録ったとおりに動いた？")
    return True


def main():
    ap = argparse.ArgumentParser()
    ap.add_argument("--dry", action="store_true")
    ap.add_argument("--replay-only", action="store_true",
                    help="replay だけ (record と同じプロセスで2回目の main() を呼ぶと, record のカメラの設定が残って止まるため)")
    args = ap.parse_args()
    screen = Screen()
    ev("start", dry=args.dry)
    if args.dry:
        REC.update(phase="start", ep=2)

        class R:
            pass
        r = R()
        r.screen, r.stop_sent, r.label = screen, False, ""
        t0 = time.perf_counter()
        for ph in ("start", "episode", "reset", "end"):
            REC.update(phase=ph, t=time.perf_counter())
            t0 = time.perf_counter()
            while time.perf_counter() - t0 < 1.5:
                on_frame(r)
                time.sleep(0.03)
            screen.cv2.imwrite(str(HERE / f"dry_{ph}.png"), screen._img)
        return 0
    if args.replay_only:
        import lerobot_safe_259 as _  # noqa: F401,F811
        ls = install_hooks()
        try:
            if not screen.space("replay の前", ["フォロワーの電源が入っていることを確かめる",
                                              "フォロワーのまわりを空ける"]):
                return 1
            ok, fol = torque_all_zero()
            RESULTS["0"] = {"torque_zero": ok, "follower": fol}
            if not ok:
                screen.ask("力が入っている・読めない (始めない)", ["フォロワーの Torque が 0 ではない (または読めない)",
                                                           f"{fol}", "", "スペースで終える"], " ",
                           color=(0, 0, 255), timeout=1800)
                return 1
            if not step2(screen, ls):
                return 2
            screen.space("おわり", ["手順はすべて終わった", "フォロワーの電源を切ってよい"], timeout=600)
            return 0
        finally:
            (HERE / "results_274_replay.json").write_text(json.dumps(RESULTS, ensure_ascii=False, indent=1,
                                                                     default=str))
            ev("end")
    if ROOT.exists():
        ev("abort", why=f"{ROOT} がすでにある")
        print(f"[274] {ROOT} がすでにある. 止める")
        return 3
    ROOT.parent.mkdir(parents=True, exist_ok=True)
    import lerobot_safe_259 as _  # noqa: F401  (先に読み込んでから包む)
    ls = install_hooks()
    install_record_hooks()
    try:
        if not step0(screen):
            return 1
        if not step1(screen, ls):
            return 2
        if not step2(screen, ls):
            return 2
        screen.space("おわり", ["手順はすべて終わった", "フォロワーの電源を切ってよい"], timeout=600)
        return 0
    finally:
        (HERE / "results_274.json").write_text(json.dumps(RESULTS, ensure_ascii=False, indent=1, default=str))
        ev("end")


if __name__ == "__main__":
    sys.exit(main())
```

### so101/check_274/analyze_274.py

```python
"""依頼 274: 録ったお手本 (~/so101_datasets/so101_redblock_box_teleop_v1) を読むだけで確かめる.

  - 回数・各回のコマ数と長さ・1秒あたりのコマ数 (記録の timestamp と, run_274 が測った実際の周期)
  - 映像2台が全部の回にあるか. 真っ黒・白飛び・止まったコマ. 各回の最初・真ん中・最後の1コマを frames/ に保存
  - 角度 (observation.state・action) が全部の回にあるか. 1コマ 10° を超える差 (爪は 20)
結果は analysis_274.json に書く. 記録は書き換えない.

使い方 (conda の lerobot 環境で):  python so101/check_274/analyze_274.py
"""

import json
import sys
from pathlib import Path

import av
import numpy as np
import pandas as pd
from PIL import Image

HERE = Path(__file__).resolve().parent
ROOT = Path.home() / "so101_datasets" / "so101_redblock_box_teleop_v1"
MOTORS = ["shoulder_pan", "shoulder_lift", "elbow_flex", "wrist_flex", "wrist_roll", "gripper"]
JUMP = {m: 10.0 for m in MOTORS} | {"gripper": 20.0}  # B と同じ幅 (関節 10°, 爪 20)
BLACK, WHITE = 16, 245  # 画素の明るさ (0〜255). 真っ黒・白飛びの目安
BAD_FRAC = 0.9          # コマの 9割がこれなら「真っ黒」「白飛び」とする
STILL_DIFF = 0.3        # 前のコマとの差 (縮めた灰色の平均の絶対差) がこれ未満なら「止まった」とみる


def read_parquets(pattern):
    files = sorted(ROOT.glob(pattern))
    return pd.concat([pd.read_parquet(f) for f in files], ignore_index=True) if files else pd.DataFrame()


def decode(path):
    """mp4 の全部のコマを (時刻, 灰色を縮めたもの, 元の RGB は呼ぶ側で必要なときだけ) で返す."""
    out = []
    with av.open(str(path)) as c:
        s = c.streams.video[0]
        for fr in c.decode(s):
            out.append((float(fr.pts * s.time_base), fr))
    return out


def main():
    global ROOT, HERE
    if len(sys.argv) > 2:  # 試し: 別の記録と書き出し先 (python analyze_274.py <root> <out>)
        ROOT, HERE = Path(sys.argv[1]), Path(sys.argv[2])
        HERE.mkdir(parents=True, exist_ok=True)
    info = json.loads((ROOT / "meta" / "info.json").read_text())
    fps = info["fps"]
    eps = read_parquets("meta/episodes/*/*.parquet").sort_values("episode_index")
    data = read_parquets("data/*/*.parquet")
    cams = [k for k, v in info["features"].items() if v["dtype"] == "video"]
    res = {"root": str(ROOT), "fps": fps, "total_episodes": info.get("total_episodes"),
           "total_frames": info.get("total_frames"), "cameras": cams, "episodes": []}
    run = {}
    rp = HERE / "results_274.json"
    if rp.exists():
        att = json.loads(rp.read_text()).get("1", {}).get("attempts", [])
        run = {a["saved_as"]: a for a in att if a.get("saved_as") is not None}
    (HERE / "frames").mkdir(exist_ok=True)
    videos = {}
    for _, e in eps.iterrows():
        i = int(e["episode_index"])
        d = data[data.episode_index == i].sort_values("frame_index")
        row = {"ep": i + 1, "length": int(e["length"]), "rows": len(d)}
        ts = d["timestamp"].to_numpy()
        row["dur_s"] = round(len(d) / fps, 2)
        row["ts_step_ms"] = [round(float(np.diff(ts).min()) * 1000, 2), round(float(np.diff(ts).max()) * 1000, 2)] \
            if len(ts) > 1 else None
        if i in run:
            row["real_hz"] = run[i].get("hz")
            row["real_dur_s"] = run[i].get("dur_s")
            row["cut_frames"] = run[i].get("cut_frames")
            row["try"] = run[i].get("try")
            row["end"] = run[i].get("end")
        for col in ("observation.state", "action"):
            a = np.stack(d[col].to_numpy()) if len(d) else np.zeros((0, 6))
            ok = a.shape == (len(d), 6) and bool(np.isfinite(a).all())
            step = np.abs(np.diff(a, axis=0)) if len(a) > 1 else np.zeros((0, 6))
            row[col] = {"present": ok,
                        "step_max": {m: round(float(step[:, j].max()), 2) if len(step) else 0.0
                                     for j, m in enumerate(MOTORS)},
                        "jumps": {m: int((step[:, j] > JUMP[m]).sum()) for j, m in enumerate(MOTORS)
                                  if len(step) and (step[:, j] > JUMP[m]).any()}}
        for cam in cams:
            k = f"videos/{cam}/"
            p = ROOT / info["video_path"].format(video_key=cam, chunk_index=int(e[k + "chunk_index"]),
                                                file_index=int(e[k + "file_index"]))
            if p not in videos:
                videos[p] = decode(p)
            t0, t1 = float(e[k + "from_timestamp"]), float(e[k + "to_timestamp"])
            frs = [fr for t, fr in videos[p] if t0 - 1e-4 <= t < t1 - 1e-4]
            v = {"file": str(p.relative_to(ROOT)), "frames": len(frs), "black": 0, "white": 0, "still": 0,
                 "still_run_max": 0, "mean": None}
            prev, run_len, means = None, 0, []
            for fr in frs:
                g = np.asarray(fr.to_image().convert("L").resize((160, 120)), dtype=np.float32)
                means.append(float(g.mean()))
                v["black"] += int((g < BLACK).mean() >= BAD_FRAC)
                v["white"] += int((g > WHITE).mean() >= BAD_FRAC)
                if prev is not None and float(np.abs(g - prev).mean()) < STILL_DIFF:
                    v["still"] += 1
                    run_len += 1
                    v["still_run_max"] = max(v["still_run_max"], run_len)
                else:
                    run_len = 0
                prev = g
            if means:
                v["mean"] = [round(min(means), 1), round(float(np.mean(means)), 1), round(max(means), 1)]
            for tag, j in (("first", 0), ("mid", len(frs) // 2), ("last", len(frs) - 1)):
                if frs:
                    frs[j].to_image().save(HERE / "frames" / f"ep{i + 1:02d}_{cam.split('.')[-1]}_{tag}.png")
            row[cam] = v
        res["episodes"].append(row)
    (HERE / "analysis_274.json").write_text(json.dumps(res, ensure_ascii=False, indent=1))
    print(f"episodes={len(res['episodes'])} fps={fps}")
    for r in res["episodes"]:
        vs = " ".join(f"{c.split('.')[-1]}:{r[c]['frames']}f 黒{r[c]['black']} 白{r[c]['white']} "
                      f"止{r[c]['still']}(最長{r[c]['still_run_max']})" for c in cams)
        print(f"ep{r['ep']:2d} len={r['length']} {r['dur_s']}s hz={r.get('real_hz')} cut={r.get('cut_frames')} "
              f"state_jumps={r['observation.state']['jumps']} action_jumps={r['action']['jumps']} | {vs}")
    return 0


if __name__ == "__main__":
    sys.exit(main())
```

### so101/check_276/run_276.py

```python
"""依頼 276: SO-101 のお手本の3回目 (dataset の episode index 2) を replay する (エイイチ立ち会い).

check_274/run_274.py を読み込んで使う (run_274.py は書き換えない). run_274.py は episode を引数で受けないため,
replay の段だけここに書いた. 入口は so101/lerobot_safe_259.py の main() の replay (このプロセスの中で呼ぶ).
包まない lerobot のコマンドは使わない. 画面の流れ・休みの姿勢への自動戻り・q キー = Ctrl-C は run_274 の
--replay-only と同じ. run_274 から変えたこと:
  - episode を 2 (3回目) にした. 画面の文も「3回目」
  - 始める前の読み (Torque_Enable) でフォロワーのサーボが1つも見えないときは「フォロワーの電源を入れて スペース」で
    待って読み直す (6個見えて全部 0 なら進む. 力が入っている・数が合わないときは始めない)
  - 終わったら見た物で2問 (ブロックは箱に入った？ / 録ったとおりに動いた？)
記録 (events・results・毎コマ) は check_276/ に書く.

使い方 (conda の lerobot 環境で):  python so101/check_276/run_276.py
"""

import json
import sys
from pathlib import Path

HERE = Path(__file__).resolve().parent
sys.path.insert(0, str(HERE.parent / "check_274"))
import run_274 as r274  # noqa: E402

EPISODE = 2  # dataset の episode index (0 始まり). 3回目
N = EPISODE + 1
r274.HERE = HERE  # Run.save・read_servos_last.txt の置き場所
r274.EVENTS = HERE / "events_276.jsonl"
ev = r274.ev
REPLAY = [f"--dataset.repo_id={r274.REPO_ID}", f"--dataset.root={r274.ROOT}", f"--dataset.episode={EPISODE}",
          "--dataset.fps=30"]
RESULTS = {"episode_index": EPISODE}


def check_torque(screen):
    """フォロワーの Torque_Enable が全軸 0 なら True. サーボが見えなければ電源を入れてもらって読み直す."""
    while True:
        ok, fol = r274.torque_all_zero()
        RESULTS.setdefault("read_servos", []).append({"ok": ok, "follower": fol})
        if ok:
            return True
        if fol:
            screen.ask("力が入っている・数が合わない (始めない)",
                       ["フォロワーの Torque が 0 ではない (またはサーボが6個でない)", f"{fol}", "",
                        "スペースで終える"], " ", color=(0, 0, 255), timeout=1800)
            return False
        if not screen.space("フォロワーの電源を入れて スペース",
                            ["フォロワーのサーボが読めない (電源が切れている)", "フォロワーの電源を入れる"]):
            return False


def replay(screen, ls):
    if not screen.space(f"replay ({N}回目を再生)", ["フォロワーのまわりを空ける", "ブロックを元の所に置く",
                                                   "スペースで replay を始める (力が入る)",
                                                   "終わると 休みの姿勢へ自動で戻る", "(止めたいとき: q)"]):
        return False
    st = {"n": 0}

    def on_rep(r):
        st["n"] += 1
        sc = r.screen
        k = sc.poll(1)
        if k in (ord("q"), 27) and not r.stop_sent:
            r.sigint("q (手順のウィンドウ)")
            return
        r.label = "replay"
        if st["n"] % 3 == 1:
            r274.big(sc, f"replay {N}回目", f"{st['n'] / 30:4.1f} 秒",
                     ["終わると 休みの姿勢へ自動で戻る", "当たりそうなら q (= Ctrl-C)"])

    r, res = r274.run_safe(ls, "step_replay_ep2", ["replay", *REPLAY], screen, on_rep)
    out = {"run": res, "replay": r274.label_stats(r.frames, "replay")}
    r274.gate_summary(r, out)
    RESULTS["replay"] = out
    if res["torque_kept"] or res["exc"] not in (None, "KeyboardInterrupt"):
        r274.stop_screen(screen)
        return False
    out["yn_block_in_box"] = screen.yn("replay で, ブロックは箱に入った？")
    out["yn_replay_same"] = screen.yn("フォロワーは 録ったとおりに動いた？")
    return True


def main():
    screen = r274.Screen()
    ev("start", episode=EPISODE)
    import lerobot_safe_259 as _  # noqa: F401  (先に読み込んでから包む)
    ls = r274.install_hooks()
    try:
        if not screen.space("replay の前", ["フォロワーのまわりを空ける",
                                          "次のスペースで 力が入っていないか読む (読むだけ)"]):
            return 1
        if not check_torque(screen):
            return 1
        if not replay(screen, ls):
            return 2
        screen.space("おわり", ["手順はすべて終わった", "フォロワーの電源を切ってよい"], timeout=600)
        return 0
    finally:
        (HERE / "results_276.json").write_text(json.dumps(RESULTS, ensure_ascii=False, indent=1, default=str))
        ev("end")


if __name__ == "__main__":
    sys.exit(main())
```
