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
560
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
510
ARKit + CoreLocation - Bonfire iOS #4 -
totomo1217
5
1.5k
AR mode in Yahoo! MAP
totomo1217
0
2k
ARKit - Nagoya iOS Meetup -
totomo1217
0
150
Other Decks in Technology
See All in Technology
地方拠点で エンジニアリングマネージャーってできるの? 〜地方という制約を楽しむオーナーシップとコミュニティ作り〜
1coin
1
220
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
6
57k
次世代KYC活動報告 / 20250219-BizDay17-KYC-nextgen
oidfj
0
240
表現を育てる
kiyou77
1
210
ユーザーストーリーマッピングから始めるアジャイルチームと並走するQA / Starting QA with User Story Mapping
katawara
0
200
Developers Summit 2025 浅野卓也(13-B-7 LegalOn Technologies)
legalontechnologies
PRO
0
650
データマネジメントのトレードオフに立ち向かう
ikkimiyazaki
6
840
AndroidデバイスにFTPサーバを建立する
e10dokup
0
250
プロセス改善による品質向上事例
tomasagi
2
2.5k
Building Products in the LLM Era
ymatsuwitter
10
5.3k
Swiftの “private” を テストする / Testing Swift "private"
yutailang0119
0
130
2.5Dモデルのすべて
yu4u
2
830
Featured
See All Featured
Designing for Performance
lara
604
68k
Bootstrapping a Software Product
garrettdimon
PRO
306
110k
Building Applications with DynamoDB
mza
93
6.2k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
The Language of Interfaces
destraynor
156
24k
KATA
mclloyd
29
14k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
A Modern Web Designer's Workflow
chriscoyier
693
190k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
Code Review Best Practice
trishagee
67
18k
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