<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SO-101 リアリティビュー（試作）| Pixels to Motors</title>
<meta name="description" content="SO-101 のロボットアームを π0.5（Physical Intelligence）で動かした実機の記録を、3Dで再生する試作。AI がこの先1秒でどこへ爪を動かすつもりか、答えが切り替わって動きがカクッとなった所、理想の動きとの違いを、ブロックの5か所ごとに見られます。">
<link rel="canonical" href="https://pixelstomotors.com/sim/so101-reality-view/">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&family=Noto+Sans+JP:wght@400;500;700&display=swap">
<style>
/* VOICE: サイトのシミュレーターと同じ、静かで道具らしい画面
   IDEA: テスラの走行画面のように、アームの先へ AI の答えが伸びる
   PICTURE: three.js の研究室の机。SO-101（URDF）・白い箱・赤いブロック
   COLOUR and TYPE: 白地・黒の面。青は今の答え、赤はカクッとなった所だけ。Noto Sans JP ＋ Inter
   LAYOUT: 左に机の3D、右に記録と再生のパネル（配送ロボットの版にそろえる） */
:root{color-scheme:light;--ink:#111;--sub:#555;--face:#f7f7f7;--blue:#1668e3;--red:#d93a3a}
*{box-sizing:border-box;min-width:0}
[hidden]{display:none!important}
body{margin:0;background:#fff;color:var(--ink);font:15px/1.6 Inter,'Noto Sans JP',sans-serif;overflow-x:clip}
button{font:inherit;color:inherit}
#play{display:flex;height:100vh;min-height:620px}
#stage{position:relative;flex:1;background:#eceef1;overflow:hidden}
#stage canvas{position:absolute;inset:0;width:100%;height:100%;touch-action:none;cursor:grab}
.card{position:absolute;z-index:2;background:#fff;border-radius:12px;padding:14px 18px}
#top{left:16px;top:16px;max-width:430px}
#top h1{margin:0;font-size:22px;font-weight:700;line-height:1.35;display:flex;align-items:center;flex-wrap:wrap;gap:4px 0}
.tag{font-size:11px;font-weight:400;background:#f0f0f0;border-radius:4px;padding:2px 6px;margin-left:8px}
#top .meta{margin:6px 0 0;font-size:13px;color:var(--sub)}
#top .meta b{color:var(--ink)}#top .meta .ng{color:var(--red);font-weight:700}
.seg{display:flex;gap:4px;background:#f0f0f0;border-radius:8px;padding:3px}
.seg button{border:0;border-radius:6px;background:transparent;padding:6px 10px;font-size:12px;cursor:pointer;white-space:nowrap}
.seg button.on{background:#111;color:#fff}
#views{right:16px;top:16px;padding:8px;display:flex;flex-direction:column;gap:6px;align-items:flex-end}
#views .hint{font-size:11px;color:var(--sub);padding:0 4px;text-align:right}
#legend{left:16px;bottom:16px;padding:12px 16px;display:flex;flex-direction:column;gap:6px;max-width:470px;font-size:13px;color:#111}
#legend>span{display:flex;align-items:center;gap:8px}#legend>span[hidden]{display:none}#legend i{flex:none}
#modes{align-self:flex-start;margin-bottom:2px}#modes button{font-size:13px;padding:7px 12px}
#legend i{display:inline-block;width:22px;height:3px;border-radius:2px}
#stage .jlbl{position:absolute;z-index:1;transform:translate(-50%,-100%);background:#fff;color:var(--red);font-size:11px;font-weight:600;border-radius:999px;padding:1px 7px;white-space:nowrap;pointer-events:none;display:none}
#nowLabel{position:absolute;z-index:1;transform:translate(-50%,-100%);background:var(--blue);color:#fff;font-size:11px;font-weight:600;border-radius:999px;padding:2px 9px;white-space:nowrap;pointer-events:none;display:none}
#stage .plbl{position:absolute;z-index:1;transform:translate(-50%,-50%);font-size:11px;font-weight:600;color:#8d9199;pointer-events:none}
#stage .plbl.on{color:#111}
#endLabel{position:absolute;z-index:1;transform:translate(-50%,-100%);background:var(--blue);color:#fff;font-size:11px;font-weight:600;border-radius:999px;padding:2px 9px;white-space:nowrap;pointer-events:none;display:none}
#cam{right:16px;bottom:16px;width:260px;padding:0;background:none}
#cam video{display:block;width:100%;aspect-ratio:4/3;border-radius:10px;background:#ddd}
#cam p{position:absolute;left:8px;bottom:8px;margin:0;font-size:11px;color:#111;background:rgba(255,255,255,.85);border-radius:999px;padding:1px 8px}
#panel{width:360px;flex:none;background:#fff;padding:20px;display:flex;flex-direction:column;gap:18px;overflow:auto}
#panel h2{margin:0 0 8px;font-size:13px;font-weight:700}
#places{margin-bottom:8px}#places button{flex:1}
#trials{display:flex;flex-direction:column;gap:6px}
.sc{all:unset;box-sizing:border-box;cursor:pointer;display:block;border-radius:10px;padding:8px 12px;background:var(--face)}
.sc b{display:block;font-size:12.5px}.sc span{display:block;font-size:11.5px;color:#777;line-height:1.5;margin-top:2px}
.sc.on{background:#111;color:#fff}.sc.on span{color:#cfcfcf}
.sc:focus-visible,.seg button:focus-visible,.opts button:focus-visible,.cta:focus-visible{outline:2px solid var(--blue);outline-offset:2px}
.prow{display:flex;gap:8px;align-items:center}
.cta{display:flex;align-items:center;justify-content:center;height:44px;padding:0 18px;border:0;border-radius:8px;background:#111;color:#fff;font-size:14px;font-weight:500;cursor:pointer;min-width:96px}
.opts{display:flex;gap:5px;flex-wrap:wrap}
.opts button{border:0;border-radius:7px;background:#f0f0f0;padding:5px 10px;font-size:12px;cursor:pointer;min-height:30px}
.opts button.on{background:#111;color:#fff}
#speeds{margin-top:8px}#speeds button{flex:1}
#tl{display:block;width:100%;height:56px;border-radius:8px;background:var(--face);cursor:pointer}
input[type=range]{width:100%;accent-color:#111;height:28px;margin:4px 0 0}
.note{font-size:11.5px;color:var(--sub);margin:4px 0 0;line-height:1.6}
.stats{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.st{background:var(--face);border-radius:10px;padding:8px 12px}
.st span{display:block;font-size:12px;color:var(--sub)}
.st b{font-size:24px;font-weight:600;white-space:nowrap}.st i{font-style:normal;font-size:13px;margin-left:3px}
.st b.hit{color:var(--red)}
.nx{background:var(--face);border-radius:10px;padding:10px 12px;margin-top:8px}
.nx p{margin:0;font-size:13px;line-height:1.9}.nx b{font-size:22px;font-weight:600;margin:0 2px}.nx i{font-style:normal;font-size:13px}
.nx b.hit{color:var(--red)}.nx .note{margin-top:4px}
@media(max-width:900px){
  #play{height:auto;flex-direction:column}#stage{height:62vh;flex:none}#panel{width:100%}
  #top{right:16px;max-width:none;padding:10px 14px}#top h1{font-size:17px}
  #views{top:auto;bottom:12px;right:12px;padding:6px}#views .hint{display:none}
  #legend{left:12px;bottom:60px;padding:6px}#legend span{display:none!important}#cam{width:140px;top:auto;bottom:112px;right:12px}#cam p{display:none}
}
</style>
</head>
<body>
<div id="play">
  <div id="stage">
    <div class="card" id="top">
      <h1>SO-101 リアリティビュー<span class="tag">試作 v0</span></h1>
      <p class="meta" id="meta"></p>
    </div>
    <div class="card" id="views">
      <div class="seg">
        <button data-cam="free" class="on">斜め上</button>
        <button data-cam="top">真上</button>
        <button data-cam="side">真横</button>
        <button data-cam="chase">爪の後ろ</button>
      </div>
      <div class="hint">ドラッグで回す・スペース＋ドラッグで動かす・ホイールで寄る</div>
    </div>
    <div id="endLabel">1秒後</div>
    <div id="nowLabel">いま</div>
    <div class="card" id="legend">
      <div class="seg" id="modes">
        <button data-mode="path" class="on">これから1秒の道</button>
        <button data-mode="jump">カクッとなった所</button>
        <button data-mode="none">線を出さない</button>
      </div>
      <span data-for="path"><i style="background:var(--blue)"></i><span>これから1秒で爪先が進む道（<b id="pathSrc" style="font-weight:400">AI の指令</b>）</span></span>
      <span data-for="jump" hidden><b id="jumpCount"></b></span>
      <span data-for="jump" hidden><i style="background:var(--red)"></i>動きがカクッとなった所。AI は約0.5秒ごとに次の動きを考え直していて、新しい答えが前の答えから大きくずれていると、ここで動きが急に変わります。数字はそのずれ（関節の角度）</span>
      <span data-for="jump" hidden><i style="background:#444;height:3px"></i>爪先が通った道（濃い灰がいままで、薄い灰がこの先。青い点が「いま」）</span>
    </div>
    <div class="card" id="cam">
      <video id="vid" muted playsinline preload="auto"></video>
      <p>机のカメラ（実機の録画）</p>
    </div>
  </div>

  <aside id="panel">
    <div>
      <h2>ブロックの場所</h2>
      <div class="seg" id="places">
        <button data-place="1">場所1</button><button data-place="2">場所2</button><button data-place="3">場所3</button><button data-place="4">場所4</button><button data-place="5">場所5</button>
      </div>
      <div id="trials"></div>
    </div>

    <div>
      <h2>再生</h2>
      <div class="prow">
        <button class="cta" id="playBtn">再生</button>
        <div class="opts">
          <button id="prevsw">前の切り替え</button>
          <button id="nextsw">次の切り替え</button>
        </div>
      </div>
      <div class="seg" id="speeds">
        <button data-spd="0.25">0.25倍</button>
        <button data-spd="0.5">0.5倍</button>
        <button data-spd="1" class="on">実際の速さ</button>
      </div>
    </div>

    <div class="aiOnly">
      <h2>答えの切り替え</h2>
      <canvas id="tl" aria-label="答えの切り替えとずれの大きさ"></canvas>
      <input type="range" id="seek" min="0" max="100" value="0" aria-label="時間">
      <p class="note">縦の線は、AI が次の動きを考え直した時。高いほど前の答えとずれていて、3°を超えると赤（カクッとなる）。押すとその時間へ移ります。</p>
    </div>

    <div>
      <h2>いまの数字</h2>
      <div class="stats">
        <div class="st"><span>時間</span><b id="time">0.0</b><i>秒</i></div>
        <div class="st aiOnly"><span>AI が考え直した回数</span><b id="chunk">1</b><i>回</i></div>
      </div>
      <div class="nx aiOnly">
        <p>あと <b id="left">0</b><i>秒</i> で、AI が次の動きを考え直します。</p>
        <p>そのとき新しい動きは、今の動きから <b id="nextjump">-</b><i>°</i> ずれます。</p>
        <p class="note">ずれが3°を超えると、動きがカクッとなります（関節の角度で見た大きさ）。</p>
      </div>
    </div>

    <div>
      <h2>表示</h2>
      <div class="opts">
        <button data-tg="ghost" class="on">1秒後のアームの形を重ねる</button>
        <button data-tg="ideal">理想の動きを重ねる</button>
      </div>
      <p class="note">薄い青は1秒後のアームの形。灰色は同じ場所の理想の動きで、同じ経過時間の形と、爪先が通る道を出します。</p>
      
    </div>

    <p class="note"><a href="/series6" style="color:#111;font-weight:600">フィジカルAI研究室へ戻る →</a></p>
    <p class="note">アームの形は実機の関節角の記録を、SO-101 の URDF（TheRobotStudio 公開）に入れて描いています。青い道は、π0.5（Physical Intelligence）の答えから実際にアームへ送った指令のうち、この先1秒分を爪先の位置に直したものです。AI は約0.5秒ごとに答えを出し直すので、道の途中で次の答えに切り替わります。箱とブロックの位置は記録と机のカメラから求め、箱の大きさ（9cm角）は写真からの見積もりです。ブロックは、爪の形が入ってきたら押し出され、爪の値がはさんだ値のあいだは爪の間に置いて一緒に動かし、離したら真下に落ちる、という決まりで動かしています（物理の計算はしていません）。</p>
  </aside>
</div>
<script type="module" src="/sim/so101-reality-view/bundle.js"></script>
<script>
// SO-101 リアリティビュー（/sim/so101-reality-view/）の使われ方の記録（2026-11-27。ブラウザ版の measure.js を写した）。
// このページはサイトの共通の型（Base.astro）を通らないため、サイトの記録（src/components/SiteMeasure.astro）が入っていなかった。
// SiteMeasure と同じ形で /api/ev に送る（数え方・数える道具は同じ）。送るもの・送らないもの・送らない場合も SiteMeasure と同じ:
// - ?p2m-notrack=1 を付けて開いたブラウザ・「トラッキングしないで」の設定のブラウザでは送らない
// - 入力した内容・IP アドレス・ブラウザの種類・Cookie は送らない。番号はこの1回の表示のためだけに作る
// このページで押したものは、場所の名前を rv にする（worker/index.js の EV_AREAS にある）。
// 何を触ったかが分かるように、ボタンは「btn:グループ:文字」、店の選択は「sel:store=p1」、時間の棒は「sel:seek」と残す。
// SiteMeasure を直したときは、ここも合わせて直す。
(() => {
  const OPT = 'p2m-notrack';
  let off = false;
  try {
    const q = new URLSearchParams(location.search).get(OPT);
    if (q === '1') { localStorage.setItem(OPT, '1'); off = true; }
    if (q === '0') localStorage.removeItem(OPT);
    if (localStorage.getItem(OPT) === '1') off = true;
  } catch { /* 覚えられない環境では、その表示の判定だけ */ }
  if (navigator.doNotTrack === '1' || navigator.globalPrivacyControl === true) off = true;
  if (off) return;

  const AUTO_UA = /headless|lighthouse|bot\/|bot;|\bbot\b|crawl|spider|slurp|preview|phantom|puppeteer|playwright|selenium/i;
  const newId = () => { try { return crypto.randomUUID().replace(/-/g, '').slice(0, 12); } catch { return Math.random().toString(36).slice(2, 14); } };
  const origin = () => {
    try {
      if (!document.referrer) return { f: '', r: '' };
      const u = new URL(document.referrer);
      if (u.host === location.host) return { f: u.pathname.slice(0, 160), r: '' };
      return { f: '', r: u.hostname.slice(0, 80) };
    } catch { return { f: '', r: '' }; }
  };
  const utm = () => {
    try { const v = (new URLSearchParams(location.search).get('utm_source') || '').toLowerCase(); return /^[a-z0-9._-]{1,40}$/.test(v) ? v : ''; } catch { return ''; }
  };
  const fresh = (from) => {
    const o = origin();
    return {
      v: newId(), n: 0, p: location.pathname.slice(0, 160), f: from ?? o.f, r: from ? '' : o.r, us: from ? '' : utm(),
      w: window.innerWidth < 600 ? 'sp' : 'pc', s: 100, t: 0, c: [],
      d: 0, g: 0, cp: 0, vp: 0, fs: 0, fx: 0, fv: 0,
      u: 0, wd: navigator.webdriver ? 1 : 0, hl: AUTO_UA.test(navigator.userAgent || '') ? 1 : 0,
    };
  };
  let st = fresh();
  let dirty = true;
  let visibleSince = document.hidden ? 0 : Date.now();
  const touched = () => { if (!st.u) { st.u = 1; dirty = true; } };
  for (const ev of ['pointermove', 'pointerdown', 'touchstart', 'wheel', 'keydown']) document.addEventListener(ev, touched, { capture: true, passive: true });

  // 同じものを続けて押しても1件にする（記録は8件まで）
  const add = (target) => {
    target = target.slice(0, 100);
    const last = st.c[st.c.length - 1];
    if (last && last[0] === target) return;
    if (st.c.length < 8) { st.c.push([target, 'rv']); dirty = true; }
  };
  const textOf = (el) => (el.getAttribute('aria-label') || el.textContent || '').replace(/\s+/g, ' ').trim().slice(0, 24);

  document.addEventListener('click', (e) => {
    try {
      const el = e.target;
      if (!(el instanceof Element)) return;
      const link = el.closest('a[href]');
      if (link) {
        let target = '';
        try { const u = new URL(link.href, location.href); target = u.host !== location.host ? u.hostname : u.pathname + (u.search.includes('topic=') ? u.search : ''); } catch { target = '(読めないリンク)'; }
        add(target);
        return;
      }
      const btn = el.closest('button,[role=button],summary');
      if (btn) {
        const group = btn.parentElement && btn.parentElement.id ? btn.parentElement.id + ':' : '';
        add('btn:' + group + (btn.dataset.view || btn.id || textOf(btn) || btn.tagName.toLowerCase()));
      }
    } catch { /* 数え損ねても動きには影響させない */ }
  }, { capture: true, passive: true });
  document.addEventListener('change', (e) => {
    try {
      const el = e.target;
      if (!(el instanceof HTMLSelectElement || el instanceof HTMLInputElement)) return;
      add(el.type === 'range' ? 'sel:' + (el.id || 'range') : 'sel:' + (el.id || el.name || 'select') + '=' + String(el.value).slice(0, 20));
    } catch { /* 同上 */ }
  }, { capture: true, passive: true });

  const send = () => {
    if (visibleSince) { st.t += Math.round((Date.now() - visibleSince) / 1000); visibleSince = 0; }
    st.t = Math.min(st.t, 7200);
    if (!dirty) return;
    const body = JSON.stringify(st);
    try {
      if (!navigator.sendBeacon || !navigator.sendBeacon('/api/ev', new Blob([body], { type: 'text/plain' }))) {
        fetch('/api/ev', { method: 'POST', body, keepalive: true }).catch(() => {});
      }
    } catch { /* 送れなくても動きには影響させない */ }
    st.n++; dirty = false;
  };
  document.addEventListener('visibilitychange', () => { if (document.hidden) send(); else visibleSince = Date.now(); });
  window.addEventListener('pagehide', send);
  window.addEventListener('pageshow', (e) => { if (e.persisted) { st = fresh('(戻る)'); visibleSince = Date.now(); dirty = true; } });
})();
</script>
</body>
</html>
