@7365admin1/core 3.122.1 → 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/CHANGELOG.md +12 -0
- package/dist/index.d.ts +49 -1
- package/dist/index.js +48 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/padbot.test.mjs +76 -0
package/dist/index.mjs
CHANGED
|
@@ -64698,6 +64698,16 @@ function padbotCanReachMap(maps, fromMapId, toMapId) {
|
|
|
64698
64698
|
};
|
|
64699
64699
|
return group(fromMapId) !== "" && group(fromMapId) === group(toMapId);
|
|
64700
64700
|
}
|
|
64701
|
+
function padbotCurrentMap(maps, ids2, floor) {
|
|
64702
|
+
const list = (Array.isArray(maps) ? maps : []).filter((m) => typeof m?.mapId === "string" && m.mapId);
|
|
64703
|
+
for (const id of ids2) {
|
|
64704
|
+
const hit = typeof id === "string" && id ? list.find((m) => m.mapId === id) : null;
|
|
64705
|
+
if (hit)
|
|
64706
|
+
return hit;
|
|
64707
|
+
}
|
|
64708
|
+
const onFloor = Number.isInteger(floor) ? list.filter((m) => m.floor === floor) : [];
|
|
64709
|
+
return onFloor.length === 1 ? onFloor[0] : null;
|
|
64710
|
+
}
|
|
64701
64711
|
var PADBOT_OTHER_MAP_TEXT = "The robot must be on this map first.";
|
|
64702
64712
|
function padbotAlarmFault(alarm) {
|
|
64703
64713
|
if (!alarm?.alarmType)
|
|
@@ -64996,13 +65006,22 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
64996
65006
|
]);
|
|
64997
65007
|
const lx = num(loc?.worldX ?? loc?.x);
|
|
64998
65008
|
const ly = num(loc?.worldY ?? loc?.y);
|
|
65009
|
+
if (typeof loc?.mapId === "string" && loc.mapId)
|
|
65010
|
+
robot.mapId = loc.mapId;
|
|
65011
|
+
const map = await maps(robotSn).then((all) => padbotCurrentMap(all, [robot.mapId, st["1007"]?.mapId], robot.floorNo)).catch(() => null);
|
|
65012
|
+
if (map)
|
|
65013
|
+
robot.mapId = map.mapId;
|
|
64999
65014
|
if (lx !== null && ly !== null) {
|
|
65000
65015
|
robot.position = { x: lx, y: ly, theta: (num(loc.yaw ?? loc.r) ?? 0) * Math.PI / 180 };
|
|
65001
|
-
if (typeof loc.mapId === "string" && loc.mapId)
|
|
65002
|
-
robot.mapId = loc.mapId;
|
|
65003
|
-
const map = await maps(robotSn).then((all) => (all ?? []).find((m) => m.mapId === (loc.mapId ?? st["1007"]?.mapId))).catch(() => null);
|
|
65004
65016
|
robot.planPosition = padbotPlanShare(map, lx, ly);
|
|
65005
65017
|
}
|
|
65018
|
+
const last = heard?.pose;
|
|
65019
|
+
if (!robot.position && last && (last.mapId === null || last.mapId === robot.mapId) && (robot.mode === "IDLE" || robot.mode === "CHARGING_CYCLE" || robot.mode === "CHARGED")) {
|
|
65020
|
+
robot.position = { x: last.x, y: last.y, theta: (last.yawDeg ?? 0) * Math.PI / 180 };
|
|
65021
|
+
robot.planPosition = padbotPlanShare(map, last.x, last.y);
|
|
65022
|
+
const mins = Math.floor((now() - last.at) / 6e4);
|
|
65023
|
+
robot.statusName = `${robot.statusName} \xB7 Last reported position${mins >= 1 ? ` (${mins} min ago)` : ""}`;
|
|
65024
|
+
}
|
|
65006
65025
|
if (!robot.position)
|
|
65007
65026
|
robot.statusName = `${robot.statusName} \xB7 Position not reported`;
|
|
65008
65027
|
if (alarm)
|
|
@@ -65185,6 +65204,27 @@ function registerPadbotBrand() {
|
|
|
65185
65204
|
registerPadbotBrand();
|
|
65186
65205
|
|
|
65187
65206
|
// src/services/robot-fleet.service.ts
|
|
65207
|
+
function fleetStateItem(id, s, lastSeenAt) {
|
|
65208
|
+
return {
|
|
65209
|
+
id,
|
|
65210
|
+
ok: true,
|
|
65211
|
+
monitorable: true,
|
|
65212
|
+
online: s.online,
|
|
65213
|
+
mode: s.mode,
|
|
65214
|
+
statusName: s.statusName,
|
|
65215
|
+
model: s.model,
|
|
65216
|
+
batteryPercent: s.batteryPercent,
|
|
65217
|
+
floorNo: s.floorNo,
|
|
65218
|
+
floorKnown: s.floorKnown,
|
|
65219
|
+
mapId: s.mapId ?? null,
|
|
65220
|
+
position: s.position,
|
|
65221
|
+
planPosition: s.planPosition,
|
|
65222
|
+
fault: s.fault,
|
|
65223
|
+
capabilities: s.capabilities,
|
|
65224
|
+
profile: s.profile,
|
|
65225
|
+
lastSeenAt: lastSeenAt ? new Date(lastSeenAt) : null
|
|
65226
|
+
};
|
|
65227
|
+
}
|
|
65188
65228
|
var OUNITECH_REGION_BASE_URLS = [
|
|
65189
65229
|
"https://app.frankfurt.robotcloud.top",
|
|
65190
65230
|
"https://app.singapore.robotcloud.top",
|
|
@@ -69987,24 +70027,7 @@ async function readLiveItems(robots) {
|
|
|
69987
70027
|
if (s.fault)
|
|
69988
70028
|
void notifyRobotFault(robot, s.fault);
|
|
69989
70029
|
const seen2 = liveEntry(id)?.lastSeenAt;
|
|
69990
|
-
items.push(
|
|
69991
|
-
id,
|
|
69992
|
-
ok: true,
|
|
69993
|
-
monitorable: true,
|
|
69994
|
-
online: s.online,
|
|
69995
|
-
mode: s.mode,
|
|
69996
|
-
statusName: s.statusName,
|
|
69997
|
-
model: s.model,
|
|
69998
|
-
batteryPercent: s.batteryPercent,
|
|
69999
|
-
floorNo: s.floorNo,
|
|
70000
|
-
floorKnown: s.floorKnown,
|
|
70001
|
-
position: s.position,
|
|
70002
|
-
planPosition: s.planPosition,
|
|
70003
|
-
fault: s.fault,
|
|
70004
|
-
capabilities: s.capabilities,
|
|
70005
|
-
profile: s.profile,
|
|
70006
|
-
lastSeenAt: seen2 ? new Date(seen2) : null
|
|
70007
|
-
});
|
|
70030
|
+
items.push(fleetStateItem(id, s, seen2));
|
|
70008
70031
|
} catch (e) {
|
|
70009
70032
|
const text2 = String(e?.message ?? "");
|
|
70010
70033
|
items.push({
|
|
@@ -104912,6 +104935,7 @@ export {
|
|
|
104912
104935
|
ffmpegFrameArgs,
|
|
104913
104936
|
ffmpegPath,
|
|
104914
104937
|
filterByAccess,
|
|
104938
|
+
fleetStateItem,
|
|
104915
104939
|
floorNoOf,
|
|
104916
104940
|
floorPlanBodySchema,
|
|
104917
104941
|
flushNotificationEmails,
|
|
@@ -105037,6 +105061,7 @@ export {
|
|
|
105037
105061
|
padbotCanReachMap,
|
|
105038
105062
|
padbotCheckpointVisit,
|
|
105039
105063
|
padbotCommandLog,
|
|
105064
|
+
padbotCurrentMap,
|
|
105040
105065
|
padbotDriveBlock,
|
|
105041
105066
|
padbotDriveLimits,
|
|
105042
105067
|
padbotDriveSignal,
|