@7365admin1/core 3.122.2 → 3.122.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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@7365admin1/core",
3
3
  "license": "MIT",
4
- "version": "3.122.2",
4
+ "version": "3.122.3",
5
5
  "author": "7365admin1",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",
@@ -24,6 +24,8 @@ import {
24
24
  padbotCheckpointVisit,
25
25
  padbotPlanShare,
26
26
  padbotCurrentMap,
27
+ padbotAccountKey,
28
+ recordPadbotLive,
27
29
  statesByType,
28
30
  } from "./.build/services/padbot.adapter.mjs";
29
31
  import { commandSupported, normalisePatrolPlan, robotTier } from "./.build/utils/robot-adapter.util.mjs";
@@ -600,8 +602,9 @@ const s2States = (mapId = S2_LVL3) => [
600
602
  ],
601
603
  },
602
604
  ];
603
- const s2Robot = (location, mapId) => {
605
+ const s2Robot = (location, mapId, heardPose) => {
604
606
  clearPadbotCache();
607
+ if (heardPose) recordPadbotLive(padbotAccountKey(CREDS), "PS8517", { pose: heardPose });
605
608
  const f = fakePadbot({
606
609
  [PADBOT_PATHS.states]: () => s2States(mapId),
607
610
  [PADBOT_PATHS.robots]: () => [{ serialNumber: "PS8517", robotName: "HERO-OTH-SECURITY", robotType: "PATROL", robotModel: "S2" }],
@@ -640,3 +643,14 @@ test("/robots/states row carries mapId (the map screens draw the pin only on the
640
643
  assert.equal(row.mapId, S2_LVL3);
641
644
  assert.equal(fleetStateItem("r2", { mapId: undefined }).mapId, null);
642
645
  });
646
+
647
+ test("real S2: PadBot's REST gives null coordinates while standing still -> its last MQTT position on this map, with its age", async () => {
648
+ const r = await s2Robot({ mapId: S2_LVL3, worldX: null, worldY: null, yaw: -94 }, undefined, { mapId: S2_LVL3, x: -13.89, y: 8.83, yawDeg: -94, at: NOW - 125_000 });
649
+ assert.deepEqual(r.planPosition, padbotPlanShare(S2_MAPS[1], -13.89, 8.83));
650
+ assert.match(r.statusName, /Last reported position \(2 min ago\)$/);
651
+ // a pose heard on ANOTHER map is not used
652
+ const other = await s2Robot({ mapId: S2_LVL3, worldX: null, worldY: null, yaw: -94 }, undefined, { mapId: S2_MAPS[0].mapId, x: 1, y: 1, yawDeg: 0, at: NOW - 125_000 });
653
+ assert.equal(other.position, null);
654
+ assert.match(other.statusName, /Position not reported$/);
655
+ clearPadbotCache();
656
+ });