@aibee/crc-bmap 0.8.24 → 0.8.26

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
@@ -12214,7 +12214,6 @@ var Sensor = class extends EventDispatcher16 {
12214
12214
  }
12215
12215
  listenGps() {
12216
12216
  this.gpsTimer = navigator.geolocation.watchPosition((position) => {
12217
- console.log("position", position);
12218
12217
  this.addDataItem({
12219
12218
  type: "gps" /* GPS */,
12220
12219
  timestamp: Date.now(),
@@ -23921,6 +23920,7 @@ var PositioningSystem = class {
23921
23920
  position_count = 0;
23922
23921
  gps_max_horizontalAccuracy = 20;
23923
23922
  MaxEstimateErr = 5;
23923
+ GpsMaxEstimateErr = 30;
23924
23924
  outTrustRegionNum = 0;
23925
23925
  TrustNum = 4;
23926
23926
  cacheSensorData = [];
@@ -23969,11 +23969,10 @@ var PositioningSystem = class {
23969
23969
  if (this.using_gps && data_type === "gps" /* GPS */) {
23970
23970
  if (this.last_beacon_time === null || time - this.last_beacon_time > 5e3) {
23971
23971
  const gps_pos = this.getGpsPosition(data);
23972
- console.log("gps_pos", gps_pos);
23973
23972
  success = gps_pos !== null;
23974
23973
  if (gps_pos) {
23975
23974
  this.particleFilter.update(gps_pos, this.gps_horizontalAccuracy);
23976
- this.resetParticleFilterDist(gps_pos);
23975
+ this.resetParticleFilterDist(gps_pos, "gps", data[2]);
23977
23976
  this.particleFilter.resampling();
23978
23977
  this.position_count += 1;
23979
23978
  this.cacheSensorData.length = 0;
@@ -24052,13 +24051,16 @@ var PositioningSystem = class {
24052
24051
  * @returns
24053
24052
  */
24054
24053
  getGpsPosition(data) {
24054
+ if (data[2] > this.gps_max_horizontalAccuracy) {
24055
+ return null;
24056
+ }
24055
24057
  return wgs84ToWebMercator(data[0], data[1]);
24056
24058
  }
24057
- resetParticleFilterDist(pos) {
24059
+ resetParticleFilterDist(pos, type, accuracy) {
24058
24060
  const pfPosX = this.particleFilter.getResultX();
24059
24061
  const pfPosY = this.particleFilter.getResultY();
24060
24062
  const dist = euclideanDist(pfPosX, pfPosY, pos.x, pos.y);
24061
- if (dist > this.MaxEstimateErr) {
24063
+ if (type === "gps" ? accuracy && dist > accuracy || dist > this.GpsMaxEstimateErr : dist > this.MaxEstimateErr) {
24062
24064
  this.outTrustRegionNum += 1;
24063
24065
  if (this.outTrustRegionNum >= this.TrustNum) {
24064
24066
  console.info(`\u8D85\u51FA\u53EF\u4FE1\u533A\u57DF\uFF0C\u91CD\u7F6E\u7C92\u5B50\u8FC7\u6EE4\u5668\u5230: ${pos.x}, ${pos.y}`);