Skip to content

駅到着判定の感度を改善: 閾値下限・GPS精度反映・位置スムージング・探索範囲最適化 - #5266

Merged
TinyKitten merged 4 commits into
devfrom
claude/fix-station-detection-pzLR6
Feb 12, 2026
Merged

TinyKitten merged 4 commits into
devfrom
claude/fix-station-detection-pzLR6

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Feb 12, 2026 •

Copy link
Copy Markdown
Member

https://claude.ai/code/session_01B1s9TeyqcuVknhESHr6Z7L

Summary by CodeRabbit

リリースノート

  • 新機能

    • GPS精度に基づいた動的なしきい値調整を実装しました。
  • バグ修正

    • 位置情報のスムージング機能を追加し、GPS外れ値を自動フィルタリングするようになりました。
    • 駅検出のしきい値に最小値の制限を追加しました。
  • パフォーマンス改善

    • 駅フィルタリング処理を最適化しました。

@github-actions github-actions Bot added the react label Feb 12, 2026
@coderabbitai

coderabbitai Bot commented Feb 12, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

ウォークスルー

このPRはGPS精度ベースの閾値調整と位置情報の検証改善を導入します。最小閾値定数を追加し、閾値計算を制限するクランプ関数を実装し、ステーション更新フックで精度ボーナス補正を追加し、有効なステーションフィルタリングをメモ化し、速度ベースの外れ値フィルタリングとEMA平滑化を位置情報更新に追加します。

変更内容

Cohort / File(s) 概要
定数と閾値設定
src/constants/threshold.ts
2つの新しい最小閾値定数を追加: APPROACHING_MIN_THRESHOLD(200)とARRIVED_MIN_THRESHOLD(100)
ステーション検出ロジック
src/hooks/useNearestStation.ts
有効なステーション(緯度経度がnullでない)をメモ化し、最近接ステーション計算の依存配列を更新
ステーション更新・到着検出
src/hooks/useRefreshStation.ts
GPS精度を読み取り、精度ボーナスをuseMemoで計算し、効果的な閾値を導出して到着/接近判定ロジックに適用
閾値計算
src/hooks/useThreshold.ts
クランプヘルパー関数を追加し、approachingThresholdとarrivedThresholdの計算を最小値・最大値で制限
位置情報処理
src/store/atoms/location.ts
速度ベースの外れ値フィルタを導入し、EMA平滑化を使用して座標を平滑化し、MAX_PLAUSIBLE_SPEEDとSMOOTHING_ALPHAをサポート
テストの更新
src/hooks/useThreshold.test.tsx
最小閾値定数をインポートし、閾値が最小値にクランプされることを検証するテストケースと他のテストのアサーションを追加

シーケンス図

sequenceDiagram
    actor Loc as Location Update
    participant Smooth as Location Smoothing<br/>(速度フィルタ/EMA)
    participant Store as Location Store
    participant Refresh as useRefreshStation
    participant Threshold as useThreshold
    participant Detect as Arrival Detection<br/>(isArrived/isApproaching)
    
    Loc->>Smooth: Raw position + accuracy
    alt Speed too high (outlier)
        Smooth->>Store: Discard, keep prev accuracy
    else Valid location
        Smooth->>Smooth: Apply EMA smoothing
        Smooth->>Store: Save smoothed coords + accuracy
    end
    
    Store->>Refresh: Updated location data
    Refresh->>Refresh: Read accuracy from location
    Refresh->>Refresh: Calculate accuracyBonus<br/>(capped by MAX_ACCURACY_BONUS)
    Refresh->>Threshold: Get base thresholds<br/>(with min/max clamping)
    Refresh->>Refresh: Compute effectiveArrivedThreshold<br/>(base + accuracyBonus)
    Refresh->>Refresh: Compute effectiveApproachingThreshold<br/>(base + accuracyBonus)
    Refresh->>Detect: Compare distance to<br/>effective thresholds
    Detect->>Detect: Determine arrival/approaching state
Loading

推定コードレビュー工数

🎯 4 (Complex) | ⏱️ ~60 minutes

関連する可能性のあるPR

詩

🐰✨ GPS精度で閾値ぐいぐい、
外れ値はサッと振り落とし、
平滑なる位置情報で
駅への到着、ぴたり掴むー🚄
速度チェック、ボーナス計算、
ウサギも走る、最小値クランプ!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed プルリクエストのタイトルは、駅到着判定の感度改善という主要な変更を明確に要約しており、具体的な改善内容(閾値下限、GPS精度反映、位置スムージング、探索範囲最適化)も示されている。変更内容とタイトルが一致している。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/fix-station-detection-pzLR6

No actionable comments were generated in the recent review. 🎉

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

@TinyKitten
TinyKitten merged commit bf2c5c0 into dev Feb 12, 2026
5 checks passed
@TinyKitten
TinyKitten deleted the claude/fix-station-detection-pzLR6 branch February 12, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants