@7365admin1/core 3.123.0 → 3.124.1
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 +82 -4
- package/dist/index.js +148 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +141 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/console-audit.test.mjs +8 -0
- package/test/padbot-movement.test.mjs +157 -0
- package/test/padbot.test.mjs +4 -4
package/dist/index.mjs
CHANGED
|
@@ -10312,6 +10312,7 @@ var ConsoleAuditAction = /* @__PURE__ */ ((ConsoleAuditAction3) => {
|
|
|
10312
10312
|
ConsoleAuditAction3["ROBOT_MAP_REMOVED"] = "robot.map-removed";
|
|
10313
10313
|
ConsoleAuditAction3["ROBOT_LIFT_REQUESTED"] = "robot.lift-requested";
|
|
10314
10314
|
ConsoleAuditAction3["ROBOT_LIFT_RELEASED"] = "robot.lift-released";
|
|
10315
|
+
ConsoleAuditAction3["INVENTORY_STORE_TYPE_REPAIRED"] = "inventory.store-type-repaired";
|
|
10315
10316
|
return ConsoleAuditAction3;
|
|
10316
10317
|
})(ConsoleAuditAction || {});
|
|
10317
10318
|
var CLIENT_ACTIONS = [
|
|
@@ -10349,7 +10350,8 @@ var CONSOLE_AUDIT_LABELS = {
|
|
|
10349
10350
|
["robot.map-updated" /* ROBOT_MAP_UPDATED */]: "Building map edited",
|
|
10350
10351
|
["robot.map-removed" /* ROBOT_MAP_REMOVED */]: "Building map removed",
|
|
10351
10352
|
["robot.lift-requested" /* ROBOT_LIFT_REQUESTED */]: "Robot asked for a lift",
|
|
10352
|
-
["robot.lift-released" /* ROBOT_LIFT_RELEASED */]: "Robot lift request released"
|
|
10353
|
+
["robot.lift-released" /* ROBOT_LIFT_RELEASED */]: "Robot lift request released",
|
|
10354
|
+
["inventory.store-type-repaired" /* INVENTORY_STORE_TYPE_REPAIRED */]: "Inventory store type corrected"
|
|
10353
10355
|
};
|
|
10354
10356
|
var ConsoleAuditTarget = /* @__PURE__ */ ((ConsoleAuditTarget2) => {
|
|
10355
10357
|
ConsoleAuditTarget2["ORGANIZATION"] = "organization";
|
|
@@ -10361,6 +10363,7 @@ var ConsoleAuditTarget = /* @__PURE__ */ ((ConsoleAuditTarget2) => {
|
|
|
10361
10363
|
ConsoleAuditTarget2["SITE"] = "site";
|
|
10362
10364
|
ConsoleAuditTarget2["ROBOT"] = "robot";
|
|
10363
10365
|
ConsoleAuditTarget2["ROBOT_MAP"] = "robot-map";
|
|
10366
|
+
ConsoleAuditTarget2["INVENTORY_STORE"] = "inventory-store";
|
|
10364
10367
|
return ConsoleAuditTarget2;
|
|
10365
10368
|
})(ConsoleAuditTarget || {});
|
|
10366
10369
|
var CAMERA_AUDIT_FIELDS = [
|
|
@@ -10408,6 +10411,7 @@ var ROBOT_MAP_AUDIT_FIELDS = [
|
|
|
10408
10411
|
];
|
|
10409
10412
|
var ROBOT_LIFT_AUDIT_FIELDS = ["name", "liftName", "fromFloor", "toFloor"];
|
|
10410
10413
|
var AUDIT_FIELDS = {
|
|
10414
|
+
["inventory.store-type-repaired" /* INVENTORY_STORE_TYPE_REPAIRED */]: ["ownerType", "name"],
|
|
10411
10415
|
["robot.map-saved" /* ROBOT_MAP_SAVED */]: ROBOT_MAP_AUDIT_FIELDS,
|
|
10412
10416
|
["robot.map-updated" /* ROBOT_MAP_UPDATED */]: ROBOT_MAP_AUDIT_FIELDS,
|
|
10413
10417
|
["robot.map-removed" /* ROBOT_MAP_REMOVED */]: ROBOT_MAP_AUDIT_FIELDS,
|
|
@@ -64688,9 +64692,9 @@ function padbotReadiness(states, now = Date.now()) {
|
|
|
64688
64692
|
const charging = st["1002"]?.chargingState;
|
|
64689
64693
|
const notes = [];
|
|
64690
64694
|
if (es.wheelLockState === 1)
|
|
64691
|
-
notes.push("
|
|
64695
|
+
notes.push("Wheel motor lock reads 1 (1006). The S2 reads 1 even while it drives, so this does not stop it.");
|
|
64692
64696
|
if (charging === 2)
|
|
64693
|
-
notes.push("Charging state 2
|
|
64697
|
+
notes.push("Charging state 2 = docked on the charger (inferred from the S2; PadBot's v4.0 document lists only 0 and 1).");
|
|
64694
64698
|
return {
|
|
64695
64699
|
online: padbotMode(st, now).online,
|
|
64696
64700
|
heartbeatAt: st["1000"]?.updatedAt ?? null,
|
|
@@ -64724,6 +64728,33 @@ function padbotFailureText(p) {
|
|
|
64724
64728
|
return null;
|
|
64725
64729
|
return `Could not reach ${p.target || "its destination"}${p.message ? ` (${p.message})` : ""}`;
|
|
64726
64730
|
}
|
|
64731
|
+
var PADBOT_CHARGING = { OFF: 0, UNDOCKING_OR_CHARGING: 1, DOCKED: 2, DOCKING: 3 };
|
|
64732
|
+
var PADBOT_MOVED_M = 0.3;
|
|
64733
|
+
var PADBOT_ARRIVED_M = 0.5;
|
|
64734
|
+
var PADBOT_MOTION_MS = 3 * 6e4;
|
|
64735
|
+
function padbotMotion(m, now) {
|
|
64736
|
+
const c = typeof now.charging === "number" ? now.charging : null;
|
|
64737
|
+
const walked = m.pose && now.pose ? Math.hypot(now.pose.x - m.pose.x, now.pose.y - m.pose.y) : null;
|
|
64738
|
+
const moved = c !== null && m.charging !== null && c !== m.charging || walked !== null && walked > PADBOT_MOVED_M;
|
|
64739
|
+
if (!moved)
|
|
64740
|
+
return null;
|
|
64741
|
+
if (m.kind === "return") {
|
|
64742
|
+
if (c === PADBOT_CHARGING.DOCKING)
|
|
64743
|
+
return { text: "Docking", mode: "WORKING", done: false };
|
|
64744
|
+
if (c === PADBOT_CHARGING.DOCKED || c === PADBOT_CHARGING.UNDOCKING_OR_CHARGING)
|
|
64745
|
+
return { text: "Back on charger", mode: null, done: true };
|
|
64746
|
+
return { text: "On the way to the charger", mode: "WORKING", done: false };
|
|
64747
|
+
}
|
|
64748
|
+
if (m.charging === PADBOT_CHARGING.DOCKED && c === PADBOT_CHARGING.UNDOCKING_OR_CHARGING)
|
|
64749
|
+
return { text: "Leaving the charger", mode: "WORKING", done: false };
|
|
64750
|
+
const t = m.target;
|
|
64751
|
+
if (t && t.x !== null && t.y !== null && now.pose && Math.hypot(now.pose.x - t.x, now.pose.y - t.y) <= PADBOT_ARRIVED_M) {
|
|
64752
|
+
return { text: `Arrived at ${t.name}`, mode: null, done: true };
|
|
64753
|
+
}
|
|
64754
|
+
if (t)
|
|
64755
|
+
return { text: `On the way to ${t.name}`, mode: "WORKING", done: false };
|
|
64756
|
+
return { text: m.kind === "full" || m.kind === "area" || m.kind === "patrol-resume" ? "Patrolling" : "On the way", mode: "WORKING", done: false };
|
|
64757
|
+
}
|
|
64727
64758
|
function networkText(net) {
|
|
64728
64759
|
const say = (label2, v) => v < 0 ? ` \xB7 ${label2} ${v} dBm` : ` \xB7 ${label2} signal ${v}`;
|
|
64729
64760
|
const wifi = num(net?.wifi?.signalStrength);
|
|
@@ -64992,6 +65023,9 @@ function clearPadbotCache() {
|
|
|
64992
65023
|
live.clear();
|
|
64993
65024
|
commandLog.clear();
|
|
64994
65025
|
lastFailure.clear();
|
|
65026
|
+
motions.clear();
|
|
65027
|
+
robotReads.clear();
|
|
65028
|
+
alarmReads.clear();
|
|
64995
65029
|
}
|
|
64996
65030
|
function forgetPadbotMaps(appid, robotSn) {
|
|
64997
65031
|
for (const key of cache2.keys())
|
|
@@ -65020,6 +65054,11 @@ function logCommand(accountKey, robotSn, entry) {
|
|
|
65020
65054
|
var padbotCommandLog = (accountKey, robotSn) => commandLog.get(`${accountKey}:${robotSn}`) ?? [];
|
|
65021
65055
|
var lastFailure = /* @__PURE__ */ new Map();
|
|
65022
65056
|
var PADBOT_FAILURE_SHOW_MS = 3 * 6e4;
|
|
65057
|
+
var motions = /* @__PURE__ */ new Map();
|
|
65058
|
+
var PADBOT_ROBOT_READ_MS = 900;
|
|
65059
|
+
var robotReads = /* @__PURE__ */ new Map();
|
|
65060
|
+
var PADBOT_ALARM_READ_MS = 1e4;
|
|
65061
|
+
var alarmReads = /* @__PURE__ */ new Map();
|
|
65023
65062
|
async function readPadbotStates(credentials, robotSn, stateTypes) {
|
|
65024
65063
|
const list = await createPadbotClient(credentials).call(PADBOT_PATHS.states, { serialNumbers: [robotSn], stateTypes });
|
|
65025
65064
|
const entry = (list ?? []).find((e) => e?.serialNumber === robotSn);
|
|
@@ -65045,7 +65084,7 @@ async function listPadbotAlarmsSince(credentials, serials, startTime) {
|
|
|
65045
65084
|
}
|
|
65046
65085
|
function createPadbotAdapter(credentials, options = {}) {
|
|
65047
65086
|
const { call, raw } = createPadbotClient(credentials, options);
|
|
65048
|
-
const watch = options.watch === void 0 ? { everyMs: 2e3, forMs:
|
|
65087
|
+
const watch = options.watch === void 0 ? { everyMs: 2e3, forMs: 6e4 } : options.watch;
|
|
65049
65088
|
const sleep3 = options.sleep ?? ((ms2) => new Promise((resolve) => {
|
|
65050
65089
|
const t = setTimeout(resolve, ms2);
|
|
65051
65090
|
t?.unref?.();
|
|
@@ -65061,14 +65100,43 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65061
65100
|
const entry = (list ?? []).find((e) => e?.serialNumber === sn);
|
|
65062
65101
|
return entry ? statesByType(entry) : null;
|
|
65063
65102
|
};
|
|
65064
|
-
|
|
65103
|
+
function openAlarm(robotSn) {
|
|
65104
|
+
const k = `${account}:${robotSn}`;
|
|
65105
|
+
const hit = alarmReads.get(k);
|
|
65106
|
+
if (hit && now() - hit.at < PADBOT_ALARM_READ_MS)
|
|
65107
|
+
return hit.value;
|
|
65108
|
+
if (alarmReads.size > 2e3)
|
|
65109
|
+
alarmReads.clear();
|
|
65110
|
+
const value = call(PADBOT_PATHS.alarms, { serialNumbers: [robotSn], resolved: false, pageNumber: 1, pageSize: 1 }).then((d) => d?.items?.[0] ?? null).catch(() => {
|
|
65111
|
+
alarmReads.delete(k);
|
|
65112
|
+
return null;
|
|
65113
|
+
});
|
|
65114
|
+
alarmReads.set(k, { at: now(), value });
|
|
65115
|
+
return value;
|
|
65116
|
+
}
|
|
65117
|
+
function getRobot(robotSn) {
|
|
65118
|
+
const k = `${account}:${robotSn}`;
|
|
65119
|
+
const hit = robotReads.get(k);
|
|
65120
|
+
if (hit && now() - hit.at < PADBOT_ROBOT_READ_MS)
|
|
65121
|
+
return hit.value;
|
|
65122
|
+
if (robotReads.size > 2e3)
|
|
65123
|
+
robotReads.clear();
|
|
65124
|
+
const value = readRobot(robotSn);
|
|
65125
|
+
robotReads.set(k, { at: now(), value });
|
|
65126
|
+
value.catch(() => robotReads.delete(k));
|
|
65127
|
+
return value;
|
|
65128
|
+
}
|
|
65129
|
+
async function readRobot(robotSn) {
|
|
65130
|
+
const heard = padbotLive(account, robotSn);
|
|
65131
|
+
const pose = heard?.pose && now() - heard.pose.at < PADBOT_LIVE_POSE_MS ? heard.pose : null;
|
|
65132
|
+
const locRead = pose ? Promise.resolve({ mapId: pose.mapId, worldX: pose.x, worldY: pose.y, yaw: pose.yawDeg }) : call(PADBOT_PATHS.location, { serialNumber: robotSn }).catch(() => null);
|
|
65133
|
+
const alarmRead = openAlarm(robotSn);
|
|
65065
65134
|
const [st, list] = await Promise.all([states(robotSn), roster().catch(() => [])]);
|
|
65066
65135
|
if (!st)
|
|
65067
65136
|
return null;
|
|
65068
65137
|
const info = (list ?? []).find((r) => r?.serialNumber === robotSn);
|
|
65069
65138
|
const { online, mode, statusName } = padbotMode(st, now());
|
|
65070
65139
|
const floor = st["1007"]?.floor;
|
|
65071
|
-
const heard = padbotLive(account, robotSn);
|
|
65072
65140
|
const restBatteryAt = ms(st["1001"]?.updatedAt);
|
|
65073
65141
|
const battery = heard?.batteryPercent !== void 0 && (!Number.isFinite(restBatteryAt) || (heard.batteryAt ?? 0) > restBatteryAt) ? heard.batteryPercent : num(st["1001"]?.batteryPercent);
|
|
65074
65142
|
const failed = lastFailure.get(`${account}:${robotSn}`);
|
|
@@ -65095,11 +65163,8 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65095
65163
|
}
|
|
65096
65164
|
if (!online)
|
|
65097
65165
|
return robot;
|
|
65098
|
-
const
|
|
65099
|
-
const
|
|
65100
|
-
pose ? Promise.resolve({ mapId: pose.mapId, worldX: pose.x, worldY: pose.y, yaw: pose.yawDeg }) : call(PADBOT_PATHS.location, { serialNumber: robotSn }).catch(() => null),
|
|
65101
|
-
robot.fault ? Promise.resolve(null) : call(PADBOT_PATHS.alarms, { serialNumbers: [robotSn], resolved: false, pageNumber: 1, pageSize: 1 }).then((d) => d?.items?.[0] ?? null).catch(() => null)
|
|
65102
|
-
]);
|
|
65166
|
+
const [loc, openA] = await Promise.all([locRead, alarmRead]);
|
|
65167
|
+
const alarm = robot.fault ? null : openA;
|
|
65103
65168
|
const lx = num(loc?.worldX ?? loc?.x);
|
|
65104
65169
|
const ly = num(loc?.worldY ?? loc?.y);
|
|
65105
65170
|
if (typeof loc?.mapId === "string" && loc.mapId)
|
|
@@ -65111,6 +65176,13 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65111
65176
|
robot.position = { x: lx, y: ly, theta: (num(loc.yaw ?? loc.r) ?? 0) * Math.PI / 180 };
|
|
65112
65177
|
robot.planPosition = padbotPlanShare(map, lx, ly);
|
|
65113
65178
|
}
|
|
65179
|
+
const mo = motions.get(`${account}:${robotSn}`);
|
|
65180
|
+
const going = mo && now() - mo.sentAt < PADBOT_MOTION_MS && /^(Standing by|Charging)/.test(robot.statusName ?? "") ? padbotMotion(mo, { charging: st["1002"]?.chargingState, pose: robot.position ? { x: robot.position.x, y: robot.position.y } : null }) : null;
|
|
65181
|
+
if (going) {
|
|
65182
|
+
robot.statusName = (robot.statusName ?? "").replace(/^(Standing by|Charging)/, going.text);
|
|
65183
|
+
if (going.mode)
|
|
65184
|
+
robot.mode = going.mode;
|
|
65185
|
+
}
|
|
65114
65186
|
const last = heard?.pose;
|
|
65115
65187
|
if (!robot.position && last && (last.mapId === null || last.mapId === robot.mapId) && (robot.mode === "IDLE" || robot.mode === "CHARGING_CYCLE" || robot.mode === "CHARGED")) {
|
|
65116
65188
|
robot.position = { x: last.x, y: last.y, theta: (last.yawDeg ?? 0) * Math.PI / 180 };
|
|
@@ -65123,7 +65195,8 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65123
65195
|
if (pile) {
|
|
65124
65196
|
robot.position = { x: pile.worldX, y: pile.worldY, theta: (num(pile.yaw) ?? 0) * Math.PI / 180 };
|
|
65125
65197
|
robot.planPosition = padbotPlanShare(map, pile.worldX, pile.worldY);
|
|
65126
|
-
|
|
65198
|
+
if (!going || going.done)
|
|
65199
|
+
robot.statusName = `${robot.statusName} \xB7 At charger`;
|
|
65127
65200
|
}
|
|
65128
65201
|
if (!robot.position)
|
|
65129
65202
|
robot.statusName = `${robot.statusName} \xB7 Position not reported`;
|
|
@@ -65144,7 +65217,7 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65144
65217
|
const ids2 = [loc?.mapId, st?.["1007"]?.mapId];
|
|
65145
65218
|
const map = padbotCurrentMap(all, ids2, st?.["1007"]?.floor);
|
|
65146
65219
|
const mapId = map?.mapId ?? ids2.find((id) => typeof id === "string" && id) ?? null;
|
|
65147
|
-
return { st: st ?? {}, all: all ?? [], mapId };
|
|
65220
|
+
return { st: st ?? {}, all: all ?? [], mapId, loc };
|
|
65148
65221
|
}
|
|
65149
65222
|
const mapName = (all, id) => {
|
|
65150
65223
|
const m = all.find((x) => x?.mapId === id);
|
|
@@ -65168,10 +65241,10 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65168
65241
|
}
|
|
65169
65242
|
return String(rawRoute.pathId);
|
|
65170
65243
|
}
|
|
65171
|
-
async function watchReaction(robotSn, entry, sentAt) {
|
|
65244
|
+
async function watchReaction(robotSn, entry, sentAt, motion) {
|
|
65172
65245
|
if (!watch)
|
|
65173
65246
|
return;
|
|
65174
|
-
const r = entry.reaction = { watching: true, points: [], failure: null, moved: false };
|
|
65247
|
+
const r = entry.reaction = { watching: true, points: [], failure: null, moved: false, firstChangeAfterSeconds: null, progress: null };
|
|
65175
65248
|
let last = "";
|
|
65176
65249
|
try {
|
|
65177
65250
|
for (let waited = 0; waited < watch.forMs; ) {
|
|
@@ -65181,19 +65254,28 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65181
65254
|
if (!st)
|
|
65182
65255
|
continue;
|
|
65183
65256
|
const p = padbotReactionPoint(st);
|
|
65257
|
+
const after = Math.round((now() - sentAt) / 1e3);
|
|
65184
65258
|
const key = JSON.stringify(p);
|
|
65185
|
-
if (key !== last && r.points.length <
|
|
65186
|
-
r.points.push({ ...p, afterSeconds:
|
|
65259
|
+
if (key !== last && r.points.length < 30)
|
|
65260
|
+
r.points.push({ ...p, afterSeconds: after });
|
|
65187
65261
|
last = key;
|
|
65188
|
-
|
|
65262
|
+
const heard = padbotLive(account, robotSn)?.pose;
|
|
65263
|
+
const pose = heard && now() - heard.at < PADBOT_LIVE_POSE_MS ? { x: heard.x, y: heard.y } : null;
|
|
65264
|
+
const going = padbotMotion(motion, { charging: p.charging, pose });
|
|
65265
|
+
if (going || p.state >= 1 && p.state <= 5) {
|
|
65266
|
+
if (!r.moved)
|
|
65267
|
+
r.firstChangeAfterSeconds = after;
|
|
65189
65268
|
r.moved = true;
|
|
65269
|
+
}
|
|
65270
|
+
if (going)
|
|
65271
|
+
r.progress = going.text;
|
|
65190
65272
|
const failure = padbotFailureText(p);
|
|
65191
65273
|
if (failure) {
|
|
65192
65274
|
r.failure = failure;
|
|
65193
65275
|
lastFailure.set(`${account}:${robotSn}`, { at: now(), text: failure });
|
|
65194
65276
|
break;
|
|
65195
65277
|
}
|
|
65196
|
-
if (p.state === 5)
|
|
65278
|
+
if (p.state === 5 || going?.done)
|
|
65197
65279
|
break;
|
|
65198
65280
|
}
|
|
65199
65281
|
} finally {
|
|
@@ -65202,22 +65284,48 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65202
65284
|
}
|
|
65203
65285
|
async function sendCommand2(robotSn, command) {
|
|
65204
65286
|
const sn = { serialNumber: robotSn };
|
|
65287
|
+
const where = command.kind === "go-to-point" ? await whereIs(robotSn) : null;
|
|
65288
|
+
let motion = null;
|
|
65205
65289
|
if (MOVING_COMMANDS.has(command.kind)) {
|
|
65206
|
-
const
|
|
65290
|
+
const before = where?.st ?? await states(robotSn);
|
|
65291
|
+
const block = padbotCommandBlock(before, command.kind, now());
|
|
65207
65292
|
if (block)
|
|
65208
65293
|
throw new BadRequestError135(block);
|
|
65209
65294
|
lastFailure.delete(`${account}:${robotSn}`);
|
|
65210
|
-
|
|
65295
|
+
const heard = padbotLive(account, robotSn)?.pose;
|
|
65296
|
+
const lx = num(where?.loc?.worldX);
|
|
65297
|
+
const ly = num(where?.loc?.worldY);
|
|
65298
|
+
let target = null;
|
|
65299
|
+
if (command.kind === "go-to-point") {
|
|
65300
|
+
const pt = (where?.all ?? []).flatMap((m) => Array.isArray(m?.targetPoints) ? m.targetPoints : []).find((t) => t?.targetPointId === command.targetPointId);
|
|
65301
|
+
target = { name: String(pt?.name || "the chosen point"), x: num(pt?.worldX), y: num(pt?.worldY) };
|
|
65302
|
+
}
|
|
65303
|
+
motion = {
|
|
65304
|
+
kind: command.kind,
|
|
65305
|
+
sentAt: 0,
|
|
65306
|
+
charging: typeof before?.["1002"]?.chargingState === "number" ? before["1002"].chargingState : null,
|
|
65307
|
+
pose: lx !== null && ly !== null ? { x: lx, y: ly } : heard ? { x: heard.x, y: heard.y } : null,
|
|
65308
|
+
target
|
|
65309
|
+
};
|
|
65310
|
+
} else if (command.kind === "cancel")
|
|
65311
|
+
motions.delete(`${account}:${robotSn}`);
|
|
65211
65312
|
const call2 = async (path5, body) => {
|
|
65212
65313
|
const at2 = new Date(now()).toISOString();
|
|
65213
65314
|
const meta = {};
|
|
65315
|
+
const t0 = Date.now();
|
|
65214
65316
|
try {
|
|
65215
65317
|
await callRaw(path5, body, meta);
|
|
65216
|
-
const entry = { at: at2, command: command.kind, path: path5, body, ok: true, vendorCode: 0, vendorMessage: meta.message, requestId: meta.requestId };
|
|
65318
|
+
const entry = { at: at2, command: command.kind, path: path5, body, ok: true, vendorCode: 0, vendorMessage: meta.message, requestId: meta.requestId, vendorMs: Date.now() - t0 };
|
|
65217
65319
|
logCommand(account, robotSn, entry);
|
|
65218
|
-
if (
|
|
65219
|
-
|
|
65320
|
+
if (motion) {
|
|
65321
|
+
motion.sentAt = now();
|
|
65322
|
+
if (motions.size > 2e3)
|
|
65323
|
+
motions.clear();
|
|
65324
|
+
motions.set(`${account}:${robotSn}`, motion);
|
|
65325
|
+
robotReads.delete(`${account}:${robotSn}`);
|
|
65326
|
+
void watchReaction(robotSn, entry, motion.sentAt, motion).catch(() => {
|
|
65220
65327
|
});
|
|
65328
|
+
}
|
|
65221
65329
|
} catch (e) {
|
|
65222
65330
|
logCommand(account, robotSn, {
|
|
65223
65331
|
at: at2,
|
|
@@ -65262,7 +65370,6 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65262
65370
|
await call2(PADBOT_PATHS.relocate, { ...sn, worldX: command.x, worldY: command.y });
|
|
65263
65371
|
return;
|
|
65264
65372
|
case "go-to-point": {
|
|
65265
|
-
const where = await whereIs(robotSn);
|
|
65266
65373
|
if (!padbotCanReachMap(where.all, where.mapId, command.mapId))
|
|
65267
65374
|
throw new BadRequestError135(PADBOT_OTHER_MAP_TEXT);
|
|
65268
65375
|
await call2(PADBOT_PATHS.navigateTarget, { ...sn, mapId: command.mapId, targetPointId: command.targetPointId });
|
|
@@ -65360,6 +65467,8 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
65360
65467
|
}
|
|
65361
65468
|
for (let i = 0; i < ids2.length; i += 100)
|
|
65362
65469
|
await call(PADBOT_PATHS.resolve, { alarmIds: ids2.slice(i, i + 100) });
|
|
65470
|
+
robotReads.delete(`${account}:${robotSn}`);
|
|
65471
|
+
alarmReads.delete(`${account}:${robotSn}`);
|
|
65363
65472
|
return ids2.length;
|
|
65364
65473
|
},
|
|
65365
65474
|
async getPatrolHistory(robotSn, pageNumber, pageSize) {
|
|
@@ -104914,20 +105023,26 @@ export {
|
|
|
104914
105023
|
PADBOT_ACTION_TEXT,
|
|
104915
105024
|
PADBOT_ALARMS,
|
|
104916
105025
|
PADBOT_ALARM_POLL_MS,
|
|
105026
|
+
PADBOT_ALARM_READ_MS,
|
|
104917
105027
|
PADBOT_ALARM_TEXT,
|
|
105028
|
+
PADBOT_ARRIVED_M,
|
|
104918
105029
|
PADBOT_BRAND,
|
|
104919
105030
|
PADBOT_BRAND_DEFINITION,
|
|
104920
105031
|
PADBOT_CAPABILITIES,
|
|
105032
|
+
PADBOT_CHARGING,
|
|
104921
105033
|
PADBOT_DISPLAY_NAME,
|
|
104922
105034
|
PADBOT_FAILURE_SHOW_MS,
|
|
104923
105035
|
PADBOT_LIVE_POSE_MS,
|
|
104924
105036
|
PADBOT_MAKER_APP_ONLY,
|
|
104925
105037
|
PADBOT_MODELS,
|
|
104926
105038
|
PADBOT_MOTION,
|
|
105039
|
+
PADBOT_MOTION_MS,
|
|
105040
|
+
PADBOT_MOVED_M,
|
|
104927
105041
|
PADBOT_MQTT_SYNC_MS,
|
|
104928
105042
|
PADBOT_ONLINE_WINDOW_MS,
|
|
104929
105043
|
PADBOT_OTHER_MAP_TEXT,
|
|
104930
105044
|
PADBOT_PATHS,
|
|
105045
|
+
PADBOT_ROBOT_READ_MS,
|
|
104931
105046
|
PATROL_CCTV_CAMERA_FILTER,
|
|
104932
105047
|
PATROL_EMAIL_MAX_LOGS,
|
|
104933
105048
|
PATROL_EMAIL_MAX_PER_HOUR,
|
|
@@ -105278,6 +105393,7 @@ export {
|
|
|
105278
105393
|
padbotLive,
|
|
105279
105394
|
padbotManualDriveEnabled,
|
|
105280
105395
|
padbotMode,
|
|
105396
|
+
padbotMotion,
|
|
105281
105397
|
padbotMqttEnabled,
|
|
105282
105398
|
padbotPatrolPlan,
|
|
105283
105399
|
padbotPatrolRecord,
|