# SO-101 失敗から学ぶアームを作る Log#25 | コードと π0.5 で分担したら、回したブロックだけ外した

- 記録: LOG621（フィジカルAI研究室）
- 公開: 2026/12/1
- 記事のページ: https://pixelstomotors.com/record/so101-switch-code-pi05-rotated-block-miss
- サイト: Pixels to Motors（ADAPT DESIGN / 島津 栄一） https://pixelstomotors.com/
- 要約: ロボットアーム SO-101 で、ブロックの真上まではコード、つかむ所は π0.5 に任せると、まっすぐ置いたブロックは実機で30回すべてつかめた。回して置いた8回では3回、π0.5 が手首カメラの見慣れない絵で早く爪を閉じて空振りした。

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

---

**ロボットアーム [SO-101](https://github.com/TheRobotStudio/SO-ARM100) で、ブロックの真上まではプログラム（コード）が運び、つかむ所だけを Physical Intelligence の AI モデル [π0.5](https://www.physicalintelligence.company/blog/pi05)（パイレイテンゴ）に任せた。まっすぐ置いたブロックは実機で30回すべてつかめた。一方、ブロックを回して置いた8回では、3回が爪を机から5〜9mm 上で閉じて空振りした。π0.5 は手首カメラの映像を見て爪を閉じるタイミングを決めており、お手本にない見え方では早く閉じてしまう。**

この分担で分かったことと、次にやることが決まった。

- π0.5 に任せる範囲をブロックの真上から爪を閉じるまでの約3秒に絞ると、学習データは56本・4,592コマで足りた。学習はクラウド GPU サービス Runpod の A40 を使い、約6.4時間、約590円で終わった。つかみ損ねたときは、コードが爪の開き具合の数値から空振りに気づく。そしてアームを上げて爪を開き、もう一度 π0.5 に操作を任せ直す。
- 空振りの原因は、π0.5 が学んでいない置き方だった。お手本の56本は、ほぼまっすぐ置いたブロックだけだった。プログラムで決めたアームを下ろす深さや、関節の角度の設定に問題があったわけではない。
- 直し方は、回して置いたブロックのお手本を足すことに決まった。コードだけなら回した置き方でも60回中60回つかめているので、お手本の記録はコードだけで録れる。60回分の録り方を AI コーディングツールの Claude Code に依頼した（依頼406・実行中）。
- 手首カメラの映像を真っ黒にして1回だけ動かすと、π0.5 はほとんど下りずに爪を閉じた。たった1回で、AI が何を見て動いているかがはっきりした。

前の回（LOG618）では、つかみ方の決まり rule_401 を、AI の学習を使わないコードだけで実機に流し、56回すべてつかめた。π0.5 につかみ損ねさせていたのは、AI の力不足ではなく、教えていたつかみ方だった。そこで今回は、そのコードの成功56回をお手本にして π0.5 を学び直し、コードと AI で仕事を分けて実機で動かした。

| やったこと | なぜ | 結果 |
|---|---|---|
| コードの成功56回から、ブロックの真上から爪を閉じるまでの82コマだけを切り出し、π0.5 を学習した（依頼403） | AI に任せる範囲を、カメラで見て位置を合わせる必要がある所だけに絞るため | モデル so101h ができた。学習時間は6.35時間、費用は約590円、学習の誤差を示す最後の loss は 0.0010 |
| あらかじめ決めた挟む面ではアームの動く経路を計算できないときだけ、挟む面と爪の傾きを選び直せる仕組みを足した（依頼404） | 回して置いたブロックで、コードが経路を作れず止まってしまう置き方を減らすため | 場所4 で経路を計算できる置き方が、95通り中31通りから95通りすべてに増えた。コードだけで回して置いた4回（−31.5〜+21.8°）もすべてつかめた |
| コード → π0.5 → コードの切り替え方式に、挟めたかの判定とやり直しの処理を加えた（依頼405） | AI が空振りしたときに、そのまま箱へ運んでしまわないようにするため | 爪の開き具合の数値で判定するようにした。過去の記録にある爪を閉じた241回分で試したところ、取り違えは2回だけだった |
| コードと π0.5 の切り替え方式を実機で動かした | 仕事の分担で本当につかめるかを確かめるため | まっすぐ置いた30回は30回すべて成功。回して置いた8回は5回成功した |
| 空振りの原因を記録で調べ、手首カメラの映像を黒くして1回動かした（依頼407） | プログラムで決めた下ろす深さのせいなのか、π0.5 の判断のせいなのかを切り分けるため | π0.5 が手首カメラの映像で爪を閉じる時を決めていた。お手本にない見え方で早く閉じていた |

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

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


## 作業ログ ― この記事に出てくる言葉

ここから下は作業ログで、判断の記録と、依頼文、報告、コード、実機のログを載せる。数字は、ことわりがなければ実機の記録から測った値で、シミュレーションの数字はそのつどシミュレーションの値だと書く。日付はすべて 2026-12-01。

### so101h

π0.5 を、rule_401 のコードだけで成功した56回のうち「ブロックの真上から爪を閉じるまで」だけで学習したモデル（依頼403）。それまでのモデル（so101f・so101g）は、HOME（休みの姿勢）から箱に入れるまでの全部を学んでいた。so101h はつかむ所しか知らないので、ブロックの真上まではコードが運ぶ必要がある。

### 切り替え方式

1回の試行の中で、コードと π0.5 が交代して腕を動かす形（依頼405）。コードがブロックの真上50mm（渡す姿勢、ABOVE_BLOCK）まで運び、π0.5 が寄せて、下りて、爪を閉じる。爪の指令が20を割ったコマでコードに戻り、コードが挟めたかを確かめて、箱へ運ぶかやり直すかを決める。

### 爪の読みと判定

SO-101 の爪のモーターが返す開き具合の値。0が閉じ切り、59が開き切り。ブロック（約2cm）を挟むと10前後で止まる。コードは爪を閉じ切ってから読みが落ち着くのを待ち、9〜12なら「挟んだ」、5未満なら「空」、それ以外は空として扱う。

### 面の選び直し

SO-101 の爪は片側だけが動く。rule_401 は、ブロックのどの2面を挟むか（面）と、手首をどれだけ傾けるか（爪の傾き）を、置き場所ごとの割り振りで決めている。ブロックを回して置くと、割り振りのままでは道が作れないことがある。そのときだけ、面を90°変えたり傾きを選び直したりする（依頼404）。

### 手首カメラ

爪のすぐ上に付いたカメラ。ブロックを真上から近くで見る。π0.5 には、机のカメラの絵と手首カメラの絵と関節の値の3つを渡している。


## so101h の学習 ― コードの成功56回から、つかむ所の82コマだけを切り出した（依頼403）

ブロックをつかむ瞬間だけをAIに学ばせた。LOG618 のあと、プログラムのコードだけで動かした rule_401 の成功56回（場所2・3・4・5 が14回ずつ）を用意した。元の1回は251コマあるが、その中からAIへ動きを渡す姿勢の67コマ目から、爪を閉じ切る148コマ目までの82コマだけを切り出した。できあがったデータセットは56本・4,592コマになり、KIOXIA の `datasets/so101_redblock_box_code_rule401_grasp_v1/` に置いた。

学習にはロボット用AIモデルの π0.5 を使い、元の学習済みモデルである base から、一部だけを軽く学び直す LoRA で3,000ステップ回した。Runpod の A40（1時間0.59ドル）を借りて11:22に始め、17:45に終わった。かかった時間は6.35時間、費用は約3.8ドル（約590円）だった。お手本とのズレを示す最後の loss は 0.0010 まで下がった。学習を終えたモデル so101h は、Hugging Face の非公開リポジトリ `PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1` と、KIOXIA の `checkpoints/pi05_so101_code_rule401_grasp_lora_v1/2999` に置いた。

このAIは、アームの動きの答えを30コマずつまとめて出す決まりになっている。1本の終わりより先にはデータがないので、その本の最後の指令である閉じた爪とその場の関節の角度をくり返して埋めた。埋めたコマは4,592コマのうち1,624コマ（35%）になった。

実機でAIを動かす推論のとき、腕を動かしてよい範囲は学習データの範囲の ±10° までに限っている。so101h はつかむ所だけを学んだので、この範囲が狭い。アームの待機姿勢である HOME から π0.5 に任せると、肩と肘の角度が範囲の外に出てしまう。ブロックの真上まではコードが運び、そこから先をAIに渡す分担は、この角度の範囲からも決まった。

- ねらい：π0.5 に任せる所を、カメラで見て寄せる必要がある所だけにする
- 変わったこと：学習データが251コマ×50本から、82コマ×56本になった。学習の時間と費用は前のモデルの so101g とほぼ同じ（約6.4時間）
- 見込める効果：運ぶ・持ち上げる・箱へ入れる所の失敗が、π0.5 の側から出なくなる（実機では、運ぶ所の失敗は38回で0回だった）


## 面の選び直し ― 回したブロックでも、コードは止まらずにつかめた（依頼404）

ブロックが傾いていても止まらずにつかめるようにした。LOG618 の実機では、場所5 でブロックを +2.4° より回すと、あらかじめ割り振った面ではアームの動く道が作れずに止まっていた。そこで、割り振りの面で道が作れないときだけ、挟む面と爪の傾きを選び直す設定（`--reselect-face`、環境変数 `R401_RESELECT=1`）を Claude Code に足してもらった。割り振りのままで通る回の道は変えない。

目印の位置と、上下左右へ20画素ずらした所、向き −45〜+45°（5°刻み）の95通りをシミュレーションで流した。安全制限であるガードの値は LOG618 の実機と同じにしている。

| 場所 | 道が作れてガードを通る数（割り振りのまま） | 選び直しを入れた数 |
|---|---|---|
| 2 | 43 / 95 | 60 / 95 |
| 3 | 69 / 95 | 95 / 95 |
| 4 | 31 / 95 | 95 / 95 |
| 5 | 31 / 95 | 54 / 95 |

場所5 だけは、+10° から上がどの面でも道を作れなかった。爪の面を机に垂直にできる傾きがないためだ。一方、−側は −40° まで広がった。LOG618 で成功した57回を選び直しの設定に通すと、57回とも割り振りの面のままで、道は1コマも変わらなかった。

この設定を入れて、コードだけで回したブロックを4回流した。場所5 の −28.5° と −30.9°、場所4 の −31.5° と +21.8° で、4回ともつかめた。LOG618 の56回と合わせて、コードだけの成功は60回中60回になった。爪を閉じたときの爪の先と机のすき間は −1.2〜−7.8mm で、机まで届いていた。


## 切り替え方式 ― 挟めたかを爪の読みで確かめ、外したらコードがやり直す（依頼405）

so101h はつかむ所だけを学んでいるので、コードと交代で動かす仕組みを作った。π0.5 が外したときに、空の爪のまま箱まで運ばないことが大事になる。

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

ブロックを挟めたかの判定は、爪の開き具合を示す数値（爪の読み）だけで決めた。今までの記録である前のモデルの so101f の実機30回、so101g の実機7回、お手本64本、コードの56回にある爪を閉じた241回で、閉じたあとの読みを調べた。挟んだ139回は10.09〜10.84、空の101回は0.88〜4.81 で、あいだの数値はほぼ空いていた。そこで、9〜12なら挟んだ、5未満なら空と決めた。この境目で記録を分け直すと、取り違えは2回だけで、どちらも判定のあとに π0.5 が爪を開き直した回だった。切り替え方式ではコードが爪を閉じたまま待つので、この形は起きない。

外したときの動き方には、シミュレーションで危ない形が見つかった。下で爪を開いてから上がると、動く爪がブロックを押してしまうことが多い。外し方56通りのうち、安全制限のガードを通ったのは3通りだけだった。閉じたまま上がってから上で開くと、39通りが通った。チャットで報告を読み、エイイチは4つの決めること（空のあとの順・あいまいの扱い・挟んだの幅・引き継ぐ時）を、報告の案のまま決めた。

- ねらい：π0.5 が外したことに、コードが気づいて手当てする
- 変わったこと：判定は爪の読み、空のあとは閉じたまま上がってから開く（`SW405_RISE_FIRST=1`）、渡すのは2回まで
- 見込める効果：空の爪で箱へ運ぶ失敗がなくなる。実機では、空振りした3回すべてで空と判定し、箱へは運ばなかった


## 実機の動画 ― 切り替え方式の1回

ロボットアームがブロックをつかむとき、人が書いたプログラム（コード）とAI（π0.5）の役割を途中で切り替える方式を試した。机の上の目印である場所3に置いたブロックをつかんだ回を、スマホで撮った。

ブロックの真上まではコードがアームを運ぶ。そこから下りて爪を閉じるのが π0.5 で、持ち上げて箱へ運ぶ先はまたコードが受け持つ。2本の動画はどちらも、アームが動き出す前と止まったあとを切り、音声を外した。

[動画: 切り替え方式の最初の1回を正面から撮った。コードがブロックの真上まで運び、π0.5 が下りて閉じ、コードが箱へ入れて戻る（8.9秒・音声なし）](https://pixelstomotors.com/media/LOG621_01_switch_place3_front.mp4)

[動画: 別の回を斜め上から撮った。π0.5 が下りてブロックを挟み、コードが持ち上げて左の箱へ入れる（8.7秒・音声なし）](https://pixelstomotors.com/media/LOG621_02_switch_place_diag.mp4)


## まっすぐ置いたブロックは、30回すべてつかめた

ブロックを場所2〜5の目印にまっすぐ置き（向き ±5° 以内）、切り替え方式でアームを動かした。最初に場所3で1回だけ動かして動きを確かめてから、場所2・3・4・5 を順に6回ずつ、そのあと3回ずつ足した。

結果は30回すべて成功だった。毎回 π0.5 が1回目でブロックを挟み、コードが箱へ運んだ。判定はすべて挟んだとなり、閉じたときの爪の読み（爪の開き具合の値）は10.37〜10.43だった。

π0.5 に操作を渡してから爪を閉じるまでは、60〜110コマ（2〜3.7秒）だった。閉じたときの爪の先と机のすき間は −10.6〜+2.8mm で、コードだけで動かした回（−13.1〜−0.6mm）とほぼ同じ高さまで下りていた。

途中で2回、机のカメラの読み込みが止まり、アームを動かさずにプログラムが止まった（`GuardError: 力を入れる前に読んだ位置 … がない`）。ブロックを置き直してやり直すと動いた。


## 回して置いた8回のうち、3回は高い所で爪を閉じて空振りした

場所ごとに、ブロックを斜めに回して置く回を足した。8回のうち5回はつかめた（場所3 の +17.1°・−14.2°、場所4 の +24.1°・−16.3°、場所5 の −17.9°）。空振りしたのは次の3回。

| 試行 | 場所 | 向き | 閉じたときの爪と机 | π0.5 が閉じるまで | その後 |
|---|---|---|---|---|---|
| 184123 | 2 | −26.5° | +4.9mm | 58コマ | 空と判定。アームが上がって爪を開き、待機位置の HOME でカメラを読み直すとブロックが202画素動いていて止まった |
| 184804 | 2 | −25.1° | +9.3mm | 47コマ | 空と判定。読み直したが、つかむ面を選び直してもアームの道が作れずに止まった |
| 185845 | 5 | +20.5° | +7.1mm（1回目） | 58コマ・58コマ | 2回 π0.5 に渡して2回とも空。2回外したので止まった |

空振りの回は、つかめた回より早く爪を閉じていた。成功は60〜110コマだったのに対し、空振りは47〜58コマだった。爪の先が机より上にあるうちに閉じている。

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

図の灰色の帯は、so101h のお手本データ56本に入っているブロックの向きの範囲（−7.5〜+17°）を示している。56本のうち49本は ±5° 以内だった。空振りの3回は、どれもこの帯の外にある。帯の外でもつかめた回（−17.9°・−16.3°・−14.2°・+24.1°）はあるが、+24.1° の回は閉じたときの爪が机から4.4mm 上で、ぎりぎりだった。

手首カメラの画像で、閉じる直前のブロックの赤い部分の面積を数えると、空振りの回は11.1〜11.7千画素、つかめた回は12.7〜14.1千画素だった。空振りの回は、ブロックがまだ小さく見える遠い位置のうちに閉じている。

![手首カメラの絵。上から、場所2 −26.5°（空振り）、場所2 −25.1°（空振り）、場所2 +0.3°（成功）、場所5 +20.5°（空振り）、場所5 +1.8°（成功）、場所5 −17.9°（成功）。左から渡す所・下りる途中・閉じる直前・閉じ始め・閉じた所](https://pixelstomotors.com/media/LOG621_04_miss_vs_success_wrist.jpg)

![同じ6回を机のカメラで見た絵。並びは手首カメラの絵と同じ](https://pixelstomotors.com/media/LOG621_05_miss_vs_success_desk.jpg)


## 場所5 の + 側は、ガードをその回だけ広げて流した

場所5 でブロックを + 側に回すと、つかむ面を選び直してもアームの道が作れず、動かさずに止まった。依頼404 の時点で、+10° から上は道を作れないと分かっていた。最初は場所5 の + 側には置かない案を選んだが、実機で動かすうちに、エイイチは安全制限のガードがきつすぎると判断した。

そこで、その回だけ制限の値を広げる設定の口を2つ、Claude が直接足した。

| 口 | 何を広げるか | 既定 | この日の値 |
|---|---|---|---|
| `R401_ELEV_MAX_DEG` | 爪の面を机に垂直にする許し（±°） | 8 | 20 |
| `SO101_RANGE_MARGIN` | π0.5 に任せる範囲（学習データの範囲 ± この値） | 10 | 25 |

ただ、`SO101_RANGE_MARGIN` を広げると、コードがアームの道を作る範囲まで変わってしまった。「割り振りを作ったときの道を作る範囲と今の範囲が違う」というエラーで止まった。道を作る範囲は ±10 のまま変えないように、`handover_392.py` と `var_lib_314.py` を直してから動かした。ガードを広げたあとの場所5 では、−17.9° はつかめ、+20.5° は2回とも空振りした。


## 決まりの深さを疑った依頼407 は、原因ではなかった

机の上の場所2 に置いたブロックを、ロボットアームが空振りした。エイイチは爪がブロックまで下りきっていないと目で確かめ、アームを動かすプログラム（rule_401）の高さ設定を直すことにした。rule_401 が場所2 で計算する爪の深さが外れているのではないかと考え、記録から実際の高さを調べる依頼407 を出した。

記録を見ると、空振りした回で爪を下ろしていたのはプログラムではなく、AIモデルの π0.5 だった。ブロックの真上までは rule_401 で動かし、そこから先は π0.5 に操作を渡している。渡したあとに rule_401 がつかむための指令を送ることはない。π0.5 が出した指令では、爪を閉じたときの机からの高さが +18.8mm と +21.1mm だった。場所2 にブロックをまっすぐ置いて成功した回（+2.1〜+11.3mm）より、10mm 以上高い。実際の腕は指令より 12〜14mm 沈むため、机からの実測は +4.9mm と +9.3mm だった。

作業を任せた Claude Code（コーディング支援AI）は、プログラムだけで動かす回に効く修正（`R401_CMD_FIRST=1`。つかむときの指令を +1mm 以下まで下げる設定）を切り替えオプションとして追加した。ただし、学習済みモデルの so101h が起こす空振りはこれでは直らないと報告した。このオプションは指定しなければ元の動きと変わらず、この日は使っていない。


## 手首カメラを黒くすると、π0.5 はほとんど下りずに閉じた

π0.5 が何を見て爪を閉じるタイミングを決めているのかを確かめた。アームの手首カメラが撮った映像だけを真っ黒に塗りつぶして π0.5 に渡すオプション（`SW405_BLACK_WRIST=1`。記録に残る映像は本物のまま）を使い、場所3 にまっすぐ置いたブロックで1回試した。

| | 渡してから閉じるまで | 肘が動いた量 | π0.5 の最初の答えの終わりの爪 |
|---|---|---|---|
| ふだんの場所3（成功） | 61コマ | 約16° | 59（開いたまま下りる） |
| 手首を黒くした1回目 | 29コマ | 約5° | 11（下りる前に閉じる） |
| 手首を黒くした2回目 | 28コマ | 約3° | 3.6 |

![机のカメラの絵。上が手首カメラを黒くした回、下がふだんの回。黒くした回は、ブロックの真上からほとんど下りずに閉じ、閉じたあともブロックが机に残っている](https://pixelstomotors.com/media/LOG621_06_black_wrist_vs_normal_desk.jpg)

**π0.5（so101h）は、手首カメラの映像を見て、まだ下りるか、もう閉じるかを決めていた。見慣れない映像が来ると、下りきる前に爪を閉じてしまう。** 真っ黒な映像ではすぐに閉じ、斜めに回して置いたブロック（お手本にない見え方）では途中で閉じた。調べ始めたとき、Claude は映像を見ずに覚えた関節の角度に達したら閉じていると見立てていたが、黒くした実験で外れだと分かった。

空振りを直すには、回して置いたブロックの見え方を π0.5 に教える必要がある。プログラムの深さ設定も、関節の角度も、原因ではなかった。


## この日に決めたこと

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


## 次にやること ― 回した置き方とずらした置き方のお手本を、コードで60回録る（依頼406）

プログラムなら斜めに回したブロックでもつかめる。つまり、AIに教えるお手本はプログラムだけで録れる。Claude Code に、次の条件で撮影する準備を依頼した（19:17 に開始。実行中）。

- 場所2・3・4・5 を15回ずつ、計60回。置く向きは −30〜+25° にまんべんなく散らし、まっすぐ置くのは場所ごとに3回までとする。場所5 はアームの動く経路を作れる範囲に限る
- 60回のうち40回は、ブロックの真上から 8〜20mm ずらした位置に一度止めてから、本当の真上へ寄せて下りる。位置の読みが外れたときに、カメラを見ながら寄せる動きを教えるため
- エイイチは、画面に出る「場所N の目印に 約 +20° 回して置いて Enter」の指示どおりにブロックを置き、Enter を押すだけ。60回で40〜50分の見込み

録り終えたら、今ある56本と合わせて π0.5 を学び直す（新しいモデル名は so101i）。学習は約6.4時間、約600円の見込み。

プログラムからAIへ操作を切り替える今回の実機テストでは、外部の計算機サービスである Runpod のGPU（A40）を so101h を動かすために約1.2時間借りた（約0.7ドル、約100円）。試し終えてから借りた計算機（Pod）は消した。


## この結果から言えること、言えないこと

**言えること**

- ブロックの真上まではプログラム、つかむ動きは π0.5 という分担で、まっすぐ置いたブロックは30回すべてつかめた
- so101h は手首カメラの映像を見て爪を閉じる時を決めている。お手本にない見え方では、下りきる前に早く閉じる
- 空振りした3回すべてで、プログラムが爪の開き具合の値からつかめていないと気づき、箱へ運ばずに止めるか、π0.5 にやり直させることができた

**言えないこと**

- 回して置いたブロックのお手本を足せば空振りが直るかは、まだ分からない（依頼406 で録ってから確かめる）
- やり直させて2回目でつかめた回はまだない。やり直しが本当に役に立つかは、これから数える
- 手首カメラを黒くした試しは1回（その中で操作を2回渡した）だけ。机のカメラだけを黒くした試しはしていない


## 依頼403 ― コードの成功56回から、つかむ所だけのお手本を作り so101h の学習を始める

### 依頼403 の依頼文

```markdown
---
作業フォルダ: /Users/shimazueiichi/r2r2r-scripts
上限時間: 100
---
# 依頼403：SO-101 のコードだけの実機 56 回（rule_401・全部成功）から「つかむ所だけ」のお手本を作り、π0.5 を学び直す so101h を回し始める（立ち会い不要・フォロワーは動かさない）

## なぜ
2026-12-01 の午前、つかみ方の決まり rule_401（案C）を学習なしのコードだけで実機に流し、場所2・3・4・5 で 56 回すべて成功した（目印にまっすぐ 24 回・目印から外した置き方 32 回。台帳 `lab/so101_Log12/so101_trials.csv` の model = code_rule401・result = success）。
同じ日の 10:53 にエイイチが決めた：**つかむ所だけを π0.5 に任せる形に戻る。今日のコードの動きをお手本にする**（つかみ方が 1 つの決まりにそろったお手本になる）。
切り替え方式の受け持ちは今までの決めのまま：コードがブロックの上（つかむ所の真上 50 mm）まで運ぶ → π0.5 が寄せて下りて閉じる → 閉じた直後にコードへ戻す（持ち上げから先はコード）。
so101f・so101g は HOME から戻るまでの全部を学ばせたが、今回は **π0.5 が受け持つ区間だけ** を学ばせる。学ぶ量を小さくするため。

## 1. データ
- 元：KIOXIA `lab/so101_Log12/so101/so101_20261201_*/`（1 回 = 1 本の LeRobot の記録。251 コマ）のうち、台帳で model = code_rule401・execute = 1・result = success の 56 本。result が空の 1 本（so101_20261201_095108・40 コマ）は入れない。元の記録は読むだけ
- 切り出す区間：各回の `trial.json` の `rule401.keyframes` の **ABOVE_BLOCK のコマから GRASP_CLOSED のコマまで**（両端を含む。今日の 56 本はどれも 67〜148 のはずだが、値は回ごとに読む）。HOME → ブロックの上と、持ち上げから先は入れない
- so101f のデータ（`datasets/so101_redblock_box_ideal_var_v2_success_v1`）と同じ形で書き出す（関節の名前・課題の言葉・コマの速さ・カメラ 2 台・絵の大きさ・爪の値の目盛り。`ptm.*` の列は入れない）。書き出しの道具は `export_so101_ideal_var_raw_episodes.py` に足してよい
- 置き場所：KIOXIA `datasets/so101_redblock_box_code_rule401_grasp_v1/`（新しいフォルダ。既存の datasets は上書きしない）
- 正規化の値と安全範囲は、この 56 本で測り直す（爪の開きは 59 まである。so101f は最大 44）
- 切り出した本の終わりより先の答え（1 回の答え 30 コマが本の終わりをまたぐ所）を、学習の読み込みがどう埋めるかを確かめて報告に書く。**最後のコマの指令をくり返す形（＝閉じたまま、その場で止まる）なら、そのまま進める**。そうでない（0 で埋める・その所を捨てる など）なら、学習は始めずに「決めてほしいこと」に書く
- 切り出しの始めのコマで、腕が指令にどれだけ遅れているか（指令と observation.state の差。関節ごとの中央値と最大）を表にする（推論では渡す所で 2〜8 コマ止めてから渡すので、始めの見え方の差を知るため。直さなくてよい）

## 2. 学習の設定 so101h
- `lab_train.sh --model so101h`：so101f と同じ値（π0.5 base から・答え 30 コマ・LoRA・3000 ステップ・decay_steps 3000）で、データだけを上の 56 本にする
- 上げる先・KIOXIA の置き場所・記録の置き場所は so101g と同じ付け方で（例：`PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1`（非公開）、`checkpoints/pi05_so101_code_rule401_grasp_lora_v1/`、`lab/so101_Log12/train_so101h/`）
- 推論でも使えるよう `lab_start.sh --model so101h` も入れる（so101f・g と同じ扱い）
- `--dry-run` を通し、既存のテストが全部通ること。mechArm・so101a〜g の出力は変えない

## 3. 回す
- `./lab_train.sh --log so101_Log12 --model so101h --limit-hours 7` を nohup で切り離して始める（依頼358・385 と同じ。A40）
- 依頼385 と同じ見張り（2 時間ごとと終わりに `lab/so101_Log12/train_so101h/progress_403.md` に書き足す）を nohup で付ける
- loss が出るところまで見届けてから、この依頼を終える。学習の終わりは待たない
- 終わったら Hugging Face と KIOXIA に置き、Pod は消える（lab_train.sh の今の動き）

## しないこと
アームを動かす、`so101/check_401/run_rule401.py`・`session_401.sh`（未 commit の変更がある。次の依頼で扱う）・`rule_401.py`・`rule_351.py` に触る、元の記録・台帳・既存の datasets に書く・動かす、`so101/sim/` に触る、codex のレビュー（アームを動かすコードではないので要らない）、確認や停止の条件を重ねる、`git add .`・`git clean`

## 報告
- いちばん大事なこと：本数・コマ数（場所ごと）、本の終わりより先の答えの埋め方、学習が始まったか
- 切り出しの始めの遅れの表、正規化と安全範囲（so101f との差）
- dry-run とテストの件数、commit（自分のファイルだけを個別に add）
- 学習の Pod の id・始めた時刻・最初の loss・終わりの見込みの時刻・費用の見込み（円）
- 最後の 1 行に「判定：合格／止めた（決めてほしいことあり）／失敗」
```

### 依頼403 の報告（見張り係の記録）

```markdown
# 結果：20261201_403_SO101のコードの56回からつかむ所だけのお手本を作りso101hの学習を回し始める

- 状態：完了
- 始めた時刻：2026-12-01 10:57
- 終わった時刻：2026-12-01 11:42（45分）
- 作業フォルダ：/Users/shimazueiichi/r2r2r-scripts
- この続きを Claude Code で話すとき：作業フォルダで `claude --resume 1cea2bf1-c536-4f76-8bd2-362dc3797675`
- 止められた操作：1件（いちばん下に一覧）

## Claude Code の報告

**やったこと**
- rule_401 をコードだけで流した成功 56 本から、ブロックの上（ABOVE_BLOCK）から爪を閉じた所（GRASP_CLOSED）までだけを切り出しました。書き出し先は KIOXIA `datasets/so101_redblock_box_code_rule401_grasp_v1/` です。道具は `export_so101_ideal_var_raw_episodes.py --set h` で、形は so101f と同じです。
- `lab_train.sh` と `lab_start.sh` に `--model so101h` を足しました。値は so101f と同じ（π0.5 base から・答え 30 コマ・LoRA・3000 ステップ・decay_steps 3000）で、データだけ替えています。上げる先は `PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1`（非公開）、置き場所は `checkpoints/pi05_so101_code_rule401_grasp_lora_v1/`、記録は `lab/so101_Log12/train_so101h/` です。
- 学習と見張り（progress_403.sh）を nohup で切り離して始め、最初の loss が出るところまで見届けました。

**結果**
- 本数とコマ数：56 本・4,592 コマです。場所 2・3・4・5 が 14 本ずつ、1,148 コマずつです。どの本も 67〜148 コマ目の 82 コマでした。result が空の so101_20261201_095108 は入れていません。
- 本の終わりより先の答え：Pod で確かめたところ、その本の最後の指令をくり返す形でした（閉じたまま、その場で止まる）。openpi は埋めた所を学習から外していません。依頼どおりそのまま進めました。埋めた所を含むコマは 4,592 コマのうち 1,624 コマ（35%）です（so101g は 10%）。
- 学習は始まりました。Pod 2t1p7dw1o9ale3（A40・1 時間 0.59 ドル）で、11:31 に始め、11:41 に Step 0 の loss 0.0873 が出ました。終わりの見込みは 17:45 ごろ（上限 18:22）です。費用の見込みは約 3.8 ドル（約 600 円）、上限までかかれば約 4.0 ドル（約 640 円）です。

切り出しの始めの遅れ（指令 − observation.state。56 本の大きさの中央値 ／ 最大）

| 関節 | 中央値 | 最大 |
|---|---|---|
| shoulder_pan | 0.52 | 0.78 |
| shoulder_lift | 0.27 | 0.42 |
| elbow_flex | 2.58 | 2.81 |
| wrist_flex | 0.51 | 0.97 |
| wrist_roll | 0.60 | 1.06 |
| gripper | 0.46 | 0.46 |

肘だけが、どの回も指令より約 2.6° 遅れています。

正規化の値（so101f との差）
- state の平均は 肩の上げ +31.5・肘 −23.1・爪 +37.6 などです。
- actions の差分の標準偏差は、関節 5 つとも小さくなりました（−6.9〜−30.3）。

安全範囲（学習データ ±10°）
- lo は [−56.3, −41.1, −83.8, 4.1, −54.8, 0]、hi は [23.9, 66.8, 70.0, 101.8, 28.6, 69.0] です。
- 爪の上限は so101f の 47.2 から 69.0 に上がりました。
- ブロックの上からの区間だけなので範囲は狭くなりました。HOME から始めた今までの推論の始め 141 回は、肩の上げと肘でほぼ全部が範囲の外になります。

dry-run とテスト
- so101h の `--dry-run` は通りました。mechArm と so101a〜g の dry-run は、かかった秒と commit の表示のほかは前と同じです。
- テストはすべて通りました：test_lab_train 313・test_lab_start 422・test_so101_train 32・test_so101_rtc 9・test_run_so101_policy 89・test_lerobot_safe_259 64・test_ideal_var_314 13 件。
- 1 回目は 2 件 NG が出ました。test_lab_train の 1 件は、テストの途中に別の作業の commit（0ee3388）が入ったためです。test_lab_start の 1 件は so101h と関係のない deep1 の所でした。どちらも流し直したら通りました。
- commit：167feed（コード）、ac3d4d6（報告）。自分のファイルだけを個別に add しました。

**変えたファイル**
- `lab_lib.sh`
- `lab_train.sh`
- `lab_start.sh`
- `lab_train_fakes.sh`
- `test_lab_train.sh`
- `test_lab_start.sh`
- `pi05/export_so101_ideal_var_raw_episodes.py`
- `pi05/openpi_addon/add_so101_config.py`
- `pi05/openpi_addon/pod_prep_so101.sh`
- `pi05/test_so101_train.py`
- `so101/check_403/progress_403.sh`（新規）
- `so101/check_403/REPORT.md`（新規）
- KIOXIA の新しいデータ `datasets/so101_redblock_box_code_rule401_grasp_v1/`

**決めてほしいこと**
なし（安全範囲が狭いことは次の推論の依頼で効いてきます。上の結果に書いたとおりです）

判定：合格

## 止められた操作

- {"tool_name": "Bash", "tool_use_id": "toolu_01GSPzrXXMZLTyHfGYuQJtzp", "tool_input": {"command": "cd ~/r2r2r-scripts; rm -rf /tmp/wt403; git worktree add -q --detach /tmp/wt403 HEAD && echo made; for m in corr deep1b so101a so101b so101e so101f so101g; do for d in /tmp/wt403 ~/r2r2r-scripts; do (cd $d && ./lab_train.sh --log so101_Log12 --model $m --dry-run 2>&1 | sed -E 's#/tmp/lab_train_dry\\.[A-Za-z0-9]+#TMP#g; s/[0-9]{2}:[0-9]{2}:[0-9]{2}/T/g; s/[0-9]{8}_[0-9]{6}/TS/g; s/[0-9]{2}-[0-9]{2} [0
```

### so101/check_403/REPORT.md

```markdown
# 依頼403 報告：so101h（rule_401 のコードだけの成功 56 本の「つかむ所だけ」）の学習を始めた

## データ（KIOXIA datasets/so101_redblock_box_code_rule401_grasp_v1/）
- 台帳 lab/so101_Log12/so101_trials.csv で model = code_rule401・execute = 1・result = success の 56 本。外したのは result が空の so101_20261201_095108（場所 2・40 コマ）だけ
- 場所ごと：場所 2・3・4・5 が 14 本ずつ・1,148 コマずつ。合計 56 本・4,592 コマ
- 切り出し：どの本も ABOVE_BLOCK 67 〜 GRASP_CLOSED 148（両端を含む）の 82 コマ（元は 251 コマ）。値は回ごとに trial.json から読んだ
- 形は so101f と同じ（関節の名前 6 つ・課題の言葉・30 fps・カメラ 2 台を 320×240 の jpg に・爪は同じ目盛り）。ptm.* の列は入れていない。action は元の action（= ptm.sent。差 0）
- tar 114,514,944 バイト・sha256 08d96723d9db…・jpg 9,184 枚。書いたあと、元の parquet の切り出しと同じことを確かめた
- 爪：指令 0.74〜59.0・state 37.6〜58.7（so101f の安全範囲の上限は 47.21）

## 本の終わりより先の答えの埋め方（Pod の check_pad_so101.py）
- `PAD horizon=30 last_frame_pad=29 fill=last_action short_frames=1624/4592 openpi_uses_is_pad=no`
- 足りない所はその本の最後のコマの指令（閉じた爪・その場の関節）をくり返す。関節 5 つは差分なので「その場で止まる」になる → 依頼どおり進めた
- 足りない所のあるコマは 4,592 コマのうち 1,624 コマ（35%）。so101g は 18,250 コマのうち 1,856 コマ（10%）

## 切り出しの始め（ABOVE_BLOCK）の遅れ：指令 − observation.state（56 本）
| 関節 | 中央値の大きさ | 最大の大きさ | 符号つきの中央値 |
|---|---|---|---|
| shoulder_pan | 0.52 | 0.78 | −0.45 |
| shoulder_lift | 0.27 | 0.42 | −0.27 |
| elbow_flex | 2.58 | 2.81 | −2.58 |
| wrist_flex | 0.51 | 0.97 | +0.51 |
| wrist_roll | 0.60 | 1.06 | −0.47 |
| gripper | 0.46 | 0.46 | +0.46 |

## 正規化の値（Pod で 56 本から測り直した。norm_stats.json sha256 a6527bfc1c92…）
- so101f との差（state の平均）：肩の回り −16.1・肩の上げ +31.5・肘 −23.1・手首の曲げ +6.1・手首の回り −2.6・爪 +37.6
- state の標準偏差は小さくなった（肩の上げ −22.6・爪 −8.9 など）。actions（差分）の標準偏差は関節 5 つとも小さくなり（−6.9〜−30.3）、爪は +9.0

## 安全範囲（学習データ ±10°。run_so101_policy と同じ決め方）
- lo [−56.26, −41.08, −83.82, 4.07, −54.82, 0.0]  hi [23.89, 66.84, 69.96, 101.79, 28.64, 69.0]
- so101f との差：lo [+11.74, +71.92, −1.33, +7.63, +13.09, 0.0]  hi [−33.03, +0.44, −30.15, −18.93, −14.87, +21.79]（爪の上限は 47.21 → 69.0）
- ブロックの上からの区間だけなので範囲は狭い。HOME から始めた今までの推論の始め 141 回は、肩の上げで 141 回・肘で 140 回・手首の曲げで 1 回範囲の外になる。休みの姿勢も、肩の上げと肘が範囲の外

## 学習
- Pod 2t1p7dw1o9ale3（A40・1 時間 0.59 ドル）。11:22 に lab_train.sh を始め、11:31 に学習を始め、11:41 に Step 0 の loss 0.0873
- 終わりの見込み：so101g と同じ 6.4 時間なら 17:45 ごろ（上限 18:22）。費用の見込みは約 3.8 ドル（約 600 円）、上限までかかれば約 4.0 ドル（約 640 円）
- 記録 KIOXIA lab/so101_Log12/train_so101h/（nohup_lab_train_20261201_112202.txt・progress_403.md。見張り so101/check_403/progress_403.sh）

## テスト・commit
- lab_train.sh --dry-run（so101h）は通った。mechArm（corr・deep1b）と so101a・b・e・f・g の dry-run は、かかった秒と由来の commit の表示のほかは前と同じ
- test_lab_train 313・test_lab_start 422・test_so101_train 32・test_so101_rtc 9・test_run_so101_policy 89・test_lerobot_safe_259 64・test_ideal_var_314 13 件 すべて OK
  - test_lab_start は 1 回目に deep1 の 1 件が NG。so101h と関係のない所で、流し直したら 422 件すべて通った
  - test_lab_train は 1 回目に由来の commit の 1 件が NG。テストの途中に別の作業の commit 0ee3388 が入ったためで、流し直したら通った
- commit 167feed（コード）
```

### so101/check_403/progress_403.sh

````bash
#!/bin/bash
# progress_403.sh — so101h の学習 (lab_train.sh --log so101_Log12 --model so101h) の途中経過を書き足す (依頼 403. progress_385.sh と同じ形で, 置き場所だけ train_so101h).
# 依頼箱の時間切れで Claude が止められても最後まで書くように nohup で切り離して流す. 学習・Pod には触らない (読むだけ).
#
#   nohup so101/check_403/progress_403.sh <lab_train の pid> <lab_train の nohup の記録> > <記録> 2>&1 &
#
# 1. 2 時間ごとに, lab_train.sh の出力の一番新しい [TRAIN ] の行 (ステップ・loss) を train_so101h/progress_403.md に足す
# 2. lab_train.sh が終わったら, result_*.txt・loss (500 ステップごと)・KIOXIA のチェックポイントの数とバイト数を足す
set -u
PID="${1:?lab_train.sh の pid}"
NOHUP="${2:?lab_train.sh の nohup の記録}"
LAB=/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12
CK=/Volumes/KIOXIA/r2r2r-data/checkpoints/pi05_so101_code_rule401_grasp_lora_v1
OUT=$LAB/train_so101h/progress_403.md
EVERY=7200
mkdir -p "$LAB/train_so101h"
add() { printf '%s\n' "$@" >> "$OUT"; }
snap() { add "- $(date '+%m-%d %H:%M') $(grep -E '^\[(TRAIN|POD|ERROR)' "$NOHUP" 2>/dev/null | tail -1)"; }

[ -f "$OUT" ] || add "# 依頼403 途中経過（so101h・rule_401 のコードの成功 56 本のつかむ所）" ""
add "- $(date '+%m-%d %H:%M') 見張りを始めた (lab_train.sh pid $PID. 記録 $NOHUP)"
last=$SECONDS
while kill -0 "$PID" 2>/dev/null; do
    sleep 60
    [ $((SECONDS - last)) -ge $EVERY ] && { snap; last=$SECONDS; }
done
snap
R=$(ls -t "$LAB"/train_so101h/result_*.txt 2>/dev/null | head -1)
add "" "## 終わり ($(date '+%m-%d %H:%M'))" "" '```'
[ -n "$R" ] && cat "$R" >> "$OUT" || add "result_*.txt がない"
add '```' "" "## loss（500 ステップごと）" "" "| step | loss |" "|---|---|"
T=$(ls -t "$LAB"/train_so101h/train_*.log 2>/dev/null | head -1)
[ -n "$T" ] && grep -oE "Step [0-9]+: .*loss=[0-9.]+" "$T" | sed -E 's/Step ([0-9]+): .*loss=([0-9.]+)/\1 \2/' \
    | awk '$1 % 500 == 0 || $1 == 2950 || $1 == 2999 { print "| " $1 " | " $2 " |" }' >> "$OUT"
add "" "## KIOXIA のチェックポイント"
for d in "$CK"/*/; do
    [ -d "$d" ] && add "- $d $(find "$d" -type f ! -name '._*' | wc -l | tr -d ' ') ファイル $(find "$d" -type f ! -name '._*' -exec stat -f %z {} + | awk '{s+=$1} END {print s}') バイト"
done
add "- 見張りの終わり $(date '+%m-%d %H:%M')"
````

### 依頼403 の commit 167feed の中身（変えたファイルの一覧と、check_40x の外のコードの差分。check_40x のファイルは上に全文）

```text
$ git show --stat 167feed && git show --format= 167feed -- '*.py' '*.sh' ':(exclude)so101/check_40*/*'
commit 167feed05eddb200f0427d89d15c854482cea180
Author: Eiichi Shimazu <studio@adaptdesign.jp>
Date:   Tue Dec 1 11:21:57 2026 +0900

    依頼 403: rule_401 をコードだけで流した成功 56 本 (場所 2〜5 各 14 本) の ABOVE_BLOCK〜GRASP_CLOSED だけを切り出したお手本 so101_redblock_box_code_rule401_grasp_v1 (56 本・4,592 コマ・各 82 コマ) を export_so101_ideal_var_raw_episodes.py --set h で書き出し, so101f と同じ値 (π0.5 base・答え 30 コマ・LoRA・3000 ステップ・decay_steps 3000) でデータだけ替えた so101h を lab_train.sh / lab_start.sh に足した (add_so101_config.py --variant h・pod_prep_so101.sh <steps> h・上げる先 PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1・KIOXIA checkpoints/pi05_so101_code_rule401_grasp_lora_v1・記録 lab/<Log>/train_so101h). 見張り so101/check_403/progress_403.sh. mechArm・so101a〜g の lab_train.sh dry-run は時間と由来の commit のほか同じ. テスト: test_lab_train 313・test_so101_train 32・test_so101_rtc 9・test_run_so101_policy 89・test_lerobot_safe_259 64・test_ideal_var_314 13 件 OK. アームは動かしていない
    
    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

 lab_lib.sh                                  |  28 +++-
 lab_start.sh                                |  36 +++--
 lab_train.sh                                |  10 +-
 lab_train_fakes.sh                          |   3 +
 pi05/export_so101_ideal_var_raw_episodes.py | 231 +++++++++++++++++++++++++++-
 pi05/openpi_addon/add_so101_config.py       |  12 +-
 pi05/openpi_addon/pod_prep_so101.sh         |  12 +-
 pi05/test_so101_train.py                    | 105 ++++++++++++-
 so101/check_403/progress_403.sh             |  39 +++++
 test_lab_start.sh                           |  51 ++++--
 test_lab_train.sh                           |  10 ++
 11 files changed, 496 insertions(+), 41 deletions(-)
diff --git a/lab_lib.sh b/lab_lib.sh
index e686188..34dc201 100644
--- a/lab_lib.sh
+++ b/lab_lib.sh
@@ -336,7 +336,9 @@ lab_cmd_addon() {           # 3f. 何度流しても同じ結果 (install_addon.
 #   (lab_train.sh --model so101f. 設定 pi05_so101_ideal_var_v2_lora). 正規化の値・安全範囲はこの 50 本から
 # so101g (依頼 385) は so101f と同じ扱い (答え 30 コマ) で, so101f の 50 本 + つかみ直しのお手本の成功 14 本で学習した 2999
 #   (lab_train.sh --model so101g. 設定 pi05_so101_ideal_var_v2_recover_lora). 正規化の値・安全範囲はこの 64 本から
-LAB_MODELS="trim corr corr2 corr3 deep1 deep1b split1 split2 so101a so101b so101c so101d so101f so101g"
+# so101h (依頼 403) は so101f と同じ扱い (答え 30 コマ) で, rule_401 をコードだけで流した成功 56 本の ABOVE_BLOCK〜GRASP_CLOSED
+#   だけで学習した 2999 (lab_train.sh --model so101h. 設定 pi05_so101_code_rule401_grasp_lora). 正規化の値・安全範囲はこの 56 本の切り出しから
+LAB_MODELS="trim corr corr2 corr3 deep1 deep1b split1 split2 so101a so101b so101c so101d so101f so101g so101h"
 LAB_SO101_PY=${LAB_SO101_PY:-/opt/homebrew/Caskroom/miniforge/base/envs/lerobot/bin/python}   # 依頼 283: SO-101 のクライアントを流す python (conda の lerobot)
 LAB_CORR_STEPS=1500
 LAB_CORR_INIT=/workspace/ckpt/3999/params
@@ -355,6 +357,7 @@ LAB_SO101D_STEPS=3000       # 依頼 309. so101c と同じステップ数 (decay
 LAB_SO101E_STEPS=3000       # 依頼 314. so101b〜d と同じステップ数 (decay_steps も同じ)
 LAB_SO101F_STEPS=3000       # 依頼 358. so101e と同じステップ数 (decay_steps も同じ)
 LAB_SO101G_STEPS=3000       # 依頼 385. so101f と同じステップ数 (decay_steps も同じ)
+LAB_SO101H_STEPS=3000       # 依頼 403. so101f と同じステップ数 (decay_steps も同じ)
 lab_model_def() {           # lab_model_def trim|corr|... → MODEL_REPO MODEL_CKPT MODEL_CONFIG MODEL_DATA MODEL_DESC MODEL_RANGE_DATA. 知らない名前なら 1
     MODEL_RANGE_DATA=mecharm_redblock_box_teach_v1_trim2        # 安全範囲を作るデータ (依頼 135. deep1・deep1b だけ下で変える)
     case "$1" in
@@ -452,6 +455,13 @@ lab_model_def() {           # lab_model_def trim|corr|... → MODEL_REPO MODEL_C
             MODEL_DATA=so101_redblock_box_ideal_var_v2_success_recover_v1
             MODEL_RANGE_DATA=$MODEL_DATA
             MODEL_DESC="SO-101: so101f と同じ値 (答え 30 コマ) で, so101f の成功 50 本 + つかみ直しのお手本の成功 14 本で学習した $((LAB_SO101G_STEPS - 1)) (依頼 385)" ;;
+        so101h)                 # 依頼 403: so101f と同じ値で, データが rule_401 のコードの成功 56 本のつかむ所だけ. 名前は lab_train.sh --model so101h と同じ
+            MODEL_REPO=PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1
+            MODEL_CKPT=/workspace/ckpt/so101_code_rule401_grasp_v1_$((LAB_SO101H_STEPS - 1))
+            MODEL_CONFIG=pi05_so101_code_rule401_grasp_lora
+            MODEL_DATA=so101_redblock_box_code_rule401_grasp_v1
+            MODEL_RANGE_DATA=$MODEL_DATA
+            MODEL_DESC="SO-101: so101f と同じ値 (答え 30 コマ) で, rule_401 のコードの成功 56 本のつかむ所 (ブロックの上〜閉じた所) だけで学習した $((LAB_SO101H_STEPS - 1)) (依頼 403)" ;;
         *) return 1 ;;
     esac
 }
@@ -472,6 +482,7 @@ lab_cmd_addon_model() {     # lab_cmd_addon_model trim|corr|corr2|corr3|deep1|de
     [ "$1" = so101d ] && add="add_so101_config.py /workspace/openpi --steps $LAB_SO101D_STEPS --variant d"        # 依頼 309
     [ "$1" = so101f ] && add="add_so101_config.py /workspace/openpi --steps $LAB_SO101F_STEPS --variant f"        # 依頼 358
     [ "$1" = so101g ] && add="add_so101_config.py /workspace/openpi --steps $LAB_SO101G_STEPS --variant g"        # 依頼 385
+    [ "$1" = so101h ] && add="add_so101_config.py /workspace/openpi --steps $LAB_SO101H_STEPS --variant h"        # 依頼 403
     # assets は hf download が置いたモデルの assets/local/<データ名> を, openpi の assets/<設定>/local/ に写す
     # (trim の 3f が assets/pi05_mecharm_trim_lora/local/ に写すのと同じ形. corr〜corr3 は trim2 と同じ正規化の値,
     # deep1 は deep_even10_v1 で測り直した値)
@@ -500,10 +511,13 @@ lab_cmd_addon_model() {     # lab_cmd_addon_model trim|corr|corr2|corr3|deep1|de
 # so101g (依頼 385): so101f と同じ値で, データだけ so101f の 50 本 + つかみ直しのお手本の成功 14 本
 #   (so101_redblock_box_ideal_var_v2_success_recover_v1. export_so101_ideal_var_raw_episodes.py --set v3. 4b は pod_prep_so101.sh <steps> g).
 #   推論のモデル (LAB_MODELS) にも足した
-LAB_TRAIN_MODELS="corr corr2 corr3 deep1 deep1b split1 split2 so101a so101b so101c so101d so101e so101f so101g"
+# so101h (依頼 403): so101f と同じ値で, データだけ rule_401 をコードだけで流した成功 56 本の ABOVE_BLOCK〜GRASP_CLOSED
+#   (so101_redblock_box_code_rule401_grasp_v1. export_so101_ideal_var_raw_episodes.py --set h. 4b は pod_prep_so101.sh <steps> h).
+#   推論のモデル (LAB_MODELS) にも足した
+LAB_TRAIN_MODELS="corr corr2 corr3 deep1 deep1b split1 split2 so101a so101b so101c so101d so101e so101f so101g so101h"
 lab_train_def() {           # lab_train_def corr|corr2|corr3|deep1|deep1b → TRAIN_* (知らない名前なら 1)
     TRAIN_STEPS=1500; TRAIN_PREP=pod_prep_trim_corr.sh      # ステップ数の既定・4b で流す準備 (依頼 133 で deep1 だけ違う)
-    TRAIN_LOGSUB=train                                      # 記録を置く lab/<Log>/ の下のフォルダ (依頼 309 で so101d は train_so101d, 依頼 314 で so101e は train_so101e, 依頼 358 で so101f は train_so101f, 依頼 385 で so101g は train_so101g)
+    TRAIN_LOGSUB=train                                      # 記録を置く lab/<Log>/ の下のフォルダ (依頼 309 で so101d は train_so101d, 依頼 314 で so101e は train_so101e, 依頼 358 で so101f は train_so101f, 依頼 385 で so101g は train_so101g, 依頼 403 で so101h は train_so101h)
     TRAIN_DECAY=steps; TRAIN_RETIRED=0                      # corr〜corr3 は add_trim_corr_config.py の 1_500 (= 既定のステップ数)
     case "$1" in
         corr)                   # 依頼 49: 3999 から trim2_corr_v3 で続きを学習した 1499
@@ -588,6 +602,14 @@ lab_train_def() {           # lab_train_def corr|corr2|corr3|deep1|deep1b → TR
             TRAIN_REPO_OUT=PixelstoMotors/pi05-so101-ideal-var-v2-recover-lora-v1
             TRAIN_CKPT_NAME=pi05_so101_ideal_var_v2_recover_lora_v1
             return 0 ;;
+        so101h)                 # 依頼 403: so101f と同じ値で, データだけ rule_401 のコードの成功 56 本のつかむ所 (lab_model_def は使わない)
+            TRAIN_FROM=""; TRAIN_VARIANT=h; TRAIN_EXP=so101_code_rule401_grasp_v1
+            TRAIN_FROM_KIOXIA=""; TRAIN_REPO_IN=""; TRAIN_CKPT_IN=""; TRAIN_INIT=base
+            TRAIN_STEPS=$LAB_SO101H_STEPS; TRAIN_PREP=pod_prep_so101.sh; TRAIN_LOGSUB=train_so101h   # 同じ Log でもほかの学習と記録を分ける
+            TRAIN_DATA=so101_redblock_box_code_rule401_grasp_v1; TRAIN_CONFIG=pi05_so101_code_rule401_grasp_lora
+            TRAIN_REPO_OUT=PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1
+            TRAIN_CKPT_NAME=pi05_so101_code_rule401_grasp_lora_v1
+            return 0 ;;
         *) return 1 ;;
     esac
     lab_model_def "$1" || return 1
diff --git a/lab_start.sh b/lab_start.sh
index 492969f..640cbee 100755
--- a/lab_start.sh
+++ b/lab_start.sh
@@ -44,9 +44,12 @@
 #              so101g = so101f と同じ扱いで, so101f の成功 50 本 + つかみ直しのお手本の成功 14 本で学習した 2999 (依頼 385.
 #                      PixelstoMotors/pi05-so101-ideal-var-v2-recover-lora-v1. Pod の /workspace/ckpt/so101_ideal_var_v2_recover_v1_2999).
 #                      流れ・引数は so101f と同じ (--exec-steps は 1〜30. --rtc・--blend も使える). 正規化の値・安全範囲はこの 64 本から
-#              --blend N (so101a〜so101d・so101f・so101g. 0〜15. 依頼 308): run_so101_policy.py にそのまま渡す (答えの切り替えを N コマかけて
+#              so101h = so101f と同じ扱いで, rule_401 をコードだけで流した成功 56 本のつかむ所 (ブロックの上〜閉じた所) だけで学習した 2999
+#                      (依頼 403. PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1. Pod の /workspace/ckpt/so101_code_rule401_grasp_v1_2999).
+#                      流れ・引数は so101f と同じ (--exec-steps は 1〜30. --rtc・--blend も使える). 正規化の値・安全範囲はこの 56 本の切り出しから
+#              --blend N (so101a〜so101d・so101f・so101g・so101h. 0〜15. 依頼 308): run_so101_policy.py にそのまま渡す (答えの切り替えを N コマかけて
 #                      前の答えと混ぜる. 爪は混ぜない. 0 か付けなければ今までどおり). 起動時に [SO101] で出す
-#              --max-step-deg X (so101a〜so101d・so101f・so101g. 1〜10. 依頼 313): run_so101_policy.py にそのまま渡す (関節 5 つの 1 コマの変化の
+#              --max-step-deg X (so101a〜so101d・so101f・so101g・so101h. 1〜10. 依頼 313): run_so101_policy.py にそのまま渡す (関節 5 つの 1 コマの変化の
 #                      上限を X° に下げる. 爪の 20 は変えない. 10 か付けなければ今までどおり). 起動時に [SO101] で出す
 #              取る場所・設定・assets・サーバーの起動・つなぎ直しの確かめが選んだモデルに合う. 安全範囲 (学習データ ±10°.
 #              run_policy_client.py --raw-dir) は, deep1・deep1b は deep_even10_v1 の raw_episodes (依頼 135), ほかは trim2 の
@@ -132,8 +135,8 @@ NO_PREFETCH=0        # 依頼 285: so101a だけ. 1 なら run_so101_policy.py 
 PLAY_SPEED=""        # 依頼 288: so101a だけ. 付けなければ run_so101_policy.py の既定 (1.0)
 RTC=0                # 依頼 294: so101b だけ. 1 ならサーバーを rtc_serve.py で起動し, 空打ちとクライアントに --rtc を渡す
 RTC_ARGS=()
-BLEND=""             # 依頼 308: so101a〜so101d・so101f・so101g (依頼 309). 付けなければ run_so101_policy.py の既定 (0 = 混ぜない)
-MAX_STEP_DEG=""      # 依頼 313: so101a〜so101d・so101f・so101g. 付けなければ run_so101_policy.py の既定 (10 = 今までどおり)
+BLEND=""             # 依頼 308: so101a〜so101d・so101f・so101g・so101h (依頼 309). 付けなければ run_so101_policy.py の既定 (0 = 混ぜない)
+MAX_STEP_DEG=""      # 依頼 313: so101a〜so101d・so101f・so101g・so101h. 付けなければ run_so101_policy.py の既定 (10 = 今までどおり)
 MECHARM_ONLY=()      # 依頼 283: so101a では使えない mechArm の引数 (付けられていれば止める)
 for a in "$@"; do
     case "$a" in --episode|--no-tilt-fix|--grip-value|--flow|--via-stride|--step-confirm|--no-auto-finish|--speed) MECHARM_ONLY+=("$a") ;; esac
@@ -164,9 +167,9 @@ while [ $# -gt 0 ]; do
                  FLOW_ARGS+=(--speed "$((10#$2))"); shift 2 ;;
         --model) [ $# -ge 2 ] || { echo "[ERROR] --model には ${LAB_MODELS// / か } を付ける" >&2; exit 2; }     # 値がないと shift 2 が失敗して回り続ける (codex R1)
                  MODEL="$2"; shift 2 ;;
-        --exec-steps) [ $# -ge 2 ] || { echo "[ERROR] --exec-steps には 1〜10 (so101b〜so101d・so101f・so101g は 1〜30) の整数を付ける" >&2; exit 2; }     # 依頼 283 (so101a だけ. 依頼 289 で so101b)
-                      case "$2" in ''|*[!0-9]*) echo "[ERROR] --exec-steps は 1〜10 (so101b〜so101d・so101f・so101g は 1〜30) の整数: $2" >&2; exit 2 ;; esac
-                      [ ${#2} -le 2 ] && [ "$((10#$2))" -ge 1 ] && [ "$((10#$2))" -le 30 ] || { echo "[ERROR] --exec-steps は 1〜10 (so101b〜so101d・so101f・so101g は 1〜30) の整数: $2" >&2; exit 2; }
+        --exec-steps) [ $# -ge 2 ] || { echo "[ERROR] --exec-steps には 1〜10 (so101b〜so101d・so101f・so101g・so101h は 1〜30) の整数を付ける" >&2; exit 2; }     # 依頼 283 (so101a だけ. 依頼 289 で so101b)
+                      case "$2" in ''|*[!0-9]*) echo "[ERROR] --exec-steps は 1〜10 (so101b〜so101d・so101f・so101g・so101h は 1〜30) の整数: $2" >&2; exit 2 ;; esac
+                      [ ${#2} -le 2 ] && [ "$((10#$2))" -ge 1 ] && [ "$((10#$2))" -le 30 ] || { echo "[ERROR] --exec-steps は 1〜10 (so101b〜so101d・so101f・so101g・so101h は 1〜30) の整数: $2" >&2; exit 2; }
                       EXEC_STEPS="$((10#$2))"; shift 2 ;;     # 上限 (so101a は 10) はモデルが決まってから見る
         --no-prefetch) NO_PREFETCH=1; shift ;;     # 依頼 285 (so101a だけ)
         --rtc) RTC=1; RTC_ARGS=(--rtc); shift ;;   # 依頼 294 (so101b だけ. 依頼 307 で so101c も)
@@ -180,7 +183,7 @@ while [ $# -gt 0 ]; do
         --play-speed) [ $# -ge 2 ] || { echo "[ERROR] --play-speed には 0 より大きく 1 までの数を付ける (例 0.8)" >&2; exit 2; }     # 依頼 288 (so101a だけ)
                       [[ "$2" =~ ^(0\.[0-9]{1,3}|1|1\.0{1,3})$ ]] && [[ ! "$2" =~ ^0\.0+$ ]] || { echo "[ERROR] --play-speed は 0 より大きく 1 までの数 (例 0.8): $2" >&2; exit 2; }
                       PLAY_SPEED="$2"; shift 2 ;;
-        -h|--help) sed -n '2,94p' "$0"; exit 0 ;;
+        -h|--help) sed -n '2,97p' "$0"; exit 0 ;;
         *) echo "[ERROR] 知らない引数: $1  (./lab_start.sh --help)" >&2; exit 2 ;;
     esac
 done
@@ -194,30 +197,31 @@ case "$MODEL" in            # 依頼 289: so101b は答えが 30 コマ. 答え
     so101d) SO101=1; SO101_HORIZON=30; SO101_STEP=$((LAB_SO101D_STEPS - 1)) ;;      # 依頼 309: so101c と同じ扱い
     so101f) SO101=1; SO101_HORIZON=30; SO101_STEP=$((LAB_SO101F_STEPS - 1)) ;;      # 依頼 358: so101d と同じ扱い
     so101g) SO101=1; SO101_HORIZON=30; SO101_STEP=$((LAB_SO101G_STEPS - 1)) ;;      # 依頼 385: so101f と同じ扱い
+    so101h) SO101=1; SO101_HORIZON=30; SO101_STEP=$((LAB_SO101H_STEPS - 1)) ;;      # 依頼 403: so101f と同じ扱い
 esac
 if [ $SO101 = 1 ] && [ ${#MECHARM_ONLY[@]} -gt 0 ]; then
     echo "[ERROR] --model $MODEL では mechArm の引数は使えない: ${MECHARM_ONLY[*]}" >&2; exit 2
 fi
 if [ $SO101 = 0 ] && [ -n "$EXEC_STEPS" ]; then
-    echo "[ERROR] --exec-steps は --model so101a〜so101d・so101f・so101g だけ" >&2; exit 2
+    echo "[ERROR] --exec-steps は --model so101a〜so101d・so101f・so101g・so101h だけ" >&2; exit 2
 fi
 if [ $SO101 = 1 ] && [ -n "$EXEC_STEPS" ] && [ "$EXEC_STEPS" -gt "$SO101_HORIZON" ]; then
     echo "[ERROR] --exec-steps は 1〜$SO101_HORIZON の整数 (--model $MODEL の答えは $SO101_HORIZON コマ): $EXEC_STEPS" >&2; exit 2
 fi
 if [ $SO101 = 0 ] && [ $NO_PREFETCH = 1 ]; then
-    echo "[ERROR] --no-prefetch は --model so101a〜so101d・so101f・so101g だけ" >&2; exit 2
+    echo "[ERROR] --no-prefetch は --model so101a〜so101d・so101f・so101g・so101h だけ" >&2; exit 2
 fi
 if [ $SO101 = 0 ] && [ -n "$PLAY_SPEED" ]; then
-    echo "[ERROR] --play-speed は --model so101a〜so101d・so101f・so101g だけ" >&2; exit 2
+    echo "[ERROR] --play-speed は --model so101a〜so101d・so101f・so101g・so101h だけ" >&2; exit 2
 fi
 if [ $SO101 = 0 ] && [ -n "$BLEND" ]; then         # 依頼 308
-    echo "[ERROR] --blend は --model so101a〜so101d・so101f・so101g だけ" >&2; exit 2
+    echo "[ERROR] --blend は --model so101a〜so101d・so101f・so101g・so101h だけ" >&2; exit 2
 fi
 if [ $SO101 = 0 ] && [ -n "$MAX_STEP_DEG" ]; then  # 依頼 313
-    echo "[ERROR] --max-step-deg は --model so101a〜so101d・so101f・so101g だけ" >&2; exit 2
+    echo "[ERROR] --max-step-deg は --model so101a〜so101d・so101f・so101g・so101h だけ" >&2; exit 2
 fi
-if [ $RTC = 1 ] && [ "$MODEL" != so101b ] && [ "$MODEL" != so101c ] && [ "$MODEL" != so101d ] && [ "$MODEL" != so101f ] && [ "$MODEL" != so101g ]; then      # 依頼 307: so101c も. 依頼 309: so101d も. 依頼 358: so101f も. 依頼 385: so101g も
-    echo "[ERROR] --rtc は --model so101b・so101c・so101d・so101f・so101g だけ" >&2; exit 2
+if [ $RTC = 1 ] && [ "$MODEL" != so101b ] && [ "$MODEL" != so101c ] && [ "$MODEL" != so101d ] && [ "$MODEL" != so101f ] && [ "$MODEL" != so101g ] && [ "$MODEL" != so101h ]; then      # 依頼 307: so101c も. 依頼 309: so101d も. 依頼 358: so101f も. 依頼 385: so101g も. 依頼 403: so101h も
+    echo "[ERROR] --rtc は --model so101b・so101c・so101d・so101f・so101g・so101h だけ" >&2; exit 2
 fi
 if [ $RTC = 1 ] && [ "$EXEC_STEPS" = 1 ]; then      # codex R2 A4: 1 コマでは前の答えの残りがなく RTC にならない
     echo "[ERROR] --rtc は --exec-steps 2 以上" >&2; exit 2
@@ -483,7 +487,7 @@ if [ $REATTACH = 1 ]; then
             fail "残っている Pod のサーバーは別のモデル${other:+ (--model $other)}で動いています. 起動し直さずに止まります. そのモデルで続けるなら --model ${other:-?} で打ち直す. 選んだモデルに替えるなら ./lab_stop.sh --log $LOG で Pod を消してから打ち直す"
         fi
         echo "[POD   ] 動いているサーバーのモデル: --policy.dir=$SERVE_DIR (--model $MODEL と同じ)"
-        if [ "$MODEL" = so101b ] || [ "$MODEL" = so101c ] || [ "$MODEL" = so101d ] || [ "$MODEL" = so101f ] || [ "$MODEL" = so101g ]; then      # 依頼 294 (依頼 307 で so101c も. 依頼 309 で so101d も. 依頼 358 で so101f も. 依頼 385 で so101g も): RTC の有無 (rtc_serve.py から起動したか) も同じでなければ止まる
+        if [ "$MODEL" = so101b ] || [ "$MODEL" = so101c ] || [ "$MODEL" = so101d ] || [ "$MODEL" = so101f ] || [ "$MODEL" = so101g ] || [ "$MODEL" = so101h ]; then      # 依頼 294 (依頼 307 で so101c も. 依頼 309 で so101d も. 依頼 358 で so101f も. 依頼 385 で so101g も. 依頼 403 で so101h も): RTC の有無 (rtc_serve.py から起動したか) も同じでなければ止まる
             out=$(LAB_TO=$LAB_TO_SHORT pod_ssh "pgrep -f '[r]tc_serve\.py' >/dev/null && echo 'SERVE_RTC 1' || echo 'SERVE_RTC 0'") \
                 || fail "動いているサーバーの RTC の有無を確かめられない (ssh に失敗)"
             serve_rtc=$(grep -E '^SERVE_RTC [01]$' <<<"$out" | tail -1 | cut -d' ' -f2)
diff --git a/lab_train.sh b/lab_train.sh
index 034b353..d2013a4 100755
--- a/lab_train.sh
+++ b/lab_train.sh
@@ -56,6 +56,11 @@
 #                            π0.5 base から学習 → PixelstoMotors/pi05-so101-ideal-var-v2-recover-lora-v1 (依頼 385.
 #                            設定 pi05_so101_ideal_var_v2_recover_lora. exp so101_ideal_var_v2_recover_v1. 4b は pod_prep_so101.sh <steps> g.
 #                            記録は lab/<Log>/train_so101g)
+#                    so101h = so101f と同じ値で, データだけを rule_401 をコードだけで流した成功 56 本の ABOVE_BLOCK〜GRASP_CLOSED
+#                            (so101_redblock_box_code_rule401_grasp_v1. export_so101_ideal_var_raw_episodes.py --set h) にして
+#                            π0.5 base から学習 → PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1 (依頼 403.
+#                            設定 pi05_so101_code_rule401_grasp_lora. exp so101_code_rule401_grasp_v1. 4b は pod_prep_so101.sh <steps> h.
+#                            記録は lab/<Log>/train_so101h)
 #   --steps / --init / --exp-name   学習 (既定 1500 (deep1b は 3000) / 続きの元の params (deep1b は base) /
 #                    trim_corr_v3・trim_corr_v4・trim_corr_v5・deep_even10_v1_b)
 #                    続きの元: corr は /workspace/ckpt/3999/params, corr2 は /workspace/ckpt/corr_v1_1499/params,
@@ -107,7 +112,7 @@ while [ $# -gt 0 ]; do
         --stall-min) lab_need_val 30 "$@"; STALL_MIN="$2"; shift 2 ;;
         --stop) MODE=stop; shift ;;
         --dry-run) DRY_RUN=1; shift ;;
-        -h|--help) sed -n '2,76p' "$0"; exit 0 ;;
+        -h|--help) sed -n '2,81p' "$0"; exit 0 ;;
         *) echo "[ERROR] 知らない引数: $1  (./lab_train.sh --help)" >&2; exit 2 ;;
     esac
 done
@@ -182,7 +187,7 @@ LAST_STEP=$((STEPS - 1))      # openpi は 0 から数え, 最後のステップ
 if [ ! -d "$DATA_ROOT" ]; then
     echo "[ERROR] SSD 未マウント: $DATA_ROOT" >&2; exit 1
 fi
-LOGDIR="$LAB_ROOT/$LOG/$TRAIN_LOGSUB"      # 依頼 309: so101d は train_so101d, 依頼 314: so101e は train_so101e, 依頼 358: so101f は train_so101f, 依頼 385: so101g は train_so101g (ほかは今までどおり train)
+LOGDIR="$LAB_ROOT/$LOG/$TRAIN_LOGSUB"      # 依頼 309: so101d は train_so101d, 依頼 314: so101e は train_so101e, 依頼 358: so101f は train_so101f, 依頼 385: so101g は train_so101g, 依頼 403: so101h は train_so101h (ほかは今までどおり train)
 STATE="$LOGDIR/lab_pod.json"
 mkdir -p "$LOGDIR" || { echo "[ERROR] $LOGDIR を作れない" >&2; exit 1; }
 LOGFILE="$LOGDIR/lab_train_$(date +%Y%m%d_%H%M%S)$([ $MODE = stop ] && echo _stop).txt"
@@ -726,6 +731,7 @@ echo "         $CONFIG --exp-name=$EXP  steps=$STEPS  init=$INIT  上限 $LIMIT_
 [ "$PREP_SH" = pod_prep_so101.sh ] && [ "$PREP_VARIANT" = e ] && echo "         1 回の答え (action_horizon): 30 コマ (so101b と同じ値で, データだけばらつき入りの理想の道の成功の本. 依頼 314)"
 [ "$PREP_SH" = pod_prep_so101.sh ] && [ "$PREP_VARIANT" = f ] && echo "         1 回の答え (action_horizon): 30 コマ (so101e と同じ値で, データだけ rule_351 の成功 50 本. 依頼 358)"
 [ "$PREP_SH" = pod_prep_so101.sh ] && [ "$PREP_VARIANT" = g ] && echo "         1 回の答え (action_horizon): 30 コマ (so101f と同じ値で, データだけ so101f の 50 本 + つかみ直しの成功 14 本. 依頼 385)"
+[ "$PREP_SH" = pod_prep_so101.sh ] && [ "$PREP_VARIANT" = h ] && echo "         1 回の答え (action_horizon): 30 コマ (so101f と同じ値で, データだけ rule_401 のコードの成功 56 本のつかむ所. 依頼 403)"
 
 # ---- 0. 送るものと Mac の道具 ----
 stage "0. 送るものと Mac の道具を確かめる"
diff --git a/lab_train_fakes.sh b/lab_train_fakes.sh
index 422eacf..2e652c1 100644
--- a/lab_train_fakes.sh
+++ b/lab_train_fakes.sh
@@ -88,6 +88,9 @@ TARF="$DATA_ROOT/datasets/so101_redblock_box_ideal_var_v2_success_v1/so101_redbl
 mkdir -p "$DATA_ROOT/datasets/so101_redblock_box_ideal_var_v2_success_recover_v1"     # so101g (依頼 385)
 TARF="$DATA_ROOT/datasets/so101_redblock_box_ideal_var_v2_success_recover_v1/so101_redblock_box_ideal_var_v2_success_recover_v1_raw_episodes.tar"
 [ -f "$TARF" ] || echo "dry tar so101_ideal_var_v2_success_recover_v1" > "$TARF"
+mkdir -p "$DATA_ROOT/datasets/so101_redblock_box_code_rule401_grasp_v1"     # so101h (依頼 403)
+TARF="$DATA_ROOT/datasets/so101_redblock_box_code_rule401_grasp_v1/so101_redblock_box_code_rule401_grasp_v1_raw_episodes.tar"
+[ -f "$TARF" ] || echo "dry tar so101_code_rule401_grasp_v1" > "$TARF"
 # 続きの元 (由来の指紋を取る. 依頼 54): corr は 3999, corr2 は corr の 1499 (依頼 57. lab_train_def が決めた選んだモデルのものだけ.
 # corr の 1499 を置くと, corr の学習で置く先と重なる)
 # deep1 (依頼 133) は続きの元がない (π0.5 base から) ので置かない
diff --git a/pi05/export_so101_ideal_var_raw_episodes.py b/pi05/export_so101_ideal_var_raw_episodes.py
index 2b98fe8..5a4a384 100644
--- a/pi05/export_so101_ideal_var_raw_episodes.py
+++ b/pi05/export_so101_ideal_var_raw_episodes.py
@@ -29,8 +29,18 @@ export_so101_ideal_only_raw_episodes.py (依頼 309. so101d) と同じ書き出
   お手本 ~/so101_datasets/so101_redblock_box_ideal_var_v2_recover_v1 (依頼 377・380. record_recover_377.py) の label == success の
   本を足す. success は割り振りごとに 1 本で, 割り振りが SETS["v3"]["recover_plans"] (14 本. 4 は無い) と同じでなければ止める
   (--trial も止める). 足す本の meta.json には recover (外した所・流れ) も写す. 安全範囲の確かめは 64 本で, v2 の 50 本の範囲との差も出す
+
+--set h (依頼 403. lab_train.sh --model so101h の学習データ so101_redblock_box_code_rule401_grasp_v1):
+  元は KIOXIA lab/so101_Log12/so101/so101_20261201_*/ (rule_401 をコードだけで実機に流した記録. 1 回 = 1 本の LeRobot の記録.
+  読むだけ). 台帳 so101_trials.csv で model == code_rule401・execute == 1・result == success の本だけ (本番は SETS["h"]["exact"]
+  本でなければ止める. result が空の本は入れない). 各本の trial.json の rule401.keyframes の ABOVE_BLOCK のコマから
+  GRASP_CLOSED のコマまで (両端を含む) だけを切り出す (π0.5 が受け持つ区間. HOME → ブロックの上と持ち上げから先は入れない).
+  state・actions は元の observation.state・action (= ptm.sent) のまま. ptm.* の列は入れない. 切り出しの始めのコマの
+  指令と state の差 (関節ごとの中央値・最大) を index.json の lag_start に出す. 安全範囲の確かめは 56 本の切り出しで, so101f
+  (v2 の 50 本) の範囲との差も出す
 """
 import argparse
+import csv
 import glob
 import json
 import os
@@ -39,6 +49,7 @@ import subprocess
 import sys
 from pathlib import Path
 
+import av
 import numpy as np
 from PIL import Image
 
@@ -60,6 +71,9 @@ SETS = {                    # --set. v1 は依頼 314 (so101e) のまま. v2 は
            "request": "依頼 385", "exact": None, "redo": True, "base": "so101_redblock_box_ideal_var_v2_success_v1",
            "base_n": 50, "made_by": "依頼 377 so101/ideal_var/record_recover_377.py",
            "recover_plans": [0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]},
+    "h": {"name": "so101_redblock_box_code_rule401_grasp_v1", "request": "依頼 403", "base": "so101_redblock_box_ideal_var_v2_success_v1",
+          "log_root": "/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12", "trial_prefix": "so101_20261201_", "model": "code_rule401",
+          "source": "local/so101_Log12_code_rule401", "exact": 56, "start_key": "ABOVE_BLOCK", "end_key": "GRASP_CLOSED"},
 }
 RANGE_MARGIN, GRIP_MIN, GRIP_MAX = 10.0, 0.0, 100.0     # run_so101_policy.load_safe_range と同じ
 TRIALS = "/Volumes/KIOXIA/r2r2r-data/lab/so101_Log1[0-2]/so101/so101_*/data/*/*.parquet"
@@ -133,16 +147,20 @@ def pick_var(src_root, name, redo=False):
 def main(argv=None):
     ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
     ap.add_argument("--set", default="v1", choices=sorted(SETS),
-                    help="v1 = 依頼 314 (so101e) / v2 = 依頼 358 (so101f) / v3 = 依頼 385 (so101g. v2 の 50 本 + つかみ直しの成功 14 本)")
+                    help="v1 = 依頼 314 (so101e) / v2 = 依頼 358 (so101f) / v3 = 依頼 385 (so101g. v2 の 50 本 + つかみ直しの成功 14 本) / "
+                         "h = 依頼 403 (so101h. rule_401 のコードだけの成功 56 本の ABOVE_BLOCK〜GRASP_CLOSED)")
     ap.add_argument("--src-root", default=str(SRC_ROOT), help="記録を置いている所 (~/so101_datasets)")
     ap.add_argument("--ideal", default=None, help=f"理想の道の記録の名前 (既定 v1 は {IDEAL}, v2 は {SETS['v2']['ideal']})")
     ap.add_argument("--out-root", default=str(OUT_ROOT))
     ap.add_argument("--trial", action="store_true", help="通しを試す: 本数をそろえず, KIOXIA の下には書かない")
     ap.add_argument("--dry-run", action="store_true", help="選ぶ本と本数だけ出して何も書かない")
     ap.add_argument("--base-root", default=None, help="--set v3 で写す v2 の書き出しを置いている所 (既定 --out-root)")
+    ap.add_argument("--log-root", default=None, help="--set h の実機の記録 (台帳 so101_trials.csv と so101/) を置いている所 (既定 KIOXIA lab/so101_Log12)")
     args = ap.parse_args(argv)
     cfg = SETS[args.set]
     name = cfg["name"]
+    if args.set == "h":
+        return main_h(args, cfg)
     if args.ideal is None:
         args.ideal = cfg["ideal"]
     if args.set == "v3":
@@ -451,5 +469,216 @@ def main_v3(args, cfg):
     return 0
 
 
+def pick_rule401(log_root, cfg):
+    """依頼 403: 台帳で model == code_rule401・execute == 1・result == success の本 → [(試行の名前, 場所, trial.json)] と 外した本.
+    trial.json の model・execute・result・keyframes が台帳と合わなければ止める"""
+    p = log_root / "so101_trials.csv"
+    if not p.exists():
+        sys.exit(f"[ERROR] 台帳がない: {p}")
+    with open(p, newline="") as f:
+        rows = [r for r in csv.DictReader(f) if r["model"] == cfg["model"] and r["trial"].startswith(cfg["trial_prefix"])]
+    picked, dropped = [], []
+    for r in rows:
+        if r["execute"] != "1" or r["result"] != "success":
+            dropped.append((r["trial"], r["place"], r["execute"], r["result"], r["frames"]))
+            continue
+        tj = log_root / "so101" / r["trial"] / "trial.json"
+        if not tj.exists():
+            sys.exit(f"[ERROR] trial.json がない: {tj}")
+        t = json.loads(tj.read_text())
+        if (t.get("model"), str(t.get("execute")), t.get("result"), str(t.get("place"))) != (cfg["model"], "1", "success", r["place"]):
+            sys.exit(f"[ERROR] {r['trial']}: trial.json (model {t.get('model')}・execute {t.get('execute')}・result {t.get('result')}・"
+                     f"場所 {t.get('place')}) が台帳と合わない")
+        kf = (t.get("rule401") or {}).get("keyframes") or {}
+        a, b = kf.get(cfg["start_key"]), kf.get(cfg["end_key"])
+        if not (isinstance(a, int) and isinstance(b, int) and 0 <= a < b < int(t["frames"])):
+            sys.exit(f"[ERROR] {r['trial']}: keyframes の {cfg['start_key']} {a}・{cfg['end_key']} {b} が使えない (frames {t.get('frames')})")
+        picked.append((r["trial"], int(r["place"]), t))
+    names = [x[0] for x in picked]
+    if len(names) != len(set(names)):
+        sys.exit(f"[ERROR] 台帳に同じ試行が 2 行以上ある: {sorted(n for n in set(names) if names.count(n) > 1)}")
+    return picked, dropped
+
+
+def write_slice_frames(src_root, d, info, eps, a, b, out_dir, cam):
+    """1 本の記録の動画から a〜b コマ目 (両端を含む) を 000000.jpg から書く (ex.write_frames と同じ縮め方・同じ画質) → 書いた枚数"""
+    key = f"observation.images.{cam}"
+    start = round(float(eps.loc[0, f"videos/{key}/from_timestamp"]) * FPS)
+    end = round(float(eps.loc[0, f"videos/{key}/to_timestamp"]) * FPS)
+    assert end - start == int(eps.loc[0, "length"]), f"{d} {cam}: 動画の長さ {end - start} コマと length が違う"
+    want = {start + i: i - a for i in range(a, b + 1)}
+    n = 0
+    with av.open(str(ex.video_path(src_root, d, info, eps, 0, cam))) as c:
+        for fr in c.decode(video=0):
+            g = round(float(fr.time) * FPS)
+            if g not in want:
+                continue
+            j = want.pop(g)
+            img = fr.to_image()
+            assert img.size == (640, 480), f"{d} {cam}: コマの大きさ {img.size}"
+            img.resize((OUT_W, OUT_H), Image.Resampling.BOX).save(out_dir / f"frames_{cam}" / f"{j:06d}.jpg", quality=ex.JPEG_Q)
+            n += 1
+    assert not want, f"{d} {cam}: 動画に見つからないコマ {len(want)} 枚"
+    return n
+
+
+def lag_table(lags):
+    """lags: 切り出しの始めのコマの (指令 − state) [本, 6] → 関節ごとの 中央値・最大 (絶対値)"""
+    L = np.abs(np.asarray(lags, np.float64))
+    return {ex.JOINTS[j]: {"median_abs": round(float(np.median(L[:, j])), 2), "max_abs": round(float(L[:, j].max()), 2),
+                           "median_signed": round(float(np.median(np.asarray(lags)[:, j])), 2)} for j in range(6)}
+
+
+def main_h(args, cfg):
+    """依頼 403: rule_401 をコードだけで流した成功の本から ABOVE_BLOCK〜GRASP_CLOSED だけを切り出す"""
+    name = cfg["name"]
+    log_root, out_root = Path(args.log_root or cfg["log_root"]), Path(args.out_root)
+    if args.trial and mx.under_kioxia(out_root):
+        sys.exit(f"[ERROR] --trial の出力は KIOXIA の下に置かない: {out_root}")
+    src_root = log_root / "so101"
+    picked, dropped = pick_rule401(log_root, cfg)
+    per = {}
+    for _, place, _ in picked:
+        per[place] = per.get(place, 0) + 1
+    print(f"[PICK  ] {log_root.name} の {cfg['model']} の success {len(picked)} 本 (場所ごと {dict(sorted(per.items()))})")
+    print(f"[DROP  ] 外した本 {len(dropped)} 本: " + ", ".join(f"{t} (場所 {pl}・execute {ex_}・result '{rs}'・{fr} コマ)"
+                                                          for t, pl, ex_, rs, fr in dropped))
+    if not picked:
+        sys.exit("[ERROR] success の本がない")
+    if len(picked) != cfg["exact"]:
+        if not args.trial:
+            sys.exit(f"[ERROR] success が {len(picked)} 本 ({cfg['exact']} 本でない). 何も書かずに止めます")
+        print(f"[TRIAL ] 試し: 本数 ({cfg['exact']} 本) は見ない")
+
+    srcs, arrays, lags = [], [], []
+    for d, place, t in picked:
+        info, data, eps, task_of = ex.load_source(src_root, d)
+        if int(info["total_episodes"]) != 1:
+            sys.exit(f"[ERROR] {d}: 1 本の記録ではない ({info['total_episodes']} 本)")
+        length = int(eps.loc[0, "length"])
+        if length != int(t["frames"]):
+            sys.exit(f"[ERROR] {d}: 記録のコマ数 {length} と trial.json の frames {t['frames']} が違う")
+        state, actions = ex.episode_arrays(data, 0, length, task_of)
+        kf = t["rule401"]["keyframes"]
+        a, b = kf[cfg["start_key"]], kf[cfg["end_key"]]
+        srcs.append((d, place, t, info, eps, a, b, length))
+        arrays.append((state[a:b + 1], actions[a:b + 1]))
+        lags.append(actions[a] - state[a])
+    rc = range_check(arrays)
+    bpath = out_root / cfg["base"] / "index.json"
+    if bpath.exists():
+        rb = json.loads(bpath.read_text())["range_check"]
+        rc["vs_base"] = {"base": cfg["base"], "lo": (np.array(rc["lo"]) - np.array(rb["lo"])).round(2).tolist(),
+                         "hi": (np.array(rc["hi"]) - np.array(rb["hi"])).round(2).tolist()}
+    print_range(rc)
+    if "vs_base" in rc:
+        print(f"[RANGE ] so101f ({cfg['base']}) の範囲からの差 (lo は負で下へ広がる・hi は正で上へ広がる): "
+              f"lo {rc['vs_base']['lo']} hi {rc['vs_base']['hi']}")
+    lag = lag_table(lags)
+    print(f"[LAG   ] 切り出しの始め ({cfg['start_key']}) の 指令 − state (|差| の中央値 / 最大. 度・爪は目盛り):")
+    for j, v in lag.items():
+        print(f"           {j:18s} {v['median_abs']:6.2f} / {v['max_abs']:6.2f}  (符号つきの中央値 {v['median_signed']:+.2f})")
+    if args.dry_run:
+        for d, place, t, _, _, a, b, length in srcs:
+            print(f"   {d}  場所 {place}  {cfg['start_key']} {a}〜{cfg['end_key']} {b}  {b - a + 1} コマ (元 {length})")
+        return 0
+
+    if not out_root.is_dir():
+        sys.exit(f"[ERROR] 置き場所がない (SSD 未マウント?): {out_root}")
+    out = out_root / name
+    if out.exists():
+        sys.exit(f"[ERROR] もうある (上書きしない): {out}")
+    tmp = out_root / f".{name}.tmp.{os.getpid()}"
+    tmp.mkdir()
+    raw = tmp / "raw_episodes"
+    raw.mkdir()
+
+    # 1. 切り出しを書き出す (state・actions は元の値のまま. ptm.* は入れない)
+    rows = []
+    for (d, place, t, info, eps, a, b, length), (st, ac), lg in zip(srcs, arrays, lags):
+        steps = b - a + 1
+        e = raw / d
+        for cam in CAMERAS:
+            (e / f"frames_{cam}").mkdir(parents=True)
+        np.savez(e / "episode.npz", state=st, actions=ac)
+        r4 = t["rule401"]
+        meta = {"task": ex.TASK, "fps": FPS, "steps": steps, "image_size": [OUT_W, OUT_H], "state_dim": 6,
+                "state_names": ex.JOINTS, "action": "rule_401 code target (absolute, same as source action = ptm.sent)",
+                "cameras": {c: f"frames_{c}" for c in CAMERAS},
+                "source_dataset": cfg["source"], "source_trial": d, "source_episode_index": 0, "source_frames": length,
+                "place": place, "label": "success", "model": t["model"], "step": t.get("step"),
+                "slice": {"start_key": cfg["start_key"], "end_key": cfg["end_key"], "start_frame": a, "end_frame": b},
+                "keyframes": r4["keyframes"], "lag_start": np.round(lg, 3).tolist(),
+                **{k: r4.get(k) for k in ("block_pixel", "block_yaw_deg", "plan_pixel", "yaw_plan", "from_candidate",
+                                          "pixel_from_plan_px", "status", "dz_mm", "shift_right_fwd_mm", "above_shifted")}}
+        (e / "meta.json").write_text(json.dumps(meta, ensure_ascii=False, indent=2) + "\n")
+        for cam in CAMERAS:
+            assert write_slice_frames(src_root, d, info, eps, a, b, e, cam) == steps, f"{d} {cam}"
+        rows.append({"dir": e.name, "place": place, "source": cfg["source"], "trial": d, "steps": steps, "kind": "code_rule401_grasp",
+                     "start_frame": a, "end_frame": b, "source_frames": length, "status": r4.get("status"),
+                     "from_candidate": r4.get("from_candidate"), "pixel_from_plan_px": r4.get("pixel_from_plan_px")})
+    print(f"[WRITE ] {len(rows)} 本")
+
+    # 2. 確かめる: 元の parquet の切り出しと同じ・meta.json の steps・jpg の枚数と大きさ
+    total = 0
+    for row in rows:
+        e = raw / row["dir"]
+        info, data, eps, task_of = ex.load_source(src_root, row["trial"])
+        st, ac = ex.episode_arrays(data, 0, row["source_frames"], task_of)
+        a, b = row["start_frame"], row["end_frame"]
+        z = np.load(e / "episode.npz")
+        assert np.array_equal(z["state"], st[a:b + 1]) and np.array_equal(z["actions"], ac[a:b + 1]), f"{e.name}: 切り出しが元と違う"
+        assert z["state"].shape == z["actions"].shape == (row["steps"], 6), e.name
+        meta = json.loads((e / "meta.json").read_text())
+        assert meta["steps"] == row["steps"] and meta["fps"] == FPS and meta["image_size"] == [OUT_W, OUT_H], e.name
+        for cam in CAMERAS:
+            jpgs = sorted(p.name for p in (e / f"frames_{cam}").glob("[!.]*.jpg"))
+            assert jpgs == [f"{i:06d}.jpg" for i in range(row["steps"])], f"{e.name}: {cam} の jpg が {len(jpgs)} 枚"
+            with Image.open(e / f"frames_{cam}" / jpgs[-1]) as im:
+                assert im.size == (OUT_W, OUT_H), e.name
+        total += row["steps"]
+    n = len(list(raw.glob("[!.]*/episode.npz")))
+    assert n == len(rows), f"raw_episodes の本数 {n}"
+    print(f"[VERIFY] {n} 本・{total} コマ (元の parquet の切り出しと同じ・jpg の枚数がコマ数と同じ)")
+
+    by = {}
+    for x in rows:
+        b_ = by.setdefault(x["kind"], {}).setdefault(str(x["place"]), {"episodes": 0, "frames": 0})
+        b_["episodes"] += 1
+        b_["frames"] += x["steps"]
+    index = {"name": name, "request": cfg["request"] + (" (試し)" if args.trial else ""), "task": ex.TASK, "fps": FPS,
+             "image_size": [OUT_W, OUT_H], "source_image_size": [640, 480], "cameras": {c: f"frames_{c}" for c in CAMERAS},
+             "joints": ex.JOINTS,
+             "actions": "rule_401 のコードが送った目標 (action = ptm.sent). 関節 6 つの絶対値. 学習で関節 5 つを差分・爪は絶対値にする",
+             "pick_rule": f"台帳 so101_trials.csv の model == {cfg['model']}・execute == 1・result == success. "
+                          f"各本の trial.json rule401.keyframes の {cfg['start_key']}〜{cfg['end_key']} (両端を含む) だけ",
+             "range_check": rc, "lag_start": {"n": len(lags), "joints": lag},
+             "sources": {"log": {"path": str(log_root), "trials_sha256": ex.sha256(log_root / "so101_trials.csv"),
+                                 "picked": [r["trial"] for r in rows],
+                                 "dropped": [{"trial": t_, "place": pl, "execute": e_, "result": rs, "frames": fr}
+                                             for t_, pl, e_, rs, fr in dropped],
+                                 "data_sha256": {r["trial"]: ex.sha256(src_root / r["trial"] / "data" / "chunk-000" / "file-000.parquet")
+                                                 for r in rows}}},
+             "episodes": rows,
+             "summary": {"episodes": n, "frames": total, "by_kind_place": by,
+                         "steps_min": min(r["steps"] for r in rows), "steps_max": max(r["steps"] for r in rows)},
+             "verify": "npz は元の parquet の切り出しと同じ / 各本の jpg がカメラごとにコマ数と同じ枚数: OK"}
+
+    tar = tmp / f"{name}_raw_episodes.tar"
+    env = dict(os.environ, COPYFILE_DISABLE="1")          # macOS の ._ を tar に入れない
+    subprocess.run(["tar", "cf", str(tar), "--exclude", "._*", "-C", str(tmp), "raw_episodes"], check=True, env=env)
+    names = subprocess.run(["tar", "tf", str(tar)], check=True, capture_output=True, text=True).stdout.splitlines()
+    n_tar = sum(1 for x in names if x.endswith("/episode.npz") and not x.split("/")[-1].startswith("._"))
+    n_jpg = sum(1 for x in names if x.endswith(".jpg") and "/._" not in x)
+    assert n_tar == n and n_jpg == 2 * total, f"tar の中: 本数 {n_tar}・jpg {n_jpg} (書いたのは {n} 本・{2 * total} 枚)"
+    assert not any("/._" in x for x in names), "tar に ._ が入っている"
+    index["tar"] = {"path": tar.name, "bytes": tar.stat().st_size, "sha256": ex.sha256(tar), "episodes": n_tar, "jpg": n_jpg}
+    (tmp / "index.json").write_text(json.dumps(index, ensure_ascii=False, indent=2) + "\n")
+    tmp.rename(out)
+    print(f"[TAR   ] {out / tar.name}  {index['tar']['bytes']} バイト  sha256 {index['tar']['sha256'][:12]}…  (中 {n_tar} 本・jpg {n_jpg} 枚)")
+    print(f"[DONE  ] {out}  {json.dumps(by, ensure_ascii=False)}")
+    return 0
+
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/pi05/openpi_addon/add_so101_config.py b/pi05/openpi_addon/add_so101_config.py
index 4f9cd61..a0203a8 100644
--- a/pi05/openpi_addon/add_so101_config.py
+++ b/pi05/openpi_addon/add_so101_config.py
@@ -43,6 +43,10 @@ weight_loader は π0.5 base), 次の所だけ変える:
   f の成功 50 本に つかみ直しのお手本の成功 14 本を足した 64 本 (so101_redblock_box_ideal_var_v2_success_recover_v1)
   にしたもの. name pi05_so101_ideal_var_v2_recover_lora. a・h30・c・d・e・f と同じ config.py に一緒に入れられる
 
+--variant h (依頼 403. lab_train.sh --model so101h): f と同じ値 (action_horizon 30 ほか) で, データだけを
+  rule_401 をコードだけで流した成功 56 本の ABOVE_BLOCK〜GRASP_CLOSED の切り出し (so101_redblock_box_code_rule401_grasp_v1)
+  にしたもの. name pi05_so101_code_rule401_grasp_lora. a・h30・c・d・e・f・g と同じ config.py に一緒に入れられる
+
 install_addon.py と add_trim_config.py (lab/Log11/pod/) を実行した後に 1 回実行:
   python3 add_so101_config.py /workspace/openpi --steps 3000                  (a. 依頼 282)
   python3 add_so101_config.py /workspace/openpi --steps 3000 --variant h30    (h30. 依頼 289)
@@ -51,6 +55,7 @@ install_addon.py と add_trim_config.py (lab/Log11/pod/) を実行した後に 1
   python3 add_so101_config.py /workspace/openpi --steps 3000 --variant e      (e. 依頼 314)
   python3 add_so101_config.py /workspace/openpi --steps 3000 --variant f      (f. 依頼 358)
   python3 add_so101_config.py /workspace/openpi --steps 3000 --variant g      (g. 依頼 385)
+  python3 add_so101_config.py /workspace/openpi --steps 3000 --variant h      (h. 依頼 403)
 何度実行しても同じ結果 (二重に入れない). 入っている設定と --steps が違うときは止まる.
 """
 import argparse
@@ -80,10 +85,13 @@ VARIANTS = {
           "  # 30 (e と同じ. データだけ rule_351 の成功 50 本. 依頼 358)"),
     "g": ("pi05_so101_ideal_var_v2_recover_lora", "ideal_var_v2_recover_v1", 30,
           "  # 30 (f と同じ. データだけ f の 50 本 + つかみ直しの成功 14 本. 依頼 385)"),
+    "h": ("pi05_so101_code_rule401_grasp_lora", "code_rule401_grasp_v1", 30,
+          "  # 30 (f と同じ. データだけ rule_401 のコードの成功 56 本のつかむ所. 依頼 403)"),
 }
 REPO_IDS = {"c": "local/so101_redblock_box_teleop_ideal_mix_v1", "d": "local/so101_redblock_box_ideal_x13_only_v1",
             "e": "local/so101_redblock_box_ideal_var_success_v1", "f": "local/so101_redblock_box_ideal_var_v2_success_v1",
-            "g": "local/so101_redblock_box_ideal_var_v2_success_recover_v1"}
+            "g": "local/so101_redblock_box_ideal_var_v2_success_recover_v1",
+            "h": "local/so101_redblock_box_code_rule401_grasp_v1"}
 
 
 def repo_id(variant):
@@ -206,7 +214,7 @@ def main(argv=None):
     ap.add_argument("openpi_root")
     ap.add_argument("--steps", type=int, required=True, help="学習のステップ数 (num_train_steps = decay_steps. 依頼 282 は 3000)")
     ap.add_argument("--variant", choices=sorted(VARIANTS), default="a",
-                    help="a = action_horizon 10 (依頼 282) / h30 = action_horizon 30 (依頼 289) / c = h30 の値で人のお手本 + 理想の道 (依頼 301) / d = c の値で理想の道だけ (依頼 309) / e = h30 の値でばらつき入りの理想の道だけ (依頼 314) / f = e の値で rule_351 の成功 50 本 (依頼 358) / g = f の値で f の 50 本 + つかみ直しの成功 14 本 (依頼 385)")
+                    help="a = action_horizon 10 (依頼 282) / h30 = action_horizon 30 (依頼 289) / c = h30 の値で人のお手本 + 理想の道 (依頼 301) / d = c の値で理想の道だけ (依頼 309) / e = h30 の値でばらつき入りの理想の道だけ (依頼 314) / f = e の値で rule_351 の成功 50 本 (依頼 358) / g = f の値で f の 50 本 + つかみ直しの成功 14 本 (依頼 385) / h = f の値で rule_401 のコードの成功 56 本のつかむ所 (依頼 403)")
     args = ap.parse_args(argv)
     name = VARIANTS[args.variant][0]
     mark_a, mark_b = marks(args.variant)
diff --git a/pi05/openpi_addon/pod_prep_so101.sh b/pi05/openpi_addon/pod_prep_so101.sh
index f9c51a7..1cb12e2 100644
--- a/pi05/openpi_addon/pod_prep_so101.sh
+++ b/pi05/openpi_addon/pod_prep_so101.sh
@@ -30,6 +30,9 @@
 #            データだけ so101_redblock_box_ideal_var_v2_success_recover_v1 (f の 50 本 + つかみ直しのお手本の成功 14 本 = 64 本.
 #            50 本が so101_redblock_box_ideal_var_v2 の success, 14 本が so101_redblock_box_ideal_var_v2_recover_v1 の success か を確かめる.
 #            Mac で export_so101_ideal_var_raw_episodes.py --set v3 が作る))
+#            か h (依頼 403. lab_train.sh --model so101h. 設定 pi05_so101_code_rule401_grasp_lora. f と同じ値で,
+#            データだけ so101_redblock_box_code_rule401_grasp_v1 (rule_401 をコードだけで流した成功 56 本の ABOVE_BLOCK〜GRASP_CLOSED.
+#            全部が so101_Log12_code_rule401 の success か を確かめる. Mac で export_so101_ideal_var_raw_episodes.py --set h が作る))
 #
 # すること (何度流しても同じ結果):
 #   1. tar を /workspace/data/<データ名>/ に広げ, エピソードの本数を確かめる (Mac で作ったときは 50 本)
@@ -52,7 +55,8 @@ case "$VARIANT" in          # 何かする前に確かめる
     e) CONFIG=pi05_so101_ideal_var_lora; EXP=so101_ideal_var_v1; NAME=so101_redblock_box_ideal_var_success_v1; N_MAC=var ;;   # 依頼 314 (本数は下で確かめる)
     f) CONFIG=pi05_so101_ideal_var_v2_lora; EXP=so101_ideal_var_v2_v1; NAME=so101_redblock_box_ideal_var_v2_success_v1; N_MAC=50 ;;   # 依頼 358
     g) CONFIG=pi05_so101_ideal_var_v2_recover_lora; EXP=so101_ideal_var_v2_recover_v1; NAME=so101_redblock_box_ideal_var_v2_success_recover_v1; N_MAC=64 ;;   # 依頼 385
-    *) echo "[ERROR] <variant> は a か h30 か c か d か e か f か g: $VARIANT" >&2; exit 2 ;;
+    h) CONFIG=pi05_so101_code_rule401_grasp_lora; EXP=so101_code_rule401_grasp_v1; NAME=so101_redblock_box_code_rule401_grasp_v1; N_MAC=56 ;;   # 依頼 403
+    *) echo "[ERROR] <variant> は a か h30 か c か d か e か f か g か h: $VARIANT" >&2; exit 2 ;;
 esac
 TAR=/workspace/data/${NAME}_raw_episodes.tar
 DATA=/workspace/data/$NAME
@@ -88,6 +92,10 @@ if [ "$VARIANT" = g ]; then     # 依頼 385: 50 本が rule_351 の記録の su
         [ "$N_SRC" = "$SRC_N" ] || { echo "[ERROR] tar の $N 本のうち $SRC_NAME の success は $N_SRC 本 ($SRC_N 本のはず): $TAR" >&2; rm -rf "$TMP"; exit 1; }
     done
 fi
+if [ "$VARIANT" = h ]; then     # 依頼 403: 56 本が全部 rule_401 のコードだけの記録 (so101_Log12_code_rule401) の success の本か
+    N_SRC=$(python3 -c 'import json,sys,pathlib; print(sum(1 for p in pathlib.Path(sys.argv[1]).glob("[!.]*/meta.json") if json.loads(p.read_text()).get("source_dataset") == "local/so101_Log12_code_rule401" and json.loads(p.read_text()).get("label") == "success"))' "$TMP/raw_episodes")
+    [ "$N_SRC" = "$N" ] || { echo "[ERROR] tar の $N 本のうち so101_Log12_code_rule401 の success は $N_SRC 本: $TAR" >&2; rm -rf "$TMP"; exit 1; }
+fi
 rm -rf "$DATA"
 mv "$TMP" "$DATA"
 # meta.json の steps の合計 (変換したあとのコマ数と比べる)
@@ -105,7 +113,7 @@ grep -qx "CONVERTED episodes=$N frames=$FRAMES" "$CONV_LOG" \
     || { echo "[ERROR] 変換した本数・コマ数が raw_episodes ($N 本・$FRAMES コマ) と違う" >&2; rm -f "$CONV_LOG"; exit 1; }
 rm -f "$CONV_LOG"
 echo "   変換した本数・コマ数は raw_episodes と同じ ($N 本・$FRAMES コマ)"
-if [ "$VARIANT" = h30 ] || [ "$VARIANT" = c ] || [ "$VARIANT" = d ] || [ "$VARIANT" = e ] || [ "$VARIANT" = f ] || [ "$VARIANT" = g ]; then      # 依頼 289 (c・d・e・f・g も答え 30 コマ. 依頼 301・309・314・358・385): 先の 30 コマが足りないコマの埋め方を見て出すだけ (確かめられなくても止めない)
+if [ "$VARIANT" = h30 ] || [ "$VARIANT" = c ] || [ "$VARIANT" = d ] || [ "$VARIANT" = e ] || [ "$VARIANT" = f ] || [ "$VARIANT" = g ] || [ "$VARIANT" = h ]; then      # 依頼 289 (c・d・e・f・g・h も答え 30 コマ. 依頼 301・309・314・358・385・403): 先の 30 コマが足りないコマの埋め方を見て出すだけ (確かめられなくても止めない)
     echo "== 3b. 先の 30 コマが足りないコマを openpi (LeRobot) がどう埋めるか (check_pad_so101.py. 学習には何も足さない)"
     uv run python "$ADDON/check_pad_so101.py" --repo-id "local/$NAME" --horizon 30 --openpi "$OPENPI" \
         || echo "   [WARN] 埋め方を確かめられなかった (学習は続ける)"
diff --git a/pi05/test_so101_train.py b/pi05/test_so101_train.py
index 5c279e3..b186813 100644
--- a/pi05/test_so101_train.py
+++ b/pi05/test_so101_train.py
@@ -235,7 +235,7 @@ class TestPodPrepSo101(unittest.TestCase):
     def test_unknown_variant_stops_first(self):
         r = subprocess.run(["bash", str(self.SH), "3000", "b"], capture_output=True, text=True)
         self.assertEqual(r.returncode, 2)
-        self.assertIn("<variant> は a か h30 か c か d か e か f か g: b", r.stderr)
+        self.assertIn("<variant> は a か h30 か c か d か e か f か g か h: b", r.stderr)
         self.assertNotIn("tar がない", r.stderr)
 
     def test_converter_compiles(self):
@@ -315,7 +315,7 @@ class TestSo101C(unittest.TestCase):
     def test_pod_prep_c(self):
         code = (ADDON / "pod_prep_so101.sh").read_text()
         self.assertIn("c) CONFIG=pi05_so101_teleop_ideal_mix_lora; EXP=so101_teleop_ideal_mix_v1; NAME=so101_redblock_box_teleop_ideal_mix_v1; N_MAC=100 ;;", code)
-        self.assertIn('if [ "$VARIANT" = h30 ] || [ "$VARIANT" = c ] || [ "$VARIANT" = d ] || [ "$VARIANT" = e ] || [ "$VARIANT" = f ] || [ "$VARIANT" = g ]; then', code)     # 依頼 309 で d, 依頼 314 で e, 依頼 358 で f, 依頼 385 で g も
+        self.assertIn('if [ "$VARIANT" = h30 ] || [ "$VARIANT" = c ] || [ "$VARIANT" = d ] || [ "$VARIANT" = e ] || [ "$VARIANT" = f ] || [ "$VARIANT" = g ] || [ "$VARIANT" = h ]; then', code)     # 依頼 309 で d, 依頼 314 で e, 依頼 358 で f, 依頼 385 で g, 依頼 403 で h も
 
     def test_mix_pick_and_guards(self):
         try:
@@ -692,5 +692,106 @@ class TestSo101G(unittest.TestCase):
             self.assertIn("v2 の書き出し", str(cm.exception))
 
 
+class TestSo101H(unittest.TestCase):
+    """依頼 403: so101h は f と同じ値で, 名前とデータ (repo_id) だけ違う. 書き出しの守り (台帳の code_rule401 の success だけ・keyframes)"""
+
+    def test_h_differs_from_f_only_in_name_and_data(self):
+        with tempfile.TemporaryDirectory() as td, mock.patch("sys.stdout"):
+            cfg = fake_openpi(Path(td))
+            for v in ("h30", "c", "d", "e", "f", "g"):
+                self.assertEqual(asc.main([td, "--steps", "3000", "--variant", v]), 0)
+            before = configs(cfg)
+            self.assertEqual(asc.main([td, "--steps", "3000", "--variant", "h"]), 0)
+            c = configs(cfg)
+            for k in before:
+                self.assertEqual(c[k], before[k], k)                # h30・c〜g は h を足しても同じ
+            x, y = c["pi05_so101_ideal_var_v2_lora"], c["pi05_so101_code_rule401_grasp_lora"]
+            self.assertEqual(set(x), set(y))
+            for k in x:
+                if k == "name":
+                    continue
+                if k == "data":
+                    self.assertEqual(y[k], x[k].replace("so101_redblock_box_ideal_var_v2_success_v1",
+                                                        "so101_redblock_box_code_rule401_grasp_v1"))
+                else:
+                    self.assertEqual(y[k], x[k], k)
+            s = cfg.read_text()
+            self.assertEqual(asc.main([td, "--steps", "3000", "--variant", "h"]), 0)    # 二重に入れない
+            self.assertEqual(cfg.read_text(), s)
+
+    def test_pod_prep_h(self):
+        code = (ADDON / "pod_prep_so101.sh").read_text()
+        self.assertIn("h) CONFIG=pi05_so101_code_rule401_grasp_lora; EXP=so101_code_rule401_grasp_v1; "
+                      "NAME=so101_redblock_box_code_rule401_grasp_v1; N_MAC=56 ;;", code)
+
+    def test_pod_prep_h_checks_source(self):
+        """h は 56 本が全部 so101_Log12_code_rule401 の success"""
+        if not shutil.which("bash"):
+            self.skipTest("bash がない")
+        code = (ADDON / "pod_prep_so101.sh").read_text()
+        a = code.index('if [ "$VARIANT" = h ]; then')
+        b = code.index("\nfi\n", a) + 4
+        part = code[a:b]
+        src, other = "local/so101_Log12_code_rule401", "local/so101_redblock_box_ideal_var_v2"
+        for srcs, labels, ok in (([src] * 56, ["success"] * 56, True), ([src] * 55 + [other], ["success"] * 56, False),
+                                 ([src] * 56, ["success"] * 55 + ["fail"], False)):
+            with tempfile.TemporaryDirectory() as td:
+                raw = Path(td) / "raw_episodes"
+                for i, (sd, lb) in enumerate(zip(srcs, labels)):
+                    (raw / f"ep{i:03d}").mkdir(parents=True)
+                    (raw / f"ep{i:03d}" / "meta.json").write_text(json.dumps({"source_dataset": sd, "label": lb}))
+                sh = f'VARIANT=h; TMP={td}; TAR=t.tar; N=56\n{part}\necho OK\n'
+                r = subprocess.run(["bash", "-c", sh], capture_output=True, text=True)
+                self.assertEqual(r.returncode == 0, ok, (srcs.count(other), labels.count("fail"), r.stderr))
+
+    def test_h_export_guards(self):
+        try:
+            import export_so101_ideal_var_raw_episodes as ev
+        except ImportError as e:
+            self.skipTest(f"lerobot の環境でない ({e})")
+        h = ev.SETS["h"]
+        self.assertEqual((h["name"], h["exact"], h["start_key"], h["end_key"]),
+                         ("so101_redblock_box_code_rule401_grasp_v1", 56, "ABOVE_BLOCK", "GRASP_CLOSED"))
+        self.assertEqual(ev.SETS["v3"]["name"], "so101_redblock_box_ideal_var_v2_success_recover_v1")     # v3 (so101g) は変えない
+        with tempfile.TemporaryDirectory() as td:
+            log = Path(td) / "log"
+            (log / "so101").mkdir(parents=True)
+            head = "trial,started_at,operator,place,model,step,exec_steps,execute,result,frames\n"
+
+            def trial(name, place, result="success", model="code_rule401", kf=None, frames=251, execute=1):
+                (log / "so101" / name).mkdir(exist_ok=True)
+                kf = kf if kf is not None else {"ABOVE_BLOCK": 67, "GRASP_CLOSED": 148}
+                (log / "so101" / name / "trial.json").write_text(json.dumps(
+                    {"model": model, "execute": execute, "result": result, "place": place, "frames": frames,
+                     "rule401": {"keyframes": kf}}))
+                return f"{name},x,code,{place},{model},rule_401,,{execute},{result},{frames}\n"
+
+            rows = [trial("so101_20261201_0900%02d" % i, 2 + i % 4) for i in range(3)]
+            rows.append(trial("so101_20261201_095108", 2, result=""))                     # result が空 → 外す
+            rows.append(trial("so101_20261201_095200", 3, model="so101g"))                # ほかのモデル → 見ない
+            rows.append("so101_20261130_100000,x,code,2,code_rule401,rule_401,,1,success,251,extra,cols\n")   # 別の日 → 見ない
+            (log / "so101_trials.csv").write_text(head + "".join(rows))
+            picked, dropped = ev.pick_rule401(log, h)
+            self.assertEqual([p[0] for p in picked], ["so101_20261201_090000", "so101_20261201_090001", "so101_20261201_090002"])
+            self.assertEqual([d[0] for d in dropped], ["so101_20261201_095108"])
+            with mock.patch("sys.stdout"), self.assertRaises(SystemExit) as cm:     # 本番は 56 本でなければ止める
+                ev.main(["--set", "h", "--log-root", str(log), "--out-root", td, "--dry-run"])
+            self.assertIn("56 本でない", str(cm.exception))
+            trial("so101_20261201_090001", 3, result="fail")                         # trial.json が台帳と合わない → 止める
+            with self.assertRaises(SystemExit) as cm:
+                ev.pick_rule401(log, h)
+            self.assertIn("台帳と合わない", str(cm.exception))
+            trial("so101_20261201_090001", 3, kf={"ABOVE_BLOCK": 148, "GRASP_CLOSED": 67})   # 区間が逆 → 止める
+            with self.assertRaises(SystemExit) as cm:
+                ev.pick_rule401(log, h)
+            self.assertIn("keyframes", str(cm.exception))
+            trial("so101_20261201_090001", 3, kf={"ABOVE_BLOCK": 67})                       # GRASP_CLOSED がない → 止める
+            with self.assertRaises(SystemExit):
+                ev.pick_rule401(log, h)
+        lag = ev.lag_table([[1, -2, 3, 0, 0, 0], [-3, 2, 1, 0, 0, 1]])
+        self.assertEqual(lag["shoulder_pan.pos"], {"median_abs": 2.0, "max_abs": 3.0, "median_signed": -1.0})
+        self.assertEqual(lag["gripper.pos"]["max_abs"], 1.0)
+
+
 if __name__ == "__main__":
     unittest.main()
diff --git a/test_lab_start.sh b/test_lab_start.sh
index b1156a7..268868f 100755
--- a/test_lab_start.sh
+++ b/test_lab_start.sh
@@ -520,7 +520,7 @@ check "終了コード 2・使える名前を出す・API を呼ばない" '[ $R
 rm -rf "$T"
 setup
 (cd "$T" && PATH="$T/bin:$PATH" perl -e 'alarm 10; exec @ARGV' ./lab_start.sh --log LogT --dry-run --model < /dev/null > "$T/out.txt" 2>&1); RC=$?
-check "--model だけで値がない → 回り続けずに終了コード 2 (codex R1)" '[ $RC = 2 ] && has out.txt "--model には trim か corr か corr2 か corr3 か deep1 か deep1b か split1 か split2 か so101a か so101b か so101c か so101d か so101f か so101g を付ける"'
+check "--model だけで値がない → 回り続けずに終了コード 2 (codex R1)" '[ $RC = 2 ] && has out.txt "--model には trim か corr か corr2 か corr3 か deep1 か deep1b か split1 か split2 か so101a か so101b か so101c か so101d か so101f か so101g か so101h を付ける"'
 rm -rf "$T"
 for a in "--gpu" "--episode" "--log" "--gpu --dry-run" "--episode --log LogT" "--log --dry-run"; do
     setup
@@ -643,7 +643,7 @@ check "--serve-only でも空打ちまで行う (依頼 176)" 'has out.txt "===
 check "Pod は消さない (DELETE を呼ばない) で, かかった時間と片付け方を出す" '[ $(n_call DELETE) = 0 ] && has out.txt "=== かかった時間" && has out.txt "Pod は残しています (id $ID_NEW). 片付けは ./lab_stop.sh --log LogT"'
 check "記録 lab_start_*.txt に残る・始めの行に --serve-only と出る" 'grep -qF "サーバーとトンネルだけ (--serve-only" "$T/data/lab/LogT"/lab_start_*.txt'
 rm -rf "$T"
-check "--help に --serve-only・--grip-value・--flow / --speed・5b の空打ちの説明が入る (2〜94 行 (依頼 289 で so101b の 3 行, 依頼 294 で --rtc の 3 行, 依頼 307 で so101c の 3 行, 依頼 308 で --blend の 2 行, 依頼 309 で so101d の 3 行, 依頼 313 で --max-step-deg の 2 行, 依頼 358 で so101f の 3 行, 依頼 385 で so101g の 3 行が増えた))" 'sed -n "2,94p" "$HERE/lab_start.sh" | grep -qF -- "--serve-only  Pod を作って" && sed -n "2,94p" "$HERE/lab_start.sh" | grep -qF -- "--no-tilt-fix  傾きを" && sed -n "2,94p" "$HERE/lab_start.sh" | grep -qF -- "--grip-value N  爪の閉じる値" && sed -n "2,94p" "$HERE/lab_start.sh" | grep -qF -- "--flow / --speed N  run_policy_client.py に" && sed -n "2,94p" "$HERE/lab_start.sh" | grep -qF -- "# 5b. 空打ち" && grep -qF "sed -n '"'"'2,94p'"'"'" "$HERE/lab_start.sh"'
+check "--help に --serve-only・--grip-value・--flow / --speed・5b の空打ちの説明が入る (2〜97 行 (依頼 289 で so101b の 3 行, 依頼 294 で --rtc の 3 行, 依頼 307 で so101c の 3 行, 依頼 308 で --blend の 2 行, 依頼 309 で so101d の 3 行, 依頼 313 で --max-step-deg の 2 行, 依頼 358 で so101f の 3 行, 依頼 385 で so101g の 3 行, 依頼 403 で so101h の 3 行が増えた))" 'sed -n "2,97p" "$HERE/lab_start.sh" | grep -qF -- "--serve-only  Pod を作って" && sed -n "2,97p" "$HERE/lab_start.sh" | grep -qF -- "--no-tilt-fix  傾きを" && sed -n "2,97p" "$HERE/lab_start.sh" | grep -qF -- "--grip-value N  爪の閉じる値" && sed -n "2,97p" "$HERE/lab_start.sh" | grep -qF -- "--flow / --speed N  run_policy_client.py に" && sed -n "2,97p" "$HERE/lab_start.sh" | grep -qF -- "# 5b. 空打ち" && grep -qF "sed -n '"'"'2,97p'"'"'" "$HERE/lab_start.sh"'
 
 echo "== 空打ち (依頼 176): トンネルのあと・アームの前に 1 回. 失敗しても止めずに続ける"
 setup; state $ID_OLD; pod 200 "$RUNNING"; probe 1 1 1 1 1; run
@@ -703,7 +703,7 @@ setup; state $ID_OLD; pod 200 "$RUNNING"; probe 1 1 1 1 1; run --step-confirm --
 check "--step-confirm なら --no-step-confirm を渡さず (ほかの引数は同じ), [CONFIRM] で出す" '[ $RC = 0 ] && has py.log "pi05/run_policy_client.py" && ! has py.log "--no-step-confirm" && grep -q -- "pi05/run_policy_client.py .* --flow$" "$T/py.log" && has out.txt "[CONFIRM] チャンクごとに確かめる (--step-confirm"'
 rm -rf "$T"
 check "実機の 8 にも既定で --no-step-confirm を渡す (8 の 2 か所)" '[ "$(grep -c '"'"'${STEP_ARGS\[@\]+"${STEP_ARGS\[@\]}"}'"'"' "$HERE/lab_start.sh")" = 2 ] && grep -qF "STEP_ARGS=(--no-step-confirm)" "$HERE/lab_start.sh" && grep -qF -- "--step-confirm) STEP_ARGS=(); shift ;;" "$HERE/lab_start.sh"'
-check "--help に --step-confirm の説明が入る" 'sed -n "2,71p" "$HERE/lab_start.sh" | grep -qF -- "--step-confirm  実機推論で"'
+check "--help に --step-confirm の説明が入る" 'sed -n "2,74p" "$HERE/lab_start.sh" | grep -qF -- "--step-confirm  実機推論で"'
 
 echo "== 置き終えたら自動で終わる (依頼 181): 既定は --auto-finish を渡す. --no-auto-finish で今までどおり"
 setup; state $ID_OLD; pod 200 "$RUNNING"; probe 1 1 1 1 1; run
@@ -713,7 +713,7 @@ setup; state $ID_OLD; pod 200 "$RUNNING"; probe 1 1 1 1 1; run --no-auto-finish
 check "--no-auto-finish なら --auto-finish を渡さず (ほかの引数は同じ), [FINISH] で出す" '[ $RC = 0 ] && has py.log "pi05/run_policy_client.py" && ! has py.log "--auto-finish" && grep -q -- "pi05/run_policy_client.py .* --no-step-confirm --flow$" "$T/py.log" && has out.txt "[FINISH] 置き終えても自動では終わらない (--no-auto-finish"'
 rm -rf "$T"
 check "実機の 8 にも既定で --auto-finish を渡す (8 の 2 か所)" '[ "$(grep -c '"'"'${FINISH_ARGS\[@\]+"${FINISH_ARGS\[@\]}"}'"'"' "$HERE/lab_start.sh")" = 2 ] && grep -qF "FINISH_ARGS=(--auto-finish)" "$HERE/lab_start.sh" && grep -qF -- "--no-auto-finish) FINISH_ARGS=(); shift ;;" "$HERE/lab_start.sh"'
-check "--help に --no-auto-finish の説明が入る" 'sed -n "2,74p" "$HERE/lab_start.sh" | grep -qF -- "--no-auto-finish  箱に置き終えたら" && ./lab_start.sh --help | grep -qF -- "--no-auto-finish"'
+check "--help に --no-auto-finish の説明が入る" 'sed -n "2,77p" "$HERE/lab_start.sh" | grep -qF -- "--no-auto-finish  箱に置き終えたら" && ./lab_start.sh --help | grep -qF -- "--no-auto-finish"'
 
 echo "== 中継点の間隔 (依頼 182): --via-stride N をそのまま渡す. 既定は今までの 3"
 setup; state $ID_OLD; pod 200 "$RUNNING"; probe 1 1 1 1 1; run
@@ -740,7 +740,7 @@ setup; run --via-stride
 check "--via-stride に値がなければ受けない (終了コード 2)" '[ $RC = 2 ] && [ ! -s "$T/calls.log" ] && has out.txt "--via-stride には 0〜10"'
 rm -rf "$T"
 check "実機の 8 にも同じ値を渡す (8 の 2 か所・3 を書き込んだ所は残らない)" '[ "$(grep -cF -- "--steps-per-chunk 10 --via-stride \"\$VIA_STRIDE\"" "$HERE/lab_start.sh")" = 2 ] && ! grep -q -- "--via-stride 3 " "$HERE/lab_start.sh" && grep -qF "VIA_STRIDE=3 " "$HERE/lab_start.sh"'
-check "--help に --via-stride の説明が入る" 'sed -n "2,71p" "$HERE/lab_start.sh" | grep -qF -- "--via-stride N  1 チャンクの中継点の間隔" && ./lab_start.sh --help | grep -qF -- "# 5b. 空打ち"'
+check "--help に --via-stride の説明が入る" 'sed -n "2,74p" "$HERE/lab_start.sh" | grep -qF -- "--via-stride N  1 チャンクの中継点の間隔" && ./lab_start.sh --help | grep -qF -- "# 5b. 空打ち"'
 
 echo "== so101a (依頼 283): SO-101 の推論. 1〜5b は同じ形で, 6〜8 は run_so101_policy.py だけ"
 so101_setup() { setup; mkdir -p "$T/data/datasets/so101_redblock_box_teleop_even_v1/raw_episodes"; }
@@ -768,7 +768,7 @@ for bad in 0 11 31 abc ""; do
     rm -rf "$T"
 done
 setup; run --exec-steps 3
-check "mechArm の --model に --exec-steps は付けられない" '[ $RC = 2 ] && [ ! -s "$T/calls.log" ] && has out.txt "--exec-steps は --model so101a〜so101d・so101f・so101g だけ"'
+check "mechArm の --model に --exec-steps は付けられない" '[ $RC = 2 ] && [ ! -s "$T/calls.log" ] && has out.txt "--exec-steps は --model so101a〜so101d・so101f・so101g・so101h だけ"'
 rm -rf "$T"
 for arg in "--flow" "--grip-value 30" "--via-stride 5" "--no-tilt-fix" "--episode x"; do
     so101_setup; run --model so101a $arg
@@ -782,7 +782,7 @@ so101_setup; run --model so101a --exec-steps 4 --no-prefetch
 check "--no-prefetch をそのまま渡す (依頼 285)" '[ $RC = 0 ] && grep -q -- "so101/run_so101_policy.py .* --step 2999 --exec-steps 4 --no-prefetch$" "$T/py.log" && has out.txt "[SO101 ] 次の問い合わせ: 答えを使い切ってから (--no-prefetch"'
 rm -rf "$T"
 setup; run --no-prefetch
-check "mechArm の --model に --no-prefetch は付けられない (依頼 285)" '[ $RC = 2 ] && [ ! -s "$T/calls.log" ] && has out.txt "--no-prefetch は --model so101a〜so101d・so101f・so101g だけ"'
+check "mechArm の --model に --no-prefetch は付けられない (依頼 285)" '[ $RC = 2 ] && [ ! -s "$T/calls.log" ] && has out.txt "--no-prefetch は --model so101a〜so101d・so101f・so101g・so101h だけ"'
 rm -rf "$T"
 so101_setup; run --model so101a --play-speed 0.8
 check "--play-speed 0.8 をそのまま渡し, [SO101] で出す (依頼 288)" '[ $RC = 0 ] && grep -q -- "so101/run_so101_policy.py .* --step 2999 --play-speed 0.8$" "$T/py.log" && has out.txt "[SO101 ] 答えを流す速さ: 0.8 (--play-speed"'
@@ -796,7 +796,7 @@ for bad in 0 0.0 1.5 2 abc -0.5 ""; do
     rm -rf "$T"
 done
 setup; run --play-speed 0.8
-check "mechArm の --model に --play-speed は付けられない (依頼 288)" '[ $RC = 2 ] && [ ! -s "$T/calls.log" ] && has out.txt "--play-speed は --model so101a〜so101d・so101f・so101g だけ"'
+check "mechArm の --model に --play-speed は付けられない (依頼 288)" '[ $RC = 2 ] && [ ! -s "$T/calls.log" ] && has out.txt "--play-speed は --model so101a〜so101d・so101f・so101g・so101h だけ"'
 rm -rf "$T"
 # 依頼 285: so101a も 2 回目の試行から --skip-first-confirm を渡す (mechArm と同じ. 端末を作って y・y・n を打つ)
 so101_setup; state $ID_OLD; pod 200 "$RUNNING"; probe 1 1 1 1 1; serve_dir /workspace/ckpt/so101_teleop_even_v1_2999
@@ -848,7 +848,7 @@ check "--rtc なし: サーバーの起動は今までどおり・--rtc を渡
 rm -rf "$T"
 for m in so101a corr trim; do
     so101_setup; run --model $m --rtc
-    check "--model $m に --rtc は付けられない (終了コード 2・API を呼ばない)" '[ $RC = 2 ] && [ ! -s "$T/calls.log" ] && has out.txt "--rtc は --model so101b・so101c・so101d・so101f・so101g だけ"'
+    check "--model $m に --rtc は付けられない (終了コード 2・API を呼ばない)" '[ $RC = 2 ] && [ ! -s "$T/calls.log" ] && has out.txt "--rtc は --model so101b・so101c・so101d・so101f・so101g・so101h だけ"'
     rm -rf "$T"
 done
 so101_setup; run --model so101b --rtc --no-prefetch
@@ -947,12 +947,12 @@ so101c_setup; run --model so101c --blend
 check "--blend に値がなければ止まる (依頼 308)" '[ $RC = 2 ] && [ ! -s "$T/calls.log" ] && has out.txt "--blend には 0〜15 の整数を付ける"'
 rm -rf "$T"
 setup; run --blend 5
-check "mechArm の --model に --blend は付けられない (依頼 308)" '[ $RC = 2 ] && [ ! -s "$T/calls.log" ] && has out.txt "--blend は --model so101a〜so101d・so101f・so101g だけ"'
+check "mechArm の --model に --blend は付けられない (依頼 308)" '[ $RC = 2 ] && [ ! -s "$T/calls.log" ] && has out.txt "--blend は --model so101a〜so101d・so101f・so101g・so101h だけ"'
 rm -rf "$T"
 so101c_setup; state $ID_OLD; pod 200 "$RUNNING"; probe 1 1 1 1 1; serve_dir /workspace/ckpt/so101_teleop_ideal_mix_v1_2999; run --model so101c --blend 10
 check "so101c つなぎ直し --blend 10: RTC なしのサーバーをそのまま使い (起動し直さない), クライアントに --blend 10" '[ $RC = 0 ] && ! has ssh.log "tmux new" && [ $(n_call POST) = 0 ] && grep -q -- "--model so101c .* --step 2999 --blend 10$" "$T/py.log"'
 rm -rf "$T"
-check "--help に --blend の説明が入る (依頼 308)" './lab_start.sh --help | grep -qF -- "--blend N (so101a〜so101d・so101f・so101g. 0〜15. 依頼 308)"'
+check "--help に --blend の説明が入る (依頼 308)" './lab_start.sh --help | grep -qF -- "--blend N (so101a〜so101d・so101f・so101g・so101h. 0〜15. 依頼 308)"'
 
 # ---- 依頼 313: --max-step-deg X をクライアントにそのまま渡す ----
 so101_setup; run --model so101b --blend 10 --max-step-deg 4
@@ -983,12 +983,12 @@ so101c_setup; run --model so101c --max-step-deg
 check "--max-step-deg に値がなければ止まる (依頼 313)" '[ $RC = 2 ] && [ ! -s "$T/calls.log" ] && has out.txt "--max-step-deg には 1〜10 の数を付ける"'
 rm -rf "$T"
 setup; run --max-step-deg 4
-check "mechArm の --model に --max-step-deg は付けられない (依頼 313)" '[ $RC = 2 ] && [ ! -s "$T/calls.log" ] && has out.txt "--max-step-deg は --model so101a〜so101d・so101f・so101g だけ"'
+check "mechArm の --model に --max-step-deg は付けられない (依頼 313)" '[ $RC = 2 ] && [ ! -s "$T/calls.log" ] && has out.txt "--max-step-deg は --model so101a〜so101d・so101f・so101g・so101h だけ"'
 rm -rf "$T"
 so101_setup; state $ID_OLD; pod 200 "$RUNNING"; probe 1 1 1 1 1; serve_dir /workspace/ckpt/so101_teleop_even_h30_v1_2999; run --model so101b --blend 10 --max-step-deg 4
 check "so101b つなぎ直し --blend 10 --max-step-deg 4: 今のサーバーをそのまま使い (起動し直さない), クライアントに渡す" '[ $RC = 0 ] && ! has ssh.log "tmux new" && [ $(n_call POST) = 0 ] && grep -q -- "--model so101b .* --step 2999 --blend 10 --max-step-deg 4$" "$T/py.log"'
 rm -rf "$T"
-check "--help に --max-step-deg の説明が入る (依頼 313)" './lab_start.sh --help | grep -qF -- "--max-step-deg X (so101a〜so101d・so101f・so101g. 1〜10. 依頼 313)"'
+check "--help に --max-step-deg の説明が入る (依頼 313)" './lab_start.sh --help | grep -qF -- "--max-step-deg X (so101a〜so101d・so101f・so101g・so101h. 1〜10. 依頼 313)"'
 
 echo "== so101d (依頼 309): so101c と同じ流れで, 理想の道だけで学習したモデル"
 so101d_setup() { so101_setup; mkdir -p "$T/data/datasets/so101_redblock_box_ideal_x13_only_v1/raw_episodes"; }
@@ -1065,6 +1065,31 @@ rm -rf "$T"
 check "フォルダからモデルの名前 (so101g)" '[ "$(lab_model_of_dir /workspace/ckpt/so101_ideal_var_v2_recover_v1_2999)" = so101g ]'
 check "--help に so101g の説明が入る" './lab_start.sh --help | grep -qF "so101g = so101f と同じ扱いで, so101f の成功 50 本 + つかみ直しのお手本の成功 14 本で"'
 
+echo "== so101h (依頼 403): so101f と同じ流れで, rule_401 のコードの成功 56 本のつかむ所だけで学習したモデル"
+so101h_setup() { so101_setup; mkdir -p "$T/data/datasets/so101_redblock_box_code_rule401_grasp_v1/raw_episodes"; }
+so101h_setup; run --model so101h
+check "so101h: 終了コード 0" '[ $RC = 0 ]'
+check "Hugging Face の so101h を /workspace/ckpt/so101_code_rule401_grasp_v1_2999 に取る" 'has ssh.log "hf download PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1 --local-dir /workspace/ckpt/so101_code_rule401_grasp_v1_2999"'
+check "3f で add_so101_config.py --steps 3000 --variant h と so101h の assets (正規化の値) を入れる" 'has ssh.log "add_so101_config.py /workspace/openpi --steps 3000 --variant h && mkdir -p assets/pi05_so101_code_rule401_grasp_lora/local && cp -r /workspace/ckpt/so101_code_rule401_grasp_v1_2999/assets/local/so101_redblock_box_code_rule401_grasp_v1 assets/pi05_so101_code_rule401_grasp_lora/local/" && ! has ssh.log "assets/local/so101_redblock_box_ideal_var_v2_success_recover_v1 "'
+check "サーバーを pi05_so101_code_rule401_grasp_lora で起動する" 'has ssh.log "uv run scripts/serve_policy.py policy:checkpoint --policy.config=pi05_so101_code_rule401_grasp_lora --policy.dir=/workspace/ckpt/so101_code_rule401_grasp_v1_2999"'
+check "so101h: 空打ちとクライアントは so101f と同じ形 (安全範囲は so101h の 56 本の切り出し. step 2999)" '[ "$(sed -n 1p "$T/py.log")" = "python3 so101/run_so101_policy.py --warmup --port 8000 --raw-dir $T/data/datasets/so101_redblock_box_code_rule401_grasp_v1/raw_episodes" ] && [ "$(sed -n 2p "$T/py.log")" = "python3 so101/run_so101_policy.py --port 8000 --raw-dir $T/data/datasets/so101_redblock_box_code_rule401_grasp_v1/raw_episodes --log-dir $T/data/lab/LogT --model so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1) --step 2999" ]'
+check "so101h: [SO101] の既定は答えの 30 コマ全部・記録 lab_pod.json に so101h" 'has out.txt "[SO101 ] 1 回で実行するコマ: 30 (既定. 答えの 30 コマ全部)" && [ "$(jq -r .model "$T/data/lab/LogT/pod/lab_pod.json")" = so101h ]'
+rm -rf "$T"
+so101h_setup; run --model so101h --blend 10 --exec-steps 20
+check "so101h: --blend 10 と --exec-steps 20 をそのまま渡す" '[ $RC = 0 ] && grep -q -- "--model so101h .* --step 2999 --exec-steps 20 .*--blend 10" "$T/py.log"'
+rm -rf "$T"
+so101h_setup; run --model so101h --exec-steps 31
+check "so101h: --exec-steps 31 は受けない" '[ $RC = 2 ] && [ ! -s "$T/calls.log" ]'
+rm -rf "$T"
+so101h_setup; run --model so101h --rtc
+check "so101h --rtc: rtc_serve.py で起動し, クライアントに --rtc を渡す" '[ $RC = 0 ] && has ssh.log "rtc_serve.py scripts/serve_policy.py policy:checkpoint --policy.config=pi05_so101_code_rule401_grasp_lora" && grep -q -- "--model so101h .* --step 2999 --rtc$" "$T/py.log"'
+rm -rf "$T"
+so101h_setup; state $ID_OLD; pod 200 "$RUNNING"; probe 1 1 1 1 1; serve_dir /workspace/ckpt/so101_ideal_x13_only_v1_2999; run --model so101h
+check "so101h つなぎ直し: so101d のサーバーが動いていれば止まる" '[ $RC = 1 ] && has out.txt "(--model so101d)" && ! has ssh.log "tmux new"'
+rm -rf "$T"
+check "フォルダからモデルの名前 (so101h)" '[ "$(lab_model_of_dir /workspace/ckpt/so101_code_rule401_grasp_v1_2999)" = so101h ]'
+check "--help に so101h の説明が入る" './lab_start.sh --help | grep -qF "so101h = so101f と同じ扱いで, rule_401 をコードだけで流した成功 56 本のつかむ所"'
+
 echo
 echo "OK $OK / NG $NG"
 [ $NG = 0 ]
diff --git a/test_lab_train.sh b/test_lab_train.sh
index e82adbc..89da369 100755
--- a/test_lab_train.sh
+++ b/test_lab_train.sh
@@ -751,6 +751,16 @@ check "so101g: 2999 を pi05-so101-ideal-var-v2-recover-lora-v1 へ上げ, KIOXI
 check "so101g: 記録は lab/LogT/train_so101g に置き, train/・train_so101f には書かない" '[ "$(jq -r "[.model,.config,.exp,.init,.steps,.norm_pod] | join(\" \")" "$TDG/lab_pod.json")" = "so101g pi05_so101_ideal_var_v2_recover_lora so101_ideal_var_v2_recover_v1 base 3000 assets/pi05_so101_ideal_var_v2_recover_lora/local/so101_redblock_box_ideal_var_v2_success_recover_v1/norm_stats.json" ] && [ -f "$TDG/norm_stats.json" ] && [ "$(jq -r ".config | [.name, .lr_schedule.source, .data_name] | join(\" \")" "$TDG/train_provenance.json")" = "pi05_so101_ideal_var_v2_recover_lora add_so101_config.py --steps 3000 --variant g so101_redblock_box_ideal_var_v2_success_recover_v1" ] && [ ! -e "$T/data/lab/LogT/train" ] && [ ! -e "$T/data/lab/LogT/train_so101f" ]'
 rm -rf "$T"
 
+echo "== 12so-h. --model so101h (依頼 403): so101f と同じ値で, データだけ rule_401 のコードの成功 56 本のつかむ所. 記録は train_so101h"
+run success --model so101h
+CKH="$T/data/checkpoints/pi05_so101_code_rule401_grasp_lora_v1"
+TDH="$T/data/lab/LogT/train_so101h"
+check "so101h: 終了コード 0・画面に上げる先・データ・steps 3000・--variant h・答え 30 コマ" '[ $RC = 0 ] && has out.txt "--model so101h (π0.5 base → PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1)  データ so101_redblock_box_code_rule401_grasp_v1" && has out.txt "pi05_so101_code_rule401_grasp_lora --exp-name=so101_code_rule401_grasp_v1  steps=3000  init=base" && has out.txt "decay_steps 3000・decay_lr 5e-6 (add_so101_config.py --steps 3000 --variant h. deep1b と同じ値)" && has out.txt "1 回の答え (action_horizon): 30 コマ (so101f と同じ値で, データだけ rule_401 のコードの成功 56 本のつかむ所"'
+check "so101h: rule_401 のつかむ所の tar だけを送り, pod_prep_so101.sh 3000 h" 'has scp.log "so101_redblock_box_code_rule401_grasp_v1_raw_episodes.tar root@" && has ssh.log "bash /workspace/r2r2r/pi05/openpi_addon/pod_prep_so101.sh 3000 h 2>&1 | tee /workspace/logs/prep_so101.log" && ! has scp.log "ideal_var_v2_success_v1_raw" && ! has scp.log "success_recover_v1_raw" && ! has scp.log "teleop" && ! has ssh.log "hf download"'
+check "so101h: 2999 を pi05-so101-code-rule401-grasp-lora-v1 へ上げ, KIOXIA の checkpoints/pi05_so101_code_rule401_grasp_lora_v1/2999 に置く" 'has ssh.log "uv run scripts/train.py pi05_so101_code_rule401_grasp_lora --exp-name=so101_code_rule401_grasp_v1 --overwrite > /workspace/logs/train_so101_code_rule401_grasp_v1.log" && has ssh.log "hf_upload_ckpt.py --dir /workspace/openpi/checkpoints/pi05_so101_code_rule401_grasp_lora/so101_code_rule401_grasp_v1/2999 --repo PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1" && [ -f "$CKH/2999/_CHECKPOINT_METADATA" ] && [ -f "$CKH/2999/assets/local/so101_redblock_box_code_rule401_grasp_v1/norm_stats.json" ] && [ ! -e "$T/data/checkpoints/pi05_so101_ideal_var_v2_recover_lora_v1" ]'
+check "so101h: 記録は lab/LogT/train_so101h に置き, train/・train_so101g には書かない" '[ "$(jq -r "[.model,.config,.exp,.init,.steps,.norm_pod] | join(\" \")" "$TDH/lab_pod.json")" = "so101h pi05_so101_code_rule401_grasp_lora so101_code_rule401_grasp_v1 base 3000 assets/pi05_so101_code_rule401_grasp_lora/local/so101_redblock_box_code_rule401_grasp_v1/norm_stats.json" ] && [ -f "$TDH/norm_stats.json" ] && [ "$(jq -r ".config | [.name, .lr_schedule.source, .data_name] | join(\" \")" "$TDH/train_provenance.json")" = "pi05_so101_code_rule401_grasp_lora add_so101_config.py --steps 3000 --variant h so101_redblock_box_code_rule401_grasp_v1" ] && [ ! -e "$T/data/lab/LogT/train" ] && [ ! -e "$T/data/lab/LogT/train_so101g" ]'
+rm -rf "$T"
+
 rm -rf "${OUT1:-}"
 echo
 echo "OK $OK / NG $NG"
```


## 依頼404 ― 割り振りの面で道が作れないときだけ、挟む面と爪の傾きを選び直す

依頼404 は上限時間の90分で止まった。作業の報告とコードの記録（commit）は時間内に済んでいたが、自動で依頼をさばく仕組み（依頼箱）は依頼文を「失敗」のフォルダに入れた。

### 依頼404 の依頼文

```markdown
---
作業フォルダ: /Users/shimazueiichi/r2r2r-scripts
上限時間: 90
---
# 依頼404：SO-101 の rule_401 をコードで流すとき、割り振りの面では道が作れない置き方で、ブロックの挟む面を選び直す（実装・アームなしの確かめ・codex のレビュー 1 回まで。アームは動かさない）

## なぜ
2026-12-01 の午前、rule_401 をコードだけで実機に流して 56 回すべて成功した。動かす前に止まった回のうち、ガードの値では説明できないものが 1 種類だけ残った：**場所5 で、ブロックの向きが +5° を超えると「爪の面を机に垂直にできない」で道が作れない**（実機で流せた場所5 の向きは −7.5〜+2.1°。場所2 は +17°、場所3・4 は +11° 台まで流せている）。
原因は `so101/check_401/run_rule401.py` の `build()`：挟む面と爪の傾きを、割り振り（plan_401.json）のその場所の値（`F.plan_face(e)`・`F.plan_tilt_s(e)`）に固定したまま、読んだ向きで道を作っている。ブロックは立方体なので、挟む面を 90° 変えれば手首の回りが小さくて済む置き方でも、割り振りの面のまま作ろうとして止まる。
2026-12-01 10:53 にエイイチが決めた：**向きが大きいときは、つかむ面を 90° 変える決まりを足す。**

## 最初に
`so101/check_401/run_rule401.py` と `session_401.sh` に、未 commit の変更がある（12/1 の実機で Claude が足した、その回だけ値を変える口：R401_PUSH_LIMIT_MM・R401_PUSH_WINDOW_MM・R401_PIXEL_TOL_PX・R401_YAW_TOL_DEG・R401_START_TOL_DEG・R401_ALLOW_CONFLICT・R401_ALLOW_DEEP・R401_COUNT_OFFSET）。56 回はこの版で流した。**中身を変えずに、この 2 つだけを個別に add して先に commit する。**

## 作るもの
1. `run_rule401.py` に `--reselect-face` を足す（付けないときの動き・出力は今と同じ）
   - まず今までどおり、割り振りの面・爪の傾きで道を作る。**作れて、ガードも通るなら、それを使う**（今日の 56 回と同じ動きを変えない）
   - 道が作れない（rule_351 の道・rule_401 の道）か、clear_345・in_range・step のガードに当たったときだけ、読んだ画素と向きに rule_351 の選び方（面のずらし 0・+90・−90。道が作れる → 爪の面の傾きが小さい → 手首の回りが小さい の順。爪の傾きは margin）を当てて、面と爪の傾きを選び直す。選び直した道にも rule_401 と今と同じガードを全部当てる
   - `--reselect-face` のときは、向きが割り振りの向きから離れていても「置き直す」で止めない（面を読んだ向きに合わせて選ぶので、向きの許しは要らなくなる）。画素の許しは今のまま
   - `trial.json` の `rule401` と `rule401_plan.json` に、使った面のずらし・爪の傾き・選び直したか（`face_reselected`）・割り振りの面で作れなかった理由を足す。台帳の既存の列は変えない
2. `session_401.sh`：`R401_RESELECT=1` で `--reselect-face` を付ける。置き方の案内の文は今のまま

## 確かめ（アームなし）
- 場所1〜5 の目印の画素で、向きを −45〜+45° に 5° 刻みで振る。さらに場所ごとに画素を上下左右へ 20 画素ずらした 4 通りでも同じ向きを振る。**今の形（割り振りの面のまま）と `--reselect-face` で、道が作れてガードを通る数** を場所ごとの表にする。ガードの値は今日の実機と同じ（R401_PUSH_LIMIT_MM=-12・R401_PUSH_WINDOW_MM=-12・conflict と deep_at_zero を許す）と、既定の値の 2 通り
- 場所5 で、向きごとにどの面を選んだか・手首の回りが何度か・まだ作れない向きがあればその理由
- 今日の実機 56 回の読み（`trial.json` の block_pixel・block_yaw_deg）を `--reselect-face` に通し、56 回とも道が今日と同じ（1 コマも変わらない）こと
- 場所1 は、目印では校正の点の囲みの外で作れない。これは面の話ではないので直さない。選び直しで変わるかどうかだけ表に出す
- 既存のテスト（`test_run_rule401.py`）が全部通ること。新しい分のテストを足す

## codex のレビュー
1 回だけ（読むだけ・依頼401 と同じ頼み方）。見てほしい点は 2 つに絞る：選び直した面で、下りる間に腕・爪がブロック・箱・机に当たらないか／選び直しが「割り振りの面で通る回」の動きを変えていないか。必須の指摘だけ直す。直したあとの頼み直しはしない（実機はエイイチが見て流す。2026-12-01 の決め）

## しないこと
アームを動かす、ガードの既定の値を変える・ガードを足す、rule_401 の決まり（開き 59・固定側 12 mm・下げ方）と `rule_351.py`・`face_349.py`・`var_lib_314.py` を変える、plan_401.json を作り直す、依頼403 のファイル（datasets・lab_train まわり）に触る、`git add .`・`git clean`

## 報告（`so101/check_404/REPORT.md`）
- いちばん大事なこと：場所5 で流せる向きの幅が どこからどこまで広がったか、ほかの場所で増えた数、今日の 56 回の道が変わっていないこと
- 場所ごとの表、codex の指摘（必須／推奨／据え置き・直したもの）、テストの件数、commit
- 実機の試しの手順の案（場所5 でブロックを回して置く 1 回分の流れ・エイイチがすること・どこで止まるか）
- 最後の 1 行に「判定：合格／止めた（決めてほしいことあり）／失敗」
```

### 依頼404 の報告（見張り係の記録）

```markdown
# 結果：20261201_404_SO101のrule401で割り振りの面で道が作れないとき面を選び直す

- 状態：時間切れ（途中で止めました）
- 始めた時刻：2026-12-01 11:57
- 終わった時刻：2026-12-01 13:27（90分）
- 作業フォルダ：/Users/shimazueiichi/r2r2r-scripts
- この続きを Claude Code で話すとき：作業フォルダで `claude --resume b1273da3-47cf-49fe-ad15-5c38637ae633`

## Claude Code の報告

**やったこと**
- 最初に commit するよう指示されていた `run_rule401.py`・`session_401.sh` の環境変数の変更は、始めた時点ですでに `0ee3388` で commit 済みでした（差分は空）。なので新しい commit は作っていません。
- `run_rule401.py` に `--reselect-face` を足しました。動きは次のとおりです。
  - まず割り振りの面で道を作り、ガードを通ればその道を使います。
  - 道が作れないとき、または clear_345・in_range・step に当たったときだけ、rule_351 の選び方で面と爪の傾きを選び直します。選び直した道にも、今と同じガードを全部当てます。
  - 押し付けや status だけに当たったときは、選び直さずに今までどおり止めます。
  - 向きの許しでは止めません。画素の許しは今のままです。
  - 付けないときの動きと出力は今と同じです。
  - `session_401.sh` は `R401_RESELECT=1` のときにこの口を付けます。
- アームなしで確かめました。
  - 全通りの数え上げ：場所1〜5 × 画素 5 通り × 向き 19 通り。ガードは今日の値と既定の値の 2 通り。
  - 今日の実機の読みを通し直す確かめ。
  - 下りる間のすき間の比べ。
  - codex のレビューを 1 回（読むだけ）。

**結果**
- **場所5 は −側だけ広がりました。+側は広がりません。**
  - 目印で道が作れてガードを通る向き：−25〜+5° が −40〜+5° になりました。−側は、同じ面のまま爪の傾きを 19° から 21〜22° に選び直した分です。
  - 今の形で実際に流せるのは向きの許し ±8° の中だけで、今日の実機は −7.5〜+2.1° でした。選び直しでは向きの許しで止めないので、実際に流せる幅は −40〜+5° になります。
  - **+10° から上は、どの面を選んでも作れません。** 場所5 の目印では、面を ±90° 変えた形に、使える爪の傾きがどの向きにも 1 本もありませんでした。なので「面を 90° 変える」決まりでは、+側で止まる件は直りません。
- ほかの場所で増えた数（95 通りのうち・今日のガードの値）：

| 場所 | 今の形 | 選び直し | 増えた |
|---|---|---|---|
| 1 | 2 | 2 | +0 |
| 2 | 43 | 60 | +17 |
| 3 | 69 | 95 | +26 |
| 4 | 31 | 95 | +64 |
| 5 | 31 | 54 | +23 |

  場所1 は選び直しでも増えません（面の話ではないので直していません）。
- 今日の実機の読みを通し直すと、57 回（成功 56・途中で止めた 1）とも道は今日と同じでした。選び直しは 0 回、記録の道との差は 0.0 です。
- 下りる間のすき間（予想）は、選び直した 118 本・今の形 175 本とも負になる道はありませんでした。最小は +1.6 mm と +1.5 mm です。
- テストは 31 本すべて通ります（前からの 20 本＋足した 11 本）。
  - 前からのテスト 1 本が新しい引数がなくて落ちたので、テストは変えずに `run_rule401.py` の読み方を直しました。
- 選び直しは候補 1 本につき 3 秒ほどかかります。
  - 場所5 の −30〜−40° では 10〜40 秒ほどです。
  - 場所3・4 の目印から外した所では、候補が 100 本を超えて数分かかることがあります（そのあいだ腕は止まったままです）。
- codex の指摘：
  - 必須 1：下りる間の、爪とブロックのすき間の予想がガードになっていない（今の形にもある抜け）。直すにはガードを足すことになり、この依頼ではしないことなので、直していません。材料として上のすき間の比べを報告に出しました。
  - 必須 2：シムの判定は、実機で当たらないことの証明ではない。コードは変えず、実機の試しの手順で「下りる所でスペースを押せる構えで見る」ことにしました。
  - ほかの 3 点は問題なしでした。頼み直しはしていません。
- 実機の試しの手順の案（場所5 にブロックを −30° ほど回して置き、まず dry-run、次に `--first` で 1 回）は `REPORT.md` の 5 節に書きました。
- commit は `a37c68a`（本体）と `6daf27c`（報告に commit を書き足した分）です。アームは動かしていません。

**変えたファイル**
- `so101/check_401/run_rule401.py`
- `so101/check_401/session_401.sh`
- `so101/check_401/test_run_rule401.py`
- `so101/check_404/`：`REPORT.md`、確かめのスクリプト 4 本（`sweep_404.py`・`summarize_404.py`・`replay56_404.py`・`gaps_404.py`）、表とその元の記録、codex への依頼文と答え
- `logs/20261201_1255.md`（作業の記録。commit していません）

**決めてほしいこと**
1. 場所5 で +10° から上は、面を変えても作れません。+側を流すなら別の手が要ります。どれにするか。
   - 場所5 では +側に置かない
   - 置く所を v 方向へ 20 画素ずらす（そこでは −45〜+40° がすべて作れます）
   - 爪の面の傾きの許し（±8°）を見直す
2. codex の必須 1：下りる間の、爪とブロックのすき間の予想を、止めるガードにするか。
3. 選び直した回で、始める前に yes を打たせるか。今は打たせません。2 回目からは Enter も待たずに流れます。
4. 選び直しの計算が数分かかる置き方がありますが、このままでよいか。

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

### so101/check_404/REPORT.md

```markdown
# 依頼 404：rule_401 をコードで流すとき 割り振りの面で道が作れない置き方で 挟む面を選び直す（--reselect-face）

2026-12-01。アームは動かしていない。計算・シム・codex のレビュー 1 回だけ。

## いちばん大事なこと

- **場所5 で流せる向きの幅が広がったのは −側だけ。+側は +5° のままで、選び直しても広がらない。**
  - 目印の画素・今日のガードの値で、道が作れてガードを通る向きの幅：今の形（割り振りの面のまま・向きの許し ±8° を外した場合）**−25〜+5°** → `--reselect-face` **−40〜+5°**（5° 刻み）
  - 今の形で実際に流せるのは 向きの許し ±8°（割り振りの向き −2.5° を中心に）の中だけで、今日の実機は −7.5〜+2.1°。`--reselect-face` は向きの許しで止めないので、実際に流せる幅は **−40〜+5°** になる
  - **+10° から上は どの面でも作れない**。場所5 の目印では、面のずらし +90・−90 は どの向きでも「爪の面を机に垂直にできる爪の傾き」の候補が 0 本だった（3.3）。爪の閉じる向きで言うと、作れるのは −40〜+5° のあいだ（45° 幅）だけ。ブロックの向きを +10° にすると、挟める向きは +10・+100・−80° になり、どれもこの幅から外れる。なので、**「挟む面を 90° 変える」決まりでは、場所5 の +側の止まりは直らない**。−側が広がったのは、同じ面（ずらし 0）のまま爪の傾きを 19° から 21〜22° に選び直したため
- **ほかの場所で増えた数**（95 通り = 画素 5 通り × 向き 19 通り。ガードは今日と同じ値）：場所2 **43 → 60（+17）**、場所3 **69 → 95（+26）**、場所4 **31 → 95（+64）**、場所5 **31 → 54（+23）**、場所1 **2 → 2（+0）**
- **今日の実機の道は変わっていない**：台帳の code_rule401 の 57 回（成功 56・追従の差で止めた 1）の読みを `--reselect-face` に通すと、**57 回とも割り振りの面のまま（選び直しは 0 回）で、付けないときと同じ配列（1 コマも違わない）**。記録の rule401_plan.json の道（3 桁に丸めたもの）とも差は **0.0**、コマの数もすべて同じ

## 1. 最初の commit について

依頼文には「`run_rule401.py` と `session_401.sh` に未 commit の変更（R401_PUSH_LIMIT_MM ほか 8 つの環境変数）がある」とあったが、始めた時点で **この 2 つはどちらも commit 済み**（`0ee3388`。「依頼401 の実機: ガードの値をその回だけ環境変数で変えられるようにした…」。R401_ALLOW_CONFLICT・R401_PIXEL_TOL_PX なども入っている）で、`git diff HEAD` は空だった。なので先の commit は作っていない。

## 2. 作ったもの

`so101/check_401/run_rule401.py`

- `--reselect-face` を足した。付けないときの動き・止め方・出力は今までと同じ（`prepare` の今までの分岐をそのまま残した）
- `build` が 面のずらし `face`・爪の傾き `tilt_s` を受けるようにした（渡さなければ今までどおり割り振りの値。`plan_401.marker_check` などの呼び方は変わらない）。答えに `face_deg`・`tilt_s_deg` を足した
- `build_choose`：まず割り振りの面・爪の傾きで `build` → ガード。**通ればそれを使う**。`--reselect-face` のときだけ、道が作れない（rule_351・rule_401）か `RESELECT_GUARDS` = clear_345・in_range・step に当たったときに選び直す。押し付け（push_limit・push_window）・status **だけ**に当たったときは選び直さずに今までどおり止める
- `reselect_candidates`：読んだ画素・向きに rule_351 の選び方を当てる（`rule_351._pick` と同じ：面のずらし 0・+90・−90 ごとに、許しに入る爪の傾きを 1° 刻みで `face_349.try_path` に通し、爪の面の傾き ±8° の外を外し、margin の大きい順）。面の順は `face_349.select`（道が作れる → |爪の面の傾き| → |手首の回り|）を残りの面にくり返し当てた順。割り振りの面・傾き（もう作れなかったもの）は作らない。rule_351 の「置き方の余り（robust：±10 画素・±6°）」は当てない（読んだ所・向きで作るので）
- `reselect_build`：候補をその順に `build`（rule_351 → rule_401 → **今と同じガードを全部**）に通し、全部通る最初のものを使う
- `--reselect-face` のときは 向きの許し（±8°。R401_YAW_TOL_DEG）で止めない。画素の許し（10 画素。R401_PIXEL_TOL_PX）は今のまま
- 記録：`--reselect-face` のとき、`trial.json` の `rule401` と `rule401_plan.json` に `face_deg`・`tilt_s_deg`・`face_reselected`・`plan_face_why`（割り振りの面で作れなかった理由。通ったときは空）を足す。選び直したときは `plan_face_deg`・`plan_tilt_s_deg`・`jaw_elev_deg`・`roll_grasp_deg`・`reselect_tried`（試した候補と それぞれの理由）も。付けないときは足さない（今までと同じ中身）。台帳の列は変えていない
- 画面：`--reselect-face` のとき「割り振りの面のまま」「面を選び直した（黄色。割り振りの面で作れなかった理由と選んだ面・傾き・手首の回り）」「選び直しても作れない」を 1 行出す

`so101/check_401/session_401.sh`：`R401_RESELECT=1` で `--reselect-face` を付ける 1 行だけ。置き方の案内の文は変えていない。

**時間**：選び直しは 候補 1 本ごとに 3 秒ほどかかる。割り振りの面で通る回は今までと同じ時間（選び直しを呼ばない）。場所5 の −30〜−40° では候補が 2〜11 本なので 10〜40 秒ほど。場所3・4 の目印から外した置き方では候補が 100 本を超えることがあり、数分かかる（そのあいだ腕は止まったまま。動かす前の計算）。

## 3. 確かめ（アームなし）

`so101/check_404/sweep_404.py`（結果 `sweep_404.jsonl`）→ `summarize_404.py`（表 `summary_404.md`）。場所1〜5 の目印の画素と 上下左右へ 20 画素ずらした 4 通り × 向き −45〜+45°（5° 刻み 19 通り）。向きの読みは `prepare` と同じ（折りたたんで 割り振りの向きに近い 90° ずらし）。−45° と +45° は同じ置き方なので、19 通りのうち 2 つは同じもの。画素の許し・向きの許しは当てず、道とガードだけを見た（20 画素ずらしは今の画素の許し 10 画素の外なので、実機ではそのままでは止まる）。

### 3.1 場所ごと（道が作れてガードを通る数 / 95）

ガード **day**（今日の実機と同じ：R401_PUSH_LIMIT_MM=−12・R401_PUSH_WINDOW_MM=−12・conflict と deep_at_zero を許す）

| 場所 | 今の形 | 今の形のうち向き ±8° | --reselect-face | 増えた | 目印の向きの幅 今の形 | 目印の向きの幅 選び直し |
|---|---|---|---|---|---|---|
| 1 | 2 | 1 | 2 | +0 | なし | なし |
| 2 | 43 | 12 | 60 | +17 | −5〜+30° | −5〜+35° |
| 3 | 69 | 15 | 95 | +26 | −25〜+40° | −45〜+40° |
| 4 | 31 | 15 | 95 | +64 | −5〜+20° | −45〜+40° |
| 5 | 31 | 15 | 54 | +23 | −25〜+5° | −40〜+5° |

ガード **default**（既定の値：−6・−6・ok だけ）

| 場所 | 今の形 | 今の形のうち向き ±8° | --reselect-face | 増えた | 目印の向きの幅 今の形 | 目印の向きの幅 選び直し |
|---|---|---|---|---|---|---|
| 1 | 0 | 0 | 0 | +0 | なし | なし |
| 2 | 9 | 0 | 19 | +10 | +30° だけ | +30〜+35° |
| 3 | 62 | 14 | 88 | +26 | 0〜+40° | −45〜+40° |
| 4 | 0 | 0 | 64 | +64 | なし | −45〜+40° |
| 5 | 5 | 5 | 6 | +1 | なし | なし |

画素のずらしごとの数（今の形 → 選び直し）と、場所5 の向きごとの全部の行は `summary_404.md` にある。

選び直したときに選ばれた面（ガード day）：場所2 は 0° 11 回・+90° 6 回、場所3 は +90° 26 回、場所4 は 0° 51 回・−90° 11 回・+90° 2 回、場所5 は 0° 22 回・−90° 1 回（v+20 の画素だけ）。面のずらしが 0 の回は 爪の傾きだけを選び直している。

### 3.2 場所1

目印（校正の点の囲みの外）では、今の形も選び直しも **0 / 19**。画素のずらしを入れても 2 → 2（v+20 の −15〜0° だけ。選び直しで増えない）。面の話ではないので直していない。

### 3.3 場所5（目印・ガード day）の向きごと

| 向き | 今の形 | 選び直し | 面 | 爪の傾き | 手首の回り（つかむ所） | 作れない理由 |
|---|---|---|---|---|---|---|
| −45 | × | × | | | | 割り振りの爪の傾き 19° ではつかむ所に届かない。選び直しの候補 0 本 |
| −40 | × | ○ | 0 | 22 | −27.2° | |
| −35 | × | ○ | 0 | 22 | −22.1° | |
| −30 | × | ○ | 0 | 21 | −16.7° | |
| −25〜+5 | ○ | ○（今のまま） | 0 | 19 | −11.4〜+20.5° | |
| +10〜+40 | × | × | | | | 爪の面を机に垂直にできない（爪の面の傾き −10.4〜−18.5°・許し ±8°）。3 つの面とも候補 0 本 |

ガード default では、場所5 の目印は −25〜+5° が押し付け（push_window −9〜−12 mm）で止まる。選び直しは押し付けでは走らない決まりなので、増えない（−30〜−40° は選び直しの候補が rule_401 の固定側 12 mm の形が解けない・押し付けに当たる）。

### 3.4 今日の実機 57 回の読み

`replay56_404.py`（結果 `replay56_404.json`）。台帳の code_rule401 の行の `trial.json` から 読んだ画素（block_read の u・v）と向き（block_yaw_deg）を取り、ガードは今日と同じ値で、`--reselect-face` あり・なしの道を作った。
**57 / 57 で同じ配列。選び直しは 0 回。記録の道との差の最大 0.0（3 桁に丸めた値で）、コマの数の違い 0。** 依頼文の 56 回（成功）を含む全 57 行。

### 3.5 下りる間のすき間（codex の必須 1 の材料）

`gaps_404.py`（結果 `gaps_404.json`）。ガード day で通った置き方（重なりを除いて 割り振りの面 175 本・選び直し 118 本）の道を作り直し、rule_401 の予想・指令の 下りる間のすき間（固定側とブロック fixed_min・動く爪とブロック moving_min）を比べた（ガードにはしていない。見ただけ）。

| | 本 | 固定側 指令 最小 | 固定側 予想 最小／中央 | 動く爪 予想 最小 | 負の本数 |
|---|---|---|---|---|---|
| 割り振りの面 | 175 | +9.30 mm | +1.53 / +7.85 mm | +21.34 mm | 0 |
| 選び直し | 118 | +9.55 mm | +1.64 / +9.27 mm | +19.21 mm | 0 |

面ごとの予想の下りる間のすき間の最小：0° +1.64 mm・+90° +8.84 mm・−90° +6.59 mm。選び直した道で ブロックへのすき間が今の形より狭くなる傾向は見えない。

### 3.6 テスト

`so101/check_401/test_run_rule401.py`：**31 本 全部通る**（前からの 20 本 + 足した 11 本）。
足したもの：割り振りの面で通るときは選び直さず同じ道／押し付けだけなら選び直さない／status を許したときは割り振りの面のまま／道が作れないときに選び直す／付けないときは選び直さない／clear_345 に当たって 1 番目の候補がガードに当たったら 2 番目／全部だめなら止めて試した候補を残す／向きの許しは外すが画素の許しは残す／`--reselect-face` の読み取り／（シム）場所3 の目印で付けた・付けないの道が同じ／（シム）場所5 の候補がすべて許しの中で並んでいる。
途中で、前からある `test_execute_cleanup_order` が `args` に `reselect_face` がなくて落ちたので、`execute`・`dry_run` で `getattr(args, "reselect_face", False)` と読むようにした（テストは変えていない）。

## 4. codex のレビュー（1 回・読むだけ）

`codex exec -s read-only -m gpt-6.1-terra`。依頼文 `review_request_404.md`、答え `review_r1.txt`（生の出力 `review_r1_raw.txt`）。見る所は依頼のとおり 2 つ（選び直した面で 下りる間に当たらないか／割り振りの面で通る回の動きを変えていないか）。

| | 指摘 | 分け | どうしたか |
|---|---|---|---|
| R1-1 | clear_345 のブロックとの距離は ABOVE_BLOCK までで、下りる間の 固定側・動く爪とブロックの予想すき間（rule_401 の fixed_min・moving_min）はガードになっていない。選び直しに限らず 今の形にもある | 必須 | **直していない**。直すにはガードを足すことになり、この依頼ではしないこと。材料として 3.5 を出した（選び直し 118 本・今の形 175 本とも 予想・指令のすき間に負はない）。決めてほしいことに書いた |
| R1-2 | clear_345 は下りる間 机については爪の下限だけを見て腕全体と机の距離は外している。シムの判定で、実機で当たらないことの証明ではない | 必須（理解して確かめる） | コードは変えていない。実機の試しの手順（5 節）で、最初の 1 回は下りる所でエイイチが止められるようにした |
| R1-3 | 向きの扱い（道には向き＋面のずらし、ブロックの形と rule_401 には元の向き）は 立方体なので正しい | 問題なし | — |
| R1-4 | 割り振りの面で通る回は 付けた・付けないで同じ `build` の答えを使う。付けないときの止め方・出力は変わっていない | 問題なし | 3.4 で 57 回とも同じを確かめた |
| R1-5 | 押し付け・status だけなら選び直さない。clear_345・in_range・step と重なったときは選び直す | 問題なし | — |

codex の最後の 1 行は「場所5 を 1 回流すのは、下りる間のすき間の止め方と判定の範囲を確かめてから エイイチが決める」。頼み直しはしていない（依頼のとおり）。

## 5. 実機の試しの手順の案（場所5 でブロックを回して置く 1 回分）

前提：+10° から上は 選び直しでも作れないので、試すのは **−側（−30° と −35° あたり）**。今の形では向きの許しで止まり、選び直すと 面 0・爪の傾き 21〜22° で作れる所。

1. エイイチ：場所5 の目印にブロックを **−30° ほど**回して置く（数え上げで確かめたのは −30°（候補 11 本）と −35°（6 本）。−40° は 2 本、−45° は 0 本で止まる）
2. エイイチ：まず dry-run（アームはつながない。机のカメラだけ）
   `R401_RESELECT=1 R401_PUSH_LIMIT_MM=-12 R401_PUSH_WINDOW_MM=-12 R401_ALLOW_CONFLICT=1 R401_ALLOW_DEEP=1 PLACES=5 ./so101/check_401/session_401.sh --dry`
   → 黄色の行「面を選び直した: 割り振りの面 +0°・爪の傾き 19.0° で作れない (…) → 面 +0°・爪の傾き 21〜22°…」と「送れる」が出るのを見る。止まる所：読めない／目印から 10 画素より離れている／候補 0 本（「選び直しても作れない」）／ガード
3. エイイチ：同じ値で 1 回だけ流す：`R401_RESELECT=1 … PLACES=5 ./so101/check_401/session_401.sh --first`
   - 選び直しの計算に 10〜40 秒かかる（そのあいだ腕は動かない）
   - deep_at_zero か conflict が出た回は yes を打つ（今までどおり）。選び直しだけの回は Enter で始まる（yes は要らない）
   - **下りる所（ABOVE_BLOCK → つかむ所）でスペースを押せる構えで見る**（R1-2）。手首の回りは −17〜−22° で、今日の場所5 の向き（−7.5〜+2.1°）でのおよそ +7〜+17° と 逆向き
   - 止まる所：HOME から離れている・追従の差 10°・スペース／q
4. 流したあと：`trial.json` の `rule401.face_reselected` が true、`plan_face_why` に割り振りの面で作れなかった理由、`tilt_s_deg` が 21〜22 になっているかを見る

## 6. 変えたファイル

- `so101/check_401/run_rule401.py`（`--reselect-face`・`build_choose`・`reselect_candidates`・`reselect_build`・`plan_jt`・`RESELECT_GUARDS`。`build` は face・tilt_s を受ける）
- `so101/check_401/session_401.sh`（`R401_RESELECT=1` の 1 行）
- `so101/check_401/test_run_rule401.py`（11 本足した）
- `so101/check_404/`：`sweep_404.py`・`summarize_404.py`・`replay56_404.py`・`gaps_404.py`・`sweep_404.jsonl`・`summary_404.md`・`replay56_404.json`・`gaps_404.json`・`review_request_404.md`・`review_r1.txt`・`review_r1_raw.txt`・`REPORT.md`

変えていないもの：ガードの既定の値・rule_401 の決まり・`rule_351.py`・`face_349.py`・`var_lib_314.py`・`plan_401.json`・依頼403 のファイル。

## 7. 決めてほしいこと

1. **場所5 の +側（+10° から上）は 面を 90° 変えても作れない**（目印では +90・−90 の面は どの向きでも候補 0 本）。+側を流すなら、別の手（例：場所5 では +側に置かない・置く所を v 方向へずらす（v+20 なら −45〜+40° がすべて作れる）・爪の面の傾きの許し ±8° を見直す）が要る。どれにするか
2. **codex R1-1（必須）**：下りる間の 固定側・動く爪とブロックの予想すき間（fixed_min・moving_min）を 止める条件（ガード）にするか。今の形にもある抜けで、この依頼では足していない（ガードを足すのはしないこと）。今の数え上げでは 選び直し・今の形とも 負になる道はない（予想の最小 +1.5 mm）
3. 選び直した回で 始める前に yes を打たせるか（今は打たせない。2 回目からは `--skip-first-confirm` で Enter も待たずに流れる）
4. 選び直しの計算が 数分かかる置き方（場所3・4 の目印から外した所で候補 100 本超え）がある。このままでよいか

## commit

`a37c68a`（実装・テスト・確かめ・レビュー・この報告）。この行を書き足した commit がもう 1 つある

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

### so101/check_404/summary_404.md

```markdown
# 依頼 404 の数え上げ (sweep_404.jsonl)

道が作れて ガードを全部通る数 / 95 (画素 5 通り × 向き 19 通り). 今の形 = 割り振りの面のまま (向きの許し ±8° と画素の許しは当てない). (±8°) = そのうち 割り振りの向きから ±8° に入る分 (今の形で実際に流せる数)

## ガード day (−12・−12・conflict と deep_at_zero を許す)

| 場所 | 今の形 | 今の形 (±8°) | --reselect-face | 増えた | 選び直した | 目印の向きの幅 今の形 | 目印の向きの幅 選び直し |
|---|---|---|---|---|---|---|---|
| 1 | 2 | 1 | 2 | +0 | 0 | なし | なし |
| 2 | 43 | 12 | 60 | +17 | 17 | -5〜+30° | -5〜+35° |
| 3 | 69 | 15 | 95 | +26 | 26 | -25〜+40° | -45〜+40° |
| 4 | 31 | 15 | 95 | +64 | 64 | -5〜+20° | -45〜+40° |
| 5 | 31 | 15 | 54 | +23 | 23 | -25〜+5° | -40〜+5° |

画素のずらしごと (今の形 → 選び直し)

| 場所 | marker | u+20 | u-20 | v+20 | v-20 |
|---|---|---|---|---|---|
| 1 | 0 → 0 (なし) | 0 → 0 (なし) | 0 → 0 (なし) | 2 → 2 (-15〜+0°) | 0 → 0 (なし) |
| 2 | 8 → 9 (-5〜+35°) | 11 → 15 (-45〜+40°) | 9 → 10 (-10〜+35°) | 11 → 18 (-45〜+40°) | 4 → 8 (-5〜+30°) |
| 3 | 14 → 19 (-45〜+40°) | 15 → 19 (-45〜+40°) | 13 → 19 (-45〜+40°) | 13 → 19 (-45〜+40°) | 14 → 19 (-45〜+40°) |
| 4 | 6 → 19 (-45〜+40°) | 6 → 19 (-45〜+40°) | 6 → 19 (-45〜+40°) | 6 → 19 (-45〜+40°) | 7 → 19 (-45〜+40°) |
| 5 | 7 → 10 (-40〜+5°) | 5 → 9 (-40〜+0°) | 7 → 9 (-35〜+10°) | 12 → 19 (-45〜+40°) | 0 → 7 (-30〜+0°) |

## ガード default (既定 −6・−6・ok だけ)

| 場所 | 今の形 | 今の形 (±8°) | --reselect-face | 増えた | 選び直した | 目印の向きの幅 今の形 | 目印の向きの幅 選び直し |
|---|---|---|---|---|---|---|---|
| 1 | 0 | 0 | 0 | +0 | 0 | なし | なし |
| 2 | 9 | 0 | 19 | +10 | 10 | +30〜+30° | +30〜+35° |
| 3 | 62 | 14 | 88 | +26 | 26 | +0〜+40° | -45〜+40° |
| 4 | 0 | 0 | 64 | +64 | 64 | なし | -45〜+40° |
| 5 | 5 | 5 | 6 | +1 | 1 | なし | なし |

画素のずらしごと (今の形 → 選び直し)

| 場所 | marker | u+20 | u-20 | v+20 | v-20 |
|---|---|---|---|---|---|
| 1 | 0 → 0 (なし) | 0 → 0 (なし) | 0 → 0 (なし) | 0 → 0 (なし) | 0 → 0 (なし) |
| 2 | 1 → 2 (+30〜+35°) | 4 → 6 (+15〜+40°) | 1 → 1 (+35〜+35°) | 3 → 10 (-45〜+40°) | 0 → 0 (なし) |
| 3 | 9 → 14 (-45〜+40°) | 13 → 17 (-45〜+40°) | 13 → 19 (-45〜+40°) | 13 → 19 (-45〜+40°) | 14 → 19 (-45〜+40°) |
| 4 | 0 → 13 (-45〜+40°) | 0 → 13 (-45〜+40°) | 0 → 13 (-45〜+40°) | 0 → 13 (-45〜+40°) | 0 → 12 (-45〜+40°) |
| 5 | 0 → 0 (なし) | 0 → 0 (なし) | 1 → 1 (+0〜+0°) | 4 → 4 (-10〜+5°) | 0 → 1 (-5〜-5°) |

## 場所5 の目印 向きごと (ガード day)

| 向き | 今の形 | 選び直し | 面 | 爪の傾き | 手首の回り (つかむ所) | 候補の数 (面) | 作れない理由 |
|---|---|---|---|---|---|---|---|
| -45.0 | × | × |  |  |  | 0  | rule_351 の道が作れない: つかむ所 (向き -45.0°): 爪の傾きを +19.0° (割り振りの値) にすると つかむ所に届かない → 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない) |
| -40.0 | × | ○ | 0.0 | 22.0 | -27.22 | 2 [0.0] |  |
| -35.0 | × | ○ | 0.0 | 22.0 | -22.05 | 6 [0.0] |  |
| -30.0 | × | ○ | 0.0 | 21.0 | -16.74 | 11 [0.0] |  |
| -25.0 | ○ | ○ | 0.0 | 19.0 | -11.41 |   |  |
| -20.0 | ○ | ○ | 0.0 | 19.0 | -6.15 |   |  |
| -15.0 | ○ | ○ | 0.0 | 19.0 | -0.85 |   |  |
| -10.0 | ○ | ○ | 0.0 | 19.0 | 4.47 |   |  |
| -5.0 | ○ | ○ | 0.0 | 19.0 | 9.81 |   |  |
| +0.0 | ○ | ○ | 0.0 | 19.0 | 15.17 |   |  |
| +5.0 | ○ | ○ | 0.0 | 19.0 | 20.52 |   |  |
| +10.0 | × | × |  |  |  | 0  | rule_351 の道が作れない: つかむ所 (向き +10.0°): 爪の面を机に垂直にできない (爪の面の傾き -10.4°・許し ±8°) → 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない) |
| +15.0 | × | × |  |  |  | 0  | rule_351 の道が作れない: つかむ所 (向き +15.0°): 爪の面を机に垂直にできない (爪の面の傾き -12.0°・許し ±8°) → 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない) |
| +20.0 | × | × |  |  |  | 0  | rule_351 の道が作れない: つかむ所 (向き +20.0°): 爪の面を机に垂直にできない (爪の面の傾き -13.5°・許し ±8°) → 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない) |
| +25.0 | × | × |  |  |  | 0  | rule_351 の道が作れない: つかむ所 (向き +25.0°): 爪の面を机に垂直にできない (爪の面の傾き -14.9°・許し ±8°) → 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない) |
| +30.0 | × | × |  |  |  | 0  | rule_351 の道が作れない: つかむ所 (向き +30.0°): 爪の面を机に垂直にできない (爪の面の傾き -16.2°・許し ±8°) → 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない) |
| +35.0 | × | × |  |  |  | 0  | rule_351 の道が作れない: つかむ所 (向き +35.0°): 爪の面を机に垂直にできない (爪の面の傾き -17.4°・許し ±8°) → 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない) |
| +40.0 | × | × |  |  |  | 0  | rule_351 の道が作れない: つかむ所 (向き +40.0°): 爪の面を机に垂直にできない (爪の面の傾き -18.5°・許し ±8°) → 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない) |
| -45.0 | × | × |  |  |  | 0  | rule_351 の道が作れない: つかむ所 (向き -45.0°): 爪の傾きを +19.0° (割り振りの値) にすると つかむ所に届かない → 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない) |

## 場所5 の目印 向きごと (ガード default)

| 向き | 今の形 | 選び直し | 面 | 爪の傾き | 手首の回り (つかむ所) | 候補の数 (面) | 作れない理由 |
|---|---|---|---|---|---|---|---|
| -45.0 | × | × |  |  |  | 0  | rule_351 の道が作れない: つかむ所 (向き -45.0°): 爪の傾きを +19.0° (割り振りの値) にすると つかむ所に届かない → 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない) |
| -40.0 | × | × |  |  |  | 2 [0.0] | rule_351 の道が作れない: つかむ所 (向き -40.0°): 爪の傾きを +19.0° (割り振りの値) にすると つかむ所に届かない → 面を選び直しても道が作れない・ガードに当たる (候補 2 通り. 最初の候補: rule_401 の道が作れない: 固定側を 12 mm 離す形が解けない: 姿 |
| -35.0 | × | × |  |  |  | 6 [0.0] | rule_401 の道が作れない: 固定側を 12 mm 離す形が解けない: 姿勢が解けない ({'pos_mm': 0.463, 'tilt_deg': 1.224, 'jaw_ → 面を選び直しても道が作れない・ガードに当たる (候補 6 通り. 最初の候補: rule_401 の道が作れない: 固定側を 12 mm 離す形が解けない: 姿 |
| -30.0 | × | × |  |  |  | 11 [0.0] | rule_401 の道が作れない: 固定側を 12 mm 離す形が解けない: 姿勢が解けない ({'pos_mm': 0.22, 'tilt_deg': 0.581, 'jaw_d → 面を選び直しても道が作れない・ガードに当たる (候補 11 通り. 最初の候補: push_limit: 予想のつかむ所の爪と机 -9.63 mm (上限 -6 |
| -25.0 | × | × | 0.0 | 19.0 |  |   | ガードに当たった: push_limit: 予想のつかむ所の爪と机 -8.84 mm (上限 -6) / push_window: 予想の 閉じる間〜持ち上げの始めの 爪と机 -11.75 mm (上限 -6) / status: deep_at_zero |
| -20.0 | × | × | 0.0 | 19.0 |  |   | ガードに当たった: push_window: 予想の 閉じる間〜持ち上げの始めの 爪と机 -9.16 mm (上限 -6) |
| -15.0 | × | × | 0.0 | 19.0 |  |   | ガードに当たった: push_window: 予想の 閉じる間〜持ち上げの始めの 爪と机 -10.27 mm (上限 -6) |
| -10.0 | × | × | 0.0 | 19.0 |  |   | ガードに当たった: push_window: 予想の 閉じる間〜持ち上げの始めの 爪と机 -9.69 mm (上限 -6) |
| -5.0 | × | × | 0.0 | 19.0 |  |   | ガードに当たった: push_window: 予想の 閉じる間〜持ち上げの始めの 爪と机 -10.28 mm (上限 -6) |
| +0.0 | × | × | 0.0 | 19.0 |  |   | ガードに当たった: push_window: 予想の 閉じる間〜持ち上げの始めの 爪と机 -9.95 mm (上限 -6) |
| +5.0 | × | × | 0.0 | 19.0 |  |   | ガードに当たった: push_window: 予想の 閉じる間〜持ち上げの始めの 爪と机 -9.87 mm (上限 -6) |
| +10.0 | × | × |  |  |  | 0  | rule_351 の道が作れない: つかむ所 (向き +10.0°): 爪の面を机に垂直にできない (爪の面の傾き -10.4°・許し ±8°) → 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない) |
| +15.0 | × | × |  |  |  | 0  | rule_351 の道が作れない: つかむ所 (向き +15.0°): 爪の面を机に垂直にできない (爪の面の傾き -12.0°・許し ±8°) → 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない) |
| +20.0 | × | × |  |  |  | 0  | rule_351 の道が作れない: つかむ所 (向き +20.0°): 爪の面を机に垂直にできない (爪の面の傾き -13.5°・許し ±8°) → 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない) |
| +25.0 | × | × |  |  |  | 0  | rule_351 の道が作れない: つかむ所 (向き +25.0°): 爪の面を机に垂直にできない (爪の面の傾き -14.9°・許し ±8°) → 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない) |
| +30.0 | × | × |  |  |  | 0  | rule_351 の道が作れない: つかむ所 (向き +30.0°): 爪の面を机に垂直にできない (爪の面の傾き -16.2°・許し ±8°) → 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない) |
| +35.0 | × | × |  |  |  | 0  | rule_351 の道が作れない: つかむ所 (向き +35.0°): 爪の面を机に垂直にできない (爪の面の傾き -17.4°・許し ±8°) → 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない) |
| +40.0 | × | × |  |  |  | 0  | rule_351 の道が作れない: つかむ所 (向き +40.0°): 爪の面を机に垂直にできない (爪の面の傾き -18.5°・許し ±8°) → 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない) |
| -45.0 | × | × |  |  |  | 0  | rule_351 の道が作れない: つかむ所 (向き -45.0°): 爪の傾きを +19.0° (割り振りの値) にすると つかむ所に届かない → 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない) |

## 選び直したときの面 (数)

- day 場所2 面 +0°: 11
- day 場所2 面 +90°: 6
- day 場所3 面 +90°: 26
- day 場所4 面 -90°: 11
- day 場所4 面 +0°: 51
- day 場所4 面 +90°: 2
- day 場所5 面 -90°: 1
- day 場所5 面 +0°: 22
- default 場所2 面 +0°: 5
- default 場所2 面 +90°: 5
- default 場所3 面 +90°: 26
- default 場所4 面 -90°: 11
- default 場所4 面 +0°: 51
- default 場所4 面 +90°: 2
- default 場所5 面 +0°: 1
```

### so101/check_404/review_request_404.md

```markdown
# コードレビュー依頼：依頼 404 rule_401 をコードで流すとき 割り振りの面で道が作れない置き方で 挟む面を選び直す（--reselect-face）

**読むだけにしてください。ファイルは書き換えないでください。テストも走らせなくてよいです。**

## 何を足したか
`so101/check_401/run_rule401.py` に `--reselect-face` を足した（`session_401.sh` は `R401_RESELECT=1` で付ける）。見る所：
`RESELECT_GUARDS`・`reselect_candidates`・`reselect_build`・`plan_jt`・`build_choose`・`build`（face・tilt_s を受ける）・`prepare`（reselect）・`print_summary`。テストは `test_run_rule401.py` の `Reselect`・`ReselectSim`。

- まず今までどおり 割り振り（plan_401.json）の面・爪の傾きで道を作る。作れてガードを全部通れば それを使う
- 道が作れない（rule_351 の道・rule_401 の道）か clear_345・in_range・step に当たったときだけ、読んだ画素・向きに rule_351 の選び方
  （`face_349.try_path` を面のずらし 0・+90・−90 × 許しに入る爪の傾き 1° 刻みで当て、爪の面の傾き ±8° の外を外し、margin の順。面の順は `face_349.select` を残りにくり返し）を当て、
  その順に `build`（rule_351 → rule_401 → 今と同じガード全部）を当て、全部通る最初のものを使う
- `--reselect-face` のときは 向きの許し（±8°）で止めない。画素の許しは今のまま
- 押し付け（push_limit・push_window）・status のガードだけに当たったときは選び直さず 今までどおり止める

## 見てほしい点（2 つだけ）
1. **選び直した面で、下りる間に腕・爪がブロック・箱・机に当たらないか。** 選び直した道にも `build` の中の clear_345.check_path（爪の先と机の下限 −11 mm）・rule_401 の予想のすき間・in_range・step・push のガードが、割り振りの面の道と同じように当たっているか。`build` の `CL.check_path(v, bxy, yaw, …)` と `R401.apply(W, res, {"pixel", "yaw"})` にはブロックの向き `yaw`（面のずらしを足さない値）を渡している。面のずらし ±90° の道でも ブロックの形（立方体）の当たりの見方が正しいか
2. **選び直しが「割り振りの面で通る回」の動きを変えていないか。** `--reselect-face` を付けても付けなくても、割り振りの面で通る回は同じ道（同じ配列）を送るか。付けないときの動き・止め方・出力が依頼 401/402 と同じか

## 確かめたこと（参考）
- 2026-12-01 の実機 code_rule401 の回の読みを通し、付けた/付けないで道が同じかを `so101/check_404/replay56_404.py` で見ている
- 場所1〜5 × 画素 5 通り × 向き 19 通りの数え上げ `so101/check_404/sweep_404.py`

結果は ✅ / ⚠️ / ❌ と **必須か推奨か** をつけて、日本語で。最後に「この直しで場所5 を 1 回流してよいか（実機はエイイチが見て流す）」を 1 行で。
```

### so101/check_404/review_r1.txt

```text
**判定：❌ 必須の確認・修正があります。** 選び直した道にも既存のガードは同じように適用されますが、下りる間のブロックとの衝突をすべて止める実装ではありません。場所5の実機実行は、この点を確認するまで見合わせることを勧めます。

- ❌ **必須：下りる間のブロックとの接触判定を確認する。** [clear_345.py](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/ideal_var/clear_345.py:120) の置いたブロックとの距離チェックは `ABOVE_BLOCK` までです。その後の下降中について、rule_401 は固定側・動く爪とブロックの予想すき間を計算しますが、[run_rule401.py](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/check_401/run_rule401.py:163) のガードはその値を停止条件にしていません。したがって、予想すき間が負でも他のガードが通れば採用され得ます。これは選び直し固有ではなく従来経路にもある制限ですが、今回の「下りる間に当たらないか」にはコード上、保証できません。

- ⚠️ **必須：実機前に判定範囲を理解して確認する。** 選び直し候補も同じ `build` を通り、指令経路への `clear_345`、範囲、ステップ、押し付け、status のガードを受けます。ただし `clear_345` は下降中、机について爪の下限を見ており、腕全体と机の距離はその区間で除外しています。また、これはモデル上の判定であり、実機の接触なしを証明するものではありません。[clear_345.py](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/ideal_var/clear_345.py:113)

- ✅ **推奨：向きの扱いは現状で妥当。** 経路生成には `yaw + face`、ブロック形状の判定と rule_401 には元の `yaw` が渡されています。[run_rule401.py](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/check_401/run_rule401.py:150) 立方体の水平形状は90°回転で同じなので、±90°の面でもブロック自体の向きを変えない扱いは適切です。

- ✅ **推奨：従来経路の同一性。** 同じ読みで従来側も向きの許しを通り、割り振りの面のガードが通る場合、両モードとも同じ引数で `build` し、その `path` を使います。選び直しモードでは付加情報が出力されます。向きの許しを超えた場合は、指定どおり従来側は停止し、選び直し側は続行するため、両者の結果は同一とは限りません。フラグなしの分岐について、差分上、従来の停止・出力の変更は見当たりません。

- ✅ **推奨：選び直しの起点。** 押し付け・status **だけ**が不合格なら選び直さず停止します。これらと `clear_345`・`in_range`・`step` の不合格が重なった場合は選び直します。

読み取りのみでレビューし、テストや実機動作は行っていません。

**場所5を1回流してよいか：現状では見合わせ、下降中の予想すき間の停止条件と判定範囲を確認してからエイイチが判断してください。**
```

### so101/check_404/sweep_404.py

```python
#!/usr/bin/env python3
"""依頼 404 の確かめ (アームなし. 計算だけ): run_rule401.py の 今の形 (割り振りの面のまま) と --reselect-face で
道が作れて ガードを通る置き方の数を数える.

- 場所1〜5 の目印の画素 と 上下左右へ 20 画素ずらした 4 通り × 向き −45〜+45° (5° 刻み) = 場所ごとに 95 通り
- ガードの値は 2 通り: day = 2026-12-01 の実機と同じ (R401_PUSH_LIMIT_MM=-12・R401_PUSH_WINDOW_MM=-12・conflict と deep_at_zero を許す) /
  default = 既定の値 (−6・−6・ok だけ)
- 画素の許し (10 画素) と 向きの許し (±8°) は ここでは当てない (道とガードだけを見る. 今の形の 向き ±8° に入るかは 列 yaw_in_tol に残す)
- 向きの読みは run_rule401.prepare と同じ (yaw_lib_343.fold → 割り振りの向きに近い 90° ずらし → 0.1° に丸める)
- 場所1 は割り振りで ok でない (目印では校正の点の囲みの外) が, 目印の画素と割り振りの値でそのまま数える

  SO101_VAR_ROLL_RANGE=-67,58 /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/bin/python so101/check_404/sweep_404.py --jobs 8
"""
import argparse
import json
import os
import sys
import time
from multiprocessing import Pool
from pathlib import Path

import numpy as np

HERE = Path(__file__).resolve().parent
SO101 = HERE.parent
sys.path.insert(0, str(SO101 / "check_401"))

OUT = HERE / "sweep_404.jsonl"
YAWS = list(range(-45, 46, 5))
OFFS = [("marker", 0, 0), ("u+20", 20, 0), ("u-20", -20, 0), ("v+20", 0, 20), ("v-20", 0, -20)]
SETTINGS = {"day": ({"R401_PUSH_LIMIT_MM": "-12", "R401_PUSH_WINDOW_MM": "-12"}, ("conflict", "deep_at_zero")),
            "default": ({}, ())}
_G = {}


def _init():
    import run_rule401 as RR
    plan, lo, hi = RR.load_plan()
    _G.update(RR=RR, plan=plan, lo=lo, hi=hi, W=RR.world())


def _env(env):
    for k in ("R401_PUSH_LIMIT_MM", "R401_PUSH_WINDOW_MM"):
        os.environ.pop(k, None)
    os.environ.update(env)


def one(task):
    import face_349 as F
    import yaw_lib_343 as Y
    RR, plan, lo, hi, W = _G["RR"], _G["plan"], _G["lo"], _G["hi"], _G["W"]
    place, oname, du, dv, yaw0 = task
    e = plan["episodes"][place - 1]
    uv = np.asarray(e["pixel"], np.float64) + (du, dv)
    yaw_plan = float(e["yaw"])
    yaw = round(float(Y.unwrap_near(Y.fold(float(yaw0)), yaw_plan)), 1)
    jt = plan.get("jaw_table_min_mm")
    t0 = time.time()
    row = {"place": place, "offset": oname, "pixel": uv.round(1).tolist(), "yaw_set": yaw0, "yaw": yaw,
           "yaw_in_tol": abs(yaw - yaw_plan) <= Y.YAW_TOL_DEG}
    cands = None
    for name, (env, allow) in SETTINGS.items():
        _env(env)
        r = {}
        try:
            b, _ = RR.build_choose(W, e, uv, yaw, lo, hi, jt, allow, reselect=False)
            r.update(now_ok=True, now_why="")
        except RR.Refused as x:
            r.update(now_ok=False, now_why=str(x)[:300])
        need = False
        try:
            b = RR.build(W, e, uv, yaw, lo, hi, jt)
            need = any(b["guards"].get(k) is not True for k in RR.RESELECT_GUARDS)
        except RR.Refused:
            need = True
        if need and cands is None:
            cands = RR.reselect_candidates(W, uv, yaw, lo, hi, RR.plan_jt(jt), skip=(F.plan_face(e), F.plan_tilt_s(e)))
        try:
            b, meta = RR.build_choose(W, e, uv, yaw, lo, hi, jt, allow, reselect=True, cands=cands if need else None)
            r.update(re_ok=True, re_why="", path_sha=_sha(b["path"]))
        except RR.Refused as x:
            b, meta = None, getattr(x, "info_extra", {})
            r.update(re_ok=False, re_why=str(x)[:300])
        r.update(face_deg=meta.get("face_deg"), tilt_s_deg=meta.get("tilt_s_deg"), face_reselected=meta.get("face_reselected"),
                 plan_face_why=(meta.get("plan_face_why") or "")[:300], jaw_elev_deg=meta.get("jaw_elev_deg"),
                 roll_grasp_deg=meta.get("roll_grasp_deg"), n_tried=len(meta.get("reselect_tried") or []),
                 tried=[{k: t[k] for k in ("face_deg", "tilt_s_deg", "jaw_elev_deg", "roll_grasp_deg")} | {"why": t["why"][:160]}
                        for t in (meta.get("reselect_tried") or [])][:6])
        if b is not None:
            r.update(status=b["v"]["status"], roll_grasp_used=round(float(b["res"]["info"]["grasp"][4]), 2))
        row[name] = r
    row["n_cands"] = None if cands is None else len(cands)
    row["cand_faces"] = None if cands is None else sorted({float(c["face"]) for c in cands})
    row["sec"] = round(time.time() - t0, 1)
    return row


def _sha(p):
    import hashlib
    return hashlib.sha256(np.round(np.asarray(p, np.float64), 6).tobytes()).hexdigest()[:16]


def main(argv=None):
    ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
    ap.add_argument("--jobs", type=int, default=8)
    ap.add_argument("--places", default="1,2,3,4,5")
    ap.add_argument("--out", default=str(OUT))
    args = ap.parse_args(argv)
    out = Path(args.out)
    done = set()
    if out.exists():
        for ln in out.read_text().splitlines():
            r = json.loads(ln)
            done.add((r["place"], r["offset"], r["yaw_set"]))
    tasks = [(p, o, du, dv, y) for p in (int(x) for x in args.places.split(",")) for (o, du, dv) in OFFS for y in YAWS
             if (p, o, y) not in done]
    print(f"[404] {len(tasks)} 通り (済み {len(done)})", flush=True)
    t0 = time.time()
    with Pool(args.jobs, initializer=_init) as pool, out.open("a") as f:
        for i, row in enumerate(pool.imap_unordered(one, tasks), 1):
            f.write(json.dumps(row, ensure_ascii=False) + "\n")
            f.flush()
            if i % 10 == 0 or i == len(tasks):
                print(f"[404] {i}/{len(tasks)} {time.time() - t0:.0f} 秒", flush=True)
    return 0


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

### so101/check_404/summarize_404.py

```python
#!/usr/bin/env python3
"""依頼 404: sweep_404.jsonl → 場所ごとの表と 場所5 の向きごとの選び方 (summary_404.md)"""
import json
from collections import defaultdict
from pathlib import Path

HERE = Path(__file__).resolve().parent


def rng(ys):
    return f"{min(ys):+.0f}〜{max(ys):+.0f}°" if ys else "なし"


def main():
    rows = [json.loads(x) for x in (HERE / "sweep_404.jsonl").read_text().splitlines()]
    rows.sort(key=lambda r: (r["place"], r["offset"], r["yaw_set"]))
    L = ["# 依頼 404 の数え上げ (sweep_404.jsonl)", "",
         "道が作れて ガードを全部通る数 / 95 (画素 5 通り × 向き 19 通り). 今の形 = 割り振りの面のまま (向きの許し ±8° と画素の許しは当てない). "
         "(±8°) = そのうち 割り振りの向きから ±8° に入る分 (今の形で実際に流せる数)", ""]
    for g in ("day", "default"):
        L += [f"## ガード {g}" + (" (−12・−12・conflict と deep_at_zero を許す)" if g == "day" else " (既定 −6・−6・ok だけ)"), "",
              "| 場所 | 今の形 | 今の形 (±8°) | --reselect-face | 増えた | 選び直した | 目印の向きの幅 今の形 | 目印の向きの幅 選び直し |", "|---|---|---|---|---|---|---|---|"]
        for p in range(1, 6):
            rs = [r for r in rows if r["place"] == p]
            now = sum(r[g]["now_ok"] for r in rs)
            now8 = sum(r[g]["now_ok"] and r["yaw_in_tol"] for r in rs)
            re = sum(r[g]["re_ok"] for r in rs)
            sel = sum(bool(r[g]["re_ok"] and r[g]["face_reselected"]) for r in rs)
            m = [r for r in rs if r["offset"] == "marker"]
            L.append(f"| {p} | {now} | {now8} | {re} | {re - now:+d} | {sel} | {rng([r['yaw'] for r in m if r[g]['now_ok']])} | "
                     f"{rng([r['yaw'] for r in m if r[g]['re_ok']])} |")
        L.append("")
        L += ["画素のずらしごと (今の形 → 選び直し)", "", "| 場所 | " + " | ".join(o for o in ("marker", "u+20", "u-20", "v+20", "v-20")) + " |",
              "|---|---|---|---|---|---|"]
        for p in range(1, 6):
            cells = []
            for o in ("marker", "u+20", "u-20", "v+20", "v-20"):
                rs = [r for r in rows if r["place"] == p and r["offset"] == o]
                cells.append(f"{sum(r[g]['now_ok'] for r in rs)} → {sum(r[g]['re_ok'] for r in rs)} "
                             f"({rng([r['yaw'] for r in rs if r[g]['re_ok']])})")
            L.append(f"| {p} | " + " | ".join(cells) + " |")
        L.append("")
    for g in ("day", "default"):
        L += [f"## 場所5 の目印 向きごと (ガード {g})", "",
              "| 向き | 今の形 | 選び直し | 面 | 爪の傾き | 手首の回り (つかむ所) | 候補の数 (面) | 作れない理由 |", "|---|---|---|---|---|---|---|---|"]
        for r in [r for r in rows if r["place"] == 5 and r["offset"] == "marker"]:
            x = r[g]
            why = "" if x["re_ok"] else (x["re_why"] if x["now_ok"] is False and not x["plan_face_why"] else
                                         f"{x['plan_face_why'][:90]} → {x['re_why'][:80]}")
            L.append(f"| {r['yaw']:+.1f} | {'○' if x['now_ok'] else '×'} | {'○' if x['re_ok'] else '×'} | {x['face_deg'] if x['face_deg'] is not None else ''} | "
                     f"{x['tilt_s_deg'] if x['tilt_s_deg'] is not None else ''} | {x.get('roll_grasp_used', '')} | "
                     f"{'' if r['n_cands'] is None else r['n_cands']} {r['cand_faces'] or ''} | {why} |")
        L.append("")
    fc = defaultdict(int)
    for r in rows:
        for g in ("day", "default"):
            if r[g]["re_ok"] and r[g]["face_reselected"]:
                fc[(g, r["place"], r[g]["face_deg"])] += 1
    L += ["## 選び直したときの面 (数)", ""] + [f"- {g} 場所{p} 面 {f:+.0f}°: {n}" for (g, p, f), n in sorted(fc.items())] + [""]
    (HERE / "summary_404.md").write_text("\n".join(L) + "\n")
    print("\n".join(L))


if __name__ == "__main__":
    main()
```

### so101/check_404/gaps_404.py

```python
#!/usr/bin/env python3
"""依頼 404 (codex R1 の必須 1 への答えの材料. アームなし): sweep_404.jsonl の ガード day で通った道 (割り振りの面のまま / 選び直し) を作り直し,
下りる間の 予想・指令の すき間 (rule_401 の cmd・pred の fixed_min (固定側とブロック)・moving_min (動く爪とブロック)・
lift_start_jaw_table_min) を比べる. ガードにはしない (見るだけ)

  SO101_VAR_ROLL_RANGE=-67,58 OMP_NUM_THREADS=1 /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/bin/python so101/check_404/gaps_404.py
"""
import json
import os
import sys
from multiprocessing import Pool
from pathlib import Path

import numpy as np

HERE = Path(__file__).resolve().parent
sys.path.insert(0, str(HERE.parent / "check_401"))
_G = {}


def _init():
    os.environ.update(R401_PUSH_LIMIT_MM="-12", R401_PUSH_WINDOW_MM="-12")
    import run_rule401 as RR
    plan, lo, hi = RR.load_plan()
    _G.update(RR=RR, plan=plan, lo=lo, hi=hi, W=RR.world())


def one(r):
    RR, plan = _G["RR"], _G["plan"]
    d = r["day"]
    e = plan["episodes"][r["place"] - 1]
    kw = {"face": d["face_deg"], "tilt_s": d["tilt_s_deg"]} if d["face_reselected"] else {}
    b = RR.build(_G["W"], e, np.asarray(r["pixel"], np.float64), r["yaw"], _G["lo"], _G["hi"], plan.get("jaw_table_min_mm"), **kw)
    v = b["v"]
    return {"place": r["place"], "offset": r["offset"], "yaw": r["yaw"], "reselected": bool(d["face_reselected"]), "face": d["face_deg"],
            "cmd_fixed": v["cmd"].get("fixed_min"), "cmd_moving": v["cmd"].get("moving_min"),
            "pred_fixed": v["pred"].get("fixed_min"), "pred_moving": v["pred"].get("moving_min"),
            "clear_min": min((x for x in b["clear"].values() if x is not None), default=None)}


def main():
    rows = [json.loads(x) for x in (HERE / "sweep_404.jsonl").read_text().splitlines()]
    seen, todo = set(), []
    for r in rows:
        k = (r["place"], r["offset"], r["yaw"])
        if r["day"]["re_ok"] and k not in seen:
            seen.add(k)
            todo.append(r)
    with Pool(8, initializer=_init) as p:
        out = p.map(one, todo)
    (HERE / "gaps_404.json").write_text(json.dumps(out, ensure_ascii=False, indent=1) + "\n")
    for sel in (False, True):
        xs = [o for o in out if o["reselected"] == sel]
        print("選び直し" if sel else "割り振りの面", len(xs))
        for k in ("cmd_fixed", "pred_fixed", "cmd_moving", "pred_moving"):
            a = np.array([o[k] for o in xs if o[k] is not None], float)
            if len(a):
                print(f"  {k}: 最小 {a.min():+.2f}  中央 {np.median(a):+.2f}  負の数 {(a < 0).sum()}")
        for f in sorted({o["face"] for o in xs}):
            a = np.array([min(o["pred_fixed"], o["pred_moving"]) for o in xs if o["face"] == f], float)
            print(f"   面 {f:+.0f}: {len(a)} 本  予想の下りる間のすき間 最小 {a.min():+.2f} 中央 {np.median(a):+.2f} 負 {(a < 0).sum()}")


if __name__ == "__main__":
    main()
```

### so101/check_404/replay56_404.py

```python
#!/usr/bin/env python3
"""依頼 404 の確かめ (アームなし): 2026-12-01 の実機の code_rule401 の回の読み (trial.json の rule401.block_read の u・v
(なければ block_pixel) と block_yaw_deg) を --reselect-face (build_choose(reselect=True)) と 今の形 (reselect=False) に通し,
道が 1 コマも変わらないか (同じ配列か) を見る. 記録の rule401_plan.json の道 (3 桁に丸めたもの) とも比べる.
ガードの値は その日と同じ (R401_PUSH_LIMIT_MM=-12・R401_PUSH_WINDOW_MM=-12・conflict と deep_at_zero を許す)

  SO101_VAR_ROLL_RANGE=-67,58 /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/bin/python so101/check_404/replay56_404.py
"""
import csv
import json
import os
import sys
from pathlib import Path

import numpy as np

HERE = Path(__file__).resolve().parent
sys.path.insert(0, str(HERE.parent / "check_401"))
LOG = Path("/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12")
OUT = HERE / "replay56_404.json"


def main():
    os.environ.update(R401_PUSH_LIMIT_MM="-12", R401_PUSH_WINDOW_MM="-12")
    import run_rule401 as RR
    import run_so101_policy as R
    plan, lo, hi = RR.load_plan()
    W = RR.world()
    allow = ("conflict", "deep_at_zero")
    rows = []
    with open(LOG / R.TRIALS_CSV, newline="") as f:
        trials = [r for r in csv.DictReader(f, fieldnames=R.TRIAL_COLUMNS, restkey="_more") if r["model"] == "code_rule401"]
    for t in trials:
        d = Path(t["record_dir"])
        tj = json.loads((d / "trial.json").read_text())
        info = tj["rule401"]
        br = info.get("block_read") or {}
        uv = np.array([br["u"], br["v"]] if "u" in br else info["block_pixel"], np.float64)
        yaw = float(info["block_yaw_deg"])
        e = RR.episode_of(plan, int(info["place"]), bool(info.get("from_candidate")))
        b0, _ = RR.build_choose(W, e, uv, yaw, lo, hi, plan.get("jaw_table_min_mm"), allow, reselect=False)
        b1, meta = RR.build_choose(W, e, uv, yaw, lo, hi, plan.get("jaw_table_min_mm"), allow, reselect=True)
        rec = np.asarray(json.loads((d / RR.PLAN_FILE).read_text())["path"], np.float64)
        same = b0["path"].shape == b1["path"].shape and bool(np.array_equal(b0["path"], b1["path"]))
        drec = float(np.abs(np.round(b1["path"], 3) - rec).max()) if rec.shape == b1["path"].shape else None
        rows.append({"trial": t["trial"], "place": int(info["place"]), "result": t["result"], "pixel": uv.round(2).tolist(), "yaw": yaw,
                     "frames": len(b1["path"]), "same_as_now": same, "face_reselected": meta["face_reselected"],
                     "face_deg": meta["face_deg"], "tilt_s_deg": meta["tilt_s_deg"], "max_diff_vs_record": drec,
                     "record_frames": len(rec)})
        print(f"{t['trial']} 場所{info['place']} {t['result']:8s} 向き {yaw:+5.1f} 同じ {same} 選び直し {meta['face_reselected']} "
              f"記録との差 {drec}", flush=True)
    n = len(rows)
    summ = {"n": n, "same_as_now": sum(r["same_as_now"] for r in rows), "reselected": sum(r["face_reselected"] for r in rows),
            "max_diff_vs_record": max((r["max_diff_vs_record"] for r in rows if r["max_diff_vs_record"] is not None), default=None),
            "frames_differ_vs_record": sum(r["max_diff_vs_record"] is None for r in rows)}
    OUT.write_text(json.dumps({"summary": summ, "rows": rows}, ensure_ascii=False, indent=1) + "\n")
    print(summ)


if __name__ == "__main__":
    main()
```

### so101/check_404/replay56_404.log

```text
so101_20261201_092453 場所3 success  向き  +2.2 同じ True 選び直し False 記録との差 0.0
so101_20261201_092549 場所3 success  向き  -2.9 同じ True 選び直し False 記録との差 0.0
so101_20261201_092935 場所3 success  向き  +2.8 同じ True 選び直し False 記録との差 0.0
so101_20261201_093018 場所3 success  向き  +2.5 同じ True 選び直し False 記録との差 0.0
so101_20261201_093131 場所3 success  向き  +0.8 同じ True 選び直し False 記録との差 0.0
so101_20261201_093251 場所3 success  向き  -0.5 同じ True 選び直し False 記録との差 0.0
so101_20261201_093506 場所2 success  向き  +3.1 同じ True 選び直し False 記録との差 0.0
so101_20261201_093547 場所4 success  向き  +3.2 同じ True 選び直し False 記録との差 0.0
so101_20261201_093749 場所5 success  向き  -0.1 同じ True 選び直し False 記録との差 0.0
so101_20261201_093932 場所2 success  向き  +4.5 同じ True 選び直し False 記録との差 0.0
so101_20261201_094011 場所4 success  向き  +2.6 同じ True 選び直し False 記録との差 0.0
so101_20261201_094157 場所5 success  向き  -4.8 同じ True 選び直し False 記録との差 0.0
so101_20261201_094318 場所2 success  向き  +3.3 同じ True 選び直し False 記録との差 0.0
so101_20261201_094418 場所4 success  向き  +3.0 同じ True 選び直し False 記録との差 0.0
so101_20261201_094609 場所5 success  向き  -2.2 同じ True 選び直し False 記録との差 0.0
so101_20261201_094707 場所2 success  向き  +1.0 同じ True 選び直し False 記録との差 0.0
so101_20261201_094744 場所4 success  向き  +2.3 同じ True 選び直し False 記録との差 0.0
so101_20261201_095034 場所5 success  向き  -4.6 同じ True 選び直し False 記録との差 0.0
so101_20261201_095108 場所2          向き  +3.8 同じ True 選び直し False 記録との差 0.0
so101_20261201_095203 場所2 success  向き  +1.7 同じ True 選び直し False 記録との差 0.0
so101_20261201_095242 場所4 success  向き  +6.7 同じ True 選び直し False 記録との差 0.0
so101_20261201_100116 場所5 success  向き  +1.6 同じ True 選び直し False 記録との差 0.0
so101_20261201_100155 場所2 success  向き  +2.9 同じ True 選び直し False 記録との差 0.0
so101_20261201_100355 場所4 success  向き  +1.9 同じ True 選び直し False 記録との差 0.0
so101_20261201_100702 場所5 success  向き  +2.1 同じ True 選び直し False 記録との差 0.0
so101_20261201_101100 場所2 success  向き  +3.9 同じ True 選び直し False 記録との差 0.0
so101_20261201_101251 場所3 success  向き  +3.6 同じ True 選び直し False 記録との差 0.0
so101_20261201_101340 場所4 success  向き  +1.4 同じ True 選び直し False 記録との差 0.0
so101_20261201_101611 場所5 success  向き  -4.5 同じ True 選び直し False 記録との差 0.0
so101_20261201_101648 場所2 success  向き  +2.9 同じ True 選び直し False 記録との差 0.0
so101_20261201_101808 場所3 success  向き  +3.0 同じ True 選び直し False 記録との差 0.0
so101_20261201_101843 場所4 success  向き  +4.4 同じ True 選び直し False 記録との差 0.0
so101_20261201_102015 場所5 success  向き  +1.7 同じ True 選び直し False 記録との差 0.0
so101_20261201_102051 場所2 success  向き  +4.9 同じ True 選び直し False 記録との差 0.0
so101_20261201_102138 場所3 success  向き  +1.2 同じ True 選び直し False 記録との差 0.0
so101_20261201_102214 場所4 success  向き  +2.8 同じ True 選び直し False 記録との差 0.0
so101_20261201_102539 場所5 success  向き  -7.5 同じ True 選び直し False 記録との差 0.0
so101_20261201_102806 場所2 success  向き  -3.2 同じ True 選び直し False 記録との差 0.0
so101_20261201_102845 場所3 success  向き  +1.4 同じ True 選び直し False 記録との差 0.0
so101_20261201_102919 場所4 success  向き  +2.5 同じ True 選び直し False 記録との差 0.0
so101_20261201_102958 場所5 success  向き  +0.5 同じ True 選び直し False 記録との差 0.0
so101_20261201_103106 場所2 success  向き  +3.4 同じ True 選び直し False 記録との差 0.0
so101_20261201_103144 場所3 success  向き  +5.7 同じ True 選び直し False 記録との差 0.0
so101_20261201_103217 場所4 success  向き  +1.9 同じ True 選び直し False 記録との差 0.0
so101_20261201_103331 場所5 success  向き  +2.0 同じ True 選び直し False 記録との差 0.0
so101_20261201_103405 場所2 success  向き  +2.8 同じ True 選び直し False 記録との差 0.0
so101_20261201_103445 場所3 success  向き  +2.4 同じ True 選び直し False 記録との差 0.0
so101_20261201_103518 場所4 success  向き  +2.6 同じ True 選び直し False 記録との差 0.0
so101_20261201_103612 場所5 success  向き  -5.0 同じ True 選び直し False 記録との差 0.0
so101_20261201_103818 場所2 success  向き +17.0 同じ True 選び直し False 記録との差 0.0
so101_20261201_103851 場所3 success  向き +11.7 同じ True 選び直し False 記録との差 0.0
so101_20261201_103926 場所4 success  向き  +4.4 同じ True 選び直し False 記録との差 0.0
so101_20261201_104502 場所5 success  向き  +1.6 同じ True 選び直し False 記録との差 0.0
so101_20261201_104539 場所2 success  向き  -2.7 同じ True 選び直し False 記録との差 0.0
so101_20261201_104646 場所3 success  向き  +7.6 同じ True 選び直し False 記録との差 0.0
so101_20261201_104832 場所4 success  向き +11.5 同じ True 選び直し False 記録との差 0.0
so101_20261201_105045 場所5 success  向き  +0.3 同じ True 選び直し False 記録との差 0.0
{'n': 57, 'same_as_now': 57, 'reselected': 0, 'max_diff_vs_record': 0.0, 'frames_differ_vs_record': 0}
```

### so101/check_404/test_404.log

```text
..................F............
======================================================================
FAIL: test_execute_cleanup_order (so101.check_401.test_run_rule401.T.test_execute_cleanup_order)
execute (モック): 結果を聞く間の Ctrl-C → 止める目標 → 記録を閉じる → 腕を閉じる の順 (codex R4 C1).
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/shimazueiichi/r2r2r-scripts/so101/check_401/test_run_rule401.py", line 308, in test_execute_cleanup_order
    self.assertEqual(order, ["hold", "rec.close", "arm.close"])
AssertionError: Lists differ: ['hold', 'arm.close'] != ['hold', 'rec.close', 'arm.close']

First differing element 1:
'arm.close'
'rec.close'

Second list contains 1 additional elements.
First extra element 2:
'arm.close'

- ['hold', 'arm.close']
+ ['hold', 'rec.close', 'arm.close']
?         +++++++++++++


----------------------------------------------------------------------
Ran 31 tests in 119.810s

FAILED (failures=1)

[STOP  ] 失敗で止まりました: AttributeError: 'types.SimpleNamespace' object has no attribute 'reselect_face'
[STOP  ] その場で止める目標を送り 腕が止まりました
[R401  ] 道を送る前に止めたので 台帳に書きません (AttributeError: 'types.SimpleNamespace' object has no attribute 'reselect_face')
[1;37;41m[STOP  ] その場で止める目標を送れない (OSError: 通信の失敗). 最後に送れた目標のまま閉じます. 腕を見てください[0m
```

### 依頼404 の commit a37c68a の中身（変えたファイルの一覧と、check_40x の外のコードの差分。check_40x のファイルは上に全文）

```text
$ git show --stat a37c68a && git show --format= a37c68a -- '*.py' '*.sh' ':(exclude)so101/check_40*/*'
commit a37c68a3bd1a5c8bc3dd930c3d3717150d1436db
Author: Eiichi Shimazu <studio@adaptdesign.jp>
Date:   Tue Dec 1 12:50:13 2026 +0900

    依頼 404: rule_401 をコードで流すとき 割り振りの面で道が作れない (か clear_345・in_range・step に当たる) ときだけ 読んだ向きに rule_351 の選び方 (面 0・+90・−90. 道が作れる → 爪の面の傾き → 手首の回り. 爪の傾きは margin) で面・爪の傾きを選び直す --reselect-face を run_rule401.py に足した (session_401.sh は R401_RESELECT=1). 選び直した道にも rule_401 と今と同じガードを全部当てる. 向きの許しでは止めない. 画素の許しは今のまま. 付けないときは今と同じ. 数え上げ (場所ごと 95 通り・今日のガード): 場所2 43→60・3 69→95・4 31→95・5 31→54・1 2→2. 場所5 の目印の向きの幅 −25〜+5° → −40〜+5° (+10° から上は どの面も作れない. +90・−90 の面は候補 0 本). 今日の実機 57 回の読みは 57 回とも同じ道 (選び直し 0・記録との差 0.0). テスト 31 本 OK. codex 1 回 (必須 R1-1 下りる間のすき間をガードにするか は 決めてほしいこと). 判定 止めた. アームは動かしていない
    
    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

 so101/check_401/run_rule401.py        |  159 +-
 so101/check_401/session_401.sh        |    1 +
 so101/check_401/test_run_rule401.py   |  141 ++
 so101/check_404/REPORT.md             |  153 ++
 so101/check_404/gaps_404.json         | 3518 +++++++++++++++++++++++++++++++++
 so101/check_404/gaps_404.py           |   65 +
 so101/check_404/replay56_404.json     |  980 +++++++++
 so101/check_404/replay56_404.log      |   58 +
 so101/check_404/replay56_404.py       |   61 +
 so101/check_404/review_r1.txt         |   15 +
 so101/check_404/review_r1_raw.txt     | 1313 ++++++++++++
 so101/check_404/review_request_404.md |   24 +
 so101/check_404/summarize_404.py      |   65 +
 so101/check_404/summary_404.md        |  110 ++
 so101/check_404/sweep_404.jsonl       |  475 +++++
 so101/check_404/sweep_404.log         |   52 +
 so101/check_404/sweep_404.py          |  129 ++
 17 files changed, 7305 insertions(+), 14 deletions(-)
```


## 実機のログ ― コードだけで、回したブロックを場所5・場所4 で流した（14:25〜14:33）

`R401_RESELECT=1` で面の選び直しを入れて流した。場所5 の −28.5°・−30.9°、場所4 の −31.5°・+21.8° の4回とも成功。

### ターミナルのログ（コードだけ・面の選び直しあり）

```text
Last login: Tue Dec  1 10:10:12 on ttys001
(base) shimazueiichi@shimadzueiichinoMacBook-Pro ~ % cd ~/r2r2r-scripts
R401_RESELECT=1 R401_PUSH_LIMIT_MM=-12 R401_PUSH_WINDOW_MM=-12 R401_ALLOW_CONFLICT=1 R401_ALLOW_DEEP=1 R401_PIXEL_TOL_PX=40 R401_START_TOL_DEG=25 N=16 PLACES="5 4" ./so101/check_401/session_401.sh

==================================================
  場所5 の 15 回目 (全 16 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

objc[62618]: 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 (0x1027cc3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x14c7443a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[62618]: 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 (0x1027cc3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x14c7443f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所5: ブロック 画素 [420.9, 156.5]・向き -28.5°・目印から 13.7 画素
[R401  ] 下げ 0.0 mm (conflict). つかむ所の爪と机 指令 5.91・予想 -2.93・沈み最大 -24.76 mm. 下りる間 固定側 指令 10.12/予想 11.09・動く爪 27.1/24.46 mm. 持ち上げの始めの予想 -7.25 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 55.9, 'arm_box': 33.1, 'arm_base': 198.5, 'arm_block_pad10': 29.8, 'held_table': 68.4, 'held_box': 32.6, 'jaw_table_grasp': 0.5}
[R401  ] 面を選び直した: 割り振りの面 +0°・爪の傾き 19.0° で 作れない (rule_401 の道が作れない: 固定側を 12 mm 離す形が解けない: 姿勢が解けない ({'pos_mm': 0.241, 'tilt_deg': 0.637, 'jaw_deg': 0.073})) → 面 +0°・爪の傾き 23.0°・爪の面の傾き 3.15°・手首の回り -13.1°
[R401  ] 送れる
[R401  ] この回は 決まりの外の口を使います: status conflict (--allow-status)
流すなら yes と打つ > yes
objc[62618]: 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 (0x1027cc3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17bdf8778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[62618]: 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 (0x1027cc3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17bdf87c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|███████████████████████████| 251/251 [00:00<00:00, 666.06 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_142543 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv

==================================================
  場所4 の 15 回目 (全 16 回): ブロックを 場所4 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

objc[62891]: 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 (0x104f543a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1403f03a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[62891]: 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 (0x104f543f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1403f03f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所4: ブロック 画素 [285.5, 250.7]・向き -31.5°・目印から 11.1 画素
[R401  ] 下げ -1.41 mm (ok). つかむ所の爪と机 指令 0.9・予想 -3.76・沈み最大 -20.83 mm. 下りる間 固定側 指令 10.87/予想 7.08・動く爪 28.17/29.46 mm. 持ち上げの始めの予想 -7.11 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 52.3, 'arm_box': 33.1, 'arm_base': 141.7, 'arm_block_pad10': 27.3, 'held_table': 72.0, 'held_box': 35.5, 'jaw_table_grasp': -1.9}
[R401  ] 面を選び直した: 割り振りの面 +0°・爪の傾き 31.0° で 作れない (rule_351 の道が作れない: つかむ所 (向き -31.5°): 爪の面を机に垂直にできない (爪の面の傾き +17.8°・許し ±8°)) → 面 +0°・爪の傾き 3.0°・爪の面の傾き -1.28°・手首の回り -37.76°
[R401  ] 送れる
objc[62891]: 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 (0x104f543a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17a1e0778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[62891]: 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 (0x104f543f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17a1e07c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 251/251 [00:00<00:00, 2691.32 examples/s]
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: 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 [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: 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[warn]: SVT [config]: BRC mode / rate factor 			: CRF / 30 
Preset M12 is mapped to M10.
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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_142751 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv

==================================================
  場所5 の 16 回目 (全 16 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

objc[63133]: 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 (0x103ac03a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x145ca03a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[63133]: 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 (0x103ac03f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x145ca03f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所5: ブロック 画素 [417.8, 161.1]・向き -45.7°・目印から 12.1 画素
[R401  ] 面を選び直しても作れない (候補 0 通り)
[R401  ] 動かさない: 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない)

   動かしません: 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない)   
[INFO] 動かさずに止まった (置き直してもう一度)

==================================================
  場所5 の 16 回目 (全 16 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

objc[63195]: 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 (0x1050003a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1571cc3a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[63195]: 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 (0x1050003f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1571cc3f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所5: ブロック 画素 [418.7, 160.3]・向き -33.0°・目印から 12.5 画素
[R401  ] 下げ 0.0 mm (deep_at_zero). つかむ所の爪と机 指令 5.34・予想 -9.6・沈み最大 -24.78 mm. 下りる間 固定側 指令 10.22/予想 7.28・動く爪 27.06/22.36 mm. 持ち上げの始めの予想 -12.31 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 55.3, 'arm_box': 33.1, 'arm_base': 200.4, 'arm_block_pad10': 27.7, 'held_table': 68.8, 'held_box': 33.2, 'jaw_table_grasp': -0.3}
[R401  ] 割り振りの面 +0°・爪の傾き 19.0° のまま
[R401  ] 動かさない: ガードに当たった: push_window: 予想の 閉じる間〜持ち上げの始めの 爪と机 -12.31 mm (上限 -12)

   動かしません: ガードに当たった: push_window: 予想の 閉じる間〜持ち上げの始めの 爪と机 -12.31 mm (上限 -12)   
[INFO] 動かさずに止まった (置き直してもう一度)

==================================================
  場所5 の 16 回目 (全 16 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================
q
(base) shimazueiichi@shimadzueiichinoMacBook-Pro r2r2r-scripts % R401_RESELECT=1 R401_PUSH_LIMIT_MM=-14 R401_PUSH_WINDOW_MM=-14 R401_ALLOW_CONFLICT=1 R401_ALLOW_DEEP=1 R401_PIXEL_TOL_PX=40 R401_START_TOL_DEG=25 N=16 PLACES="5 4" ./so101/check_401/session_401.sh

==================================================
  場所5 の 16 回目 (全 16 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

objc[63347]: 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 (0x1065e83a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1570483a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[63347]: 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 (0x1065e83f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1570483f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所5: ブロック 画素 [418.6, 160.6]・向き -30.9°・目印から 12.6 画素
[R401  ] 下げ 0.0 mm (conflict). つかむ所の爪と机 指令 5.26・予想 -3.22・沈み最大 -24.75 mm. 下りる間 固定側 指令 10.29/予想 11.07・動く爪 27.36/24.78 mm. 持ち上げの始めの予想 -5.92 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 55.2, 'arm_box': 33.1, 'arm_base': 199.0, 'arm_block_pad10': 25.1, 'held_table': 68.8, 'held_box': 33.1, 'jaw_table_grasp': 0.0}
[R401  ] 割り振りの面 +0°・爪の傾き 19.0° のまま
[R401  ] 送れる
[R401  ] この回は 決まりの外の口を使います: status conflict (--allow-status)
流すなら yes と打つ > yes
objc[63347]: 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 (0x1065e83a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17ff6c778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[63347]: 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 (0x1065e83f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17ff6c7c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 251/251 [00:00<00:00, 3431.22 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_143148 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv

==================================================
  場所4 の 16 回目 (全 16 回): ブロックを 場所4 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

objc[63444]: 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 (0x102f2c3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x12fa6c3a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[63444]: 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 (0x102f2c3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x12fa6c3f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所4: ブロック 画素 [284.8, 249.7]・向き 21.8°・目印から 10.6 画素
[R401  ] 下げ -3.08 mm (ok). つかむ所の爪と机 指令 0.61・予想 -1.97・沈み最大 -19.79 mm. 下りる間 固定側 指令 11.16/予想 10.01・動く爪 29.89/29.55 mm. 持ち上げの始めの予想 -7.34 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 53.7, 'arm_box': 33.1, 'arm_base': 112.5, 'arm_block_pad10': 27.8, 'held_table': 70.5, 'held_box': 33.7, 'jaw_table_grasp': 0.6}
[R401  ] 面を選び直した: 割り振りの面 +0°・爪の傾き 31.0° で 作れない (rule_351 の道が作れない: つかむ所 (向き +21.8°): 爪の面を机に垂直にできない (爪の面の傾き -11.0°・許し ±8°)) → 面 +0°・爪の傾き 19.0°・爪の面の傾き -7.54°・手首の回り 16.63°
[R401  ] 送れる
objc[63444]: 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 (0x102f2c3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17c24c778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[63444]: 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 (0x102f2c3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17c24c7c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 251/251 [00:00<00:00, 3535.66 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_143227 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv

==================================================
  済み: 場所5 16 回  場所4 16 回  
==================================================
(base) shimazueiichi@shimadzueiichinoMacBook-Pro r2r2r-scripts %
```


## 依頼405 ― 切り替え方式に、挟めたかの判定とコードのやり直しを足す

### 依頼405 の依頼文

```markdown
---
作業フォルダ: /Users/shimazueiichi/r2r2r-scripts
上限時間: 150
---
# 依頼405：SO-101 の切り替え方式（コード → π0.5 → コード）に、握れたかの判定と、外したときのコードのやり直しを足す（実装・アームなしの通し・codex のレビューまで。アームは動かさない）

## なぜ
2026-11-30 23:16 にエイイチが決めた：π0.5 が受け持つのは「寄せて下りて閉じる」まで。**閉じた直後にコードへ戻す。** 握れたかはコードが判定し、外したらコードが上へ戻して π0.5 に渡し直す。持ち上げ・箱へ運ぶ・戻るはコード。
理由：so101g（成功 50 本＋つかみ直し 14 本）は、外したあと上がる動きをモデルに教えたため、同じ場面（ブロックの上で爪が開いている）に正しい動きが 2 つでき、0.5 秒ごとに上下を切り替える動きになった（so101g の失敗の回：肘の向きが逆になる回数 1 分に約 35 回・so101f は約 17 回。閉じる回数は 18 → 11 回）。やり直しをコードが受け持てば、モデルが覚える動きは 1 つで済む。

## 土台（変えない・重ねて使う）
- `run_so101_policy.py` の `--handover-above-mm`・`--handover-plan`（依頼392・394）、`--first-chunk-only`（依頼395・396）、`check_392/handover_392.py`、`check_395/first_chunk_395.py`
- 爪の読み：空で閉じると約 4、挟むと約 11（依頼379）。閉じて 20 コマ後に 7 以上なら挟んだ・5 未満なら空（依頼376）
- 電流：`--currents`（今は off で流している）。爪のサーボの電流を判定に使えるか、読む速さが 30 コマ／秒を落とさないかを先に確かめる（LOG570 の決め）
- 持ち上げから先のコードの道：`ideal_var/`（rule_351 の道の LIFT 以降。依頼380 で「持ち上げから先は同じ」を確かめた形）

- **2026-12-01 07:32 の決め（依頼401 に入っている）**：つかみ方は案C（開き 59・固定側を 12 mm 離して下りる・つかむ所を下げる）、シムの腕の動きは依頼400 の dir_s、つかみ直しのお手本（recover_v1）は次の学習から外す。渡す姿勢と爪の開きは、依頼401 で作る `so101/ideal_var/rule_401.py` に合わせる（rule_351 の値を決め打ちしない）。コードの道で流す所は、依頼401 の `run_rule401.py` と同じ読み方・同じ台帳の書き方にそろえる

- **2026-12-01 午前〜10:53 の決め・結果（この依頼の前提）**
  - rule_401 をコードだけで実機に流し、場所2〜5 で 56 回すべて成功（依頼401 の `so101/check_401/run_rule401.py`）。コードの道で流す所（持ち上げから先・空のあと真上へ戻る所）は、この `run_rule401.py` と同じ道の作り方・同じ送り方・同じ止め方・同じ台帳の書き方にそろえる
  - **渡す所までのコードの道（HOME → ブロックの上）も rule_401 の道にする**（依頼392 の `--handover-plan` は rule_351 の面・ブロックの上の姿勢。rule_401 はブロックの上を固定側から離す向きへ寄せ、爪を 59 に開く）。割り振りは plan_401.json。依頼404 の `--reselect-face`（面の選び直し）が入っていれば、同じ選び方を使う
  - π0.5 は so101h（依頼403。今日の 56 回の「ブロックの上 → 閉じる」だけを切り出したお手本で学び直し。閉じたあとは、閉じたままその場で止まる答えを出すはず）。so101f・g でも動く形は残す
  - その回だけガードの値を変える口（R401_PUSH_LIMIT_MM など）は run_rule401.py と同じ名前で効くようにする。新しい確認・停止の条件は、この依頼に書いたもののほかは足さない
  - codex のレビューは 1 回だけ。必須だけ直し、頼み直しはしない（2026-12-01 エイイチ：レビューを重ねない）

## 作るもの（新しいオプション。付けないときの出力は今と同じ）
1. **閉じたことを見つける**：π0.5 の区間で、爪の指令が開き → 閉じに変わり、爪の読みが落ち着いたら（何コマ・どの幅で落ち着いたとするかは記録から決める）、その場で π0.5 の答えを使うのをやめる
2. **握れたかの判定**：爪の読み（と、使えるなら電流）で「挟んだ／空／あいまい」の 3 つ。境目は so101f の 30 回・so101g の 7 回・お手本 64 本の記録から決め、記録に当てて取り違えの数を出す。あいまいは空として扱う
3. **挟んだとき**：そこからコードの道で 持ち上げ → 箱の上 → 離す → 戻る。持ち上げの途中でもう一度爪を見て、落としていたら止めて「落とした」と記録する（自動では拾い直さない）
4. **空のとき**：コードが爪を開き、真上（渡す所の高さ）へ戻る。机のカメラでブロックの位置を読み直し（腕で隠れていたら、戻ってから読む）、渡す所を作り直して π0.5 に渡し直す。**やり直しは最大 2 回**。2 回外したら止めて失敗として記録する
   - 渡し直す所を固定側の爪から離す向きへ寄せるかどうかは、オプションにする（既定は寄せない。寄せる量は依頼399 の結果でエイイチが決める）
   - ブロックが読めない・校正の点の囲みの外・道が作れないときは、やり直さずに止める
5. **π0.5 の区間の長さの上限**：渡してから閉じるまでが長すぎる回（上限の秒は記録から案を出す）は、コードが止めて「閉じなかった」と記録する。上下を繰り返して終わらない回を切るため
6. **答えの流し方**：π0.5 の区間で、1 回の答えを最後のコマまで流し切る形（途中で次の答えに切り替えない）を選べるようにする。今の形（0.5 秒ごとに切り替え）と実機で比べるため。手首カメラの絵を黒くして渡す形も、確かめ用のオプションとして足す
7. **台帳・記録**：やり直しの回数、回ごとの判定（挟んだ／空／あいまい・爪の読み・電流）、閉じた所の爪の間の点、π0.5 の区間のコマ数、どこで止めたか。既存の列は変えず、最後に足す

## 確かめ（アームなし）
- 偽のサーバーと偽の関節で通す：1 回で挟む／1 回外して 2 回目で挟む／2 回外して止まる／閉じない（上限で止まる）／持ち上げで落とす／ブロックが読めない
- 既存のテストが全部通ること、付けないときの出力が今とバイトごと同じこと
- 判定の境目を記録（so101f 30 回・so101g 7 回・お手本 64 本）に当てた取り違えの表

## codex のレビュー
依頼394・396 と同じ形（読むだけ）。見てほしい点：コードが π0.5 から引き継ぐ瞬間の急な動き、空のあと真上へ戻る道で腕・爪がブロック・箱・机に当たる所、やり直しが止まらなくなる道筋、判定の取り違え（挟んでいるのに開く・空なのに運ぶ）。必須／推奨／据え置きに分け、必須だけ直す

## しないこと
アームを動かす（`--execute` で流さない）、Pod を借りる、既にあるオプションの動き・既存の台帳の行・`rule_351.py` を変える、依頼399・400 のファイルに触る、やり直しの動きをお手本にする、`git add .`・`git clean`

## 報告（`so101/check_405/REPORT.md`）
- いちばん大事なこと：判定の境目と取り違えの数、やり直しの道、止まる条件
- 偽のサーバーの通しの表、テストの件数、commit
- codex の指摘の表（必須／推奨／据え置き・直したもの）
- 実機の試しの手順の案（1 回分の流れ・エイイチがすること・どこで止まるか）
- 決めてほしいこと
- 最後の1行に「判定：合格／止めた（決めてほしいことあり）／失敗」
```

### 依頼405 の報告（見張り係の記録）

```markdown
# 結果：20261201_405_SO101の切り替え方式に握れたかの判定とコードのやり直しを足す

- 状態：完了
- 始めた時刻：2026-12-01 13:27
- 終わった時刻：2026-12-01 14:42（75分）
- 作業フォルダ：/Users/shimazueiichi/r2r2r-scripts
- この続きを Claude Code で話すとき：作業フォルダで `claude --resume cb74061f-8686-4a58-8784-a57970343a77`

## Claude Code の報告

**やったこと**

アームは動かしていません（`--execute` では流していません）。Pod も借りていません。

- `run_so101_policy.py` に `--switch-405` を足しました。付けたときだけ `check_405/switch_405.py` に処理を渡します。付けないときの動きは今と同じです。
- 流れは次のとおりです。
  1. `run_rule401.py` と同じ読み方・ガード・環境変数で rule_401 の道を作り、渡す所まで動かす
  2. π0.5 の区間は今の `run_trial` をそのまま使い、爪の指令が 20 を割ったコマでコードが引き継ぐ
  3. コードは関節をそのまま止め、爪を閉じ切ってから判定する
  4. 挟んだときは、持ち上げ → 箱 → 離す → HOME と送る。持ち上げで落としていたら止める
  5. 空のときは、開いて真上へ戻り、読み直して渡し直す（2 回まで）
- 足したオプション：π0.5 の区間の上限（既定 8 秒）、答えを流し切る形、手首の絵を黒くする形、渡し直す姿勢を寄せる量（既定 0）。台帳は行の最後に 22 列を足しました。
- codex のレビューは 1 回だけ頼みました。

**結果**

- **判定の境目**：落ち着いた読みが 9〜12 なら挟んだ、5 未満なら空、それ以外はあいまい（空として扱う）です。
  - 記録 241 回に当てた取り違えは、挟んだのに開く 1 / 139、空なのに運ぶ 1 / 101 です。
  - 2 回とも、判定のあとに π0.5 が爪を開き直した回でした。
  - 記録はどれも「コードが関節を止めて 5 コマで閉じ切る」形ではありません。この形での読みは実機で初めて分かります。
- **新しく分かった危ないこと**：依頼の順（下で爪を開いてから上がる）では、動く爪がブロックを押す形が多いです。
  - シムで外し方 56 通りを試すと、ガードを通ったのは 3 通りだけでした。
  - 閉じたまま上がってから上で開く形なら 39 通り通ります。
  - 既定は依頼の形のままにし、上がってから開く形は `--retry-rise-first` で選べるようにしました。
- **止まる条件**：π0.5 の区間 8 秒（時計で測り、一時停止の間は数えない）、推論の答えが 10 秒返らない、2 回外した、持ち上げで落とした、読めない・道が作れない、スペース・q、追従の差 10°。
- **偽のサーバーの通し**：18 場面すべて期待どおりでした（1 回で挟む／外して 2 回目で挟む／2 回外して止まる／閉じない／持ち上げで落とす／q／ブロックが読めない、場所 2〜5）。
- **テスト**：新しく足した 18 件と、既存の 89・12・13・13・10・31・64・13・9・32 件がすべて通りました。付けないときの出力が 927d01d とバイトごと同じかを見るテストも通っています。
  - handover_392 は、まとめて流した 1 回目だけ 1 件エラーになりました。
  - 単独で 1 回、同じ順で 1 回流し直すと 12 件とも通りました。エラーの中身は取れておらず、原因は分かっていません。
- **codex**：必須 4 件のうち 3 件を直しました（空のあとの道で腕と机・ブロックをガードに入れる、π0.5 の上限を実時間にする、π0.5 の区間の q で止める）。
  - 残る 1 件（あいまいなら開かずに止める）は依頼の決めと食い違うので、直していません。
  - 推奨 3 件は据え置きです。codex は「直したあとをもう一度見るまで流さないで」と書いています。
- commit は 7f97287 と 95ea79f です。

**変えたファイル**

- `so101/run_so101_policy.py`
- `so101/check_405/` の下（新しいファイルだけ）：`switch_405.py`・`analyze_405.py`・`open_order_405.py`・`fake_run_405.py`・`test_switch_405.py`・`session_405.sh`・`REPORT.md`、結果の `judge_405`・`open_order_405`・`fake_run_405`（それぞれ md と json）、`review_request_405.md`・`review_r1.txt`・`review_r1_raw.txt`

**決めてほしいこと**

1. 空のあとの順：依頼の形（下で開く。多くの回でやり直さずに止まる）にするか、上がってから開く形にするか。後者は、あいまいで本当は挟んでいた回だと 50 mm の高さからブロックを落とします。
2. あいまいの扱い：依頼どおり開いてやり直すか、codex の言うとおり開かずに止めるか。
3. 挟んだの幅を 9〜12 にしたこと（依頼 376 は 7 以上）。
4. 引き継ぐ時：爪の指令が 20 を割ったコマで引き継ぎ、閉じ切ってから判定する形にしました。依頼の「読みが落ち着いたら π0.5 をやめる」より前です。この形でよいか。
5. 電流：記録が 1 つもない（120 回すべて off）ので判定には使っていません。実機で読む速さと、挟んだ／空の差を測るか。
6. 持ち上げの確かめを、真上 80 mm に上がり切った所の 1 回にしたこと。
7. 「やり直しは最大 2 回。2 回外したら止める」を「π0.5 に渡すのは 2 回まで（やり直しは 1 回）」と読みました。これでよいか。
8. π0.5 の区間の上限 8 秒。記録では成功の回が閉じるまで 2.2〜5.9 秒でした。
9. 読み直したブロックが目印から 10 画素より離れている（押された）ときは、やり直さずに止めています。広げるか。
10. 押し付けのガード（既定 −6 mm）：この区間は π0.5 が受け持つが、run_rule401 と同じガードとして当てたままにしています。既定のままだと場所 2・4・5 は止まります（今日の実機は −12）。
11. 実機の前に、直したあとをもう一度 codex にレビューしてもらうか。

報告の全文は `so101/check_405/REPORT.md` にあります。

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

### so101/check_405/REPORT.md

````markdown
# 依頼 405：SO-101 の切り替え方式（コード → π0.5 → コード）に、握れたかの判定と、外したときのコードのやり直しを足した（2026-12-01）

アームは動かしていない（`--execute` で流していない）。Pod は借りていない。`rule_351.py`・依頼 399/400 のファイル・既存の台帳の行・データセットは変えていない（KIOXIA は読むだけ。偽の通しの記録・台帳は `/tmp/r405_dry/` だけに書いた）。既にあるオプションの動きは変えていない（`run_so101_policy.py` には `--switch-405` とその口を足し、付けたときだけ `check_405/switch_405.py` へ渡す）。やり直しの動きはお手本にしていない。

## いちばん大事なこと

### 1. 判定の境目と取り違えの数
- **境目：爪の読みが落ち着いたら（判定を始めて 3 コマ目以降に、続けて 4 コマの読みの幅が 0.5 以下）、9〜12 = 挟んだ／5 未満 = 空／それ以外・30 コマで落ち着かない = あいまい（空として扱う）**
  - 記録の「本当の答え」（閉じたあと 指令が 5 未満のまま 10 コマ以上続いた区間の 最後の 5 コマの読み）は、**挟んだ 139 回が 10.09〜10.84、空 101 回が 0.88〜4.81**。間はほぼ空いている（中途 1 回 6.78）。依頼 376 の「7 以上」より狭い 9〜12 にした（挟んだは 1 回も落ちず、空なのに 7.05 で落ち着いた 1 回が「挟んだ」から外れる）
- **取り違え（記録に当てた数。判定は コードが引き継ぐコマ＝指令が 20 を割ったコマから）**：

| 記録 | 本当の答えのある閉じ | 挟んだのに 空・あいまい（→ 開く） | 空なのに 挟んだ（→ 運ぶ） |
|---|---|---|---|
| so101f 実機 30 回 | 117 | 1 / 17 | 0 / 99（あいまい 22・空 77） |
| so101g 実機 7 回 | 4 | 0 / 2 | 1 / 2 |
| お手本 success 50 本 | 50 | 0 / 50 | — |
| お手本 recover 14 本 | 14 | 0 / 14 | — |
| 参考: code_rule401 実機 56 回 | 56 | 0 / 56 | — |
| **合計** | **241** | **1 / 139** | **1 / 101**（中途 1 回は空） |

  - 取り違えた 2 回は、どちらも **判定のあとに π0.5 が爪を開き直した回**（so101f 105255 の 493 コマ目：閉じた 2 コマ後に指令が 34 へ戻り、読みが落ち着かずあいまい。so101g 222805 の 315 コマ目：読みが 10.64 で 4 コマ落ち着いたあと π0.5 が開き、あとの区間では空）。切り替え方式ではコードが閉じたまま待つので、この形は起きない
  - 比べ：依頼 376 の「20 コマ後の読みだけ」で分けると 挟んだのに開く 4・空なのに運ぶ 1
  - 落ち着くまで：中央値 17・90% 23・最大 31 コマ（記録はモデル・お手本の指令がゆっくり閉じるため。偽の通しでは コードが 5 コマで閉じて 挟んだ 12 コマ・空 24 コマ）
  - **限り（codex の指摘のとおり）**：記録はどれも「コードが関節を止めて 5 コマで閉じ切る」形ではない。この形での読みは実機で初めて分かる
- 持ち上げの確かめ：挟んだ閉じの 20〜60 コマ後の読みの最小は 10.09〜10.84（成功の回すべて）。同じ 9〜12 を LIFT のコマ（真上 80 mm に上がり切った所）で 1 回当てる
- **電流は判定に使っていない**：台帳の 120 回はどれも `--currents off` で、爪の電流の記録が 1 つもない。読む速さが 30 コマ／秒を落とさないかもアームなしでは測れない。`--currents lift_grip` を付ければ 判定のときの爪の電流（中央値）を台帳の `sw_grip_currents` に残す形だけ入れた（決めてほしいこと 5）

### 2. やり直しの道
- **空・あいまい → 爪を閉じる前の開き（直前 15 コマの指令の最大）に開く（10 コマ）→ 真上へ 渡す所の高さまで（Shifter。解けなければ持ち上げと同じ lift_pose）→ 2 回目ならここで止める → 机のカメラで読み直す**
  - 戻った所で読めた（赤の面積が 1 回目の 85% 以上）・道が作れた・寄せる道（24 コマ）がシムを通る → そのまま新しい渡す所へ
  - 隠れた・読めない・道が作れない・ガードに当たる → 前の渡す姿勢 → 来たコードの道を逆に HOME → HOME で読む → 1 回目と同じ道で渡す所へ
  - `--retry-shift-mm X`（既定 0）：渡し直す姿勢を固定側の爪から離す向きへさらに寄せる（寄せた道も clear_345 で確かめる）
- **新しく分かった危ないこと：依頼の順（下で爪を開いてから上がる）は、下で開くと動く爪がブロックへ入る形が多い**（`open_order_405.md`。場所2〜5・外し方 14 通り）
  - ガードを通ったのは **開いてから上がる 3 / 56、閉じたまま上がってから上で開く 39 / 56**。下で開くと 動く爪とシムのブロックの距離が −2〜−18 mm（ブロックを押す）。通ったのは「手前 20 mm」だけ
  - 既定は依頼の形のまま（ガードで止める → やり直さずに止める）。上がってから開く形は `--retry-rise-first` で選べるようにした（決めてほしいこと 1）
- 挟んだ → 今の姿勢から rule_351 の LIFT 以降と同じ形の道（真上 80 mm → 箱の上の真上 → 箱の上 → 離す → HOME。コマ数・爪の値も同じ）。ガード（1 コマ・道を作る範囲・運ぶ高さ 50 mm・シム）を当てて送る

### 3. 止まる条件（どこで止まるか）
| 止まる所 | 台帳の sw_status | 結果 |
|---|---|---|
| 始めに読めない・目印から 10 画素・向き ±8°・道が作れない・ガード・渡す姿勢が推論の安全範囲の外 | （書かない。終了コード 3） | — |
| π0.5 が 8 秒たっても閉じない（`--policy-max-s`。時計で測る。一時停止・手直しの間は数えない） | not_closed | 失敗 6（自動） |
| 推論の答えが 10 秒で返らない | （例外として その場で止める） | 聞かない |
| 2 回外した | missed_max | 失敗 2（自動） |
| 持ち上げ（LIFT）で読みが 9〜12 の外 | dropped | 失敗 3（自動） |
| HOME で読んでも読めない・道が作れない・空のあとの道がガードに当たる | retry_refused | 失敗 2（自動） |
| 持ち上げの道が作れない・ガードに当たる | lift_refused | 聞かない |
| スペース・q（コードの区間・π0.5 の区間）・追従の差 10° | stopped / policy_quit | 聞かない |
| 挟んで HOME まで送り終えた | carried | y / n を聞く |

- 渡すのは最大 2 回（`MAX_ATTEMPTS`）。π0.5 の区間は 8 秒、判定は 31 コマまで。止めたらどの道も次へ進まない
- **コードが π0.5 から引き継ぐのは、爪の指令が 25 以上のあと 20 を割ったコマ**（そのコマは送ったあと）。関節 5 つは最後に送った値のまま・爪は 5 コマで 0.74 へ。指令の跳びはない

## 1. 作ったもの

### 入口（`run_so101_policy.py`。付けないときは今と同じ）
```
--switch-405                 切り替え方式 (check_405/switch_405.py)
--policy-max-s X             π0.5 の区間の上限 (秒. 既定 8. 1〜60)
--chunk-full                 1 回の答えを最後のコマまで流し切ってから次を問い合わせる (run_trial の --no-prefetch・答えの全部のコマ)
--black-wrist                推論に渡す手首カメラの絵を黒くする (確かめ用. 記録の絵は本物)
--retry-shift-mm X           渡し直す姿勢を固定側の爪から離す向きへ X mm (既定 0. 0〜20)
--retry-rise-first           空のあと 閉じたまま上がってから上で開く (既定は依頼の形: 下で開いてから上がる)
--allow-status / --reselect-face / --place1-candidate     run_rule401.py と同じ
```
- `--switch-405` は `--handover-above-mm`・`--first-chunk-only`・`--rtc`・`--warmup` と一緒に使えない。口だけを `--switch-405` なしで付けると止まる
- 渡す所までの道・読み方・ガード・環境変数（R401_PUSH_LIMIT_MM・R401_PUSH_WINDOW_MM・R401_PIXEL_TOL_PX・R401_YAW_TOL_DEG・R401_START_TOL_DEG）は `run_rule401.prepare`・`Runner.run` をそのまま使う（同じ名前で効く）
- π0.5 の区間は `run_trial` をそのまま呼ぶ（安全範囲・`--max-step-deg`・`--blend`・`--exec-steps`・先に問い合わせる）。記録の口 `_Watch` で閉じた・長すぎるを見て抜ける
- 後始末（Ctrl-C・例外のあと止める目標を送る・結果を聞く・記録を閉じる・KIOXIA の確かめ）は `run_rule401.execute` と同じ順

### 台帳・記録
- 台帳：その試行だけ `TRIAL_COLUMNS + SWITCH_COLUMNS`（行の最後に 22 列を足す。既存の列は変えない）：`sw_status`・`sw_attempts`・`sw_retries`・`sw_judges`（回ごと `held|empty`）・`sw_grip_reads`・`sw_grip_currents`・`sw_judge_frames`・`sw_close_points`（閉じた所の爪の間の点。ブロックに対して 右,奥,高さ mm。依頼 376 の lib_376）・`sw_policy_frames`・`sw_stop_where`・`sw_stop_why`・`sw_frames_code`・`sw_frames_wait`・`sw_block_u/v/yaw_deg`・`sw_chunk_full`・`sw_black_wrist`・`sw_retry_shift_mm`・`sw_policy_max_s`・`sw_plan_file`・`sw_rise_first`
- 記録（LeRobot）：コードの区間は `ptm.mode` 3、渡す所の待ちは 4、π0.5 は 0（今までと同じ値）
- 試行のフォルダの `switch405_plan.json`：回ごとの判定（読みの列・落ち着いたか・電流）・π0.5 の区間の秒とコマ・最初の答え・空のあとの道とシムの距離・読み直し・持ち上げの道・区間ごとの始めのコマ

### ファイル（`so101/check_405/`）
| ファイル | 中身 |
|---|---|
| `switch_405.py` | 1 試行の流れ・判定・コードの道・ガード・台帳 |
| `analyze_405.py` → `judge_405.md`・`judge_405.json` | 判定の境目と取り違え（記録から） |
| `open_order_405.py` → `open_order_405.md`・`.json` | 空のあとの道の順を 外し方ごとにシムで比べた |
| `fake_run_405.py` → `fake_run_405.md`・`.json` | 偽のアーム・偽のサーバーの通し |
| `test_switch_405.py` | テスト 18 件 |
| `session_405.sh` | 実機の案内（流していない） |
| `review_request_405.md`・`review_r1.txt`（生の出力 `review_r1_raw.txt`） | codex のレビュー |

## 2. アームなしの通し（`fake_run_405.py`）

rule_401 の道・ガード・シム・`run_trial`・記録（LeRobot）・台帳は本物。偽はアーム（送った値に 腕の動きの予想 dir_s の関節ごとの遅れを当てる・挟む閉じでは読みが 10.6 で止まる・落とす場面では閉じて 20 コマから抜ける）、サーバー（つかむ所へ 1 コマ 1.5° で寄せて爪を 0 へ。外す閉じは つかむ所から指定の向きへずらした所）、読み、時計。推論の安全範囲は so101h の学習データ（56 本 ±10）。

### 場所3
| 場面 | 結果 | 判定（読み・コマ） | π0.5 のコマ | 道 | 止めた所 |
|---|---|---|---|---|---|
| 1 回で挟む | carried ○ | 挟んだ（10.6・12） | 13 | — | — |
| 1 回外して（奥 15 mm）2 回目で挟む・依頼の形（下で開く） | retry_refused ○ | 空（1.3・24） | 10 | — | 空のあとの道がガードに当たる（腕とブロック −9.3 mm） |
| 1 回外して（奥 15 mm）2 回目で挟む・上がってから開く（戻った所で隠れた → HOME で読む） | carried ○ | 空 → 挟んだ | 10・13 | HOME | — |
| 2 回外して止まる・上がってから開く（戻った所で読めた → そのまま渡し直す） | missed_max ○ | 空・空 | 10・10 | そのまま | 2 回外した |
| 閉じない（上限 3 秒にして） | not_closed ○ | — | 92 | — | 3 秒たっても閉じない |
| 持ち上げで落とす | dropped ○ | 挟んだ（10.6） | 13 | — | LIFT で読み 0.7 |
| π0.5 の区間で q | policy_quit ○ | — | 19 | — | q で止めた |
| 外したあと ブロックが読めない・上がってから開く | retry_refused ○ | 空 | 10 | — | HOME で読めない |
| 始めに ブロックが読めない | refused ○（終了コード 3・台帳に書かない） | — | — | — | — |

### 場所2・4・5（今日の実機と同じガードの値：R401_PUSH_LIMIT_MM・R401_PUSH_WINDOW_MM = −12・conflict を許す）
| 場所 | 1 回で挟む | 外して（手前 20 mm）2 回目・下で開く | 外して（左 15 mm）2 回目・上がってから開く |
|---|---|---|---|
| 2 | carried | retry_refused（腕とブロック −0.1 → −2.7 mm。境目の形） | carried |
| 4 | carried | carried | carried |
| 5 | carried | carried | carried |

- 持ち上げの道のシムの距離（mm）：爪と机 0.9〜3.4・持ったブロックと箱 33.6〜35.3・持ったブロックと机 70.2〜71.8・腕と箱 33.1・腕と机 73.3（場所2〜5）
- 18 場面とも期待どおり。台帳 `/tmp/r405_dry/log/so101_trials.csv` に 17 行（動かさなかった 1 回は書かない）。自動の失敗は 落とした = 3・2 回外した = 2・閉じなかった = 6・やり直せない = 2

## 3. テスト・commit
| テスト | 件数 |
|---|---|
| `so101/check_405/test_switch_405.py`（判定 6・引き継ぎの口 4・推論の口 2・引数と列 4・道 2） | 18 OK |
| `so101/test_run_so101_policy.py` | 89 OK |
| `so101/check_392/test_handover_392.py`（付けないときが 927d01d とバイトごと同じ を含む） | 12 OK（まとめて流した 1 回目だけ エラー 1。単独で 1 回・同じ順で 1 回流し直して 12 件とも OK。エラーの中身は取れておらず 原因は分からない） |
| `so101/check_394/test_handover_394.py` | 13 OK |
| `so101/check_395/test_first_chunk_395.py` | 13 OK |
| `so101/check_396/test_return_track_396.py` | 10 OK |
| `so101/check_401/test_run_rule401.py` | 31 OK |
| `so101/test_lerobot_safe_259.py` | 64 OK |
| `so101/ideal_var/test_ideal_var_314.py` | 13 OK |
| `pi05/test_so101_rtc.py` | 9 OK |
| `pi05/test_so101_train.py` | 32 OK（8 件 skip。前から） |

commit：7f97287（このファイルの commit の値だけ 次の commit で書き足した）

## 4. codex のレビュー（1 回だけ。`codex exec -s read-only -m gpt-6.1-terra`。読むだけ）

| 分け | 指摘 | どうしたか |
|---|---|---|
| 必須 1 | あいまいでも爪を開く → 挟んでいるのに落とし得る（記録で 1 回）。あいまいは開かずに止めるべき | **直していない**。依頼の決め「あいまいは空として扱う」と食い違うため（決めてほしいこと 2） |
| 必須 2 | 空のあと開いて上がる道で 腕と机・腕とブロックが止める条件に入っていない | **直した**。開く区間は 爪と机 −11 mm（rule の GRASP_OPEN と同じ）、上がる区間は 腕と机が開いた所より 0.5 mm を超えて近づかない、腕とブロックは閉じた所より 0.5 mm を超えて近づかない（閉じた所で 3 mm より重なっていたら ブロックの位置が分からないので送らない）。**この直しで 依頼の順（下で開く）は外し方 56 通りのうち 3 通りしか通らないことが分かった**（上の 2） |
| 必須 3 | `--policy-max-s` がコマ数で 実時間でない。推論が返らないとキーも見られない | **直した**。時計で測る（一時停止・手直しの間は数えない）。推論の口で 10 秒返らなければ 例外として止める |
| 必須 4 | π0.5 の区間の q で その場で止める目標を送っていない | **直した**（`hold_here`） |
| 推奨 | LIFT で 1 回だけの確かめでは 持ち上げ途中の動きを防げない・確かめのあとに落ちても分からない | 据え置き（依頼は「持ち上げの途中でもう一度」。決めてほしいこと 6） |
| 推奨 | HOME へ戻る逆の道を 今のブロックの位置で確かめていない | 据え置き（寄せる区間だけ確かめている。逆の道は 1 回目に全区間を確かめた道） |
| 推奨 | 判定の間に関節の追従の差を見ていない | 据え置き |
| 据え置き | 引き継ぐ瞬間の指令の跳びはない／やり直しは 2 回で止まる | — |

codex の最後の 1 行：「必須を直し、直した道と止まる条件を再レビューできるまでは まだ流さないでください」。**頼み直しはしていない**（依頼のとおり 1 回だけ）。必須 1 は直していないので、実機の前に決めてほしい。

## 5. 実機の試しの手順の案（エイイチの確かめのあと。まだ流していない）
1. 決めてほしいこと 1・2（空のあとの順・あいまいの扱い）を決める
2. 別の窓でサーバー：`./lab_start.sh --model so101h --log so101_Log12 --serve-only`
3. アームなしでもう一度：`SO101_VAR_ROLL_RANGE=-67,58 $P so101/check_405/fake_run_405.py`（18 場面 ○ を見る）
4. 1 回目（場所3・今のガードで通る）：`SW405_RISE_FIRST=1 ./so101/check_405/session_405.sh --first`（順を「上がってから開く」に決めた場合。依頼の形のままなら `SW405_RISE_FIRST` を付けない）
   - エイイチがすること：場所3 の目印にまっすぐ置く → Enter → 腕が HOME からブロックの上へ（2.3 秒）→ 2〜8 コマ止まる → π0.5 が下りて閉じる → **閉じた所で腕が止まり 爪が閉じ切る（0.3〜1 秒）** → 「n 回目の判定: held / empty」と出る
   - 挟んだ：持ち上げ → 箱 → 離す → HOME（約 4.4 秒）→ y / n を打つ
   - 空：開いて上がる（または上がってから開く）→ 読み直し → 渡し直し（2 回目）。2 回目も空なら上で止まる（失敗として自動で書く）
   - どこで止まるか：閉じない 8 秒・LIFT で落とした・HOME で読めない・追従の差 10°・スペース / q
   - おかしければスペース（その場で止める）。止めたあとは閉じるときに入口が休みの姿勢を確かめる（幅の外ならリーダーで戻す）
5. 記録を見る：台帳の `sw_*` 列・試行のフォルダの `switch405_plan.json`（判定の読みの列 `reads`・落ち着いたコマ）。**この形（関節を止めて 5 コマで閉じ切る）での読みは初めてなので、挟んだ 9〜12・空 5 未満が実機でも分かれるかを最初の数回で見る**
6. 続き：`PLACES="2 3 4 5" R401_PUSH_LIMIT_MM=-12 R401_PUSH_WINDOW_MM=-12 R401_ALLOW_CONFLICT=1 ./so101/check_405/session_405.sh`（今日の rule401 の実機と同じガードの値。場所2・4 は毎回 yes）
7. 答えの流し方の比べ（依頼 6）は `SW405_CHUNK_FULL=1` を付けた回と付けない回を同じ場所で。手首を黒くする確かめは `SW405_BLACK_WRIST=1`

## 決めてほしいこと
1. **空のあとの順**：依頼の形（下で開いてから上がる）は シムでは動く爪がブロックを押す形が多く、ガードで止まる（外し方 56 通りのうち通るのは 3）。(a) 依頼の形のまま（多くの回で やり直さずに止まる）／(b) `--retry-rise-first`（閉じたまま上がってから上で開く。39 / 56 通る。ただし あいまいで本当は挟んでいた回は ブロックを 50 mm の高さから落とす）／(c) 開く量を減らす・下で開くのをやめて少し上がってから開く など別の形
2. **あいまいの扱い**：依頼どおり「空として扱う（開いてやり直す）」にした。codex は「挟んでいるのに開く」を避けるため あいまいは開かずに止めるべきと言っている（必須 1）。記録では 挟んだ 139 回のうち 1 回があいまい（判定のあとに π0.5 が開き直した回）
3. **挟んだの幅 9〜12**（記録の挟んだは 10.09〜10.84）。依頼 376 の「7 以上」より狭い。斜めに挟んだ（読みが 12〜16 くらい）回は あいまい → 開く
4. **引き継ぐ時**：爪の指令が 20 を割ったコマで π0.5 をやめ、コードが関節を止めて閉じ切ってから判定する形にした（依頼の「読みが落ち着いたら π0.5 をやめる」より前で引き継ぐ。落ち着くまで π0.5 に任せると その間に上下に動くため）。この形でよいか
5. **電流**：記録がない（120 回すべて off）ので判定に使っていない。`--currents lift_grip` で判定のときの爪の電流を台帳に残せる。実機で 読む速さ（30 コマ／秒を保つか）と 挟んだ／空の差を測るかどうか
6. **持ち上げの確かめ**：LIFT（真上 80 mm に上がり切った所）で 1 回だけ。途中（例えば 40 mm）にするか・運ぶ間も見るか
7. **やり直しの回数**：「やり直しは最大 2 回。2 回外したら止める」を「π0.5 に渡すのは 2 回まで（やり直しは 1 回）」と読んだ。π0.5 に 3 回渡す（2 回やり直す）意味なら `MAX_ATTEMPTS` を 3 にする
8. **π0.5 の区間の上限 8 秒**（記録：so101f・g でブロックの上の高さに来てから最初に閉じるまで 成功の回は 2.2〜5.9 秒・中央値 3.7 秒・最大 11.3 秒）
9. **読み直したブロックが目印から 10 画素より離れている（押された）とき**は やり直さずに止める（run_rule401 と同じ画素の許し）。押されたブロックでもやり直すなら R401_PIXEL_TOL_PX を広げる
10. **押し付けのガード（R401_PUSH_LIMIT_MM・PUSH_WINDOW_MM）**は rule_401 の道のつかむ所・持ち上げの始めの予想に当たる値で、切り替え方式ではその区間を π0.5 が受け持つ。run_rule401 と同じガードとして当てたまま（既定 −6 では 場所2・4・5 が止まる。今日の実機は −12）
11. **codex の再レビュー**：必須 2〜4 を直したあとの道はレビューしていない（依頼のとおり 1 回だけ）。実機の前にもう一度頼むか

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

### so101/check_405/judge_405.md

```markdown
# 依頼 405: 握れたかの判定の境目と取り違え (記録から. analyze_405.py が書いた)

判定: 判定を始めて 3 コマ目以降に 続けて 4 コマの爪の読みの幅が 0.5 以下で 落ち着いた とし, その読みが 9.0〜12.0 = 挟んだ / 5.0 未満 = 空 / ほか・30 コマで落ち着かない = あいまい (空として扱う)

## 数えた閉じ

| 記録 | 本・回 | 閉じ (つかむ高さ) | 本当の答えのある閉じ |
|---|---|---|---|
| so101f 実機 30 回 | 30 | 139 | 117 |
| so101g 実機 7 回 | 7 | 35 | 4 |
| お手本 success 50 本 | 50 | 50 | 50 |
| お手本 recover 14 本 | 14 | 28 | 14 |
| 参考: code_rule401 実機 56 回 | 56 | 56 | 56 |

## 本当の答えごとの爪の読み (区間の最後の 5 コマの中央値)

| 答え | 数 | 最小 | 5% | 中央値 | 95% | 最大 |
|---|---|---|---|---|---|---|
| held | 139 | 10.09 | 10.43 | 10.57 | 10.77 | 10.84 |
| empty | 101 | 0.88 | 1.22 | 2.1 | 3.66 | 4.81 |
| partial | 1 | 6.78 | 6.78 | 6.78 | 6.78 | 6.78 |

## 取り違えの表 (a) 指令が 20 を割ったコマから判定 (切り替え方式でコードが受け取るコマ)

| 記録 | 答え | 挟んだ | 空 | あいまい (→空) |
|---|---|---|---|---|
| so101f 実機 30 回 | held | 16 | 0 | 1 |
| so101f 実機 30 回 | empty | 0 | 77 | 22 |
| so101f 実機 30 回 | partial | 0 | 1 | 0 |
| so101g 実機 7 回 | held | 2 | 0 | 0 |
| so101g 実機 7 回 | empty | 1 | 1 | 0 |
| お手本 success 50 本 | held | 50 | 0 | 0 |
| お手本 recover 14 本 | held | 14 | 0 | 0 |
| 参考: code_rule401 実機 56 回 | held | 56 | 0 | 0 |
| **合計** | 挟んだのに 空・あいまい (→ 開く) | | | **1** |
| **合計** | 空・中途なのに 挟んだ (→ 運ぶ) | **1** | | |

落ち着くまでのコマ: 中央値 17・90% 23・最大 31

## 取り違えの表 (b) 指令が 5 を割ったコマから判定

| 記録 | 答え | 挟んだ | 空 | あいまい (→空) |
|---|---|---|---|---|
| so101f 実機 30 回 | held | 16 | 0 | 1 |
| so101f 実機 30 回 | empty | 0 | 78 | 21 |
| so101f 実機 30 回 | partial | 0 | 1 | 0 |
| so101g 実機 7 回 | held | 2 | 0 | 0 |
| so101g 実機 7 回 | empty | 1 | 1 | 0 |
| お手本 success 50 本 | held | 50 | 0 | 0 |
| お手本 recover 14 本 | held | 14 | 0 | 0 |
| 参考: code_rule401 実機 56 回 | held | 56 | 0 | 0 |
| **合計** | 挟んだのに 空・あいまい (→ 開く) | | | **1** |
| **合計** | 空・中途なのに 挟んだ (→ 運ぶ) | **1** | | |

落ち着くまでのコマ: 中央値 14・90% 21・最大 31

## 取り違えの表 比べ: 20 コマ後の読みだけで分ける (依頼 376 の決め方)

| 記録 | 答え | 挟んだ | 空 | あいまい (→空) |
|---|---|---|---|---|
| so101f 実機 30 回 | held | 14 | 0 | 3 |
| so101f 実機 30 回 | empty | 1 | 73 | 25 |
| so101f 実機 30 回 | partial | 0 | 0 | 1 |
| so101g 実機 7 回 | held | 1 | 0 | 1 |
| so101g 実機 7 回 | empty | 0 | 1 | 1 |
| お手本 success 50 本 | held | 50 | 0 | 0 |
| お手本 recover 14 本 | held | 14 | 0 | 0 |
| 参考: code_rule401 実機 56 回 | held | 56 | 0 | 0 |
| **合計** | 挟んだのに 空・あいまい (→ 開く) | | | **4** |
| **合計** | 空・中途なのに 挟んだ (→ 運ぶ) | **1** | | |

## 持ち上げの途中 (挟んだ閉じの 20〜60 コマ後の爪の読みの最小. 成功の回)

| 記録 | 数 | 最小 | 中央値 | 最大 |
|---|---|---|---|---|
| so101f 実機 30 回 | 16 | 10.09 | 10.74 | 10.84 |
| so101g 実機 7 回 | 2 | 10.57 | 10.57 | 10.57 |
| お手本 success 50 本 | 50 | 10.7 | 10.77 | 10.84 |
| お手本 recover 14 本 | 14 | 10.57 | 10.57 | 10.7 |
| 参考: code_rule401 実機 56 回 | 56 | 10.37 | 10.43 | 10.57 |

「持ち上げで落とす」の回 so101_20261130_222805 (so101g) 閉じ 135 コマ目から 5 コマごと: 爪の読み [31.5, 20.7, 6.8, 22.2, 30.6, 31.5, 31.8, 31.3, 31.0, 30.7, 30.8, 32.0, 32.1, 33.1, 33.6, 33.9, 31.0, 15.7] / 指令 [12.6, 1.8, 24.9, 29.9, 31.7, 32.0, 31.1, 30.9, 30.5, 23.7, 32.1, 32.4, 33.2, 33.8, 34.2, 32.3, 18.7, 2.1] / 手先の高さ [-0.4, 0.0, -1.6, -1.9, -2.1, 7.3, 16.1, 22.0, 22.8, 24.6, 21.0, 14.7, 20.2, 25.2, 28.4, 32.4, 31.4, 16.9]

「持ち上げで落とす」の回 so101_20261130_222805 (so101g) 閉じ 215 コマ目から 5 コマごと: 爪の読み [31.0, 15.7, 6.3, 20.9, 30.6, 31.6, 33.0, 33.1, 33.1, 31.8, 31.8, 31.9, 32.9, 33.2, 33.2, 28.5, 31.4, 31.8] / 指令 [18.7, 2.1, 32.5, 32.3, 32.1, 33.1, 33.4, 33.3, 30.1, 31.7, 32.1, 33.6, 33.5, 33.4, 23.3, 31.5, 32.2, 32.0] / 手先の高さ [31.4, 16.9, 11.8, 8.1, 0.9, -1.8, 2.5, 16.9, 30.9, 24.6, 5.4, 5.9, 7.1, 12.9, 12.8, 13.7, 16.7, 21.6]

「持ち上げで落とす」の回 so101_20261130_222805 (so101g) 閉じ 315 コマ目から 5 コマごと: 爪の読み [31.8, 22.2, 10.6, 11.2, 24.7, 31.0, 32.0, 26.4, 8.7, 2.0, 1.2, 6.0, 23.4, 24.3, 9.8, 23.4, 31.1, 32.0] / 指令 [13.7, 1.6, 3.2, 29.3, 31.9, 32.3, 32.4, 0.5, 0.9, 1.0, 1.5, 24.6, 31.4, 9.6, 29.5, 32.5, 32.4, 32.6] / 手先の高さ [-1.4, -0.4, 7.0, 11.1, 10.9, 6.5, 7.0, 9.9, 32.1, 57.0, 56.6, 26.6, 8.9, 11.7, 34.5, 52.2, 57.8, 41.2]

「持ち上げで落とす」の回 so101_20261130_222805 (so101g) 閉じ 346 コマ目から 5 コマごと: 爪の読み [32.1, 23.1, 6.2, 1.8, 1.2, 9.3, 26.3, 20.9, 10.3, 26.6, 31.4, 32.2, 32.5, 34.6, 34.8, 34.8, 34.8, 34.8] / 指令 [0.2, 0.6, 0.9, 1.8, 3.2, 28.5, 1.8, 13.6, 31.2, 32.3, 32.4, 32.7, 35.0, 35.1, 35.2, 34.9, 35.0, 34.9] / 手先の高さ [7.3, 12.1, 37.8, 58.2, 53.2, 19.5, 10.2, 14.0, 40.8, 52.7, 57.0, 37.3, 38.5, 38.7, 47.9, 50.2, 48.8, 47.7]

「持ち上げで落とす」の回 so101_20261130_222805 (so101g) 閉じ 376 コマ目から 5 コマごと: 爪の読み [26.3, 20.9, 10.3, 26.6, 31.4, 32.2, 32.5, 34.6, 34.8, 34.8, 34.8, 34.8, 34.8, 34.4, 34.4, 34.4, 34.4, 34.3] / 指令 [1.8, 13.6, 31.2, 32.3, 32.4, 32.7, 35.0, 35.1, 35.2, 34.9, 35.0, 34.9, 34.2, 34.2, 34.3, 34.2, 34.1, 34.1] / 手先の高さ [10.2, 14.0, 40.8, 52.7, 57.0, 37.3, 38.5, 38.7, 47.9, 50.2, 48.8, 47.7, 49.1, 52.2, 60.8, 62.8, 62.2, 55.9]

「持ち上げで落とす」の回 so101_20261130_222805 (so101g) 閉じ 675 コマ目から 5 コマごと: 爪の読み [30.6, 22.2, 32.6, 34.4, 32.8, 32.3, 32.3, 34.5, 35.1, 35.1, 34.6, 34.6, 34.6, 35.0, 35.0, 35.0, 34.9, 34.9] / 指令 [19.9, 35.1, 35.0, 34.9, 32.1, 32.0, 32.2, 35.6, 35.5, 35.3, 34.4, 34.5, 34.4, 35.3, 35.2, 35.1, 34.8, 34.7] / 手先の高さ [14.5, 13.8, 37.5, 52.3, 51.0, 44.0, 42.3, 41.7, 46.2, 46.1, 45.8, 43.5, 38.3, 37.0, 36.5, 33.9, 32.4, 36.8]

## 取り違えた閉じ ((a) の判定)

| 記録 | 回 | コマ | 答え (読み) | 判定 (読み・コマ) |
|---|---|---|---|---|
| so101f | so101_20261130_105255 | 493 | held (10.57) | ambiguous (33.74・19) |
| so101g | so101_20261130_222805 | 315 | empty (1.36) | held (10.64・13) |
```

### so101/check_405/open_order_405.md

```markdown
# 依頼 405: 空のあとの道の順 (開いてから上がる / 上がってから開く) を 外し方ごとに (open_order_405.py が書いた)

場所2〜5 の目印・rule_401 の道 (今日のガードの値)・つかむ所から 爪の間の点をずらした所で 空で閉じたとする. ○ = switch_405 のガードを通る

| 外し方 | 場所2 開→上 | 場所2 上→開 | 場所3 開→上 | 場所3 上→開 | 場所4 開→上 | 場所4 上→開 | 場所5 開→上 | 場所5 上→開 |
|---|---|---|---|---|---|---|---|---|
| つかむ所 | × (ブロック -15.1) | ○ (ブロック -2.4) | × (ブロック -13.5) | ○ (ブロック -1.8) | × (ブロック -16.0) | ○ (ブロック -2.4) | × (ブロック -14.1) | ○ (ブロック -1.6) |
| 奥 10 | × (ブロック -13.0) | ○ (ブロック -0.5) | × (ブロック -13.1) | ○ (ブロック 3.5) | × (ブロック -16.9) | ○ (ブロック -1.9) | × (ブロック -12.8) | × (ブロック -3.9) |
| 奥 15 | 解けない | 解けない | × (ブロック -9.3) | ○ (ブロック 6.5) | × (ブロック -13.4) | ○ (ブロック -1.4) | 解けない | 解けない |
| 奥 20 | 解けない | 解けない | × (ブロック -5.4) | ○ (ブロック 9.6) | × (ブロック -9.9) | ○ (ブロック -0.9) | 解けない | 解けない |
| 手前 10 | × (ブロック -9.0) | × (ブロック -3.5) | × (ブロック -11.2) | × (ブロック -6.8) | × (ブロック -8.8) | ○ (ブロック -1.5) | × (ブロック -7.6) | ○ (ブロック 1.9) |
| 手前 15 | × (ブロック -4.1) | ○ (ブロック -2.3) | × (ブロック -7.4) | × (ブロック -7.1) | × (ブロック -3.8) | ○ (ブロック 2.3) | × (ブロック -2.7) | ○ (ブロック 4.3) |
| 手前 20 | ○ (ブロック 0.8) | ○ (ブロック 1.8) | × (ブロック -3.6) | × (ブロック -3.3) | ○ (ブロック 1.1) | ○ (ブロック 6.1) | ○ (ブロック 2.1) | ○ (ブロック 8.3) |
| 右 10 | × (ブロック -16.8) | × (ブロック -9.8) | × (ブロック -14.4) | × (ブロック -8.2) | × (ブロック -18.2) | × (ブロック -10.4) | × (ブロック -14.3) | × (ブロック -9.5) |
| 右 15 | × (ブロック -17.1) | × (ブロック -13.4) | × (ブロック -11.4) | × (ブロック -10.6) | × (ブロック -17.3) | × (ブロック -13.6) | × (ブロック -12.6) | × (ブロック -12.6) |
| 右 20 | × (ブロック -16.2) | × (ブロック -15.7) | × (ブロック -8.3) | × (ブロック -7.7) | × (ブロック -17.4) | × (ブロック -16.8) | × (ブロック -11.2) | × (ブロック -12.6) |
| 左 10 | × (ブロック -13.2) | ○ (ブロック 6.4) | × (ブロック -12.7) | ○ (ブロック 5.1) | × (ブロック -14.3) | ○ (ブロック 6.4) | × (ブロック -12.4) | ○ (ブロック 7.3) |
| 左 15 | × (ブロック -14.8) | ○ (ブロック 11.0) | × (ブロック -9.6) | ○ (ブロック 8.9) | × (ブロック -15.7) | ○ (ブロック 10.7) | × (ブロック -14.7) | ○ (ブロック 11.8) |
| 左 20 | × (ブロック -13.8) | ○ (ブロック 15.5) | × (ブロック -6.3) | ○ (ブロック 12.7) | × (ブロック -14.5) | ○ (ブロック 15.0) | × (ブロック -14.9) | ○ (ブロック 16.4) |
| 上 10 | × (ブロック -14.3) | ○ (ブロック 4.0) | × (ブロック -11.8) | ○ (ブロック 4.0) | × (ブロック -14.6) | ○ (ブロック 3.4) | × (ブロック -10.2) | ○ (ブロック 4.0) |
| 上 20 | × (ブロック -4.5) | ○ (ブロック 10.9) | × (ブロック -2.4) | ○ (ブロック 9.8) | × (ブロック -4.6) | ○ (ブロック 11.1) | × (ブロック -0.6) | ○ (ブロック 9.7) |

通った数 (全 56): 開いてから上がる 3・上がってから開く 39
かっこは 腕 (爪・手首・カメラ) とシムのブロックの最小距離 mm (負は重なり)
```

### so101/check_405/fake_run_405.md

```markdown
# 依頼 405: 偽のアーム・偽のサーバーでの通し (fake_run_405.py が書いた)

場所3 の目印・rule_401 の道 (本物)・ガード・シム (本物)・run_trial (本物)・記録 LeRobot と台帳 (/tmp/r405_dry). アーム・サーバー・読みだけ偽

| 場面 | 期待 | 結果 | 合う | 渡した回 | 判定 (爪の読み・コマ) | π0.5 のコマ | 道 | 持ち上げの読み | コードのコマ | 待ち | 止めた所 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 回で挟む | carried | carried | ○ | 1 | held (10.6・12) | [13] | - | [10.6] | 183 | 3 | - |
| 1 回外して (奥 15 mm) 2 回目で挟む・依頼の形 (下で開く) | retry_refused | retry_refused | ○ | 1 | empty (1.3・24) | [10] | - | - | 92 | 3 | 1 回目の 空のあと: 開いて真上へ戻る道がガードに当たる: arm_block -9.3 mm (下限 -0.5) |
| 1 回外して (奥 15 mm) 2 回目で挟む・上がってから開く (戻った所で隠れた → HOME で読む) | carried | carried | ○ | 2 | empty (1.3・24) / held (10.6・12) | [10, 13] | ['home'] | [10.6] | 394 | 6 | - |
| 2 回外して止まる・上がってから開く (戻った所で読めた → そのまま渡し直す) | missed_max | missed_max | ○ | 2 | empty (1.3・24) / empty (1.3・24) | [10, 10] | ['direct'] | - | 195 | 5 | 2 回目: 2 回外した |
| 閉じない (区間の上限で止まる) | not_closed | not_closed | ○ | 1 | - | [92] | - | - | 68 | 3 | 1 回目の π0.5: 3 秒たっても閉じない |
| 持ち上げで落とす | dropped | dropped | ○ | 1 | held (10.6・12) | [13] | - | [0.66] | 104 | 3 | 持ち上げ〜戻る: 持ち上げ (LIFT) で爪の読み 0.7 が 挟んだの幅 (9〜12) の外: 落とした |
| π0.5 の区間で q (その場で止める) | policy_quit | policy_quit | ○ | 1 | - | [19] | - | - | 68 | 3 | 1 回目の π0.5: q で止めた |
| 外したあと ブロックが読めない・上がってから開く | retry_refused | retry_refused | ○ | 1 | empty (1.3・24) | [10] | - | - | 211 | 3 | 読み直し (HOME): ブロックが読めない (偽の読み) |
| 始めに ブロックが読めない (動かさない) | refused | refused | ○ | 0 | - | [] | - | - | 0 | 0 | -: ブロックが読めない (偽の読み) |

## ほかの場所 (今日の実機と同じガードの値: R401_PUSH_LIMIT_MM・R401_PUSH_WINDOW_MM = −12・conflict を許す)

| 場所 | 場面 | 結果 | 合う | 判定 | 道 | 持ち上げの道のシム (mm) | 空のあとの道のシム (mm) |
|---|---|---|---|---|---|---|---|
| 2 | 1 回で挟む | carried | ○ | held | - | {'jaw_table': 2.3, 'arm_base': 195.6, 'held_box': 35.1, 'arm_box': 33.1, 'arm_table': 73.3, 'held_table': 71.6} | - |
| 2 | 1 回外して (手前 20 mm) 2 回目で挟む・依頼の形 (下で開く) | retry_refused (開いて真上へ戻る道がガードに当たる: arm_block -2.7 mm (下限 -0.606556)) | ○ | empty | - | - | {'jaw_table': 0.6, 'arm_base': 191.7, 'arm_block': -2.7, 'arm_box': 173.1, 'arm_table': 5.9, 'start_arm_block': -0.1, 'start_arm_table': 5.9} |
| 2 | 1 回外して (左 15 mm) 2 回目で挟む・上がってから開く | carried | ○ | empty / held | ['home'] | {'jaw_table': 2.3, 'arm_base': 195.6, 'held_box': 35.1, 'arm_box': 33.1, 'arm_table': 73.3, 'held_table': 71.6} | {'jaw_table': 2.2, 'arm_base': 203.6, 'arm_block': 10.8, 'arm_table': 2.2, 'arm_box': 189.4, 'start_arm_block': 10.8, 'start_arm_table': 2.2} |
| 4 | 1 回で挟む | carried | ○ | held | - | {'jaw_table': 3.4, 'arm_base': 98.6, 'held_box': 34.9, 'arm_box': 33.1, 'arm_table': 73.3, 'held_table': 71.8} | - |
| 4 | 1 回外して (手前 20 mm) 2 回目で挟む・依頼の形 (下で開く) | carried | ○ | empty / held | ['home'] | {'jaw_table': 3.4, 'arm_base': 98.6, 'held_box': 34.9, 'arm_box': 33.1, 'arm_table': 73.3, 'held_table': 71.8} | {'jaw_table': -3.4, 'arm_base': 80.0, 'arm_block': 1.1, 'arm_box': 125.7, 'arm_table': 3.4, 'start_arm_block': 6.8, 'start_arm_table': 3.4} |
| 4 | 1 回外して (左 15 mm) 2 回目で挟む・上がってから開く | carried | ○ | empty / held | ['home'] | {'jaw_table': 3.4, 'arm_base': 98.6, 'held_box': 34.9, 'arm_box': 33.1, 'arm_table': 73.3, 'held_table': 71.8} | {'jaw_table': 3.6, 'arm_base': 100.9, 'arm_block': 10.7, 'arm_table': 3.6, 'arm_box': 143.9, 'start_arm_block': 10.7, 'start_arm_table': 3.6} |
| 5 | 1 回で挟む | carried | ○ | held | - | {'jaw_table': 0.9, 'arm_base': 203.0, 'held_box': 33.6, 'arm_box': 33.1, 'arm_table': 73.3, 'held_table': 70.2} | - |
| 5 | 1 回外して (手前 20 mm) 2 回目で挟む・依頼の形 (下で開く) | carried | ○ | empty / held | ['home'] | {'jaw_table': 0.9, 'arm_base': 203.0, 'held_box': 33.6, 'arm_box': 33.1, 'arm_table': 73.3, 'held_table': 70.2} | {'jaw_table': 0.9, 'arm_base': 190.8, 'arm_block': 2.1, 'arm_box': 59.7, 'arm_table': 0.9, 'start_arm_block': 8.3, 'start_arm_table': 0.9} |
| 5 | 1 回外して (左 15 mm) 2 回目で挟む・上がってから開く | carried | ○ | empty / held | ['home'] | {'jaw_table': 0.9, 'arm_base': 203.0, 'held_box': 33.6, 'arm_box': 33.1, 'arm_table': 73.3, 'held_table': 70.2} | {'jaw_table': 1.0, 'arm_base': 210.9, 'arm_block': 11.8, 'arm_table': 1.0, 'arm_box': 91.9, 'start_arm_block': 11.8, 'start_arm_table': 1.0} |

台帳 /tmp/r405_dry/log/so101_trials.csv: 17 行 (動かさずに止めた回は書かない). 見出しは TRIAL_COLUMNS + SWITCH_COLUMNS
- so101_20261201_142942_dry: result=success・fail_reason=・sw_status=carried・sw_judges=held・sw_grip_reads=10.60・sw_close_points=-8.8,15.8,11.9・sw_policy_frames=13・frames=199 (model 13)
- so101_20261201_142953_dry: result=failure・fail_reason=2・sw_status=retry_refused・sw_judges=empty・sw_grip_reads=1.31・sw_close_points=-8.4,31.1,11.9・sw_policy_frames=10・frames=105 (model 10)
- so101_20261201_143000_dry: result=success・fail_reason=・sw_status=carried・sw_judges=empty|held・sw_grip_reads=1.31|10.60・sw_close_points=-8.4,31.1,11.9|-8.8,15.8,11.9・sw_policy_frames=10|13・frames=423 (model 23)
- so101_20261201_143015_dry: result=failure・fail_reason=2・sw_status=missed_max・sw_judges=empty|empty・sw_grip_reads=1.31|1.31・sw_close_points=-8.4,31.1,11.9|-8.4,31.1,11.9・sw_policy_frames=10|10・frames=220 (model 20)
- so101_20261201_143026_dry: result=failure・fail_reason=6・sw_status=not_closed・sw_judges=・sw_grip_reads=・sw_close_points=・sw_policy_frames=92・frames=163 (model 92)
- so101_20261201_143036_dry: result=failure・fail_reason=3・sw_status=dropped・sw_judges=held・sw_grip_reads=10.60・sw_close_points=-8.8,15.8,11.9・sw_policy_frames=13・frames=120 (model 13)
- so101_20261201_143044_dry: result=・fail_reason=・sw_status=policy_quit・sw_judges=・sw_grip_reads=・sw_close_points=・sw_policy_frames=19・frames=90 (model 19)
- so101_20261201_143051_dry: result=failure・fail_reason=2・sw_status=retry_refused・sw_judges=empty・sw_grip_reads=1.31・sw_close_points=-8.4,31.1,11.9・sw_policy_frames=10・frames=224 (model 10)
- so101_20261201_143102_dry: result=success・fail_reason=・sw_status=carried・sw_judges=held・sw_grip_reads=10.60・sw_close_points=-12.3,13.5,14.0・sw_policy_frames=15・frames=201 (model 15)
- so101_20261201_143114_dry: result=failure・fail_reason=2・sw_status=retry_refused・sw_judges=empty・sw_grip_reads=1.31・sw_close_points=-13.2,-2.8,17.7・sw_policy_frames=34・frames=129 (model 34)
- so101_20261201_143124_dry: result=success・fail_reason=・sw_status=carried・sw_judges=empty|held・sw_grip_reads=1.31|10.60・sw_close_points=-27.7,13.8,13.7|-12.3,13.5,14.0・sw_policy_frames=14|15・frames=429 (model 29)
- so101_20261201_143143_dry: result=success・fail_reason=・sw_status=carried・sw_judges=held・sw_grip_reads=10.60・sw_close_points=-14.6,9.9,15.4・sw_policy_frames=17・frames=202 (model 17)
- so101_20261201_143154_dry: result=success・fail_reason=・sw_status=carried・sw_judges=empty|held・sw_grip_reads=1.31|10.60・sw_close_points=-15.2,-9.9,15.5|-14.6,9.9,15.4・sw_policy_frames=18|17・frames=434 (model 35)
- so101_20261201_143210_dry: result=success・fail_reason=・sw_status=carried・sw_judges=empty|held・sw_grip_reads=1.31|10.60・sw_close_points=-30.1,10.5,15.1|-14.6,9.9,15.4・sw_policy_frames=17|17・frames=433 (model 34)
- so101_20261201_143226_dry: result=success・fail_reason=・sw_status=carried・sw_judges=held・sw_grip_reads=10.60・sw_close_points=-11.3,5.9,16.6・sw_policy_frames=14・frames=200 (model 14)
- so101_20261201_143239_dry: result=success・fail_reason=・sw_status=carried・sw_judges=empty|held・sw_grip_reads=1.31|10.60・sw_close_points=-11.9,-13.9,16.7|-11.3,5.9,16.6・sw_policy_frames=28|14・frames=442 (model 42)
- so101_20261201_143258_dry: result=success・fail_reason=・sw_status=carried・sw_judges=empty|held・sw_grip_reads=1.31|10.60・sw_close_points=-26.7,6.3,16.4|-11.3,5.9,16.6・sw_policy_frames=13|14・frames=427 (model 27)
```

### so101/check_405/review_request_405.md

```markdown
# コードレビュー依頼：依頼 405 切り替え方式（コード → π0.5 → コード）に 握れたかの判定と 外したときのコードのやり直しを足した

**読むだけにしてください。ファイルは書き換えないでください。テストも走らせなくてよいです。**

## 何を足したか
- `so101/check_405/switch_405.py`（新しい）：1 試行の流れ・判定・コードの道・記録・台帳。入口 `execute`、本体 `Switch.run`
- `so101/run_so101_policy.py`：`--switch-405` と その口（`--policy-max-s`・`--chunk-full`・`--black-wrist`・`--retry-shift-mm`・`--allow-status`・`--reselect-face`・`--place1-candidate`）を足し、`--switch-405` のときだけ `switch_405.execute` へ渡す（付けないときは `run()` のまま）
- 判定の境目は記録から：`so101/check_405/analyze_405.py` → `judge_405.md`
- 偽のアーム・偽のサーバーの通し `fake_run_405.py`（結果 `fake_run_405.md`）、テスト `test_switch_405.py`
- 土台（変えていない・使っているだけ）：`so101/check_401/run_rule401.py`（`prepare`・`Runner`・`hold_here`・`safe_hold`・`kioxia_bad`）、`run_so101_policy.run_trial`、`ideal_var/var_lib_314.py`（`lift_pose`・`assemble`・`box_mid_pose`）、`ideal_var/clear_345.py`、`check_399/lib_399.py`（`World.sh` = `recover_377.Shifter`・`jaw_dir`）

## 流れ（`Switch.run`）
1. 机のカメラで読む → rule_401 の道 → run_rule401 と同じガード（`RR.prepare`）。渡す姿勢が推論の安全範囲の外でも止める
2. `RR.Runner.run` で HOME → ABOVE_BLOCK（追従の差 10° で止める）→ 渡す所で 2〜8 コマ待つ
3. π0.5：`run_trial` をそのまま呼び、記録の口 `_Watch.add` が 1 コマずつ見る。爪の指令（action）が 25 以上のあと 20 を割ったら `Takeover("closed")` を投げて抜ける。π0.5 のコマが `--policy-max-s`（既定 8 秒）を超えたら `Takeover("timeout")`。推論の口 `Gate` は問い合わせを 1 つずつにする（前の区間の裏の問い合わせと重ならない）
4. 判定 `_close_and_judge`：関節 5 つは `arm.last_sent` のまま、爪の指令を 5 コマで 0.74 へ。`judge_reading`（3 コマ目以降に 続けて 4 コマの読みの幅 ≤ 0.5 → 9〜12 = 挟んだ / 5 未満 = 空 / ほか・30 コマで落ち着かない = あいまい → 空として扱う）
5. 挟んだ：`after_held_path`（今の姿勢から真上 80 mm → 箱の上の真上 → 箱の上 → 離す → HOME。rule_351 の LIFT 以降と同じコマ数・爪の値）にガード（範囲・1 コマ・運ぶ高さ・`clear_after` のシム）→ 送る。LIFT のコマで直近 3 コマの爪の読みの中央値が 9〜12 の外なら止めて「落とした」
6. 空・あいまい：`_open_rise`（閉じる前の開きへ 10 コマで開く → 真上へ 渡す所の高さまで（`rise_pose`））。2 回目ならそこで止める（missed_max）。そうでなければ 戻った所で読む → 読めて道が作れて 寄せる道（24 コマ）がシムを通れば そのまま新しい渡す所へ。だめなら 前の渡す姿勢 → 来たコードの道を逆に HOME（`_go_home`）→ HOME で読む → `_to_handover`。HOME でも読めない・道が作れない → 止める（retry_refused）
7. 台帳：`TRIAL_COLUMNS + SWITCH_COLUMNS`。運んだ回だけ結果を聞く。落とした・2 回外した・閉じなかった・やり直せないは失敗として自動で書く

## 見てほしい点（4 つ）
1. **コードが π0.5 から引き継ぐ瞬間の急な動き。** 引き継ぐのは 指令が 20 を割ったコマ（そのコマは送ったあと）。関節は `arm.last_sent` のまま、爪は 5 コマで閉じる。持ち上げ・空のあとの道の 1 コマ目は 止めた姿勢そのもの。ここで跳びが出る道筋はないか（`--max-step-deg 5` は π0.5 の区間だけ・コードは run_rule401 と同じ 10°）
2. **空のあと 真上へ戻る道で 腕・爪がブロック・箱・机に当たる所。** 開く（10 コマ）→ 上がる の順。`clear_after(held=False)` は爪と机に `jaw_table_min`（−11 mm）だけ当て、腕とブロックは測るだけ（空で閉じた所はブロックのすぐ横なので）。寄せる道（`"connect"`）はブロック +10 mm ≥ 0・腕と机 15 mm。HOME へ戻る道の確かめは 寄せる区間だけ（逆に流す来た道は 1 回目に clear_345 で全区間を確かめた道）
3. **やり直しが止まらなくなる道筋。** 渡すのは最大 2 回（`MAX_ATTEMPTS`）、π0.5 の区間は 8 秒、判定は 31 コマまで。キー・追従の差・例外・Ctrl-C で止まったときに 次へ進まないか
4. **判定の取り違え。** 挟んでいるのに開く（→ 落とす）・空なのに運ぶ。境目の決め方（`judge_405.md`：記録の挟んだ 139 回は 10.09〜10.84・空 101 回は 0.88〜4.81）と 実機の判定の始め方（引き継ぐコマから）の食い違い。持ち上げの確かめ（LIFT で 1 回）

## 確かめたこと（参考）
- 偽の通し：場所3 で 1 回で挟む／1 回外して 2 回目で挟む（HOME で読む）／2 回外して止まる（戻った所で読めた）／閉じない／持ち上げで落とす／外したあと読めない／始めに読めない。場所2・4・5 で 1 回で挟む・1 回外して 2 回目で挟む。13 場面とも期待どおり
- 既存のテスト（run_so101_policy 89・handover_392 12（付けないときが 927d01d とバイトごと同じ）・394 13・395 13・396 10・run_rule401 31・lerobot_safe_259 64・ideal_var_314 13・so101_rtc 9・so101_train 32）が通る

結果は **必須／推奨／据え置き** に分け、それぞれ ✅ / ⚠️ / ❌ と ファイル:行 を付けて、日本語で。最後に「直したあと 実機で 1 回流してよいか（実機はエイイチが見て流す）」を 1 行で。
```

### so101/check_405/review_r1.txt

```text
**現状では実機を流す前に修正が必要です。** 特に、あいまい判定で自動的に開くこと、空の後の上昇で腕と机・ブロックの衝突を止めないこと、π0.5 の「8秒」が実時間の上限になっていないことが気になります。

## 必須

- ❌ **あいまい判定でも爪を開くため、握っているブロックを落とし得ます。** [switch_405.py:619](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/check_405/switch_405.py:619) では `held` 以外をすべて `_open_rise` に進めます。実際に、既存記録の再判定には「held を ambiguous と判定」が1件あります。[judge_405.md:23](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/check_405/judge_405.md:23) あいまい・未安定は開かず保持して停止し、確認を受ける経路が必要です。加えて、この集計は過去の指令が続いた読みを使っており、引き継ぎ後に5コマで閉じ切る今回の動作を再現した検証ではありません。

- ❌ **空の後の開き・上昇では、腕と机・ブロックの距離が停止条件に入っていません。** [switch_405.py:265](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/check_405/switch_405.py:265) では `held=False` のとき腕とブロックを計測するだけで、腕と机も判定しません。[switch_405.py:520](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/check_405/switch_405.py:520) の経路には、真上に解けず根元側へ引くフォールバックもあります。爪がブロックに近いことと、腕の貫通を許すことは別なので、少なくとも腕と机・腕とブロックに停止条件を設け、初期接近を許す必要がある場合はその許容範囲を明示して確認してください。

- ❌ **`--policy-max-s` は実時間の上限ではなく、モデル送信コマ数の上限です。** [switch_405.py:143](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/check_405/switch_405.py:143)、[switch_405.py:163](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/check_405/switch_405.py:163) 推論待ち中はカウントされず、初回問い合わせや `future.result()` が返らなければキーも監視できません。[run_so101_policy.py:734](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/run_so101_policy.py:734)、[run_so101_policy.py:798](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/run_so101_policy.py:798) また一時停止・手直し中も増えず、`--play-speed` を下げると240コマの所要時間も延びます。実時間の期限と、問い合わせ待ち中の停止・タイムアウトを設けてください。

- ❌ **π0.5 区間の `q` は明示的なその場保持を行いません。** [switch_405.py:608](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/check_405/switch_405.py:608) はそのまま終了しますが、`run_trial` の `q` もループを抜けるだけです。[run_so101_policy.py:766](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/run_so101_policy.py:766) 最後の目標へ追従中なら動きが残り得るため、コード区間の停止と同様に保持処理と成否の報告が必要です。

## 推奨

- ⚠️ **空を held と誤判定した既知例があり、LIFT 終点の1回確認では持ち上げ途中の移動を防げません。** [judge_405.md:23](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/check_405/judge_405.md:23)、[switch_405.py:504](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/check_405/switch_405.py:504) 判定の信頼性を今回の固定関節・閉じ切り動作で別途確認し、LIFT 中にも適切な時点で複数回確認する設計を検討してください。終点の確認後に落ちる場合も検出できません。

- ⚠️ **HOME へ戻る逆走路は、現在のブロック位置で再確認されません。** [switch_405.py:545](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/check_405/switch_405.py:545) では接続区間だけをシムで確認します。π0.5 や開く動作でブロックが動いた場合、初回のクリアランスは逆走時の保証になりません。読み直せた位置を利用するか、位置が不明な場合の停止条件を設けるのが安全です。

- ⚠️ **判定中は関節の追従差を監視していません。** [switch_405.py:457](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/check_405/switch_405.py:457) は最後の送信目標を保持するため指令の跳びは抑えられますが、実関節がまだその目標へ動いている場合は動き続けます。判定中も実位置と目標の差や停止を確認すると、引き継ぎ時の状態を把握できます。

## 据え置き

- ✅ **指令上の引き継ぎに関節の跳びは見当たりません。** 判定は `arm.last_sent` の関節5軸を保持し、爪を5コマで閉じます。[switch_405.py:461](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/check_405/switch_405.py:461) その後の持ち上げ・開き戻しも同じ指令姿勢から経路を組み立てています。[switch_405.py:186](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/check_405/switch_405.py:186)、[switch_405.py:532](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/check_405/switch_405.py:532) ただし、これは指令の連続性であり、実機が静止済みという保証ではありません。

- ✅ **通常の外し経路は最大2回です。** [switch_405.py:594](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/check_405/switch_405.py:594)、[switch_405.py:628](https://pixelstomotors.com/Users/shimazueiichi/r2r2r-scripts/so101/check_405/switch_405.py:628) コード区間のキー・追従差による停止、および例外・Ctrl-C は後続の試行に進まない構造です。ただし、上記の推論待ちと `q` の保持は別途修正が必要です。

読み取りのみで確認しました。テストと実機操作は行っていません。

**直したあと実機で1回流してよいか：上記の必須事項を直し、修正後の経路と停止条件を再レビューできるまでは、まだ流さないでください。**
```

### so101/check_405/switch_405.py

```python
"""依頼 405: 切り替え方式 (コード → π0.5 → コード) に 握れたかの判定と 外したときのコードのやり直しを足す.
run_so101_policy.py --switch-405 が使う (付けなければ run_so101_policy.py は今までどおり).

2026-11-30 23:16 エイイチの決め: π0.5 が受け持つのは「寄せて下りて閉じる」まで. 閉じた直後にコードへ戻す. 握れたかはコードが判定し,
外したらコードが上へ戻して π0.5 に渡し直す. 持ち上げ・箱へ運ぶ・戻るはコード.

1 回の流れ (1 試行):
  1. 割り振り plan_401.json・道を作る範囲・腕の動きの予想を アームを開く前に読む (run_rule401.load_plan・world. 依頼 401 と同じ)
  2. 机のカメラでブロックを読み, rule_401 の道を作ってガードを当てる (run_rule401.prepare. 読み方・ガード・環境変数 R401_* ・
     --reselect-face・--allow-status・--place1-candidate は run_rule401.py と同じ). だめなら動かさずに止める (終了コード 3)
     R401_CMD_FIRST=1 (依頼 407 の A) も run_rule401.prepare が読む. 変わるのは rule_401 の道の つかむ所 (記録の cmd・pred) と,
     すき間 12 mm を解き直すことによる 渡す姿勢 (ABOVE_BLOCK) の差 (今日の読み 97 回で 30 回. 多くは 0.5° 以下・最大 18°) だけ.
     π0.5 の下り方そのものは変わらない
     渡す姿勢 (ABOVE_BLOCK. rule_401 の 開き 59・固定側から離す向きへ寄せた姿勢) が 推論の安全範囲 (--raw-dir) の外でも止める
  3. 確かめ (Enter. --skip-first-confirm なら待たない. status が ok でない・場所1 の候補の回は 毎回 yes) → HOME へ寄せ → HOME で待つ →
     rule_401 の道の HOME → ABOVE_BLOCK を 30fps で送る (run_rule401.Runner.run と同じ. 予想からの追従の差 10° で止める. ptm.mode = 3)
  4. 渡す所で 2〜8 コマ待つ (handover_392 と同じ: 手先の速さ 5 mm/秒 未満. ptm.mode = 4)
  5. π0.5 の区間 (run_so101_policy.run_trial をそのまま. 安全範囲・--max-step-deg・--blend・--exec-steps・先に問い合わせる).
     記録の口 (_Watch) で 1 コマずつ見て:
       - 閉じた: 爪の指令 (action) が CMD_OPEN (25) 以上のあと CMD_CLOSE (20) を割ったコマで π0.5 の答えを使うのをやめる
       - 長すぎる: π0.5 の区間 (渡してから. 一時停止・手直しの間は数えない) が --policy-max-s (既定 8 秒) を超えたら止めて
         「閉じなかった」(not_closed. 失敗 6). 推論の答えが INFER_TIMEOUT_S (10 秒) で返らなければ 例外として その場で止める
       - q: その場で止める (policy_quit. 結果は聞かない)
     --chunk-full: 1 回の答えを最後のコマまで流し切ってから 次を問い合わせる (run_trial の --no-prefetch と同じ形・答えの全部のコマ)
     --black-wrist: 推論に渡す手首カメラの絵を黒くする (確かめ用. 記録の絵は本物)
  6. 握れたかの判定 (コード. ptm.mode = 3): 関節 5 つは 最後に送った値のまま・爪の指令を CLOSE_RAMP (5) コマで GRASP_CLOSED (0.74) へ.
     judge_reading: 判定を始めて JUDGE.start (3) コマ目以降に 続けて JUDGE.n (4) コマの爪の読みの幅が JUDGE.w (0.5) 以下になったら
     落ち着いたとし, その読みが 9〜12 = 挟んだ / 5 未満 = 空 / ほか・JUDGE.max_wait (30) コマで落ち着かない = あいまい (空として扱う).
     境目は so101f 30 回・so101g 7 回・お手本 64 本の記録から (analyze_405.py → judge_405.md)
  7. 挟んだ: 今の姿勢から rule_351 の LIFT 以降と同じ形の道 (真上 80 mm (V.lift_pose) → 箱の上の真上 → 箱の上 → 離す → HOME.
     コマ数・爪の値も同じ) を作り, ガード (1 コマの変化・道を作る範囲・運ぶ間の高さ・シム) を当てて送る. 持ち上げ (LIFT のコマ) で
     爪の読みをもう一度見て (直近 3 コマの中央値) 挟んだの幅の外なら その場で止めて「落とした」(dropped. 失敗 3. 自動では拾い直さない)
  8. 空・あいまい: 爪を閉じる前の開き (直前 15 コマの指令の最大. 道を作る範囲の上限まで) に開き (10 コマ), 真上へ 渡す所の高さまで戻る
     (recover_377.Shifter で 爪の傾き・閉じる向きのまま. 解けなければ 持ち上げと同じ V.lift_pose). 外したのが MAX_ATTEMPTS (2) 回目なら そこで止めて「2 回外した」(missed_max. 失敗 2).
     そうでなければ 机のカメラで読み直す:
       - 読めた (赤の面積が 1 回目の READ_KEEP_FRAC (85%) 以上): 道を作り直し (2 と同じ), 戻った姿勢から 新しい渡す姿勢へ 24 コマ
         (var_lib_314.DETOUR_BACK) で寄せる (シムで確かめる. 通らなければ 下の HOME の道へ)
       - 読めない・腕で隠れた・道が作れない・ガードに当たる・寄せる道がシムを通らない: 戻った姿勢 → 前の渡す姿勢 → 来たコードの道を
         逆に HOME へ戻ってから読む → 2・3 と同じ道で渡す所へ (決まりの外の口を使う道は 1 回目と同じく yes を聞く)
     HOME で読んでも ブロックが読めない・校正の点の囲みの外・道が作れない・ガードに当たる → やり直さずに止める (retry_refused. 失敗 2)
     --retry-shift-mm X (既定 0 = 寄せない): 渡し直す姿勢を 固定側の爪から離す向きへ さらに X mm 寄せる (寄せたあとの道もシムで確かめる)
     --retry-rise-first (既定 なし = 依頼の形): 空のあと 閉じたまま真上へ上がってから 上で開く (open_order_405.md: 下で開くと 動く爪が
       ブロックへ入る形が多い. 決めるのはエイイチ)
  スペース・q (コードの区間): その場で止める (run_rule401 と同じ hold_here). 結果は聞かない
  台帳: TRIAL_COLUMNS + SWITCH_COLUMNS (行の最後に足す). 結果は 運んだ回 (carried) だけ聞く. 落とした・2 回外した・閉じなかった・
  やり直せなかった は 失敗として自動で書く (fail_reason 3・2・6・2)
"""
import json
import os
import sys
import time
from datetime import datetime
from pathlib import Path

import numpy as np

HERE = Path(__file__).resolve().parent
SO101 = HERE.parent
for p in (SO101, SO101 / "ideal_var", SO101 / "check_392", SO101 / "check_399", SO101 / "check_401", SO101 / "check_376"):
    if str(p) not in sys.path:
        sys.path.insert(0, str(p))

import run_so101_policy as R  # noqa: E402

# ---- 判定の値 (analyze_405.py で記録に当てた) ----------------------------------------------------------
CMD_OPEN, CMD_CLOSE = 25.0, 20.0        # 爪の指令: 開き (この値以上) のあと 閉じ (この値を割った) で π0.5 をやめる
HELD_MIN, HELD_MAX, EMPTY_MAX = 9.0, 12.0, 5.0       # 挟んだ: 9〜12 (記録の挟んだ 139 回は 10.09〜10.84) / 空: 5 未満 (空 101 回は 0.88〜4.81)
JUDGE = {"start": 3, "n": 4, "w": 0.5, "max_wait": 30, "held_min": HELD_MIN, "held_max": HELD_MAX, "empty_max": EMPTY_MAX}
CLOSE_RAMP = 5                          # 閉じる指令を GRASP_CLOSED へ この コマ数で (入口の B の爪 20 の内側)
LIFT_CHECK_FRAMES = 3                   # 持ち上げの確かめ: 直近この コマの爪の読みの中央値
MAX_ATTEMPTS = 2                        # π0.5 に渡すのは 2 回まで (2 回外したら止める)
POLICY_MAX_S = 8.0                      # π0.5 の区間の上限 (秒. 記録: so101f・g でブロックの上の高さから最初の閉じまで 成功は 2.2〜5.9 秒)
READ_KEEP_FRAC = 0.85                   # 読み直しの赤の面積が 1 回目のこの割合より少なければ 腕で隠れたとする (依頼 376 と同じ 85%)
OPEN_FRAMES = 10                        # 空のあと 爪を開くコマ (var_lib_314.TEMPLATE["close"] と同じ)
RISE_MM_PER_FRAME = 80.0 / 24           # 真上へ戻る速さ (持ち上げ 80 mm / 24 コマ と同じ)
RISE_MIN_MM = 3.0                       # これより低い差は上げない
START_TOL_MM = 0.5                      # 空のあとの道: 腕とブロック (始め = 閉じた所)・腕と机 (始め = 開いた所) より この mm を超えて近づいたら送らない
BLOCK_START_OVERLAP_MM = 3.0            # 空のあとの道: 閉じた所で 腕とシムのブロックが この mm より重なっていたら ブロックの位置が分からないので送らない
INFER_TIMEOUT_S = 10.0                  # 推論の答えが この秒で返らなければ 止める (codex 405 R1 必須 3)
CODE_MAX_STEP = R.MAX_STEP_DEG          # コードの区間の 1 コマの上限 (run_rule401 と同じ既定 10° = 入口の B)
PLAN_FILE = "switch405_plan.json"
STATUS = {"refused": "動かさずに止めた", "stopped": "止めた (スペース・q・追従の差)", "policy_quit": "π0.5 の区間で q",
          "carried": "挟んで箱へ運んだ", "dropped": "持ち上げで落とした", "missed_max": "2 回外した", "not_closed": "閉じなかった (区間の上限)",
          "retry_refused": "やり直せない (読めない・道が作れない)", "lift_refused": "持ち上げの道が作れない", "not_started": "始める前に終わった"}
AUTO_FAIL = {"dropped": "3", "missed_max": "2", "not_closed": "6", "retry_refused": "2"}
SWITCH_COLUMNS = ["sw_status", "sw_attempts", "sw_retries", "sw_judges", "sw_grip_reads", "sw_grip_currents", "sw_judge_frames",
                  "sw_close_points", "sw_policy_frames", "sw_stop_where", "sw_stop_why", "sw_frames_code", "sw_frames_wait",
                  "sw_block_u", "sw_block_v", "sw_block_yaw_deg", "sw_chunk_full", "sw_black_wrist", "sw_retry_shift_mm",
                  "sw_policy_max_s", "sw_plan_file", "sw_rise_first"]


class Refused(Exception):
    """やり直さない・送らない (理由は文字)"""


class Takeover(Exception):
    """π0.5 の区間を終わる (kind: closed / timeout)"""

    def __init__(self, kind):
        super().__init__(kind)
        self.kind = kind


def judge_reading(reads, p=JUDGE):
    """判定を始めてからの爪の読み (1 コマ 1 つ) → 決まらなければ None. 決まれば {"class", "grip", "frames", "settled", "why"}.
    class: held (挟んだ) / empty (空) / ambiguous (あいまい. 空として扱う)"""
    n = len(reads)
    if n - p["n"] >= p["start"]:
        w = reads[-p["n"]:]
        if max(w) - min(w) <= p["w"]:
            g = float(reads[-1])
            c = "held" if p["held_min"] <= g <= p["held_max"] else "empty" if g < p["empty_max"] else "ambiguous"
            return {"class": c, "grip": g, "frames": n, "settled": True,
                    "why": "" if c != "ambiguous" else f"落ち着いた読み {g:.1f} が 挟んだ ({p['held_min']:g}〜{p['held_max']:g}) にも 空 ({p['empty_max']:g} 未満) にも入らない"}
    if n > p["max_wait"]:
        return {"class": "ambiguous", "grip": float(reads[-1]), "frames": n, "settled": False,
                "why": f"{p['max_wait']} コマで爪の読みが落ち着かない"}
    return None


def lift_ok(reads, k=LIFT_CHECK_FRAMES):
    g = float(np.median(reads[-k:]))
    return HELD_MIN <= g <= HELD_MAX, g


# ---- π0.5 の区間の口 --------------------------------------------------------------------------------

class Gate:
    """推論の口: 問い合わせを 1 つずつにする (糸 1 本. 前の区間の裏の問い合わせと重ならない) ・ 答えが timeout 秒で返らなければ
    TimeoutError (codex 405 R1 必須 3: 返らないと キーも見られないため. 呼ぶ側は例外として その場で止める) ・
    --black-wrist なら手首の絵を黒くして渡す"""

    def __init__(self, policy, black_wrist=False, timeout=INFER_TIMEOUT_S):
        from concurrent.futures import ThreadPoolExecutor
        self._p, self.black, self.timeout = policy, bool(black_wrist), float(timeout)
        self._ex = ThreadPoolExecutor(max_workers=1)
        self._black = R.encode_jpeg(np.zeros((R.CAM_H, R.CAM_W, 3), np.uint8)) if black_wrist else None
        self.n = 0

    def infer(self, obs):
        from concurrent.futures import TimeoutError as FT
        if self.black:
            obs = dict(obs, **{"observation/wrist_image": self._black})
        self.n += 1
        fut = self._ex.submit(self._p.infer, obs)
        try:
            return fut.result(timeout=self.timeout)
        except FT:
            raise TimeoutError(f"推論の答えが {self.timeout:g} 秒で返らない") from None

    def close(self):
        self._ex.shutdown(wait=False, cancel_futures=True)

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


class _Watch:
    """run_trial に渡す記録の代わり. 1 コマずつ記録してから 閉じた・長すぎるを見て Takeover を投げる (run_trial は変えない)"""

    def __init__(self, add, limit_s, grip0, clock=time.perf_counter):
        """limit_s: π0.5 の区間の上限 (秒. 時計で測る. 一時停止・手直しのコマの間は数えない. codex 405 R1 必須 3)"""
        self._add, self.limit_s, self.clock = add, float(limit_s), clock
        self.armed = float(grip0) >= CMD_OPEN
        self.n_model, self.n_all, self.cmd = 0, 0, []
        self.first = None
        self.t0 = self.last = clock()          # 区間の始め (最初の問い合わせの前)
        self.idle_s = 0.0

    def elapsed(self):
        return self.clock() - self.t0 - self.idle_s

    def add(self, state, desk, wrist, action, sent, mode, *a, **k):
        self._add(state, desk, wrist, action, sent, mode, *a, **k)
        self.n_all += 1
        now = self.clock()
        if mode != R.MODEL:                    # 一時停止・手直し (人が見ている間) は数えない
            self.idle_s += now - self.last
            self.last = now
            return
        self.last = now
        if self.first is None:
            self.first = (np.asarray(action, np.float64).copy(), np.asarray(sent, np.float64).copy())
        self.n_model += 1
        g = float(np.asarray(action, np.float64)[5])
        self.cmd.append(g)
        if g >= CMD_OPEN:
            self.armed = True
        elif self.armed and g < CMD_CLOSE:
            raise Takeover("closed")
        if self.elapsed() >= self.limit_s:
            raise Takeover("timeout")

    def open_grip(self, k=15):
        """閉じる前の開き: 直近 k コマの指令の最大 (閉じたコマを除く)"""
        c = self.cmd[:-1][-k:]
        return max(c) if c else None


# ---- 道 (コード) -------------------------------------------------------------------------------------

def _V():
    import var_lib_314 as V
    return V


def after_held_path(chain, q5):
    """挟んだ姿勢 q5 (関節 5 つ) から rule_351 の LIFT 以降と同じ形の道 (コマ数・爪の値も同じ). → (道, キーのコマ, 情報)"""
    V = _V()
    lift5, pe, ae, back = V.lift_pose(chain, q5, V.LIFT_MM)
    if pe >= 1.0 or ae >= 2.0:
        raise Refused(f"持ち上げの姿勢が解けない (位置 {pe:.1f} mm・向き {ae:.1f}°)")
    mid5 = V.box_mid_pose(chain, V.CARRY_RAISE_MM)
    kp = [("GRASP_CLOSED", np.r_[q5, V.GRIP["GRASP_CLOSED"]]), ("LIFT", np.r_[lift5, V.GRIP["LIFT"]]),
          ("CARRY_MID", np.r_[mid5, V.GRIP["ABOVE_BOX"]]), ("ABOVE_BOX", np.r_[V.ABOVE_BOX, V.GRIP["ABOVE_BOX"]]),
          ("RELEASED", np.r_[V.RELEASED, V.GRIP["RELEASED"]]), ("HOME_END", V.HOME.copy())]
    segs = [0, V.TEMPLATE["lift"], V.TEMPLATE["carry"], V.TEMPLATE_LOWER_BOX, V.TEMPLATE["release"], V.TEMPLATE["return"]]
    path, fr = V.assemble(kp, segs)
    zc = [float(V.tcp_mm(chain, q)[2]) for q in path[fr["LIFT"]:fr["ABOVE_BOX"] + 1]]
    return path, fr, {"lift_back_mm": back, "carry_z_min_mm": round(min(zc), 1), "lift_pose": np.round(lift5, 3).tolist()}


def rise_pose(W, q5, z_target):
    """q5 から 手先を真上へ 渡す所の高さ z_target (アームの座標 mm) まで (爪の傾き・閉じる向きのまま. recover_377.Shifter).
    → (関節 5 つ, 上げた mm, 根もとへ引いた mm). 解けなければ V.lift_pose (URDF の真上・爪の向きのまま. 届かなければ根もとへ
    LIFT_BACK_STEP_MM ずつ引く. make_path の持ち上げと同じ). どちらも解けなければ Refused"""
    V = _V()
    _, z0, _, _ = W.sh.point(np.asarray(q5, np.float64))
    dz = float(z_target - z0)
    if dz < RISE_MIN_MM:
        return np.asarray(q5, np.float64).copy(), 0.0, 0.0
    q, err = W.sh.shift(np.asarray(q5, np.float64), np.zeros(2), dz)
    if q is not None:
        return np.asarray(q, np.float64), dz, 0.0
    q, pe, ae, back = V.lift_pose(W.w.chain, q5, dz)          # 持ち上げ (make_path の LIFT) と同じ: 届かなければ根もとへ引く
    if pe >= 1.0 or ae >= 2.0:
        raise Refused(f"真上へ戻る姿勢が解けない ({err}・位置 {pe:.1f} mm・向き {ae:.1f}°)")
    return np.asarray(q, np.float64), dz, float(back)


def segment(start6, keys_poses):
    """start6 から [(名前, 姿勢 (6), コマ数)] を min_jerk でつなぐ. → (道 (始めを含む), キーのコマ)"""
    V = _V()
    kp = [("START", np.asarray(start6, np.float64))] + [(n, np.asarray(p, np.float64)) for n, p, _ in keys_poses]
    return V.assemble(kp, [0] + [int(n) for _, _, n in keys_poses])


def check_steps_range(path, lo, hi):
    """→ 止める理由 (文字) か "" (run_rule401.build と同じ: 範囲・1 コマ 関節 10°・爪 20)"""
    V = _V()
    bad = []
    if not ((path >= lo - 1e-9) & (path <= hi + 1e-9)).all():
        j = sorted({R.MOTORS[i] for i in np.where(((path < lo) | (path > hi)).any(0))[0]})
        bad.append(f"道を作る範囲の外 ({', '.join(j)})")
    if len(path) > 1:
        d = np.abs(np.diff(path, axis=0))
        sj, sg = float(d[:, :5].max()), float(d[:, 5].max())
        if sj > V.STEP_LIMIT_DEG + 1e-9 or sg > V.STEP_LIMIT_GRIP + 1e-9:
            bad.append(f"1 コマ 関節 {sj:.2f}°・爪 {sg:.2f}")
    return " / ".join(bad)


def clear_after(path, fr, bxy, yaw, held, jaw_table_min):
    """コードの区間のシムの距離 (clear_345 の場面・下限). held: 挟んだ (持ったブロックを ABOVE_BOX まで爪に付ける) /
    False: 空のあと (fr に "OPENED". ブロックは置いた所. 爪と机は jaw_table_min (全区間). 腕とブロックは 閉じた所より・腕と机は 開いた所
    (上がる区間) より START_TOL_MM を超えて近づかない. 閉じた所で 腕とブロックが BLOCK_START_OVERLAP_MM より重なっていたら送らない.
    codex 405 R1 必須 2) / "connect": 渡す姿勢へ寄せる (ブロック +10 mm ≥ 0・腕と机 15 mm).
    → {"ok", "why", "dist"}"""
    import clear_345 as CL
    S = CL.scene()
    sc, geo = S.sc, S.geo
    n = len(path)
    dist = {}

    def keep(k, v):
        dist[k] = min(dist.get(k, np.inf), float(v))
    rel = S.held_rel(path[0]) if held is True else None
    for i in range(n):
        sc.pose(path[i])
        if held is True:
            if i <= fr["ABOVE_BOX"]:
                S.set_held(rel)
            else:
                sc.block([1000, 1000], 0)
            if i < fr["LIFT"]:
                keep("jaw_table", geo.dist(geo.jaw, geo.table))
            else:
                keep("arm_table", geo.dist(geo.arm, geo.table))
            if i <= fr["LIFT"] + CL.BASE_AFTER:
                keep("arm_base", geo.dist(geo.arm, geo.base))
            if i >= fr["LIFT"] and i <= fr["ABOVE_BOX"]:
                keep("held_table", geo.dist(geo.blk, geo.table))
            if i <= fr["ABOVE_BOX"]:
                keep("held_box", geo.dist(geo.blk, geo.box))
        else:
            sc.block(bxy, yaw)
            keep("jaw_table", geo.dist(geo.jaw, geo.table))
            keep("arm_base", geo.dist(geo.arm, geo.base))
            if held == "connect":
                keep("arm_table", geo.dist(geo.arm, geo.table))
                keep("arm_block_pad10", geo.dist(geo.arm, geo.blk) - CL.BLOCK_PAD_MM)
            else:
                keep("arm_block", geo.dist(geo.arm, geo.blk))
                if i == 0:
                    start = {"arm_block": dist["arm_block"]}
                t0 = fr.get("TABLE_FROM", fr["OPENED"])
                if i >= t0:                             # 上がる区間 (下で開く区間は 爪と机 jaw_table_min だけ. rule の GRASP_OPEN と同じ形)
                    keep("arm_table", geo.dist(geo.arm, geo.table))
                    if i == t0:
                        start["arm_table"] = dist["arm_table"]
        keep("arm_box", geo.dist(geo.arm, geo.box))
    sc.block([1000, 1000], 0)
    lim = {"jaw_table": float(jaw_table_min), "arm_table": CL.CLEAR_TABLE_MM, "arm_box": CL.CLEAR_BOX_MM, "arm_base": CL.CLEAR_BASE_MM,
           "held_table": CL.CLEAR_TABLE_MM, "held_box": CL.CLEAR_BOX_MM, "arm_block_pad10": 0.0}
    if held is False:
        # codex 405 R1 必須 2: 空のあと 開いて真上へ戻る道は 閉じた所 (π0.5 が来た所. もう机・ブロックのすぐそば) から始まるので,
        # 腕と机・腕とブロックは「始めより近づかない」(始めの値と 下限 (机 15 mm・ブロック 0 mm) の小さいほう − START_TOL_MM) を下限にする
        lim["arm_table"] = min(CL.CLEAR_TABLE_MM, start["arm_table"]) - START_TOL_MM
        lim["arm_block"] = min(0.0, start["arm_block"]) - START_TOL_MM
        dist.update({f"start_{k}": v for k, v in start.items()})
        if start["arm_block"] < -BLOCK_START_OVERLAP_MM:      # 閉じた爪が シムのブロックと始めから重なる = ブロックの位置が分からない
            dist["arm_block_start_overlap"] = start["arm_block"]
            lim["arm_block_start_overlap"] = -BLOCK_START_OVERLAP_MM
    bad = [f"{k} {v:.1f} mm (下限 {lim[k]:g})" for k, v in dist.items() if k in lim and v < lim[k]]
    return {"ok": not bad, "why": " / ".join(bad), "dist": {k: round(v, 1) for k, v in dist.items()}}


def reassemble(path, frames, replace):
    """道 (キーのコマ frames) のキー姿勢を replace {名前: 姿勢 (6)} に替えて min_jerk でつなぎ直す (コマ数は同じ)"""
    V = _V()
    names = sorted(frames, key=lambda k: frames[k])
    kp = [(n, np.asarray(replace.get(n, path[frames[n]]), np.float64)) for n in names]
    segs = [frames[names[0]]] + [frames[b] - frames[a] for a, b in zip(names, names[1:])]
    return V.assemble(kp, segs)


# ---- 1 試行 ------------------------------------------------------------------------------------------

class Switch:
    def __init__(self, args, lo, hi, out=print, clock=time.perf_counter, sleep=time.sleep, W=None, plan=None, prepare=None):
        """args: run_so101_policy の引数. lo, hi: 推論の安全範囲 (--raw-dir). W・plan・prepare はテストで差し替える"""
        import run_rule401 as RR
        self.RR, self.args, self.out, self.clock, self.sleep = RR, args, out, clock, sleep
        self.plo, self.phi = np.asarray(lo, np.float64), np.asarray(hi, np.float64)
        if plan is None:
            plan, self.rlo, self.rhi = RR.load_plan(RR.PLAN)
        else:
            plan, self.rlo, self.rhi = plan
        self.plan = plan
        self.W = W if W is not None else RR.world()
        self._prepare = prepare or RR.prepare
        self.retry_shift = float(getattr(args, "retry_shift_mm", 0.0) or 0.0)
        self.policy_max_s = float(getattr(args, "policy_max_s", POLICY_MAX_S) or POLICY_MAX_S)
        self.chunk_full = bool(getattr(args, "chunk_full", False))
        self.black_wrist = bool(getattr(args, "black_wrist", False))
        self.rise_first = bool(getattr(args, "retry_rise_first", False))
        self.info = {"status": "not_started", "attempts": [], "stop_where": "", "stop_why": "", "frames_code": 0, "frames_wait": 0,
                     "builds": [], "segments": []}
        self.rec, self.make_rec = None, None
        self.fake_reads = None              # テスト・偽の通し: 読むたびに 1 つずつ取り出す ((u, v, 向き) / "hidden" / "unreadable")
        self.red_px0 = None

    # ---- 記録 --------------------------------------------------------------------------------------
    def add(self, state, desk, wrist, action, sent, mode, *a, **k):
        if self.rec is None:
            self.rec = self.make_rec()
        self.rec.add(state, desk, wrist, action, sent, mode, *a, **k)
        if mode == R.CODE:
            self.info["frames_code"] += 1
        elif mode == R.WAIT:
            self.info["frames_wait"] += 1

    def _seg(self, name):
        self.info["segments"].append({"name": name, "start_frame": self.rec.n if self.rec is not None else 0})

    # ---- 読む・道を作る ------------------------------------------------------------------------------
    def _fake(self):
        if self.fake_reads is None:
            return None
        return self.fake_reads.pop(0) if self.fake_reads else "unreadable"

    def read_and_build(self, place, desk, at_rise=False):
        """読む → rule_401 の道 → ガード (run_rule401.prepare). at_rise: 戻った姿勢で読む (腕で隠れていたら None を返す).
        → (b, info) / None (隠れた). だめなら RR.Refused"""
        fake = self._fake()
        if fake == "hidden":
            return None
        if fake == "unreadable":
            raise self.RR.Refused("ブロックが読めない (偽の読み)")
        if at_rise and fake is None:
            import yaw_lib_343 as Y
            yr, why = Y.read_block(np.asarray(desk)[..., ::-1], self.W.w.cam)
            if yr is None or (self.red_px0 and yr["red_px"] < READ_KEEP_FRAC * self.red_px0):
                return None                 # 腕で隠れた (読めない・赤の面積が 1 回目の 85% 未満) → HOME へ戻ってから読む
        b, info = self._prepare(self.W, self.plan, place, self.rlo, self.rhi, desk, fake, self.args.place1_candidate,
                                tuple(self.args.allow_status), self.args.reselect_face)
        if self.red_px0 is None:
            self.red_px0 = (info.get("block_read") or {}).get("red_px")
        b = self._shift(b, info) if (self.retry_shift and self.info["attempts"]) else b
        a6 = b["path"][b["v"]["frames"]["ABOVE_BLOCK"]]
        if not ((a6 >= self.plo - 1e-9) & (a6 <= self.phi + 1e-9)).all():
            j = sorted({R.MOTORS[i] for i in np.where((a6 < self.plo) | (a6 > self.phi))[0]})
            x = self.RR.Refused(f"渡す姿勢が推論の安全範囲の外 ({', '.join(j)})")
            x.info = info
            raise x
        self.info["builds"].append({k: info.get(k) for k in ("place", "block_pixel", "block_yaw_deg", "pixel_from_plan_px", "status", "dz_mm",
                                                              "clearance_mm", "face_deg", "tilt_s_deg", "face_reselected", "retry_shift")})
        return b, info

    def _shift(self, b, info):
        """--retry-shift-mm: 渡し直す姿勢を 固定側の爪から離す向き (rule_401 の寄せと同じ向き) へ さらに寄せ, 道をつなぎ直して確かめる"""
        import clear_345 as CL
        W, v = self.W, b["v"]
        fr = v["frames"]
        a6 = b["path"][fr["ABOVE_BLOCK"]]
        a, _ = W.jaw_dir(b["path"][fr["GRASP_OPEN"]])
        q, err = W.sh.shift(a6[:5], a * self.retry_shift, 0.0)
        if q is None:
            raise self.RR.Refused(f"渡し直す姿勢を {self.retry_shift:g} mm 寄せられない: {err}")
        path, fr2 = reassemble(b["path"], fr, {"ABOVE_BLOCK": np.r_[q, a6[5]]})
        c = CL.check_path({"path": path, "frames": fr2}, b["bxy"], b["yaw"], jaw_table_min=self.plan.get("jaw_table_min_mm"))
        bad = check_steps_range(path, self.rlo, self.rhi) or ("" if c["ok"] else c["why"])
        if bad:
            raise self.RR.Refused(f"渡し直す姿勢を {self.retry_shift:g} mm 寄せた道がガードに当たる: {bad}")
        nb = dict(b, path=path)
        nb["v"] = dict(v, frames=fr2, pred_path=W.ar.predict(path))
        info["retry_shift"] = {"mm": self.retry_shift, "dir_xy": np.round(a, 3).tolist(), "clearance_mm": c["dist"]}
        return nb

    # ---- 送る ----------------------------------------------------------------------------------------
    def _send_path(self, runner, arm, keys, path, pred, name, on_frame=None):
        """道を 30fps で送りながら録る (ptm.mode = CODE. run_rule401.Runner.run の道の所と同じ: スペース・q・追従の差 10° で止める).
        on_frame(i, state) が文字を返したら その場で止める. → True (全部送った) / 止めた理由"""
        self._seg(name)
        path = np.asarray(path, np.float64)
        nxt = self.clock()
        for i, target in enumerate(path):
            if runner.stop_key(f"{name} の {i} コマ目"):
                return runner.info["stopped"]
            state, desk, wrist = arm.observe()
            if pred is not None and i > 0:
                dt = float(np.abs(np.asarray(state, np.float64)[:5] - np.asarray(pred[i - 1], np.float64)[:5]).max())
                if dt > self.RR.TRACK_STOP_DEG:
                    runner.hold_here()
                    runner._stopped(f"{name} の {i} コマ目で 実際の関節が予想から {dt:.1f}° (許し {self.RR.TRACK_STOP_DEG:g}°)")
                    return runner.info["stopped"]
            if on_frame is not None:
                why = on_frame(i, state)
                if why:
                    runner.hold_here()
                    runner._stopped(why)
                    return why
            current = arm.read_currents() if hasattr(arm, "read_currents") else None
            sent = runner.send(target, count=True)
            self.add(state, desk, wrist, target, sent, R.CODE, **({"current": current} if current is not None else {}))
            nxt = self.RR._pace(nxt, self.clock, self.sleep)
        return True

    def _to_handover(self, runner, arm, keys, b):
        """HOME → 渡す所 (rule_401 の道の ABOVE_BLOCK まで. Runner.run と同じ) → 渡す所で待つ. → True / False (止めた)"""
        fr = b["v"]["frames"]
        a = fr["ABOVE_BLOCK"]
        self._seg("code_to_above")
        if not runner.run(b["path"][:a + 1], np.asarray(b["v"]["pred_path"])[:a + 1]):
            return False
        return self._wait_handover(runner, arm, keys, b["path"][a])

    def _wait_handover(self, runner, arm, keys, last):
        import handover_392 as H
        self._seg("wait")
        state, _, _ = arm.observe()
        prev, speeds, n = H._tcp(self.W.w.chain, state), [], 0
        nxt = self.clock()
        while n < H.WAIT_MAX:
            if runner.stop_key(f"渡す所の {n} コマ目"):
                return False
            state, desk, wrist = arm.observe()
            tcp = H._tcp(self.W.w.chain, state)
            speeds.append(round(float(np.linalg.norm(tcp - prev) * R.FPS), 2))
            prev = tcp
            current = arm.read_currents() if hasattr(arm, "read_currents") else None
            sent = runner.send(last)
            self.add(state, desk, wrist, last, sent, R.WAIT, **({"current": current} if current is not None else {}))
            n += 1
            nxt = self.RR._pace(nxt, self.clock, self.sleep)
            if n >= H.WAIT_MIN and speeds[-1] < H.SETTLE_MM_S:
                break
        self.cur_wait = {"frames": n, "speeds_mm_s": speeds}
        return True

    def _policy(self, arm, gate, keys, grip0):
        """π0.5 の区間 (run_trial をそのまま). → (kind, watch). kind: closed / timeout / quit"""
        a = self.args
        self._seg("policy")
        w = _Watch(self.add, self.policy_max_s, grip0, self.clock)
        try:
            R.run_trial(arm, gate, w, self.plo, self.phi, None if self.chunk_full else a.exec_steps, keys,
                        prefetch=not (self.chunk_full or a.no_prefetch), skip_confirm=True, play_speed=a.play_speed,
                        rtc=False, blend=a.blend, max_step=a.max_step_deg, out=self.out, clock=self.clock, sleep=self.sleep)
            return "quit", w
        except Takeover as t:
            return t.kind, w

    def _close_and_judge(self, runner, arm, keys):
        """関節 5 つは最後に送った値・爪を GRASP_CLOSED へ. 読みが落ち着いたら判定. → judge の答え / 止めた理由 (文字)"""
        V = _V()
        self._seg("judge")
        hold = np.asarray(arm.last_sent, np.float64).copy()
        g0 = float(hold[5])
        reads, cur = [], []
        nxt = self.clock()
        i = 0
        while True:
            if runner.stop_key(f"判定の {i} コマ目"):
                return runner.info["stopped"]
            state, desk, wrist = arm.observe()
            current = arm.read_currents() if hasattr(arm, "read_currents") else None
            t = hold.copy()
            t[5] = g0 + (V.GRIP["GRASP_CLOSED"] - g0) * min(1.0, (i + 1) / CLOSE_RAMP)
            sent = runner.send(t)
            self.add(state, desk, wrist, t, sent, R.CODE, **({"current": current} if current is not None else {}))
            reads.append(float(state[5]))
            if current is not None and "gripper" in getattr(arm, "current_motors", []):
                cur.append(float(current[list(arm.current_motors).index("gripper")]))
            r = judge_reading(reads)
            i += 1
            nxt = self.RR._pace(nxt, self.clock, self.sleep)
            if r is not None:
                r.update(state=np.round(state, 3).tolist(), hold=np.round(t, 3).tolist(), reads=np.round(reads, 2).tolist(),
                         grip_current=(round(float(np.median(cur[-JUDGE["n"]:])), 1) if cur else None))
                return r

    def _held(self, runner, arm, keys, b, att):
        """挟んだ: 持ち上げ → 箱 → 離す → HOME. 持ち上げで爪をもう一度見る"""
        hold = np.asarray(arm.last_sent, np.float64)
        try:
            path, fr, inf = after_held_path(self.W.w.chain, hold[:5])
        except Refused as x:
            return self._end("lift_refused", "持ち上げ", str(x), runner)
        bad = check_steps_range(path, self.rlo, self.rhi)
        if inf["carry_z_min_mm"] < _V().CARRY_Z_MIN_MM:
            bad = (bad + " / " if bad else "") + f"運ぶ間の手先が低い ({inf['carry_z_min_mm']} mm)"
        c = clear_after(path, fr, b["bxy"], b["yaw"], True, self.plan.get("jaw_table_min_mm", -11.0))
        att["after_path"] = {"frames": len(path), "keyframes": {k: int(v) for k, v in fr.items()}, "clearance_mm": c["dist"], **inf}
        if bad or not c["ok"]:
            return self._end("lift_refused", "持ち上げ", f"持ち上げの道がガードに当たる: {bad or c['why']}", runner)
        state, _, _ = arm.observe()
        pred = self.W.ar.predict(path, y0=np.asarray(state, np.float64))
        reads = []

        def check(i, st):
            reads.append(float(st[5]))
            if i == fr["LIFT"]:
                ok, g = lift_ok(reads)
                att["lift_grip"] = round(g, 2)
                if not ok:
                    att["dropped"] = True
                    return f"持ち上げ (LIFT) で爪の読み {g:.1f} が 挟んだの幅 ({HELD_MIN:g}〜{HELD_MAX:g}) の外: 落とした"
            return ""
        r = self._send_path(runner, arm, keys, path, pred, "code_after_held", check)
        self.info["after_held_path"] = np.round(path, 3).tolist()
        if r is True:
            self.info["status"] = "carried"
            return True
        return self._end("dropped" if att.get("dropped") else "stopped", "持ち上げ〜戻る", r, runner, held_done=True)

    def _open_rise(self, runner, arm, keys, b, att, open_g):
        """空・あいまい: 爪を開き, 真上へ 渡す所の高さまで戻る. → (True, 戻った姿勢 (6)) / (False, 理由)"""
        V = _V()
        hold = np.asarray(arm.last_sent, np.float64).copy()
        a6 = b["path"][b["v"]["frames"]["ABOVE_BLOCK"]]
        g_open = float(np.clip(open_g if open_g is not None else a6[5], hold[5], self.rhi[5]))
        _, z_above, _, _ = self.W.sh.point(a6[:5])
        try:
            q_up, dz, back = rise_pose(self.W, hold[:5], z_above)
        except Refused as x:
            return False, str(x)
        n_rise = max(1, int(np.ceil(dz / RISE_MM_PER_FRAME))) if dz > 0 else 1
        if self.rise_first:              # --retry-rise-first: 閉じたまま真上へ → 上で開く (腕と机は 閉じた所から見る)
            path, fr = segment(hold, [("RISEN", np.r_[q_up, hold[5]], n_rise), ("OPENED", np.r_[q_up, g_open], OPEN_FRAMES)])
            fr = dict(fr, TABLE_FROM=0)
        else:                            # 依頼の形: 下で開く → 真上へ (腕と机は 開いた所から見る)
            path, fr = segment(hold, [("OPENED", np.r_[hold[:5], g_open], OPEN_FRAMES), ("RISEN", np.r_[q_up, g_open], n_rise)])
        bad = check_steps_range(path, self.rlo, self.rhi)
        c = clear_after(path, fr, b["bxy"], b["yaw"], False, self.plan.get("jaw_table_min_mm", -11.0))
        att["open_rise"] = {"order": "rise_first" if self.rise_first else "open_first", "open_grip": round(g_open, 2), "rise_mm": round(dz, 1),
                            "rise_back_mm": back, "frames": len(path), "clearance_mm": c["dist"]}
        if bad or not c["ok"]:
            return False, f"{'閉じたまま上がって開く' if self.rise_first else '開いて真上へ戻る'}道がガードに当たる: {bad or c['why']}"
        state, _, _ = arm.observe()
        r = self._send_path(runner, arm, keys, path, self.W.ar.predict(path, y0=np.asarray(state, np.float64)), "code_open_rise")
        if r is not True:
            return False, r
        return True, path[-1]

    def _go_home(self, runner, arm, keys, b, up6, att):
        """戻った姿勢 → 前の渡す姿勢 → 来たコードの道を逆に HOME へ"""
        V = _V()
        fr = b["v"]["frames"]
        code = b["path"][:fr["ABOVE_BLOCK"] + 1]
        con, cfr = segment(up6, [("ABOVE_BLOCK", code[-1], V.DETOUR_BACK)])
        path = np.vstack([con, code[::-1][1:]])
        bad = check_steps_range(path, self.rlo, self.rhi)
        c = clear_after(con, cfr, b["bxy"], b["yaw"], "connect", self.plan.get("jaw_table_min_mm", -11.0))
        att["go_home"] = {"frames": len(path), "clearance_connect_mm": c["dist"]}
        if bad or not c["ok"]:
            return f"前の渡す姿勢へ戻る道がガードに当たる: {bad or c['why']}"
        state, _, _ = arm.observe()
        return self._send_path(runner, arm, keys, path, self.W.ar.predict(path, y0=np.asarray(state, np.float64)), "code_go_home")

    def _confirm(self, info, inp, runner):
        """やり直しの道が 決まりの外の口 (status が ok でない・場所1 の候補) を使うときは 1 回目と同じく yes を聞く (腕は止めたまま)"""
        if info.get("status") == "ok" and not info.get("from_candidate"):
            return True
        runner.hold_here()
        return inp("やり直しの道も 決まりの外の口を使います. 流すなら yes と打つ > ").strip() == "yes"

    def _end(self, status, where, why, runner=None, held_done=False):
        self.info.update(status=status, stop_where=where, stop_why=str(why))
        self.out(f"\033[1;37;41m[SW405 ] {STATUS.get(status, status)}: {where}. {why}\033[0m")
        return False

    def run(self, arm, policy, keys, place, skip_confirm=False, inp=input):
        """1 試行. → status (self.info["status"]). 動かす前に止めたら RR.Refused を投げる"""
        RR, out = self.RR, self.out
        _, desk, _ = arm.observe()
        b, info = self.read_and_build(place, desk)
        self.info["first"] = info
        RR.print_summary(info, True, "")
        loosened = [x for x in (f"status {info.get('status')} (--allow-status)" if info.get("status") != "ok" else "",
                                "場所1 の候補の置き方 (--place1-candidate)" if info.get("from_candidate") else "") if x]
        if loosened:
            out(f"\033[1;33m[SW405 ] この回は 決まりの外の口を使います: {' / '.join(loosened)}\033[0m")
            if inp("流すなら yes と打つ > ").strip() != "yes":
                raise RR.Refused("yes でないので動かしません")
        elif not skip_confirm:
            inp("Enter で始める (Ctrl-C でやめる) > ")
        gate = self.gate = Gate(policy, self.black_wrist)
        getattr(keys, "start", lambda: None)()
        runner = RR.Runner(arm, self, keys, CODE_MAX_STEP, out=out, clock=self.clock, sleep=self.sleep)
        self.runner = runner
        self.info["status"] = "stopped"
        if not self._to_handover(runner, arm, keys, b):
            return self._end("stopped", "HOME → 渡す所", runner.info.get("stopped"))
        attempt = 0
        while True:
            attempt += 1
            att = {"attempt": attempt, "handover_pose": np.round(b["path"][b["v"]["frames"]["ABOVE_BLOCK"]], 3).tolist(),
                   "block_pixel": np.round(b["uv"], 1).tolist(), "block_yaw_deg": b["yaw"], "block_xy_mm": np.round(b["bxy"], 1).tolist(),
                   "wait": getattr(self, "cur_wait", None)}
            self.info["attempts"].append(att)
            self.cur_b = b
            out(f"[SW405 ] {attempt} 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 {self.policy_max_s:g} 秒"
                f"{'. 答えを流し切る' if self.chunk_full else ''}{'. 手首の絵を黒くして渡す' if self.black_wrist else ''})")
            kind, w = self._policy(arm, gate, keys, b["path"][b["v"]["frames"]["ABOVE_BLOCK"]][5])
            att.update(policy_frames=w.n_model, policy_all_frames=w.n_all, policy_end=kind, policy_s=round(w.elapsed(), 2),
                       first_model=(None if w.first is None else {"target": np.round(w.first[0], 3).tolist(),
                                                                   "sent": np.round(w.first[1], 3).tolist()}))
            if kind == "quit":                   # codex 405 R1 必須 4: run_trial の q は抜けるだけなので その場で止める目標を送る
                runner.hold_here()
                return self._end("policy_quit", f"{attempt} 回目の π0.5", "q で止めた")
            if kind == "timeout":
                runner.hold_here()
                return self._end("not_closed", f"{attempt} 回目の π0.5", f"{self.policy_max_s:g} 秒たっても閉じない")
            j = self._close_and_judge(runner, arm, keys)
            if isinstance(j, str):
                return self._end("stopped", f"{attempt} 回目の判定", j)
            att["judge"] = j
            out(f"[SW405 ] {attempt} 回目の判定: {j['class']} (爪の読み {j['grip']:.1f}・{j['frames']} コマ"
                f"{'' if j['settled'] else '・落ち着かない'})")
            if j["class"] == "held":
                self._held(runner, arm, keys, b, att)
                return self.info["status"]
            ok, up = self._open_rise(runner, arm, keys, b, att, w.open_grip())
            if not ok:
                if runner.info.get("stopped"):
                    return self._end("stopped", f"{attempt} 回目の 空のあと", up)
                runner.hold_here()
                return self._end("retry_refused", f"{attempt} 回目の 空のあと", up)
            if attempt >= MAX_ATTEMPTS:
                runner.hold_here()
                return self._end("missed_max", f"{attempt} 回目", f"{MAX_ATTEMPTS} 回外した")
            # 読み直す (戻った所. 隠れた・読めない・道が作れない・ガードに当たる は HOME へ戻ってから読み直す)
            _, desk, _ = arm.observe()
            try:
                got = self.read_and_build(place, desk, at_rise=True)
            except RR.Refused as x:
                att["reread_rise_refused"] = str(x)
                got = None
            route = None
            if got is not None and not self._confirm(got[1], inp, runner):
                return self._end("retry_refused", "読み直し (戻った所)", "yes でない")
            if got is not None:
                nb, ninfo = got
                na6 = nb["path"][nb["v"]["frames"]["ABOVE_BLOCK"]]
                con, cfr = segment(up, [("ABOVE_BLOCK", na6, _V().DETOUR_BACK)])
                bad = check_steps_range(con, self.rlo, self.rhi)
                c = clear_after(con, cfr, nb["bxy"], nb["yaw"], "connect", self.plan.get("jaw_table_min_mm", -11.0))
                att["reread"] = {"where": "rise", "info": {k: ninfo.get(k) for k in ("block_pixel", "block_yaw_deg", "status")},
                                 "connect_clearance_mm": c["dist"], "connect_bad": bad or c["why"]}
                if not bad and c["ok"]:
                    route = "direct"
                    state, _, _ = arm.observe()
                    r = self._send_path(runner, arm, keys, con, self.W.ar.predict(con, y0=np.asarray(state, np.float64)), "code_to_new_above")
                    if r is not True:
                        return self._end("stopped", "新しい渡す所へ", r)
                    if not self._wait_handover(runner, arm, keys, na6):
                        return self._end("stopped", "渡す所で待つ", runner.info.get("stopped"))
                    b = nb
            if route is None:
                route = "home"
                r = self._go_home(runner, arm, keys, b, up, att)
                if r is not True:
                    if runner.info.get("stopped"):
                        return self._end("stopped", "HOME へ戻る", r)
                    runner.hold_here()
                    return self._end("retry_refused", "HOME へ戻る", r)
                _, desk, _ = arm.observe()
                try:
                    got = self.read_and_build(place, desk)
                except RR.Refused as x:
                    runner.hold_here()
                    return self._end("retry_refused", "読み直し (HOME)", x)
                if got is None:
                    runner.hold_here()
                    return self._end("retry_refused", "読み直し (HOME)", "HOME でもブロックが読めない")
                b, ninfo = got
                att["reread_home"] = {k: ninfo.get(k) for k in ("block_pixel", "block_yaw_deg", "status")}
                if not self._confirm(ninfo, inp, runner):
                    return self._end("retry_refused", "読み直し (HOME)", "yes でない")
                try:
                    went = self._to_handover(runner, arm, keys, b)
                except RR.Refused as x:          # HOME から離れている・道の 1 コマが上限を超える (送る前に止める)
                    runner.hold_here()
                    return self._end("retry_refused", "HOME → 渡す所 (やり直し)", x)
                if not went:
                    return self._end("stopped", "HOME → 渡す所 (やり直し)", runner.info.get("stopped"))
            att["route"] = route

    # ---- 台帳・記録 --------------------------------------------------------------------------------
    def close_points(self):
        """閉じた所 (判定で読んだ姿勢) の爪の間の点 (依頼 376 の lib_376. ブロックに対して 右・奥・机からの高さ mm). 計算だけ"""
        try:
            import lib_376 as L
            arm, _, _ = L.setup()
        except Exception as x:          # シムが開けなくても記録は書く
            return [f"({type(x).__name__})"] * len(self.info["attempts"])
        out = []
        for a in self.info["attempts"]:
            j = a.get("judge")
            if not j:
                out.append("")
                continue
            c = arm.center(j["state"])
            r = L.rel(np.atleast_2d(c), np.asarray(a["block_xy_mm"]))[0]
            a["close_point_rel_mm"] = np.round(r, 1).tolist()
            out.append(",".join(f"{x:.1f}" for x in r))
        return out

    def row(self, points=None):
        i, at = self.info, self.info["attempts"]
        js = [a.get("judge") or {} for a in at]
        bp = (i.get("first") or {}).get("block_pixel") or ["", ""]
        return {"sw_status": i["status"], "sw_attempts": len(at), "sw_retries": max(0, len(at) - 1),
                "sw_judges": "|".join(j.get("class", "") for j in js),
                "sw_grip_reads": "|".join("" if not j else f"{j['grip']:.2f}" for j in js),
                "sw_grip_currents": "|".join("" if j.get("grip_current") is None else f"{j['grip_current']:g}" for j in js),
                "sw_judge_frames": "|".join(str(j.get("frames", "")) for j in js),
                "sw_close_points": "|".join(points or []), "sw_policy_frames": "|".join(str(a.get("policy_frames", "")) for a in at),
                "sw_stop_where": i["stop_where"], "sw_stop_why": i["stop_why"][:300], "sw_frames_code": i["frames_code"],
                "sw_frames_wait": i["frames_wait"], "sw_block_u": bp[0], "sw_block_v": bp[1],
                "sw_block_yaw_deg": (i.get("first") or {}).get("block_yaw_deg", ""), "sw_chunk_full": int(self.chunk_full),
                "sw_black_wrist": int(self.black_wrist), "sw_retry_shift_mm": self.retry_shift, "sw_policy_max_s": self.policy_max_s,
                "sw_plan_file": PLAN_FILE, "sw_rise_first": int(self.rise_first)}

    def doc(self):
        d = {"request": 405, "what": "切り替え方式 (コード → π0.5 → コード) の 1 試行. 判定・やり直し・コードの道",
             "joints": R.MOTORS, "fps": R.FPS, "judge": JUDGE, "cmd_open": CMD_OPEN, "cmd_close": CMD_CLOSE, "max_attempts": MAX_ATTEMPTS,
             "plan_sha256": self.RR.sha256(self.RR.PLAN), **json.loads(json.dumps(self.info, default=_js))}
        return d


def _js(x):
    if hasattr(x, "tolist"):
        return x.tolist()
    if isinstance(x, (np.floating, np.integer)):
        return x.item()
    return str(x)


# ---- 入口 (run_so101_policy.py --switch-405 から) ---------------------------------------------------

def execute(args, arm_factory=None, policy=None, keys=None, inp=input, switch=None, local_root=None, kioxia_check=True):
    """1 試行を流して記録・台帳を書く (run_rule401.execute と同じ止め方・後始末). → 終了コード.
    arm_factory・policy・keys・switch・local_root はテスト・偽の通しで差し替える"""
    import run_rule401 as RR
    log_dir = Path(args.log_dir)
    if args.execute and kioxia_check:
        bad = RR.kioxia_bad(log_dir)
        if bad:
            sys.exit(f"[ERROR] {bad}")
    elif not log_dir.is_dir():
        sys.exit(f"[ERROR] 記録の置き場所がない: {log_dir}")
    lo, hi, n_eps = R.load_safe_range(args.raw_dir)
    print(f"[RANGE ] 推論の安全範囲 (学習の {n_eps} 本 ±{R.RANGE_MARGIN:g}) " +
          "  ".join(f"{m} {a:.1f}〜{b:.1f}" for m, a, b in zip(R.MOTORS, lo, hi)))
    place = args.place or R.ask_place()
    try:
        sw = switch or Switch(args, lo, hi)                 # アームを開く前に 割り振り・シムを読む
    except RR.Refused as x:
        sys.exit(f"[ERROR] --switch-405: {x}")
    stamp = datetime.now().strftime("%Y%m%d_%H%M%S")
    trial = f"so101_{stamp}{'' if args.execute else '_dry'}"
    local = Path(local_root or R.LOCAL_RUNS) / log_dir.name / trial
    local.parent.mkdir(parents=True, exist_ok=True)
    if local_root is None:
        import lerobot_safe_259 as safe
        safe.check_dataset_root(local)
    if local.exists():
        sys.exit(f"[ERROR] ローカルの記録がもうある: {local}")
    current_motors = R.CURRENT_SETS[args.currents] if args.execute else []
    pol = policy or R.Policy(args.port)
    made = []

    def make_rec():
        made.append(R.Recorder(local, f"local/{trial}", current_motors=current_motors, blend=args.blend > 0, max_step=args.max_step_deg))
        return made[0]
    sw.make_rec = make_rec
    arm, err, result, reason, held = None, "", "", "", False
    try:
        arm = arm_factory() if arm_factory else (R.LiveArm(current_motors) if args.execute else R.DryArm())
        kr = keys if keys is not None else R.KeyReader()
        with kr as k:
            try:
                sw.run(arm, pol, k, place, skip_confirm=args.skip_first_confirm, inp=inp)
            except RR.Refused as x:
                sw.info.update(status="refused", stop_why=str(x))
                RR.print_summary(getattr(x, "info", {}), False, str(x))
                print(f"\n\033[1;37;41m   動かしません: {x}   \033[0m")
    except KeyboardInterrupt:
        err, held = "Ctrl-C", True
        print("\n[STOP  ] Ctrl-C で止めました")
        RR.safe_hold(arm)
    except Exception as x:
        err, held = f"{type(x).__name__}: {x}", True
        print(f"\n[STOP  ] 失敗で止まりました: {err}")
        RR.safe_hold(arm)
    finally:
        rec = made[0] if made else None
        close_failed = False
        try:
            st = sw.info.get("status")
            if rec is not None and rec.n and not err:
                if st == "carried":
                    result = R.ask_result(inp)
                    reason = R.ask_fail_reason(inp) if result == "failure" else ""
                elif st in AUTO_FAIL:
                    result, reason = "failure", AUTO_FAIL[st]
        except BaseException as x:
            result, reason = "", ""
            print(f"\n[STOP  ] 結果を聞く間に {type(x).__name__}")
            if not held:
                held = True
                RR.safe_hold(arm)
        try:
            try:
                if rec is not None:
                    rec.close()
            except BaseException as x:
                err = err or f"記録を閉じる間に {type(x).__name__}: {x}"
                rec, close_failed = None, True
                print(f"\n[STOP  ] {err}")
                if not held:
                    held = True
                    RR.safe_hold(arm)
        finally:
            try:
                if getattr(sw, "gate", None) is not None:
                    sw.gate.close()
                pol.close()
            finally:
                if arm is not None:
                    arm.close()
    if rec is None or not rec.n:                 # 送る前に止めた (台帳に書かない)
        if close_failed:
            print(f"[ERROR] 記録を閉じられない. ローカル {local} を見てください (台帳には書いていません)")
            return 1
        if local_root is None:
            RR.drop_empty_local(local, existed=False)
        print(f"[SW405 ] 送る前に止めたので 台帳に書きません ({err or sw.info.get('stop_why')})")
        return RR.EXIT_REFUSED if (err or sw.info.get("status") == "refused") else 0
    if args.execute and kioxia_check:
        bad = RR.kioxia_bad(log_dir)
        if bad:
            print(f"[ERROR] {bad}. 記録はローカル {local} に残っています (台帳には書いていません)")
            return 1
    dst = log_dir / "so101" / trial
    dst.parent.mkdir(parents=True, exist_ok=True)
    n_files = R.copy_record(local, dst)
    modes = rec.modes
    med, mx = R.latency_stats(pol.latencies)
    row = {"trial": trial, "started_at": stamp, "operator": R.operator_of(modes), "place": place, "model": args.model, "step": args.step,
           "exec_steps": "" if sw.chunk_full else (args.exec_steps or ""), "execute": int(args.execute), "result": result,
           "frames": len(modes), "frames_model": modes.count(R.MODEL), "frames_correct": modes.count(R.CORRECT),
           "frames_pause": modes.count(R.PAUSE), "queries": len(pol.latencies),
           "latency_median_s": "" if med is None else round(med, 3), "latency_max_s": "" if mx is None else round(mx, 3),
           "record_dir": str(dst), "prefetch": int(not (sw.chunk_full or args.no_prefetch)), "fail_reason": reason,
           "currents": args.currents, "play_speed": args.play_speed, "rtc": 0, "blend": args.blend, "max_step_deg": args.max_step_deg}
    pts = sw.close_points()
    row.update(sw.row(pts))
    R.append_trial(log_dir / R.TRIALS_CSV, row, columns=R.TRIAL_COLUMNS + SWITCH_COLUMNS)
    (dst / PLAN_FILE).write_text(json.dumps(sw.doc(), ensure_ascii=False) + "\n")
    (dst / "trial.json").write_text(json.dumps({**row, "switch405": sw.doc(), "latencies_s": [round(x, 4) for x in pol.latencies],
                                                 "stopped_by": err, "safe_range": {"lo": lo.tolist(), "hi": hi.tolist()}},
                                                ensure_ascii=False, indent=2, default=_js) + "\n")
    print(f"[RECORD] {dst} ({n_files} ファイル) / 1 行 → {log_dir / R.TRIALS_CSV}")
    print(f"[SW405 ] {sw.info['status']} ({STATUS.get(sw.info['status'], '')}). 渡した {len(sw.info['attempts'])} 回・判定 "
          f"{row['sw_judges'] or '-'}・爪の読み {row['sw_grip_reads'] or '-'}")
    return 0
```

### so101/check_405/session_405.sh

```bash
#!/bin/bash
# 依頼 405: 切り替え方式 (コード → π0.5 → コード) に 握れたかの判定とやり直しを足したもの (run_so101_policy.py --switch-405) を
#   実機で流す案内. エイイチの確かめのあとに使う (アームを動かす). サーバー (so101h) は別の窓で先に立てておく:
#     ./lab_start.sh --model so101h --log so101_Log12 --serve-only
#   1 回 = run_so101_policy.py --switch-405 --execute を 1 度. 場所ごとに N 回 (既定 6). 台帳は KIOXIA lab/so101_Log12/so101_trials.csv
#   (TRIAL_COLUMNS + switch_405.SWITCH_COLUMNS. 結果は 運んだ回だけ聞く. 落とした・2 回外した・閉じなかった・やり直せない は失敗として自動で書く).
#   途中で止めて打ち直すと, 台帳で済んだ回 (この MODEL で sw_status があり 結果のある回) を数えて続ける.
#   ブロックは目印 (場所の番号の所) に まっすぐ (0°) 置く (session_401 と同じ). 読めない・目印から 10 画素・向き ±8° → 動かさずに止まる.
#
#   ./so101/check_405/session_405.sh --first      場所 (PLACES の最初. 既定 3) を 1 回だけ流して止める
#   ./so101/check_405/session_405.sh              PLACES × N 回
#   ガードの値・口は run_rule401.py と同じ環境変数: R401_PUSH_LIMIT_MM・R401_PUSH_WINDOW_MM・R401_PIXEL_TOL_PX・R401_YAW_TOL_DEG・
#     R401_START_TOL_DEG・R401_ALLOW_CONFLICT=1・R401_ALLOW_DEEP=1・R401_RESELECT=1・R401_PLACE1=1・R401_CMD_FIRST=1 (依頼 407 の A)
#   依頼 405 の口: SW405_CHUNK_FULL=1 (答えを流し切る)・SW405_BLACK_WRIST=1 (手首の絵を黒く. 確かめ用)・SW405_RETRY_SHIFT_MM=X (既定 0)・
#     SW405_POLICY_MAX_S=X (既定 8)・SW405_RISE_FIRST=1 (空のあと 閉じたまま上がってから開く)
set -u
HERE="$(cd "$(dirname "$0")/../.." && pwd)"
cd "$HERE" || exit 1
PY=${PY:-/opt/homebrew/Caskroom/miniforge/base/envs/lerobot/bin/python}
LOG=/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12
RAW=${RAW:-/Volumes/KIOXIA/r2r2r-data/datasets/so101_redblock_box_code_rule401_grasp_v1/raw_episodes}   # so101h の学習データ (推論の安全範囲)
MODEL=${MODEL:-"so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1)"}
STEP=${STEP:-2999}
PLACES=${PLACES:-"3"}
N=${N:-6}
MODE=run; [ "${1:-}" = --first ] && MODE=first
EXTRA=(); [ "${R401_PLACE1:-0}" = 1 ] && EXTRA+=(--place1-candidate)
ST=(); [ "${R401_ALLOW_CONFLICT:-0}" = 1 ] && ST+=(conflict); [ "${R401_ALLOW_DEEP:-0}" = 1 ] && ST+=(deep_at_zero)
[ ${#ST[@]} -gt 0 ] && EXTRA+=(--allow-status "${ST[@]}")
[ "${R401_RESELECT:-0}" = 1 ] && EXTRA+=(--reselect-face)
[ "${R401_CMD_FIRST:-0}" = 1 ] && echo "[INFO] R401_CMD_FIRST=1: コードの道の つかむ所の下げ方を A にする (渡す姿勢が少し変わることがある. π0.5 の下り方は変わらない)"
[ "${SW405_CHUNK_FULL:-0}" = 1 ] && EXTRA+=(--chunk-full)
[ "${SW405_BLACK_WRIST:-0}" = 1 ] && EXTRA+=(--black-wrist)
[ "${SW405_RISE_FIRST:-0}" = 1 ] && EXTRA+=(--retry-rise-first)
[ -n "${SW405_RETRY_SHIFT_MM:-}" ] && EXTRA+=(--retry-shift-mm "$SW405_RETRY_SHIFT_MM")
[ -n "${SW405_POLICY_MAX_S:-}" ] && EXTRA+=(--policy-max-s "$SW405_POLICY_MAX_S")
export SO101_VAR_ROLL_RANGE=-67,58

[ -d "$LOG" ] || { echo "[ERROR] KIOXIA がつながっていない: $LOG"; exit 1; }
[ -d "$RAW" ] || { echo "[ERROR] 推論の安全範囲を作る学習データがない: $RAW"; exit 1; }
[ -f so101/check_401/plan_401.json ] || { echo "[ERROR] 割り振りがない: so101/check_401/plan_401.json"; exit 1; }

done_n() {   # 台帳で その場所の この MODEL の 切り替え方式 (sw_status がある) の 結果のある回 (y/n) を数える
    "$PY" - "$LOG/so101_trials.csv" "$1" "$MODEL" <<'EOF'
import csv, sys
sys.path.insert(0, "so101"); sys.path.insert(0, "so101/check_405")
import run_so101_policy as R
import switch_405 as SW
cols = R.TRIAL_COLUMNS + SW.SWITCH_COLUMNS
n = 0
try:
    with open(sys.argv[1], newline="") as f:
        for row in list(csv.reader(f))[1:]:
            r = dict(zip(cols, row))
            if (r["model"] == sys.argv[3] and r["place"] == sys.argv[2] and r["execute"] == "1" and r.get("sw_status")
                    and len(row) == len(cols) and r["result"] in ("success", "failure")):
                n += 1
except FileNotFoundError:
    pass
print(n)
EOF
}

big() { printf '\n\033[1;33m==================================================\n  %s\n==================================================\033[0m\n' "$1"; }

first=1
for round in $(seq 1 "$N"); do
    for p in $PLACES; do
        while [ "$(done_n "$p")" -lt "$round" ]; do      # 動かさずに止まった・結果のない回は 同じ回をやり直す
            d=$(done_n "$p")
            big "場所$p の $((d + 1)) 回目 (全 $N 回): ブロックを 場所$p の目印に まっすぐ置いて Enter (q で終わる)"
            read -r a
            [ "$a" = q ] && exit 0
            args=(--switch-405 --execute --place "$p" --log-dir "$LOG" --raw-dir "$RAW" --model "$MODEL" --step "$STEP"
                  --exec-steps 30 --play-speed 1.0 --blend 10 --max-step-deg 5 --currents off ${EXTRA[@]+"${EXTRA[@]}"})
            [ $first = 0 ] && args+=(--skip-first-confirm)
            "$PY" so101/run_so101_policy.py "${args[@]}"
            rc=$?
            first=0
            if [ $rc = 3 ]; then
                echo "[INFO] 動かさずに止まった (置き直してもう一度)"
            elif [ $rc != 0 ]; then
                echo "[ERROR] 止まった (終了コード $rc). 続けるなら打ち直す"; exit $rc
            fi
            if [ $MODE = first ]; then
                echo "[INFO] --first: 1 回で止めます. 記録を見てから 続きを打つ: ./so101/check_405/session_405.sh"
                exit 0
            fi
        done
    done
done
big "済み: $(for p in $PLACES; do printf '場所%s %s 回  ' "$p" "$(done_n "$p")"; done)"
```

### so101/check_405/analyze_405.py

```python
#!/usr/bin/env python3
"""依頼 405: 握れたかの判定 (爪の読み) の境目を 記録から決め, 記録に当てて取り違えを数える (読むだけ・アームなし).

使う記録 (KIOXIA は読むだけ):
  - so101f の実機 30 回・so101g の実機 7 回 (台帳 so101_trials.csv の結果 y/n のある回. 記録の observation.state・action)
  - お手本 64 本 (datasets/so101_redblock_box_ideal_var_v2_success_recover_v1. success 50 本・recover 14 本. episode.npz の state・actions)
  - 参考: code_rule401 の実機 56 回 (依頼 401. 成功の回だけ)
閉じた所: 爪の指令 (action) が 開き (CMD_OPEN 25 以上) のあと CMD_CLOSE (20) を割った最初のコマ k. そのうち つかむ高さ
  (手先 (URDF) の z が GRASP_Z_MAX 70 mm 未満) のものだけ (箱で離したあと HOME で閉じるのは数えない)
本当の答え (truth): k + 8 コマから k + 60 コマの間で 爪の指令が 5 未満のまま 10 コマ以上続く いちばん長い区間の 最後の 5 コマの爪の読みの中央値.
  9 以上 = 挟んだ・5 未満 = 空・その間 = 中途 (switch_405 の HELD_MIN・EMPTY_MAX). その区間がない (モデルが すぐ開き直した) 閉じは数えない
  (切り替え方式では コードが閉じたまま待つので, 開き直す動きは起きない)
判定 (judge. switch_405 と同じ関数 judge_reading): 判定を始めるコマから START (3) コマ目以降で 続けて N (4) コマの爪の読みの幅が W (0.5) 以下に
  なったら 落ち着いたとし, そのコマの読みで 挟んだ (HELD_MIN 9 〜 HELD_MAX 12)・空 (EMPTY_MAX 5 未満)・あいまい (その間・12 より上・
  MAX_WAIT 30 コマで落ち着かない) に分ける. あいまいは空として扱う
  判定を始めるコマは 2 通りで数える: (a) 指令が 20 を割ったコマ (切り替え方式でコードが受け取るコマ) / (b) 指令が 5 を割ったコマ (記録では
  モデル・お手本の指令がゆっくり閉じるので, コードが 1 コマで閉じる形に近い所)
持ち上げの途中の確かめ: 挟んだ回の k + 20 〜 k + 60 コマの爪の読みの最小 (成功の回) と so101g の「持ち上げで落とす」回

  P=/opt/homebrew/Caskroom/miniforge/base/envs/lerobot/bin/python
  $P so101/check_405/analyze_405.py          → so101/check_405/judge_405.json・judge_405.md
"""
import csv
import json
import sys
from collections import Counter
from pathlib import Path

import numpy as np

HERE = Path(__file__).resolve().parent
SO101 = HERE.parent
for p in (SO101, SO101 / "ideal_var", HERE):
    if str(p) not in sys.path:
        sys.path.insert(0, str(p))

import switch_405 as SW  # noqa: E402

LOG = Path("/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12")
DEMO = Path("/Volumes/KIOXIA/r2r2r-data/datasets/so101_redblock_box_ideal_var_v2_success_recover_v1/raw_episodes")
GRASP_Z_MAX = 70.0
OUT_JSON, OUT_MD = HERE / "judge_405.json", HERE / "judge_405.md"
KINDS = ("so101f", "so101g", "demo_success", "demo_recover", "code_rule401")
KIND_JA = {"so101f": "so101f 実機 30 回", "so101g": "so101g 実機 7 回", "demo_success": "お手本 success 50 本",
           "demo_recover": "お手本 recover 14 本", "code_rule401": "参考: code_rule401 実機 56 回"}


def load():
    import pandas as pd
    import run_so101_policy as R
    out = []
    with open(LOG / R.TRIALS_CSV, newline="") as f:
        rows = [dict(zip(R.TRIAL_COLUMNS, r)) for r in list(csv.reader(f))[1:]]
    for r in rows:
        kind = r["model"].split()[0]
        if kind not in ("so101f", "so101g", "code_rule401") or r["execute"] != "1" or r["result"] not in ("success", "failure"):
            continue
        if kind == "code_rule401" and r["result"] != "success":
            continue
        f = sorted(p for p in (Path(r["record_dir"]) / "data").glob("*/*.parquet") if not p.name.startswith("._"))
        if not f:
            continue
        df = pd.read_parquet(f[0])
        out.append({"kind": kind, "name": r["trial"], "result": r["result"], "fail_reason": r["fail_reason"], "place": r["place"],
                    "S": np.stack(df["observation.state"].values).astype(np.float64),
                    "A": np.stack(df["action"].values).astype(np.float64)})
    for p in sorted(x for x in DEMO.iterdir() if not x.name.startswith(".")):
        z = np.load(p / "episode.npz")
        out.append({"kind": "demo_recover" if "recover" in p.name else "demo_success", "name": p.name, "result": "success",
                    "fail_reason": "", "place": "", "S": z["state"].astype(np.float64), "A": z["actions"].astype(np.float64)})
    return out


def close_events(A):
    g, armed, ev = A[:, 5], False, []
    for k in range(len(g)):
        if g[k] >= SW.CMD_OPEN:
            armed = True
        elif armed and g[k] < SW.CMD_CLOSE:
            ev.append(k)
            armed = False
    return ev


def truth(s, a, k):
    n, best, j = len(s), None, k + 8
    end = min(k + 60, n)
    while j < end:
        if a[j] < 5.0:
            e = j
            while e + 1 < end and a[e + 1] < 5.0:
                e += 1
            if e - j + 1 >= 10 and (best is None or e - j > best[1] - best[0]):
                best = (j, e)
            j = e + 1
        else:
            j += 1
    if best is None:
        return None, None
    v = float(np.median(s[best[1] - 4:best[1] + 1]))
    return ("held" if v >= SW.HELD_MIN else "empty" if v < SW.EMPTY_MAX else "partial"), round(v, 2)


def judge_from(s, k0):
    """記録の爪の読み s を k0 から 1 コマずつ judge_reading に渡す (switch_405 と同じ)"""
    reads = []
    for j in range(k0, min(k0 + SW.JUDGE["max_wait"] + 1, len(s))):
        reads.append(float(s[j]))
        r = SW.judge_reading(reads)
        if r is not None:
            return r
    return {"class": "ambiguous", "why": "記録が終わった", "frames": len(reads), "grip": float(s[min(k0 + len(reads) - 1, len(s) - 1)]),
            "settled": False}


def main():
    import var_lib_314 as V
    ch = V.load_urdf_chain(V.URDF)
    recs = load()
    ev_rows = []
    for r in recs:
        S, A = r["S"], r["A"]
        for k in close_events(A):
            z = float(V.tcp_mm(ch, S[k, :5])[2])
            if z >= GRASP_Z_MAX:
                continue
            t, tv = truth(S[:, 5], A[:, 5], k)
            k5 = next((j for j in range(k, min(k + 15, len(A))) if A[j, 5] < 5.0), k)
            ja, jb = judge_from(S[:, 5], k), judge_from(S[:, 5], k5)
            g20 = float(S[min(k + 20, len(S) - 1), 5])
            fixed20 = "held" if SW.HELD_MIN <= g20 <= SW.HELD_MAX else "empty" if g20 < SW.EMPTY_MAX else "ambiguous"
            ev_rows.append({"kind": r["kind"], "name": r["name"], "result": r["result"], "fail_reason": r["fail_reason"], "frame": k,
                            "tcp_z_mm": round(z, 1), "truth": t, "truth_grip": tv,
                            "judge_a": ja["class"], "judge_a_frames": ja["frames"], "judge_a_grip": round(ja["grip"], 2),
                            "judge_b": jb["class"], "judge_b_frames": jb["frames"], "judge_b_grip": round(jb["grip"], 2),
                            "fixed20": fixed20, "grip_k20": round(g20, 2)})
    # 持ち上げの途中: 成功の回の 挟んだ閉じ (truth held) の k+20〜k+60 の最小
    lift = {}
    for kind in KINDS:
        mins = []
        for e in ev_rows:
            if e["kind"] != kind or e["result"] != "success" or e["truth"] != "held":
                continue
            S = next(r["S"] for r in recs if r["name"] == e["name"] and r["kind"] == kind)
            mins.append(float(S[e["frame"] + 20:e["frame"] + 60, 5].min()))
        if mins:
            lift[kind] = {"n": len(mins), "min": round(min(mins), 2), "median": round(float(np.median(mins)), 2), "max": round(max(mins), 2)}
    drops = []
    for r in recs:
        if r["fail_reason"] == "3":
            S, A = r["S"], r["A"]
            for k in close_events(A):
                z0 = float(V.tcp_mm(ch, S[k, :5])[2])
                if z0 >= GRASP_Z_MAX:
                    continue
                seg = S[k:k + 90]
                zz = [float(V.tcp_mm(ch, q[:5])[2]) for q in seg]
                drops.append({"name": r["name"], "kind": r["kind"], "frame": k, "grip_every5": np.round(seg[::5, 5], 1).tolist(),
                              "cmd_every5": np.round(A[k:k + 90:5, 5], 1).tolist(), "tcp_z_every5": np.round(zz[::5], 1).tolist()})
    tables = {}
    for col in ("judge_a", "judge_b", "fixed20"):
        c = Counter((e["kind"], e["truth"], e[col]) for e in ev_rows if e["truth"] is not None)
        tables[col] = {f"{k}|{t}|{j}": n for (k, t, j), n in sorted(c.items())}
    settle = {}
    for col in ("judge_a", "judge_b"):
        f = [e[f"{col}_frames"] for e in ev_rows if e["truth"] is not None]
        settle[col] = {"median": float(np.median(f)), "p90": float(np.percentile(f, 90)), "max": int(max(f))}
    counts = {k: {"events": sum(e["kind"] == k for e in ev_rows), "with_truth": sum(e["kind"] == k and e["truth"] is not None for e in ev_rows),
                  "records": sum(r["kind"] == k for r in recs)} for k in KINDS}
    gv = {t: [e["truth_grip"] for e in ev_rows if e["truth"] == t] for t in ("held", "empty", "partial")}
    doc = {"request": 405, "params": SW.JUDGE, "grasp_z_max_mm": GRASP_Z_MAX, "counts": counts, "tables": tables, "settle_frames": settle,
           "truth_grip": {t: ({"n": len(v), "min": min(v), "p5": round(float(np.percentile(v, 5)), 2), "median": round(float(np.median(v)), 2),
                               "p95": round(float(np.percentile(v, 95)), 2), "max": max(v)} if v else {"n": 0}) for t, v in gv.items()},
           "lift_held_min": lift, "drops": drops, "events": ev_rows}
    OUT_JSON.write_text(json.dumps(doc, ensure_ascii=False, indent=1) + "\n")
    OUT_MD.write_text(markdown(doc))
    print(OUT_MD.read_text())


def markdown(doc):
    L = ["# 依頼 405: 握れたかの判定の境目と取り違え (記録から. analyze_405.py が書いた)", "",
         f"判定: 判定を始めて {SW.JUDGE['start']} コマ目以降に 続けて {SW.JUDGE['n']} コマの爪の読みの幅が {SW.JUDGE['w']} 以下で 落ち着いた とし, "
         f"その読みが {SW.JUDGE['held_min']}〜{SW.JUDGE['held_max']} = 挟んだ / {SW.JUDGE['empty_max']} 未満 = 空 / ほか・{SW.JUDGE['max_wait']} コマで落ち着かない = あいまい (空として扱う)", "",
         "## 数えた閉じ", "", "| 記録 | 本・回 | 閉じ (つかむ高さ) | 本当の答えのある閉じ |", "|---|---|---|---|"]
    for k in KINDS:
        c = doc["counts"][k]
        L.append(f"| {KIND_JA[k]} | {c['records']} | {c['events']} | {c['with_truth']} |")
    L += ["", "## 本当の答えごとの爪の読み (区間の最後の 5 コマの中央値)", "", "| 答え | 数 | 最小 | 5% | 中央値 | 95% | 最大 |", "|---|---|---|---|---|---|---|"]
    for t, v in doc["truth_grip"].items():
        if v.get("n"):
            L.append(f"| {t} | {v['n']} | {v['min']} | {v['p5']} | {v['median']} | {v['p95']} | {v['max']} |")
    names = {"judge_a": "(a) 指令が 20 を割ったコマから判定 (切り替え方式でコードが受け取るコマ)",
             "judge_b": "(b) 指令が 5 を割ったコマから判定", "fixed20": "比べ: 20 コマ後の読みだけで分ける (依頼 376 の決め方)"}
    for col, title in names.items():
        L += ["", f"## 取り違えの表 {title}", "", "| 記録 | 答え | 挟んだ | 空 | あいまい (→空) |", "|---|---|---|---|---|"]
        tb = doc["tables"][col]
        for k in KINDS:
            for t in ("held", "empty", "partial"):
                n = {j: tb.get(f"{k}|{t}|{j}", 0) for j in ("held", "empty", "ambiguous")}
                if sum(n.values()):
                    L.append(f"| {KIND_JA[k]} | {t} | {n['held']} | {n['empty']} | {n['ambiguous']} |")
        tot = Counter()
        for key, n in tb.items():
            _, t, j = key.split("|")
            tot[(t, j)] += n
        L.append(f"| **合計** | 挟んだのに 空・あいまい (→ 開く) | | | **{tot[('held', 'empty')] + tot[('held', 'ambiguous')]}** |")
        L.append(f"| **合計** | 空・中途なのに 挟んだ (→ 運ぶ) | **{tot[('empty', 'held')] + tot[('partial', 'held')]}** | | |")
        if col in doc["settle_frames"]:
            s = doc["settle_frames"][col]
            L.append(f"\n落ち着くまでのコマ: 中央値 {s['median']:g}・90% {s['p90']:g}・最大 {s['max']}")
    L += ["", "## 持ち上げの途中 (挟んだ閉じの 20〜60 コマ後の爪の読みの最小. 成功の回)", "", "| 記録 | 数 | 最小 | 中央値 | 最大 |", "|---|---|---|---|---|"]
    for k, v in doc["lift_held_min"].items():
        L.append(f"| {KIND_JA[k]} | {v['n']} | {v['min']} | {v['median']} | {v['max']} |")
    for d in doc["drops"]:
        L.append(f"\n「持ち上げで落とす」の回 {d['name']} ({d['kind']}) 閉じ {d['frame']} コマ目から 5 コマごと: 爪の読み {d['grip_every5']} / "
                 f"指令 {d['cmd_every5']} / 手先の高さ {d['tcp_z_every5']}")
    L += ["", "## 取り違えた閉じ ((a) の判定)", "", "| 記録 | 回 | コマ | 答え (読み) | 判定 (読み・コマ) |", "|---|---|---|---|---|"]
    for e in doc["events"]:
        if e["truth"] is None:
            continue
        bad = (e["truth"] == "held" and e["judge_a"] != "held") or (e["truth"] != "held" and e["judge_a"] == "held")
        if bad:
            L.append(f"| {e['kind']} | {e['name']} | {e['frame']} | {e['truth']} ({e['truth_grip']}) | {e['judge_a']} "
                     f"({e['judge_a_grip']}・{e['judge_a_frames']}) |")
    return "\n".join(L) + "\n"


if __name__ == "__main__":
    main()
```

### so101/check_405/open_order_405.py

```python
#!/usr/bin/env python3
"""依頼 405: 空のあとの道の順 (開いてから上がる = 依頼の形 / 上がってから開く) を 外し方ごとにシムで比べる (計算だけ・アームなし).
場所2〜5 の目印 (今日の実機と同じガードの値) で rule_401 の道を作り, つかむ所 (GRASP_OPEN) から 爪の間の点を 奥・手前・右・左へ 10・15・20 mm,
上へ 10・20 mm ずらした所で 空で閉じた (爪 0.74) とし, switch_405 と同じ ガード (clear_after held=False) を当てる.
「上がってから開く」は 閉じたまま 渡す所の高さへ上がり (同じコマ数), 上で開く (10 コマ). 同じガードを当てる (開く区間は上なので 腕と机も見る).

  SO101_VAR_ROLL_RANGE=-67,58 R401_PUSH_LIMIT_MM=-12 R401_PUSH_WINDOW_MM=-12 $P so101/check_405/open_order_405.py → open_order_405.md・.json
"""
import json
import sys
from pathlib import Path

import numpy as np

HERE = Path(__file__).resolve().parent
for p in (HERE.parent, HERE.parent / "check_401", HERE.parent / "check_392", HERE.parent / "check_399", HERE.parent / "ideal_var", HERE):
    if str(p) not in sys.path:
        sys.path.insert(0, str(p))
import run_rule401 as RR  # noqa: E402
import switch_405 as SW  # noqa: E402

MISS = [("奥", 1, 0, 0), ("手前", -1, 0, 0), ("右", 0, 1, 0), ("左", 0, -1, 0)]
MM = (10.0, 15.0, 20.0)
UP = (10.0, 20.0)


def paths(W, b, q5, open_g, z_above):
    q_up, dz, back = SW.rise_pose(W, q5, z_above)
    n_rise = max(1, int(np.ceil(dz / SW.RISE_MM_PER_FRAME))) if dz > 0 else 1
    h6 = np.r_[q5, 0.74]
    a, fa = SW.segment(h6, [("OPENED", np.r_[q5, open_g], SW.OPEN_FRAMES), ("RISEN", np.r_[q_up, open_g], n_rise)])
    c, fc = SW.segment(h6, [("RISEN", np.r_[q_up, 0.74], n_rise), ("OPENED2", np.r_[q_up, open_g], SW.OPEN_FRAMES)])
    return (a, fa), (c, fc)


def main():
    plan, lo, hi = RR.load_plan(RR.PLAN)
    W = RR.world()
    jt = plan.get("jaw_table_min_mm", -11.0)
    rows = []
    for place in (2, 3, 4, 5):
        e = plan["episodes"][place - 1]
        b, info = RR.prepare(W, plan, place, lo, hi, None, (e["pixel"][0], e["pixel"][1], 0.0), False, ("conflict",), False)
        fr = b["v"]["frames"]
        g5 = b["path"][fr["GRASP_OPEN"]][:5]
        a6 = b["path"][fr["ABOVE_BLOCK"]]
        _, z_above, _, _ = W.sh.point(a6[:5])
        u = np.asarray(b["bxy"]) / np.linalg.norm(b["bxy"])
        r = np.array([u[1], -u[0]])
        cases = [("つかむ所", 0.0, np.zeros(2), 0.0)]
        for name, sf, sr, _ in MISS:
            for mm in MM:
                cases.append((f"{name} {mm:g}", mm, (sf * u + sr * r) * mm, 0.0))
        for mm in UP:
            cases.append((f"上 {mm:g}", mm, np.zeros(2), mm))
        for name, mm, dxy, dz in cases:
            q, err = W.sh.shift(g5, dxy, dz)
            if q is None:
                rows.append({"place": place, "case": name, "solved": False})
                continue
            (pa, fa), (pc, fc) = paths(W, b, q, a6[5], z_above)
            ca = SW.clear_after(pa, fa, b["bxy"], b["yaw"], False, jt)
            fc2 = dict(fc, OPENED=0)            # 上がってから開く: 全区間で 腕と机 (始め = 閉じた所) を見る
            cc = SW.clear_after(pc, fc2, b["bxy"], b["yaw"], False, jt)
            rows.append({"place": place, "case": name, "solved": True, "open_first_ok": ca["ok"], "open_first_why": ca["why"],
                         "open_first": ca["dist"], "rise_first_ok": cc["ok"], "rise_first_why": cc["why"], "rise_first": cc["dist"]})
            print(place, name, ca["ok"], cc["ok"], ca["why"][:80], flush=True)
    (HERE / "open_order_405.json").write_text(json.dumps(rows, ensure_ascii=False, indent=1) + "\n")
    L = ["# 依頼 405: 空のあとの道の順 (開いてから上がる / 上がってから開く) を 外し方ごとに (open_order_405.py が書いた)", "",
         "場所2〜5 の目印・rule_401 の道 (今日のガードの値)・つかむ所から 爪の間の点をずらした所で 空で閉じたとする. ○ = switch_405 のガードを通る", "",
         "| 外し方 | " + " | ".join(f"場所{p} 開→上 | 場所{p} 上→開" for p in (2, 3, 4, 5)) + " |", "|---|" + "---|---|" * 4]
    names = [x["case"] for x in rows if x["place"] == 2]
    for n in names:
        cells = []
        for p in (2, 3, 4, 5):
            x = next(y for y in rows if y["place"] == p and y["case"] == n)
            if not x["solved"]:
                cells += ["解けない", "解けない"]
                continue
            fa = x["open_first"]
            cells += [("○" if x["open_first_ok"] else "×") + f" (ブロック {fa.get('arm_block')})",
                      ("○" if x["rise_first_ok"] else "×") + f" (ブロック {x['rise_first'].get('arm_block')})"]
        L.append(f"| {n} | " + " | ".join(cells) + " |")
    n_ok = {k: sum(1 for x in rows if x.get(k)) for k in ("open_first_ok", "rise_first_ok")}
    L += ["", f"通った数 (全 {sum(1 for x in rows if x['solved'])}): 開いてから上がる {n_ok['open_first_ok']}・上がってから開く {n_ok['rise_first_ok']}",
          "かっこは 腕 (爪・手首・カメラ) とシムのブロックの最小距離 mm (負は重なり)"]
    (HERE / "open_order_405.md").write_text("\n".join(L) + "\n")
    print("\n".join(L))


if __name__ == "__main__":
    main()
```

### so101/check_405/fake_run_405.py

```python
#!/usr/bin/env python3
"""依頼 405: 切り替え方式 (--switch-405) を アーム・カメラ・サーバーなしで通す (偽のアーム・偽のサーバー・偽の読み).

switch_405.execute をそのまま通す (rule_401 の道・ガード・シムの確かめ・run_trial・記録 (LeRobot)・台帳 は本物). 差し替えるのは:
  - アーム (FakeArm): 送った値に 腕の動きの予想 (arm_response_400 の dir_s) の 関節ごとの遅れ (1 次の遅れ α・d コマの待ち) だけを
    当てた値を 今の角度にする (重さの沈みは入れない). 爪の読みも同じ遅れ. ただし その場面で「挟む」閉じ (つかむ高さ = 手先 70 mm 未満で 爪の指令が 25 以上から 20 を割った回. 場面の grips の順) のときは
    爪の指令が BLOCK_GRIP (10.6. 記録の挟んだ読み) を割っても 読みは BLOCK_GRIP で止まる (ブロックを挟む).
    「落とす」場面では 閉じて 20 コマ (判定のあと・持ち上げの途中) から 読みが指令に戻る (ブロックが抜ける)
    机・手首の絵は so101f の場所3 の 1 回目の最初のコマ (fake_run_392.first_frames. KIOXIA は読むだけ)
  - サーバー (FakeClient): 今の角度から 渡す所のつかむ所 (rule_401 の道の GRASP_OPEN) へ 1 コマ 1.5° ずつ寄せ, 着いたら爪を 0 へ.
    「外す」閉じは つかむ所から 場面の向き (既定 ブロックの奥へ MISS_MM = 15 mm) にずらした所 (爪の傾き・向きのまま) で閉じる.
    「閉じない」場面では 上下に 10° ゆれるだけで爪は開いたまま. 答えが返るまで 0.05 秒
  - 読み (Switch.fake_reads): 場所3 の目印の画素・向き 0° を読んだことにする. "hidden" = 腕で隠れた / "unreadable" = 読めない
  - 時計: 偽 (1 コマ 1/30 秒を待たずに進める)
推論の安全範囲は so101h の学習データ (code_rule401_grasp_v1 の 56 本 ±10). 場所2・4・5 は 今日の実機と同じガードの値で 3 場面ずつ.
「上がってから開く」の場面は --retry-rise-first を付けた形
記録・台帳は /tmp/r405_dry/ の下 (KIOXIA には書かない).

  P=/opt/homebrew/Caskroom/miniforge/base/envs/lerobot/bin/python
  SO101_VAR_ROLL_RANGE=-67,58 $P so101/check_405/fake_run_405.py          → so101/check_405/fake_run_405.md・.json
"""
import argparse
import csv
import json
import shutil
import sys
import time
from pathlib import Path

import numpy as np

HERE = Path(__file__).resolve().parent
SO101 = HERE.parent
for p in (SO101, SO101 / "check_392", SO101 / "check_401", SO101 / "sim" / "look_400", HERE):
    if str(p) not in sys.path:
        sys.path.insert(0, str(p))

import run_so101_policy as R  # noqa: E402
import switch_405 as SW  # noqa: E402

OUT = Path("/tmp/r405_dry")
RAW_H = Path("/Volumes/KIOXIA/r2r2r-data/datasets/so101_redblock_box_code_rule401_grasp_v1/raw_episodes")   # so101h の学習データ (推論の安全範囲)
BLOCK_GRIP = 10.6
MISS_MM = 15.0
PLACE = 3
# 場面: 閉じごとに 挟むか (True/False), 読み直しの答え, 落とすか, 閉じないか
SCENES = [
    {"name": "1 回で挟む", "grips": [True], "reads": ["marker"], "expect": "carried"},
    {"name": "1 回外して (奥 15 mm) 2 回目で挟む・依頼の形 (下で開く)", "grips": [False, True], "reads": ["marker", "hidden", "marker"],
     "expect": "retry_refused"},
    {"name": "1 回外して (奥 15 mm) 2 回目で挟む・上がってから開く (戻った所で隠れた → HOME で読む)", "grips": [False, True],
     "reads": ["marker", "hidden", "marker"], "rise_first": True, "expect": "carried"},
    {"name": "2 回外して止まる・上がってから開く (戻った所で読めた → そのまま渡し直す)", "grips": [False, False], "reads": ["marker", "marker"],
     "rise_first": True, "expect": "missed_max"},
    {"name": "閉じない (区間の上限で止まる)", "grips": [], "reads": ["marker"], "never_close": True, "policy_max_s": 3.0,
     "expect": "not_closed"},
    {"name": "持ち上げで落とす", "grips": [True], "reads": ["marker"], "drop": True, "expect": "dropped"},
    {"name": "π0.5 の区間で q (その場で止める)", "grips": [], "reads": ["marker"], "never_close": True, "q_after": 20,
     "expect": "policy_quit"},
    {"name": "外したあと ブロックが読めない・上がってから開く", "grips": [False], "reads": ["marker", "hidden", "unreadable"], "rise_first": True,
     "expect": "retry_refused"},
    {"name": "始めに ブロックが読めない (動かさない)", "grips": [], "reads": ["unreadable"], "expect": "refused"},
]


class Clock:
    def __init__(self):
        self.t = 1000.0

    def __call__(self):
        return self.t

    def sleep(self, dt):
        self.t += max(0.0, float(dt))


class FakeArm:
    def __init__(self, images, scene):
        import lerobot_safe_259 as safe
        self.state = np.array([safe.load_rest_pose()[0][m] for m in R.MOTORS], dtype=np.float64)
        self.last_sent = self.state.copy()
        self.images, self.scene = images, scene
        self.leader, self.current_motors = None, []
        self.closes, self.armed, self.block, self.after = 0, False, False, 0     # 始め (休みの姿勢) の爪は閉じている. 開いてから数える
        self.n_sent = 0
        import arm_response_400 as AR
        P = AR.ArmResponse()
        self.lag = [(float(P.p[m]["alpha"]), int(P.p[m]["d"])) for m in R.MOTORS]
        self.hist = [self.state.copy()]
        self.y = self.state.copy()

    def observe(self):
        return self.state.copy(), self.images["desk"], self.images["wrist"]

    def send(self, target):
        t = np.asarray(target, dtype=np.float64).copy()
        g = t[5]
        if g >= SW.CMD_OPEN:
            self.armed, self.block = True, False
        elif self.armed and g < SW.CMD_CLOSE and self._z(t) < 70.0:     # つかむ高さの閉じだけ (HOME へ戻る道の閉じは数えない)
            self.armed = False
            gr = self.scene["grips"]
            self.block = self.closes < len(gr) and gr[self.closes]
            self.closes += 1
            self.after = 0
        if self.block:
            self.after += 1
            if self.scene.get("drop") and self.after > 20:       # 判定 (8〜10 コマ) のあと 持ち上げの途中で抜ける
                self.block = False
        self.hist.append(t.copy())
        for j, (al, d) in enumerate(self.lag):
            x = self.hist[max(0, len(self.hist) - 1 - d)][j]
            self.y[j] = (1.0 - al) * self.y[j] + al * x
        st = self.y.copy()
        if self.block:
            st[5] = max(st[5], BLOCK_GRIP)
        self.state = st
        self.last_sent = t
        self.n_sent += 1
        return t.copy()

    def _z(self, q):
        import var_lib_314 as V
        if not hasattr(self, "chain"):
            self.chain = V.load_urdf_chain(V.URDF)
        return float(V.tcp_mm(self.chain, np.asarray(q, np.float64)[:5])[2])

    def leader_target(self):
        return None

    def close(self):
        pass


class FakeClient:
    def __init__(self, sw, scene, arm, latency=0.05):
        self.sw, self.scene, self.arm, self.latency, self.n = sw, scene, arm, latency, 0
        self.miss = {}

    def infer(self, obs):
        time.sleep(self.latency)
        self.n += 1
        s = np.asarray(obs["observation/state"], dtype=np.float64)
        b = self.sw.cur_b
        goal = np.asarray(b["path"][b["v"]["frames"]["GRASP_OPEN"]], np.float64).copy()
        gr, k = self.scene["grips"], self.arm.closes
        if k < len(gr) and not gr[k]:              # 外す閉じ: ブロックから奥へ MISS_MM ずれた所で閉じる (依頼 376: 外しは奥がいちばん多い)
            key = (id(b), k)
            if key not in self.miss:
                fwd = np.asarray(b["bxy"], np.float64) / np.linalg.norm(b["bxy"])
                right = np.array([fwd[1], -fwd[0]])
                sf, sr, mm = self.scene.get("miss", (1, 0, MISS_MM))
                q, _ = self.sw.W.sh.shift(goal[:5], (sf * fwd + sr * right) * mm, 0.0)
                self.miss[key] = goal[:5] if q is None else q
            goal[:5] = self.miss[key]
        out, q = [], s.copy()
        for k in range(30):
            if self.scene.get("never_close"):
                q = s.copy()
                q[1] += 10.0 * np.sin((self.n * 30 + k) / 15.0)
                q[5] = 59.0
            else:
                d = goal[:5] - q[:5]
                q[:5] += np.clip(d, -1.5, 1.5)
                q[5] = 0.0 if np.abs(goal[:5] - q[:5]).max() < 0.5 else 59.0
            out.append(q.copy())
        return {"actions": np.asarray(out, np.float32)}

    def close(self):
        pass


class Keys:
    """q_after: π0.5 の区間に入ってから この回 見たら q"""

    def __init__(self, sw=None, q_after=None):
        self.sw, self.q_after, self.n = sw, q_after, 0

    def __enter__(self):
        return self

    def __exit__(self, *a):
        return False

    def start(self):
        pass

    def poll(self):
        if self.q_after is None or not self.sw.info["segments"] or self.sw.info["segments"][-1]["name"] != "policy":
            return None
        self.n += 1
        return "q" if self.n >= self.q_after else None


EXTRA = [{"name": "1 回で挟む", "grips": [True], "reads": ["marker"], "expect": "carried"},
         {"name": "1 回外して (手前 20 mm) 2 回目で挟む・依頼の形 (下で開く)", "grips": [False, True], "reads": ["marker", "hidden", "marker"],
          "miss": (-1, 0, 20.0), "expect": ("carried", "retry_refused")},    # 境目の形 (open_order_405.md の 手前 20). ガードしだい
         {"name": "1 回外して (左 15 mm) 2 回目で挟む・上がってから開く", "grips": [False, True], "reads": ["marker", "hidden", "marker"],
          "miss": (0, -1, 15.0), "rise_first": True, "expect": "carried"}]
EXTRA_PLACES = (2, 4, 5)       # 今日の実機と同じガードの値 (R401_PUSH_LIMIT_MM・R401_PUSH_WINDOW_MM = −12・conflict を許す) で流す


def args_for(scene, log_dir, place=PLACE, allow=()):
    return argparse.Namespace(port=8000, raw_dir=str(RAW_H), log_dir=str(log_dir), model="fake_405", step="0", exec_steps=30,
                              no_prefetch=False, skip_first_confirm=True, execute=False, place=place, currents="off", play_speed=1.0,
                              rtc=False, rtc_max_delay=None, blend=10, max_step_deg=5.0, switch_405=True,
                              policy_max_s=scene.get("policy_max_s"), chunk_full=False, black_wrist=False, retry_shift_mm=None,
                              allow_status=list(allow), reselect_face=False, place1_candidate=False,
                              retry_rise_first=bool(scene.get("rise_first")))


def main():
    import fake_run_392 as F
    import run_rule401 as RR
    if OUT.exists():
        shutil.rmtree(OUT)
    (OUT / "log").mkdir(parents=True)
    plan, lo, hi = RR.load_plan(RR.PLAN)
    W = RR.world()
    plo, phi, _ = R.load_safe_range(RAW_H)
    rows = run_scenes(SCENES, PLACE, plan, lo, hi, W, plo, phi, F)
    import os
    env0 = {k: os.environ.get(k) for k in ("R401_PUSH_LIMIT_MM", "R401_PUSH_WINDOW_MM")}
    os.environ.update(R401_PUSH_LIMIT_MM="-12", R401_PUSH_WINDOW_MM="-12")
    try:
        extra = []
        for pl in EXTRA_PLACES:
            extra += run_scenes(EXTRA, pl, plan, lo, hi, W, plo, phi, F, allow=("conflict",))
    finally:
        for k, v in env0.items():
            if v is None:
                os.environ.pop(k, None)
            else:
                os.environ[k] = v
    return report(rows, extra)


def run_scenes(scenes, place, plan, lo, hi, W, plo, phi, F, allow=()):
    images = F.first_frames(place)
    e = plan["episodes"][place - 1]
    marker = (float(e["pixel"][0]), float(e["pixel"][1]), 0.0)
    rows = []
    for sc in scenes:
        print(f"\n===== 場所{place}: {sc['name']} =====", flush=True)
        a = args_for(sc, OUT / "log", place, allow)
        clk = Clock()
        sw = SW.Switch(a, plo, phi, W=W, plan=(plan, lo, hi), clock=clk, sleep=clk.sleep)
        sw.fake_reads = [marker if r == "marker" else r for r in sc["reads"]]
        arm = FakeArm(images, sc)
        pol = R.Policy(0, client=FakeClient(sw, sc, arm))
        rc = SW.execute(a, arm_factory=lambda: arm, policy=pol, keys=Keys(sw, sc.get("q_after")), inp=lambda q="": "yes" if "yes" in q else "y", switch=sw,
                        local_root=OUT / "runs")
        i = sw.info
        att = i["attempts"]
        js = [x.get("judge") or {} for x in att]
        rows.append({"place": place, "scene": sc["name"], "expect": sc["expect"], "status": i["status"], "ok": i["status"] in (sc["expect"] if isinstance(sc["expect"], tuple) else (sc["expect"],)), "rc": rc,
                     "attempts": len(att), "judges": [j.get("class") for j in js], "grips": [j.get("grip") for j in js],
                     "judge_frames": [j.get("frames") for j in js], "policy_frames": [x.get("policy_frames") for x in att],
                     "routes": [x.get("route") for x in att], "lift_grip": [x.get("lift_grip") for x in att],
                     "frames_code": i["frames_code"], "frames_wait": i["frames_wait"], "stop_where": i["stop_where"],
                     "stop_why": i["stop_why"][:160], "sent": arm.n_sent, "clear": [x.get("after_path", {}).get("clearance_mm") or
                                                                                      x.get("open_rise", {}).get("clearance_mm") for x in att],
                     "seconds_fake": round(clk.t - 1000.0, 1)})
        print(json.dumps(rows[-1], ensure_ascii=False), flush=True)
    return rows


def report(rows, extra):
    with open(OUT / "log" / R.TRIALS_CSV, newline="") as f:
        led = list(csv.reader(f))
    doc = {"request": 405, "place": PLACE, "rows": rows, "extra_rows": extra, "ledger_header": led[0], "ledger_rows": led[1:]}
    (HERE / "fake_run_405.json").write_text(json.dumps(doc, ensure_ascii=False, indent=1, default=SW._js) + "\n")
    L = ["# 依頼 405: 偽のアーム・偽のサーバーでの通し (fake_run_405.py が書いた)", "",
         f"場所{PLACE} の目印・rule_401 の道 (本物)・ガード・シム (本物)・run_trial (本物)・記録 LeRobot と台帳 (/tmp/r405_dry). "
         "アーム・サーバー・読みだけ偽", "",
         "| 場面 | 期待 | 結果 | 合う | 渡した回 | 判定 (爪の読み・コマ) | π0.5 のコマ | 道 | 持ち上げの読み | コードのコマ | 待ち | 止めた所 |",
         "|---|---|---|---|---|---|---|---|---|---|---|---|"]
    for r in rows:
        jd = " / ".join(f"{c} ({g:.1f}・{f})" for c, g, f in zip(r["judges"], r["grips"], r["judge_frames"]) if c) or "-"
        L.append(f"| {r['scene']} | {'・'.join(r['expect']) if isinstance(r['expect'], (list, tuple)) else r['expect']} | {r['status']} | {'○' if r['ok'] else '×'} | {r['attempts']} | {jd} | "
                 f"{r['policy_frames']} | {[x for x in r['routes'] if x] or '-'} | {[x for x in r['lift_grip'] if x is not None] or '-'} | "
                 f"{r['frames_code']} | {r['frames_wait']} | {r['stop_where'] or '-'}{(': ' + r['stop_why']) if r['stop_why'] else ''} |")
    L += ["", "## ほかの場所 (今日の実機と同じガードの値: R401_PUSH_LIMIT_MM・R401_PUSH_WINDOW_MM = −12・conflict を許す)", "",
          "| 場所 | 場面 | 結果 | 合う | 判定 | 道 | 持ち上げの道のシム (mm) | 空のあとの道のシム (mm) |", "|---|---|---|---|---|---|---|---|"]
    for r in extra:
        held = [c for c in r["clear"] if c and "held_box" in c]
        emp = [c for c in r["clear"] if c and "arm_block" in c]
        L.append(f"| {r['place']} | {r['scene']} | {r['status']}{(' (' + r['stop_why'][:90] + ')') if r['stop_why'] else ''} | "
                 f"{'○' if r['ok'] else '×'} | {' / '.join(c for c in r['judges'] if c)} | "
                 f"{[x for x in r['routes'] if x] or '-'} | {held[0] if held else '-'} | {emp[0] if emp else '-'} |")
    L += ["", f"台帳 /tmp/r405_dry/log/so101_trials.csv: {len(led) - 1} 行 (動かさずに止めた回は書かない). 見出しは TRIAL_COLUMNS + SWITCH_COLUMNS"]
    for r in led[1:]:
        d = dict(zip(led[0], r))
        L.append(f"- {d['trial']}: result={d['result']}・fail_reason={d['fail_reason']}・sw_status={d['sw_status']}・"
                 f"sw_judges={d['sw_judges']}・sw_grip_reads={d['sw_grip_reads']}・sw_close_points={d['sw_close_points']}・"
                 f"sw_policy_frames={d['sw_policy_frames']}・frames={d['frames']} (model {d['frames_model']})")
    (HERE / "fake_run_405.md").write_text("\n".join(L) + "\n")
    print("\n".join(L))
    return 0 if all(r["ok"] for r in rows + extra) else 1


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

### so101/check_405/test_switch_405.py

```python
"""依頼 405 のテスト (アーム・シムなしで速く通る所). 端から端までの通しは fake_run_405.py (偽のアーム・サーバー・本物の道とシム).

  /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/bin/python -m unittest so101/check_405/test_switch_405.py
"""
import io
import sys
import threading
import time
import unittest
from contextlib import redirect_stderr
from pathlib import Path

import numpy as np

HERE = Path(__file__).resolve().parent
for p in (HERE.parent, HERE):
    if str(p) not in sys.path:
        sys.path.insert(0, str(p))

import run_so101_policy as R  # noqa: E402
import switch_405 as SW  # noqa: E402


class Judge(unittest.TestCase):
    def test_held(self):
        r = None
        reads = []
        for g in [40, 30, 20, 12, 10.7, 10.6, 10.6, 10.6]:
            reads.append(g)
            r = SW.judge_reading(reads)
            if r:
                break
        self.assertEqual(r["class"], "held")
        self.assertTrue(r["settled"])
        self.assertEqual(r["frames"], 8)

    def test_empty(self):
        reads = [30, 20, 10, 4, 1.4, 1.3, 1.2, 1.2]
        r = None
        for i in range(1, len(reads) + 1):
            r = SW.judge_reading(reads[:i])
            if r:
                break
        self.assertEqual(r["class"], "empty")

    def test_start_skips_first_frames(self):
        # 始めの 3 コマは動かない読み (閉じる指令が効く前) でも 判定しない
        self.assertIsNone(SW.judge_reading([35.0, 35.0, 35.0, 35.0, 35.0, 35.0]))
        r = SW.judge_reading([35.0] * 7)
        self.assertEqual(r["class"], "ambiguous")          # 35 は挟んだ (9〜12) でも空 (5 未満) でもない

    def test_between_is_ambiguous(self):
        for g in (6.5, 8.9, 12.5):
            r = SW.judge_reading([20, 15, 10] + [g] * 4)
            self.assertEqual(r["class"], "ambiguous", g)
        self.assertEqual(SW.judge_reading([20, 15, 10] + [9.0] * 4)["class"], "held")
        self.assertEqual(SW.judge_reading([20, 15, 10] + [4.99] * 4)["class"], "empty")

    def test_not_settling(self):
        reads = [10.0 + (i % 2) for i in range(31)]    # 1 ずつ揺れて落ち着かない
        r = None
        for i in range(1, len(reads) + 1):
            r = SW.judge_reading(reads[:i])
            if r:
                break
        self.assertEqual(r["class"], "ambiguous")
        self.assertFalse(r["settled"])
        self.assertEqual(r["frames"], SW.JUDGE["max_wait"] + 1)

    def test_lift_ok(self):
        self.assertTrue(SW.lift_ok([10.5, 10.4, 10.6])[0])
        self.assertFalse(SW.lift_ok([10.5, 3.0, 1.0])[0])


class Watch(unittest.TestCase):
    def run_(self, grips, grip0=59.0, limit=100.0, modes=None):
        added = []
        clk = [0.0]
        w = SW._Watch(lambda *a, **k: added.append(a[5]), limit, grip0, clock=lambda: clk[0])
        for i, g in enumerate(grips):
            act = np.r_[np.zeros(5), g]
            clk[0] += 1.0                               # 1 コマ 1 秒 (偽の時計)
            try:
                w.add(np.zeros(6), None, None, act, act, (modes or {}).get(i, R.MODEL), i, 1)
            except SW.Takeover as t:
                return t.kind, i, w, added
        return None, None, w, added

    def test_close_after_open(self):
        kind, i, w, added = self.run_([59, 50, 30, 19.9, 5])
        self.assertEqual((kind, i), ("closed", 3))
        self.assertEqual(len(added), 4)                  # 閉じたコマも記録してから止める
        self.assertEqual(w.open_grip(), 59)

    def test_not_armed_until_open(self):
        kind, i, _, _ = self.run_([10, 10, 30, 10], grip0=1.0)
        self.assertEqual((kind, i), ("closed", 3))

    def test_timeout_is_wall_clock(self):
        kind, i, w, _ = self.run_([59] * 10, limit=5.0)
        self.assertEqual((kind, i), ("timeout", 4))      # 5 秒たったコマ
        self.assertEqual(w.n_model, 5)

    def test_pause_time_does_not_count(self):
        # 0〜2 コマ目は一時停止 (3 秒) → 数えない. 3 コマ目から 5 秒で上限
        kind, i, w, _ = self.run_([59] * 12, limit=5.0, modes={0: R.PAUSE, 1: R.PAUSE, 2: R.PAUSE})
        self.assertEqual((kind, i), ("timeout", 7))
        self.assertEqual(w.n_model, 5)
        kind, i, w, _ = self.run_([0.0] * 5, limit=5.0, modes={k: R.PAUSE for k in range(5)})
        self.assertIsNone(kind)                           # 一時停止のコマの爪の指令では 引き継がない
        self.assertEqual(w.n_model, 0)


class Gate_(unittest.TestCase):
    def test_black_wrist_and_serial(self):
        seen, active, peak = [], [0], [0]

        class P:
            latencies = [0.1]

            def infer(self, obs):
                active[0] += 1
                peak[0] = max(peak[0], active[0])
                seen.append(obs["observation/wrist_image"])
                time.sleep(0.02)
                active[0] -= 1
                return {"actions": np.zeros((30, 6))}
        g = SW.Gate(P(), black_wrist=True)
        obs = {"observation/wrist_image": b"real", "observation/desk_image": b"d"}
        ts = [threading.Thread(target=g.infer, args=(obs,)) for _ in range(3)]
        [t.start() for t in ts]
        [t.join() for t in ts]
        self.assertEqual(peak[0], 1)                     # 前の区間の裏の問い合わせと重ならない
        self.assertTrue(all(s != b"real" for s in seen))
        self.assertEqual(obs["observation/wrist_image"], b"real")    # 記録の絵 (元の obs) は変えない
        self.assertEqual(R.decode_jpeg(seen[0]).max(), 0)
        self.assertEqual(g.latencies, [0.1])
        g2 = SW.Gate(P(), black_wrist=False)
        seen.clear()
        g2.infer(obs)
        self.assertEqual(seen[0], b"real")
        g.close()
        g2.close()

    def test_timeout(self):
        class Slow:
            def infer(self, obs):
                time.sleep(0.5)
                return {}
        g = SW.Gate(Slow(), timeout=0.05)
        with self.assertRaises(TimeoutError):
            g.infer({"observation/wrist_image": b""})
        g.close()


class Cli(unittest.TestCase):
    def parse_err(self, argv):
        with redirect_stderr(io.StringIO()) as e, self.assertRaises(SystemExit):
            R.main(argv)
        return e.getvalue()

    def test_sub_options_need_switch(self):
        for o in (["--chunk-full"], ["--black-wrist"], ["--policy-max-s", "5"], ["--retry-shift-mm", "3"], ["--reselect-face"], ["--retry-rise-first"],
                  ["--allow-status", "conflict"], ["--place1-candidate"]):
            self.assertIn("--switch-405 と一緒に", self.parse_err(["--log-dir", "/tmp"] + o))

    def test_switch_excludes(self):
        self.assertIn("一緒に使わない", self.parse_err(["--log-dir", "/tmp", "--switch-405", "--handover-above-mm", "50"]))
        self.assertIn("一緒に使わない", self.parse_err(["--log-dir", "/tmp", "--switch-405", "--rtc"]))
        self.assertIn("1〜60", self.parse_err(["--log-dir", "/tmp", "--switch-405", "--policy-max-s", "0.5"]))
        self.assertIn("0〜20", self.parse_err(["--log-dir", "/tmp", "--switch-405", "--retry-shift-mm", "-1"]))

    def test_dispatch(self):
        got = {}
        orig_run = R.run
        sys.modules.setdefault("switch_405", SW)
        orig = SW.execute
        try:
            R.run = lambda a: got.setdefault("run", a) and 0
            SW.execute = lambda a: got.setdefault("sw", a) and 0
            R.main(["--log-dir", "/tmp"])
            self.assertIn("run", got)
            self.assertNotIn("sw", got)
            got.clear()
            R.main(["--log-dir", "/tmp", "--switch-405", "--chunk-full", "--retry-shift-mm", "4"])
            self.assertIn("sw", got)
            self.assertNotIn("run", got)
            self.assertEqual(got["sw"].allow_status, [])
            self.assertTrue(got["sw"].chunk_full)
        finally:
            R.run, SW.execute = orig_run, orig

    def test_columns_appended(self):
        self.assertEqual(len(set(SW.SWITCH_COLUMNS)), len(SW.SWITCH_COLUMNS))
        self.assertFalse(set(SW.SWITCH_COLUMNS) & set(R.TRIAL_COLUMNS + R.HANDOVER_COLUMNS + R.FIRST_CHUNK_COLUMNS))


class Paths(unittest.TestCase):
    def test_segment_and_reassemble(self):
        a, b = np.zeros(6), np.r_[np.ones(5) * 10, 50.0]
        p, fr = SW.segment(a, [("X", b, 10)])
        self.assertEqual(len(p), 11)
        self.assertTrue(np.allclose(p[0], a) and np.allclose(p[-1], b))
        self.assertEqual(fr["X"], 10)
        p2, fr2 = SW.reassemble(p, {"START": 0, "X": 10}, {"X": b * 2})
        self.assertEqual(len(p2), 11)
        self.assertTrue(np.allclose(p2[-1], b * 2))

    def test_check_steps_range(self):
        lo, hi = np.full(6, -100.0), np.full(6, 100.0)
        p = np.zeros((3, 6))
        self.assertEqual(SW.check_steps_range(p, lo, hi), "")
        p[2, 1] = 11.0
        self.assertIn("1 コマ", SW.check_steps_range(p, lo, hi))
        p[2, 1] = 101.0
        self.assertIn("範囲の外", SW.check_steps_range(p, lo, hi))


if __name__ == "__main__":
    unittest.main()
```

### 依頼405 の commit 7f97287 の中身（変えたファイルの一覧と、check_40x の外のコードの差分。check_40x のファイルは上に全文）

```text
$ git show --stat 7f97287 && git show --format= 7f97287 -- '*.py' '*.sh' ':(exclude)so101/check_40*/*'
commit 7f97287c27b7d58a7436fffa51ce35cd89c894e6
Author: Eiichi Shimazu <studio@adaptdesign.jp>
Date:   Tue Dec 1 14:42:14 2026 +0900

    依頼 405: 切り替え方式 (コード → π0.5 → コード) に 握れたかの判定と 外したときのコードのやり直しを足した (run_so101_policy.py --switch-405・check_405/switch_405.py. 付けなければ今までどおり). 判定 9〜12 = 挟んだ・5 未満 = 空・ほか = あいまい (空として扱う). 記録 241 回に当てて 挟んだのに開く 1・空なのに運ぶ 1. 空のあと 下で開くと 動く爪がブロックへ入る形が多い (外し方 56 通りで通るのは 3. 上がってから開く --retry-rise-first なら 39). 偽の通し 18 場面 OK. codex 1 回 (必須 4 のうち 3 を直した. あいまいの扱いは決めてほしいこと). 判定 止めた. アームは動かしていない
    
    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

 so101/check_405/REPORT.md             |  173 +
 so101/check_405/analyze_405.py        |  229 ++
 so101/check_405/fake_run_405.json     | 1983 +++++++++++
 so101/check_405/fake_run_405.md       |   48 +
 so101/check_405/fake_run_405.py       |  303 ++
 so101/check_405/judge_405.json        | 6091 +++++++++++++++++++++++++++++++++
 so101/check_405/judge_405.md          |   99 +
 so101/check_405/open_order_405.json   | 1568 +++++++++
 so101/check_405/open_order_405.md     |   24 +
 so101/check_405/open_order_405.py     |   92 +
 so101/check_405/review_r1.txt         |   29 +
 so101/check_405/review_r1_raw.txt     | 1810 ++++++++++
 so101/check_405/review_request_405.md |   31 +
 so101/check_405/session_405.sh        |   91 +
 so101/check_405/switch_405.py         |  916 +++++
 so101/check_405/test_switch_405.py    |  220 ++
 so101/run_so101_policy.py             |   44 +
 17 files changed, 13751 insertions(+)
diff --git a/so101/run_so101_policy.py b/so101/run_so101_policy.py
index 549cedc..7cb9e4d 100644
--- a/so101/run_so101_policy.py
+++ b/so101/run_so101_policy.py
@@ -41,6 +41,10 @@ mechArm の pi05/run_policy_client.py は使わない (カメラ 2 台・関節
     --first-chunk-only (依頼 395. --handover-above-mm と一緒に. 付けなければ今までどおり): 渡す所で止めたまま 推論に 1 回だけ
         問い合わせ, 最初の答えはフォロワーに送らずに記録して (試行のフォルダの first_chunk_395.json), 来たコードの道を逆に HOME へ戻す
         (check_395/first_chunk_395.py). 結果は聞かない. 台帳はその試行だけ さらに FIRST_CHUNK_COLUMNS を足す
+    --switch-405 (依頼 405. 付けなければ今までどおり): rule_401 の道 (check_401/run_rule401.py と同じ読み方・ガード) で渡す所まで →
+        π0.5 (爪の指令が閉じたらやめる) → コードが爪の読みで 挟んだ/空/あいまい を判定 → 挟んだら持ち上げ・箱・戻る / 空なら開いて真上へ戻り
+        読み直して渡し直す (2 回まで). --policy-max-s・--chunk-full・--black-wrist・--retry-shift-mm・--retry-rise-first・--allow-status・--reselect-face・
+        --place1-candidate はこれと一緒に. 1 試行の流れ・記録・台帳 (TRIAL_COLUMNS + switch_405.SWITCH_COLUMNS) は check_405/switch_405.py
 
 1 回の流れ:
   1. ブロックの場所の番号 (1〜5) を聞く
@@ -1112,7 +1116,43 @@ def main(argv=None):
     ap.add_argument("--first-chunk-only", action="store_true",
                     help="依頼 395: --handover-above-mm と一緒に. 渡す所で推論に 1 回だけ問い合わせ, 最初の答えは送らずに記録して HOME へ戻す. "
                          "付けなければ今までどおり")
+    # 依頼 405: 切り替え方式 (コード → π0.5 → コード) に 握れたかの判定と やり直しを足したもの. 付けなければ今までどおり
+    ap.add_argument("--switch-405", action="store_true",
+                    help="依頼 405: rule_401 の道で渡す所まで → π0.5 (閉じたらやめる) → 爪の読みで 挟んだ/空/あいまい → 挟んだら持ち上げ・箱・戻る / "
+                         "空なら開いて真上へ戻り 読み直して渡し直す (2 回まで). check_405/switch_405.py. 付けなければ今までどおり")
+    ap.add_argument("--policy-max-s", type=float, default=None,
+                    help="依頼 405 (--switch-405 と一緒に): π0.5 の区間の上限 (秒. 既定 8). 超えたら止めて「閉じなかった」")
+    ap.add_argument("--chunk-full", action="store_true",
+                    help="依頼 405 (--switch-405 と一緒に): π0.5 の 1 回の答えを最後のコマまで流し切ってから 次を問い合わせる")
+    ap.add_argument("--black-wrist", action="store_true",
+                    help="依頼 405 (--switch-405 と一緒に. 確かめ用): 推論に渡す手首カメラの絵を黒くする (記録の絵は本物)")
+    ap.add_argument("--retry-shift-mm", type=float, default=None,
+                    help="依頼 405 (--switch-405 と一緒に): 渡し直す姿勢を 固定側の爪から離す向きへ さらにこの mm 寄せる (既定 0 = 寄せない)")
+    ap.add_argument("--retry-rise-first", action="store_true",
+                    help="依頼 405 (--switch-405 と一緒に): 空のあと 閉じたまま真上へ上がってから上で開く (既定は 下で開いてから上がる)")
+    ap.add_argument("--allow-status", nargs="*", default=None, choices=["conflict", "deep_at_zero"],
+                    help="依頼 405 (--switch-405 と一緒に): run_rule401.py と同じ")
+    ap.add_argument("--reselect-face", action="store_true", help="依頼 405 (--switch-405 と一緒に): run_rule401.py と同じ (依頼 404)")
+    ap.add_argument("--place1-candidate", action="store_true", help="依頼 405 (--switch-405 と一緒に): run_rule401.py と同じ")
     args = ap.parse_args(argv)
+    sw405 = [o for o, v in (("--policy-max-s", args.policy_max_s is not None), ("--chunk-full", args.chunk_full),
+                            ("--black-wrist", args.black_wrist), ("--retry-shift-mm", args.retry_shift_mm is not None),
+                            ("--retry-rise-first", args.retry_rise_first),
+                            ("--allow-status", args.allow_status is not None), ("--reselect-face", args.reselect_face),
+                            ("--place1-candidate", args.place1_candidate)) if v]
+    if sw405 and not args.switch_405:
+        ap.error(f"{' '.join(sw405)} は --switch-405 と一緒に使う (依頼 405)")
+    if args.switch_405:
+        if args.handover_above_mm is not None or args.first_chunk_only:
+            ap.error("--switch-405 は --handover-above-mm・--first-chunk-only と一緒に使わない (渡す所までの道は rule_401)")
+        if args.rtc or args.warmup:
+            ap.error("--switch-405 は --rtc・--warmup と一緒に使わない")
+        if args.policy_max_s is not None and not (math.isfinite(args.policy_max_s) and 1.0 <= args.policy_max_s <= 60.0):
+            ap.error(f"--policy-max-s は 1〜60 秒: {args.policy_max_s:g}")
+        if args.retry_shift_mm is not None and not (math.isfinite(args.retry_shift_mm) and 0.0 <= args.retry_shift_mm <= 20.0):
+            ap.error(f"--retry-shift-mm は 0〜20 mm: {args.retry_shift_mm:g}")
+        if args.allow_status is None:
+            args.allow_status = []
     if args.first_chunk_only and args.handover_above_mm is None:
         ap.error("--first-chunk-only は --handover-above-mm 50 と一緒に使う (依頼 395)")
     if args.handover_above_mm is not None and args.handover_above_mm != 50.0:
@@ -1135,6 +1175,10 @@ def main(argv=None):
         return warmup(args)
     if not args.log_dir:
         ap.error("--log-dir を付ける")
+    if args.switch_405:                          # 依頼 405: 1 試行の流れ・記録・台帳は check_405/switch_405.py
+        sys.path.insert(0, str(HERE / "check_405"))
+        import switch_405 as SW
+        return SW.execute(args)
     return run(args)
```


## Claude が直接足した、その回だけ値を広げる口（R401_ELEV_MAX_DEG・SO101_RANGE_MARGIN）

場所5 の + 側のガードを、その回だけ広げるために足した。commit b1d4d65 に入っている。そのあと、道を作る範囲が変わって止まったのを直した `handover_392.py` と `var_lib_314.py` の変更は、この記事の時点でまだ commit していない（下の差分）。

### commit b1d4d65 の中身（差分）

```text
$ git show b1d4d65
commit b1d4d65309e898240aae103bcd68aeb73a9061bf
Author: Eiichi Shimazu <studio@adaptdesign.jp>
Date:   Tue Dec 1 18:57:43 2026 +0900

    依頼 407 の前に: その回だけ値を変える口 2 つ (R401_ELEV_MAX_DEG・SO101_RANGE_MARGIN). 中身は 2026-12-01 に足したまま
    
    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

diff --git a/so101/check_401/run_rule401.py b/so101/check_401/run_rule401.py
index 4307143..df561aa 100644
--- a/so101/check_401/run_rule401.py
+++ b/so101/check_401/run_rule401.py
@@ -129,6 +129,9 @@ def world():
     lo, hi = H.rule_range()
     if np.abs(W.w.lo - lo).max() > RANGE_TOL or np.abs(W.w.hi - hi).max() > RANGE_TOL:
         raise Refused(f"rule_401 の道を作る範囲が rule_351 の範囲と違う: {W.w.lo} / {W.w.hi}")
+    em = os.environ.get("R401_ELEV_MAX_DEG")   # 2026-12-01 エイイチ: 爪の面の傾きの許し (既定 ±8°) をその回だけ広げる (場所5 の +側のため)
+    if em:
+        W.w.gmap.elev_max = float(em)
     return W
 
 
@@ -215,7 +218,7 @@ def reselect_candidates(W, uv, yaw, lo, hi, jaw_table_min, skip=None):
             if skip is not None and abs(f - skip[0]) < 1e-6 and skip[1] is not None and abs(c["s"] - skip[1]) < 1e-6:
                 continue
             t = F.try_path(gm, uv, yaw, f, c["s"], W.w.chain, lo, hi, None, None, None, W.w.cam, jaw_table_min)
-            if t["ok"] and (t["jaw_elev_deg"] is None or abs(t["jaw_elev_deg"]) > R351.ELEV_MAX_DEG + 1e-6):
+            if t["ok"] and (t["jaw_elev_deg"] is None or abs(t["jaw_elev_deg"]) > gm.elev_max + 1e-6):
                 t["ok"] = False
             if t["ok"]:
                 oks.append(t)
diff --git a/so101/run_so101_policy.py b/so101/run_so101_policy.py
index 7cb9e4d..0cc1e1e 100644
--- a/so101/run_so101_policy.py
+++ b/so101/run_so101_policy.py
@@ -119,7 +119,7 @@ MAX_HORIZON = 30                        # --exec-steps の上限 (so101b の答
 CAM_W, CAM_H = 640, 480
 OUT_W, OUT_H = 320, 240
 JPEG_Q = 95
-RANGE_MARGIN = 10.0
+RANGE_MARGIN = float(os.environ.get("SO101_RANGE_MARGIN", "10"))   # 2026-12-01 エイイチ: その回だけ広げられる (既定 ±10)
 GRIP_MIN, GRIP_MAX = 0.0, 100.0         # 爪の安全範囲の外枠 (依頼 285)
 LEAD_WINDOW = 5                         # 先に問い合わせるコマ数を決める, 答えが返るまでの時間の直近の回数
 SERVER_RETURNS_ABSOLUTE = True
```

### まだ commit していない変更（handover_392.py・var_lib_314.py）

```text
$ git diff -- so101/check_392/handover_392.py so101/ideal_var/var_lib_314.py
```


## 実機のログ ― 切り替え方式（so101h のサーバーを Runpod に立てて流した）

### 窓1：so101h のサーバーを立てたログ（lab_start.sh --serve-only）

```text
Last login: Tue Dec  1 17:30:22 on ttys002
(base) shimazueiichi@shimadzueiichinoMacBook-Pro ~ % # 窓1：so101h のサーバーを 立ち上げる（Pod を借ります）
cd ~/r2r2r-scripts
./lab_start.sh --model so101h --log so101_Log12 --serve-only
zsh: command not found: #
[LOG   ] ターミナルの出力を残します → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/lab_start_20261201_180743.txt
[RANGE ] 安全範囲 (学習データ ±10°) は /Volumes/KIOXIA/r2r2r-data/datasets/so101_redblock_box_code_rule401_grasp_v1/raw_episodes から (--model so101h)
[SO101 ] 推論のクライアントは so101/run_so101_policy.py (/opt/homebrew/Caskroom/miniforge/base/envs/lerobot/bin/python). --serve-only なのでクライアントは流さない (空打ちだけ)
[SO101 ] 1 回で実行するコマ: 30 (既定. 答えの 30 コマ全部)
[SO101 ] 次の問い合わせ: 答えを実行している間に先に出す (既定. 依頼 285)
[LAB   ] 2026-12-01 18:07:43  GPU=NVIDIA A40  episode=run_0001_20261019_194818  log=/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12  サーバーとトンネルだけ (--serve-only. アームと daemon には触らない)
[MODEL ] --model so101h: SO-101: so101f と同じ値 (答え 30 コマ) で, rule_401 のコードの成功 56 本のつかむ所 (ブロックの上〜閉じた所) だけで学習した 2999 (依頼 403)
         PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1 → /workspace/ckpt/so101_code_rule401_grasp_v1_2999  設定 pi05_so101_code_rule401_grasp_lora  assets local/so101_redblock_box_code_rule401_grasp_v1

=== 1. Pod を作る
[POD   ] 記録の Pod (id 4r8c448n4vzain) は API で見ると残っていない. 新しく作ります
         古い記録は /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/pod/lab_pod_20261201_180744.json に残しました
[POD   ] 作れなかった (1/5, HTTP 400): There are no longer any instances available with the requested specifications. Please refresh and try again.
[POD   ] 30 秒待って作り直します
[POD   ] 作った: id 3pbko3hg98r2ya  GPU=NVIDIA A40  1時間 0.59 ドル  (記録 /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/pod/lab_pod.json)
    (34 秒)

=== 2. Pod が立ち上がるまで待つ
[POD   ] SSH の IP とポートを API から受け取った (<POD_IP>:<SSH_PORT>)
[POD   ] 入れた: c6998b630f27
NVIDIA A40, 46068 MiB
    (27 秒)

=== 3a. スクリプトを送る
    (142 秒)

=== 3b. huggingface_hub を入れ, 鍵を渡す
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
Hint: The `hf-cli` skill is not installed. Run `hf skills add -g` to teach your AI agents how to use the `hf` CLI.
✓ Logged in
  user: PixelstoMotors
    (10 秒)

=== 3c. モデルを取る (hf download PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1)
Fetching 38 files: 100%|██████████| 38/38 [00:08<00:00,  4.42it/s]
✓ Downloaded
  path: /workspace/ckpt/so101_code_rule401_grasp_v1_2999
6.0G	/workspace/ckpt/so101_code_rule401_grasp_v1_2999
    (12 秒)

=== 3d. openpi を取る (215abfb)
215abfb docs(droid): fix config search instruction (#1023)
    (15 秒)

=== 3e. uv sync
downloading uv 0.13.10 x86_64-unknown-linux-gnu
WARN: The following commands are shadowed by other commands in your PATH: uv uvx
Using CPython 3.11.13 interpreter at: /usr/bin/python3.11
Creating virtual environment at: .venv
Resolved 279 packages in 4ms
   Building openpi @ file:///workspace/openpi
   Updating https://github.com/huggingface/lerobot (0cf864870cf29f4738d3ade893e6fd13fbd7cdb5)
   Building openpi-client @ file:///workspace/openpi/packages/openpi-client
Downloading sympy (6.0MiB)
Downloading nvidia-cublas-cu12 (374.9MiB)
Downloading nvidia-cuda-nvrtc-cu12 (22.6MiB)
Downloading nvidia-cusparselt-cu12 (149.5MiB)
Downloading jaxlib (100.2MiB)
Downloading numba (3.7MiB)
Downloading tensorstore (17.5MiB)
Downloading labmaze (4.7MiB)
Downloading triton (148.5MiB)
Downloading nvidia-cusolver-cu12 (150.9MiB)
Downloading opencv-python (60.1MiB)
Downloading cmake (26.6MiB)
Downloading torch (783.1MiB)
Downloading nvidia-cuda-cupti-cu12 (8.5MiB)
Downloading llvmlite (40.4MiB)
Downloading scipy (35.9MiB)
Downloading nvidia-cusparse-cu12 (206.5MiB)
Downloading nvidia-curand-cu12 (53.7MiB)
Downloading opencv-python-headless (47.7MiB)
Downloading dm-control (37.5MiB)
Downloading nvidia-nccl-cu12 (192.0MiB)
Downloading pyopengl (3.0MiB)
Downloading imageio-ffmpeg (28.1MiB)
Downloading rerun-sdk (68.1MiB)
Downloading nvidia-nvjitlink-cu12 (18.8MiB)
Downloading jax-cuda12-pjrt (99.8MiB)
Downloading fonttools (4.7MiB)
Downloading numpy (17.4MiB)
Downloading pyarrow (40.3MiB)
Downloading wandb (20.4MiB)
Downloading av (34.7MiB)
Downloading nvidia-cufft-cu12 (190.9MiB)
Downloading hf-xet (4.9MiB)
Downloading nvidia-cuda-nvcc-cu12 (38.7MiB)
Downloading matplotlib (8.2MiB)
Downloading jax-cuda12-plugin (15.9MiB)
Downloading mujoco (4.4MiB)
Downloading pandas (12.5MiB)
Downloading torchvision (7.1MiB)
Downloading lxml (4.7MiB)
Downloading ruff (11.0MiB)
Downloading numcodecs (8.4MiB)
Downloading pillow (4.4MiB)
Downloading hf-transfer (3.4MiB)
Downloading transformers (10.3MiB)
Downloading h5py (4.3MiB)
Downloading nvidia-cudnn-cu12 (544.5MiB)
Downloading virtualenv (5.8MiB)
Downloading polars (34.6MiB)
Downloading diffusers (3.4MiB)
 Downloaded hf-transfer
 Downloaded pyopengl
Downloading tokenizers (2.9MiB)
Downloading debugpy (3.0MiB)
 Downloaded numba
Downloading jax (2.3MiB)
 Downloaded diffusers
Downloading widgetsnbextension (2.1MiB)
 Downloaded mujoco
 Downloaded pillow
 Downloaded h5py
 Downloaded labmaze
Downloading networkx (1.9MiB)
Downloading ml-dtypes (2.1MiB)
Downloading pydantic-core (1.9MiB)
 Downloaded lxml
 Downloaded fonttools
Downloading kiwisolver (1.4MiB)
Downloading jedi (1.5MiB)
 Downloaded hf-xet
Downloading aiohttp (1.6MiB)
Downloading torchcodec (1.3MiB)
 Downloaded virtualenv
 Downloaded sympy
Downloading sentencepiece (1.2MiB)
Downloading pygments (1.2MiB)
 Downloaded jax
Downloading setuptools (1.1MiB)
 Downloaded kiwisolver
 Downloaded tokenizers
 Downloaded widgetsnbextension
 Downloaded torchcodec
 Downloaded debugpy
Downloading nvidia-cufile-cu12 (1.1MiB)
 Downloaded pydantic-core
Downloading pymunk (1.0MiB)
 Downloaded aiohttp
 Downloaded ml-dtypes
 Downloaded networkx
 Downloaded sentencepiece
 Downloaded torchvision
 Downloaded pygments
 Downloaded jedi
 Downloaded setuptools
 Downloaded nvidia-cufile-cu12
 Downloaded pymunk
 Downloaded matplotlib
 Downloaded numcodecs
 Downloaded nvidia-cuda-cupti-cu12
   Building evdev==1.9.2
 Downloaded transformers
   Building antlr4-python3-runtime==4.9.3
 Downloaded ruff
 Downloaded pandas
 Downloaded jax-cuda12-plugin
 Downloaded numpy
 Downloaded tensorstore
      Built openpi-client @ file:///workspace/openpi/packages/openpi-client
      Built openpi @ file:///workspace/openpi
 Downloaded nvidia-nvjitlink-cu12
 Downloaded wandb
 Downloaded nvidia-cuda-nvrtc-cu12
      Built antlr4-python3-runtime==4.9.3
 Downloaded imageio-ffmpeg
 Downloaded cmake
 Downloaded polars
 Downloaded av
 Downloaded scipy
 Downloaded dm-control
 Downloaded nvidia-cuda-nvcc-cu12
 Downloaded llvmlite
 Downloaded pyarrow
 Downloaded opencv-python-headless
 Downloaded nvidia-curand-cu12
 Downloaded opencv-python
      Built evdev==1.9.2
 Downloaded rerun-sdk
    Updated https://github.com/huggingface/lerobot (0cf864870cf29f4738d3ade893e6fd13fbd7cdb5)
   Building lerobot @ git+https://github.com/huggingface/lerobot@0cf864870cf29f4738d3ade893e6fd13fbd7cdb5
 Downloaded jax-cuda12-pjrt
 Downloaded jaxlib
      Built lerobot @ git+https://github.com/huggingface/lerobot@0cf864870cf29f4738d3ade893e6fd13fbd7cdb5
 Downloaded nvidia-cusparselt-cu12
 Downloaded triton
 Downloaded nvidia-cusolver-cu12
 Downloaded nvidia-cufft-cu12
 Downloaded nvidia-nccl-cu12
 Downloaded nvidia-cusparse-cu12
 Downloaded nvidia-cublas-cu12
 Downloaded nvidia-cudnn-cu12
 Downloaded torch
Prepared 240 packages in 15.52s
Installed 240 packages in 1.77s
 + absl-py==2.3.0
 + aiohappyeyeballs==2.6.1
 + aiohttp==3.12.4
 + aiosignal==1.3.2
 + annotated-types==0.7.0
 + antlr4-python3-runtime==4.9.3
 + asttokens==3.0.0
 + attrs==25.3.0
 + augmax==0.4.1
 + av==17.0.0
 + beartype==0.19.0
 + beautifulsoup4==4.13.4
 + blinker==1.9.0
 + cachetools==5.5.2
 + certifi==2025.4.26
 + cffi==1.17.1
 + cfgv==3.4.0
 + charset-normalizer==3.4.2
 + chex==0.1.90
 + click==8.2.1
 + cloudpickle==3.1.1
 + cmake==4.0.2
 + comm==0.2.2
 + contourpy==1.3.2
 + crc32c==2.7.1
 + cycler==0.12.1
 + datasets==3.6.0
 + debugpy==1.8.14
 + decorator==5.2.1
 + deepdiff==8.5.0
 + diffusers==0.33.1
 + dill==0.3.8
 + distlib==0.3.9
 + dm-control==1.0.14
 + dm-env==1.6
 + dm-tree==0.1.9
 + docker-pycreds==0.4.0
 + docstring-parser==0.16
 + donfig==0.8.1.post1
 + draccus==0.10.0
 + einops==0.8.1
 + equinox==0.12.2
 + etils==1.12.2
 + evdev==1.9.2
 + executing==2.2.0
 + farama-notifications==0.0.4
 + filelock==3.18.0
 + flask==3.1.1
 + flatbuffers==25.2.10
 + flax==0.10.2
 + fonttools==4.58.1
 + frozenlist==1.6.0
 + fsspec==2025.3.0
 + gcsfs==2025.3.0
 + gdown==5.2.0
 + gitdb==4.0.12
 + gitpython==3.1.44
 + glfw==2.9.0
 + google-api-core==2.24.2
 + google-auth==2.40.2
 + google-auth-oauthlib==1.2.2
 + google-cloud-core==2.4.3
 + google-cloud-storage==3.1.0
 + google-crc32c==1.7.1
 + google-resumable-media==2.7.2
 + googleapis-common-protos==1.70.0
 + gym-aloha==0.1.1
 + gymnasium==0.29.1
 + h5py==3.13.0
 + hf-transfer==0.1.9
 + hf-xet==1.1.2
 + huggingface-hub==0.32.3
 + humanize==4.12.3
 + identify==2.6.12
 + idna==3.10
 + imageio==2.37.0
 + imageio-ffmpeg==0.6.0
 + importlib-metadata==8.7.0
 + importlib-resources==6.5.2
 + iniconfig==2.1.0
 + inquirerpy==0.3.4
 + ipykernel==6.29.5
 + ipython==9.2.0
 + ipython-pygments-lexers==1.1.1
 + ipywidgets==8.1.7
 + itsdangerous==2.2.0
 + jax==0.5.3
 + jax-cuda12-pjrt==0.5.3
 + jax-cuda12-plugin==0.5.3
 + jaxlib==0.5.3
 + jaxtyping==0.2.36
 + jedi==0.19.2
 + jinja2==3.1.6
 + jsonlines==4.0.0
 + jupyter-client==8.6.3
 + jupyter-core==5.8.1
 + jupyterlab-widgets==3.0.15
 + kiwisolver==1.4.8
 + labmaze==1.0.6
 + lerobot==0.1.0 (from git+https://github.com/huggingface/lerobot@0cf864870cf29f4738d3ade893e6fd13fbd7cdb5)
 + llvmlite==0.44.0
 + lxml==5.4.0
 + markdown-it-py==3.0.0
 + markupsafe==3.0.2
 + matplotlib==3.10.3
 + matplotlib-inline==0.1.7
 + mdurl==0.1.2
 + mergedeep==1.3.4
 + ml-collections==1.0.0
 + ml-dtypes==0.4.1
 + mpmath==1.3.0
 + msgpack==1.1.0
 + mujoco==2.3.7
 + multidict==6.4.4
 + multiprocess==0.70.16
 + mypy-extensions==1.1.0
 + nest-asyncio==1.6.0
 + networkx==3.5
 + nodeenv==1.9.1
 + numba==0.61.2
 + numcodecs==0.16.1
 + numpy==1.26.4
 + numpydantic==1.6.9
 + nvidia-cublas-cu12==12.6.4.1
 + nvidia-cuda-cupti-cu12==12.6.80
 + nvidia-cuda-nvcc-cu12==12.9.41
 + nvidia-cuda-nvrtc-cu12==12.6.77
 + nvidia-cuda-runtime-cu12==12.6.77
 + nvidia-cudnn-cu12==9.5.1.17
 + nvidia-cufft-cu12==11.3.0.4
 + nvidia-cufile-cu12==1.11.1.6
 + nvidia-curand-cu12==10.3.7.77
 + nvidia-cusolver-cu12==11.7.1.2
 + nvidia-cusparse-cu12==12.5.4.2
 + nvidia-cusparselt-cu12==0.6.3
 + nvidia-ml-py==12.575.51
 + nvidia-nccl-cu12==2.26.2
 + nvidia-nvjitlink-cu12==12.6.85
 + nvidia-nvtx-cu12==12.6.77
 + oauthlib==3.2.2
 + omegaconf==2.3.0
 + opencv-python==4.11.0.86
 + opencv-python-headless==4.11.0.86
 + openpi==0.1.0 (from file:///workspace/openpi)
 + openpi-client==0.1.0 (from file:///workspace/openpi/packages/openpi-client)
 + opt-einsum==3.4.0
 + optax==0.2.4
 + orbax-checkpoint==0.11.13
 + orderly-set==5.4.1
 + packaging==25.0
 + pandas==2.2.3
 + parso==0.8.4
 + pexpect==4.9.0
 + pfzy==0.3.4
 + pillow==11.2.1
 + platformdirs==4.3.8
 + pluggy==1.6.0
 + polars==1.30.0
 + pre-commit==4.2.0
 + prompt-toolkit==3.0.51
 + propcache==0.3.1
 + proto-plus==1.26.1
 + protobuf==4.25.8
 + psutil==7.0.0
 + ptyprocess==0.7.0
 + pure-eval==0.2.3
 + pyarrow==20.0.0
 + pyasn1==0.6.1
 + pyasn1-modules==0.4.2
 + pycparser==2.22
 + pydantic==2.11.5
 + pydantic-core==2.33.2
 + pygments==2.19.1
 + pymunk==7.0.0
 + pynput==1.8.1
 + pynvml==12.0.0
 + pyopengl==3.1.9
 + pyparsing==3.2.3
 + pysocks==1.7.1
 + pytest==8.3.5
 + python-dateutil==2.9.0.post0
 + python-xlib==0.33
 + pytz==2025.2
 + pyyaml==6.0.2
 + pyyaml-include==1.4.1
 + pyzmq==26.4.0
 + regex==2024.11.6
 + requests==2.32.3
 + requests-oauthlib==2.0.0
 + rerun-sdk==0.23.1
 + rich==14.0.0
 + rsa==4.9.1
 + ruff==0.11.12
 + safetensors==0.5.3
 + scipy==1.15.3
 + sentencepiece==0.2.0
 + sentry-sdk==2.29.1
 + setproctitle==1.3.6
 + setuptools==80.9.0
 + shtab==1.7.2
 + simplejson==3.20.1
 + six==1.17.0
 + smmap==5.0.2
 + soupsieve==2.7
 + stack-data==0.6.3
 + sympy==1.14.0
 + tensorstore==0.1.74
 + termcolor==3.1.0
 + tokenizers==0.21.1
 + toml==0.10.2
 + toolz==1.0.0
 + torch==2.7.1
 + torchcodec==0.4.0
 + torchvision==0.22.1
 + tornado==6.5.1
 + tqdm==4.67.1
 + tqdm-loggable==0.2
 + traitlets==5.14.3
 + transformers==4.53.2
 + treescope==0.1.9
 + triton==3.3.1
 + typeguard==4.4.2
 + typing-extensions==4.13.2
 + typing-inspect==0.9.0
 + typing-inspection==0.4.1
 + tyro==0.9.22
 + tzdata==2025.2
 + urllib3==2.4.0
 + virtualenv==20.31.2
 + wadler-lindig==0.1.6
 + wandb==0.19.11
 + wcwidth==0.2.13
 + websockets==15.0.1
 + werkzeug==3.1.3
 + widgetsnbextension==4.0.14
 + wrapt==1.14.1
 + xxhash==3.5.0
 + yarl==1.20.0
 + zarr==3.0.8
 + zipp==3.22.0
    (21 秒)

=== 3f. addon・設定・assets (pi05_so101_code_rule401_grasp_lora)
installed: policies/mecharm_policy.py + config.py (pi05_mecharm_lora)
installed: pi05_mecharm_trim_lora (repo_id=local/mecharm_redblock_box_teach_v1_trim2, 4,000 steps)
installed: policies/so101_policy.py + pi05_so101_code_rule401_grasp_lora (repo_id=local/so101_redblock_box_code_rule401_grasp_v1, 3000 steps, decay_steps 3000, action_horizon 30, init=π0.5 base)
    (2 秒)

=== 4. サーバーの起動
[SERVE ] --model so101h: --policy.config=pi05_so101_code_rule401_grasp_lora --policy.dir=/workspace/ckpt/so101_code_rule401_grasp_v1_2999
INFO:websockets.server:server listening on 0.0.0.0:8000
    (45 秒)

=== 5. Mac の 8000 番へのトンネル
[TUNNEL] localhost:8000 → Pod の 8000 番 (pid 73936. このスクリプトが終わると閉じる)
    (2 秒)

=== 5b. 空打ち (1 回目の推論の待ちを先に済ませる)
[WARM  ] 空打ち 61.2 秒 (答え (30, 6))
    (61 秒)
[SERVE ] --serve-only: サーバー (--model so101h) は localhost:8000 で待っています.
         デーモン・HOME・爪・位置合わせ・推論には進みません. 終わるときは Ctrl-C か kill (TERM) (Pod は消さない)
```

### 窓2：切り替え方式のセッションのログ（18:07〜19:14。手首カメラを黒くした回まで）

```text
Last login: Tue Dec  1 18:07:40 on ttys001
(base) shimazueiichi@shimadzueiichinoMacBook-Pro ~ % cd ~/r2r2r-scripts    
SW405_RISE_FIRST=1 R401_PUSH_LIMIT_MM=-14 R401_PUSH_WINDOW_MM=-14 R401_ALLOW_CONFLICT=1 R401_ALLOW_DEEP=1 R401_PIXEL_TOL_PX=40 R401_START_TOL_DEG=25 ./so101/check_405/session_405.sh --first

==================================================
  場所3 の 1 回目 (全 6 回): ブロックを 場所3 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[73999]: 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 (0x104be43a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x157d883a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[73999]: 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 (0x104be43f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x157d883f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所3: ブロック 画素 [163.8, 306.1]・向き 1.9°・目印から 11.0 画素
[R401  ] 下げ -0.79 mm (ok). つかむ所の爪と机 指令 0.9・予想 -2.39・沈み最大 -19.57 mm. 下りる間 固定側 指令 11.12/予想 7.49・動く爪 29.78/31.01 mm. 持ち上げの始めの予想 -6.01 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 51.7, 'arm_box': 33.1, 'arm_base': 132.9, 'arm_block_pad10': 26.5, 'held_table': 71.4, 'held_box': 35.3, 'jaw_table_grasp': -0.7}
[R401  ] 送れる
Enter で始める (Ctrl-C でやめる) > 
objc[73999]: 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 (0x104be43a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17fbc4778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[73999]: 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 (0x104be43f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17fbc47c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -41.5   +22.7   -20.1   +89.1   -38.1   +58.6
[FIRST ] 最初の目標       -41.8   +22.7   -20.3   +88.0   -38.8   +59.2  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -41.8   +25.5    -9.3   +74.3   -38.8   +59.3  (かかった 0.39 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・16 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 251/251 [00:00<00:00, 2780.89 examples/s]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
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
LIB Build date: Jul  3 2025 03:06:26
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[warn]: Preset M12 is mapped to M10.
Svt[warn]: Preset M12 is mapped to M10.
Svt[info]: Svt[info]: Level of Parallelism: 4
Level of Parallelism: 4
Svt[info]: Svt[info]: Number of PPCS 59
Number of PPCS 59
Svt[info]: Svt[info]: [asm level on system : up to neon_dotprod]
[asm level on system : up to neon_dotprod]
Svt[info]: Svt[info]: [asm level selected : up to neon_dotprod]
[asm level selected : up to neon_dotprod]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: Svt[info]: SVT [config]: bit-depth / color format 			: 8 / YUV420
SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: Svt[info]: SVT [config]: preset / tune / pred struct 		: 10 / PSNR / random access
SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 	: 2 / 16 / key frame
SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: 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 [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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_181516 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37
[INFO] --first: 1 回で止めます. 記録を見てから 続きを打つ: ./so101/check_405/session_405.sh
(base) shimazueiichi@shimadzueiichinoMacBook-Pro r2r2r-scripts % SW405_RISE_FIRST=1 R401_PUSH_LIMIT_MM=-14 R401_PUSH_WINDOW_MM=-14 R401_ALLOW_CONFLICT=1 R401_ALLOW_DEEP=1 R401_PIXEL_TOL_PX=40 R401_START_TOL_DEG=25 PLACES="2 3 4 5" ./so101/check_405/session_405.sh

==================================================
  場所2 の 1 回目 (全 6 回): ブロックを 場所2 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[74202]: 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 (0x101fec3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x163c4c3a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[74202]: 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 (0x101fec3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x163c4c3f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所2: ブロック 画素 [245.0, 170.5]・向き -1.8°・目印から 11.7 画素
[R401  ] 下げ 0.0 mm (deep_at_zero). つかむ所の爪と机 指令 5.04・予想 -9.41・沈み最大 -23.53 mm. 下りる間 固定側 指令 10.24/予想 2.98・動く爪 27.74/25.07 mm. 持ち上げの始めの予想 -10.12 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 55.0, 'arm_box': 33.1, 'arm_base': 198.7, 'arm_block_pad10': 29.6, 'held_table': 68.9, 'held_box': 33.1, 'jaw_table_grasp': 0.1}
[R401  ] 送れる
[SW405 ] この回は 決まりの外の口を使います: status deep_at_zero (--allow-status)
流すなら yes と打つ > yes
objc[74202]: 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 (0x101fec3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17d5c8778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[74202]: 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 (0x101fec3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17d5c87c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -15.2   +54.8   -71.5   +90.9   -15.8   +58.6
[FIRST ] 最初の目標       -15.7   +54.3   -72.0   +89.9   -16.2   +59.6  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -15.6   +55.1   -60.9   +78.2   -16.2   +58.9  (かかった 0.47 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・16 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 253/253 [00:00<00:00, 2759.22 examples/s]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
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
LIB Build date: Jul  3 2025 03:06:26
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[warn]: Svt[warn]: Preset M12 is mapped to M10.
Preset M12 is mapped to M10.
Svt[info]: Svt[info]: Level of Parallelism: 4
Level of Parallelism: 4
Svt[info]: Svt[info]: Number of PPCS 59
Number of PPCS 59
Svt[info]: [asm level on system : 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]
[asm level selected : up to neon_dotprod]
Svt[info]: Svt[info]: -------------------------------------------
Svt[info]: -------------------------------------------
SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: Svt[info]: SVT [config]: bit-depth / color format 			: 8 / YUV420
SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: Svt[info]: SVT [config]: preset / tune / pred struct 		: 10 / PSNR / random access
SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 	: 2 / 16 / key frame
SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: Svt[info]: SVT [config]: BRC mode / rate factor 			: CRF / 30 
SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: Svt[info]: SVT [config]: AQ mode / variance boost 			: 2 / 0
SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: SVT [config]: sharpness / luminance-based QP bias 	: 0 / 0
Svt[info]: Svt[info]: -------------------------------------------
Svt[info]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_181745 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.43

==================================================
  場所4 の 1 回目 (全 6 回): ブロックを 場所4 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[74329]: 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 (0x106acc3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x15ebe83a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[74329]: 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 (0x106acc3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x15ebe83f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所4: ブロック 画素 [280.2, 256.6]・向き 0.1°・目印から 6.8 画素
[R401  ] 下げ -4.25 mm (conflict). つかむ所の爪と机 指令 3.0・予想 -5.83・沈み最大 -19.48 mm. 下りる間 固定側 指令 10.11/予想 7.54・動く爪 22.7/23.96 mm. 持ち上げの始めの予想 -10.33 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 57.3, 'arm_box': 33.1, 'arm_base': 94.2, 'arm_block_pad10': 33.2, 'held_table': 72.1, 'held_box': 34.9, 'jaw_table_grasp': -3.0}
[R401  ] 送れる
[SW405 ] この回は 決まりの外の口を使います: status conflict (--allow-status)
流すなら yes と打つ > yes
objc[74329]: 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 (0x106acc3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17ee60778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[74329]: 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 (0x106acc3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17ee607c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -13.0   -20.3   +40.4   +40.9   -12.1   +58.6
[FIRST ] 最初の目標       -13.6   -20.1   +38.2   +40.8   -12.5   +59.5  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -13.6   -12.6   +44.6   +26.7   -12.5   +58.8  (かかった 0.38 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・14 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 262/262 [00:00<00:00, 3170.81 examples/s]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
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]: 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]: Svt[info]: Level of Parallelism: 4
Level of Parallelism: 4
Svt[info]: Number of PPCS 59
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[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: Svt[info]: SVT [config]: bit-depth / color format 			: 8 / YUV420
SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: Svt[info]: SVT [config]: preset / tune / pred struct 		: 10 / PSNR / random access
SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 	: 2 / 16 / key frame
SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: Svt[info]: SVT [config]: BRC mode / rate factor 			: CRF / 30 
SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: Svt[info]: SVT [config]: AQ mode / variance boost 			: 2 / 0
SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: Svt[info]: SVT [config]: sharpness / luminance-based QP bias 	: 0 / 0
SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: Svt[info]: Svt[info]: SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
-------------------------------------------
Svt[info]: Svt[info]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_181856 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所5 の 1 回目 (全 6 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[74434]: 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 (0x1028d03a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1421683a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[74434]: 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 (0x1028d03f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1421683f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所5: ブロック 画素 [418.5, 163.5]・向き -3.8°・目印から 14.0 画素
[R401  ] 下げ 0.0 mm (deep_at_zero). つかむ所の爪と机 指令 3.81・予想 -6.2・沈み最大 -24.38 mm. 下りる間 固定側 指令 10.98/予想 12.15・動く爪 31.87/23.17 mm. 持ち上げの始めの予想 -8.81 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 53.8, 'arm_box': 33.1, 'arm_base': 200.1, 'arm_block_pad10': 27.4, 'held_table': 67.7, 'held_box': 32.0, 'jaw_table_grasp': 3.8}
[R401  ] 送れる
[SW405 ] この回は 決まりの外の口を使います: status deep_at_zero (--allow-status)
流すなら yes と打つ > yes
objc[74434]: 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 (0x1028d03a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17d0ac778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[74434]: 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 (0x1028d03f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17d0ac7c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         +11.9   +47.2   -57.3   +83.6   +10.9   +58.6
[FIRST ] 最初の目標       +12.5   +46.7   -58.4   +82.9   +11.7   +58.9  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   +12.5   +47.4   -46.4   +69.9   +11.7   +59.2  (かかった 0.38 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・18 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 257/257 [00:00<00:00, 2891.61 examples/s]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
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
LIB Build date: Jul  3 2025 03:06:26
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[warn]: Preset M12 is mapped to M10.
Svt[warn]: Preset M12 is mapped to M10.
Svt[info]: Svt[info]: Level of Parallelism: 4
Level of Parallelism: 4
Svt[info]: Svt[info]: Number of PPCS 59
Number of PPCS 59
Svt[info]: [asm level on system : 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]
[asm level selected : up to neon_dotprod]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: Svt[info]: SVT [config]: bit-depth / color format 			: 8 / YUV420
SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: Svt[info]: SVT [config]: preset / tune / pred struct 		: 10 / PSNR / random access
SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 	: 2 / 16 / key frame
SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: Svt[info]: SVT [config]: BRC mode / rate factor 			: CRF / 30 
SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: Svt[info]: SVT [config]: AQ mode / variance boost 			: 2 / 0
SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: Svt[info]: SVT [config]: sharpness / luminance-based QP bias 	: 0 / 0
SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_182001 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所2 の 2 回目 (全 6 回): ブロックを 場所2 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[74552]: 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 (0x1047743a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1603083a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[74552]: 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 (0x1047743f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1603083f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所2: ブロック 画素 [241.0, 172.6]・向き 2.0°・目印から 8.5 画素
[R401  ] 下げ 0.0 mm (deep_at_zero). つかむ所の爪と机 指令 4.93・予想 -8.96・沈み最大 -23.35 mm. 下りる間 固定側 指令 10.37/予想 3.53・動く爪 28.24/25.34 mm. 持ち上げの始めの予想 -9.93 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 54.9, 'arm_box': 33.1, 'arm_base': 195.8, 'arm_block_pad10': 29.4, 'held_table': 68.9, 'held_box': 33.0, 'jaw_table_grasp': 0.5}
[R401  ] 送れる
[SW405 ] この回は 決まりの外の口を使います: status deep_at_zero (--allow-status)
流すなら yes と打つ > yes
objc[74552]: 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 (0x1047743a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x1775c0778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[74552]: 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 (0x1047743f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x1775c07c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -16.2   +45.8   -55.3   +83.9   -12.6   +58.6
[FIRST ] 最初の目標       -16.7   +45.4   -57.5   +84.1   -13.1   +59.5  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -16.7   +44.7   -47.8   +74.9   -13.0   +58.7  (かかった 0.38 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・15 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 265/265 [00:00<00:00, 3122.06 examples/s]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
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
LIB Build date: Jul  3 2025 03:06:26
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[warn]: Svt[warn]: Preset M12 is mapped to M10.
Preset M12 is mapped to M10.
Svt[info]: Svt[info]: Level of Parallelism: 4
Level of Parallelism: 4
Svt[info]: Svt[info]: Number of PPCS 59
Number of PPCS 59
Svt[info]: Svt[info]: [asm level on system : up to neon_dotprod]
[asm level on system : up to neon_dotprod]
Svt[info]: Svt[info]: [asm level selected : up to neon_dotprod]
[asm level selected : up to neon_dotprod]
Svt[info]: Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
-------------------------------------------
Svt[info]: Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: Svt[info]: SVT [config]: bit-depth / color format 			: 8 / YUV420
SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: Svt[info]: SVT [config]: preset / tune / pred struct 		: 10 / PSNR / random access
SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: 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 [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: Svt[info]: SVT [config]: AQ mode / variance boost 			: 2 / 0
SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: Svt[info]: SVT [config]: sharpness / luminance-based QP bias 	: 0 / 0
SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_182109 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所3 の 2 回目 (全 6 回): ブロックを 場所3 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[74659]: 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 (0x1041a83a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x14bef43a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[74659]: 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 (0x1041a83f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x14bef43f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所3: ブロック 画素 [164.9, 307.6]・向き -3.7°・目印から 10.5 画素
[R401  ] 下げ -0.79 mm (ok). つかむ所の爪と机 指令 0.9・予想 -2.36・沈み最大 -19.69 mm. 下りる間 固定側 指令 10.97/予想 7.24・動く爪 29.87/31.19 mm. 持ち上げの始めの予想 -6.08 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 51.7, 'arm_box': 33.1, 'arm_base': 127.3, 'arm_block_pad10': 26.4, 'held_table': 71.4, 'held_box': 35.3, 'jaw_table_grasp': -0.7}
[R401  ] 送れる
objc[74659]: 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 (0x1041a83a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x303920778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[74659]: 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 (0x1041a83f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x3039207c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -41.0   +23.1   -20.5   +89.2   -43.0   +58.6
[FIRST ] 最初の目標       -41.3   +23.0   -20.4   +87.7   -43.9   +59.4  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -41.4   +25.4    -9.5   +74.4   -43.8   +59.0  (かかった 0.37 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・16 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 252/252 [00:00<00:00, 3007.01 examples/s]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
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
LIB Build date: Jul  3 2025 03:06:26
Svt[info]: 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]: Svt[info]: Number of PPCS 59
Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[info]: Svt[info]: [asm level on system : up to neon_dotprod]
[asm level on system : up to neon_dotprod]
Svt[info]: Svt[info]: [asm level selected : up to neon_dotprod]
[asm level selected : up to neon_dotprod]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: Svt[info]: SVT [config]: bit-depth / color format 			: 8 / YUV420
SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: Svt[info]: SVT [config]: preset / tune / pred struct 		: 10 / PSNR / random access
SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 	: 2 / 16 / key frame
SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: Svt[info]: SVT [config]: BRC mode / rate factor 			: CRF / 30 
SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: Svt[info]: SVT [config]: AQ mode / variance boost 			: 2 / 0
SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: Svt[info]: SVT [config]: sharpness / luminance-based QP bias 	: 0 / 0
SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_182215 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所4 の 2 回目 (全 6 回): ブロックを 場所4 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[74770]: 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 (0x1064543a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1514d83a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[74770]: 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 (0x1064543f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1514d83f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所4: ブロック 画素 [281.1, 255.4]・向き 1.3°・目印から 7.0 画素
[R401  ] 下げ -4.63 mm (conflict). つかむ所の爪と机 指令 2.52・予想 -5.86・沈み最大 -19.93 mm. 下りる間 固定側 指令 10.22/予想 7.74・動く爪 22.75/23.95 mm. 持ち上げの始めの予想 -10.53 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 57.2, 'arm_box': 33.1, 'arm_base': 94.2, 'arm_block_pad10': 33.1, 'held_table': 72.4, 'held_box': 35.0, 'jaw_table_grasp': -3.0}
[R401  ] 送れる
[SW405 ] この回は 決まりの外の口を使います: status conflict (--allow-status)
流すなら yes と打つ > yes
objc[74770]: 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 (0x1064543a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x30238c778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[74770]: 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 (0x1064543f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x30238c7c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -12.7   -20.2   +40.4   +40.9   -10.7   +58.6
[FIRST ] 最初の目標       -13.2   -19.9   +38.4   +40.1   -11.1   +58.6  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -13.2   -11.2   +45.7   +24.1   -11.1   +58.8  (かかった 0.38 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・15 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 257/257 [00:00<00:00, 3127.05 examples/s]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: 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 [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]: Svt[warn]: Preset M12 is mapped to M10.
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]: Svt[info]: [asm level on system : up to neon_dotprod]
[asm level on system : up to neon_dotprod]
Svt[info]: [asm level selected : up to neon_dotprod]
Svt[info]: -------------------------------------------
Svt[info]: Svt[info]: [asm level selected : up to neon_dotprod]
SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: 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[info]: SVT [config]: main profile	tier (auto)	level (auto)
SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: Svt[info]: SVT [config]: bit-depth / color format 			: 8 / YUV420
SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: Svt[info]: SVT [config]: preset / tune / pred struct 		: 10 / PSNR / random access
SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 	: 2 / 16 / key frame
SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: SVT [config]: BRC mode / rate factor 			: CRF / 30 
Svt[info]: 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_182304 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所5 の 2 回目 (全 6 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[74876]: 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 (0x1022583a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1398c03a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[74876]: 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 (0x1022583f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1398c03f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所5: ブロック 画素 [415.1, 164.4]・向き -2.4°・目印から 12.1 画素
[R401  ] 下げ -2.85 mm (ok). つかむ所の爪と机 指令 0.9・予想 -2.39・沈み最大 -27.05 mm. 下りる間 固定側 指令 10.94/予想 13.76・動く爪 29.17/25.27 mm. 持ち上げの始めの予想 -9.66 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 53.8, 'arm_box': 33.1, 'arm_base': 197.8, 'arm_block_pad10': 27.8, 'held_table': 70.4, 'held_box': 33.6, 'jaw_table_grasp': 0.9}
[R401  ] 送れる
objc[74876]: 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 (0x1022583a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x171aec778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[74876]: 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 (0x1022583f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x171aec7c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         +11.3   +43.6   -51.2   +80.9   +11.6   +58.6
[FIRST ] 最初の目標       +12.0   +43.2   -52.9   +80.9   +12.4   +59.4  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   +12.0   +43.9   -41.6   +68.6   +12.4   +59.0  (かかった 0.38 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・16 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 261/261 [00:00<00:00, 2759.57 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_182352 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所2 の 3 回目 (全 6 回): ブロックを 場所2 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[74967]: 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 (0x104a9c3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1332a03a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[74967]: 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 (0x104a9c3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1332a03f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所2: ブロック 画素 [241.0, 174.6]・向き -5.3°・目印から 9.6 画素
[R401  ] 下げ 0.0 mm (deep_at_zero). つかむ所の爪と机 指令 5.18・予想 -9.92・沈み最大 -23.43 mm. 下りる間 固定側 指令 10.22/予想 2.48・動く爪 26.98/24.68 mm. 持ち上げの始めの予想 -10.49 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 55.2, 'arm_box': 33.1, 'arm_base': 194.8, 'arm_block_pad10': 30.0, 'held_table': 68.9, 'held_box': 33.4, 'jaw_table_grasp': -0.5}
[R401  ] 送れる
[SW405 ] この回は 決まりの外の口を使います: status deep_at_zero (--allow-status)
流すなら yes と打つ > yes
objc[74967]: 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 (0x104a9c3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x16d13c778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[74967]: 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 (0x104a9c3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x16d13c7c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -15.8   +51.4   -64.9   +88.2   -20.3   +58.6
[FIRST ] 最初の目標       -16.3   +50.7   -66.1   +87.6   -20.8   +59.5  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -16.3   +51.4   -53.4   +74.8   -20.8   +59.9  (かかった 0.38 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・14 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 260/260 [00:00<00:00, 3150.07 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[warn]: Svt[info]: Preset M12 is mapped to M10.
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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_182430 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所3 の 3 回目 (全 6 回): ブロックを 場所3 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[75053]: 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 (0x1029503a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13bd8c3a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[75053]: 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 (0x1029503f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13bd8c3f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所3: ブロック 画素 [161.7, 307.8]・向き 2.0°・目印から 8.5 画素
[R401  ] 下げ -0.79 mm (ok). つかむ所の爪と机 指令 0.9・予想 -2.39・沈み最大 -19.58 mm. 下りる間 固定側 指令 10.96/予想 7.31・動く爪 29.89/31.12 mm. 持ち上げの始めの予想 -6.01 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 51.7, 'arm_box': 33.1, 'arm_base': 132.2, 'arm_block_pad10': 26.4, 'held_table': 71.4, 'held_box': 35.3, 'jaw_table_grasp': -0.7}
[R401  ] 送れる
objc[75053]: 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 (0x1029503a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x171474778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[75053]: 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 (0x1029503f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x1714747c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -41.9   +22.7   -19.8   +89.2   -38.2   +58.6
[FIRST ] 最初の目標       -42.3   +22.6   -21.8   +89.6   -39.1   +58.6  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -42.3   +24.2   -15.3   +81.5   -39.1   +58.6  (かかった 0.39 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・16 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 265/265 [00:00<00:00, 2866.39 examples/s]
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: Svt[info]: -------------------------------------------
SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
Svt[info]: Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
LIB Build date: Jul  3 2025 03:06:26
Svt[info]: 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]: Svt[info]: Number of PPCS 59
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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_182515 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所4 の 3 回目 (全 6 回): ブロックを 場所4 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[75144]: 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 (0x101d403a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x12048c3a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[75144]: 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 (0x101d403f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x12048c3f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所4: ブロック 画素 [280.6, 259.3]・向き 1.1°・目印から 8.9 画素
[R401  ] 下げ -4.52 mm (conflict). つかむ所の爪と机 指令 2.67・予想 -5.85・沈み最大 -19.57 mm. 下りる間 固定側 指令 10.21/予想 7.73・動く爪 22.72/23.94 mm. 持ち上げの始めの予想 -10.4 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 57.2, 'arm_box': 33.1, 'arm_base': 91.5, 'arm_block_pad10': 33.1, 'held_table': 72.3, 'held_box': 35.0, 'jaw_table_grasp': -3.0}
[R401  ] 送れる
[SW405 ] この回は 決まりの外の口を使います: status conflict (--allow-status)
流すなら yes と打つ > yes
objc[75144]: 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 (0x101d403a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x1754fc778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[75144]: 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 (0x101d403f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x1754fc7c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -13.1   -21.7   +41.6   +40.9   -11.0   +58.6
[FIRST ] 最初の目標       -13.6   -21.5   +39.4   +40.5   -11.4   +59.5  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -13.6   -13.6   +46.2   +26.1   -11.4   +59.3  (かかった 0.44 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・16 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 261/261 [00:00<00:00, 3006.50 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_182554 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所5 の 3 回目 (全 6 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[75234]: 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 (0x106be03a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x15f5fc3a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[75234]: 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 (0x106be03f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x15f5fc3f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所5: ブロック 画素 [416.4, 167.9]・向き 0.4°・目印から 15.7 画素
[R401  ] 下げ -2.62 mm (ok). つかむ所の爪と机 指令 0.9・予想 -2.35・沈み最大 -26.63 mm. 下りる間 固定側 指令 11.09/予想 14.05・動く爪 29.94/25.95 mm. 持ち上げの始めの予想 -4.77 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 53.5, 'arm_box': 33.1, 'arm_base': 196.4, 'arm_block_pad10': 27.4, 'held_table': 69.9, 'held_box': 33.4, 'jaw_table_grasp': 0.9}
[R401  ] 送れる
objc[75234]: 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 (0x106be03a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17b1c8778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[75234]: 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 (0x106be03f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17b1c87c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         +11.8   +39.0   -42.8   +77.3   +15.2   +58.6
[FIRST ] 最初の目標       +12.5   +38.6   -43.3   +76.0   +16.1   +59.3  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   +12.4   +39.6   -30.6   +62.1   +16.1   +59.3  (かかった 0.43 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・15 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 250/250 [00:00<00:00, 3028.17 examples/s]
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: 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]: Svt[warn]: Preset M12 is mapped to M10.
Preset M12 is mapped to M10.
Svt[info]: Level of Parallelism: 4
Svt[info]: Svt[info]: Number of PPCS 59
Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[info]: Svt[info]: [asm level on system : up to neon_dotprod]
[asm level on system : up to neon_dotprod]
Svt[info]: Svt[info]: [asm level selected : up to neon_dotprod]
[asm level selected : up to neon_dotprod]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: Svt[info]: SVT [config]: bit-depth / color format 			: 8 / YUV420
SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: Svt[info]: SVT [config]: preset / tune / pred struct 		: 10 / PSNR / random access
SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 	: 2 / 16 / key frame
SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: Svt[info]: SVT [config]: BRC mode / rate factor 			: CRF / 30 
SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: Svt[info]: SVT [config]: AQ mode / variance boost 			: 2 / 0
SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: Svt[info]: SVT [config]: sharpness / luminance-based QP bias 	: 0 / 0
SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_182653 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所2 の 4 回目 (全 6 回): ブロックを 場所2 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[75363]: 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 (0x1072903a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x160f383a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[75363]: 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 (0x1072903f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x160f383f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所2: ブロック 画素 [244.3, 170.3]・向き -1.4°・目印から 11.0 画素
[R401  ] 下げ 0.0 mm (deep_at_zero). つかむ所の爪と机 指令 5.03・予想 -9.38・沈み最大 -23.55 mm. 下りる間 固定側 指令 10.24/予想 3.01・動く爪 27.8/25.1 mm. 持ち上げの始めの予想 -10.08 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 55.0, 'arm_box': 33.1, 'arm_base': 199.3, 'arm_block_pad10': 29.6, 'held_table': 68.9, 'held_box': 33.1, 'jaw_table_grasp': 0.2}
[R401  ] 送れる
[SW405 ] この回は 決まりの外の口を使います: status deep_at_zero (--allow-status)
流すなら yes と打つ > yes
objc[75363]: 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 (0x1072903a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17f494778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[75363]: 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 (0x1072903f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17f4947c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -15.3   +54.8   -71.1   +90.9   -15.6   +58.6
[FIRST ] 最初の目標       -15.7   +54.4   -72.5   +90.5   -16.0   +59.8  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -15.7   +55.1   -61.4   +78.8   -16.0   +59.9  (かかった 0.36 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・10 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 253/253 [00:00<00:00, 3070.87 examples/s]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
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
LIB Build date: Jul  3 2025 03:06:26
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[warn]: Svt[warn]: Preset M12 is mapped to M10.
Preset M12 is mapped to M10.
Svt[info]: Svt[info]: Level of Parallelism: 4
Level of Parallelism: 4
Svt[info]: Svt[info]: Number of PPCS 59
Number of PPCS 59
Svt[info]: Svt[info]: [asm level on system : up to neon_dotprod]
[asm level on system : up to neon_dotprod]
Svt[info]: Svt[info]: [asm level selected : up to neon_dotprod]
[asm level selected : up to neon_dotprod]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: Svt[info]: SVT [config]: bit-depth / color format 			: 8 / YUV420
SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: Svt[info]: SVT [config]: preset / tune / pred struct 		: 10 / PSNR / random access
SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 	: 2 / 16 / key frame
SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: Svt[info]: SVT [config]: BRC mode / rate factor 			: CRF / 30 
SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: Svt[info]: SVT [config]: AQ mode / variance boost 			: 2 / 0
SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: Svt[info]: SVT [config]: sharpness / luminance-based QP bias 	: 0 / 0
SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_182738 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所3 の 4 回目 (全 6 回): ブロックを 場所3 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[75515]: 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 (0x1077403a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1679783a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[75515]: 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 (0x1077403f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1679783f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:Error reading frame in background thread for OpenCVCamera(1): OpenCVCamera(1) read failed (status=False).
WARNING:lerobot.cameras.opencv.camera_opencv:Error reading frame in background thread for OpenCVCamera(1): OpenCVCamera(1) read failed (status=False).
[REST] 力を入れたままポートを閉じた. フォロワーを支えてから電源を切る
[REST] camera disconnect: OpenCVCamera(1) not connected.
[REST] camera disconnect: OpenCVCamera(0) not connected.

[STOP  ] 失敗で止まりました: GuardError: 力を入れる前に読んだ位置 (B の最初の「前の目標」) がない. 送らない
[SW405 ] 送る前に止めたので 台帳に書きません (GuardError: 力を入れる前に読んだ位置 (B の最初の「前の目標」) がない. 送らない)
[INFO] 動かさずに止まった (置き直してもう一度)

==================================================
  場所3 の 4 回目 (全 6 回): ブロックを 場所3 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[75560]: 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 (0x1060383a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x142d9c3a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[75560]: 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 (0x1060383f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x142d9c3f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所3: ブロック 画素 [163.9, 306.7]・向き -1.2°・目印から 10.5 画素
[R401  ] 下げ -0.79 mm (ok). つかむ所の爪と机 指令 0.9・予想 -2.38・沈み最大 -19.67 mm. 下りる間 固定側 指令 10.93/予想 7.24・動く爪 29.9/31.18 mm. 持ち上げの始めの予想 -6.06 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 51.7, 'arm_box': 33.1, 'arm_base': 130.1, 'arm_block_pad10': 26.3, 'held_table': 71.4, 'held_box': 35.3, 'jaw_table_grasp': -0.7}
[R401  ] 送れる
objc[75560]: 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 (0x1060383a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x33a3a8778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[75560]: 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 (0x1060383f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x33a3a87c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -41.2   +23.3   -20.8   +89.6   -40.7   +58.6
[FIRST ] 最初の目標       -41.6   +23.2   -21.2   +88.5   -41.4   +59.3  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -41.6   +25.7   -11.1   +75.9   -41.4   +59.3  (かかった 0.39 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・15 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 255/255 [00:00<00:00, 2838.79 examples/s]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
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
LIB Build date: Jul  3 2025 03:06:26
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[warn]: Preset M12 is mapped to M10.
Svt[warn]: Preset M12 is mapped to M10.
Svt[info]: Svt[info]: Level of Parallelism: 4
Level of Parallelism: 4
Svt[info]: Svt[info]: Number of PPCS 59
Number of PPCS 59
Svt[info]: Svt[info]: [asm level on system : up to neon_dotprod]
[asm level on system : up to neon_dotprod]
Svt[info]: Svt[info]: [asm level selected : up to neon_dotprod]
[asm level selected : up to neon_dotprod]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: Svt[info]: SVT [config]: bit-depth / color format 			: 8 / YUV420
SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: Svt[info]: SVT [config]: preset / tune / pred struct 		: 10 / PSNR / random access
SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 	: 2 / 16 / key frame
SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: Svt[info]: SVT [config]: BRC mode / rate factor 			: CRF / 30 
Svt[info]: SVT [config]: BRC mode / rate factor 				: CRF / 30 
SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: Svt[info]: SVT [config]: AQ mode / variance boost 			: 2 / 0
SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: SVT [config]: sharpness / luminance-based QP bias 	: 0 / 0
Svt[info]: Svt[info]: -------------------------------------------
Svt[info]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_182956 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所4 の 4 回目 (全 6 回): ブロックを 場所4 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[75678]: 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 (0x106e243a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x155d6c3a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[75678]: 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 (0x106e243f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x155d6c3f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所4: ブロック 画素 [280.6, 254.5]・向き 1.7°・目印から 6.3 画素
[R401  ] 下げ -4.71 mm (conflict). つかむ所の爪と机 指令 2.42・予想 -5.86・沈み最大 -20.07 mm. 下りる間 固定側 指令 10.23/予想 7.76・動く爪 22.79/23.97 mm. 持ち上げの始めの予想 -10.59 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 57.1, 'arm_box': 33.1, 'arm_base': 94.8, 'arm_block_pad10': 33.0, 'held_table': 72.5, 'held_box': 35.0, 'jaw_table_grasp': -3.0}
[R401  ] 送れる
[SW405 ] この回は 決まりの外の口を使います: status conflict (--allow-status)
流すなら yes と打つ > yes
objc[75678]: 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 (0x106e243a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x16e400778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[75678]: 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 (0x106e243f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x16e4007c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -12.8   -19.6   +40.3   +40.9   -10.0   +58.6
[FIRST ] 最初の目標       -13.4   -19.3   +38.2   +40.1   -10.5   +58.7  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -13.4   -10.3   +45.8   +23.2   -10.5   +58.8  (かかった 0.39 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・13 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 256/256 [00:00<00:00, 2926.17 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183036 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所5 の 4 回目 (全 6 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[75784]: 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 (0x10677c3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13ac143a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[75784]: 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 (0x10677c3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13ac143f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所5: ブロック 画素 [416.4, 161.4]・向き -4.4°・目印から 11.1 画素
[R401  ] 下げ -2.99 mm (ok). つかむ所の爪と机 指令 0.91・予想 -2.66・沈み最大 -27.42 mm. 下りる間 固定側 指令 10.93/予想 13.66・動く爪 28.65/24.8 mm. 持ち上げの始めの予想 -5.13 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 53.9, 'arm_box': 33.1, 'arm_base': 199.7, 'arm_block_pad10': 28.5, 'held_table': 70.7, 'held_box': 33.8, 'jaw_table_grasp': 0.7}
[R401  ] 送れる
objc[75784]: 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 (0x10677c3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x308a98778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[75784]: 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 (0x10677c3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x308a987c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         +11.3   +42.2   -48.7   +79.9    +9.9   +58.6
[FIRST ] 最初の目標       +11.9   +41.9   -50.9   +80.0   +10.7   +59.3  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   +12.0   +43.4   -41.8   +69.2   +10.7   +58.9  (かかった 0.37 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・16 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 266/266 [00:00<00:00, 3249.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]: 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]: -------------------------------------------
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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183119 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所2 の 5 回目 (全 6 回): ブロックを 場所2 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[75874]: 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 (0x1057a83a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1647383a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[75874]: 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 (0x1057a83f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1647383f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所2: ブロック 画素 [242.3, 169.9]・向き -2.4°・目印から 9.0 画素
[R401  ] 下げ -2.71 mm (conflict). つかむ所の爪と机 指令 2.38・予想 -5.88・沈み最大 -26.39 mm. 下りる間 固定側 指令 10.36/予想 6.41・動く爪 24.47/25.32 mm. 持ち上げの始めの予想 -10.94 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 55.0, 'arm_box': 33.1, 'arm_base': 193.3, 'arm_block_pad10': 23.9, 'held_table': 71.5, 'held_box': 35.1, 'jaw_table_grasp': -2.8}
[R401  ] 送れる
[SW405 ] この回は 決まりの外の口を使います: status conflict (--allow-status)
流すなら yes と打つ > yes
objc[75874]: 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 (0x1057a83a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17fcf4778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[75874]: 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 (0x1057a83f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17fcf47c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -13.1   +44.5   -52.8   +82.9   -14.2   +58.6
[FIRST ] 最初の目標       -13.5   +44.1   -54.5   +82.6   -14.7   +58.5  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -14.9   +45.6   -45.6   +72.3   -16.2   +58.1  (かかった 0.38 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・19 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 260/260 [00:00<00:00, 3075.69 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183159 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所3 の 5 回目 (全 6 回): ブロックを 場所3 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[75978]: 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 (0x103dcc3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13caac3a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[75978]: 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 (0x103dcc3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13caac3f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所3: ブロック 画素 [162.6, 305.9]・向き 1.9°・目印から 10.6 画素
[R401  ] 下げ -0.79 mm (ok). つかむ所の爪と机 指令 0.9・予想 -2.4・沈み最大 -19.63 mm. 下りる間 固定側 指令 10.91/予想 7.28・動く爪 29.92/31.14 mm. 持ち上げの始めの予想 -6.02 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 51.7, 'arm_box': 33.1, 'arm_base': 133.4, 'arm_block_pad10': 26.3, 'held_table': 71.4, 'held_box': 35.3, 'jaw_table_grasp': -0.7}
[R401  ] 送れる
objc[75978]: 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 (0x103dcc3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x3012bc778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[75978]: 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 (0x103dcc3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x3012bc7c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -41.6   +23.3   -20.8   +89.6   -38.1   +58.6
[FIRST ] 最初の目標       -41.9   +23.2   -21.4   +88.4   -38.9   +59.1  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -41.9   +26.0   -10.4   +74.7   -38.9   +59.2  (かかった 0.41 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・16 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 251/251 [00:00<00:00, 3112.05 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183242 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.43

==================================================
  場所4 の 5 回目 (全 6 回): ブロックを 場所4 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[76054]: 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 (0x1042dc3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1358803a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[76054]: 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 (0x1042dc3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1358803f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所4: ブロック 画素 [280.5, 255.5]・向き 1.1°・目印から 6.5 画素
[R401  ] 下げ -4.53 mm (conflict). つかむ所の爪と机 指令 2.64・予想 -5.84・沈み最大 -19.83 mm. 下りる間 固定側 指令 10.19/予想 7.69・動く爪 22.76/23.97 mm. 持ち上げの始めの予想 -10.48 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 57.2, 'arm_box': 33.1, 'arm_base': 94.4, 'arm_block_pad10': 33.1, 'held_table': 72.3, 'held_box': 35.0, 'jaw_table_grasp': -2.9}
[R401  ] 送れる
[SW405 ] この回は 決まりの外の口を使います: status conflict (--allow-status)
流すなら yes と打つ > yes
objc[76054]: 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 (0x1042dc3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x16d904778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[76054]: 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 (0x1042dc3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x16d9047c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -13.1   -19.9   +40.3   +40.9   -11.0   +58.6
[FIRST ] 最初の目標       -13.6   -19.7   +38.6   +40.0   -11.5   +58.4  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -13.6   -10.6   +46.3   +23.1   -11.5   +58.2  (かかった 0.40 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・13 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 255/255 [00:00<00:00, 3107.81 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183321 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所5 の 5 回目 (全 6 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[76168]: 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 (0x1062603a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x12b0383a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[76168]: 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 (0x1062603f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x12b0383f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所5: ブロック 画素 [413.4, 163.4]・向き 0.4°・目印から 10.3 画素
[R401  ] 下げ -2.66 mm (ok). つかむ所の爪と机 指令 0.9・予想 -2.38・沈み最大 -26.94 mm. 下りる間 固定側 指令 11.09/予想 14.02・動く爪 29.75/25.75 mm. 持ち上げの始めの予想 -9.6 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 53.6, 'arm_box': 33.1, 'arm_base': 197.8, 'arm_block_pad10': 27.5, 'held_table': 70.0, 'held_box': 33.4, 'jaw_table_grasp': 0.9}
[R401  ] 送れる
objc[76168]: 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 (0x1062603a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x16e4e0778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[76168]: 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 (0x1062603f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x16e4e07c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         +11.3   +42.9   -49.8   +80.4   +14.3   +58.6
[FIRST ] 最初の目標       +11.9   +42.4   -50.7   +79.5   +15.1   +59.3  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   +11.9   +43.5   -38.5   +66.3   +15.1   +59.2  (かかった 0.38 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・15 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 256/256 [00:00<00:00, 3197.45 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183405 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所2 の 6 回目 (全 6 回): ブロックを 場所2 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[76256]: 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 (0x1048d83a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13dd743a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[76256]: 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 (0x1048d83f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13dd743f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所2: ブロック 画素 [244.1, 172.9]・向き -2.9°・目印から 11.5 画素
[R401  ] 下げ 0.0 mm (deep_at_zero). つかむ所の爪と机 指令 5.09・予想 -9.54・沈み最大 -23.41 mm. 下りる間 固定側 指令 10.26/予想 2.86・動く爪 27.49/24.96 mm. 持ち上げの始めの予想 -10.26 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 55.1, 'arm_box': 33.1, 'arm_base': 195.8, 'arm_block_pad10': 29.7, 'held_table': 68.9, 'held_box': 33.2, 'jaw_table_grasp': -0.1}
[R401  ] 送れる
[SW405 ] この回は 決まりの外の口を使います: status deep_at_zero (--allow-status)
流すなら yes と打つ > yes
objc[76256]: 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 (0x1048d83a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17f114778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[76256]: 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 (0x1048d83f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17f1147c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -15.4   +48.9   -60.7   +86.2   -17.1   +58.6
[FIRST ] 最初の目標       -15.7   +48.1   -62.2   +85.9   -17.6   +59.0  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -15.7   +47.9   -48.9   +73.4   -17.6   +59.3  (かかった 0.38 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・15 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 256/256 [00:00<00:00, 2929.03 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[warn]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Preset M12 is mapped to M10.
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]: 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183447 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所3 の 6 回目 (全 6 回): ブロックを 場所3 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[76354]: 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 (0x1054983a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13f18c3a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[76354]: 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 (0x1054983f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13f18c3f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所3: ブロック 画素 [162.6, 305.6]・向き 2.8°・目印から 10.8 画素
[R401  ] 下げ -0.79 mm (ok). つかむ所の爪と机 指令 0.9・予想 -2.4・沈み最大 -19.6 mm. 下りる間 固定側 指令 10.9/予想 7.28・動く爪 29.93/31.13 mm. 持ち上げの始めの予想 -6.01 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 51.7, 'arm_box': 33.1, 'arm_base': 134.3, 'arm_block_pad10': 26.3, 'held_table': 71.4, 'held_box': 35.3, 'jaw_table_grasp': -0.7}
[R401  ] 送れる
objc[76354]: 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 (0x1054983a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x302918778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[76354]: 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 (0x1054983f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x3029187c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -41.5   +23.1   -20.8   +89.5   -37.4   +58.6
[FIRST ] 最初の目標       -41.8   +23.0   -22.2   +88.9   -38.2   +59.0  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -41.8   +25.5   -12.2   +76.5   -38.2   +58.8  (かかった 0.38 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・16 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 256/256 [00:00<00:00, 3086.09 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183527 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.43

==================================================
  場所4 の 6 回目 (全 6 回): ブロックを 場所4 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[76419]: 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 (0x1025903a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1638b83a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[76419]: 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 (0x1025903f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1638b83f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所4: ブロック 画素 [281.7, 253.4]・向き -1.2°・目印から 7.1 画素
[R401  ] 下げ -4.02 mm (conflict). つかむ所の爪と机 指令 3.29・予想 -5.83・沈み最大 -19.46 mm. 下りる間 固定側 指令 10.08/予想 7.43・動く爪 22.63/23.93 mm. 持ち上げの始めの予想 -10.29 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 57.3, 'arm_box': 33.1, 'arm_base': 97.2, 'arm_block_pad10': 33.3, 'held_table': 71.9, 'held_box': 34.9, 'jaw_table_grasp': -3.1}
[R401  ] 送れる
[SW405 ] この回は 決まりの外の口を使います: status conflict (--allow-status)
流すなら yes と打つ > yes
objc[76419]: 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 (0x1025903a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17ca14778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[76419]: 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 (0x1025903f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17ca147c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -12.6   -18.4   +38.8   +40.9   -13.1   +58.6
[FIRST ] 最初の目標       -13.1   -18.1   +37.0   +40.2   -13.6   +59.4  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -13.1    -9.0   +44.7   +23.4   -13.6   +58.5  (かかった 0.39 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・16 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 254/254 [00:00<00:00, 2996.13 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183606 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.43

==================================================
  場所5 の 6 回目 (全 6 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[76529]: 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 (0x106c243a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x16103c3a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[76529]: 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 (0x106c243f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x16103c3f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所5: ブロック 画素 [416.5, 164.5]・向き 1.8°・目印から 13.2 画素
[R401  ] 下げ -2.52 mm (ok). つかむ所の爪と机 指令 0.9・予想 -2.37・沈み最大 -26.81 mm. 下りる間 固定側 指令 11.08/予想 14.11・動く爪 30.29/26.22 mm. 持ち上げの始めの予想 -4.58 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 53.4, 'arm_box': 33.1, 'arm_base': 199.7, 'arm_block_pad10': 27.2, 'held_table': 69.6, 'held_box': 33.3, 'jaw_table_grasp': 0.9}
[R401  ] 送れる
objc[76529]: 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 (0x106c243a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x318da4778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[76529]: 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 (0x106c243f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x318da47c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         +11.8   +41.6   -47.3   +79.3   +16.7   +58.6
[FIRST ] 最初の目標       +12.4   +41.3   -49.5   +79.6   +17.6   +58.7  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   +12.5   +42.5   -40.8   +69.5   +17.6   +59.1  (かかった 0.39 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・16 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 260/260 [00:00<00:00, 3009.99 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183647 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  済み: 場所2 6 回  場所3 6 回  場所4 6 回  場所5 6 回  
==================================================
(base) shimazueiichi@shimadzueiichinoMacBook-Pro r2r2r-scripts % SW405_RISE_FIRST=1 R401_RESELECT=1 R401_PUSH_LIMIT_MM=-14 R401_PUSH_WINDOW_MM=-14 R401_ALLOW_CONFLICT=1 R401_ALLOW_DEEP=1 R401_PIXEL_TOL_PX=40 R401_START_TOL_DEG=25 N=9 PLACES="2 3 4 5" ./so101/check_405/session_405.sh

==================================================
  場所2 の 7 回目 (全 9 回): ブロックを 場所2 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[76702]: 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 (0x102dd03a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1638b43a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[76702]: 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 (0x102dd03f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1638b43f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所2: ブロック 画素 [243.6, 161.3]・向き 0.3°・目印から 12.7 画素
[R401  ] 下げ -3.09 mm (conflict). つかむ所の爪と机 指令 1.88・予想 -5.89・沈み最大 -27.31 mm. 下りる間 固定側 指令 10.38/予想 6.52・動く爪 24.67/25.36 mm. 持ち上げの始めの予想 -11.48 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 54.9, 'arm_box': 33.1, 'arm_base': 195.7, 'arm_block_pad10': 23.5, 'held_table': 71.9, 'held_box': 35.2, 'jaw_table_grasp': -2.7}
[R401  ] 割り振りの面 +0°・爪の傾き 18.0° のまま
[R401  ] 送れる
[SW405 ] この回は 決まりの外の口を使います: status conflict (--allow-status)
流すなら yes と打つ > いyes
objc[76702]: 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 (0x102dd03a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17c420778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[76702]: 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 (0x102dd03f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17c4207c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -12.6   +47.2   -57.7   +84.8   -10.9   +58.7
[FIRST ] 最初の目標       -12.9   +46.7   -60.3   +85.1   -11.4   +59.1  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -14.0   +46.7   -50.6   +75.6   -12.4   +58.4  (かかった 0.44 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・15 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 277/277 [00:00<00:00, 2903.63 examples/s]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
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
LIB Build date: Jul  3 2025 03:06:26
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[warn]: Svt[warn]: Preset M12 is mapped to M10.
Preset M12 is mapped to M10.
Svt[info]: Level of Parallelism: 4
Svt[info]: Svt[info]: Number of PPCS 59
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]: Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
[asm level selected : up to neon_dotprod]
Svt[info]: Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
-------------------------------------------
Svt[info]: Svt[info]: SVT [config]: bit-depth / color format 			: 8 / YUV420
SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: Svt[info]: SVT [config]: preset / tune / pred struct 		: 10 / PSNR / random access
SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 	: 2 / 16 / key frame
SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: Svt[info]: SVT [config]: BRC mode / rate factor 			: CRF / 30 
SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: Svt[info]: SVT [config]: AQ mode / variance boost 			: 2 / 0
SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: Svt[info]: SVT [config]: sharpness / luminance-based QP bias 	: 0 / 0
SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: Svt[info]: 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183826 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所3 の 7 回目 (全 9 回): ブロックを 場所3 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[76817]: 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 (0x1066403a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13dfa43a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[76817]: 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 (0x1066403f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13dfa43f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所3: ブロック 画素 [164.5, 320.4]・向き 0.3°・目印から 8.4 画素
[R401  ] 下げ -0.79 mm (ok). つかむ所の爪と机 指令 0.9・予想 -2.29・沈み最大 -18.8 mm. 下りる間 固定側 指令 10.68/予想 7.03・動く爪 30.07/31.4 mm. 持ち上げの始めの予想 -5.78 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 51.7, 'arm_box': 33.1, 'arm_base': 119.4, 'arm_block_pad10': 26.2, 'held_table': 71.4, 'held_box': 35.3, 'jaw_table_grasp': -0.7}
[R401  ] 割り振りの面 +0°・爪の傾き 0.0° のまま
[R401  ] 送れる
objc[76817]: 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 (0x1066403a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x304c30778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[76817]: 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 (0x1066403f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x304c307c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -43.2   +16.8   -11.4   +86.5   -41.2   +58.7
[FIRST ] 最初の目標       -43.5   +16.6   -13.2   +87.0   -42.0   +58.6  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -43.5   +18.6    -6.9   +78.7   -42.0   +58.2  (かかった 0.39 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・15 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 266/266 [00:00<00:00, 2949.30 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183928 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所4 の 7 回目 (全 9 回): ブロックを 場所4 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[76912]: 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 (0x101ed03a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x165cc43a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[76912]: 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 (0x101ed03f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x165cc43f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所4: ブロック 画素 [295.6, 255.3]・向き 2.2°・目印から 21.2 画素
[R401  ] 下げ -5.71 mm (conflict). つかむ所の爪と机 指令 1.12・予想 -5.9・沈み最大 -20.95 mm. 下りる間 固定側 指令 10.58/予想 8.4・動く爪 22.93/23.92 mm. 持ち上げの始めの予想 -11.02 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 56.8, 'arm_box': 33.1, 'arm_base': 90.9, 'arm_block_pad10': 32.6, 'held_table': 73.4, 'held_box': 35.2, 'jaw_table_grasp': -3.0}
[R401  ] 割り振りの面 +0°・爪の傾き 31.0° のまま
[R401  ] 送れる
[SW405 ] この回は 決まりの外の口を使います: status conflict (--allow-status)
流すなら yes と打つ > yes
objc[76912]: 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 (0x101ed03a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17d1d8778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[76912]: 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 (0x101ed03f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17d1d87c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度          -9.6   -21.8   +41.6   +41.5    -5.8   +58.6
[FIRST ] 最初の目標       -10.1   -21.9   +39.0   +41.7    -6.3   +58.8  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -10.1   -14.7   +45.2   +28.4    -6.2   +58.7  (かかった 0.38 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・16 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 265/265 [00:00<00:00, 3173.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]: 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_184007 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所5 の 7 回目 (全 9 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[76997]: 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 (0x1063b43a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13cacc3a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[76997]: 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 (0x1063b43f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13cacc3f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所5: ブロック 画素 [409.0, 161.9]・向き 0.2°・目印から 7.0 画素
[R401  ] 下げ -2.73 mm (ok). つかむ所の爪と机 指令 0.91・予想 -2.38・沈み最大 -27.02 mm. 下りる間 固定側 指令 11.15/予想 14.03・動く爪 29.43/25.46 mm. 持ち上げの始めの予想 -9.61 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 53.6, 'arm_box': 33.1, 'arm_base': 198.4, 'arm_block_pad10': 27.7, 'held_table': 70.1, 'held_box': 33.5, 'jaw_table_grasp': 0.9}
[R401  ] 割り振りの面 +0°・爪の傾き 19.0° のまま
[R401  ] 送れる
objc[76997]: 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 (0x1063b43a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17c738778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[76997]: 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 (0x1063b43f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17c7387c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         +10.3   +43.9   -51.4   +80.9   +13.6   +58.6
[FIRST ] 最初の目標       +11.0   +43.3   -53.6   +80.8   +14.1   +58.5  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   +11.0   +43.6   -42.4   +69.7   +14.2   +59.2  (かかった 0.42 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・19 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 258/258 [00:00<00:00, 2980.07 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_184046 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.43

==================================================
  場所2 の 8 回目 (全 9 回): ブロックを 場所2 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[77085]: 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 (0x1066383a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x156f943a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[77085]: 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 (0x1066383f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x156f943f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所2: ブロック 画素 [252.5, 169.9]・向き -26.5°・目印から 19.1 画素
[R401  ] 下げ 0.0 mm (deep_at_zero). つかむ所の爪と机 指令 5.43・予想 -11.7・沈み最大 -24.29 mm. 下りる間 固定側 指令 9.69/予想 -0.58・動く爪 24.44/25.19 mm. 持ち上げの始めの予想 -11.7 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 55.5, 'arm_box': 33.1, 'arm_base': 193.1, 'arm_block_pad10': 24.3, 'held_table': 69.0, 'held_box': 34.5, 'jaw_table_grasp': -3.8}
[R401  ] 割り振りの面 +0°・爪の傾き 18.0° のまま
[R401  ] 送れる
[SW405 ] この回は 決まりの外の口を使います: status deep_at_zero (--allow-status)
流すなら yes と打つ > yes
objc[77085]: 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 (0x1066383a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x178a70778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[77085]: 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 (0x1066383f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x178a707c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -10.6   +43.6   -51.4   +82.0   -36.5   +58.6
[FIRST ] 最初の目標       -11.0   +43.3   -52.0   +80.8   -37.5   +60.0  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -12.7   +44.7   -42.9   +71.1   -38.7   +59.9  (かかった 0.38 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: empty (爪の読み 1.2・21 コマ)
[SW405 ] やり直せない (読めない・道が作れない): 読み直し (HOME). ブロックが 場所2 の目印から 202 画素 離れている (許し 40 画素). 置き直す
Map: 100%|██████████████████████████| 265/265 [00:00<00:00, 2874.06 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_184123 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] retry_refused (やり直せない (読めない・道が作れない)). 渡した 1 回・判定 empty・爪の読み 1.15

==================================================
  場所3 の 8 回目 (全 9 回): ブロックを 場所3 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[77178]: 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 (0x1041283a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x163ab03a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[77178]: 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 (0x1041283f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x163ab03f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所3: ブロック 画素 [156.7, 314.6]・向き 17.1°・目印から 1.3 画素
[R401  ] 下げ -0.79 mm (ok). つかむ所の爪と机 指令 0.9・予想 -2.42・沈み最大 -18.66 mm. 下りる間 固定側 指令 10.8/予想 7.54・動く爪 30.03/30.93 mm. 持ち上げの始めの予想 -5.72 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 51.7, 'arm_box': 33.1, 'arm_base': 133.7, 'arm_block_pad10': 26.3, 'held_table': 71.4, 'held_box': 35.3, 'jaw_table_grasp': -0.7}
[R401  ] 割り振りの面 +0°・爪の傾き 0.0° のまま
[R401  ] 送れる
objc[77178]: 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 (0x1041283a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x300bdc778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[77178]: 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 (0x1041283f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x300bdc7c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -45.0   +17.8   -13.0   +86.9   -26.2   +58.6
[FIRST ] 最初の目標       -45.5   +17.5   -15.0   +87.3   -26.9   +58.8  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -45.5   +19.5    -8.6   +78.9   -27.0   +58.4  (かかった 0.39 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・15 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 266/266 [00:00<00:00, 2782.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[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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_184211 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.43

==================================================
  場所4 の 8 回目 (全 9 回): ブロックを 場所4 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[77271]: 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 (0x1027e83a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x12f9dc3a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[77271]: 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 (0x1027e83f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x12f9dc3f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所4: ブロック 画素 [294.9, 263.4]・向き 30.7°・目印から 22.9 画素
[R401  ] 下げ -0.99 mm (ok). つかむ所の爪と机 指令 0.9・予想 -2.87・沈み最大 -20.47 mm. 下りる間 固定側 指令 10.9/予想 8.76・動く爪 29.21/29.74 mm. 持ち上げの始めの予想 -6.4 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 51.9, 'arm_box': 33.1, 'arm_base': 113.9, 'arm_block_pad10': 26.7, 'held_table': 71.8, 'held_box': 35.4, 'jaw_table_grasp': -1.3}
[R401  ] 面を選び直した: 割り振りの面 +0°・爪の傾き 31.0° で 作れない (rule_351 の道が作れない: つかむ所 (向き +30.7°): 爪の面を机に垂直にできない (爪の面の傾き -17.1°・許し ±8°)) → 面 -90°・爪の傾き 1.0°・爪の面の傾き -2.32°・手首の回り -62.43°
[R401  ] 動かさない: 渡す姿勢が推論の安全範囲の外 (wrist_roll)

   動かしません: 渡す姿勢が推論の安全範囲の外 (wrist_roll)   
[SW405 ] 送る前に止めたので 台帳に書きません (渡す姿勢が推論の安全範囲の外 (wrist_roll))
[INFO] 動かさずに止まった (置き直してもう一度)

==================================================
  場所4 の 8 回目 (全 9 回): ブロックを 場所4 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[77494]: 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 (0x1060fc3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x126e6c3a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[77494]: 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 (0x1060fc3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x126e6c3f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所4: ブロック 画素 [291.1, 257.4]・向き 24.1°・目印から 17.2 画素
[R401  ] 下げ -2.74 mm (ok). つかむ所の爪と机 指令 0.42・予想 -1.97・沈み最大 -18.91 mm. 下りる間 固定側 指令 11.15/予想 10.23・動く爪 30.47/29.9 mm. 持ち上げの始めの予想 -6.9 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 53.2, 'arm_box': 33.1, 'arm_base': 109.6, 'arm_block_pad10': 27.2, 'held_table': 70.3, 'held_box': 33.9, 'jaw_table_grasp': 0.4}
[R401  ] 面を選び直した: 割り振りの面 +0°・爪の傾き 31.0° で 作れない (rule_351 の道が作れない: つかむ所 (向き +24.1°): 爪の面を机に垂直にできない (爪の面の傾き -13.0°・許し ±8°)) → 面 +0°・爪の傾き 16.0°・爪の面の傾き -7.77°・手首の回り 19.9°
[R401  ] 送れる
objc[77494]: 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 (0x1060fc3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x179a54778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[77494]: 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 (0x1060fc3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x179a547c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度          -9.4   -11.3   +25.6   +62.2   +16.1   +58.7
[FIRST ] 最初の目標        -9.7   -11.0   +25.0   +60.8   +16.8   +60.1  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標    -9.7    -5.9   +31.9   +48.8   +16.5   +59.4  (かかった 0.39 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・15 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 253/253 [00:00<00:00, 2885.85 examples/s]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
LIB Build date: Jul  3 2025 03:06:26
Svt[info]: Svt[info]: LIB Build date: Jul  3 2025 03:06:26
Svt[info]: -------------------------------------------
-------------------------------------------
Svt[warn]: Svt[warn]: Preset M12 is mapped to M10.
Preset M12 is mapped to M10.
Svt[info]: Level of Parallelism: 4
Svt[info]: Svt[info]: Level of Parallelism: 4
Number of PPCS 59
Svt[info]: Number of PPCS 59
Svt[info]: Svt[info]: [asm level on system : up to neon_dotprod]
[asm level on system : up to neon_dotprod]
Svt[info]: Svt[info]: [asm level selected : up to neon_dotprod]
[asm level selected : up to neon_dotprod]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: Svt[info]: SVT [config]: bit-depth / color format 			: 8 / YUV420
SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: Svt[info]: SVT [config]: preset / tune / pred struct 		: 10 / PSNR / random access
SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 	: 2 / 16 / key frame
SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: Svt[info]: SVT [config]: BRC mode / rate factor 			: CRF / 30 
SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: Svt[info]: SVT [config]: AQ mode / variance boost 			: 2 / 0
SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: Svt[info]: SVT [config]: sharpness / luminance-based QP bias 	: 0 / 0
SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_184346 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所5 の 8 回目 (全 9 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[77977]: 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 (0x1062c03a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13b2083a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[77977]: 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 (0x1062c03f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13b2083f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所5: ブロック 画素 [415.4, 163.1]・向き 24.7°・目印から 11.4 画素
[R401  ] 面を選び直しても作れない (候補 0 通り)
[R401  ] 動かさない: 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない)

   動かしません: 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない)   
[SW405 ] 送る前に止めたので 台帳に書きません (面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない))
[INFO] 動かさずに止まった (置き直してもう一度)

==================================================
  場所5 の 8 回目 (全 9 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[78046]: 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 (0x10216c3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13c0803a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[78046]: 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 (0x10216c3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13c0803f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所5: ブロック 画素 [425.3, 166.8]・向き 19.3°・目印から 21.5 画素
[R401  ] 面を選び直しても作れない (候補 0 通り)
[R401  ] 動かさない: 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない)

   動かしません: 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない)   
[SW405 ] 送る前に止めたので 台帳に書きません (面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない))
[INFO] 動かさずに止まった (置き直してもう一度)

==================================================
  場所5 の 8 回目 (全 9 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[78101]: 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 (0x1062183a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x136b203a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[78101]: 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 (0x1062183f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x136b203f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所5: ブロック 画素 [417.7, 158.6]・向き 21.4°・目印から 11.0 画素
[R401  ] 面を選び直しても作れない (候補 0 通り)
[R401  ] 動かさない: 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない)

   動かしません: 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない)   
[SW405 ] 送る前に止めたので 台帳に書きません (面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない))
[INFO] 動かさずに止まった (置き直してもう一度)

==================================================
  場所5 の 8 回目 (全 9 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[78157]: 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 (0x1050bc3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x165a303a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[78157]: 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 (0x1050bc3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x165a303f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所5: ブロック 画素 [425.3, 164.3]・向き 23.3°・目印から 20.2 画素
[R401  ] 面を選び直しても作れない (候補 0 通り)
[R401  ] 動かさない: 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない)

   動かしません: 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない)   
[SW405 ] 送る前に止めたので 台帳に書きません (面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない))
[INFO] 動かさずに止まった (置き直してもう一度)

==================================================
  場所5 の 8 回目 (全 9 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[78220]: 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 (0x106b883a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13e9003a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[78220]: 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 (0x106b883f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13e9003f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所None: ブロック 画素 None・向き None°・目印から None 画素
[R401  ] 動かさない: ブロックが読めない: 赤い塊が 2 つある (786・297 画素)

   動かしません: ブロックが読めない: 赤い塊が 2 つある (786・297 画素)   
[SW405 ] 送る前に止めたので 台帳に書きません (ブロックが読めない: 赤い塊が 2 つある (786・297 画素))
[INFO] 動かさずに止まった (置き直してもう一度)

==================================================
  場所5 の 8 回目 (全 9 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[78286]: 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 (0x106f403a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13f1d83a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[78286]: 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 (0x106f403f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13f1d83f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所5: ブロック 画素 [414.9, 160.7]・向き 0.9°・目印から 9.4 画素
[R401  ] 下げ 0.0 mm (deep_at_zero). つかむ所の爪と机 指令 3.5・予想 -6.35・沈み最大 -24.57 mm. 下りる間 固定側 指令 11.23/予想 12.89・動く爪 32.46/23.34 mm. 持ち上げの始めの予想 -8.81 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 53.5, 'arm_box': 33.1, 'arm_base': 201.1, 'arm_block_pad10': 27.0, 'held_table': 67.3, 'held_box': 31.9, 'jaw_table_grasp': 3.5}
[R401  ] 割り振りの面 +0°・爪の傾き 19.0° のまま
[R401  ] 送れる
[SW405 ] この回は 決まりの外の口を使います: status deep_at_zero (--allow-status)
流すなら yes と打つ > いyes
objc[78286]: 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 (0x106f403a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17fcb0778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[78286]: 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 (0x106f403f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17fcb07c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         +11.3   +46.7   -56.3   +83.1   +15.3   +58.6
[FIRST ] 最初の目標       +12.0   +46.4   -57.0   +82.3   +16.0   +59.7  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   +12.0   +48.0   -44.9   +68.7   +16.1   +59.8  (かかった 0.39 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・15 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 251/251 [00:00<00:00, 3017.43 examples/s]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
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
LIB Build date: Jul  3 2025 03:06:26
Svt[info]: 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]: Svt[info]: [asm level on system : up to neon_dotprod]
[asm level on system : up to neon_dotprod]
Svt[info]: Svt[info]: [asm level selected : up to neon_dotprod]
[asm level selected : up to neon_dotprod]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: Svt[info]: SVT [config]: bit-depth / color format 			: 8 / YUV420
SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: Svt[info]: SVT [config]: preset / tune / pred struct 		: 10 / PSNR / random access
SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 	: 2 / 16 / key frame
SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: Svt[info]: SVT [config]: BRC mode / rate factor 			: CRF / 30 
Svt[info]: SVT [config]: BRC mode / rate factor 				: CRF / 30 
SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: Svt[info]: SVT [config]: AQ mode / variance boost 			: 2 / 0
SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: SVT [config]: sharpness / luminance-based QP bias 	: 0 / 0
Svt[info]: Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_184703 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所2 の 9 回目 (全 9 回): ブロックを 場所2 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[78393]: 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 (0x105fc03a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x136b783a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[78393]: 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 (0x105fc03f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x136b783f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:Error reading frame in background thread for OpenCVCamera(1): OpenCVCamera(1) read failed (status=False).
WARNING:lerobot.cameras.opencv.camera_opencv:Error reading frame in background thread for OpenCVCamera(1): OpenCVCamera(1) read failed (status=False).
[REST] 力を入れたままポートを閉じた. フォロワーを支えてから電源を切る
[REST] camera disconnect: OpenCVCamera(1) not connected.
[REST] camera disconnect: OpenCVCamera(0) not connected.

[STOP  ] 失敗で止まりました: GuardError: 力を入れる前に読んだ位置 (B の最初の「前の目標」) がない. 送らない
[SW405 ] 送る前に止めたので 台帳に書きません (GuardError: 力を入れる前に読んだ位置 (B の最初の「前の目標」) がない. 送らない)
[INFO] 動かさずに止まった (置き直してもう一度)

==================================================
  場所2 の 9 回目 (全 9 回): ブロックを 場所2 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[78458]: 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 (0x106ba83a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x11c2d43a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[78458]: 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 (0x106ba83f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x11c2d43f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所2: ブロック 画素 [242.9, 171.9]・向き -25.1°・目印から 10.0 画素
[R401  ] 下げ 0.0 mm (deep_at_zero). つかむ所の爪と机 指令 5.43・予想 -11.73・沈み最大 -24.31 mm. 下りる間 固定側 指令 9.67/予想 -0.62・動く爪 24.43/25.19 mm. 持ち上げの始めの予想 -11.73 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 55.5, 'arm_box': 33.1, 'arm_base': 193.1, 'arm_block_pad10': 24.3, 'held_table': 69.1, 'held_box': 34.5, 'jaw_table_grasp': -3.9}
[R401  ] 割り振りの面 +0°・爪の傾き 18.0° のまま
[R401  ] 送れる
[SW405 ] この回は 決まりの外の口を使います: status deep_at_zero (--allow-status)
流すなら yes と打つ > yes
objc[78458]: 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 (0x106ba83a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x16f204778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[78458]: 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 (0x106ba83f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x16f2047c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -12.7   +43.6   -51.4   +82.1   -37.0   +58.7
[FIRST ] 最初の目標       -13.1   +43.3   -51.8   +80.9   -37.9   +60.3  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -14.8   +44.6   -41.8   +70.7   -39.1   +61.7  (かかった 0.38 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: empty (爪の読み 1.2・21 コマ)
[SW405 ] やり直せない (読めない・道が作れない): 読み直し (HOME). 面を選び直しても道が作れない・ガードに当たる (候補 1 通り. 最初の候補: rule_401 の道が作れない: 固定側を 12 mm 離す形が解けない: 姿勢が解けない ({'pos_mm': 0.799, 'tilt_deg': 2.135, 'jaw_deg': 0.198}))
Map: 100%|██████████████████████████| 252/252 [00:00<00:00, 3060.76 examples/s]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
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
LIB Build date: Jul  3 2025 03:06:26
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[warn]: Svt[warn]: Preset M12 is mapped to M10.
Preset M12 is mapped to M10.
Svt[info]: Level of Parallelism: 4
Svt[info]: Svt[info]: Number of PPCS 59
Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[info]: Svt[info]: [asm level on system : up to neon_dotprod]
[asm level on system : up to neon_dotprod]
Svt[info]: Svt[info]: [asm level selected : up to neon_dotprod]
[asm level selected : up to neon_dotprod]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: Svt[info]: SVT [config]: bit-depth / color format 			: 8 / YUV420
SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: Svt[info]: SVT [config]: preset / tune / pred struct 		: 10 / PSNR / random access
SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 	: 2 / 16 / key frame
SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: Svt[info]: SVT [config]: BRC mode / rate factor 			: CRF / 30 
SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: Svt[info]: SVT [config]: AQ mode / variance boost 			: 2 / 0
SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: Svt[info]: SVT [config]: sharpness / luminance-based QP bias 	: 0 / 0
SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_184804 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] retry_refused (やり直せない (読めない・道が作れない)). 渡した 1 回・判定 empty・爪の読み 1.15

==================================================
  場所3 の 9 回目 (全 9 回): ブロックを 場所3 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[78593]: 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 (0x1026b03a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x127d283a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[78593]: 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 (0x1026b03f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x127d283f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所3: ブロック 画素 [156.6, 307.9]・向き -27.4°・目印から 7.5 画素
[R401  ] 下げ -0.79 mm (ok). つかむ所の爪と机 指令 0.9・予想 -2.33・沈み最大 -20.92 mm. 下りる間 固定側 指令 11.07/予想 7.17・動く爪 29.78/31.2 mm. 持ち上げの始めの予想 -6.52 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 51.7, 'arm_box': 33.1, 'arm_base': 118.0, 'arm_block_pad10': 26.4, 'held_table': 71.4, 'held_box': 35.3, 'jaw_table_grasp': -0.7}
[R401  ] 割り振りの面 +0°・爪の傾き 0.0° のまま
[R401  ] 動かさない: 渡す姿勢が推論の安全範囲の外 (wrist_roll)

   動かしません: 渡す姿勢が推論の安全範囲の外 (wrist_roll)   
[SW405 ] 送る前に止めたので 台帳に書きません (渡す姿勢が推論の安全範囲の外 (wrist_roll))
[INFO] 動かさずに止まった (置き直してもう一度)

==================================================
  場所3 の 9 回目 (全 9 回): ブロックを 場所3 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[78664]: 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 (0x101ef83a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x11ff043a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[78664]: 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 (0x101ef83f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x11ff043f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所3: ブロック 画素 [166.5, 309.1]・向き -26.1°・目印から 10.7 画素
[R401  ] 下げ -0.79 mm (ok). つかむ所の爪と机 指令 0.9・予想 -2.29・沈み最大 -20.3 mm. 下りる間 固定側 指令 11.04/予想 7.14・動く爪 29.8/31.27 mm. 持ち上げの始めの予想 -6.36 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 51.7, 'arm_box': 33.1, 'arm_base': 112.9, 'arm_block_pad10': 26.4, 'held_table': 71.4, 'held_box': 35.3, 'jaw_table_grasp': -0.7}
[R401  ] 割り振りの面 +0°・爪の傾き 0.0° のまま
[R401  ] 動かさない: 渡す姿勢が推論の安全範囲の外 (wrist_roll)

   動かしません: 渡す姿勢が推論の安全範囲の外 (wrist_roll)   
[SW405 ] 送る前に止めたので 台帳に書きません (渡す姿勢が推論の安全範囲の外 (wrist_roll))
[INFO] 動かさずに止まった (置き直してもう一度)

==================================================
  場所3 の 9 回目 (全 9 回): ブロックを 場所3 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[78721]: 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 (0x10223c3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x116db43a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[78721]: 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 (0x10223c3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x116db43f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所3: ブロック 画素 [169.3, 309.1]・向き -14.2°・目印から 13.1 画素
[R401  ] 下げ -0.79 mm (ok). つかむ所の爪と机 指令 0.9・予想 -2.3・沈み最大 -19.79 mm. 下りる間 固定側 指令 10.77/予想 6.92・動く爪 29.98/31.43 mm. 持ち上げの始めの予想 -6.16 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 51.7, 'arm_box': 33.1, 'arm_base': 117.7, 'arm_block_pad10': 26.2, 'held_table': 71.4, 'held_box': 35.3, 'jaw_table_grasp': -0.7}
[R401  ] 割り振りの面 +0°・爪の傾き 0.0° のまま
[R401  ] 送れる
objc[78721]: 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 (0x10223c3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x176a44778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[78721]: 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 (0x10223c3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x176a447c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -39.3   +22.7   -20.0   +89.2   -51.7   +58.6
[FIRST ] 最初の目標       -39.8   +22.5   -21.7   +89.0   -52.8   +59.4  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -39.8   +24.3   -13.5   +79.3   -52.8   +59.1  (かかった 0.40 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・15 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 264/264 [00:00<00:00, 3210.86 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_184939 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.43

==================================================
  場所4 の 9 回目 (全 9 回): ブロックを 場所4 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[78833]: 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 (0x102aec3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x12ffcc3a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[78833]: 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 (0x102aec3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x12ffcc3f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所4: ブロック 画素 [280.6, 259.7]・向き -16.3°・目印から 9.2 画素
[R401  ] 下げ -1.18 mm (ok). つかむ所の爪と机 指令 0.9・予想 -3.12・沈み最大 -19.41 mm. 下りる間 固定側 指令 10.92/予想 7.57・動く爪 28.96/29.99 mm. 持ち上げの始めの予想 -6.42 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 52.1, 'arm_box': 33.1, 'arm_base': 137.8, 'arm_block_pad10': 26.9, 'held_table': 71.8, 'held_box': 35.4, 'jaw_table_grasp': -1.3}
[R401  ] 面を選び直した: 割り振りの面 +0°・爪の傾き 31.0° で 作れない (rule_351 の道が作れない: つかむ所 (向き -16.3°): 爪の面を机に垂直にできない (爪の面の傾き +11.7°・許し ±8°)) → 面 +0°・爪の傾き 2.0°・爪の面の傾き -2.32°・手首の回り -24.35°
[R401  ] 送れる
objc[78833]: 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 (0x102aec3a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17d884778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[78833]: 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 (0x102aec3f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17d8847c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -11.5   +18.5   -14.1   +85.4   -26.4   +58.6
[FIRST ] 最初の目標       -12.0   +18.6   -13.8   +83.8   -27.2   +58.0  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -11.9   +21.1    -4.1   +71.2   -27.1   +57.5  (かかった 0.38 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・12 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 254/254 [00:00<00:00, 2996.24 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_185016 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所5 の 9 回目 (全 9 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[78950]: 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 (0x103fc43a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13d4a03a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[78950]: 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 (0x103fc43f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13d4a03f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所5: ブロック 画素 [419.1, 161.1]・向き 15.9°・目印から 13.2 画素
[R401  ] 面を選び直しても作れない (候補 0 通り)
[R401  ] 動かさない: 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない)

   動かしません: 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない)   
[SW405 ] 送る前に止めたので 台帳に書きません (面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない))
[INFO] 動かさずに止まった (置き直してもう一度)

==================================================
  場所5 の 9 回目 (全 9 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[79010]: 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 (0x105fc43a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1602883a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[79010]: 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 (0x105fc43f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1602883f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所5: ブロック 画素 [422.3, 160.9]・向き 15.5°・目印から 16.1 画素
[R401  ] 面を選び直しても作れない (候補 0 通り)
[R401  ] 動かさない: 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない)

   動かしません: 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない)   
[SW405 ] 送る前に止めたので 台帳に書きません (面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない))
[INFO] 動かさずに止まった (置き直してもう一度)

==================================================
  場所5 の 9 回目 (全 9 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[79064]: 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 (0x1069f43a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x141cc83a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[79064]: 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 (0x1069f43f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x141cc83f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所5: ブロック 画素 [425.2, 160.6]・向き 11.8°・目印から 18.7 画素
[R401  ] 面を選び直しても作れない (候補 0 通り)
[R401  ] 動かさない: 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない)

   動かしません: 面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない)   
[SW405 ] 送る前に止めたので 台帳に書きません (面を選び直しても道が作れない・ガードに当たる (候補 0 通り. rule_351 の選び方で作れる面・爪の傾きがない))
[INFO] 動かさずに止まった (置き直してもう一度)

==================================================
  場所5 の 9 回目 (全 9 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[79120]: 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 (0x101ea83a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1392743a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[79120]: 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 (0x101ea83f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1392743f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所5: ブロック 画素 [419.4, 165.3]・向き 3.7°・目印から 15.8 画素
[R401  ] 下げ -2.02 mm (ok). つかむ所の爪と机 指令 0.9・予想 -2.2・沈み最大 -26.26 mm. 下りる間 固定側 指令 11.09/予想 14.11・動く爪 30.74/26.55 mm. 持ち上げの始めの予想 -9.27 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 52.9, 'arm_box': 33.1, 'arm_base': 194.3, 'arm_block_pad10': 28.4, 'held_table': 69.6, 'held_box': 33.6, 'jaw_table_grasp': 0.9}
[R401  ] 面を選び直した: 割り振りの面 +0°・爪の傾き 19.0° で 作れない (rule_351 の道が作れない: つかむ所 (向き +3.7°): 爪の面を机に垂直にできない (爪の面の傾き -9.0°・許し ±8°)) → 面 +0°・爪の傾き 15.0°・爪の面の傾き -7.72°・手首の回り 20.8°
[R401  ] 送れる
objc[79120]: 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 (0x101ea83a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x170f08778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[79120]: 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 (0x101ea83f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x170f087c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         +12.2   +41.5   -48.4   +84.2   +18.4   +58.6
[FIRST ] 最初の目標       +12.9   +41.1   -51.1   +85.2   +19.3   +59.9  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   +12.9   +41.9   -46.4   +79.3   +19.3   +59.9  (かかった 0.38 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・16 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 301/301 [00:00<00:00, 3128.45 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_185212 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.43

==================================================
  済み: 場所2 9 回  場所3 9 回  場所4 9 回  場所5 9 回  
==================================================
(base) shimazueiichi@shimadzueiichinoMacBook-Pro r2r2r-scripts % SW405_RISE_FIRST=1 R401_RESELECT=1 R401_ELEV_MAX_DEG=20 SO101_RANGE_MARGIN=25 R401_PUSH_LIMIT_MM=-14 R401_PUSH_WINDOW_MM=-14 R401_ALLOW_CONFLICT=1 R401_ALLOW_DEEP=1 R401_PIXEL_TOL_PX=40 R401_START_TOL_DEG=25 N=11 PLACES="5" ./so101/check_405/session_405.sh

==================================================
  場所5 の 10 回目 (全 11 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±25) shoulder_pan -71.3〜38.9  shoulder_lift -56.1〜81.8  elbow_flex -98.8〜85.0  wrist_flex -10.9〜116.8  wrist_roll -69.8〜43.6  gripper 0.0〜84.0
[ERROR] --switch-405: 割り振りを作ったときの 道を作る範囲と 今の範囲が違う. 割り振りを作り直す (plan_401.py)
[ERROR] 止まった (終了コード 1). 続けるなら打ち直す
(base) shimazueiichi@shimadzueiichinoMacBook-Pro r2r2r-scripts % SW405_RISE_FIRST=1 R401_RESELECT=1 R401_ELEV_MAX_DEG=20 SO101_RANGE_MARGIN=25 R401_PUSH_LIMIT_MM=-14 R401_PUSH_WINDOW_MM=-14 R401_ALLOW_CONFLICT=1 R401_ALLOW_DEEP=1 R401_PIXEL_TOL_PX=40 R401_START_TOL_DEG=25 N=11 PLACES="5" ./so101/check_405/session_405.sh

==================================================
  場所5 の 10 回目 (全 11 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±25) shoulder_pan -71.3〜38.9  shoulder_lift -56.1〜81.8  elbow_flex -98.8〜85.0  wrist_flex -10.9〜116.8  wrist_roll -69.8〜43.6  gripper 0.0〜84.0
objc[79702]: 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 (0x104d843a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x144e603a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[79702]: 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 (0x104d843f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x144e603f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所5: ブロック 画素 [420.0, 160.6]・向き -17.9°・目印から 13.8 画素
[R401  ] 下げ -3.79 mm (ok). つかむ所の爪と机 指令 0.92・予想 -5.24・沈み最大 -28.37 mm. 下りる間 固定側 指令 10.57/予想 12.52・動く爪 25.5/22.23 mm. 持ち上げの始めの予想 -11.33 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 54.7, 'arm_box': 33.1, 'arm_base': 202.7, 'arm_block_pad10': 29.4, 'held_table': 72.6, 'held_box': 35.0, 'jaw_table_grasp': -1.8}
[R401  ] 割り振りの面 +0°・爪の傾き 19.0° のまま
[R401  ] 送れる
Enter で始める (Ctrl-C でやめる) > 
objc[79702]: 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 (0x104d843a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17fa54778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[79702]: 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 (0x104d843f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x17fa547c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         +11.7   +46.5   -56.0   +83.0    -3.0   +58.7
[FIRST ] 最初の目標       +12.3   +46.1   -57.3   +82.3    -2.8   +59.1  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   +12.3   +47.3   -44.6   +68.5    -2.8   +59.8  (かかった 0.39 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: held (爪の読み 10.4・14 コマ)
結果: y=成功 / n=失敗 / Enter=記録しない > y
Map: 100%|██████████████████████████| 259/259 [00:00<00:00, 2921.48 examples/s]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
Svt[info]: Svt[info]: SVT [build]  :	Apple LLVM 15.0.0 (clang-1500.3.9.4)	 64 bit
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
LIB Build date: Jul  3 2025 03:06:26
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[warn]: Svt[warn]: Preset M12 is mapped to M10.
Preset M12 is mapped to M10.
Svt[info]: Svt[info]: Level of Parallelism: 4
Svt[info]: Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Number of PPCS 59
Svt[info]: [asm level on system : up to neon_dotprod]
Svt[info]: Svt[info]: [asm level on system : up to neon_dotprod]
[asm level selected : up to neon_dotprod]
Svt[info]: Svt[info]: [asm level selected : up to neon_dotprod]
-------------------------------------------
Svt[info]: Svt[info]: -------------------------------------------
SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: Svt[info]: SVT [config]: bit-depth / color format 			: 8 / YUV420
SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: Svt[info]: SVT [config]: preset / tune / pred struct 		: 10 / PSNR / random access
SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 	: 2 / 16 / key frame
SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: Svt[info]: SVT [config]: BRC mode / rate factor 			: CRF / 30 
SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: Svt[info]: SVT [config]: AQ mode / variance boost 			: 2 / 0
SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: SVT [config]: sharpness / luminance-based QP bias 	: 0 / 0
Svt[info]: Svt[info]: -------------------------------------------
Svt[info]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_185802 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] carried (挟んで箱へ運んだ). 渡した 1 回・判定 held・爪の読み 10.37

==================================================
  場所5 の 11 回目 (全 11 回): ブロックを 場所5 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±25) shoulder_pan -71.3〜38.9  shoulder_lift -56.1〜81.8  elbow_flex -98.8〜85.0  wrist_flex -10.9〜116.8  wrist_roll -69.8〜43.6  gripper 0.0〜84.0
objc[79912]: 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 (0x105e483a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13e8fc3a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[79912]: 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 (0x105e483f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x13e8fc3f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所5: ブロック 画素 [418.3, 162.7]・向き 20.5°・目印から 13.4 画素
[R401  ] 下げ -0.98 mm (ok). つかむ所の爪と机 指令 0.9・予想 -2.25・沈み最大 -25.96 mm. 下りる間 固定側 指令 11.5/予想 15.2・動く爪 34.99/30.32 mm. 持ち上げの始めの予想 -4.57 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 51.9, 'arm_box': 33.1, 'arm_base': 189.7, 'arm_block_pad10': 24.9, 'held_table': 66.7, 'held_box': 32.5, 'jaw_table_grasp': 0.9}
[R401  ] 割り振りの面 +0°・爪の傾き 19.0° のまま
[R401  ] 送れる
objc[79912]: 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 (0x105e483a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x317ee4778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[79912]: 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 (0x105e483f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x317ee47c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         +12.9   +36.0   -38.2   +75.5   +37.1   +58.6
[FIRST ] 最初の目標       +13.5   +35.6   -38.7   +74.1   +37.8   +59.9  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   +13.6   +37.8   -29.1   +62.2   +37.9   +59.4  (かかった 0.37 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: empty (爪の読み 1.2・22 コマ)
[SW405 ] 2 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         +12.9   +36.9   -39.6   +75.7   +36.0   +58.6
[FIRST ] 最初の目標       +13.5   +36.5   -40.4   +74.6   +36.9   +60.0  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   +13.5   +38.6   -30.7   +62.8   +36.9   +59.6  (かかった 0.38 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 2 回目の判定: empty (爪の読み 1.2・23 コマ)
[SW405 ] 2 回外した: 2 回目. 2 回外した
Map: 100%|██████████████████████████| 443/443 [00:00<00:00, 3060.37 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]: -------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_185845 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] missed_max (2 回外した). 渡した 2 回・判定 empty|empty・爪の読み 1.15|1.15

==================================================
  済み: 場所5 11 回  
==================================================
(base) shimazueiichi@shimadzueiichinoMacBook-Pro r2r2r-scripts % SW405_BLACK_WRIST=1 SW405_RISE_FIRST=1 PLACES="3" ./so101/check_405/session_405.sh --first

==================================================
  済み: 場所3 9 回  
==================================================
(base) shimazueiichi@shimadzueiichinoMacBook-Pro r2r2r-scripts % 
(base) shimazueiichi@shimadzueiichinoMacBook-Pro r2r2r-scripts % SW405_BLACK_WRIST=1 SW405_RISE_FIRST=1 PLACES="3" ./so101/check_405/session_405.sh --first

==================================================
  済み: 場所3 9 回  
==================================================
(base) shimazueiichi@shimadzueiichinoMacBook-Pro r2r2r-scripts % N=20 SW405_BLACK_WRIST=1 SW405_RISE_FIRST=1 PLACES="3" ./so101/check_405/session_405.sh --first 

==================================================
  場所3 の 10 回目 (全 20 回): ブロックを 場所3 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[81281]: 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 (0x1066d83a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1250583a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[81281]: 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 (0x1066d83f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1250583f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所3: ブロック 画素 [164.4, 308.0]・向き 1.5°・目印から 9.8 画素
[R401  ] 下げ -0.79 mm (ok). つかむ所の爪と机 指令 0.9・予想 -2.38・沈み最大 -19.44 mm. 下りる間 固定側 指令 10.9/予想 7.27・動く爪 29.92/31.16 mm. 持ち上げの始めの予想 -5.97 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 51.7, 'arm_box': 33.1, 'arm_base': 130.7, 'arm_block_pad10': 26.3, 'held_table': 71.4, 'held_box': 35.3, 'jaw_table_grasp': -0.7}
[R401  ] 送れる
Enter で始める (Ctrl-C でやめる) > 
[R401  ] 場所None: ブロック 画素 None・向き None°・目印から None 画素
[R401  ] 動かさない: 今の姿勢が HOME から 22.9° 離れている (許し 10°. 関節ごとの差 [2.2, -0.3, 1.1, -22.9, 1.4]). 腕を休みの姿勢に戻してから

   動かしません: 今の姿勢が HOME から 22.9° 離れている (許し 10°. 関節ごとの差 [2.2, -0.3, 1.1, -22.9, 1.4]). 腕を休みの姿勢に戻してから   
[SW405 ] 送る前に止めたので 台帳に書きません (今の姿勢が HOME から 22.9° 離れている (許し 10°. 関節ごとの差 [2.2, -0.3, 1.1, -22.9, 1.4]). 腕を休みの姿勢に戻してから)
[INFO] 動かさずに止まった (置き直してもう一度)
[INFO] --first: 1 回で止めます. 記録を見てから 続きを打つ: ./so101/check_405/session_405.sh
(base) shimazueiichi@shimadzueiichinoMacBook-Pro r2r2r-scripts % N=20 SW405_BLACK_WRIST=1 SW405_RISE_FIRST=1 PLACES="3" ./so101/check_405/session_405.sh --first 

==================================================
  場所3 の 10 回目 (全 20 回): ブロックを 場所3 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[81378]: 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 (0x1046903a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x136c7c3a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[81378]: 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 (0x1046903f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x136c7c3f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所3: ブロック 画素 [165.1, 308.5]・向き -0.7°・目印から 10.0 画素
[R401  ] 下げ -0.79 mm (ok). つかむ所の爪と机 指令 0.9・予想 -2.36・沈み最大 -19.48 mm. 下りる間 固定側 指令 10.92/予想 7.25・動く爪 29.91/31.19 mm. 持ち上げの始めの予想 -6.0 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 51.7, 'arm_box': 33.1, 'arm_base': 128.5, 'arm_block_pad10': 26.3, 'held_table': 71.4, 'held_box': 35.3, 'jaw_table_grasp': -0.7}
[R401  ] 送れる
Enter で始める (Ctrl-C でやめる) > 
[R401  ] 場所None: ブロック 画素 None・向き None°・目印から None 画素
[R401  ] 動かさない: 今の姿勢が HOME から 22.9° 離れている (許し 10°. 関節ごとの差 [2.2, -0.3, 1.1, -22.9, 1.4]). 腕を休みの姿勢に戻してから

   動かしません: 今の姿勢が HOME から 22.9° 離れている (許し 10°. 関節ごとの差 [2.2, -0.3, 1.1, -22.9, 1.4]). 腕を休みの姿勢に戻してから   
[SW405 ] 送る前に止めたので 台帳に書きません (今の姿勢が HOME から 22.9° 離れている (許し 10°. 関節ごとの差 [2.2, -0.3, 1.1, -22.9, 1.4]). 腕を休みの姿勢に戻してから)
[INFO] 動かさずに止まった (置き直してもう一度)
[INFO] --first: 1 回で止めます. 記録を見てから 続きを打つ: ./so101/check_405/session_405.sh
(base) shimazueiichi@shimadzueiichinoMacBook-Pro r2r2r-scripts % N=20 R401_START_TOL_DEG=25 SW405_BLACK_WRIST=1 SW405_RISE_FIRST=1 PLACES="3" ./so101/check_405/session_405.sh --first

==================================================
  場所3 の 10 回目 (全 20 回): ブロックを 場所3 の目印に まっすぐ置いて Enter (q で終わる)
==================================================

[RANGE ] 推論の安全範囲 (学習の 56 本 ±10) shoulder_pan -56.3〜23.9  shoulder_lift -41.1〜66.8  elbow_flex -83.8〜70.0  wrist_flex 4.1〜101.8  wrist_roll -54.8〜28.6  gripper 0.0〜69.0
objc[81475]: 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 (0x1027d83a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1227243a8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[81475]: 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 (0x1027d83f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/python3.12/site-packages/av/.dylibs/libavdevice.61.3.100.dylib (0x1227243f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(1) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
WARNING:lerobot.cameras.opencv.camera_opencv:OpenCVCamera(0) failed to set fourcc=MJPG (actual=, success=False). Continuing with default format.
[R401  ] 場所3: ブロック 画素 [164.8, 308.4]・向き 0.5°・目印から 9.8 画素
[R401  ] 下げ -0.79 mm (ok). つかむ所の爪と机 指令 0.9・予想 -2.37・沈み最大 -19.44 mm. 下りる間 固定側 指令 10.91/予想 7.26・動く爪 29.92/31.18 mm. 持ち上げの始めの予想 -5.98 mm
[R401  ] 道 251 コマ (8.4 秒). 1 コマ最大 6.22°・爪 10.64. シムの距離 (mm) {'arm_table': 51.7, 'arm_box': 33.1, 'arm_base': 129.5, 'arm_block_pad10': 26.3, 'held_table': 71.4, 'held_box': 35.3, 'jaw_table_grasp': -0.7}
[R401  ] 送れる
Enter で始める (Ctrl-C でやめる) > 
objc[81475]: 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 (0x1027d83a8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x1790d0778). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[81475]: 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 (0x1027d83f8) and /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/lib/libavdevice.59.7.100.dylib (0x1790d07c8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
[SW405 ] 1 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒. 手首の絵を黒くして渡す)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -41.4   +21.7   -18.4   +88.7   -39.2   +58.7
[FIRST ] 最初の目標       -41.7   +21.5   -19.3   +88.0   -40.0   +58.3  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -41.8   +22.7   -14.8   +81.9   -39.9   +11.0  (かかった 0.40 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 1 回目の判定: empty (爪の読み 1.2・21 コマ)
[SW405 ] 2 回目: π0.5 に渡します (閉じたらコードへ戻す. 上限 8 秒. 手首の絵を黒くして渡す)
[FIRST ] 答えのコマ数   30 (サーバーの答えから). 1 回で実行するコマ 30
[FIRST ] 今の角度         -41.4   +21.9   -18.9   +88.7   -40.0   +58.6
[FIRST ] 最初の目標       -41.8   +21.8   -19.7   +88.0   -40.7   +58.2  (1 コマ 関節 5°・爪 20 までで寄せる)
[FIRST ] 答えの最後の目標   -41.8   +22.6   -16.8   +83.9   -40.7    +3.6  (かかった 0.44 秒)
[FIRST ] 始めの確かめは飛ばします (2 回目の試行から)
[RUN   ] 動かしています (先に問い合わせる). スペース=一時停止 (一時停止中: t=手直し / スペース=推論に戻る / q=終わる)
[SW405 ] 2 回目の判定: empty (爪の読み 1.2・20 コマ)
[SW405 ] 2 回外した: 2 回目. 2 回外した
Map: 100%|██████████████████████████| 364/364 [00:00<00:00, 3093.13 examples/s]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [version]:	SVT-AV1 Encoder Lib v3.0.0
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 [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]: Svt[warn]: Preset M12 is mapped to M10.
Preset M12 is mapped to M10.
Svt[info]: Level of Parallelism: 4
Svt[info]: Svt[info]: Number of PPCS 59
Level of Parallelism: 4
Svt[info]: Number of PPCS 59
Svt[info]: Svt[info]: [asm level on system : up to neon_dotprod]
[asm level on system : up to neon_dotprod]
Svt[info]: Svt[info]: [asm level selected : up to neon_dotprod]
[asm level selected : up to neon_dotprod]
Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
Svt[info]: Svt[info]: SVT [config]: main profile	tier (auto)	level (auto)
SVT [config]: main profile	tier (auto)	level (auto)
Svt[info]: Svt[info]: SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
SVT [config]: width / height / fps numerator / fps denominator 		: 640 / 480 / 30 / 1
Svt[info]: Svt[info]: SVT [config]: bit-depth / color format 			: 8 / YUV420
SVT [config]: bit-depth / color format 					: 8 / YUV420
Svt[info]: Svt[info]: SVT [config]: preset / tune / pred struct 		: 10 / PSNR / random access
SVT [config]: preset / tune / pred struct 					: 10 / PSNR / random access
Svt[info]: Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type 	: 2 / 16 / key frame
SVT [config]: gop size / mini-gop size / key-frame type 			: 2 / 16 / key frame
Svt[info]: Svt[info]: SVT [config]: BRC mode / rate factor 			: CRF / 30 
SVT [config]: BRC mode / rate factor 					: CRF / 30 
Svt[info]: Svt[info]: SVT [config]: AQ mode / variance boost 			: 2 / 0
SVT [config]: AQ mode / variance boost 					: 2 / 0
Svt[info]: Svt[info]: SVT [config]: sharpness / luminance-based QP bias 	: 0 / 0
SVT [config]: sharpness / luminance-based QP bias 			: 0 / 0
Svt[info]: Svt[info]: Svt[info]: Svt[info]: -------------------------------------------
-------------------------------------------
[RECORD] /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_191412 (7 ファイル) / 1 行 → /Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101_trials.csv
[SW405 ] missed_max (2 回外した). 渡した 2 回・判定 empty|empty・爪の読み 1.15|1.15
[INFO] --first: 1 回で止めます. 記録を見てから 続きを打つ: ./so101/check_405/session_405.sh
(base) shimazueiichi@shimadzueiichinoMacBook-Pro r2r2r-scripts %
```

### 台帳 so101_trials.csv の 2026-12-01 の so101h の行

```text
$ head -1 ${K:-/Volumes/KIOXIA}/r2r2r-data/lab/so101_Log12/so101_trials.csv; grep '^so101_20261201_1[89]' ${K:-/Volumes/KIOXIA}/r2r2r-data/lab/so101_Log12/so101_trials.csv
trial,started_at,operator,place,model,step,exec_steps,execute,result,frames,frames_model,frames_correct,frames_pause,queries,latency_median_s,latency_max_s,clipped_frames,record_dir,prefetch,payload_bytes,stall_median_s,stall_max_s,stall_total_s,fail_reason,currents,play_speed,rtc,rtc_d_median,rtc_s_median,jump_median_deg,jump_max_deg,jump_over3,jump_target_median_deg,jump_target_max_deg,jump_target_over3,rtc_s_over
so101_20261201_181516,20261201_181516,AI,3,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,251,61,0,0,4,0.389,0.453,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_181516,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,16,"-8.5,11.8,10.6",61,,,187,3,163.8,306.1,1.9,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_181745,20261201_181745,AI,2,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,253,62,0,0,4,0.424,0.672,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_181745,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.43,,16,"-7.7,17.6,13.8",62,,,187,4,245.0,170.5,-1.8,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_181856,20261201_181856,AI,4,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,262,75,0,0,5,0.382,0.408,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_181856,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,14,"-12.9,7.2,14.4",75,,,185,2,280.2,256.6,0.1,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_182001,20261201_182001,AI,5,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,257,66,0,0,4,0.401,0.433,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_182001,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,18,"-14.9,7.2,11.5",66,,,189,2,418.5,163.5,-3.8,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_182109,20261201_182109,AI,2,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,265,75,0,0,5,0.381,0.444,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_182109,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,15,"-8.2,9.0,5.6",75,,,186,4,241.0,172.6,2.0,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_182215,20261201_182215,AI,3,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,252,62,0,0,4,0.379,0.423,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_182215,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,16,"-6.8,14.4,11.3",62,,,187,3,164.9,307.6,-3.7,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_182304,20261201_182304,AI,4,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,257,69,0,0,4,0.379,0.419,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_182304,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,15,"-12.2,8.0,15.3",69,,,186,2,281.1,255.4,1.3,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_182352,20261201_182352,AI,5,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,261,71,0,0,5,0.38,0.558,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_182352,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,16,"-15.1,8.1,13.8",71,,,187,3,415.1,164.4,-2.4,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_182430,20261201_182430,AI,2,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,260,71,0,0,4,0.378,0.385,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_182430,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,14,"-7.4,18.7,10.7",71,,,185,4,241.0,174.6,-5.3,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_182515,20261201_182515,AI,3,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,265,76,0,0,5,0.38,0.433,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_182515,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,16,"-8.1,14.1,10.9",76,,,187,2,161.7,307.8,2.0,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_182554,20261201_182554,AI,4,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,261,70,0,0,5,0.438,0.557,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_182554,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,16,"-13.4,7.4,14.5",70,,,187,4,280.6,259.3,1.1,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_182653,20261201_182653,AI,5,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,250,62,0,0,4,0.447,0.706,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_182653,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,15,"-14.1,2.5,14.4",62,,,186,2,416.4,167.9,0.4,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_182738,20261201_182738,AI,2,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,253,70,0,0,4,0.413,0.474,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_182738,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,10,"-8.0,17.5,10.7",70,,,181,2,244.3,170.3,-1.4,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_182956,20261201_182956,AI,3,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,255,65,0,0,4,0.383,0.406,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_182956,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,15,"-8.2,12.6,10.7",65,,,186,4,163.9,306.7,-1.2,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_183036,20261201_183036,AI,4,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,256,69,0,0,4,0.379,0.437,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183036,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,13,"-13.5,6.7,13.8",69,,,184,3,280.6,254.5,1.7,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_183119,20261201_183119,AI,5,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,266,75,0,0,5,0.392,0.475,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183119,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,16,"-14.7,3.1,12.6",75,,,187,4,416.4,161.4,-4.4,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_183159,20261201_183159,AI,2,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,260,67,0,0,4,0.381,0.386,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183159,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,19,"-8.4,10.4,10.0",67,,,190,3,242.3,169.9,-2.4,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_183242,20261201_183242,AI,3,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,251,60,0,0,4,0.413,0.466,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183242,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.43,,16,"-8.4,12.2,8.9",60,,,187,4,162.6,305.9,1.9,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_183321,20261201_183321,AI,4,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,255,69,0,0,4,0.41,0.432,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183321,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,13,"-13.1,5.8,13.6",69,,,184,2,280.5,255.5,1.1,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_183405,20261201_183405,AI,5,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,256,67,0,0,4,0.383,0.414,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183405,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,15,"-13.7,4.3,10.4",67,,,186,3,413.4,163.4,0.4,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_183447,20261201_183447,AI,2,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,256,67,0,0,4,0.379,0.606,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183447,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,15,"-7.3,14.8,8.5",67,,,186,3,244.1,172.9,-2.9,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_183527,20261201_183527,AI,3,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,256,66,0,0,4,0.383,0.42,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183527,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.43,,16,"-7.9,14.3,11.7",66,,,187,3,162.6,305.6,2.8,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_183606,20261201_183606,AI,4,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,254,65,0,0,4,0.4,0.434,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183606,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.43,,16,"-12.7,8.0,14.9",65,,,187,2,281.7,253.4,-1.2,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_183647,20261201_183647,AI,5,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,260,71,0,0,5,0.379,0.561,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183647,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,16,"-13.9,5.1,14.6",71,,,187,2,416.5,164.5,1.8,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_183826,20261201_183826,AI,2,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,277,88,0,0,6,0.403,0.458,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183826,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,15,"-6.8,4.3,8.1",88,,,186,3,243.6,161.3,0.3,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_183928,20261201_183928,AI,3,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,266,78,0,0,5,0.414,0.51,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_183928,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,15,"-7.2,14.5,12.8",78,,,186,2,164.5,320.4,0.3,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_184007,20261201_184007,AI,4,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,265,76,0,0,5,0.387,0.487,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_184007,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,16,"-12.7,6.9,15.6",76,,,187,2,295.6,255.3,2.2,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_184046,20261201_184046,AI,5,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,258,65,0,0,4,0.419,0.464,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_184046,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.43,,19,"-15.2,6.7,18.5",65,,,190,3,409.0,161.9,0.2,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_184123,20261201_184123,AI,2,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,failure,265,58,0,0,4,0.475,0.641,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_184123,1,,,,,2,off,1.0,0,,,,,,,,,,10,5.0,retry_refused,1,0,empty,1.15,,21,"-3.7,7.2,21.1",58,読み直し (HOME),ブロックが 場所2 の目印から 202 画素 離れている (許し 40 画素). 置き直す,203,4,252.5,169.9,-26.5,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_184211,20261201_184211,AI,3,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,266,77,0,0,5,0.382,0.565,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_184211,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.43,,15,"-10.8,11.4,12.3",77,,,186,3,156.7,314.6,17.1,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_184346,20261201_184346,AI,4,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,253,65,0,0,4,0.398,0.427,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_184346,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,15,"-7.1,-2.0,19.6",65,,,186,2,291.1,257.4,24.1,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_184703,20261201_184703,AI,5,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,251,63,0,0,4,0.409,0.438,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_184703,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,15,"-14.2,5.2,10.5",63,,,186,2,414.9,160.7,0.9,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_184804,20261201_184804,AI,2,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,failure,252,47,0,0,3,0.38,0.558,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_184804,1,,,,,2,off,1.0,0,,,,,,,,,,10,5.0,retry_refused,1,0,empty,1.15,,21,"-2.1,5.6,26.2",47,読み直し (HOME),"面を選び直しても道が作れない・ガードに当たる (候補 1 通り. 最初の候補: rule_401 の道が作れない: 固定側を 12 mm 離す形が解けない: 姿勢が解けない ({'pos_mm': 0.799, 'tilt_deg': 2.135, 'jaw_deg': 0.198}))",203,2,242.9,171.9,-25.1,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_184939,20261201_184939,AI,3,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,264,76,0,0,5,0.389,0.419,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_184939,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.43,,15,"-4.4,17.2,11.2",76,,,186,2,169.3,309.1,-14.2,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_185016,20261201_185016,AI,4,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,254,67,0,0,4,0.372,0.59,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_185016,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,12,"-8.7,11.2,5.9",67,,,183,4,280.6,259.7,-16.3,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_185212,20261201_185212,AI,5,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,301,110,0,0,6,0.369,0.46,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_185212,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.43,,16,"-13.1,4.1,16.2",110,,,187,4,419.4,165.3,3.7,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_185802,20261201_185802,AI,5,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,success,259,71,0,0,5,0.388,0.424,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_185802,1,,,,,,off,1.0,0,,,,,,,,,,10,5.0,carried,1,0,held,10.37,,14,"-15.9,2.2,10.3",71,,,185,3,420.0,160.6,-17.9,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_185845,20261201_185845,AI,5,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,failure,443,116,0,0,8,0.379,0.46,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_185845,1,,,,,2,off,1.0,0,,,,,,,,,,10,5.0,missed_max,2,1,empty|empty,1.15|1.15,|,22|23,"-10.4,1.9,27.0|-10.4,1.3,22.4",58|58,2 回目,2 回外した,321,6,418.3,162.7,20.5,0,0,0.0,8.0,switch405_plan.json,1
so101_20261201_191412,20261201_191412,AI,3,so101h (PixelstoMotors/pi05-so101-code-rule401-grasp-lora-v1),2999,30,1,failure,364,57,0,0,4,0.421,0.441,,/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12/so101/so101_20261201_191412,1,,,,,2,off,1.0,0,,,,,,,,,,10,5.0,missed_max,2,1,empty|empty,1.15|1.15,|,21|20,"-7.9,15.7,42.4|-7.7,15.3,45.8",29|28,2 回目,2 回外した,302,5,164.8,308.4,0.5,0,1,0.0,8.0,switch405_plan.json,1
```


## 空振りの原因を調べたコードと出力（Claude）

### LOG621_work/analyze_621.py

```python
#!/usr/bin/env python3
"""LOG621: 切り替え方式 (so101h) の空振りの原因を記録から調べた (2026-12-01. 読むだけ).

1. 台帳の so101h の回ごとに switch405_plan.json から: 置いた向き・渡す姿勢・判定のときの関節・π0.5 が閉じるまでのコマ・閉じた所の高さ (close_point_rel_mm)
2. 学習データ (so101h の 56 本) の場所ごとの向きの範囲と, 渡す姿勢 / 閉じた所の指令の範囲
3. 空振りと成功の回の手首カメラで, 閉じる直前のブロックの赤い面積 (画素)

KIOXIA の lab/so101_Log12 と datasets/so101_redblock_box_code_rule401_grasp_v1 を読むだけ. 動画の読み出しは ffmpeg (libdav1d).
  python3 analyze_621.py  (KIOXIA は $HOME/mnt/KIOXIA か /Volumes/KIOXIA)
"""
import csv
import glob
import json
import os
import subprocess
import tempfile
from pathlib import Path

import numpy as np

ROOT = Path(os.path.expanduser('~/mnt/KIOXIA/r2r2r-data'))
if not ROOT.exists():
    ROOT = Path('/Volumes/KIOXIA/r2r2r-data')
LOG = ROOT / 'lab/so101_Log12'
DS = ROOT / 'datasets/so101_redblock_box_code_rule401_grasp_v1'
np.set_printoptions(precision=1, suppress=True, linewidth=200)


def so101h_trials():
    rows = list(csv.reader(open(LOG / 'so101_trials.csv')))
    h = rows[0]
    for r in rows[1:]:
        d = dict(zip(h, r))
        if d['trial'].startswith('so101_20261201') and d['model'].startswith('so101h'):
            yield d


def part1():
    print('== 1. so101h の回 (置いた向き順)')
    out = []
    for d in so101h_trials():
        j = json.load(open(LOG / 'so101' / d['trial'] / 'switch405_plan.json'))
        for a in j['attempts']:
            b = j['builds'][min(a['attempt'] - 1, len(j['builds']) - 1)]
            hp, st = a['handover_pose'], a['judge']['state']
            out.append((b['place'], a['block_yaw_deg'], d['trial'][-6:], a['attempt'], hp[:5], st[:5],
                        a['policy_frames'], a['close_point_rel_mm'][2], a['judge']['class'], b['status']))
    out.sort(key=lambda o: (o[0], o[1]))
    for o in out:
        hp, st = o[4], o[5]
        print(o[0], '%6.1f' % o[1], o[2], o[3], '渡す', ' '.join('%6.1f' % x for x in hp), '| 判定', ' '.join('%6.1f' % x for x in st),
              '| 肘 %5.1f 手首 %5.1f' % (st[2] - hp[2], st[3] - hp[3]), '| コマ', o[6], '高さ %5.1f' % o[7], o[8], o[9])


def part2():
    print('== 2. 学習データ 56 本 (場所ごと)')
    rows = []
    for e in sorted(glob.glob(str(DS / 'raw_episodes/*'))):
        m = json.load(open(e + '/meta.json'))
        z = np.load(e + '/episode.npz')
        rows.append((m['place'], m['block_yaw_deg'], z['actions'][0], z['actions'][-1]))
    yaws = [r[1] for r in rows]
    print('向き', min(yaws), max(yaws), '±5° 以内', sum(abs(y) <= 5 for y in yaws), '/', len(yaws))
    for p in sorted({r[0] for r in rows}):
        R = [r for r in rows if r[0] == p]
        A0 = np.array([r[2] for r in R]); A1 = np.array([r[3] for r in R])
        print('場所', p, len(R), '向き', min(r[1] for r in R), max(r[1] for r in R))
        print('  渡す姿勢 min', A0.min(0)[:5], 'max', A0.max(0)[:5])
        print('  閉じた所 min', A1.min(0)[:5], 'max', A1.max(0)[:5])


def frames(trial, cam, idx):
    """動画から指定のコマを取り出す (ffmpeg・libdav1d)."""
    import cv2
    src = LOG / 'so101' / trial / f'videos/observation.images.{cam}/chunk-000/file-000.mp4'
    sel = '+'.join(f'eq(n\\,{i})' for i in idx)
    with tempfile.TemporaryDirectory() as td:
        subprocess.run(['ffmpeg', '-loglevel', 'error', '-y', '-c:v', 'libdav1d', '-i', str(src), '-vf', f'select={sel}',
                        '-vsync', '0', f'{td}/f_%d.png'], check=True)
        return [cv2.imread(f'{td}/f_{k}.png') for k in range(1, len(idx) + 1)]


def red_area(im):
    import cv2
    hsv = cv2.cvtColor(im, cv2.COLOR_BGR2HSV)
    m = ((hsv[..., 0] < 12) | (hsv[..., 0] > 168)) & (hsv[..., 1] > 110) & (hsv[..., 2] > 60)
    ys, xs = np.nonzero(m)
    return int(m.sum()), int(xs.max() - xs.min()), int(ys.max() - ys.min())


def part3():
    print('== 3. 手首カメラの赤い面積 (画素・幅・高さ). 渡す所 / 閉じる直前 / 閉じ始め')
    T = [('184123', '場所2 -26.5 空振り', [72, 122, 129]), ('184804', '場所2 -25.1 空振り', [70, 110, 116]),
         ('183826', '場所2 +0.3 成功', [71, 150, 158]), ('185845', '場所5 +20.5 空振り', [71, 122, 128]),
         ('183647', '場所5 +1.8 成功', [70, 134, 140]), ('185802', '場所5 -17.9 成功', [71, 135, 141])]
    for k, name, idx in T:
        ims = frames('so101_20261201_' + k, 'wrist', idx)
        print(k, name, [red_area(im) for im in ims])


if __name__ == '__main__':
    part1()
    part2()
    part3()
```

### analyze_621.py の出力

```text
== 1. so101h の回 (置いた向き順)
2  -26.5 184123 1 渡す  -11.3   43.2  -53.6   82.4  -37.3 | 判定  -12.9   45.9  -40.3   68.3  -38.7 | 肘  13.4 手首 -14.1 | コマ 58 高さ  21.1 empty deep_at_zero
2  -25.1 184804 1 渡す  -13.0   43.3  -53.8   82.5  -37.5 | 判定  -14.3   45.3  -41.5   70.5  -38.6 | 肘  12.3 手首 -11.9 | コマ 47 高さ  26.2 empty deep_at_zero
2   -5.3 182430 1 渡す  -16.5   50.9  -67.4   88.5  -20.7 | 判定  -15.9   51.8  -45.6   67.3  -20.4 | 肘  21.8 手首 -21.2 | コマ 71 高さ  10.7 held deep_at_zero
2   -2.9 183447 1 渡す  -16.0   48.6  -63.3   86.7  -17.7 | 判定  -15.4   49.0  -39.6   64.3  -17.1 | 肘  23.6 手首 -22.4 | コマ 67 高さ   8.5 held deep_at_zero
2   -2.4 183159 1 渡す  -13.5   44.0  -55.2   83.2  -14.6 | 判定  -15.8   47.4  -37.5   63.6  -16.9 | 肘  17.8 手首 -19.6 | コマ 67 高さ  10.0 held conflict
2   -1.8 181745 1 渡す  -15.8   54.4  -73.8   91.4  -16.3 | 判定  -15.2   56.0  -54.6   73.2  -15.8 | 肘  19.2 手首 -18.2 | コマ 62 高さ  13.8 held deep_at_zero
2   -1.4 182738 1 渡す  -15.9   54.4  -73.8   91.4  -16.0 | 判定  -15.4   56.6  -54.4   72.5  -15.6 | 肘  19.4 手首 -18.9 | コマ 70 高さ  10.7 held deep_at_zero
2    0.3 183826 1 渡す  -13.1   46.7  -59.9   85.2  -11.3 | 判定  -15.1   47.8  -37.1   62.6  -14.0 | 肘  22.8 手首 -22.6 | コマ 88 高さ   8.1 held conflict
2    2.0 182109 1 渡す  -16.6   45.4  -57.6   84.2  -13.2 | 判定  -16.2   45.8  -32.9   61.2  -12.6 | 肘  24.7 手首 -23.0 | コマ 75 高さ   5.6 held deep_at_zero
3  -14.2 184939 1 渡す  -39.6   22.5  -22.3   89.9  -52.6 | 判定  -39.3   26.5   -6.4   70.5  -52.2 | 肘  15.9 手首 -19.3 | コマ 76 高さ  11.2 held ok
3   -3.7 182215 1 渡す  -41.3   22.7  -22.7   90.0  -43.8 | 判定  -41.0   26.6   -6.6   70.9  -43.6 | 肘  16.1 手首 -19.1 | コマ 62 高さ  11.3 held ok
3   -1.2 182956 1 渡す  -41.6   22.9  -23.0   90.1  -41.6 | 判定  -41.5   26.9   -6.9   71.3  -40.7 | 肘  16.1 手首 -18.7 | コマ 65 高さ  10.7 held ok
3   -0.4 191412 2 渡す  -41.7   21.6  -21.1   89.4  -40.9 | 判定  -41.4   23.1  -16.1   84.1  -40.0 | 肘   5.0 手首  -5.4 | コマ 28 高さ  45.8 empty ok
3    0.3 183928 1 渡す  -43.6   16.6  -13.6   87.1  -42.1 | 判定  -43.2   21.3    1.0   68.3  -41.3 | 肘  14.6 手首 -18.8 | コマ 78 高さ  12.8 held ok
3    0.5 191412 1 渡す  -41.8   21.4  -20.7   89.3  -40.1 | 判定  -41.5   23.0  -14.5   82.3  -39.2 | 肘   6.2 手首  -7.0 | コマ 29 高さ  42.4 empty ok
3    1.9 181516 1 渡す  -41.8   22.5  -22.4   89.9  -38.7 | 判定  -41.6   26.6   -6.2   71.1  -38.3 | 肘  16.1 手首 -18.8 | コマ 61 高さ  10.6 held ok
3    1.9 183242 1 渡す  -42.0   22.9  -23.1   90.1  -38.9 | 判定  -41.8   27.3   -6.6   70.5  -38.3 | 肘  16.5 手首 -19.6 | コマ 60 高さ   8.9 held ok
3    2.0 182515 1 渡す  -42.4   22.5  -22.3   89.9  -39.2 | 判定  -42.1   26.9   -6.9   70.9  -38.2 | 肘  15.4 手首 -19.0 | コマ 76 高さ  10.9 held ok
3    2.8 183527 1 渡す  -42.0   22.8  -22.9   90.1  -38.0 | 判定  -41.6   26.9   -7.3   70.9  -37.8 | 肘  15.6 手首 -19.2 | コマ 66 高さ  11.7 held ok
3   17.1 184211 1 渡す  -45.4   17.5  -15.0   87.5  -27.1 | 判定  -45.2   22.5   -0.6   68.3  -26.8 | 肘  14.4 手首 -19.2 | コマ 77 高さ  12.3 held ok
4  -16.3 185016 1 渡す  -12.0   18.2  -16.1   85.9  -27.1 | 判定  -11.8   23.4    1.0   64.8  -26.6 | 肘  17.1 手首 -21.0 | コマ 67 高さ   5.9 held ok
4   -1.2 183606 1 渡す  -13.0  -18.5   36.3   41.2  -13.6 | 判定  -12.6   -4.7   47.9   16.7  -13.2 | 肘  11.6 手首 -24.5 | コマ 65 高さ  14.9 held conflict
4    0.1 181856 1 渡す  -13.5  -20.1   37.8   41.3  -12.7 | 判定  -13.1   -6.1   50.0   15.8  -12.2 | 肘  12.3 手首 -25.6 | コマ 75 高さ  14.4 held conflict
4    1.1 182554 1 渡す  -13.5  -21.6   39.1   41.5  -11.6 | 判定  -13.3   -7.2   51.4   15.3  -11.1 | 肘  12.3 手首 -26.3 | コマ 70 高さ  14.5 held conflict
4    1.1 183321 1 渡す  -13.4  -20.0   37.6   41.3  -11.4 | 判定  -13.1   -6.0   50.4   15.4  -11.1 | 肘  12.8 手首 -25.9 | コマ 69 高さ  13.6 held conflict
4    1.3 182304 1 渡す  -13.3  -20.0   37.7   41.4  -11.0 | 判定  -12.7   -5.9   49.7   15.6  -10.9 | 肘  12.0 手首 -25.7 | コマ 69 高さ  15.3 held conflict
4    1.7 183036 1 渡す  -13.3  -19.7   37.4   41.3  -10.7 | 判定  -13.1   -5.4   49.8   15.1  -10.1 | 肘  12.5 手首 -26.2 | コマ 69 高さ  13.8 held conflict
4    2.2 184007 1 渡す  -10.2  -21.7   39.1   41.6   -6.4 | 判定   -9.7   -7.0   51.1   15.3   -5.9 | 肘  11.9 手首 -26.3 | コマ 76 高さ  15.6 held conflict
4   24.1 184346 1 渡す  -10.0  -11.3   22.8   62.5   16.7 | 判定   -9.4   -3.1   35.3   43.3   16.2 | 肘  12.6 手首 -19.2 | コマ 65 高さ  19.6 held ok
5  -17.9 185802 1 渡す   12.3   45.9  -58.3   83.4   -3.7 | 判定   11.7   48.5  -38.6   62.5   -3.0 | 肘  19.7 手首 -20.8 | コマ 71 高さ  10.3 held ok
5   -4.4 183119 1 渡す   12.0   41.7  -50.9   80.2   10.3 | 判定   11.4   45.8  -34.4   61.1   10.2 | 肘  16.5 手首 -19.1 | コマ 75 高さ  12.6 held ok
5   -3.8 182001 1 渡す   12.7   46.7  -59.7   83.9   11.6 | 判定   11.9   48.3  -38.4   62.7   11.1 | 肘  21.3 手首 -21.2 | コマ 66 高さ  11.5 held deep_at_zero
5   -2.4 182352 1 渡す   12.0   43.3  -53.7   81.4   12.4 | 判定   11.3   45.7  -34.4   60.4   12.0 | 肘  19.3 手首 -20.9 | コマ 71 高さ  13.8 held ok
5    0.2 184046 1 渡す   11.0   43.4  -53.8   81.4   14.0 | 判定   10.3   44.1  -33.5   61.0   13.6 | 肘  20.4 手首 -20.5 | コマ 65 高さ  18.5 held ok
5    0.4 182653 1 渡す   12.4   38.4  -45.3   77.9   15.7 | 判定   11.8   40.6  -26.0   58.0   15.7 | 肘  19.3 手首 -19.9 | コマ 62 高さ  14.4 held ok
5    0.4 183405 1 渡す   11.8   42.4  -52.1   80.7   15.1 | 判定   11.3   44.8  -31.6   59.5   14.5 | 肘  20.4 手首 -21.2 | コマ 67 高さ  10.4 held ok
5    0.9 184703 1 渡す   12.1   46.3  -58.9   83.6   15.9 | 判定   11.3   48.9  -39.3   63.8   15.6 | 肘  19.6 手首 -19.8 | コマ 63 高さ  10.5 held deep_at_zero
5    1.8 183647 1 渡す   12.4   41.1  -49.8   79.7   17.2 | 判定   11.8   44.4  -32.8   61.1   17.7 | 肘  17.0 手首 -18.6 | コマ 71 高さ  14.6 held ok
5    3.7 185212 1 渡す   12.9   40.9  -50.7   84.8   19.1 | 判定   12.4   44.8  -34.4   63.1   19.3 | 肘  16.3 手首 -21.7 | コマ 110 高さ  16.2 held ok
5   19.3 185845 2 渡す   13.7   36.4  -41.8   76.3   36.6 | 判定   13.1   40.3  -28.5   60.9   37.1 | 肘  13.3 手首 -15.4 | コマ 58 高さ  22.4 empty ok
5   20.5 185845 1 渡す   13.6   35.7  -40.5   75.8   37.7 | 判定   12.9   38.3  -26.5   59.9   37.2 | 肘  14.0 手首 -15.9 | コマ 58 高さ  27.0 empty ok
== 2. 学習データ 56 本 (場所ごと)
向き -7.5 17.0 ±5° 以内 49 / 56
場所 2 14 向き -3.2 17.0
  渡す姿勢 min [-16.9  37.2 -73.8  78.3 -16.1] max [-12.1  54.4 -43.6  91.1   3.5]
  閉じた所 min [-17.   38.9 -56.2  56.6 -19.1] max [-12.   56.6 -23.5  71.6   3.5]
場所 3 14 向き -2.9 11.7
  渡す姿勢 min [-46.3  18.4 -27.9  87.9 -44.8] max [-40.4  26.1 -16.3  91.8 -29.5]
  閉じた所 min [-46.3  23.1 -11.2  68.3 -44.8] max [-40.4  29.3  -1.3  71.9 -29.5]
場所 4 14 向き 1.4 11.5
  渡す姿勢 min [-14.6 -30.9  35.2  41.2 -11.2] max [ -9.3 -17.4  46.6  43.3   5.4]
  閉じた所 min [-14.6 -14.9  46.8  14.1 -11.2] max [-9.3 -3.  59.7 15.2  5.4]
場所 5 14 向き -7.5 2.1
  渡す姿勢 min [  9.4  40.3 -59.3  79.1   8.1] max [ 13.9  46.5 -48.4  83.8  18.6]
  閉じた所 min [  9.4  41.  -39.   57.1   8.1] max [ 13.9  47.8 -27.1  62.2  18.6]
== 3. 手首カメラの赤い面積 (画素・幅・高さ). 渡す所 / 閉じる直前 / 閉じ始め
184123 場所2 -26.5 空振り [(7345, 88, 92), (11702, 110, 127), (11844, 111, 126)]
184804 場所2 -25.1 空振り [(7339, 87, 93), (11096, 106, 119), (10822, 105, 119)]
183826 場所2 +0.3 成功 [(6461, 87, 87), (14073, 129, 135), (14283, 129, 130)]
185845 場所5 +20.5 空振り [(5462, 90, 87), (11159, 120, 123), (11034, 118, 123)]
183647 場所5 +1.8 成功 [(6466, 87, 84), (12666, 120, 122), (12795, 121, 123)]
185802 場所5 -17.9 成功 [(6630, 87, 87), (13942, 126, 126), (14527, 129, 127)]
```


## 依頼407 ― 場所2 で回すと爪が下りきらない原因を記録で確かめる

### 依頼407 の依頼文

```markdown
---
作業フォルダ: /Users/shimazueiichi/r2r2r-scripts
上限時間: 90
---
# 依頼407：SO-101 の場所2 でブロックを回して置くと爪が下りきらない原因を、実機の記録で確かめ、rule_401 の下げ方を直す（アームは動かさない）

## なぜ
2026-12-01 夜、so101h（つかむ所だけ π0.5）の切り替え方式（依頼405 の `check_405/session_405.sh`）で、目印にまっすぐ置いた 24 回は全部成功した。ずらして置いた回では、場所2 で −25〜−27° に回した 2 回だけ空振りした（`so101_20261201_184123`・場所2 の 9 回目。どちらも判定 empty・爪の読み 1.2）。
エイイチの目視：**爪が下りきっていない**。
ログの値：この 2 回は rule_401 の status が deep_at_zero（下げ 0 mm）で、指令の爪と机は **+5.4 mm**、予想は −11.7 mm。下りる間の固定側の予想は **−0.6 mm**（ブロックに重なる）。まっすぐ置いた場所2 も deep_at_zero（指令 +5.0 mm・予想 −9.4 mm）だが、実機では届いて成功している。
見立て：予想（依頼400 の dir_s）は回した姿勢で沈みを多く見積もっていて、実際は沈まず 5 mm 浮いたまま閉じている。so101h はまっすぐ置いたお手本（指令 +5 mm で止まる下り方）を覚えているので、π0.5 側でも同じになる。
2026-12-01 18:56 にエイイチが決めた：**決まりを直す（回した置き方でも爪が机まで下りるようにする）**。

## 最初に
Claude が今日足した、その回だけ値を変える口 2 つを、中身を変えずに個別に add して commit する：`so101/check_401/run_rule401.py`（`R401_ELEV_MAX_DEG`：爪の面の傾きの許し）、`so101/run_so101_policy.py`（`SO101_RANGE_MARGIN`：推論の安全範囲の余裕）。

## 確かめ（記録だけ）
1. 今日の場所2 の記録（KIOXIA `lab/so101_Log12/so101/so101_20261201_*`。model = code_rule401 と so101h。台帳の place = 2）で、**閉じた所の実際の爪と机の高さ**を、記録の observation.state から URDF で出す（依頼379・400 と同じ測り方）。指令・予想（rule401_plan.json / switch405 の記録）と並べ、ブロックの向き（block_yaw_deg）ごとの表にする。空振りの 2 回と、まっすぐ置いて成功した回の差がはっきり出るか
2. 同じことを場所3・4・5 でも出し、向きを変えたときに予想が外れる量（実際 − 予想）を場所ごと・向きごとにまとめる
3. 予想の外れが向き（手首の回り）でどう変わるかを、依頼400 の dir_s の形のどこが合っていないかとして書く（直すかどうかは 4 の結果で決める）

## 直す（rule_401 の下げ方。付けないときの道は今と同じ）
4. 1〜3 の結果から、どちらかを選んで入れる（両方でもよい。選んだ理由を報告に書く）
   - A：**指令の爪と机を +1 mm 以下にする決め（b）を、予想の押し付けの上限（c）より先にする**オプション。deep_at_zero・conflict の所でも指令を +1 mm まで下げる。押し付けの上限は R401_PUSH_LIMIT_MM（今日の実機は −14）で、これより深い所は止める（ガードは今のまま）
   - B：予想の沈みを、手首の回り（向き）で補正する（記録から出した量で）
5. 今日の場所2〜5 の実機の読み（trial.json の block_pixel・block_yaw_deg）すべてに、直した決まりを当てた表：指令の爪と机・予想・下げ量の変わり方。**まっすぐ置いて成功した回で、指令がどれだけ深くなるか**（机を押しすぎないか）を必ず出す。空振りの 2 回が +1 mm 以下になるか
6. `run_rule401.py`・`session_401.sh`・`check_405/switch_405.py`・`session_405.sh` で、環境変数 `R401_CMD_FIRST=1`（A）や `R401_YAW_SAG=1`（B）など 1 つの口で使えるようにする。既存の口・既定は変えない

## しないこと
アームを動かす、ガードを足す・既定の値を変える、rule_351・依頼399/400 のファイル・plan_401.json・データセット・台帳・元の記録を変える、学習を始める、codex のレビュー（アームの区間の道の高さだけの変更で、実機はエイイチが見て流す。2026-12-01 の決め）、`git add .`・`git clean`

## 報告（`so101/check_407/REPORT.md`）
- いちばん大事なこと：空振りの原因が予想の外れで説明できたか、選んだ直し方、直したあと場所2 の −25° で指令が何 mm になるか、まっすぐ置いた回への影響
- 1〜5 の表、テストの件数、commit（自分のファイルだけ個別に add）
- 実機の確かめの手順の案（場所2 を −25° に回して、コードだけで 2 回・so101h で 2 回。エイイチがすること・見る所）
- 最後の 1 行に「判定：合格／止めた（決めてほしいことあり）／失敗」
```

### 依頼407 の報告（見張り係の記録）

```markdown
# 結果：20261201_407_SO101の場所2で回して置くと爪が下りきらない原因を記録で確かめ決まりを直す

- 状態：完了
- 始めた時刻：2026-12-01 18:57
- 終わった時刻：2026-12-01 19:12（15分）
- 作業フォルダ：/Users/shimazueiichi/r2r2r-scripts
- この続きを Claude Code で話すとき：作業フォルダで `claude --resume 48789fe5-4674-49b8-994d-6c3ffc97d6ad`

## Claude Code の報告

**やったこと**
- 最初に、その回だけ値を変える口 2 つ（`run_rule401.py` の R401_ELEV_MAX_DEG、`run_so101_policy.py` の SO101_RANGE_MARGIN）を、中身を変えずに個別に add して commit しました（b1d4d65）。
- 今日の場所2〜5 で結果のある 97 回（コード 60 回・so101h 37 回）について、閉じた所の実際の爪と机を記録から出しました。測り方は依頼379・400 と同じです。指令・予想と並べ、場所ごと・向きごと・関節ごとの表にしました。
- rule_401 の下げ方に A（`R401_CMD_FIRST=1`）を足しました。付けなければ今と同じです。
- 今日の読みすべてに、今の決まりと A を当てた表を作りました。
- アームは動かしていません。

**結果**
- **空振りの原因は、予想の外れでは説明できません。** 空振りの 2 回は so101h の回で、下りて閉じたのは π0.5 です。rule_401 のつかむ所（指令 +5.4 mm）は送られていません。
  - π0.5 が閉じたときの指令は、爪と机 **+18.8 / +21.1 mm** でした。まっすぐ置いて成功した回は +2〜11 mm です。
  - 実際の高さは **+4.9 / +9.3 mm** で、エイイチの目視（下りきっていない）と合います。
  - 実際は dir_s の予想より 3.5〜5.6 mm 深い所にいました。見立て（予想が沈みを多く見積もった）とは向きが逆です。
  - so101h の学習データの向きは −7.5〜+17° で、−25° は学んだ範囲の外です。
  - コードだけで回して置いた 4 回（場所4・5 で −31.5°〜+21.8°）は、全部机まで届いて成功しています。
- **予想の外れは、向きでは片寄りません。** 場所ごとの片寄りのほうが大きいです（場所4 のコードは予想が約 5 mm 深すぎ、場所3 は約 2 mm）。補正する量を記録から出せないので、B は入れていません。
- **A を付けたときの場所2 −25°:** 指令は +0.89 mm（+1 mm 以下）になります。ただし予想が −16.3 mm、閉じる間〜持ち上げの始めが −17.6 mm なので、今日の上限 −14 ではガードが止めます。
- **まっすぐ置いた回への影響（A・上限 −14）:**

  | 場所 | 変わり方 | 止まる回 |
  |---|---|---|
  | 3 | 23 回とも同じ道 | なし |
  | 5 | 変わるのは 2 回だけ（下げが 2.6〜2.9 mm 深く） | なし |
  | 4 | 18 回で下げが 0.2〜2.4 mm 深く | なし |
  | 2（午前） | 下げが 0.25〜1.7 mm 深い回が多い | 1 回（下げ 4.0 mm 深く） |
  | 2（夕方の so101h の読み・まっすぐ） | 下げが約 4 mm 深く | 5 回のうち 4 回 |

- A は渡す姿勢も変えることがあります。97 回のうち 30 回で、多くは 0.5° 以下、最大 18° です。
- テストは `test_run_rule401.py` 39 本（8 本足した）と `test_switch_405.py` 18 本で、全部通りました。偽の読みで −26.5° を通して、上限 −14 で止まることも確かめました。
- commit は c7c4611 と bc5f37a（報告に commit を書き足したもの）です。ファイルは個別に add しました。
- 報告 `so101/check_407/REPORT.md` の最後の 1 行は「判定：止めた（決めてほしいことあり）」です。実機の確かめの手順の案もここに書きました（コードだけ 2 回で、今の決まりと A を 1 回ずつ。so101h で 2 回）。

**変えたファイル**
- `so101/check_401/run_rule401.py`（A を足した。あわせて最初の commit の口も入っている）
- `so101/run_so101_policy.py`（最初の commit だけ）
- `so101/check_401/test_run_rule401.py`
- `so101/check_401/session_401.sh`
- `so101/check_405/session_405.sh`
- `so101/check_405/switch_405.py`（説明だけ）
- `so101/check_407/` に新しく 7 つ: REPORT.md・analyze_407.py・apply_407.py・summarize_407.py・analyze_407.json・apply_407.json・tables_407.md
- 作業の記録として `logs/20261201_1915.md` も書きました（commit はしていません）。

**決めてほしいこと**
1. so101h の空振りへの手当て。原因は π0.5 が学んだ向きの外で下りきらないことなので、rule_401 を直しても直りません。次のどれにするかを決めてほしいです。
   - 回した置き方のお手本を足して学習し直す
   - so101h は向き ±17° の中だけで使う
   - 外したあとのやり直しをコードのつかみにする
2. A を使うときの押し付けの上限。場所2 −25° を流すには、R401_PUSH_LIMIT_MM を −16.4 以下、R401_PUSH_WINDOW_MM を −17.7 以下にする必要があります。−14 のままだと、夕方の読みの場所2 では、まっすぐの回も 5 回のうち 4 回が止まります。
3. π0.5 の回（session_405）にも A を付けるか。渡す姿勢が変わる回があります。
4. 依頼の外で見つけたこと: `check_392/handover_392.py` と `ideal_var/var_lib_314.py` の `margin=10.0` の変更が、まだ commit されていません。SO101_RANGE_MARGIN に合わせて足されたものに見えます。範囲外なので触っていません。
```

### so101/check_407/REPORT.md

```markdown
# 依頼 407 報告: 場所2 で回して置くと爪が下りきらない原因を記録で確かめ、rule_401 の下げ方を直す（アームは動かしていない）

## いちばん大事なこと

1. **空振りの原因は「予想の外れ」では説明できない。** 空振りした 2 回（184123・184804）は so101h の回なので、下りて閉じたのは π0.5 で、rule_401 のつかむ所（指令 +5.4 mm・予想 −11.7 mm）は送っていない。π0.5 が送った指令は、閉じたときに爪と机が **+18.8 / +21.1 mm**（まっすぐ置いて成功した so101h の場所2 は +2.1〜+11.3）。実際の高さは **+4.9 / +9.3 mm** で、エイイチの目視（下りきっていない）と合う。
   - 腕は指令より 12〜14 mm 沈んでいて、送った指令を dir_s に通した予想（+10.5 / +12.8）より **さらに 3.5〜5.6 mm 下**にいた。つまり dir_s は「沈みを多く見積もった」のではなく、少なく見積もっていた。見立て（予想が沈みを多く見積もり、実際は沈まなかった）とは向きが逆。
   - 下りるのが止まったのは π0.5 の指令。肘が −40.4°、手首の曲げが 68° で止まっている（まっすぐのときは 63.7°）。閉じる前に爪を一度 39 まで閉じてから 59 に開き直していて、迷っている形。
   - so101h の学習データ 56 本のブロックの向きは −7.5〜+17°（場所2 は −3.2〜+17°）。−25〜−27° は学んだ範囲の外。18:58 の場所5 +20.5° の空振り（185845。実際 +7.1 mm・送った指令 +10.1 mm）も同じ形。
   - コードだけで回して置いた 4 回（場所4 −31.5°・+21.8°、場所5 −28.5°・−30.9°）は全部成功し、実際の爪と机は −1.2〜−7.8 mm で机まで届いている。
2. **選んだ直し方は A（`R401_CMD_FIRST=1`）。B は入れていない。**
   - B を入れなかった理由: 記録では、予想の外れが向きによって決まった向きに変わる様子がない（表 2・3）。回した 4 回のコードの外れは +4.7・−2.3・+4.7・+2.3 mm で、まっすぐの回の幅の中に入る。関節ごとの外れも、どの向きでも ±1.1° 以内。補正する量を記録から出せない。
   - A を入れた理由: コードの道で deep_at_zero・conflict になる所（今は指令 +1.2〜+5.9 mm で止まる）を、指令 +1 mm 以下まで確実に下げられる。so101h の空振りは直らないが、コードだけで流す回・お手本を録り直す回には効く。付けなければ今と同じ。
3. **A を付けたとき、場所2 の −25° の指令は +0.89 mm になる。** ただし予想が −16.3 mm、閉じる間〜持ち上げの始めが −17.6 mm なので、今日の上限 −14 では **ガード（push_limit・push_window）が止める**。流すには、上限を −16.4 / −17.7 より深くする必要がある（決めてほしいこと 2）。
4. **まっすぐ置いた回への影響（A・上限 −14）**
   - 場所3: 23 回とも同じ道。
   - 場所5: 22 回のうち、変わるのは deep_at_zero の 2 回だけ（指令 +3.8 → +0.9・下げ +2.6〜2.9 mm 深く）。
   - 場所4: conflict の 18 回は、指令 +1.1〜+3.3 → +0.95 mm、下げが 0.2〜2.4 mm 深くなる。予想は −5.9 → −6.1〜−8.3 mm で、止まる回はない。
   - 場所2（午前の目印の所）: conflict の 13 回は、下げが 0.25〜1.7 mm 深くなる（予想 −6.2〜−7.6 mm）。止まらない。104539 の 1 回だけ、下げが 4.0 mm 深くなって閉じる間の予想 −15.8 mm で止まる。
   - **場所2（夕方の so101h の回の読み）**: deep_at_zero の 5 回は、下げが 4.0〜4.3 mm 深くなり、予想 −13.1〜−14.3 mm。上限 −14 では **5 回のうち 4 回が止まる**（push_window 3 回・too_deep 1 回）。
   - 机を押しすぎないかについて: 今の決まりのままでも、まっすぐの場所2 のコードの回は、実際 −1.0〜−13.1 mm（中央値 −8.3）まで押し付けて成功している。予想より深い回が多い（実際 − 予想 の中央値 −1.9 mm）。
5. A では、つかむ所を下げたあとで固定側のすき間 12 mm を解き直すので、**渡す姿勢（ABOVE_BLOCK）も変わる回がある**（今日の読み 97 回のうち 30 回。多くは 0.5° 以下。2° を超えるのは 5 回で 2〜18°。そのうち 4 回は止まる回）。so101h に渡す姿勢が変わるので、π0.5 の回に A を付けるかどうかも決めてほしいことに入れる。

## 確かめ（記録だけ）

測り方（依頼 379・400 と同じ）: 実際の関節は A[k] = state[k+1]。閉じた所は、実際の爪の値が 20 を割った最初のコマ。爪と机は `ArmResponse.clearance`（clear_345 の場面・関節のずれなし）の jaw_table。
- コードの回: 道は rule401_plan.json の指令と同じ（60 回とも、送った値と道の差は 0.05 以下）
- so101h の回: 方策の区間で、送った爪が 20 を割ったあと、実際の爪が 20 を割ったコマ
- 予想: 送った指令の並びを dir_s に通したもの（同じコマで比べる）。記録の指令・予想は、その回の rule_401 のつかむ所の値

対象は 2026-12-01 の場所2〜5 で、結果のある回 97 回（コード 60 回・so101h 37 回）。全部の表は `tables_407.md`、生の値は `analyze_407.json` にある。

### 1. 場所2（mm。負は机より下）

| 試行 | 方式 | 結果 | 向き° | status | 記録 指令 | 記録 予想 | 送った指令 | 送った予想 | 実際 |
|---|---|---|---|---|---|---|---|---|---|
| 184123 | so101h | 空振り | −26.5 | deep_at_zero | +5.4 | −11.7 | **+18.8** | +10.5 | **+4.9** |
| 184804 | so101h | 空振り | −25.1 | deep_at_zero | +5.4 | −11.7 | **+21.1** | +12.8 | **+9.3** |
| 181745・182109・182430・182738・183447 | so101h | 成功 | −5.3〜+2.0 | deep_at_zero | +4.9〜+5.2 | −9.0〜−9.9 | +2.2〜+11.3 | −9.6〜−1.2 | −2.5〜−10.6 |
| 183159・183826 | so101h | 成功 | −2.4・+0.3 | conflict | +2.4・+1.9 | −5.9 | +2.1・+3.0 | −3.8・−10.1 | −6.5・−8.3 |
| コード 14 回 | code | 成功 | −3.2〜+17.0 | conflict 12・ok 2 | +0.9〜+4.9 | −2.7〜−5.9 | +3.9〜+7.9 | −5.0〜−6.8 | −1.0〜−13.1 |

空振りの 2 回とまっすぐ置いて成功した回の差は、**π0.5 が送った指令の高さ**にはっきり出ている（+19〜21 mm と +2〜11 mm）。rule_401 の記録の指令は +5.4 と +5.0 でほぼ同じ。

### 2. 場所ごと・向きごと: 実際 − 予想（mm。中央値（最小〜最大、回数）。正 = 実際が予想より上）

| 場所 | 方式 | ±10° の内 | ±10° の外 |
|---|---|---|---|
| 2 | code | −1.9（−6.4〜+4.0, 13） | +3.1（1） |
| 2 | so101h | −1.2（−2.7〜+2.5, 7） | **−4.6（−5.6〜−3.5, 2）** |
| 3 | code | +2.2（+1.6〜+4.9, 13） | +2.3（1） |
| 3 | so101h | −0.3（−2.1〜+4.6, 7） | −0.3（2） |
| 4 | code | +5.0（+3.8〜+5.8, 13） | +4.7（+2.3〜+5.4, 3） |
| 4 | so101h | −0.2（−0.3〜+2.8, 7） | +0.8（2） |
| 5 | code | +1.7（−2.8〜+4.0, 14） | +1.2（−2.3〜+4.7, 2） |
| 5 | so101h | −0.9（−3.4〜+1.3, 9） | −0.1（2） |

### 3. dir_s の形のどこが合っていないか

- **外れは向き（手首の回り）では決まらない。** 場所ごとの片寄りのほうが大きい（場所4 のコードは +5.0 で、予想が深すぎる。場所3 は +2.2）。同じ場所で ±10° の外に出しても、外れの片寄りは同じくらい（場所4 +4.7、場所5 +1.2）。回したときに沈みを多く見積もる形は、記録には出ていない。
- **場所2 のコードの回は外れが 2 つに分かれる**（−4.9〜−6.4 の回と、−0.5〜+2.1 の回）。分かれ方は肩の上下の外れと合っている（深い回は +1.4〜+1.6°、浅い回は +0.1〜+0.3°）。dir_s の「動く向き」の足し分は、最後に動いた向きで一度に切り替わる。場所2 のつかむ所では肩がほとんど動かないので、実機は 2 つの止まり方のどちらにもなり、予想は片方しか表せない。これは向きとは関係がない。
- 空振りの 2 回では、実際が予想より 3.5〜5.6 mm 深い。関節ごとの外れは手首の曲げ・手首の回りとも +0.5° 程度。π0.5 の指令が閉じる直前に上がりかけていて（+10 → +19 mm）、遅れの分も入っている。
- 4 の直し方としては、どちらにしても B（向きで補正する）の根拠は出ない。場所ごとの片寄り（場所4 で予想が 5 mm 深すぎる）を直すなら、dir_s の当てはめを直す別の仕事になる（依頼400 のファイルは変えていない）。

## 直す（A）

- `run_rule401.py` に `apply_cmd_first` を足した。
  - a（予想で −2 mm をねらう）・b（指令 +1 mm 以下）は rule_401 と同じ解き方（`rule_401._var`・`measure` をそのまま使う）。
  - c はしない。予想が `R401_PUSH_LIMIT_MM` より深くても上げず、status を `too_deep` にする。そのあと今のガード push_limit が止める。b を満たせなければ conflict。
  - `build()` は、`R401_CMD_FIRST=1` のときだけこれを使う。付けないときは `rule_401.apply` のままで、今日の 97 回の読みで記録の値と全部一致した（差 0.02 以下）。
  - 記録（rule401_plan.json・switch405_plan.json）には `cmd_first`・`push_limit_mm_used` が入る。確かめの表示に 1 行出す。
- `switch_405.py` は `run_rule401.prepare` を使うので、同じ口で効く（説明だけ足した）。
- `session_401.sh`・`session_405.sh` は環境変数をそのまま渡す。付けたときに 1 行出すようにした。
- rule_401.py・rule_351・依頼399/400 のファイル・plan_401.json・既定の値・ガードは変えていない。

### 5. 今日の読みに A を当てた表（押し付けの上限 −14・閉じる間〜持ち上げ −14）

まとめ（全部の行は `tables_407.md` の 5、生の値は `apply_407.json`）:

| 場所・今の status | 回数 | 指令 今 → A | 予想 今 → A | 下げの差 | A で止まる |
|---|---|---|---|---|---|
| 2 conflict（午前の目印・コード 13・so101h 1） | 14 | +1.2〜+4.9 → +0.91 | −2.7〜−5.9 → −6.2〜−12.8 | −0.25〜−4.03 | 1（104539・push_window −15.8） |
| 2 deep_at_zero（夕方の so101h の読み・空振り 2 を含む） | 7 | +4.9〜+5.4 → +0.89〜+0.92 | −9.0〜−11.7 → −13.1〜−16.3 | −4.03〜−4.53 | 6 |
| 2 ok | 2 | 同じ | 同じ | 0 | 0 |
| 3 ok | 23 | 同じ | 同じ | 0 | 0 |
| 4 conflict | 18 | +1.1〜+3.3 → +0.93〜+0.97 | −5.8〜−5.9 → −6.1〜−8.2 | −0.19〜−2.35 | 0 |
| 4 ok | 7 | 同じ | 同じ | 0 | 0 |
| 5 conflict（−28.5°・−30.9° のコード） | 2 | +5.3〜+5.9 → +0.93 | −2.9〜−3.2 → −13.8〜−15.0 | −4.36〜−5.01 | 2 |
| 5 deep_at_zero | 2 | +3.5〜+3.8 → +0.91 | −6.2〜−6.3 → −8.9〜−9.1 | −2.60〜−2.91 | 0 |
| 5 ok | 22 | 同じ | 同じ | 0 | 0 |

- 空振りの 2 回: 指令 +5.43 → **+0.89 mm**（+1 mm 以下になる）。下げ 0 → −4.53 mm、予想 −11.7 → −16.3 mm、閉じる間〜持ち上げ −17.6 mm で、上限 −14 では止まる。
- 185845（場所5 +20.5°）は、既定の爪の面の傾き ±8° では rule_351 の道が作れないので外した（その回は R401_ELEV_MAX_DEG を広げて流した回）。

## テスト

- `test_run_rule401.py`: 39 本 OK（A の解き方 8 本を足した。下げ方は今の 5 本と同じ形で当てたうえ、too_deep で上げないこと・上限 −6 で止まること・環境変数の切り替えを見る）
- `test_switch_405.py`: 18 本 OK
- 偽の読みでの通し: `run_rule401.py --dry-run --fake 252.5,169.9,-26.5`（A・上限 −14）で、指令 +0.89・予想 −16.29・too_deep で止まることを確かめた（書き出したファイルは消した）

## 実機の確かめの手順（案。流すかどうかはエイイチが決める）

ねらいは、空振りの原因が π0.5 の下り方なのか、コードの道でも浮くのかを分けること。

1. まず偽の読みで道を見る（アームなし）:
   `SO101_VAR_ROLL_RANGE=-67,58 R401_PIXEL_TOL_PX=40 R401_YAW_TOL_DEG=40 R401_CMD_FIRST=1 R401_PUSH_LIMIT_MM=<決めた値> R401_PUSH_WINDOW_MM=<決めた値> $P so101/check_401/run_rule401.py --place 2 --dry-run --fake 252.5,169.9,-26.5`
2. コードだけ 2 回（場所2・−25° に回して置く）。
   - 1 回目は今の決まりのまま: `R401_ALLOW_DEEP=1`。指令 +5.4 mm。**コードの道でも浮くか**を見る。dir_s の予想は −11.7 mm で、記録の傾向なら届く。
   - 2 回目は `R401_CMD_FIRST=1`。指令 +0.9 mm。上限を −16.4 / −17.7 より深くしないと動かない。
   - 打ち方: `PLACES=2 N=… R401_PIXEL_TOL_PX=40 R401_YAW_TOL_DEG=40 [上の口] ./so101/check_401/session_401.sh --first`
3. so101h で 2 回（今日と同じ `session_405.sh`、`PLACES=2`、−25° に置く）。A を付けても π0.5 の下り方は変わらない見込み。付けると渡す姿勢が少し変わる。
4. エイイチが見る所:
   - 閉じる瞬間に、爪の先が机に付いているか（横から）
   - 下りる間に、固定側の爪がブロックの角に当たらないか（予想の最小 −0.3〜−0.6 mm）
   - コードの回で、閉じたあと机を押してアームがきしまないか・止まらないか
   - so101h の回で、肘・手首が途中で止まり、爪を開き直す迷いが出るか
5. あとで `analyze_407.py 20261202`（日付を引数で渡す）と `summarize_407.py` を流し直し、表 1 と同じ形で比べる。

## 決めてほしいこと

1. **so101h の空振りへの手当て**: 原因は π0.5 が学んだ向きの外（−25°）で下りきらないこと。rule_401 を直しても π0.5 の下り方は変わらない。たとえば、回した置き方のお手本を足して学習し直す、so101h は向き ±17° の中だけで使う、外したあとのやり直しをコードのつかみにする、のどれにするか。
2. **A を使うときの押し付けの上限**: 場所2 の −25° を A で流すには、R401_PUSH_LIMIT_MM ≤ −16.4、R401_PUSH_WINDOW_MM ≤ −17.7 が要る。上限 −14 のままでは、夕方の so101h の読みの場所2（まっすぐ）も 5 回のうち 4 回が止まる。
3. **π0.5 の回（session_405）に A を付けるか**: 渡す姿勢が変わる回がある（30/97 回。最大 18°）。
4. この依頼の外で見つけたこと: SO101_RANGE_MARGIN に合わせて足されたと見られる `check_392/handover_392.py`・`ideal_var/var_lib_314.py` の `margin=10.0` の変更が、まだ commit されていない（依頼の範囲外なので触っていない）。

## commit

- b1d4d65: 最初に、その回だけ値を変える口 2 つ（`run_rule401.py` の R401_ELEV_MAX_DEG・`run_so101_policy.py` の SO101_RANGE_MARGIN）を、中身を変えずに commit した
- c7c4611: この依頼の commit。run_rule401.py・test_run_rule401.py・session_401.sh・session_405.sh・switch_405.py と check_407/ の 7 ファイル（REPORT.md・analyze_407.py・apply_407.py・summarize_407.py・analyze_407.json・apply_407.json・tables_407.md）を個別に add した

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

### so101/check_407/tables_407.md

```markdown
# 依頼 407 の表 (summarize_407.py が作った)

## 1. 場所2: 閉じた所の 爪と机 (mm. 負は机より下 = 押し付け)

記録の値 = その回の rule_401 の道 (コードの道) の つかむ所. 閉じたときの値 = 実際の爪が 20 を割ったコマで, 送っていた指令 (送った指令)・送った指令の並びを dir_s に通した予想 (送った予想)・実際 (observation.state)

| 試行 | 方式 | 結果 | 向き° | status | 記録 指令 | 記録 予想 | 送った指令 | 送った予想 | 実際 | 実際−送った予想 |
|---|---|---|---|---|---|---|---|---|---|---|
| 102806 | code | success | -3.2 | conflict | +2.6 | -5.9 | +5.6 | -6.2 | **-6.7** | -0.5 |
| 104539 | code | success | -2.7 | conflict | +4.9 | -2.7 | +7.9 | -5.0 | **-1.0** | +4.0 |
| 094707 | code | success | +1.0 | conflict | +1.8 | -5.9 | +4.7 | -6.6 | **-11.5** | -4.9 |
| 095203 | code | success | +1.7 | conflict | +1.6 | -5.9 | +4.6 | -6.4 | **-8.3** | -1.9 |
| 103405 | code | success | +2.8 | conflict | +1.3 | -5.9 | +4.2 | -6.6 | **-4.5** | +2.1 |
| 100155 | code | success | +2.9 | conflict | +1.3 | -5.9 | +4.3 | -6.7 | **-12.4** | -5.7 |
| 101648 | code | success | +2.9 | conflict | +1.2 | -5.9 | +4.2 | -6.5 | **-5.8** | +0.8 |
| 093506 | code | success | +3.1 | conflict | +1.5 | -5.9 | +4.4 | -6.7 | **-12.5** | -5.8 |
| 094318 | code | success | +3.3 | conflict | +1.4 | -5.9 | +4.4 | -6.8 | **-6.0** | +0.8 |
| 103106 | code | success | +3.4 | conflict | +1.2 | -5.9 | +4.2 | -6.8 | **-9.6** | -2.8 |
| 101100 | code | success | +3.9 | conflict | +1.2 | -5.9 | +4.2 | -6.8 | **-13.1** | -6.4 |
| 093932 | code | success | +4.5 | conflict | +1.2 | -5.9 | +4.2 | -6.5 | **-6.5** | +0.0 |
| 102051 | code | success | +4.9 | ok | +0.9 | -5.8 | +3.9 | -6.8 | **-9.3** | -2.5 |
| 103818 | code | success | +17.0 | ok | +0.9 | -3.8 | +3.9 | -6.7 | **-3.6** | +3.1 |
| 184123 | so101h | failure | -26.5 | deep_at_zero | +5.4 | -11.7 | +18.8 | +10.5 | **+4.9** | -5.6 |
| 184804 | so101h | failure | -25.1 | deep_at_zero | +5.4 | -11.7 | +21.1 | +12.8 | **+9.3** | -3.5 |
| 182430 | so101h | success | -5.3 | deep_at_zero | +5.2 | -9.9 | +3.0 | -4.4 | **-5.7** | -1.2 |
| 183447 | so101h | success | -2.9 | deep_at_zero | +5.1 | -9.5 | +2.2 | -5.3 | **-7.8** | -2.5 |
| 183159 | so101h | success | -2.4 | conflict | +2.4 | -5.9 | +2.1 | -3.8 | **-6.5** | -2.7 |
| 181745 | so101h | success | -1.8 | deep_at_zero | +5.0 | -9.4 | +11.3 | -1.2 | **-2.5** | -1.3 |
| 182738 | so101h | success | -1.4 | deep_at_zero | +5.0 | -9.4 | +4.0 | -8.0 | **-5.5** | +2.5 |
| 183826 | so101h | success | +0.3 | conflict | +1.9 | -5.9 | +3.0 | -10.1 | **-8.3** | +1.8 |
| 182109 | so101h | success | +2.0 | deep_at_zero | +4.9 | -9.0 | +2.5 | -9.6 | **-10.6** | -1.0 |

## 2. 場所ごと・向きごと: 実際 − 予想 (mm. 中央値 (最小〜最大, 回数))

予想 = 送った指令の並びを dir_s に通したもの (同じコマ). 正 = 実際は予想より上 (沈みを多く見積もった)

| 場所 | 方式 | 向き | 実際 | 実際 − 予想 | 実際 − 送った指令 |
|---|---|---|---|---|---|
| 2 | code | ±10° の内 | -8.3 (-13.1〜-1.0, 13) | -1.9 (-6.4〜+4.0, 13) | -12.9 (-17.3〜-8.7, 13) |
| 2 | code | ±10° の外 | -3.6 (-3.6〜-3.6, 1) | +3.1 (+3.1〜+3.1, 1) | -7.5 (-7.5〜-7.5, 1) |
| 2 | so101h | ±10° の内 | -6.5 (-10.6〜-2.5, 7) | -1.2 (-2.7〜+2.5, 7) | -10.0 (-13.8〜-8.6, 7) |
| 2 | so101h | ±10° の外 | +7.1 (+4.9〜+9.3, 2) | -4.6 (-5.6〜-3.5, 2) | -12.9 (-13.9〜-11.8, 2) |
| 3 | code | ±10° の内 | -1.3 (-1.9〜-0.8, 13) | +2.2 (+1.6〜+4.9, 13) | -5.2 (-7.8〜-4.7, 13) |
| 3 | code | ±10° の外 | -1.1 (-1.1〜-1.1, 1) | +2.3 (+2.3〜+2.3, 1) | -4.8 (-4.8〜-4.8, 1) |
| 3 | so101h | ±10° の内 | -1.4 (-3.6〜+0.3, 7) | -0.3 (-2.1〜+4.6, 7) | -3.4 (-5.2〜-2.4, 7) |
| 3 | so101h | ±10° の外 | -0.8 (-1.1〜-0.5, 2) | -0.3 (-0.9〜+0.3, 2) | -3.6 (-4.2〜-3.0, 2) |
| 4 | code | ±10° の内 | -4.3 (-5.3〜-3.4, 13) | +5.0 (+3.8〜+5.8, 13) | -8.7 (-10.1〜-7.0, 13) |
| 4 | code | ±10° の外 | -1.7 (-2.3〜-1.5, 3) | +4.7 (+2.3〜+5.4, 3) | -5.2 (-8.4〜-4.8, 3) |
| 4 | so101h | ±10° の内 | -3.5 (-4.4〜-2.0, 7) | -0.2 (-0.3〜+2.8, 7) | -6.8 (-8.4〜-5.2, 7) |
| 4 | so101h | ±10° の外 | -1.4 (-7.2〜+4.4, 2) | +0.8 (+0.2〜+1.4, 2) | -2.2 (-2.5〜-1.9, 2) |
| 5 | code | ±10° の内 | -2.6 (-7.0〜-0.6, 14) | +1.7 (-2.8〜+4.0, 14) | -6.5 (-10.9〜-4.5, 14) |
| 5 | code | ±10° の外 | -4.5 (-7.8〜-1.2, 2) | +1.2 (-2.3〜+4.7, 2) | -15.4 (-19.0〜-11.9, 2) |
| 5 | so101h | ±10° の内 | -1.6 (-5.2〜+2.8, 9) | -0.9 (-3.4〜+1.3, 9) | -4.2 (-6.4〜-1.9, 9) |
| 5 | so101h | ±10° の外 | +0.7 (-5.7〜+7.1, 2) | -0.1 (-0.4〜+0.2, 2) | -4.5 (-6.0〜-3.0, 2) |

## 3. 関節ごと: 実際 − 予想 (°. 閉じたコマ. 中央値)

| 場所 | 方式 | 向き | 回数 | 肩の回転 | 肩の上下 | 肘 | 手首の曲げ | 手首の回り |
|---|---|---|---|---|---|---|---|---|
| 2 | code | ±10° の内 | 13 | +0.1 | +0.8 | -0.8 | -0.0 | +0.2 |
| 2 | code | ±10° の外 | 1 | +0.1 | -0.0 | -1.0 | -0.2 | +0.1 |
| 2 | so101h | ±10° の内 | 7 | +1.1 | +0.1 | -0.1 | -0.0 | +0.1 |
| 2 | so101h | ±10° の外 | 2 | +0.1 | +0.3 | +0.1 | +0.5 | +0.5 |
| 3 | code | ±10° の内 | 13 | -0.1 | -0.1 | -1.0 | -0.2 | +0.1 |
| 3 | code | ±10° の外 | 1 | -0.0 | -0.2 | -0.9 | -0.1 | +0.3 |
| 3 | so101h | ±10° の内 | 7 | +0.8 | -0.1 | +0.0 | +0.1 | +0.1 |
| 3 | so101h | ±10° の外 | 2 | +0.1 | -0.2 | +0.3 | -0.4 | +0.7 |
| 4 | code | ±10° の内 | 13 | +0.0 | -1.1 | -0.9 | +0.1 | +0.3 |
| 4 | code | ±10° の外 | 3 | +0.2 | -0.9 | -0.8 | +0.2 | -0.2 |
| 4 | so101h | ±10° の内 | 7 | +0.1 | -0.3 | -0.1 | +0.5 | +0.8 |
| 4 | so101h | ±10° の外 | 2 | +1.1 | -0.2 | -0.2 | +0.4 | +0.0 |
| 5 | code | ±10° の内 | 14 | +0.0 | +0.1 | -0.8 | +0.1 | -0.2 |
| 5 | code | ±10° の外 | 2 | +0.6 | -0.4 | -0.2 | +0.1 | -0.1 |
| 5 | so101h | ±10° の内 | 9 | +0.1 | +0.1 | -0.1 | +0.2 | -0.2 |
| 5 | so101h | ±10° の外 | 2 | -0.4 | +0.1 | -0.3 | +0.3 | -0.0 |

## 5. 今の rule_401 と A (R401_CMD_FIRST=1) を 今日の読みに当てた (押し付けの上限 −14・閉じる間〜持ち上げ −14)

| 試行 | 方式 | 場所 | 結果 | 向き° | 今 status | 今 指令 | 今 予想 | 今 下げ | A status | A 指令 | A 予想 | A 下げ | 下げの差 | A 閉じる間〜持ち上げ | A で止まる |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 092453 | code | 3 | success | +2.2 | ok | +0.90 | -2.42 | -0.79 | ok | +0.90 | -2.42 | -0.79 | +0.00 | -6.14 |  |
| 092549 | code | 3 | success | -2.9 | ok | +0.90 | -2.39 | -0.79 | ok | +0.90 | -2.39 | -0.79 | +0.00 | -6.20 |  |
| 092935 | code | 3 | success | +2.8 | ok | +0.90 | -2.38 | -0.79 | ok | +0.90 | -2.38 | -0.79 | +0.00 | -5.99 |  |
| 093018 | code | 3 | success | +2.5 | ok | +0.90 | -2.40 | -0.79 | ok | +0.90 | -2.40 | -0.79 | +0.00 | -6.03 |  |
| 093131 | code | 3 | success | +0.8 | ok | +0.90 | -2.36 | -0.79 | ok | +0.90 | -2.36 | -0.79 | +0.00 | -5.97 |  |
| 093251 | code | 3 | success | -0.5 | ok | +0.90 | -2.38 | -0.79 | ok | +0.90 | -2.38 | -0.79 | +0.00 | -6.07 |  |
| 093506 | code | 2 | success | +3.1 | conflict | +1.46 | -5.89 | -3.44 | ok | +0.91 | -6.45 | -3.99 | -0.55 | -11.63 |  |
| 093547 | code | 4 | success | +3.2 | conflict | +1.70 | -5.89 | -5.27 | ok | +0.94 | -6.66 | -6.03 | -0.76 | -11.57 |  |
| 093749 | code | 5 | success | -0.1 | ok | +0.90 | -2.43 | -2.70 | ok | +0.90 | -2.43 | -2.70 | +0.00 | -9.95 |  |
| 093932 | code | 2 | success | +4.5 | conflict | +1.20 | -5.90 | -3.65 | ok | +0.92 | -6.18 | -3.93 | -0.28 | -6.93 |  |
| 094011 | code | 4 | success | +2.6 | conflict | +2.25 | -5.86 | -4.84 | ok | +0.96 | -7.21 | -6.15 | -1.31 | -11.92 |  |
| 094157 | code | 5 | success | -4.8 | ok | +0.90 | -2.79 | -3.04 | ok | +0.90 | -2.79 | -3.04 | +0.00 | -5.22 |  |
| 094318 | code | 2 | success | +3.3 | conflict | +1.38 | -5.90 | -3.49 | ok | +0.92 | -6.37 | -3.96 | -0.47 | -11.88 |  |
| 094418 | code | 4 | success | +3.0 | conflict | +1.90 | -5.87 | -5.11 | ok | +0.95 | -6.86 | -6.07 | -0.96 | -11.77 |  |
| 094609 | code | 5 | success | -2.2 | ok | +0.90 | -2.43 | -2.76 | ok | +0.90 | -2.43 | -2.76 | +0.00 | -9.95 |  |
| 094707 | code | 2 | success | +1.0 | conflict | +1.77 | -5.89 | -3.20 | ok | +0.91 | -6.76 | -4.06 | -0.86 | -11.83 |  |
| 094744 | code | 4 | success | +2.3 | conflict | +2.05 | -5.87 | -5.00 | ok | +0.95 | -7.01 | -6.11 | -1.11 | -11.74 |  |
| 095034 | code | 5 | success | -4.6 | ok | +0.91 | -2.63 | -2.99 | ok | +0.91 | -2.63 | -2.99 | +0.00 | -4.86 |  |
| 095203 | code | 2 | success | +1.7 | conflict | +1.63 | -5.88 | -3.31 | ok | +0.91 | -6.62 | -4.03 | -0.72 | -7.20 |  |
| 095242 | code | 4 | success | +6.7 | ok | +0.94 | -5.60 | -5.75 | ok | +0.94 | -5.60 | -5.75 | +0.00 | -10.81 |  |
| 100116 | code | 5 | success | +1.6 | ok | +0.90 | -2.42 | -2.49 | ok | +0.90 | -2.42 | -2.49 | +0.00 | -9.87 |  |
| 100155 | code | 2 | success | +2.9 | conflict | +1.32 | -5.90 | -3.55 | ok | +0.91 | -6.31 | -3.96 | -0.41 | -11.54 |  |
| 100355 | code | 4 | success | +1.9 | conflict | +2.15 | -5.88 | -4.92 | ok | +0.95 | -7.11 | -6.13 | -1.21 | -11.89 |  |
| 100702 | code | 5 | success | +2.1 | ok | +0.90 | -2.36 | -2.51 | ok | +0.90 | -2.36 | -2.51 | +0.00 | -9.57 |  |
| 101100 | code | 2 | success | +3.9 | conflict | +1.17 | -5.90 | -3.67 | ok | +0.92 | -6.15 | -3.92 | -0.25 | -11.43 |  |
| 101251 | code | 3 | success | +3.6 | ok | +0.90 | -2.36 | -0.79 | ok | +0.90 | -2.36 | -0.79 | +0.00 | -5.79 |  |
| 101340 | code | 4 | success | +1.4 | conflict | +1.67 | -5.89 | -5.29 | ok | +0.94 | -6.63 | -6.02 | -0.73 | -11.60 |  |
| 101611 | code | 5 | success | -4.5 | ok | +0.90 | -2.45 | -2.88 | ok | +0.90 | -2.45 | -2.88 | +0.00 | -9.97 |  |
| 101648 | code | 2 | success | +2.9 | conflict | +1.21 | -5.90 | -3.64 | ok | +0.92 | -6.19 | -3.93 | -0.29 | -6.92 |  |
| 101808 | code | 3 | success | +3.0 | ok | +0.90 | -2.38 | -0.79 | ok | +0.90 | -2.38 | -0.79 | +0.00 | -5.88 |  |
| 101843 | code | 4 | success | +4.4 | ok | +0.94 | -6.00 | -5.87 | ok | +0.94 | -6.00 | -5.87 | +0.00 | -11.18 |  |
| 102015 | code | 5 | success | +1.7 | ok | +0.90 | -2.39 | -2.41 | ok | +0.90 | -2.39 | -2.41 | +0.00 | -4.79 |  |
| 102051 | code | 2 | success | +4.9 | ok | +0.92 | -5.81 | -3.84 | ok | +0.92 | -5.81 | -3.84 | +0.00 | -11.23 |  |
| 102138 | code | 3 | success | +1.2 | ok | +0.90 | -2.34 | -0.79 | ok | +0.90 | -2.34 | -0.79 | +0.00 | -5.85 |  |
| 102214 | code | 4 | success | +2.8 | conflict | +1.42 | -5.89 | -5.48 | ok | +0.94 | -6.38 | -5.96 | -0.48 | -11.44 |  |
| 102539 | code | 5 | success | -7.5 | ok | +0.90 | -3.09 | -3.14 | ok | +0.90 | -3.09 | -3.14 | +0.00 | -9.44 |  |
| 102806 | code | 2 | success | -3.2 | conflict | +2.60 | -5.88 | -2.53 | ok | +0.92 | -7.59 | -4.22 | -1.69 | -8.38 |  |
| 102845 | code | 3 | success | +1.4 | ok | +0.90 | -2.42 | -0.79 | ok | +0.90 | -2.42 | -0.79 | +0.00 | -6.15 |  |
| 102919 | code | 4 | success | +2.5 | conflict | +2.58 | -5.86 | -4.58 | ok | +0.95 | -7.55 | -6.23 | -1.65 | -12.20 |  |
| 102958 | code | 5 | success | +0.5 | ok | +0.90 | -2.39 | -2.71 | ok | +0.90 | -2.39 | -2.71 | +0.00 | -9.61 |  |
| 103106 | code | 2 | success | +3.4 | conflict | +1.23 | -5.90 | -3.61 | ok | +0.91 | -6.22 | -3.93 | -0.32 | -11.76 |  |
| 103144 | code | 3 | success | +5.7 | ok | +0.90 | -2.46 | -0.79 | ok | +0.90 | -2.46 | -0.79 | +0.00 | -6.01 |  |
| 103217 | code | 4 | success | +1.9 | conflict | +1.85 | -5.89 | -5.14 | ok | +0.95 | -6.81 | -6.05 | -0.91 | -11.83 |  |
| 103331 | code | 5 | success | +2.0 | ok | +0.90 | -2.41 | -2.52 | ok | +0.90 | -2.41 | -2.52 | +0.00 | -9.90 |  |
| 103405 | code | 2 | success | +2.8 | conflict | +1.28 | -5.90 | -3.59 | ok | +0.91 | -6.27 | -3.96 | -0.37 | -9.70 |  |
| 103445 | code | 3 | success | +2.4 | ok | +0.90 | -2.34 | -0.79 | ok | +0.90 | -2.34 | -0.79 | +0.00 | -5.85 |  |
| 103518 | code | 4 | success | +2.6 | conflict | +2.03 | -5.88 | -5.02 | ok | +0.95 | -6.99 | -6.11 | -1.09 | -11.70 |  |
| 103612 | code | 5 | success | -5.0 | ok | +0.90 | -2.64 | -3.00 | ok | +0.90 | -2.64 | -3.00 | +0.00 | -5.05 |  |
| 103818 | code | 2 | success | +17.0 | ok | +0.91 | -3.83 | -3.29 | ok | +0.91 | -3.83 | -3.29 | +0.00 | -6.66 |  |
| 103851 | code | 3 | success | +11.7 | ok | +0.90 | -2.43 | -0.79 | ok | +0.90 | -2.43 | -0.79 | +0.00 | -5.82 |  |
| 103926 | code | 4 | success | +4.4 | conflict | +1.46 | -5.88 | -5.45 | ok | +0.94 | -6.42 | -5.97 | -0.52 | -11.45 |  |
| 104502 | code | 5 | success | +1.6 | ok | +0.90 | -2.37 | -2.49 | ok | +0.90 | -2.37 | -2.49 | +0.00 | -9.56 |  |
| 104539 | code | 2 | success | -2.7 | conflict | +4.93 | -2.67 | +0.00 | ok | +0.92 | -12.85 | -4.03 | -4.03 | -15.81 | 止まる: push_window |
| 104646 | code | 3 | success | +7.6 | ok | +0.90 | -2.35 | -0.79 | ok | +0.90 | -2.35 | -0.79 | +0.00 | -5.82 |  |
| 104832 | code | 4 | success | +11.5 | ok | +0.91 | -2.75 | -4.95 | ok | +0.91 | -2.75 | -4.95 | +0.00 | -8.88 |  |
| 105045 | code | 5 | success | +0.3 | ok | +0.91 | -2.44 | -2.84 | ok | +0.91 | -2.44 | -2.84 | +0.00 | -9.96 |  |
| 142543 | code | 5 | success | -28.5 | conflict | +5.91 | -2.93 | +0.00 | too_deep | +0.93 | -14.96 | -5.01 | -5.01 | -15.08 | 止まる: push_limit, push_window, status |
| 142751 | code | 4 | success | -31.5 | ok | +0.90 | -3.76 | -1.41 | ok | +0.90 | -3.76 | -1.41 | +0.00 | -7.11 |  |
| 143148 | code | 5 | success | -30.9 | conflict | +5.26 | -3.22 | +0.00 | ok | +0.91 | -13.78 | -4.36 | -4.36 | -16.51 | 止まる: push_window |
| 143227 | code | 4 | success | +21.8 | ok | +0.61 | -1.97 | -3.08 | ok | +0.61 | -1.97 | -3.08 | +0.00 | -7.34 |  |
| 181516 | so101h | 3 | success | +1.9 | ok | +0.90 | -2.39 | -0.79 | ok | +0.90 | -2.39 | -0.79 | +0.00 | -6.01 |  |
| 181745 | so101h | 2 | success | -1.8 | deep_at_zero | +5.04 | -9.41 | +0.00 | ok | +0.92 | -13.63 | -4.14 | -4.14 | -14.27 | 止まる: push_window |
| 181856 | so101h | 4 | success | +0.1 | conflict | +3.00 | -5.83 | -4.25 | ok | +0.97 | -7.96 | -6.31 | -2.06 | -12.41 |  |
| 182001 | so101h | 5 | success | -3.8 | deep_at_zero | +3.81 | -6.20 | +0.00 | ok | +0.91 | -9.13 | -2.91 | -2.91 | -11.68 |  |
| 182109 | so101h | 2 | success | +2.0 | deep_at_zero | +4.93 | -8.96 | +0.00 | ok | +0.92 | -13.05 | -4.03 | -4.03 | -13.96 |  |
| 182215 | so101h | 3 | success | -3.7 | ok | +0.90 | -2.36 | -0.79 | ok | +0.90 | -2.36 | -0.79 | +0.00 | -6.08 |  |
| 182304 | so101h | 4 | success | +1.3 | conflict | +2.52 | -5.86 | -4.63 | ok | +0.95 | -7.48 | -6.21 | -1.58 | -12.13 |  |
| 182352 | so101h | 5 | success | -2.4 | ok | +0.90 | -2.39 | -2.85 | ok | +0.90 | -2.39 | -2.85 | +0.00 | -9.66 |  |
| 182430 | so101h | 2 | success | -5.3 | deep_at_zero | +5.18 | -9.92 | +0.00 | too_deep | +0.91 | -14.28 | -4.28 | -4.28 | -14.79 | 止まる: push_limit, push_window, status |
| 182515 | so101h | 3 | success | +2.0 | ok | +0.90 | -2.39 | -0.79 | ok | +0.90 | -2.39 | -0.79 | +0.00 | -6.01 |  |
| 182554 | so101h | 4 | success | +1.1 | conflict | +2.67 | -5.85 | -4.52 | ok | +0.95 | -7.63 | -6.25 | -1.73 | -12.15 |  |
| 182653 | so101h | 5 | success | +0.4 | ok | +0.90 | -2.35 | -2.62 | ok | +0.90 | -2.35 | -2.62 | +0.00 | -4.77 |  |
| 182738 | so101h | 2 | success | -1.4 | deep_at_zero | +5.03 | -9.38 | +0.00 | ok | +0.92 | -13.59 | -4.13 | -4.13 | -14.22 | 止まる: push_window |
| 182956 | so101h | 3 | success | -1.2 | ok | +0.90 | -2.38 | -0.79 | ok | +0.90 | -2.38 | -0.79 | +0.00 | -6.06 |  |
| 183036 | so101h | 4 | success | +1.7 | conflict | +2.42 | -5.86 | -4.71 | ok | +0.95 | -7.38 | -6.19 | -1.48 | -12.08 |  |
| 183119 | so101h | 5 | success | -4.4 | ok | +0.91 | -2.66 | -2.99 | ok | +0.91 | -2.66 | -2.99 | +0.00 | -5.13 |  |
| 183159 | so101h | 2 | success | -2.4 | conflict | +2.38 | -5.88 | -2.71 | ok | +0.91 | -7.37 | -4.18 | -1.47 | -12.39 |  |
| 183242 | so101h | 3 | success | +1.9 | ok | +0.90 | -2.40 | -0.79 | ok | +0.90 | -2.40 | -0.79 | +0.00 | -6.02 |  |
| 183321 | so101h | 4 | success | +1.1 | conflict | +2.64 | -5.84 | -4.53 | ok | +0.95 | -7.61 | -6.24 | -1.71 | -12.21 |  |
| 183405 | so101h | 5 | success | +0.4 | ok | +0.90 | -2.38 | -2.66 | ok | +0.90 | -2.38 | -2.66 | +0.00 | -9.60 |  |
| 183447 | so101h | 2 | success | -2.9 | deep_at_zero | +5.09 | -9.54 | +0.00 | ok | +0.91 | -13.81 | -4.19 | -4.19 | -14.47 | 止まる: push_window |
| 183527 | so101h | 3 | success | +2.8 | ok | +0.90 | -2.40 | -0.79 | ok | +0.90 | -2.40 | -0.79 | +0.00 | -6.01 |  |
| 183606 | so101h | 4 | success | -1.2 | conflict | +3.29 | -5.83 | -4.02 | ok | +0.96 | -8.25 | -6.37 | -2.35 | -12.66 |  |
| 183647 | so101h | 5 | success | +1.8 | ok | +0.90 | -2.37 | -2.52 | ok | +0.90 | -2.37 | -2.52 | +0.00 | -4.58 |  |
| 183826 | so101h | 2 | success | +0.3 | conflict | +1.88 | -5.89 | -3.09 | ok | +0.92 | -6.87 | -4.06 | -0.97 | -10.98 |  |
| 183928 | so101h | 3 | success | +0.3 | ok | +0.90 | -2.29 | -0.79 | ok | +0.90 | -2.29 | -0.79 | +0.00 | -5.78 |  |
| 184007 | so101h | 4 | success | +2.2 | conflict | +1.12 | -5.90 | -5.71 | ok | +0.93 | -6.09 | -5.90 | -0.19 | -11.21 |  |
| 184046 | so101h | 5 | success | +0.2 | ok | +0.91 | -2.38 | -2.73 | ok | +0.91 | -2.38 | -2.73 | +0.00 | -9.61 |  |
| 184123 | so101h | 2 | failure | -26.5 | deep_at_zero | +5.43 | -11.70 | +0.00 | too_deep | +0.89 | -16.29 | -4.53 | -4.53 | -17.58 | 止まる: push_limit, push_window, status |
| 184211 | so101h | 3 | success | +17.1 | ok | +0.90 | -2.42 | -0.79 | ok | +0.90 | -2.42 | -0.79 | +0.00 | -5.72 |  |
| 184346 | so101h | 4 | success | +24.1 | ok | +0.42 | -1.97 | -2.74 | ok | +0.42 | -1.97 | -2.74 | +0.00 | -6.90 |  |
| 184703 | so101h | 5 | success | +0.9 | deep_at_zero | +3.50 | -6.35 | +0.00 | ok | +0.91 | -8.93 | -2.60 | -2.60 | -11.35 |  |
| 184804 | so101h | 2 | failure | -25.1 | deep_at_zero | +5.43 | -11.73 | +0.00 | too_deep | +0.89 | -16.32 | -4.53 | -4.53 | -17.68 | 止まる: push_limit, push_window, status |
| 184939 | so101h | 3 | success | -14.2 | ok | +0.90 | -2.30 | -0.79 | ok | +0.90 | -2.30 | -0.79 | +0.00 | -6.16 |  |
| 185016 | so101h | 4 | success | -16.3 | ok | +0.90 | -3.12 | -1.18 | ok | +0.90 | -3.12 | -1.18 | +0.00 | -6.42 |  |
| 185212 | so101h | 5 | success | +3.7 | ok | +0.90 | -2.20 | -2.02 | ok | +0.90 | -2.20 | -2.02 | +0.00 | -9.27 |  |
| 185802 | so101h | 5 | success | -17.9 | ok | +0.92 | -5.24 | -3.79 | ok | +0.92 | -5.24 | -3.79 | +0.00 | -11.33 |  |
| 185845 | so101h | 5 | failure | +20.5 | 道が作れない | | | | | | | | | | |
```

### so101/check_407/analyze_407.py

```python
#!/usr/bin/env python3
"""依頼 407 の 1〜3: 今日 (2026-12-01) の場所2〜5 の実機の記録で, 閉じた所の 実際の爪と机 を出し, 指令・予想と並べる (読むだけ).

測り方 (依頼 379・400 と同じ):
  実際の関節 A[k] = state[k+1] (指令 k を送った次のコマで読んだ関節). 閉じた所 = 実際の爪の値が 20 を割った最初のコマ.
  爪と机 = arm_response_400.ArmResponse.clearance (clear_345 の場面. 関節のずれは足さない) の jaw_table.
  code_rule401: 道は rule401_plan.json (指令 path・予想 pred_path). 閉じた所は GRASP_OPEN − 1 〜 GRASP_CLOSED + 15 で探す.
  so101h (切り替え方式): コードの道の値は switch405_plan.json の builds[0] (π0.5 が下ろす前に作った rule_401 の道).
    閉じた所は 方策の区間で 送った爪が 20 を割った最初のコマのあと 実際の爪が 20 を割った所.
  どちらも 送った指令の並び (ptm.sent) を dir_s に通した予想 (送った予想) も出す (同じ閉じた所で 実際 − 送った予想).

  /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/bin/python so101/check_407/analyze_407.py [YYYYMMDD]
  → check_407/analyze_407.json・analyze_407.md
"""
import csv
import json
import os
import sys
from pathlib import Path

import numpy as np

HERE = Path(__file__).resolve().parent
SO101 = HERE.parent
for p in (SO101, SO101 / "check_401", SO101 / "ideal_var", SO101 / "check_392", SO101 / "check_399", SO101 / "sim" / "look_400"):
    if str(p) not in sys.path:
        sys.path.insert(0, str(p))

LOG = Path("/Volumes/KIOXIA/r2r2r-data/lab/so101_Log12")
DAY = "so101_" + (sys.argv[1] if len(sys.argv) > 1 else "20261201") + "_"   # 引数で日を変えられる (例 20261202)
JOINTS = ("shoulder_pan", "shoulder_lift", "elbow_flex", "wrist_flex", "wrist_roll")


def trials():
    import run_so101_policy as R
    out = []
    with open(LOG / "so101_trials.csv", newline="") as f:
        for r in csv.DictReader(f, fieldnames=R.TRIAL_COLUMNS, restkey="_more"):
            if not r["trial"].startswith(DAY) or r["execute"] != "1" or r["result"] not in ("success", "failure"):
                continue
            if r["place"] not in ("2", "3", "4", "5"):
                continue
            out.append(r)
    return out


def close_actual(A, a, b):
    for k in range(max(a, 0), min(b, len(A))):
        if A[k, 5] < 20:
            return k
    return None


def jt(W, Q, k):
    return round(float(W.ar.clearance(Q, [1000, 1000], 0.0, frames=[k])["jaw_table"][0]), 2)


def one(W, r):
    import pandas as pd
    d = Path(r["record_dir"])
    df = pd.read_parquet(d / "data/chunk-000/file-000.parquet")
    sent = np.stack(df["ptm.sent"].to_numpy()).astype(float)
    state = np.stack(df["observation.state"].to_numpy()).astype(float)
    A = state[1:]                       # A[k] = 指令 k への応え
    sent = sent[:len(A)]
    code = r["model"] == "code_rule401"
    if code:
        p = json.loads((d / "rule401_plan.json").read_text())
        b = p
        kf = p["keyframes"]
        kc = close_actual(A, kf["GRASP_OPEN"] - 1, kf["GRASP_CLOSED"] + 16)
    else:
        p = json.loads((d / "switch405_plan.json").read_text())
        b = p["first"]
        kf = b["keyframes"]
        seg = {s["name"]: s["start_frame"] for s in p["segments"]}
        k0 = seg.get("policy", 0)
        ks = next((k for k in range(max(k0, 1), len(sent)) if sent[k - 1, 5] >= 20 > sent[k, 5]), None)
        kc = None if ks is None else close_actual(A, ks, ks + 20)
    row = {"trial": r["trial"], "model": "code" if code else "so101h", "place": int(r["place"]), "result": r["result"],
           "yaw": float(b["block_yaw_deg"]), "pixel": b["block_pixel"], "status": b["status"], "dz_mm": b["dz_mm"],
           "plan_cmd": b["cmd"]["grasp_jaw_table"], "plan_pred": b["pred"]["grasp_jaw_table"],
           "plan_pred_fixed_min": b["pred"]["fixed_min"], "face_deg": b.get("face_deg", 0.0), "tilt_s_deg": b.get("tilt_s_deg"),
           "close_frame": kc}
    if not code:
        t = json.loads((d / "trial.json").read_text())
        row["sw_judges"] = t.get("sw_judges")
        row["sw_grip_reads"] = t.get("sw_grip_reads")
    if kc is None:
        row["actual"] = None
        return row
    Qp = W.ar.predict(sent, y0=state[0])     # 送った並びの予想 (out[k] = 指令 k への応え)
    row["actual"] = jt(W, A, kc)
    row["sent_cmd"] = jt(W, sent, kc)          # その時に送っていた指令の姿勢 (沈みなし)
    row["sent_pred"] = jt(W, Qp, kc)
    row["joint_actual_minus_pred"] = np.round(A[kc, :5] - Qp[kc, :5], 2).tolist()
    row["joint_actual_minus_cmd"] = np.round(A[kc, :5] - sent[kc, :5], 2).tolist()
    row["joint_pred_minus_cmd"] = np.round(Qp[kc, :5] - sent[kc, :5], 2).tolist()
    row["roll_at_close"] = round(float(sent[kc, 4]), 1)
    row["grip_actual_at_close_plus5"] = round(float(A[min(kc + 5, len(A) - 1), 5]), 1)
    if code:
        # 道どおりに流した回は 予想の道 (rule401_plan の pred_path) と 指令の道 (path) で 同じコマも比べる
        pp = np.asarray(p["pred_path"], float)
        pa = np.asarray(p["path"], float)
        row["same_path"] = bool(len(pa) >= len(sent) and np.abs(pa[:len(sent)] - sent).max() < 0.05)
        row["plan_pred_at_kc"] = jt(W, pp, kc)
        row["plan_cmd_at_kc"] = jt(W, pa, kc)
        row["min_actual_close_lift"] = round(float(W.ar.clearance(A, [1000, 1000], 0.0,
                                                   frames=list(range(kf["GRASP_OPEN"], kf["GRASP_CLOSED"] + 11)))["jaw_table"].min()), 2)
    return row


def main():
    import run_rule401 as RR
    os.environ.setdefault("SO101_VAR_ROLL_RANGE", "-67,58")
    W = RR.world()
    rows = []
    for r in trials():
        try:
            row = one(W, r)
        except FileNotFoundError as x:
            row = {"trial": r["trial"], "error": str(x)}
        rows.append(row)
        print(json.dumps({k: row.get(k) for k in ("trial", "model", "place", "result", "yaw", "status", "plan_cmd", "plan_pred",
                                                    "actual", "sent_cmd", "sent_pred")}, ensure_ascii=False), flush=True)
    (HERE / "analyze_407.json").write_text(json.dumps(rows, ensure_ascii=False, indent=1))
    print("[WROTE]", HERE / "analyze_407.json", len(rows))


if __name__ == "__main__":
    main()
```

### so101/check_407/apply_407.py

```python
#!/usr/bin/env python3
"""依頼 407 の 5: 今日 (2026-12-01) の場所2〜5 の実機の読み (記録の block_pixel・block_yaw_deg・面・爪の傾き) すべてに
今の rule_401 (R401_CMD_FIRST なし) と 依頼 407 の A (R401_CMD_FIRST=1) を当てて, つかむ所の 指令の爪と机・予想・下げ量・ガードを並べる.
アームは動かさない (run_rule401.build を呼ぶだけ). 押し付けの上限は 今日の実機の値 (既定 −14. 引数で変えられる).

  /opt/homebrew/Caskroom/miniforge/base/envs/lerobot/bin/python so101/check_407/apply_407.py [--push-limit -14] [--push-window -14]
  → check_407/apply_407.json (analyze_407.json の行の順)
"""
import argparse
import json
import os
import sys
from pathlib import Path

import numpy as np

HERE = Path(__file__).resolve().parent
SO101 = HERE.parent
for p in (SO101, SO101 / "check_401", SO101 / "ideal_var", SO101 / "check_392", SO101 / "check_399", SO101 / "sim" / "look_400"):
    if str(p) not in sys.path:
        sys.path.insert(0, str(p))


def one(RR, W, plan, lo, hi, row, cmd_first):
    os.environ["R401_CMD_FIRST"] = "1" if cmd_first else "0"
    e = RR.episode_of(plan, row["place"])
    face = row.get("face_deg")
    tilt = row.get("tilt_s_deg")
    try:
        b = RR.build(W, e, row["pixel"], row["yaw"], lo, hi, plan.get("jaw_table_min_mm"),
                     face=face if tilt is not None else None, tilt_s=tilt)
    except RR.Refused as x:
        return {"refused": str(x)}
    v = b["v"]
    bad = RR.check_guards(b, ("conflict", "deep_at_zero"))
    return {"status": v["status"], "dz_mm": v["dz_mm"], "cmd": v["cmd"]["grasp_jaw_table"], "pred": v["pred"]["grasp_jaw_table"],
            "pred_fixed_min": v["pred"]["fixed_min"], "pred_window_min": min(v["pred"]["close_jaw_table_min"],
                                                                              v["pred"]["lift_start_jaw_table_min"]),
            "guards_bad_except_status": bad, "above_block": np.round(b["path"][v["frames"]["ABOVE_BLOCK"]], 3).tolist()}


def main():
    ap = argparse.ArgumentParser()
    ap.add_argument("--push-limit", type=float, default=-14.0)
    ap.add_argument("--push-window", type=float, default=-14.0)
    a = ap.parse_args()
    os.environ["R401_PUSH_LIMIT_MM"] = str(a.push_limit)
    os.environ["R401_PUSH_WINDOW_MM"] = str(a.push_window)
    import run_rule401 as RR
    rows = json.loads((HERE / "analyze_407.json").read_text())
    plan, lo, hi = RR.load_plan(RR.PLAN)
    W = RR.world()
    out = []
    for r in rows:
        if r.get("actual") is None and "error" in r:
            continue
        cur = one(RR, W, plan, lo, hi, r, False)
        new = one(RR, W, plan, lo, hi, r, True)
        d = {k: r.get(k) for k in ("trial", "model", "place", "result", "yaw", "status", "dz_mm", "plan_cmd", "plan_pred", "actual")}
        d.update(now=cur, cmd_first=new, push_limit=a.push_limit, push_window=a.push_window)
        out.append(d)
        f = lambda x, k: "-" if "refused" in x else x[k]  # noqa: E731
        print(f"{r['trial'][-6:]} {r['model']:6s} p{r['place']} yaw{r['yaw']:6.1f} 記録 {r['status'][:6]:6s} c{r['plan_cmd']:5.1f} "
              f"p{r['plan_pred']:6.1f} | 今 {f(cur, 'status')} c{f(cur, 'cmd')} p{f(cur, 'pred')} dz{f(cur, 'dz_mm')} | "
              f"A {f(new, 'status')} c{f(new, 'cmd')} p{f(new, 'pred')} dz{f(new, 'dz_mm')} w{f(new, 'pred_window_min')} "
              f"止め {f(new, 'guards_bad_except_status') or new.get('refused', '')}", flush=True)
    os.environ.pop("R401_CMD_FIRST", None)
    (HERE / "apply_407.json").write_text(json.dumps(out, ensure_ascii=False, indent=1))
    print("[WROTE]", HERE / "apply_407.json", len(out))


if __name__ == "__main__":
    main()
```

### so101/check_407/summarize_407.py

```python
#!/usr/bin/env python3
"""依頼 407: analyze_407.json (1〜3)・apply_407.json (5) から 報告の表を作る (読むだけ). → check_407/tables_407.md
  python3 so101/check_407/summarize_407.py
"""
import json
from pathlib import Path

import numpy as np

HERE = Path(__file__).resolve().parent


def f(x, n=1):
    return "—" if x is None else f"{x:+.{n}f}"


def stat(x):
    x = np.asarray(x, float)
    if len(x) == 0:
        return "—"
    return f"{np.median(x):+.1f} ({x.min():+.1f}〜{x.max():+.1f}, {len(x)})"


def main():
    rows = [r for r in json.loads((HERE / "analyze_407.json").read_text()) if r.get("actual") is not None]
    ap = {r["trial"]: r for r in json.loads((HERE / "apply_407.json").read_text())}
    L = ["# 依頼 407 の表 (summarize_407.py が作った)", ""]
    L += ["## 1. 場所2: 閉じた所の 爪と机 (mm. 負は机より下 = 押し付け)", "",
          "記録の値 = その回の rule_401 の道 (コードの道) の つかむ所. 閉じたときの値 = 実際の爪が 20 を割ったコマで, "
          "送っていた指令 (送った指令)・送った指令の並びを dir_s に通した予想 (送った予想)・実際 (observation.state)",
          "",
          "| 試行 | 方式 | 結果 | 向き° | status | 記録 指令 | 記録 予想 | 送った指令 | 送った予想 | 実際 | 実際−送った予想 |",
          "|---|---|---|---|---|---|---|---|---|---|---|"]
    for r in sorted([r for r in rows if r["place"] == 2], key=lambda r: (r["model"], r["yaw"])):
        L.append(f"| {r['trial'][-6:]} | {r['model']} | {r['result']} | {r['yaw']:+.1f} | {r['status']} | {f(r['plan_cmd'])} | "
                 f"{f(r['plan_pred'])} | {f(r['sent_cmd'])} | {f(r['sent_pred'])} | **{f(r['actual'])}** | {f(r['actual'] - r['sent_pred'])} |")
    L += ["", "## 2. 場所ごと・向きごと: 実際 − 予想 (mm. 中央値 (最小〜最大, 回数))", "",
          "予想 = 送った指令の並びを dir_s に通したもの (同じコマ). 正 = 実際は予想より上 (沈みを多く見積もった)",
          "", "| 場所 | 方式 | 向き | 実際 | 実際 − 予想 | 実際 − 送った指令 |", "|---|---|---|---|---|---|"]
    for p in (2, 3, 4, 5):
        for m in ("code", "so101h"):
            for name, cond in (("±10° の内", lambda y: abs(y) < 10), ("±10° の外", lambda y: abs(y) >= 10)):
                s = [r for r in rows if r["place"] == p and r["model"] == m and cond(r["yaw"])]
                if not s:
                    continue
                L.append(f"| {p} | {m} | {name} | {stat([r['actual'] for r in s])} | "
                         f"{stat([r['actual'] - r['sent_pred'] for r in s])} | {stat([r['actual'] - r['sent_cmd'] for r in s])} |")
    L += ["", "## 3. 関節ごと: 実際 − 予想 (°. 閉じたコマ. 中央値)", "",
          "| 場所 | 方式 | 向き | 回数 | 肩の回転 | 肩の上下 | 肘 | 手首の曲げ | 手首の回り |", "|---|---|---|---|---|---|---|---|---|"]
    for p in (2, 3, 4, 5):
        for m in ("code", "so101h"):
            for name, cond in (("±10° の内", lambda y: abs(y) < 10), ("±10° の外", lambda y: abs(y) >= 10)):
                s = [r for r in rows if r["place"] == p and r["model"] == m and cond(r["yaw"])]
                if not s:
                    continue
                e = np.median(np.array([r["joint_actual_minus_pred"] for r in s]), 0)
                L.append(f"| {p} | {m} | {name} | {len(s)} | " + " | ".join(f"{x:+.1f}" for x in e) + " |")
    L += ["", "## 5. 今の rule_401 と A (R401_CMD_FIRST=1) を 今日の読みに当てた (押し付けの上限 −14・閉じる間〜持ち上げ −14)", "",
          "| 試行 | 方式 | 場所 | 結果 | 向き° | 今 status | 今 指令 | 今 予想 | 今 下げ | A status | A 指令 | A 予想 | A 下げ | 下げの差 | A 閉じる間〜持ち上げ | A で止まる |",
          "|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|"]
    for t, r in ap.items():
        n, a = r["now"], r["cmd_first"]
        if "refused" in n:
            L.append(f"| {t[-6:]} | {r['model']} | {r['place']} | {r['result']} | {r['yaw']:+.1f} | 道が作れない | | | | | | | | | | |")
            continue
        why = a["guards_bad_except_status"] or ""
        stop = "止まる: " + ", ".join(x.split(":")[0] for x in why.split(" / ")) if why else ""
        L.append(f"| {t[-6:]} | {r['model']} | {r['place']} | {r['result']} | {r['yaw']:+.1f} | {n['status']} | {f(n['cmd'], 2)} | "
                 f"{f(n['pred'], 2)} | {f(n['dz_mm'], 2)} | {a['status']} | {f(a['cmd'], 2)} | {f(a['pred'], 2)} | {f(a['dz_mm'], 2)} | "
                 f"{f(a['dz_mm'] - n['dz_mm'], 2)} | {f(a['pred_window_min'], 2)} | {stop} |")
    (HERE / "tables_407.md").write_text("\n".join(L) + "\n")
    print("\n".join(L[:60]))
    print("[WROTE]", HERE / "tables_407.md")


if __name__ == "__main__":
    main()
```

### 依頼407 の commit c7c4611 の中身（変えたファイルの一覧と、check_40x の外のコードの差分。check_40x のファイルは上に全文）

```text
$ git show --stat c7c4611 && git show --format= c7c4611 -- '*.py' '*.sh' ':(exclude)so101/check_40*/*'
commit c7c46110054ba620a89cffcfda9d5b1ed3f39057
Author: Eiichi Shimazu <studio@adaptdesign.jp>
Date:   Tue Dec 1 19:12:06 2026 +0900

    依頼 407: 場所2 で回して置いた空振り 2 回を記録で確かめ, rule_401 の下げ方 A (R401_CMD_FIRST=1) を足した
    
    空振りは so101h の回で π0.5 が閉じたときの指令が爪と机 +18.8/+21.1 mm (まっすぐの成功は +2〜11). 実際 +4.9/+9.3 で
    dir_s の予想より 3.5〜5.6 mm 深い (沈みの見積もりすぎではない). 向きによる予想の外れの片寄りは記録に出ないので B は入れない.
    A: 指令 +1 mm 以下を押し付けの上限より先にする (上限より深ければ上げずに too_deep → 今のガードが止める). 付けなければ今と同じ
    (今日の 97 回の読みで記録と一致). 場所2 −25° は 指令 +0.89・予想 −16.3 で 上限 −14 では止まる. テスト 39 本・18 本 OK.
    アームは動かしていない. 判定 止めた
    
    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

 so101/check_401/run_rule401.py      |   86 +-
 so101/check_401/session_401.sh      |    2 +
 so101/check_401/test_run_rule401.py |   49 +
 so101/check_405/session_405.sh      |    3 +-
 so101/check_405/switch_405.py       |    3 +
 so101/check_407/REPORT.md           |  130 +
 so101/check_407/analyze_407.json    | 4728 +++++++++++++++++++++++++++++++++++
 so101/check_407/analyze_407.py      |  131 +
 so101/check_407/apply_407.json      | 4678 ++++++++++++++++++++++++++++++++++
 so101/check_407/apply_407.py        |   73 +
 so101/check_407/summarize_407.py    |   77 +
 so101/check_407/tables_407.md       |  178 ++
 12 files changed, 10134 insertions(+), 4 deletions(-)
```


## 依頼406 ― 回した置き方とずらした置き方のお手本を、コードで実機に録る準備（実行中）

最初はずらした置き方だけの下書きだった。空振りの原因が分かったあと、回した置き方を足して出し直した。下は出した版。

### 依頼406 の依頼文（19:16 に出した版）

```markdown
---
作業フォルダ: /Users/shimazueiichi/r2r2r-scripts
上限時間: 150
---
# 依頼406：SO-101 で、ブロックを回して置いた回と、ブロックの上からわざとずらした所から寄せる回のお手本を、コード（rule_401）で実機に録れるようにする（実装・アームなしの確かめ・codex のレビュー 1 回まで。アームは動かさない）

## なぜ
切り替え方式（依頼405）は、コードがブロックの上（つかむ所の真上 50 mm）まで運び、π0.5（so101h）が下りて閉じる。so101h のお手本は 2026-12-01 午前のコードの成功 56 回で、ブロックはほぼまっすぐ置いていた（56 本のうち 49 本が向き ±5° 以内、全体で −7.5〜+17°）。

2026-12-01 夜の実機で分かったこと：
- まっすぐ置いた回は 35 回すべて挟めた。回して置いた回は、場所2 の −26.5°・−25.1°、場所5 の +20.5°（2 回）で空振りした。どれも下りる途中、爪の先が机から +5〜+9 mm の高さで閉じていた（成功は −11〜+4 mm）
- 手首カメラの絵を黒くして渡すと、場所3 にまっすぐ置いても、ほとんど下りずにすぐ閉じた（2 回とも）。so101h は手首の絵を見て下りるか閉じるかを決めていて、見慣れない絵だと早めに閉じる
- 原因は、お手本に回した置き方の見え方がないこと。決まりの深さや関節の値ではない（依頼407 の測りでも、空振りの回は so101h が下ろしていた）

rule_401 のコードは、面の選び直し（依頼404、`--reselect-face`）で回した置き方もつかめる（夜の実機でコードだけ 60/60）。そこで 2026-12-01 19:16 にエイイチが決めた：**回した置き方と、ずらした所から寄せる動きを足したお手本をコードで録り、今の 56 本と合わせて so101i を学び直す。** この依頼は録る準備まで。

## 作るもの
1. **ずらした始めの道**（新しいファイル。`run_rule401.py`・`rule_401.py` の今の動きは変えない。使う所は import する）
   - 机のカメラでブロックを読む → 今までどおり rule_401 の道を作る（本当の道。面の選び直し `--reselect-face` は常に入れる）
   - **うその読み**（読んだ位置に机の上で dx・dy mm、向きに dyaw 度を足したもの）でも rule_401 のブロックの上の姿勢を作る。これを「ずらしたブロックの上」とする。コードの読みが外れたときに腕が着く所と同じ作り方にするため
   - 道の形：HOME → **ずらしたブロックの上**（今と同じ 57 コマ）→ **本当のブロックの上へ寄せる**（新しい区間。高さは変えず、横と手首の回りだけ動かす。コマ数は手先の速さがほかの区間と同じくらいになるように決める）→ 今までどおり下りる（71 コマ）→ 閉じる → 持ち上げ → 箱 → HOME
   - ずらしが 0 の回は、今の rule_401 の道そのまま（寄せる区間なし）
   - 下りる所から先は、本当の道と 1 コマも変えない
   - うその読みで道が作れない・ガードに当たるときは、その回のずらしを半分にして作り直す。それでもだめなら、ずらし 0 で流す（置いた向きのお手本は残す）。本当の道が作れないときは動かさずに止め、次の回へ（割り振りの番号は残す）
2. **割り振り**（種を決めた表。json）
   - 場所2・3・4・5 × 15 回 = 60 回。1 回ごとに「置く向き」と「ずらし」を決める
   - 置く向き：場所ごとに、面の選び直しを入れたコードで道が作れる範囲（依頼404 の表。シムで確かめ直す）の中で、−30〜+25° にまんべんなく。まっすぐ（±5° 以内）は場所ごとに 3 回まで。場所5 で +側が作れない範囲は、作れる範囲だけでよい（作れない向きを無理に入れない）
   - ずらし：60 回のうち 40 回はずらす（幅 8〜20 mm、方向は 360° にまんべんなく、dyaw は −15〜+15°）、20 回はずらし 0。置く向きとずらしが偏らないように組む
3. **録る案内**（`session_406.sh`。`session_405.sh` と同じ作り。コードだけで流し、π0.5 のサーバーは使わない）
   - 1 回の流れ：画面に「場所N の目印に 約 +20° 回して置いて Enter」と出す → 腕が自動で動く → 終わったら成功／失敗を打つ。途中で止めて打ち直すと、台帳で済んだ回の次から続く
   - 置いた向きは机のカメラで読んだ値を使う（割り振りの向きと違っても止めない。trial.json に両方を残す）
   - その回だけガードの値を変える口（R401_PUSH_LIMIT_MM・R401_PUSH_WINDOW_MM・R401_ALLOW_CONFLICT・R401_ALLOW_DEEP・R401_PIXEL_TOL_PX・R401_START_TOL_DEG・R401_ELEV_MAX_DEG）は run_rule401.py と同じ名前で効く。今日の夜と同じ値を案内の既定にする（−14・−14・conflict と deep_at_zero を許す・40 画素・25°）
   - 確認や停止の条件は、run_rule401.py にある分だけ。新しく足さない
4. **台帳・記録**：1 回 1 行を `lab/so101_Log12/so101_trials.csv` に足す（model = code_rule401_rot。既存の列は変えない）。`trial.json` に、割り振りの番号・割り振りの向き・読んだ向き・dx・dy・dyaw（実際に使った値。半分にしたらその値）・面の選び直しの結果・ずらしたブロックの上の姿勢・keyframes（ABOVE_SHIFTED・ABOVE_BLOCK・GRASP_OPEN・GRASP_CLOSED ほか）を残す。記録は今日と同じ LeRobot の形

## 確かめ（アームなし）
- 割り振りの 60 回を、目印の画素と割り振りの向きの読みで通す：道が作れた数、ずらしを半分にした数、ずらし 0 にした数、作れなかった数（場所ごと）
- ずらしたブロックの上と寄せる区間で、爪・腕とブロック・箱・机のすき間の最小（clear_345 と同じ測り方）。寄せる区間で、爪の先がブロックの上の面より 20 mm 以上高いままであること
- 寄せる区間の 1 コマの変化（関節・手先の速さ）と区間のコマ数
- ずらしたブロックの上で、手首カメラの絵にブロックが入っているか（MuJoCo の手首カメラで 60 回分を描き、入っている回数。入らないずらしは割り振りから外して別の値に替える）
- 60 回の渡す姿勢（ABOVE_BLOCK）と GRASP_CLOSED の関節の範囲を、so101h の学習データ（56 本）の範囲と並べる（特に手首の回り。so101i で推論の安全範囲がどこまで広がるかの見込み）
- 下りる所から先が、本当の道と 1 コマも変わらないこと
- 既存のテストが全部通ること。新しい分のテストを足す

## codex のレビュー
1 回だけ（読むだけ）。見てほしい点は 2 つ：寄せる区間で腕・爪がブロック・箱・机に当たらないか／下りる所から先が今日の道と変わっていないか。必須の指摘だけ直す。頼み直しはしない

## しないこと
アームを動かす、`run_rule401.py`・`session_401.sh`・`rule_401.py`・`rule_351.py`・`check_405/` のファイル・plan_401.json を変える、ガードの既定の値を変える・ガードを足す、データセットを作る・学習を始める（録ったあとに別の依頼で決める）、`git add .`・`git clean`

## 報告（`so101/check_406/REPORT.md`）
- いちばん大事なこと：60 回のうち流せる数（場所ごと・置く向きごと）、寄せる区間のコマ数と速さ、手首カメラにブロックが入る数、手首の回りの範囲が so101h からどれだけ広がるか
- 場所ごとの表、codex の指摘（必須／推奨／据え置き・直したもの）、テストの件数、commit（自分のファイルだけを個別に add）
- 実機で録る手順の案（打つコマンド 1 行・1 回分の流れ・エイイチがすること・60 回にかかる時間の見込み・どこで止まるか）
- 回して置いた回とずらした回を 1 回ずつ、シムで描いた短い動画（机側と手首の 2 つ）
- 最後の 1 行に「判定：合格／止めた（決めてほしいことあり）／失敗」
```
