本文档用于整理当前项目后续可利用的传感器能力,分为:
目标不是一次性接入所有传感器,而是优先接入对当前地图玩法、自动转图、运动状态识别、HUD/反馈最有价值的能力。
传感器接入必须遵守以下原则:
engine/sensortelemetry推荐统一产出的高级状态包括:
movementStateheadingSourcedevicePoseheadingConfidencecadenceSpmmotionIntensity基于微信小程序官方 API 与项目内 typings,当前可直接使用的能力包括:
Location
wx.startLocationUpdatewx.startLocationUpdateBackgroundwx.onLocationChangeAccelerometer
wx.startAccelerometerwx.onAccelerometerChangeCompass
wx.startCompasswx.onCompassChangeDeviceMotion
wx.startDeviceMotionListeningwx.onDeviceMotionChangeGyroscope
wx.startGyroscopewx.onGyroscopeChangeWeRunData
wx.getWeRunData微信小程序没有直接开放以下原始传感器接口:
GravityLinear AccelerationRotation VectorGeomagnetic Field 原始三轴ProximityStep Counter说明:
wx.getWeRunData 不是实时步数传感器流用途:
推荐产出:
turnRateheadingSmoothFactorheadingStability用途:
推荐产出:
devicePoseorientationConfidencetiltState用途:
推荐角色:
用途:
推荐产出:
motionIntensitymovementConfidence说明:
用途:
推荐角色:
用途:
当前不建议投入原因:
建议值:
idlewalkrun来源:
建议值:
sensorblendedmovement来源:
建议值:
uprighttiltedflat来源:
建议值:
lowmediumhigh来源:
原生 Flutter App 的能力边界明显更强,后续如果迁移或并行开发,可直接利用系统原始传感器。
Location / GNSSCompass / MagnetometerGyroscopeAccelerometerLinear AccelerationGravityRotation VectorStep Counter / PedometerBarometer(如设备支持)Proximity(视玩法需求)说明:
用途:
推荐产出:
deviceHeadingDegdevicePoseheadingConfidence用途:
用途:
推荐产出:
motionIntensitymovementState用途:
推荐产出:
stepCountcadenceSpmmovementState用途:
用途:
建议:
用途:
适合:
建议值:
idlewalkrunsprint来源:
用途:
建议值:
uprighttiltedflat建议值:
sensorblendedmovement建议值:
lowmediumhigh建议值:
flatascendingdescending来源:
尽管两端可用传感器不同,但建议统一抽象,不让上层感知平台差异。
放在:
engine/sensor职责:
放在:
telemetry职责:
建议统一输出:
movementStatedevicePoseheadingSourceheadingConfidencecadenceSpmmotionIntensityheadingSourcedevicePoseheadingConfidencemovementStatecadenceSpmmotionIntensitymovementStatecadenceSpm先接:
GyroscopeDeviceMotion目标:
再接:
Accelerometer目标:
先接:
Rotation VectorGyroscopeLinear Acceleration目标:
再接:
Step CounterGravity目标:
如果只从当前项目收益看,最值得优先做的是:
GyroscopeDeviceMotionRotation VectorGyroscopeLinear Acceleration原因:
可用传感器有限,但足够继续做:
最值得优先接入的是:
GyroscopeDeviceMotionAccelerometer可利用的原始传感器更完整,建议未来重点发挥:
Rotation VectorGyroscopeLinear AccelerationStep Counter两端都应遵守同一个原则:
原始传感器进 engine/sensor,高级状态进 telemetry,上层只消费统一状态。