Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ARKit + CoreLocation
Search
totomo
April 20, 2018
Technology
1
590
ARKit + CoreLocation
Presentation about ARKit + CoreLocation in Osaka Mix Leap Study #11
totomo
April 20, 2018
Tweet
Share
More Decks by totomo
See All by totomo
Yahoo! MAPにおけるARの活用事例 - FOSS4G Tokai 2018 -
totomo1217
1
550
ARKit + CoreLocation - Bonfire iOS #4 -
totomo1217
5
1.5k
AR mode in Yahoo! MAP
totomo1217
0
2.1k
ARKit - Nagoya iOS Meetup -
totomo1217
0
160
Other Decks in Technology
See All in Technology
Infrastructure as Prompt実装記 〜Bedrock AgentCoreで作る自然言語インフラエージェント〜
yusukeshimizu
1
160
AIが住民向けコンシェルジュに?Amazon Connectと生成AIで実現する自治体AIエージェント!
yuyeah
0
210
Claude Codeは仕様駆動の夢を見ない
gotalab555
23
7.2k
「AIと一緒にやる」が当たり前になるまでの奮闘記
kakehashi
PRO
3
180
Oracle Base Database Service:サービス概要のご紹介
oracle4engineer
PRO
1
20k
GISエンジニアよ 現場に行け!
sudataka
1
140
[OCI Technical Deep Dive] OracleのAI戦略(2025年8月5日開催)
oracle4engineer
PRO
1
250
Delegate authentication and a lot more to Keycloak with OpenID Connect
ahus1
0
240
Amazon Q Developerを活用したアーキテクチャのリファクタリング
k1nakayama
2
220
Kiro と Q Dev で 同じゲームを作らせてみた
r3_yamauchi
PRO
1
120
Amazon Bedrock AgentCoreのフロントエンドを探す旅 (Next.js編)
kmiya84377
1
160
家族の思い出を形にする 〜 1秒動画の生成を支えるインフラアーキテクチャ
ojima_h
3
1.3k
Featured
See All Featured
Navigating Team Friction
lara
188
15k
The Language of Interfaces
destraynor
159
25k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.6k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.4k
For a Future-Friendly Web
brad_frost
179
9.9k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
Art, The Web, and Tiny UX
lynnandtonic
301
21k
Balancing Empowerment & Direction
lara
2
570
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
23
1.4k
Rebuilding a faster, lazier Slack
samanthasiow
83
9.1k
Testing 201, or: Great Expectations
jmmastey
45
7.6k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.9k
Transcript
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 2018年4⽉20⽇
Kenta Tokumoto ARKit+CoreLocation
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 2
Outline • 自己紹介 • ARモードについて • ARKitの概要 • ARKit+CoreLocation • オブジェクトの配置方法について • ルートライン • 看板 • 足跡 • けんさく+ゴールピン • 空間補正
About me ,FOUB5PLVNPUP 5XJUUFSUPUPNP (JUIVCUPUPNP 2JJUBUPUPNP ໊ݹۈɺೖࣾ̒ :BIPP."1ͷJ04 8FC"1*։ൃ୲
3
AR mode? 4 • Yahoo! MAPアプリ(iOS)で提供しているARを使った徒歩 ナビ支援機能 • iOS 11から利用可能なARKitを使用
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 5
Team Product Manager Designer Engineer
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 6
Schedule 2017年9月〜 12月 1月 2月 3月 ルートライン、足跡 実験 看板、けんさく QA、申請 空間補正 リリース
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 7
ARKit • iOS 11以降で使えるAR機能を実装するのに便利 なFramework • AR modeはPosition Trackingを必要とするためA9 チップが搭載された端末のみサポート • Android → ARCore
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. ARKit
+ CoreLocation
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 9
ARKit+CoreLocation • ARConfiguration.worldAlignment.gravity AndHeadingを指定する • 原点の位置情報とARKitにより構築された 世界空間の原点は相互変換可能 AR 実空間 N N (xn , zn ) (latn , lonn )
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 10
ARKit+CoreLocation (0, 0) d [m] (x1 , z1 ) (lat0 , lon0 ) d [m] (lat1 , lon1 )
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 11
SCNNodeの配置 • ルートライン (SCNPlane) • 看板 (3D) • けんさく+ゴールピン(3D) • 足跡 (SCNPlane)
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 12
ルートライン
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 13
ルートライン position eulerAngles.y
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 14
看板
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 15
看板 position
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 16
看板 position
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 17
看板 position • マージンを設けて見やすい方向に回転 • 東西どちらに配置するかは、進行方向と 次の方向との差分から判断している
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 18
⾜跡
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 19
⾜跡 position
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 20
⾜跡 position • ARSCNViewから取れるpointOfView のpositionを取得 • 現在位置の座標をもとに移動距離と 角度を計算 • 足跡はランダムで出すようにmaterial に設定しているUIImageを動的に設定 している
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 21
けんさく+ゴールピン position SCNBillboardConstraint
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 22
SCNNodeの追加 locationInfoProvider.location { [weak self] location in guard let origin = location else { self?.displayError() return } self?.addObjects(origin: origin) }
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 23
⼤量のSCNNodeの追加 func renderer(_ renderer: SCNSceneRenderer, updateAtTime time: TimeInterval) { // 5つずつ追加する } self.navigationView.worldNode.addScheduledNodes(quantity: 5) func addObjects(origin: CLLocation) { self.navigationView.origin = origin let routeLineNodes = routeNodes(withCoordinates: self.coordinates) self.navigationView.scheduleNodes(routeLineNodes, priority: .high) } // ARSCNViewDelegate
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 24
空間補正 Correctable Space Fixed Space Root Space
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 空間補正
25 • Fixed Space • 足跡 • Correctable Space • ルートライン • けんさく&ゴールピン • 看板
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 空間補正
26 GPSによる現在地 (CoreLocation) AR空間上のカメラの現在地 (ARKit) GPSによる誤差の半径
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 空間補正
27 GPSによる現在地 (CoreLocation) AR空間上のカメラの現在地 (ARKit) GPSによる誤差の半径 誤差の円からはみ出してい る
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 28
LocationInfoProvider public protocol LocationInfoProvidable { func location(completion: @escaping (CLLocation?)->()) func nearbyRoutePoint(from origin: SCNVector3) -> SCNVector3? var delegate: LocationInfoProviderDelegate? { get set } } protocol LocationInfoProviderDelegate: class { // 角度補正 (電子コンパスまたは位置情報の精度が向上したタイミングで通知) // 精度: heading.headingAccuracy func locationInfoProvider(_ provider: LocationInfoProvidable, requestUpdateHeading heading: CLHeading) // 位置補正 (位置情報の精度が向上したタイミングで通知 // 精度: location.horizontalAccuracy func locationInfoProvider(_ provider: LocationInfoProvidable, requestUpdateLocation location: CLLocation, oldLocation: CLLocation?) }
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 空間補正
29 extension ARRouteNavigationViewController: ARLocationInfoProviderDelegate { public func arLocationInfoProvider(_ provider: ARLocationInfoProvidable, requestUpdateLocation location: CLLocation, oldLocation: CLLocation?) { guard let origin = navigationView.origin, let currentPosition = navigationView.pointOfView?.worldPosition else { return } // GPSから計算したAR空間における座標 let gpsPosition = location.coordinate.relativeVector3(to: origin.coordinate) + navigationView.worldNode.correctableNode.worldPosition // GPSの誤差を超えてずれていない場合は何もしない guard idealPosition.length(between: currentPosition) > location.horizontalAccuracy else { return } // 誤差を計算 let positionDifference = gpsPosition – currentPosition // 補正 navigationView.worldNode.correctableNode.worldPosition -= SCNVector3(positionDifference.x, 0, positionDifference.z) } }
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. 30
まとめ • ARKit + CoreLocation で実際の風景を見ながら道 案内ができる • ARKitが構成する空間座標と実空間の緯度経度は 相互に変換することができる • 3Dオブジェクトの配置にはSceneKitの知識が必要 • GPSや電子コンパスの精度を見つつカメラの座標 から位置や方向を補正可能 • ただしデバッグが大変です(笑)
Copyright (C) 2018 Yahoo Japan Corporation. All Rights Reserved. Fin