Skip to content

Commit ab56a8c

Browse files
Wilhelm Bergabhishektrip
authored andcommitted
Enhanced DeviceLocationProvider, GPS logging and playback (#811)
* [wip] log location to file * use persistentDataPath for location log file * log location info. update scene * writing log file seems to work on Android and iOS * string.format fix * Change location provider folder/scene name * make player transparent * LocationProviderScene: Screen.sleepTimeout = SleepTimeout.NeverSleep; * cleanup after merge * add DeviceOrientationMaterial * fix v1.4.2 merge quest using wrong LocationProvider scene and LogLocationProviderData.cs * fix typo in DeviceLocationProvider.cs * disable native Android location plugin for testing purposes * implement proper LocationLogFile Reader and Writer * implement LocationLogWriter * testing: force default location provider for Android * for baran :-) * set scene back to defaults * fine tune parameters * make sure Android native location plugin does not run when deactivated * reattach loggingtoggle * just a little bit of eyecandy for the text panel * FOR DEBUGGING: MockLocationInfo and MockLocationProvider to feed locations logs through `DeviceLocationProvider`. * [wip] work on UserHeading calculation * work on UserHeading and DeviceOrientation * Smoothing algorithms * make heading and orientation material more transparent * update changelog and documentation * add code comments * fix "MonoBehaviours can only be added using AddComponent()" and don't run DeviceLocationProvder CoRoutine when not selected as default location provider * location provider scene: change EditorProvider back to log file provider * Revert to original materials
1 parent 6c864f3 commit ab56a8c

File tree

65 files changed

+2850
-479
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2850
-479
lines changed

documentation/docs/05-changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55
- Added a **Feature Replacement Modifer** that allows replacement of a vector feature at a given Latitude,Longitude with a supplied prefab. Enables replacing a procedurally generated building at a given Latitude,Longitude with a custom 3D model.
66
- Texturing Style dropdown now allows users to select from prepackaged texture styles or custom, which allows for user-defined texturing.
77
- Mesh and GameObject modifiers can now be created and added to AbstractMap via `Add New` buttons.
8+
- Example scene `LocationProvder` can be used to log GPS traces. See documentation on how to copy logs from devices.
9+
- GPS traces can be played back in the Editor with `EditorLocationProviderLocationLog`.
10+
- `UserHeading` and `DeviceOrientation` values can be smoothed via different smoothing algorithms.
811
##### Improvements
912
- Improvements to UV mapping for side walls of extruded polygons when using atlas textures. Enables better handling of leftover areas when creating columns.
13+
- DeviceLocationProvider should work on devices. Tested with iPhone 7/8/X, Google Pixel 2, Samsung S8, Samsung Galaxy Note 8, OnePlus 3
1014
##### Bug Fixes
1115
- Fix issue with UvModifier which caused wrong roof uv positions calculations.
1216
- Fix issue with data fetcher to handle failed connections properly, which caused IndexOutOfRangeException during tile loading/unloading.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Accessing GPS log files
2+
3+
`LocationProvider` scene has the option to write location data into files.
4+
Follow these steps download the logs from your device.
5+
6+
## Android
7+
8+
Log files can be accessed directly via Explorer after plugging in the device.
9+
10+
**Note:** If files don't show up disconnect/connect your device. Sometimes even a reboot seems to be required as folders/files only get synced on first connection.
11+
12+
**Alternative:** use a file manager (eg [Solid Explorer Classic](https://play.google.com/store/apps/details?id=pl.solidexplorer)) on your device and copy files to eg `<storage>/Download` that should trigger a refresh.
13+
14+
15+
Location:
16+
17+
```
18+
/<your-device>/<storage>/Android/data/<bundle-identifier>/files/
19+
```
20+
21+
![log file location on Android](images/access-gps-logs/android-logfile-location.png)
22+
23+
## iOS
24+
25+
Open the exported project in `XCode` and add `Application supports iTunes file sharing : YES` key to `Info.plist` file:
26+
27+
![edit info.plist](images/access-gps-logs/info.plist.png)
28+
29+
Build to the device, run, log and connect device to your computer.
30+
31+
Select the device in `iTunes`:
32+
33+
![select device in itunes](images/access-gps-logs/itunes-select-device.png)
34+
35+
1. Click on `File Sharing`
36+
2. Select `Bundle Identifier` eg `MBX-SDK` from the `Apps` list
37+
3. Access log files
38+
39+
![get log files in itunes](images/access-gps-logs/itunes-file-sharing.png)
5.8 KB
Loading
55 KB
Loading
95.3 KB
Loading
14.7 KB
Loading

documentation/docs/toc.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@
1111
href: windowsstore-uwp-hololens.md
1212

1313
- name: HoloLens Development
14-
href: hololens-development.md
14+
href: hololens-development.md
15+
16+
- name: Access GPS logs
17+
href: access-gps-logs.md

sdkproject/Assets/Mapbox/Core/mapbox-sdk-cs/Utils/UnixTimestampUtils.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
// </copyright>
55
//-----------------------------------------------------------------------
66

7-
namespace Mapbox.Utils {
7+
namespace Mapbox.Utils
8+
{
89
using System;
910
using System.Collections.Generic;
1011
using System.Text;
@@ -13,7 +14,8 @@ namespace Mapbox.Utils {
1314
/// <summary>
1415
/// A set of Unix Timestamp utils.
1516
/// </summary>
16-
public static class UnixTimestampUtils {
17+
public static class UnixTimestampUtils
18+
{
1719

1820
// http://gigi.nullneuron.net/gigilabs/converting-tofrom-unix-timestamp-in-c/
1921

@@ -22,7 +24,8 @@ public static class UnixTimestampUtils {
2224
/// </summary>
2325
/// <param name="date"></param>
2426
/// <returns></returns>
25-
public static double To(DateTime date) {
27+
public static double To(DateTime date)
28+
{
2629
//return date.ToLocalTime().Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds;
2730
return date.Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds;
2831
}

sdkproject/Assets/Mapbox/Examples/0_PrefabScenes/LocationBasedGame.unity

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ RenderSettings:
3838
m_ReflectionIntensity: 1
3939
m_CustomReflection: {fileID: 0}
4040
m_Sun: {fileID: 0}
41-
m_IndirectSpecularColor: {r: 0.4465785, g: 0.49641252, b: 0.574817, a: 1}
41+
m_IndirectSpecularColor: {r: 0.44657826, g: 0.49641263, b: 0.57481676, a: 1}
4242
--- !u!157 &3
4343
LightmapSettings:
4444
m_ObjectHideFlags: 0
@@ -298,6 +298,11 @@ Prefab:
298298
propertyPath: m_RootOrder
299299
value: 2
300300
objectReference: {fileID: 0}
301+
- target: {fileID: 114472907270853152, guid: 35ce2bb4caba9434db5e656796b632b1,
302+
type: 2}
303+
propertyPath: _editorDebuggingOnly._locationLogFile
304+
value:
305+
objectReference: {fileID: 4900000, guid: 5e6bb7224cef35c4788a4817b1c9778d, type: 3}
301306
m_RemovedComponents: []
302307
m_ParentPrefab: {fileID: 100100000, guid: 35ce2bb4caba9434db5e656796b632b1, type: 2}
303308
m_IsPrefabParent: 0

sdkproject/Assets/Mapbox/Examples/5_Playground/Materials/HeadingMat.mat renamed to sdkproject/Assets/Mapbox/Examples/5_Playground/Materials/DeviceOrientationMat.mat

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ Material:
66
m_ObjectHideFlags: 0
77
m_PrefabParentObject: {fileID: 0}
88
m_PrefabInternal: {fileID: 0}
9-
m_Name: HeadingMat
9+
m_Name: DeviceOrientationMat
1010
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
11-
m_ShaderKeywords: _ALPHATEST_ON
11+
m_ShaderKeywords: _ALPHAPREMULTIPLY_ON
1212
m_LightmapFlags: 4
1313
m_EnableInstancingVariants: 0
1414
m_DoubleSidedGI: 0
15-
m_CustomRenderQueue: 2450
15+
m_CustomRenderQueue: 3000
1616
stringTagMap:
17-
RenderType: TransparentCutout
17+
RenderType: Transparent
1818
disabledShaderPasses: []
1919
m_SavedProperties:
2020
serializedVersion: 3
@@ -59,19 +59,19 @@ Material:
5959
- _BumpScale: 1
6060
- _Cutoff: 0.5
6161
- _DetailNormalMapScale: 1
62-
- _DstBlend: 0
62+
- _DstBlend: 10
6363
- _GlossMapScale: 1
6464
- _Glossiness: 0.5
6565
- _GlossyReflections: 1
6666
- _Metallic: 0
67-
- _Mode: 1
67+
- _Mode: 3
6868
- _OcclusionStrength: 1
6969
- _Parallax: 0.02
7070
- _SmoothnessTextureChannel: 0
7171
- _SpecularHighlights: 1
7272
- _SrcBlend: 1
7373
- _UVSec: 0
74-
- _ZWrite: 1
74+
- _ZWrite: 0
7575
m_Colors:
76-
- _Color: {r: 0.11724138, g: 1, b: 0, a: 1}
76+
- _Color: {r: 1, g: 0, b: 0, a: 0.391}
7777
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

0 commit comments

Comments
 (0)