@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.
@@ -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 "src/factory";
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 "src/utils/taskQueue";
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 "src/utils/taskQueue";
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
- 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((value)=>value - math.mean(this.accH_fifo)); // remove bias
277
- const fft_xf = math.fft(fft_xs); // assuming math.fft exists, or use appropriate FFT library
278
- const fft_freqs = Array.from({
279
- length: fft_size / 2 + 1
280
- }, (_, i)=>i * (fft_fre / (2 * fft_size))); // freqs
281
- const fft_amps = fft_xf.map((value)=>Math.abs(value)); // amplitude
282
- // find main fre and amp, and judge
283
- const fft_max_amp = Math.max(...fft_amps);
284
- const main_fre_index = fft_amps.indexOf(fft_max_amp);
285
- if (fft_max_amp > this.fft_min_amp && this.fft_min_fre < fft_freqs[main_fre_index] && fft_freqs[main_fre_index] < this.fft_max_fre) {
286
- // 0~4 Hz
287
- fft_detected_flag = true;
288
- }
289
- this.last_fft_amp = fft_max_amp;
290
- // abnormal gait detect(small amplitude steps)
291
- let abnor_fft_max_amp = 0;
292
- this.abnor_fft_detected = false;
293
- for(let i = 0; i < fft_freqs.length; i++){
294
- if (fft_amps[i] > abnor_fft_max_amp && this.fft_min_fre < fft_freqs[i] && fft_freqs[i] < this.fft_max_fre) {
295
- abnor_fft_max_amp = fft_amps[i];
296
- }
297
- }
298
- if (abnor_fft_max_amp > this.fft_min_amp - 0.1) {
299
- this.abnor_fft_detected = true;
300
- }
301
- return fft_detected_flag;
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 * as math from 'mathjs';
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 = math.reshape(this.particleWeight, [
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 = math.multiply(this.particleX, weightsAsMatrix); // 3 x 100 * 100 x 1 -> 3 x 1
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aibee/crc-bmap",
3
- "version": "0.8.28",
3
+ "version": "0.8.29",
4
4
  "description": "",
5
5
  "main": "lib/bmap.min.js",
6
6
  "module": "lib/bmap.esm.js",