@aibee/crc-bmap 0.8.28 → 0.8.29
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/lib/bmap.cjs.min.js +8 -8
- package/lib/bmap.esm.js +48 -309
- package/lib/bmap.esm.min.js +8 -8
- package/lib/bmap.min.js +8 -8
- package/lib/src/elements/ground-texture.js +1 -1
- package/lib/src/plugins/navigation/navigation.d.ts +1 -1
- package/lib/src/plugins/navigation/navigation.js +1 -1
- package/lib/src/plugins/pdr-position/imu-position.js +42 -31
- package/lib/src/plugins/pdr-position/particle.js +3 -3
- package/package.json +1 -1
|
@@ -45,7 +45,7 @@ function _extends() {
|
|
|
45
45
|
import { initShape } from "../utils";
|
|
46
46
|
import { DoubleSide, Float32BufferAttribute, Mesh, MeshBasicMaterial, Object3D, ShapeGeometry } from "three";
|
|
47
47
|
import { mergeGeometries } from "three/examples/jsm/utils/BufferGeometryUtils";
|
|
48
|
-
import { ImgTextureFactory } from "
|
|
48
|
+
import { ImgTextureFactory } from "../factory";
|
|
49
49
|
export const defaultOptions = {
|
|
50
50
|
uuid: "",
|
|
51
51
|
iconUrl: "",
|
|
@@ -5,7 +5,7 @@ import { PathData2, TweenUtil, PathData, RoadData2 } from "../../utils";
|
|
|
5
5
|
import { Floor, Poi2, PoiOptions2 } from "../../elements";
|
|
6
6
|
import { Tween } from "@tweenjs/tween.js";
|
|
7
7
|
import { type NavigationProcessInfo, PositionNavigation, type PositionNavigationConfig } from "./position-navigation";
|
|
8
|
-
import TaskQueue from "
|
|
8
|
+
import TaskQueue from "../../utils/taskQueue";
|
|
9
9
|
import { StartRotateHelperPoi } from "./start-rotate-helper-poi";
|
|
10
10
|
export type Point = [number, number];
|
|
11
11
|
export { NavigationProcessInfo };
|
|
@@ -49,7 +49,7 @@ import { getDistanceByPathPos, getPosByPathDistance, simplifyPath } from "../../
|
|
|
49
49
|
import { Tween, Easing } from "@tweenjs/tween.js";
|
|
50
50
|
import { Vector3 } from "three";
|
|
51
51
|
import { PositionNavigation } from "./position-navigation";
|
|
52
|
-
import TaskQueue from "
|
|
52
|
+
import TaskQueue from "../../utils/taskQueue";
|
|
53
53
|
import { StartRotateHelperPoi } from "./start-rotate-helper-poi";
|
|
54
54
|
const defaultConfig = {
|
|
55
55
|
path: {},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as math from "mathjs";
|
|
1
|
+
// import * as math from "mathjs";
|
|
2
2
|
export class ImuPosition {
|
|
3
3
|
init() {
|
|
4
4
|
this.fre = 100; // IMU init frequency, dynamic adjust
|
|
@@ -269,36 +269,47 @@ export class ImuPosition {
|
|
|
269
269
|
*/ FFTStepDetec() {
|
|
270
270
|
// 一直返回false 先固定返回测试pdr效果
|
|
271
271
|
return true;
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
272
|
+
// let fft_detected_flag = false;
|
|
273
|
+
// const fft_fre = this.fre;
|
|
274
|
+
// const fft_size = this.accH_fifo_len; // 1.2s windows
|
|
275
|
+
// // FFT in short sliding window
|
|
276
|
+
// const fft_xs = this.accH_fifo.map(
|
|
277
|
+
// (value) => value - math.mean(this.accH_fifo)
|
|
278
|
+
// ); // remove bias
|
|
279
|
+
// const fft_xf = math.fft(fft_xs); // assuming math.fft exists, or use appropriate FFT library
|
|
280
|
+
// const fft_freqs = Array.from(
|
|
281
|
+
// { length: fft_size / 2 + 1 },
|
|
282
|
+
// (_, i) => i * (fft_fre / (2 * fft_size))
|
|
283
|
+
// ); // freqs
|
|
284
|
+
// const fft_amps = fft_xf.map((value) => Math.abs(value)); // amplitude
|
|
285
|
+
// // find main fre and amp, and judge
|
|
286
|
+
// const fft_max_amp = Math.max(...fft_amps);
|
|
287
|
+
// const main_fre_index = fft_amps.indexOf(fft_max_amp);
|
|
288
|
+
// if (
|
|
289
|
+
// fft_max_amp > this.fft_min_amp &&
|
|
290
|
+
// this.fft_min_fre < fft_freqs[main_fre_index] &&
|
|
291
|
+
// fft_freqs[main_fre_index] < this.fft_max_fre
|
|
292
|
+
// ) {
|
|
293
|
+
// // 0~4 Hz
|
|
294
|
+
// fft_detected_flag = true;
|
|
295
|
+
// }
|
|
296
|
+
// this.last_fft_amp = fft_max_amp;
|
|
297
|
+
// // abnormal gait detect(small amplitude steps)
|
|
298
|
+
// let abnor_fft_max_amp = 0;
|
|
299
|
+
// this.abnor_fft_detected = false;
|
|
300
|
+
// for (let i = 0; i < fft_freqs.length; i++) {
|
|
301
|
+
// if (
|
|
302
|
+
// fft_amps[i] > abnor_fft_max_amp &&
|
|
303
|
+
// this.fft_min_fre < fft_freqs[i] &&
|
|
304
|
+
// fft_freqs[i] < this.fft_max_fre
|
|
305
|
+
// ) {
|
|
306
|
+
// abnor_fft_max_amp = fft_amps[i];
|
|
307
|
+
// }
|
|
308
|
+
// }
|
|
309
|
+
// if (abnor_fft_max_amp > this.fft_min_amp - 0.1) {
|
|
310
|
+
// this.abnor_fft_detected = true;
|
|
311
|
+
// }
|
|
312
|
+
// return fft_detected_flag;
|
|
302
313
|
}
|
|
303
314
|
/**
|
|
304
315
|
* Get delta yaw from rotation
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { euclideanDist, gaussLikelihood, limitYaw } from "./utils";
|
|
2
|
-
import
|
|
2
|
+
import { reshape, multiply } from 'mathjs';
|
|
3
3
|
class ParticleFilter {
|
|
4
4
|
/**
|
|
5
5
|
* motionModelRotYaw 更新粒子的航向角。
|
|
@@ -113,12 +113,12 @@ class ParticleFilter {
|
|
|
113
113
|
this.particle_yawInitFlag = flag;
|
|
114
114
|
}
|
|
115
115
|
getResultX() {
|
|
116
|
-
const weightsAsMatrix =
|
|
116
|
+
const weightsAsMatrix = reshape(this.particleWeight, [
|
|
117
117
|
this.NumParticle,
|
|
118
118
|
1
|
|
119
119
|
]); // 100 x 1
|
|
120
120
|
// 计算加权和:weightedSum = particleX * weightsAsMatrix
|
|
121
|
-
const weightedSum =
|
|
121
|
+
const weightedSum = multiply(this.particleX, weightsAsMatrix); // 3 x 100 * 100 x 1 -> 3 x 1
|
|
122
122
|
this.xEst = weightedSum; // 更新 xEst
|
|
123
123
|
return this.xEst[0][0];
|
|
124
124
|
}
|