
[iOS 17] Nearby Interactionの延長距離測定 (Extended Distance Measurement / EDM)
`NINearbyPeerConfiguration` に、iOS 17で `isExtendedDistanceMeasurementEnabled` という新しいAPIが生えていた。
この新APIについて、WWDC23では僕の知る限りでは言及されていない。
iOS 17でNearby Interactionに追加された "extended distance measurement (EDM)" ってどういうものなんだろう?WWDC23でもこれについて言及されているセッションは(知る限りでは)なかった。
— 堤修一 / Shuichi Tsutsumi (@shu223) January 8, 2024
isExtendedDistanceMeasurementEnabled | Apple Developer Documentation https://t.co/CKzXRJsixU
(そもそもNearby Interaction関連のセッションがなかった)
Apple公式サンプル
調べると、以下の公式サンプルのページが見つかった。
サンプル自体は以前から存在する、ARKitを使って他の(AppleのUWBチップを搭載した)デバイスを見つけるというもの:
This sample code project demonstrates how to use ARKit to find devices equipped with Apple Ultra Wideband (UWB) chips using a technique known as ranging. Ranging estimates the distance between devices using parameters such as signal strength and packet timing.
(このサンプルコードプロジェクトでは、ARKitを使用して、レンジングとして知られる技術を使用してApple Ultra Wideband(UWB)チップを搭載したデバイスを見つける方法を示します。測距は、信号強度やパケットタイミングなどのパラメータを使用してデバイス間の距離を推定します。)
このサンプルは、iOS 17以上 / iPhone 15以降のデバイスで実行すると、Extended Distance Measurement (EDM) 機能を試すことができる。
To use Extended Distance Measurement (EDM) capabilities, you’ll need two iPhone 15 devices or later.
(拡張距離測定(EDM)機能を使用するには、2台のiPhone 15以降のデバイスが必要です。)
同ページの別部分での記述によると、同機能の利用には第2世代のUWBチップ(U2)が必要なようだ。
EDM capabilities (available on devices with second generation UWB chips)
起動してすぐの画面の、"Discuss jetpacks〜"をタップするとEDMを使用したデモを利用できる。

下側のメニューはiOS 17以上の端末でのみ表示されるようになっている:
if #available(iOS 17.0, watchOS 10.0, *), NISession.deviceCapabilities.supportsExtendedDistanceMeasurement {
NavigationLink(destination: NICameraAssistanceView(mode: .visitor)) {
Text("\(Image(systemName: "person.2")) Discuss jetpacks with another visitor.")
.padding()
.font(.title2)
.cornerRadius(10)
}
}
メニューを選択するとカメラへのアクセスを求められ、

許可すると次のようにカメラを利用しつつ相手デバイスを探すような画面になる:

だが残念ながら
2台のiPhone 15以降のデバイスが必要
というハードルが高すぎるため、このサンプルの実際の(他のデバイスとの)インタラクションは試せていない。
いずれ新機種が出たら試すとして、この機能がどういうものなのか、当該サンプルページの解説と、その後見つけたEDMの解説ページを読んでいく。
距離品質推定関数(Distance Quality Estimator)の実装を読む
最後まで読んでいただきありがとうございます!もし参考になる部分があれば、スキを押していただけると励みになります。 Twitterもフォローしていただけたら嬉しいです。 https://twitter.com/shu223/