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
540
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
390
ARKit + CoreLocation - Bonfire iOS #4 -
totomo1217
5
1.3k
AR mode in Yahoo! MAP
totomo1217
0
1.8k
ARKit - Nagoya iOS Meetup -
totomo1217
0
120
Other Decks in Technology
See All in Technology
ハイパフォーマンスな組織をつくるための開発生産性の考え方 / developer-productivity-high-performer-link-and-motivation
lmi
3
240
Oracle Database で機械学習を始めよう! Oracle Machine Learning
oracle4engineer
PRO
1
140
実務への応用例から考える 変更に強いオブジェクト指向設計 / 20240324-ooc2024
bengo4com
7
5k
サービスメッシュ環境における OpenTelemetry 活用 / OpenTelemetry in Service Mesh
k6s4i53rx
2
820
中央集権体制からDataOpsへの転換 / centralized-to-dataops-transformation
pei0804
7
1.4k
なんで私に登壇依頼が?! ~頼られるエンジニアになるためには~ /
mixi_engineers
PRO
2
200
現実世界の事象から学ぶSOLID原則
h0r15h0
24
10k
「XX試験の環境作ってよ」と言われた時によく使うAWSのソリューションについて
bun913
0
120
エンジニアブランディングチームの KPI / KPI's of engineer branding team
chaspy
1
140
生成AI・LLM時代における 機械学習エンジニアとしてのキャリア戦略・開発戦略 / my-career-and-development-strategies-for-ml-engineer-2024
yuya4
3
180
20240321_生成AI時代のDevOps
kzkmaeda
2
610
XRミーティング 2024-03-20
1ftseabass
PRO
0
100
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
225
51k
What's in a price? How to price your products and services
michaelherold
236
11k
Typedesign – Prime Four
hannesfritz
36
2k
4 Signs Your Business is Dying
shpigford
174
21k
Practical Orchestrator
shlominoach
180
9.7k
Writing Fast Ruby
sferik
619
59k
Agile that works and the tools we love
rasmusluckow
323
20k
The Language of Interfaces
destraynor
150
23k
Become a Pro
speakerdeck
PRO
8
4.4k
Building Your Own Lightsaber
phodgson
97
5.6k
Infographics Made Easy
chrislema
237
18k
What’s in a name? Adding method to the madness
productmarketing
PRO
14
2.6k
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