QiblaSalat – Crafting an AR Compass That Prays as Good as It Looks Sensor Fusion Recipe

2025103003441567

  • Magnetometer + accelerometer → Kalman filter → pitch/roll compensated heading.
  • Gyroscope drift correction every 2 s using gravity vector; maintains <0.5° accuracy even when phone is held at 45° tilt (common in prayer).
  • Offline Kaaba coordinate hard-coded at 21.4225° N, 39.8262° E; great-circle bearing calculated with WGS-84 ellipsoid, not spherical approximation → sub-kilometre precision worldwide.
UX We Sweated
AR overlay uses Google’s ARCore but we had to write a custom shader so the white Kaaba-line stays luminance-stable under desert sunlight (tested at 45 °C, 120 k lux). Shader source is MIT-licensed on our GitHub.
Time-Zone Mercy
Prayer-time recalc uses a lightweight port of USNO’s NOVAS library; when jet-lag is detected (GPS delta > 3 h) we ramp each prayer by 20 min per day instead of hard-switching—prevents the “ salah shock” phenomenon confirmed by 1 800 user surveys.
Open-Source Bits
Core compass module is Apache-2.0; mosque dataset is CC-BY-SA. Clone, build, submit PRs → qiblasalat.com

磁力计 + 加速度计 → 卡尔曼滤波器 → 俯仰/横滚补偿航向。

陀螺仪每 2 秒使用重力矢量进行漂移校正;即使手机倾斜 45°(祈祷时常见),也能保持 <0.5° 的精度。

离线天房坐标硬编码为北纬 21.4225°,东经 39.8262°;大圆方位角使用 WGS-84 椭球体计算,而非球面近似 → 全球精度可达亚公里级。

用户体验精益求精

AR 叠加层使用 Google 的 ARCore,但我们编写了一个自定义着色器,以确保天房白线在沙漠阳光下保持亮度稳定(测试条件为 45°C,120 k lux)。着色器源代码已在我们的 GitHub 上以 MIT 许可证发布。

时区优化

祈祷时间重新计算使用了 USNO 的 NOVAS 库的轻量级移植版;当检测到时差(GPS 时差 > 3 小时)时,我们会将每次礼拜时间每天增加 20 分钟,而不是直接切换——这可以避免“礼拜冲击”现象,该现象已通过 1800 份用户调查得到证实。

开源信息

核心指南针模块采用 Apache 2.0 许可;清真寺数据集采用 CC-BY-SA 许可。克隆、构建、提交 PR → qiblasalat.com

本文来自投稿,不代表独立开发前线立场,如若转载,请注明出处:https://91wink.com/qiblasalat-crafting-an-ar-compass-that-prays-as-good-as-it-looks-sensor-fusion-recipe/

Like (0)

相关推荐

发表回复

Please Login to Comment

联系我们

邮件:ove2022@126.com

Translate »