Repository navigation
GPXを到着時間推定に合わせて走らせるようにし、同梱のGPXを作り直した - #7157
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (13)
Included review availability: This review used your included allowance. 1 included review remains after this review. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour. 📝 WalkthroughWalkthroughGPX生成器は、StationAPI の線路距離と Estimated 到着・出発見込みを使って waypoint を生成します。到着判定のテストは、猶予時間と複数の測位条件を扱うよう更新されました。 ChangesGPX生成
到着判定テスト
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~45 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant Generator as generate-location-gpx.mjs
participant StationAPI
participant WaypointBuilder as buildWaypoints
participant GPX as GPX出力
Generator->>StationAPI: 駅情報と Estimated の trainRoute を要求
StationAPI-->>Generator: 駅間距離、到着・出発見込み、運動条件を返す
Generator->>WaypointBuilder: 経路、区間距離、区間時間を渡す
WaypointBuilder-->>Generator: 時刻に合わせた waypoint を返す
Generator->>GPX: waypoint を出力
Merge Risk: ⚪ Minimal · up to This change regenerates sample GPX files and updates the generator script, tests and docs. It does not affect production app behavior, and no merge-blocking issues were identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
うさぎが線路の距離をたどる Comment |
…の形に戻した Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
概要
GPX 生成スクリプトで、駅間の長さに線路の長さを使うようにしました。
--line-groupでは、StationAPI の到着時間推定の見込みに合わせて走らせます。あわせて、同梱の GPX を作り直しました。これまでの GPX は、駅間を直線距離で測り、固定の最高速度と 60 秒の停車で走っていました。そのため所要時間が実際より短くなっていました。京王線の特急(新宿→京王八王子)は、実際のダイヤでは約 45 分かかりますが、GPX は約 35 分でした。今回作り直した GPX では 41.4 分です。
GPX が使う見込みは
trainRouteのEstimatedで、線路の長さと、その距離で求め直した較正を使います(TrainLCD/StationAPI#1712、#1714)。アプリの ETA(estimateArrivalTimes)と経路検索は元の計算のままなので、GPX の所要時間は ETA の見込みと一致しません。同梱の GPX を ETA 補助ありとなしで流すテスト(location.gpxEtaAssist.test.ts)では、どの GPX も両者の走行結果が一致し、ETA 補助による棄却は起きませんでした。変更の種類
変更内容
scripts/generate-location-gpx.mjs)trackDistanceFromPrevious(線路の長さ)を使います。値が返らない区間だけ直線距離にします。逆向きに走らせるときは、値を走る向きの直前の駅に付け替えます。--line-groupでは、trainRouteにmodel: Estimated(trainRouteに到着時間推定のモデルで区間の値を返すEstimatedモードを追加 StationAPI#1710)を渡し、到着・出発の見込みを取ります。--skip)は、その停車時間を走行時間から引きます。GPX で停まる駅を推定が通過しているときは、--dwellの指定を求めて止まります。--max-speedと--dwellは、明示したときだけ見込みの代わりに使います。--lineは、これまでどおり--max-speed(既定 320)で走ります。assets/gpx/)SampleJY.gpx(実走行の記録)以外の 5 本を作り直しました。SampleTohokuShinkansen.gpxは--lineで作っているので、線路の長さだけが反映されています。location.gpxLag.test.tsとlocation.tsは変更していません(devのまま)。作り直した GPX でも、EMAスムージングのαを測位の配信間隔で正規化して到着判定が駅の直前までずれ込む不具合を修正 #6917 の配信間隔の見張りを含めてすべて通ります。location.gpxEtaAssist.test.tsは、精度の悪い条件では終着駅を検知できない前提で、検知駅数を完全一致で見ていました。作り直した GPX では終着駅も検知できた(片町線・京王線)ので、下限と上限の範囲で見るようにしました。途中の駅の取りこぼしは、これまでどおり検出します。location.subwayGpx.test.tsのFLinerSeibu.gpxの形(90 秒を超える欠測の数と最長の欠測)を、作り直した GPX の実測値(5 件、326 秒)に合わせました。docs/location-simulation.mdとreplay-gpxスキルから、「最高 120km/h」のように、作り直した GPX には当てはまらない記述を削りました。見込みに合わせる仕組みと、その結果として現実とずれる点を書き足しました。現実との差として残る点
テスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ることnpm run lint、npm run typecheck、npm test(321 スイート・3573 件)はすべて成功しました。生成スクリプトのテスト(node --test scripts/generate-location-gpx.test.mjs)は 31 件すべて成功しました。関連Issue
Refs TrainLCD/StationAPI#1710, TrainLCD/StationAPI#1712, TrainLCD/StationAPI#1714
スクリーンショット(任意)
UI 変更なし:
assets/gpx/は開発者向けの GPX で、アプリのコードからは読み込みません。🤖 Generated with Claude Code
Summary by CodeRabbit