@wemap/providers 12.10.8 → 12.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/helpers/CustomMapProvider.d.ts +10 -0
  2. package/{index.ts → dist/index.d.ts} +0 -14
  3. package/dist/index.js +1 -3446
  4. package/dist/index.js.map +1 -1
  5. package/{src/ProvidersOptions.ts → dist/src/ProvidersOptions.d.ts} +7 -16
  6. package/dist/src/errors/AskImuOnDesktopError.d.ts +5 -0
  7. package/dist/src/errors/ContainsIgnoredProviderError.d.ts +5 -0
  8. package/dist/src/errors/GeolocationApiMissingError.d.ts +5 -0
  9. package/dist/src/errors/GeolocationPermissionDeniedError.d.ts +5 -0
  10. package/dist/src/errors/GeolocationPositionUnavailableError.d.ts +5 -0
  11. package/dist/src/errors/IpResolveServerError.d.ts +5 -0
  12. package/dist/src/errors/MissingAccelerometerError.d.ts +6 -0
  13. package/dist/src/errors/MissingArCoreError.d.ts +5 -0
  14. package/dist/src/errors/MissingGyroscopeError.d.ts +6 -0
  15. package/dist/src/errors/MissingMagnetometerError.d.ts +5 -0
  16. package/dist/src/errors/MissingNativeInterfaceError.d.ts +5 -0
  17. package/dist/src/errors/MissingPoleStarError.d.ts +5 -0
  18. package/dist/src/errors/MissingSensorError.d.ts +6 -0
  19. package/dist/src/errors/NoProviderFoundError.d.ts +5 -0
  20. package/dist/src/events/AvailabilityHelper.d.ts +5 -0
  21. package/dist/src/events/ProvidersLoggerOld.d.ts +24 -0
  22. package/dist/src/events/Types.d.ts +34 -0
  23. package/dist/src/mapmatching/MapMatchingHandler.d.ts +93 -0
  24. package/dist/src/providers/Constants.d.ts +4 -0
  25. package/{src/providers/NativeProviders.ts → dist/src/providers/NativeProviders.d.ts} +2 -23
  26. package/dist/src/providers/Provider.d.ts +64 -0
  27. package/dist/src/providers/attitude/EkfAttitude.d.ts +41 -0
  28. package/dist/src/providers/attitude/TurnProvider.d.ts +17 -0
  29. package/dist/src/providers/attitude/absolute/AbsoluteAttitudeFromBrowserProvider.d.ts +60 -0
  30. package/dist/src/providers/attitude/absolute/AbsoluteAttitudeProvider.d.ts +44 -0
  31. package/dist/src/providers/attitude/relative/RelativeAttitudeFromBrowserProvider.d.ts +31 -0
  32. package/dist/src/providers/attitude/relative/RelativeAttitudeFromEkfProvider.d.ts +26 -0
  33. package/dist/src/providers/attitude/relative/RelativeAttitudeFromInertialProvider.d.ts +18 -0
  34. package/dist/src/providers/attitude/relative/RelativeAttitudeProvider.d.ts +25 -0
  35. package/dist/src/providers/imu/AccelerometerProvider.d.ts +11 -0
  36. package/dist/src/providers/imu/GyroscopeProvider.d.ts +11 -0
  37. package/dist/src/providers/imu/HighRotationsProvider.d.ts +15 -0
  38. package/dist/src/providers/imu/ImuProvider.d.ts +34 -0
  39. package/dist/src/providers/imu/MagnetometerCalibrationProvider.d.ts +11 -0
  40. package/dist/src/providers/inclination/InclinationFromAccProvider.d.ts +18 -0
  41. package/dist/src/providers/inclination/InclinationFromRelativeAttitudeProvider.d.ts +19 -0
  42. package/dist/src/providers/inclination/InclinationProvider.d.ts +18 -0
  43. package/dist/src/providers/legacy/helpers/HeadingUnlocker.d.ts +12 -0
  44. package/dist/src/providers/legacy/helpers/ThugDetector.d.ts +8 -0
  45. package/dist/src/providers/others/CameraNativeProvider.d.ts +11 -0
  46. package/dist/src/providers/others/CameraProjectionMatrixProvider.d.ts +11 -0
  47. package/dist/src/providers/position/absolute/AbsolutePositionProvider.d.ts +35 -0
  48. package/dist/src/providers/position/absolute/GnssWifiProvider.d.ts +28 -0
  49. package/dist/src/providers/position/absolute/IpProvider.d.ts +16 -0
  50. package/dist/src/providers/position/absolute/PoleStarProvider.d.ts +14 -0
  51. package/dist/src/providers/position/relative/GeoRelativePositionFromArCoreProvider.d.ts +17 -0
  52. package/dist/src/providers/position/relative/GeoRelativePositionProvider.d.ts +12 -0
  53. package/dist/src/providers/position/relative/PdrProvider.d.ts +15 -0
  54. package/dist/src/providers/steps/StepDetectionLadetto.d.ts +15 -0
  55. package/dist/src/providers/steps/StepDetectionMinMaxPeaks.d.ts +19 -0
  56. package/dist/src/providers/steps/StepDetectionMinMaxPeaks2.d.ts +27 -0
  57. package/dist/src/providers/steps/StepDetectionMinMaxPeaks3.d.ts +24 -0
  58. package/dist/src/providers/steps/StepProvider.d.ts +36 -0
  59. package/dist/src/providers/steps/StraightLineProvider.d.ts +21 -0
  60. package/dist/src/providers/vision/ArCoreProvider.d.ts +50 -0
  61. package/dist/src/providers/vision/BarcodeProvider.d.ts +11 -0
  62. package/dist/src/providers/vision/vps/ImageRelocalization.d.ts +11 -0
  63. package/dist/src/providers/vision/vps/RelativeRotationCalc.d.ts +10 -0
  64. package/dist/src/providers/vision/vps/VpsMetadata.d.ts +33 -0
  65. package/dist/src/providers/vision/vps/VpsProvider.d.ts +45 -0
  66. package/dist/src/providers/vision/vps/VpsRequest.d.ts +18 -0
  67. package/dist/src/providers/vision/vps/VpsResponse.d.ts +15 -0
  68. package/dist/src/smoothers/AttitudeSmoother.d.ts +23 -0
  69. package/dist/src/smoothers/PositionSmoother.d.ts +21 -0
  70. package/package.json +16 -12
  71. package/src/errors/AskImuOnDesktopError.ts +0 -10
  72. package/src/errors/ContainsIgnoredProviderError.ts +0 -10
  73. package/src/errors/GeolocationApiMissingError.ts +0 -10
  74. package/src/errors/GeolocationPermissionDeniedError.ts +0 -10
  75. package/src/errors/GeolocationPositionUnavailableError.ts +0 -10
  76. package/src/errors/IpResolveServerError.ts +0 -10
  77. package/src/errors/MissingAccelerometerError.ts +0 -11
  78. package/src/errors/MissingArCoreError.ts +0 -10
  79. package/src/errors/MissingGyroscopeError.ts +0 -11
  80. package/src/errors/MissingMagnetometerError.ts +0 -9
  81. package/src/errors/MissingNativeInterfaceError.ts +0 -11
  82. package/src/errors/MissingPoleStarError.ts +0 -10
  83. package/src/errors/MissingSensorError.ts +0 -15
  84. package/src/errors/NoProviderFoundError.ts +0 -10
  85. package/src/events/AvailabilityHelper.spec.ts +0 -30
  86. package/src/events/AvailabilityHelper.ts +0 -28
  87. package/src/events/ProvidersLoggerOld.ts +0 -87
  88. package/src/events/Types.ts +0 -18
  89. package/src/mapmatching/MapMatchingHandler.spec.ts +0 -142
  90. package/src/mapmatching/MapMatchingHandler.ts +0 -540
  91. package/src/providers/Constants.ts +0 -5
  92. package/src/providers/FakeProvider.spec.ts +0 -49
  93. package/src/providers/Provider.spec.ts +0 -113
  94. package/src/providers/Provider.ts +0 -244
  95. package/src/providers/attitude/EkfAttitude.spec.ts +0 -115
  96. package/src/providers/attitude/EkfAttitude.ts +0 -233
  97. package/src/providers/attitude/TurnProvider.ts +0 -58
  98. package/src/providers/attitude/absolute/AbsoluteAttitudeFromBrowserProvider.ts +0 -267
  99. package/src/providers/attitude/absolute/AbsoluteAttitudeProvider.ts +0 -268
  100. package/src/providers/attitude/relative/RelativeAttitudeFromBrowserProvider.ts +0 -84
  101. package/src/providers/attitude/relative/RelativeAttitudeFromEkfProvider.ts +0 -89
  102. package/src/providers/attitude/relative/RelativeAttitudeFromInertialProvider.ts +0 -66
  103. package/src/providers/attitude/relative/RelativeAttitudeProvider.ts +0 -70
  104. package/src/providers/imu/AccelerometerProvider.ts +0 -28
  105. package/src/providers/imu/GyroscopeProvider.ts +0 -27
  106. package/src/providers/imu/HighRotationsProvider.ts +0 -49
  107. package/src/providers/imu/ImuProvider.ts +0 -110
  108. package/src/providers/imu/MagnetometerCalibrationProvider.ts +0 -21
  109. package/src/providers/inclination/InclinationFromAccProvider.ts +0 -57
  110. package/src/providers/inclination/InclinationFromRelativeAttitudeProvider.ts +0 -51
  111. package/src/providers/inclination/InclinationProvider.ts +0 -59
  112. package/src/providers/legacy/helpers/HeadingUnlocker.spec.ts +0 -53
  113. package/src/providers/legacy/helpers/HeadingUnlocker.ts +0 -44
  114. package/src/providers/legacy/helpers/ThugDetector.ts +0 -30
  115. package/src/providers/others/CameraNativeProvider.ts +0 -29
  116. package/src/providers/others/CameraProjectionMatrixProvider.ts +0 -25
  117. package/src/providers/position/absolute/AbsolutePositionProvider.spec.ts +0 -31
  118. package/src/providers/position/absolute/AbsolutePositionProvider.ts +0 -277
  119. package/src/providers/position/absolute/GnssWifiProvider.ts +0 -126
  120. package/src/providers/position/absolute/GnssWifiProviders.spec.ts +0 -90
  121. package/src/providers/position/absolute/IpProvider.ts +0 -47
  122. package/src/providers/position/absolute/PoleStarProvider.ts +0 -88
  123. package/src/providers/position/relative/GeoRelativePositionFromArCoreProvider.ts +0 -82
  124. package/src/providers/position/relative/GeoRelativePositionProvider.ts +0 -35
  125. package/src/providers/position/relative/PdrProvider.ts +0 -107
  126. package/src/providers/steps/StepDetectionLadetto.ts +0 -67
  127. package/src/providers/steps/StepDetectionMinMaxPeaks.ts +0 -70
  128. package/src/providers/steps/StepDetectionMinMaxPeaks2.ts +0 -99
  129. package/src/providers/steps/StepDetectionMinMaxPeaks3.ts +0 -192
  130. package/src/providers/steps/StepProvider.ts +0 -151
  131. package/src/providers/steps/StraightLineProvider.ts +0 -69
  132. package/src/providers/vision/ArCoreProvider.ts +0 -184
  133. package/src/providers/vision/BarcodeProvider.ts +0 -28
  134. package/src/providers/vision/vps/ImageRelocalization.ts +0 -98
  135. package/src/providers/vision/vps/RelativeRotationCalc.ts +0 -58
  136. package/src/providers/vision/vps/VpsMetadata.ts +0 -63
  137. package/src/providers/vision/vps/VpsProvider.ts +0 -251
  138. package/src/providers/vision/vps/VpsRequest.ts +0 -29
  139. package/src/providers/vision/vps/VpsResponse.ts +0 -43
  140. package/src/providers/vision/vps/VpsSchema.json +0 -90
  141. package/src/smoothers/AttitudeSmoother.ts +0 -110
  142. package/src/smoothers/PositionSmoother.spec.ts +0 -53
  143. package/src/smoothers/PositionSmoother.ts +0 -96
  144. package/tsconfig.json +0 -3
  145. package/vite.config.ts +0 -4
  146. /package/{src/providers/ProviderState.ts → dist/src/providers/ProviderState.d.ts} +0 -0
@@ -1,31 +1,22 @@
1
- const ProvidersOptions = {
2
-
1
+ declare const ProvidersOptions: {
3
2
  /**
4
3
  * Does provider will use map to
5
4
  */
6
- useMapMatching: true,
7
-
5
+ useMapMatching: boolean;
8
6
  /**
9
7
  * Providers listed here will not be used by the system
10
8
  * List of {@link Provider#pname}
11
9
  */
12
- ignoreProviders: [] as string[],
13
-
10
+ ignoreProviders: string[];
14
11
  /**
15
12
  * Some providers are not used by default (i.e. PoleStar) because they
16
13
  * require data from an optional external service or because they drain more
17
14
  * battery. They can be added to this list to be used
18
15
  * List of {@link Provider#pname}
19
16
  */
20
- optionalProviders: [] as string[],
21
-
22
- stopOnError: true,
23
-
24
- checkAvailabilityOnStart: true,
25
-
26
- get hasPoleStar() {
27
- return this.optionalProviders.includes('PoleStar');
28
- }
17
+ optionalProviders: string[];
18
+ stopOnError: boolean;
19
+ checkAvailabilityOnStart: boolean;
20
+ readonly hasPoleStar: boolean;
29
21
  };
30
-
31
22
  export default ProvidersOptions;
@@ -0,0 +1,5 @@
1
+ declare class AskImuOnDesktopError extends Error {
2
+ static DEFAULT_MESSAGE: string;
3
+ constructor(message?: string);
4
+ }
5
+ export default AskImuOnDesktopError;
@@ -0,0 +1,5 @@
1
+ declare class ContainsIgnoredProviderError extends Error {
2
+ static DEFAULT_MESSAGE: string;
3
+ constructor(message?: string);
4
+ }
5
+ export default ContainsIgnoredProviderError;
@@ -0,0 +1,5 @@
1
+ declare class GeolocationApiMissingError extends Error {
2
+ static DEFAULT_MESSAGE: string;
3
+ constructor(message?: string);
4
+ }
5
+ export default GeolocationApiMissingError;
@@ -0,0 +1,5 @@
1
+ declare class GeolocationPermissionDeniedError extends Error {
2
+ static DEFAULT_MESSAGE: string;
3
+ constructor(message?: string);
4
+ }
5
+ export default GeolocationPermissionDeniedError;
@@ -0,0 +1,5 @@
1
+ declare class GeolocationPositionUnavailableError extends Error {
2
+ static DEFAULT_MESSAGE: string;
3
+ constructor(message?: string);
4
+ }
5
+ export default GeolocationPositionUnavailableError;
@@ -0,0 +1,5 @@
1
+ declare class IpResolveServerError extends Error {
2
+ static DEFAULT_MESSAGE: string;
3
+ constructor(message?: string);
4
+ }
5
+ export default IpResolveServerError;
@@ -0,0 +1,6 @@
1
+ import { default as MissingSensorError } from './MissingSensorError.js';
2
+ declare class MissingAccelerometerError extends MissingSensorError {
3
+ static DEFAULT_MESSAGE: string;
4
+ constructor(message?: string);
5
+ }
6
+ export default MissingAccelerometerError;
@@ -0,0 +1,5 @@
1
+ declare class MissingArCoreError extends Error {
2
+ static DEFAULT_MESSAGE: string;
3
+ constructor(message?: string);
4
+ }
5
+ export default MissingArCoreError;
@@ -0,0 +1,6 @@
1
+ import { default as MissingSensorError } from './MissingSensorError.js';
2
+ declare class MissingGyroscopeError extends MissingSensorError {
3
+ static DEFAULT_MESSAGE: string;
4
+ constructor(message?: string);
5
+ }
6
+ export default MissingGyroscopeError;
@@ -0,0 +1,5 @@
1
+ import { default as MissingSensorError } from './MissingSensorError.js';
2
+ declare class MissingMagnetometerError extends MissingSensorError {
3
+ constructor(message?: string);
4
+ }
5
+ export default MissingMagnetometerError;
@@ -0,0 +1,5 @@
1
+ declare class MissingNativeInterfaceError extends Error {
2
+ static DEFAULT_MESSAGE: string;
3
+ constructor(message?: string);
4
+ }
5
+ export default MissingNativeInterfaceError;
@@ -0,0 +1,5 @@
1
+ declare class MissingPoleStarError extends Error {
2
+ static DEFAULT_MESSAGE: string;
3
+ constructor(message?: string);
4
+ }
5
+ export default MissingPoleStarError;
@@ -0,0 +1,6 @@
1
+ declare class MissingSensorError extends Error {
2
+ static DEFAULT_MESSAGE: string;
3
+ constructor(message?: string);
4
+ from(fromMessage: string): this;
5
+ }
6
+ export default MissingSensorError;
@@ -0,0 +1,5 @@
1
+ declare class NoProviderFoundError extends Error {
2
+ static DEFAULT_MESSAGE: string;
3
+ constructor(message?: string);
4
+ }
5
+ export default NoProviderFoundError;
@@ -0,0 +1,5 @@
1
+ export type AvailabilityPromise = Promise<Error | null | void>;
2
+ export default class AvailabilityHelper {
3
+ static every(availabilityPromises: AvailabilityPromise[]): AvailabilityPromise;
4
+ static some(availabilityPromises: AvailabilityPromise[]): AvailabilityPromise;
5
+ }
@@ -0,0 +1,24 @@
1
+ interface MyObject {
2
+ getName(): string;
3
+ }
4
+ declare class ProvidersLoggerOld {
5
+ _enabled: boolean;
6
+ currentId: number;
7
+ objectsIdMap: WeakMap<MyObject, number>;
8
+ pushEvents: {
9
+ [key: number]: number;
10
+ };
11
+ pushEventsRef: {
12
+ [key: number]: MyObject;
13
+ };
14
+ interval?: number;
15
+ initDate?: number;
16
+ get enabled(): boolean;
17
+ set enabled(_newVal: boolean);
18
+ initializeInterval(): void;
19
+ getObjectId(object: MyObject): number;
20
+ addEvent(object: MyObject, method: string): void;
21
+ incrementNotifications(object: MyObject): void;
22
+ }
23
+ declare const _default: ProvidersLoggerOld;
24
+ export default _default;
@@ -0,0 +1,34 @@
1
+ import { Attitude, UserPosition } from '@wemap/geo';
2
+ import { Vector16_t, Vector3_t } from '@wemap/maths';
3
+ export type Acceleration = Readonly<{
4
+ readonly timestamp: number;
5
+ readonly values: Vector3_t;
6
+ }>;
7
+ export type AngularRate = Readonly<{
8
+ readonly timestamp: number;
9
+ readonly values: Vector3_t;
10
+ }>;
11
+ export type HighRotation = Readonly<{
12
+ readonly timestamp: number;
13
+ }>;
14
+ export type MagnetometerNeedCalibration = Readonly<{
15
+ readonly angle: number;
16
+ }>;
17
+ export declare class RelativeAttitude extends Attitude {
18
+ }
19
+ export declare class AbsoluteAttitude extends Attitude {
20
+ }
21
+ export declare class AbsolutePosition extends UserPosition {
22
+ }
23
+ export type Inclination = number;
24
+ export type Barcode = string;
25
+ export type Step = {
26
+ readonly size: number;
27
+ readonly number: number;
28
+ };
29
+ export type Turn = {
30
+ readonly timestamp: number;
31
+ };
32
+ export type StraightLine = boolean;
33
+ export type CameraProjectionMatrix = Vector16_t;
34
+ export type CameraNativeState = 'started' | 'stopped';
@@ -0,0 +1,93 @@
1
+ import { UserPosition, Coordinates } from '@wemap/geo';
2
+ import { Graph, GraphProjection, Itinerary, ItineraryInfoManager, Vertex } from '@wemap/routers';
3
+ import { default as Provider } from '../providers/Provider.js';
4
+ import { AbsolutePosition } from '../events/Types.js';
5
+ type MapMatchingEvent = {
6
+ graph?: Graph;
7
+ itinerary?: Itinerary | null;
8
+ };
9
+ declare class MapMatchingHandler extends Provider<MapMatchingEvent> {
10
+ static DEFAULT_MM_MAX_ANGLE: number;
11
+ static DEFAULT_MM_MAX_DIST: number;
12
+ static DEFAULT_MM_MIN_DIST: number;
13
+ static DEFAULT_USE_ITINERARY_START_AS_POSITION: boolean;
14
+ static DEFAULT_USE_ORIENTATION_MATCHING: boolean;
15
+ static DEFAULT_MM_HUGE_JUMP_DISTANCE: number;
16
+ static DEFAULT_DISABLE_MM_CLOSE_TO_A_TURN_DISTANCE: number;
17
+ static DEFAULT_MIN_STEPS_BETWEEN_ORIENTATION_MATCHING: number;
18
+ static DEFAULT_MIN_STEPS_FOR_ORIENTATION_MATCHING: number;
19
+ static DEFAULT_LAST_PROJECTIONS_WINDOW_SIZE: number;
20
+ static DEFAULT_LAST_PROJECTIONS_EDGE_ANGLE_THRESHOLD: number;
21
+ _mapMatchingMaxDistance: number;
22
+ _mapMatchingMinDistance: number;
23
+ _mapMatchingMaxAngleBearing: number;
24
+ _useItineraryStartAsPosition: boolean;
25
+ _useOrientationMatching: boolean;
26
+ _hugeJumpDistance: number;
27
+ _disableMMCloseToATurnDistance: number;
28
+ _minStepsBetweenOrientationMatching: number;
29
+ _minStepsForOrientationMatching: number;
30
+ _lastProjectionsWindowSize: number;
31
+ _lastProjectionsEdgeAngleThreshold: number;
32
+ _graph: Graph | null;
33
+ _internalProvidersStarted: boolean;
34
+ _straightLineProviderId?: number;
35
+ _turnProviderId?: number;
36
+ _stepProviderId?: number;
37
+ _projectionsWithAbsAndWithoutRelAttitudeInARow: GraphProjection[];
38
+ _countStepsFromLastMatching: number;
39
+ _lastProjections: GraphProjection[];
40
+ _itineraryInfoManager: ItineraryInfoManager | null;
41
+ getName: () => string;
42
+ availability: () => Promise<void>;
43
+ start(): void;
44
+ stop(): void;
45
+ _manageStartStop: () => void;
46
+ _startInternalProviders(): void;
47
+ _stopInternalProviders(): void;
48
+ get enabled(): boolean;
49
+ get graph(): Graph | null;
50
+ set graph(graph: Graph | null);
51
+ set itinerary(itinerary: Itinerary | null);
52
+ canUseMapMatching(): false | Graph | null;
53
+ private _notifyPositionFromItineraryInput;
54
+ notifyPositionFromFeed(newPositionEvent: AbsolutePosition): void;
55
+ /**
56
+ * @returns if input position is used by the system (true = used, false = discarded)
57
+ */
58
+ notifyPositionFromAbsolute(newPosition: AbsolutePosition): boolean;
59
+ /**
60
+ * @returns if input position is used by the system (true = used, false = discarded)
61
+ */
62
+ notifyPositionFromRelative(newPosition: AbsolutePosition): boolean;
63
+ _detectWrongBigJump(projection: GraphProjection<UserPosition>): boolean;
64
+ _areLastProjectionsInTheSameDirection(): boolean;
65
+ _nodeHasTurn(vertex: Vertex): boolean | undefined;
66
+ _hasTurnInCircle(center: Coordinates, radius: number): boolean;
67
+ tryOrientationMatching(projection: GraphProjection<UserPosition>): void;
68
+ getProjection(position: UserPosition, useDistance?: boolean, useBearing?: boolean): GraphProjection<UserPosition> | null | undefined;
69
+ get maxDistance(): number;
70
+ set maxDistance(maxDistance: number);
71
+ get minDistance(): number;
72
+ set minDistance(minDistance: number);
73
+ get maxAngleBearing(): number;
74
+ set maxAngleBearing(maxAngleBearing: number);
75
+ get useItineraryStartAsPosition(): boolean;
76
+ set useItineraryStartAsPosition(useItineraryStartAsPosition: boolean);
77
+ get useOrientationMatching(): boolean;
78
+ set useOrientationMatching(useOrientationMatching: boolean);
79
+ get hugeJumpDistance(): number;
80
+ set hugeJumpDistance(hugeJumpDistance: number);
81
+ get disableMMCloseToATurnDistance(): number;
82
+ set disableMMCloseToATurnDistance(disableMMCloseToATurnDistance: number);
83
+ get minStepsBetweenOrientationMatching(): number;
84
+ set minStepsBetweenOrientationMatching(minStepsBetweenOrientationMatching: number);
85
+ get minStepsForOrientationMatching(): number;
86
+ set minStepsForOrientationMatching(minStepsForOrientationMatching: number);
87
+ get lastProjectionsWindowSize(): number;
88
+ set lastProjectionsWindowSize(lastProjectionsWindowSize: number);
89
+ get lastProjectionsEdgeAngleThreshold(): number;
90
+ set lastProjectionsEdgeAngleThreshold(lastProjectionsEdgeAngleThreshold: number);
91
+ }
92
+ declare const _default: MapMatchingHandler;
93
+ export default _default;
@@ -0,0 +1,4 @@
1
+ declare const Constants: {
2
+ DEFAULT_ALTITUDE: number;
3
+ };
4
+ export default Constants;
@@ -1,12 +1,7 @@
1
- //-----------------
2
- // Native Interface
3
- //-----------------
4
-
5
1
  export interface NativeInterface {
6
- getArCoreProvider: () => NativeArCore,
7
- getPoleStarProvider: () => NativePoleStar
2
+ getArCoreProvider: () => NativeArCore;
3
+ getPoleStarProvider: () => NativePoleStar;
8
4
  }
9
-
10
5
  export interface NativeArCore {
11
6
  checkAvailability(): boolean;
12
7
  start(): void;
@@ -15,23 +10,15 @@ export interface NativeArCore {
15
10
  enableBarcodeScanner(): void;
16
11
  disableBarcodeScanner(): void;
17
12
  }
18
-
19
13
  export interface NativePoleStar {
20
14
  checkAvailability(): boolean;
21
15
  start(): void;
22
16
  stop(): void;
23
17
  setApiKey(key: string): void;
24
18
  }
25
-
26
-
27
- //--------------------------
28
- // Native Callback Interface
29
- //--------------------------
30
-
31
19
  export interface NativeCallbackInterface {
32
20
  polestar?: NativeCallbackPoleStar;
33
21
  }
34
-
35
22
  export interface NativePolestarPosition {
36
23
  lat: number;
37
24
  lng: number;
@@ -40,15 +27,7 @@ export interface NativePolestarPosition {
40
27
  accuracy: number;
41
28
  bearing: number;
42
29
  }
43
-
44
30
  export interface NativeCallbackPoleStar {
45
31
  callbackError(errorMessage: string): void;
46
32
  callbackPosition(jsonString: string): void;
47
33
  }
48
-
49
- // declare global {
50
- // interface Window {
51
- // __nativeProviders?: NativeInterface;
52
- // __nativeJsProviders?: NativeCallbackInterface;
53
- // }
54
- // }
@@ -0,0 +1,64 @@
1
+ import { ProviderState } from './ProviderState.js';
2
+ import { AvailabilityPromise } from '../events/AvailabilityHelper.js';
3
+ import { NativeCallbackInterface, NativeInterface } from './NativeProviders.js';
4
+ declare global {
5
+ interface Window {
6
+ __nativeProviders?: NativeInterface;
7
+ __nativeJsProviders?: NativeCallbackInterface;
8
+ }
9
+ }
10
+ /**
11
+ * A provider is a meta class to define an entity which can be
12
+ * started / stopped and provides a data of <E>
13
+ */
14
+ declare abstract class Provider<E> {
15
+ static _callbackUniqueId: number;
16
+ static _uniqueId: number;
17
+ id: number;
18
+ state: ProviderState;
19
+ _lastEvent: E | null;
20
+ _eventsCallbacks: {
21
+ id: number;
22
+ onEvent: ((event: E) => void) | null;
23
+ onError: ((error: Error) => void) | null;
24
+ optional: boolean;
25
+ }[];
26
+ _monitoringCallbacks: {
27
+ id: number;
28
+ onStarted: (() => void) | null;
29
+ onStopped: (() => void) | null;
30
+ }[];
31
+ /**
32
+ * Provider constructor
33
+ */
34
+ constructor();
35
+ /**
36
+ * Get the provider name
37
+ */
38
+ abstract getName(): string;
39
+ /**
40
+ * Resolve with an error if the provider is not available
41
+ */
42
+ getAvailability(): AvailabilityPromise;
43
+ protected abstract availability(): AvailabilityPromise;
44
+ protected get hasNativeInterface(): boolean;
45
+ protected get nativeInterface(): NativeInterface | null;
46
+ protected get nativeJsInterface(): NativeCallbackInterface | null;
47
+ get useCameraNatively(): boolean;
48
+ addEventListener(onEvent?: ((events: E) => void) | null, onError?: ((error: Error) => void) | null, startIfNecessary?: boolean): number;
49
+ removeEventListener(callbackUniqueId?: number): void;
50
+ addMonitoringListener(onStarted?: (() => void) | null, onStopped?: (() => void) | null): number;
51
+ removeMonitoringListener(callbackUniqueId?: number): void;
52
+ protected abstract start(): void;
53
+ protected abstract stop(): void;
54
+ /**
55
+ * Notify the subscriber defined in {@link addEventListener}
56
+ */
57
+ notify: (event: E) => void;
58
+ /**
59
+ * Notify the subscriber defined in {@link addEventListener}
60
+ */
61
+ notifyError: (error: Error) => void;
62
+ get lastEvent(): E | null;
63
+ }
64
+ export default Provider;
@@ -0,0 +1,41 @@
1
+ import { Matrix3_t, Matrix4_t, Quaternion_t, Vector3_t, Vector4_t } from '@wemap/maths';
2
+ type RelativeNoises = {
3
+ acc: number;
4
+ gyr: number;
5
+ };
6
+ type AbsoluteNoises = {
7
+ acc: number;
8
+ gyr: number;
9
+ yc: number;
10
+ };
11
+ type RelativeNoisesMat = {
12
+ acc: Matrix3_t;
13
+ gyr: Matrix3_t;
14
+ };
15
+ type AbsoluteNoisesMat = {
16
+ acc: Matrix3_t;
17
+ gyr: Matrix3_t;
18
+ yc: Matrix3_t;
19
+ };
20
+ declare class EkfAttitude {
21
+ P: Matrix4_t;
22
+ accRef: Vector3_t;
23
+ cRef: Vector3_t;
24
+ noises: {
25
+ relative: RelativeNoisesMat;
26
+ absolute: AbsoluteNoisesMat;
27
+ };
28
+ quaternion: Quaternion_t | null;
29
+ constructor(accRef?: Vector3_t, ycRef?: Vector3_t);
30
+ setRelativeNoises(relativeNoises: RelativeNoises): void;
31
+ setAbsoluteNoises(absoluteNoises: AbsoluteNoises): void;
32
+ /**
33
+ * Try to initialize filter.
34
+ * To initialize, we need at least current acceleration (acc)
35
+ */
36
+ tryInitialize(acc: Vector3_t, mag?: Vector3_t): Quaternion_t;
37
+ update(diffTime: number, acc: Vector3_t, gyr: Vector3_t, mag?: Vector3_t): Quaternion_t;
38
+ computeC(b: Vector4_t): Matrix4_t;
39
+ jacobianES(q: Quaternion_t, v: Vector3_t): number[][];
40
+ }
41
+ export default EkfAttitude;
@@ -0,0 +1,17 @@
1
+ import { default as Provider } from '../Provider.js';
2
+ import { Turn } from '../../events/Types.js';
3
+ declare class TurnProvider extends Provider<Turn> {
4
+ static SLIDING_WINDOW_TIME: number;
5
+ static STD_THRESHOLD: number;
6
+ static CONSIDER_TURN_UNTIL: number;
7
+ providerId?: number;
8
+ slidingWindow: [number, number][];
9
+ getName: () => string;
10
+ availability: () => import('../../events/AvailabilityHelper.js').AvailabilityPromise;
11
+ start(): void;
12
+ stop(): void;
13
+ isTurning(): boolean;
14
+ private _parseRelativeAttitude;
15
+ }
16
+ declare const _default: TurnProvider;
17
+ export default _default;
@@ -0,0 +1,60 @@
1
+ import { Quaternion_t } from '@wemap/maths';
2
+ import { default as Provider } from '../../Provider.js';
3
+ import { default as AskImuOnDesktopError } from '../../../errors/AskImuOnDesktopError.js';
4
+ import { AbsoluteAttitude, AbsolutePosition } from '../../../events/Types.js';
5
+ export interface DeviceOrientationEventiOS extends DeviceOrientationEvent {
6
+ webkitCompassHeading: number | null;
7
+ webkitCompassAccuracy: number | null;
8
+ requestPermission?: () => Promise<'granted' | 'denied'>;
9
+ }
10
+ declare global {
11
+ interface Window {
12
+ addEventListener(evtName: 'deviceorientationabsolute', cb: (evt: DeviceOrientationEvent) => void, options?: boolean): void;
13
+ addEventListener(evtName: 'deviceorientation', cb: (evt: DeviceOrientationEventiOS) => void, options?: boolean): void;
14
+ removeEventListener(evtName: 'deviceorientationabsolute', cb: (evt: DeviceOrientationEvent) => void, options?: boolean): void;
15
+ removeEventListener(evtName: 'deviceorientation', cb: (evt: DeviceOrientationEventiOS) => void, options?: boolean): void;
16
+ }
17
+ }
18
+ /**
19
+ * Absolute attitude provider gives the device attitude in East-North-Up (ENU) frame using
20
+ * browser deviceorientation or deviceorientationabsolute
21
+ * The provider does not work until an AbsolutePosition is given. This is necessary to
22
+ * calculate declination.
23
+ *
24
+ * -----------------------------------
25
+ * Overview of compatibilities:
26
+ * -----------------------------------
27
+ *
28
+ * Chrome Android (v72.0.3626): YES (via deviceorientationabsolute)
29
+ * Safari iOS (v12.0): YES (via deviceorientation and event.webkitCompassHeading)
30
+ * Opera Android (v50.2.2426): NO {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/ondeviceorientation}
31
+ * Firefox Android (v65.0.1): NO {@link https://www.fxsitecompat.com/en-CA/docs/2018/various-device-sensor-apis-are-now-deprecated/}
32
+ *
33
+ * -----------------------------------
34
+ */
35
+ declare class AbsoluteAttitudeFromBrowser extends Provider<AbsoluteAttitude> {
36
+ DEFAULT_ACCURACY: number;
37
+ absolutePositionProviderId?: number;
38
+ absolutePositionEvent?: AbsolutePosition;
39
+ declinationQuaternion?: Quaternion_t;
40
+ magQuaternion?: Quaternion_t;
41
+ magQuaternionTimestamp?: number;
42
+ iosPreviousQuat?: Quaternion_t;
43
+ iosIsSkyMode: boolean | null;
44
+ getName: () => string;
45
+ availability(): Promise<void> | Promise<AskImuOnDesktopError>;
46
+ start(): void;
47
+ stop(): void;
48
+ onDeviceOrientationChromeEvent: (e: DeviceOrientationEvent) => void;
49
+ onDeviceOrientationSafariEvent: (e: DeviceOrientationEventiOS) => void;
50
+ compute(): void;
51
+ /**
52
+ * Initialized declination quaternion using current position.
53
+ * This method should be theoretically called every time the user moves.
54
+ * But in reality declination does not change as much.
55
+ */
56
+ onAbsolutePositionEvent: (position: AbsolutePosition) => void;
57
+ static webkitCompassToHeading(_webkitCompassHeading: number, _beta: number, _gamma: number): number;
58
+ }
59
+ declare const _default: AbsoluteAttitudeFromBrowser;
60
+ export default _default;
@@ -0,0 +1,44 @@
1
+ import { AbsoluteHeading } from '@wemap/geo';
2
+ import { Quaternion_t } from '@wemap/maths';
3
+ import { default as Provider } from '../../Provider.js';
4
+ import { AbsoluteAttitude, RelativeAttitude } from '../../../events/Types.js';
5
+ /**
6
+ * Absolute attitude provider gives the device attitude in East-North-Up (ENU) frame
7
+ */
8
+ declare class AbsoluteAttitudeProvider extends Provider<AbsoluteAttitude> {
9
+ static REL_ABS_DIVERGENCE_ANGLE_THRESHOLD: number;
10
+ static REL_ABS_DIVERGENCE_TIME_THRESHOLD: number;
11
+ static REL_ABS_DIVERGENCE_INCLINATION_THRESHOLD: number;
12
+ private _absAttitudeFromBrowser?;
13
+ private _vpsProviderId?;
14
+ fromBrowserProviderId?: number;
15
+ highRotationProviderId?: number;
16
+ inclinationProviderId?: number;
17
+ relativeAttitudeProviderId?: number;
18
+ _attitudeFromBrowserErrored: boolean;
19
+ _attitudeFromRelativeErrored: boolean;
20
+ _relativeAttitude: RelativeAttitude | null;
21
+ _relativeAccuracy: number;
22
+ _lastForcedHeadingEvent?: AbsoluteAttitude | AbsoluteHeading;
23
+ _relAbsQuat?: Quaternion_t;
24
+ _wasHighRotationInProgress: boolean;
25
+ _timeFirstDivergence: number | null;
26
+ _callbackMagCalibration?: (data: {
27
+ angle: number;
28
+ }) => void;
29
+ getName: () => string;
30
+ availability(): import('../../../events/AvailabilityHelper.js').AvailabilityPromise;
31
+ start(): void;
32
+ stop(): void;
33
+ _setCallbackMagCalibration(cb: (data: {
34
+ angle: number;
35
+ }) => void): void;
36
+ private _onError;
37
+ _forceHeadingForRelative: (absoluteHeadingEvent: AbsoluteAttitude | AbsoluteHeading) => void;
38
+ _onRelativeAttitudeEvent: (event: RelativeAttitude) => void;
39
+ _onAttitudeFromBrowser: (event: AbsoluteAttitude) => void;
40
+ _onAttitudeFromVps: (event: AbsoluteAttitude) => void;
41
+ feed(data: AbsoluteHeading | AbsoluteAttitude): void;
42
+ }
43
+ declare const _default: AbsoluteAttitudeProvider;
44
+ export default _default;
@@ -0,0 +1,31 @@
1
+ import { default as Provider } from '../../Provider.js';
2
+ import { default as AskImuOnDesktopError } from '../../../errors/AskImuOnDesktopError.js';
3
+ import { RelativeAttitude } from '../../../events/Types.js';
4
+ /**
5
+ * Relative attitude provider gives the device attitude in a custom frame (x-right, y-front, z-up) using
6
+ * browser deviceorientation
7
+ *
8
+ * -----------------------------------
9
+ * Overview of compatibilities:
10
+ * -----------------------------------
11
+ *
12
+ * Chrome Android (v72.0.3626): YES (via deviceorientation but deviceorientation.alpha is unreliable! Sometimes it starts at 0°, sometimes at 270°)
13
+ * Safari iOS (v12.0): YES (via deviceorientation)
14
+ * Opera Android (v50.2.2426): NO {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/ondeviceorientation}
15
+ * Firefox Android (v65.0.1): YES (via deviceorientation)
16
+ *
17
+ * -----------------------------------
18
+ */
19
+ declare class RelativeAttitudeFromBrowser extends Provider<RelativeAttitude> {
20
+ /**
21
+ * default relative attitude drift in rad.second-1
22
+ */
23
+ static DEFAULT_DRIFT: number;
24
+ getName: () => string;
25
+ availability(): Promise<void> | Promise<AskImuOnDesktopError>;
26
+ start(): void;
27
+ stop(): void;
28
+ onDeviceOrientationEvent: (e: DeviceOrientationEvent) => void;
29
+ }
30
+ declare const _default: RelativeAttitudeFromBrowser;
31
+ export default _default;
@@ -0,0 +1,26 @@
1
+ import { default as Provider } from '../../Provider.js';
2
+ import { default as EkfAttitude } from '../EkfAttitude.js';
3
+ import { AngularRate, RelativeAttitude } from '../../../events/Types.js';
4
+ /**
5
+ * Relative attitude provider gives the device attitude in East-North-Up (ENU) frame using
6
+ * browser deviceorientation
7
+ * The provider does not work until an offset is given.
8
+ */
9
+ declare class RelativeAttitudeFromEkf extends Provider<RelativeAttitude> {
10
+ /**
11
+ * default relative attitude drift in rad.second-1
12
+ */
13
+ static DEFAULT_DRIFT: number;
14
+ accelerometerProviderId?: number;
15
+ ekfAttitude: EkfAttitude;
16
+ gyroscopeEvent?: AngularRate;
17
+ gyroscopeProviderId?: number;
18
+ lastTimestamp: number;
19
+ getName: () => string;
20
+ availability(): import('../../../events/AvailabilityHelper.js').AvailabilityPromise;
21
+ start(): void;
22
+ stop(): void;
23
+ private onAccelerometerEvent;
24
+ }
25
+ declare const _default: RelativeAttitudeFromEkf;
26
+ export default _default;