@wemap/positioning 2.7.1 → 2.7.3

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.
package/package.json CHANGED
@@ -8,11 +8,11 @@
8
8
  "Guillaume Pannetier <guillaume.pannetier@getwemap.com>"
9
9
  ],
10
10
  "dependencies": {
11
- "@wemap/geo": "^2.7.1",
12
- "@wemap/graph": "^2.7.1",
11
+ "@wemap/geo": "^2.7.2",
12
+ "@wemap/graph": "^2.7.2",
13
13
  "@wemap/logger": "^2.7.0",
14
- "@wemap/maths": "^2.7.0",
15
- "@wemap/osm": "^2.7.1",
14
+ "@wemap/maths": "^2.7.2",
15
+ "@wemap/osm": "^2.7.2",
16
16
  "@wemap/utils": "^2.7.0",
17
17
  "geomagnetism": "^0.1.0",
18
18
  "lodash.isempty": "^4.4.0",
@@ -71,6 +71,6 @@
71
71
  "lint": "eslint --ext .js,.jsx --quiet src",
72
72
  "test": "mocha -r esm \"src/**/*.spec.js\""
73
73
  },
74
- "version": "2.7.1",
75
- "gitHead": "3d332f1dce308ba28f2a551c2e709e840c54bd83"
74
+ "version": "2.7.3",
75
+ "gitHead": "e4f4ccdfdb5a2aaa1f8d4ab2c062f1ff3a740a43"
76
76
  }
@@ -10,6 +10,8 @@ import ArCoreAbsoluteProvider from './providers/pose/ArCoreAbsoluteProvider';
10
10
  import GnssWifiProvider from './providers/position/GnssWifiProvider';
11
11
  import NoProviderFoundError from './errors/NoProviderFoundError';
12
12
  import Availability from './events/Availability';
13
+ import RelativeAttitudeProvider from './providers/attitude/RelativeAttitudeProvider';
14
+ import AbsoluteAttitudeProvider from './providers/attitude/AbsoluteAttitudeProvider';
13
15
 
14
16
  /**
15
17
  * @private
@@ -113,6 +115,30 @@ class PositioningHandler {
113
115
  throw availability.reason;
114
116
  }
115
117
 
118
+ const wantAbsoluteAttitude = eventsType.length === 1
119
+ && eventsType.includes(EventType.AbsoluteAttitude);
120
+
121
+ if (wantAbsoluteAttitude) {
122
+ if (canUse(AbsoluteAttitudeProvider)) {
123
+ return AbsoluteAttitudeProvider;
124
+ }
125
+ throw availability.reason;
126
+ }
127
+
128
+
129
+ const wantRelativeAttitude = eventsType.length === 1
130
+ && eventsType.includes(EventType.RelativeAttitude);
131
+
132
+ if (wantRelativeAttitude) {
133
+ if (!options.waitInputHeading) {
134
+ throw new NoProviderFoundError();
135
+ }
136
+ if (canUse(RelativeAttitudeProvider)) {
137
+ return RelativeAttitudeProvider;
138
+ }
139
+ throw availability.reason;
140
+ }
141
+
116
142
  throw new NoProviderFoundError();
117
143
  }
118
144
 
@@ -13,6 +13,9 @@ import ArCoreProvider from './providers/pose/ArCoreProvider';
13
13
  import { ProvidersName } from './providers/ProvidersList';
14
14
  import AskImuOnDesktopError from './errors/AskImuOnDesktopError';
15
15
  import ContainsIgnoredProviderError from './errors/ContainsIgnoredProviderError';
16
+ import AbsoluteAttitudeProvider from './providers/attitude/AbsoluteAttitudeProvider';
17
+ import NoProviderFoundError from './errors/NoProviderFoundError';
18
+ import RelativeAttitudeProvider from './providers/attitude/RelativeAttitudeProvider';
16
19
 
17
20
  const expect = chai.expect;
18
21
 
@@ -238,4 +241,51 @@ describe('PositioningHandler#findProvider', () => {
238
241
  ).to.throw(ContainsIgnoredProviderError);
239
242
  });
240
243
 
244
+ it('Absolute Attitude Desktop', () => {
245
+ config(CHROME_DESKTOP_USER_AGENT);
246
+ expect(
247
+ () => PositioningHandler.findProvider([EventType.AbsoluteAttitude])
248
+ ).to.throw(AskImuOnDesktopError);
249
+ });
250
+
251
+
252
+ it('Absolute Attitude Web', () => {
253
+ config(CHROME_ANDROID_USER_AGENT);
254
+ const provider = PositioningHandler.findProvider([EventType.AbsoluteAttitude]);
255
+ expect(provider).to.be.equals(AbsoluteAttitudeProvider);
256
+ });
257
+
258
+
259
+ it('Relative Attitude Desktop without waitInputHeading', () => {
260
+ config(CHROME_DESKTOP_USER_AGENT);
261
+ expect(
262
+ () => PositioningHandler.findProvider([EventType.RelativeAttitude])
263
+ ).to.throw(NoProviderFoundError);
264
+ });
265
+
266
+ it('Relative Attitude Desktop', () => {
267
+ config(CHROME_DESKTOP_USER_AGENT);
268
+ expect(() => PositioningHandler.findProvider(
269
+ [EventType.RelativeAttitude],
270
+ { waitInputHeading: true })
271
+ ).to.throw(AskImuOnDesktopError);
272
+ });
273
+
274
+ it('Relative Attitude Web without waitInputHeading', () => {
275
+ config(CHROME_ANDROID_USER_AGENT);
276
+ expect(
277
+ () => PositioningHandler.findProvider([EventType.RelativeAttitude])
278
+ ).to.throw(NoProviderFoundError);
279
+ });
280
+
281
+
282
+ it('Relative Attitude Web', () => {
283
+ config(CHROME_ANDROID_USER_AGENT);
284
+ const provider = PositioningHandler.findProvider(
285
+ [EventType.RelativeAttitude],
286
+ { waitInputHeading: true }
287
+ );
288
+ expect(provider).to.be.equals(RelativeAttitudeProvider);
289
+ });
290
+
241
291
  });
@@ -159,8 +159,8 @@ class EkfAttitude {
159
159
  const HAcc = this.jacobianES(qAPriori, this.accRef);
160
160
  H = Matrix.concatRow(HYc, HAcc);
161
161
 
162
- const RYc = Matrix.concatLine(this.noises.absolute.yc, Matrix3.zeros());
163
- const RAcc = Matrix.concatLine(Matrix3.zeros(), this.noises.absolute.accelerometer);
162
+ const RYc = Matrix.concatLine(this.noises.absolute.yc, Matrix3.zeros);
163
+ const RAcc = Matrix.concatLine(Matrix3.zeros, this.noises.absolute.accelerometer);
164
164
  const R = Matrix.concatRow(RYc, RAcc);
165
165
 
166
166
  K = Matrix.multiply(
@@ -200,7 +200,7 @@ class EkfAttitude {
200
200
  );
201
201
  const P = Matrix.multiply(
202
202
  Matrix4.subtract(
203
- Matrix.identity4(),
203
+ Matrix4.identity,
204
204
  Matrix.multiply(K, H)
205
205
  ),
206
206
  pAPriori