@aibee/crc-bmap 0.2.14 → 0.2.16

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.esm.js CHANGED
@@ -10948,7 +10948,7 @@ var Navigation = class extends Plugin {
10948
10948
  if (this.startPoi) {
10949
10949
  const azimuthalAngle = this.bmap.context.control.getAzimuthalAngle();
10950
10950
  const azimuthal = (azimuthalAngle * 180 / Math.PI + 360) % 360;
10951
- this.startPoi.options.icon_rotate = (180 - rotate - azimuthal) % 360;
10951
+ this.startPoi.options.icon_rotate = (360 - rotate - azimuthal) % 360;
10952
10952
  }
10953
10953
  }
10954
10954
  dispose() {
@@ -21545,6 +21545,10 @@ var ParticleFilter = class {
21545
21545
  // 粒子的权重
21546
21546
  last_compass_time;
21547
21547
  // 上次罗盘更新时间
21548
+ last_yaw_compass = 0;
21549
+ // 上次罗盘的航向角
21550
+ compass_consecutive_offset_count = 0;
21551
+ // 罗盘连续偏移次数
21548
21552
  constructor(parameters) {
21549
21553
  this.NumParticle = parameters.NumParticle;
21550
21554
  this.reSampNumParticle = parameters.reSampNumParticle;
@@ -21575,6 +21579,7 @@ var ParticleFilter = class {
21575
21579
  */
21576
21580
  motionModelRotYaw(delta_yaw) {
21577
21581
  if (Math.abs(delta_yaw) < 1e-3) return;
21582
+ this.last_yaw_compass = limitYaw(this.last_yaw_compass + delta_yaw);
21578
21583
  for (let index = 0; index < this.NumParticle; index++) {
21579
21584
  const yaw_noise = Math.random() * this.yaw_noise_sigma;
21580
21585
  this.particleX[2][index] = this.particleX[2][index] + delta_yaw + yaw_noise;
@@ -21610,6 +21615,14 @@ var ParticleFilter = class {
21610
21615
  let compass = 360 - compass_yaw;
21611
21616
  compass += this.delta_yaw;
21612
21617
  compass = limitYaw(compass);
21618
+ if (Math.abs(compass - this.last_yaw_compass) > 60) {
21619
+ this.compass_consecutive_offset_count++;
21620
+ } else {
21621
+ this.compass_consecutive_offset_count = 0;
21622
+ }
21623
+ if (this.compass_consecutive_offset_count >= 5) {
21624
+ this.initParticlesByCompass(compass_yaw);
21625
+ }
21613
21626
  for (let index = 0; index < this.NumParticle; index++) {
21614
21627
  let err_yaw = Math.abs(this.particleX[2][index] - compass);
21615
21628
  if (err_yaw > 180) err_yaw = 360 - err_yaw;
@@ -21782,6 +21795,8 @@ var ParticleFilter = class {
21782
21795
  }
21783
21796
  this.particle_yawInitFlag = true;
21784
21797
  this.xEst[2][0] = yaw_compass;
21798
+ this.last_yaw_compass = yaw_compass;
21799
+ this.compass_consecutive_offset_count = 0;
21785
21800
  }
21786
21801
  };
21787
21802