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
580
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
540
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
A2Aのクライアントを自作する
rynsuke
1
150
OAuth/OpenID Connectで実現するMCPのセキュアなアクセス管理
kuralab
5
810
エンジニア向け技術スタック情報
kauche
0
110
_第3回__AIxIoTビジネス共創ラボ紹介資料_20250617.pdf
iotcomjpadmin
0
140
Uniadex__公開版_20250617-AIxIoTビジネス共創ラボ_ツナガルチカラ_.pdf
iotcomjpadmin
0
140
20250623 Findy Lunch LT Brown
3150
0
740
Prox Industries株式会社 会社紹介資料
proxindustries
0
170
新規プロダクト開発、AIでどう変わった? #デザインエンジニアMeetup
bengo4com
0
500
AWS CDK 実践的アプローチ N選 / aws-cdk-practical-approaches
gotok365
4
460
Oracle Cloud Infrastructure:2025年6月度サービス・アップデート
oracle4engineer
PRO
1
140
登壇ネタの見つけ方 / How to find talk topics
pinkumohikan
2
180
Create a Rails8 responsive app with Gemini and RubyLLM
palladius
0
140
Featured
See All Featured
Facilitating Awesome Meetings
lara
54
6.4k
Side Projects
sachag
455
42k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
700
Speed Design
sergeychernyshev
31
1k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
Git: the NoSQL Database
bkeepers
PRO
430
65k
Done Done
chrislema
184
16k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Automating Front-end Workflow
addyosmani
1370
200k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.3k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.3k
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.8k
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