@7365admin1/core 3.131.0 → 3.131.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 +6 -0
- package/dist/index.d.ts +18 -10
- package/dist/index.js +204 -127
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +202 -127
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/ounitech-api-2025-10.test.mjs +103 -4
package/dist/index.mjs
CHANGED
|
@@ -10204,15 +10204,15 @@ function robotConnectionText(robotName, online, minutes) {
|
|
|
10204
10204
|
}
|
|
10205
10205
|
var OFFLINE_FAULT_CODE = "OFFLINE";
|
|
10206
10206
|
var SAME_OCCURRENCE_MS = 1e3;
|
|
10207
|
-
function planFaultChanges(open,
|
|
10207
|
+
function planFaultChanges(open, reading2) {
|
|
10208
10208
|
const byCode = new Map(open.map((r) => [r.code, r]));
|
|
10209
10209
|
const want = [];
|
|
10210
|
-
const offline = !
|
|
10210
|
+
const offline = !reading2.ok || reading2.online === false;
|
|
10211
10211
|
if (offline) {
|
|
10212
|
-
const reason =
|
|
10212
|
+
const reason = reading2.ok ? "" : String(reading2.error ?? "").slice(0, 200);
|
|
10213
10213
|
want.push({ code: OFFLINE_FAULT_CODE, message: reason ? `Not reporting: ${reason}` : "Not reporting" });
|
|
10214
10214
|
}
|
|
10215
|
-
const fault =
|
|
10215
|
+
const fault = reading2.ok && reading2.fault?.code ? reading2.fault : null;
|
|
10216
10216
|
if (fault)
|
|
10217
10217
|
want.push({ code: fault.code, message: fault.message || fault.code, since: fault.since });
|
|
10218
10218
|
const clear = [];
|
|
@@ -10244,12 +10244,12 @@ function planFaultChanges(open, reading) {
|
|
|
10244
10244
|
return { open: toOpen, clear, refresh };
|
|
10245
10245
|
}
|
|
10246
10246
|
function robotFaultSweepConfig(env2 = process.env) {
|
|
10247
|
-
const
|
|
10247
|
+
const num4 = (v, def, min, max) => {
|
|
10248
10248
|
const n = Math.floor(Number(v));
|
|
10249
10249
|
return Number.isFinite(n) && String(v ?? "").trim() !== "" ? Math.min(max, Math.max(min, n)) : def;
|
|
10250
10250
|
};
|
|
10251
10251
|
const enabled = String(env2.ROBOT_FAULT_SWEEP ?? "on").trim().toLowerCase() !== "off";
|
|
10252
|
-
const asked =
|
|
10252
|
+
const asked = num4(env2.ROBOT_FAULT_SWEEP_SECONDS, 60, 10, 3600);
|
|
10253
10253
|
const pick = (steps, v) => steps.filter((d) => d <= v).pop() ?? steps[0];
|
|
10254
10254
|
const subMinute = asked < 60;
|
|
10255
10255
|
const step = subMinute ? pick([10, 12, 15, 20, 30], asked) : pick([1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60], Math.floor(asked / 60));
|
|
@@ -10259,9 +10259,9 @@ function robotFaultSweepConfig(env2 = process.env) {
|
|
|
10259
10259
|
enabled,
|
|
10260
10260
|
seconds,
|
|
10261
10261
|
cron: cron2,
|
|
10262
|
-
concurrency:
|
|
10263
|
-
timeoutMs:
|
|
10264
|
-
offlineAlertMinutes:
|
|
10262
|
+
concurrency: num4(env2.ROBOT_FAULT_SWEEP_CONCURRENCY, 4, 1, 16),
|
|
10263
|
+
timeoutMs: num4(env2.ROBOT_FAULT_SWEEP_TIMEOUT_MS, 1e4, 1e3, 6e4),
|
|
10264
|
+
offlineAlertMinutes: num4(env2.ROBOT_OFFLINE_ALERT_MINUTES, 10, 1, 1440)
|
|
10265
10265
|
};
|
|
10266
10266
|
}
|
|
10267
10267
|
function withTimeout(promise, ms2, label2 = "Timed out") {
|
|
@@ -26173,7 +26173,7 @@ function usePersonRepo() {
|
|
|
26173
26173
|
}
|
|
26174
26174
|
async function pushVehicleById(id, plate, session) {
|
|
26175
26175
|
const { plateNumber, recNo } = plate;
|
|
26176
|
-
const
|
|
26176
|
+
const updatedAt2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
26177
26177
|
const _id = toObjectId9(id);
|
|
26178
26178
|
try {
|
|
26179
26179
|
const updateExisting = await collection.updateOne(
|
|
@@ -26184,7 +26184,7 @@ function usePersonRepo() {
|
|
|
26184
26184
|
{
|
|
26185
26185
|
$set: {
|
|
26186
26186
|
"plates.$.recNo": recNo,
|
|
26187
|
-
updatedAt
|
|
26187
|
+
updatedAt: updatedAt2
|
|
26188
26188
|
}
|
|
26189
26189
|
},
|
|
26190
26190
|
{ session }
|
|
@@ -26200,7 +26200,7 @@ function usePersonRepo() {
|
|
|
26200
26200
|
}
|
|
26201
26201
|
},
|
|
26202
26202
|
$set: {
|
|
26203
|
-
updatedAt
|
|
26203
|
+
updatedAt: updatedAt2
|
|
26204
26204
|
}
|
|
26205
26205
|
},
|
|
26206
26206
|
{ session }
|
|
@@ -26211,7 +26211,7 @@ function usePersonRepo() {
|
|
|
26211
26211
|
}
|
|
26212
26212
|
}
|
|
26213
26213
|
async function pullVehicleByRecNo(recNo, scope, session) {
|
|
26214
|
-
const
|
|
26214
|
+
const updatedAt2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
26215
26215
|
const owner = scope?.peopleId ? toObjectId9(scope.peopleId) : null;
|
|
26216
26216
|
const site = scope?.site ? toObjectId9(scope.site) : null;
|
|
26217
26217
|
if (!owner && !site) {
|
|
@@ -26250,7 +26250,7 @@ function usePersonRepo() {
|
|
|
26250
26250
|
plates: match
|
|
26251
26251
|
},
|
|
26252
26252
|
$set: {
|
|
26253
|
-
updatedAt
|
|
26253
|
+
updatedAt: updatedAt2
|
|
26254
26254
|
}
|
|
26255
26255
|
},
|
|
26256
26256
|
{ session }
|
|
@@ -47708,7 +47708,7 @@ var MKeyLog = class {
|
|
|
47708
47708
|
organization = "",
|
|
47709
47709
|
serviceProvider = "",
|
|
47710
47710
|
createdAt = /* @__PURE__ */ new Date(),
|
|
47711
|
-
updatedAt = /* @__PURE__ */ new Date(),
|
|
47711
|
+
updatedAt: updatedAt2 = /* @__PURE__ */ new Date(),
|
|
47712
47712
|
template,
|
|
47713
47713
|
status = "Available",
|
|
47714
47714
|
updatedBy = "",
|
|
@@ -47729,7 +47729,7 @@ var MKeyLog = class {
|
|
|
47729
47729
|
this.organization = organization;
|
|
47730
47730
|
this.serviceProvider = serviceProvider;
|
|
47731
47731
|
this.createdAt = createdAt;
|
|
47732
|
-
this.updatedAt =
|
|
47732
|
+
this.updatedAt = updatedAt2;
|
|
47733
47733
|
this.template = template;
|
|
47734
47734
|
this.status = status;
|
|
47735
47735
|
this.updatedBy = updatedBy;
|
|
@@ -56384,7 +56384,7 @@ var MAccessCard = class {
|
|
|
56384
56384
|
isLiftCard,
|
|
56385
56385
|
liftAccessLevel,
|
|
56386
56386
|
createdAt,
|
|
56387
|
-
updatedAt,
|
|
56387
|
+
updatedAt: updatedAt2,
|
|
56388
56388
|
assignedUnit,
|
|
56389
56389
|
userType,
|
|
56390
56390
|
doorName,
|
|
@@ -56411,7 +56411,7 @@ var MAccessCard = class {
|
|
|
56411
56411
|
this.isLiftCard = isLiftCard;
|
|
56412
56412
|
this.liftAccessLevel = liftAccessLevel;
|
|
56413
56413
|
this.createdAt = createdAt;
|
|
56414
|
-
this.updatedAt =
|
|
56414
|
+
this.updatedAt = updatedAt2;
|
|
56415
56415
|
this.assignedUnit = assignedUnit;
|
|
56416
56416
|
this.userType = userType;
|
|
56417
56417
|
this.doorName = doorName;
|
|
@@ -56590,8 +56590,8 @@ function encryptPayload(payloadHex) {
|
|
|
56590
56590
|
);
|
|
56591
56591
|
return encrypted.toString("base64");
|
|
56592
56592
|
}
|
|
56593
|
-
function toHex(
|
|
56594
|
-
return
|
|
56593
|
+
function toHex(num4, length) {
|
|
56594
|
+
return num4.toString(16).padStart(length * 2, "0");
|
|
56595
56595
|
}
|
|
56596
56596
|
function buildPayload(cardNumber, validityMinutes) {
|
|
56597
56597
|
const randomHex = crypto7.randomBytes(2).toString("hex");
|
|
@@ -56771,8 +56771,8 @@ function UseAccessManagementRepo() {
|
|
|
56771
56771
|
}
|
|
56772
56772
|
}
|
|
56773
56773
|
function generateCardNo() {
|
|
56774
|
-
const
|
|
56775
|
-
return
|
|
56774
|
+
const num4 = Math.floor(Math.random() * 65536);
|
|
56775
|
+
return num4.toString().padStart(10, "0");
|
|
56776
56776
|
}
|
|
56777
56777
|
async function createQrData({
|
|
56778
56778
|
cardNumber,
|
|
@@ -58012,13 +58012,13 @@ function UseAccessManagementRepo() {
|
|
|
58012
58012
|
const prevCard = res && res?.[1]?.cardNo || "-1";
|
|
58013
58013
|
const currentCard = res && res?.[0]?.cardNo || "0";
|
|
58014
58014
|
let availableCardNo = [];
|
|
58015
|
-
let
|
|
58015
|
+
let num4 = parseInt(prevCard, 10) + 1;
|
|
58016
58016
|
while (availableCardNo.length < (unit.length > 0 ? unit.length : quantity)) {
|
|
58017
|
-
if (
|
|
58018
|
-
|
|
58017
|
+
if (num4 === parseInt(currentCard, 10)) {
|
|
58018
|
+
num4++;
|
|
58019
58019
|
}
|
|
58020
|
-
availableCardNo.push(
|
|
58021
|
-
|
|
58020
|
+
availableCardNo.push(num4);
|
|
58021
|
+
num4++;
|
|
58022
58022
|
}
|
|
58023
58023
|
const cardNumbers = availableCardNo.map(
|
|
58024
58024
|
(no2) => no2.toString().padStart(10, "0")
|
|
@@ -63754,13 +63754,13 @@ function parseRobotCommand(body) {
|
|
|
63754
63754
|
if (has2(k))
|
|
63755
63755
|
return { ok: false, message: `${k} is not valid for a ${kind} command.` };
|
|
63756
63756
|
}
|
|
63757
|
-
const
|
|
63758
|
-
if (!
|
|
63757
|
+
const num4 = (k) => typeof b[k] === "number" && Number.isFinite(b[k]);
|
|
63758
|
+
if (!num4("x") || !num4("y"))
|
|
63759
63759
|
return { ok: false, message: `${kind} needs x and y (metres).` };
|
|
63760
63760
|
if (kind === "navigate") {
|
|
63761
63761
|
if (has2("floorNo"))
|
|
63762
63762
|
return { ok: false, message: "floorNo is not valid for a navigate command." };
|
|
63763
|
-
if (has2("theta") && !
|
|
63763
|
+
if (has2("theta") && !num4("theta"))
|
|
63764
63764
|
return { ok: false, message: "theta must be a number (radians)." };
|
|
63765
63765
|
return {
|
|
63766
63766
|
ok: true,
|
|
@@ -63772,7 +63772,7 @@ function parseRobotCommand(body) {
|
|
|
63772
63772
|
}
|
|
63773
63773
|
};
|
|
63774
63774
|
}
|
|
63775
|
-
if (!
|
|
63775
|
+
if (!num4("theta"))
|
|
63776
63776
|
return { ok: false, message: "relocalize needs theta (radians)." };
|
|
63777
63777
|
if (!Number.isInteger(b.floorNo))
|
|
63778
63778
|
return { ok: false, message: "relocalize needs an integer floorNo." };
|
|
@@ -64196,23 +64196,81 @@ var OUNITECH_CAPABILITIES = {
|
|
|
64196
64196
|
var OUNITECH_PENDING_COMMANDS = ["pause", "resume", "cancel"].map(
|
|
64197
64197
|
(kind) => ({ kind, reason: "awaiting Ounitech's robot-control action numbers" })
|
|
64198
64198
|
);
|
|
64199
|
-
function propertyNumber(row, key) {
|
|
64200
|
-
const p = row.robotState?.properties?.find((x) => x?.key === key);
|
|
64201
|
-
const n = p?.value != null && String(p.value).trim() !== "" ? Number(p.value) : NaN;
|
|
64202
|
-
return Number.isFinite(n) ? n : null;
|
|
64203
|
-
}
|
|
64204
64199
|
var finite = (v) => typeof v === "number" && Number.isFinite(v);
|
|
64205
|
-
function
|
|
64206
|
-
|
|
64207
|
-
|
|
64208
|
-
|
|
64200
|
+
function num(v) {
|
|
64201
|
+
if (finite(v))
|
|
64202
|
+
return v;
|
|
64203
|
+
if (typeof v === "string" && v.trim() !== "") {
|
|
64204
|
+
const n = Number(v);
|
|
64205
|
+
return Number.isFinite(n) ? n : void 0;
|
|
64206
|
+
}
|
|
64207
|
+
return void 0;
|
|
64208
|
+
}
|
|
64209
|
+
function reading(st, key) {
|
|
64210
|
+
const v = st.properties?.find((x) => x?.key === key)?.value;
|
|
64211
|
+
return v == null || String(v).trim() === "" ? void 0 : String(v).trim();
|
|
64212
|
+
}
|
|
64213
|
+
var OUNITECH_FRESH_MS = 3 * 6e4;
|
|
64214
|
+
var STATUS_CODE_BY_READING = {
|
|
64215
|
+
\u5F85\u673A: 1,
|
|
64216
|
+
\u7A7A\u95F2: 1,
|
|
64217
|
+
\u6E05\u626B\u4E2D: 2,
|
|
64218
|
+
\u5DE5\u4F5C\u4E2D: 2,
|
|
64219
|
+
\u6682\u505C: 3,
|
|
64220
|
+
\u6682\u505C\u4E2D: 3,
|
|
64221
|
+
\u5EFA\u56FE\u4E2D: 4,
|
|
64222
|
+
\u56DE\u5145\u4E2D: 6,
|
|
64223
|
+
\u8FD4\u56DE\u5145\u7535: 6,
|
|
64224
|
+
\u6545\u969C: 7,
|
|
64225
|
+
\u5F02\u5E38: 7,
|
|
64226
|
+
\u5145\u7535\u4E2D: 8,
|
|
64227
|
+
\u65AD\u70B9\u5145\u7535\u4E2D: 16,
|
|
64228
|
+
\u5DF2\u5145\u6EE1: 9,
|
|
64229
|
+
\u5145\u6EE1: 9,
|
|
64230
|
+
\u6025\u505C: 11,
|
|
64231
|
+
\u5173\u673A: 14,
|
|
64232
|
+
\u79BB\u7EBF: 99
|
|
64233
|
+
};
|
|
64234
|
+
var JOB_WORDS = {
|
|
64235
|
+
\u5DF2\u7ED3\u675F: "job finished",
|
|
64236
|
+
\u5DF2\u5B8C\u6210: "job finished",
|
|
64237
|
+
\u5B8C\u6210: "job finished",
|
|
64238
|
+
\u6E05\u626B\u4E2D: "job in progress",
|
|
64239
|
+
\u8FDB\u884C\u4E2D: "job in progress",
|
|
64240
|
+
\u6682\u505C: "job paused",
|
|
64241
|
+
\u6682\u505C\u4E2D: "job paused",
|
|
64242
|
+
\u672A\u5F00\u59CB: "no job started",
|
|
64243
|
+
\u5DF2\u53D6\u6D88: "job cancelled",
|
|
64244
|
+
\u53D6\u6D88: "job cancelled"
|
|
64245
|
+
};
|
|
64246
|
+
function ounitechJobWords(st) {
|
|
64247
|
+
const v = reading(st, "job");
|
|
64248
|
+
return v ? JOB_WORDS[v] ?? null : null;
|
|
64249
|
+
}
|
|
64250
|
+
function updatedAt(v) {
|
|
64251
|
+
const n = num(v);
|
|
64252
|
+
if (n !== void 0)
|
|
64253
|
+
return n < 1e12 ? n * 1e3 : n;
|
|
64254
|
+
const t = typeof v === "string" ? Date.parse(v) : NaN;
|
|
64255
|
+
return Number.isFinite(t) ? t : null;
|
|
64256
|
+
}
|
|
64257
|
+
function ounitechRobotFromHomeRow(row, live2, now = Date.now()) {
|
|
64258
|
+
const listed = row.robotState ?? {};
|
|
64259
|
+
const st = live2 ? { ...listed, ...live2, properties: live2.properties?.length ? live2.properties : listed.properties } : listed;
|
|
64260
|
+
const statusReading = reading(st, "status");
|
|
64261
|
+
const flag = num(st.statusFlag) ?? (statusReading ? STATUS_CODE_BY_READING[statusReading] : void 0);
|
|
64262
|
+
const at2 = updatedAt(st.updateOn);
|
|
64263
|
+
const fresh = at2 !== null && now - at2 <= OUNITECH_FRESH_MS;
|
|
64264
|
+
const online = flag !== 99 && (flag !== void 0 || fresh);
|
|
64209
64265
|
const mode = online ? robotMode(flag) : "UNAVAILABLE";
|
|
64210
|
-
const pct =
|
|
64266
|
+
const pct = num(reading(st, "battery-percent")) ?? num(st.battery) ?? null;
|
|
64211
64267
|
const task = row.taskState;
|
|
64212
64268
|
const jobPct = task && String(task.statusFlag) === "1" && finite(task.accPercent) ? Math.round(task.accPercent) : null;
|
|
64213
|
-
const words = flag
|
|
64269
|
+
const words = flag !== void 0 ? ROBOT_STATUS_NAMES[flag] ?? `Status ${flag}` : online ? "Online - status not reported" : "Unknown";
|
|
64214
64270
|
const model = String(row.modelCode || row.modelName || "").trim().slice(0, 40);
|
|
64215
|
-
|
|
64271
|
+
const x = num(st.x);
|
|
64272
|
+
const y = num(st.y);
|
|
64273
|
+
const robot = {
|
|
64216
64274
|
robotSn: row.robotSn,
|
|
64217
64275
|
name: row.aliasName || row.robotName,
|
|
64218
64276
|
...model ? { model } : {},
|
|
@@ -64222,8 +64280,16 @@ function ounitechRobotFromHomeRow(row) {
|
|
|
64222
64280
|
batteryPercent: online && pct !== null && pct >= 0 && pct <= 100 ? Math.round(pct) : null,
|
|
64223
64281
|
floorNo: Number.isInteger(row.floorNo) ? row.floorNo : null,
|
|
64224
64282
|
floorKnown: Number.isInteger(row.floorNo),
|
|
64225
|
-
position: online &&
|
|
64283
|
+
position: online && x !== void 0 && y !== void 0 ? { x, y, theta: num(st.theta) ?? 0 } : null
|
|
64226
64284
|
};
|
|
64285
|
+
if (online && (flag === 7 || Array.isArray(st.rtFaultList) && st.rtFaultList.length)) {
|
|
64286
|
+
robot.fault = ounitechFault(st.rtFaultList);
|
|
64287
|
+
}
|
|
64288
|
+
return robot;
|
|
64289
|
+
}
|
|
64290
|
+
function needsLiveState(row) {
|
|
64291
|
+
const f = num(row.robotState?.statusFlag);
|
|
64292
|
+
return finite(row.robotId) && (f === void 0 || f === 99 || f === 7);
|
|
64227
64293
|
}
|
|
64228
64294
|
function ounitechFault(list) {
|
|
64229
64295
|
const f = Array.isArray(list) ? list[0] : null;
|
|
@@ -64240,6 +64306,9 @@ function ounitechFault(list) {
|
|
|
64240
64306
|
var robotTime = (d) => robotCloudTimestamp(d, "yyyy-MM-dd HH:mm:ss", "Asia/Shanghai");
|
|
64241
64307
|
function createOunitechAdapter(credentials, options) {
|
|
64242
64308
|
const cloud = useRobotCloudService(credentials, options);
|
|
64309
|
+
async function liveFor(row) {
|
|
64310
|
+
return needsLiveState(row) ? cloud.getRobotState(row.robotId).catch(() => null) : null;
|
|
64311
|
+
}
|
|
64243
64312
|
async function rowFor(robotSn) {
|
|
64244
64313
|
return (await cloud.getHomeRobots()).find((r) => r.robotSn === robotSn) ?? null;
|
|
64245
64314
|
}
|
|
@@ -64248,7 +64317,7 @@ function createOunitechAdapter(credentials, options) {
|
|
|
64248
64317
|
displayName: "Ounitech (Q3-G / Q3-W)",
|
|
64249
64318
|
capabilities: OUNITECH_CAPABILITIES,
|
|
64250
64319
|
async listRobots() {
|
|
64251
|
-
return (await cloud.getHomeRobots()).map(ounitechRobotFromHomeRow);
|
|
64320
|
+
return Promise.all((await cloud.getHomeRobots()).map(async (row) => ounitechRobotFromHomeRow(row, await liveFor(row))));
|
|
64252
64321
|
},
|
|
64253
64322
|
async getRobot(robotSn) {
|
|
64254
64323
|
const row = await rowFor(robotSn);
|
|
@@ -64264,12 +64333,7 @@ function createOunitechAdapter(credentials, options) {
|
|
|
64264
64333
|
position: null
|
|
64265
64334
|
};
|
|
64266
64335
|
}
|
|
64267
|
-
|
|
64268
|
-
if (row.robotState?.statusFlag === 7 && finite(row.robotId)) {
|
|
64269
|
-
const state = await cloud.getRobotState(row.robotId).catch(() => null);
|
|
64270
|
-
robot.fault = ounitechFault(state?.rtFaultList);
|
|
64271
|
-
}
|
|
64272
|
-
return robot;
|
|
64336
|
+
return ounitechRobotFromHomeRow(row, await liveFor(row));
|
|
64273
64337
|
},
|
|
64274
64338
|
async sendCommand(robotSn, command) {
|
|
64275
64339
|
const options2 = {
|
|
@@ -64384,10 +64448,19 @@ function createOunitechAdapter(credentials, options) {
|
|
|
64384
64448
|
const window = { timeFrom: robotTime(from), timeTo: robotTime(to) };
|
|
64385
64449
|
await run("live state (get-robot-state-v2.0)", ROBOT_CLOUD_PATHS.robotState, { robotId }, async () => {
|
|
64386
64450
|
const s = await cloud.getRobotState(robotId);
|
|
64451
|
+
const r = ounitechRobotFromHomeRow(row, s);
|
|
64452
|
+
const level2 = (...keys) => keys.map((k) => num(reading(s, k))).find((n) => n !== void 0) ?? null;
|
|
64453
|
+
const at2 = updatedAt(s.updateOn);
|
|
64387
64454
|
return {
|
|
64455
|
+
online: r.online,
|
|
64456
|
+
status: r.statusName,
|
|
64457
|
+
job: ounitechJobWords(s),
|
|
64458
|
+
battery: r.batteryPercent,
|
|
64459
|
+
cleanWater: level2("clean-water", "clean-percent"),
|
|
64460
|
+
dirtyWater: level2("dirty-water", "dirty-percent"),
|
|
64461
|
+
fault: r.fault ?? null,
|
|
64388
64462
|
statusFlag: s.statusFlag,
|
|
64389
|
-
|
|
64390
|
-
updateOn: s.updateOn ? new Date(s.updateOn).toISOString() : null,
|
|
64463
|
+
updateOn: at2 !== null ? new Date(at2).toISOString() : null,
|
|
64391
64464
|
x: s.x,
|
|
64392
64465
|
y: s.y,
|
|
64393
64466
|
theta: s.theta,
|
|
@@ -66319,7 +66392,7 @@ function statesByType(entry) {
|
|
|
66319
66392
|
}
|
|
66320
66393
|
var PADBOT_ONLINE_WINDOW_MS = 12e4;
|
|
66321
66394
|
var ms = (t) => typeof t === "string" ? Date.parse(t) : NaN;
|
|
66322
|
-
var
|
|
66395
|
+
var num2 = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
66323
66396
|
function padbotMode(states, now = Date.now()) {
|
|
66324
66397
|
const hb = ms(states["1000"]?.updatedAt);
|
|
66325
66398
|
const online = Number.isFinite(hb) && now - hb <= PADBOT_ONLINE_WINDOW_MS;
|
|
@@ -66327,7 +66400,7 @@ function padbotMode(states, now = Date.now()) {
|
|
|
66327
66400
|
return { online: false, mode: "UNAVAILABLE", statusName: "Not reporting to PadBot" };
|
|
66328
66401
|
const nav = states["1003"] ?? {};
|
|
66329
66402
|
const work = states["1010"] ?? {};
|
|
66330
|
-
const battery =
|
|
66403
|
+
const battery = num2(states["1001"]?.batteryPercent);
|
|
66331
66404
|
const charging = states["1002"]?.chargingState === 1;
|
|
66332
66405
|
const type = Number(nav.actionType) || 0;
|
|
66333
66406
|
const st = Number(nav.actionState) || 0;
|
|
@@ -66364,7 +66437,7 @@ function padbotCommandBlock(states, kind, now = Date.now()) {
|
|
|
66364
66437
|
return "The robot is not reporting to PadBot, so it cannot take a command. Check it is switched on and connected.";
|
|
66365
66438
|
if (states["1006"]?.emergencyStopState === 1)
|
|
66366
66439
|
return "The robot's emergency stop button is pressed. Release the red button on the robot, then try again.";
|
|
66367
|
-
const battery =
|
|
66440
|
+
const battery = num2(states["1001"]?.batteryPercent);
|
|
66368
66441
|
if (kind !== "return" && battery !== null && battery < 10)
|
|
66369
66442
|
return `The battery is at ${battery}%. PadBot robots do not start jobs under 10%; send it to charge first.`;
|
|
66370
66443
|
if (kind === "return" && [1, 2].includes(states["1002"]?.chargingState))
|
|
@@ -66386,7 +66459,7 @@ function padbotReadiness(states, now = Date.now()) {
|
|
|
66386
66459
|
heartbeatAt: st["1000"]?.updatedAt ?? null,
|
|
66387
66460
|
emergencyStopPressed: es.emergencyStopState === 1,
|
|
66388
66461
|
wheelLockState: es.wheelLockState ?? null,
|
|
66389
|
-
batteryPercent:
|
|
66462
|
+
batteryPercent: num2(st["1001"]?.batteryPercent),
|
|
66390
66463
|
chargingState: charging ?? null,
|
|
66391
66464
|
map: { id: st["1007"]?.mapId ?? null, name: st["1007"]?.mapDisplayName ?? null, floor: st["1007"]?.floor ?? null },
|
|
66392
66465
|
navigation: { actionType: nav.actionType ?? null, actionState: nav.actionState ?? null, message: nav.message ?? null, updatedAt: nav.updatedAt ?? null },
|
|
@@ -66443,19 +66516,19 @@ function padbotMotion(m, now) {
|
|
|
66443
66516
|
}
|
|
66444
66517
|
function networkText(net) {
|
|
66445
66518
|
const say = (label2, v) => v < 0 ? ` \xB7 ${label2} ${v} dBm` : ` \xB7 ${label2} signal ${v}`;
|
|
66446
|
-
const wifi =
|
|
66519
|
+
const wifi = num2(net?.wifi?.signalStrength);
|
|
66447
66520
|
if (wifi !== null)
|
|
66448
66521
|
return say("Wi-Fi", wifi);
|
|
66449
|
-
const cell =
|
|
66522
|
+
const cell = num2(net?.cellular?.signalStrength);
|
|
66450
66523
|
return cell !== null ? say("Mobile", cell) : "";
|
|
66451
66524
|
}
|
|
66452
66525
|
function padbotPlanShare(frame2, x, y) {
|
|
66453
|
-
const w =
|
|
66454
|
-
const wx =
|
|
66526
|
+
const w = num2(frame2?.width), h = num2(frame2?.height), r = num2(frame2?.resolution);
|
|
66527
|
+
const wx = num2(x), wy = num2(y);
|
|
66455
66528
|
if (!w || !h || !r || r <= 0 || wx === null || wy === null)
|
|
66456
66529
|
return null;
|
|
66457
|
-
const px = (wx - (
|
|
66458
|
-
const pyUp = (wy - (
|
|
66530
|
+
const px = (wx - (num2(frame2?.originX) ?? 0)) / r;
|
|
66531
|
+
const pyUp = (wy - (num2(frame2?.originY) ?? 0)) / r;
|
|
66459
66532
|
const sx = px / w * 100, sy = 100 - pyUp / h * 100;
|
|
66460
66533
|
if (sx < 0 || sx > 100 || sy < 0 || sy > 100)
|
|
66461
66534
|
return null;
|
|
@@ -66485,9 +66558,9 @@ function padbotCurrentMap(maps, ids2, floor) {
|
|
|
66485
66558
|
}
|
|
66486
66559
|
function padbotChargingPoint(map) {
|
|
66487
66560
|
const piles = (Array.isArray(map?.targetPoints) ? map.targetPoints : []).filter(
|
|
66488
|
-
(t) => Number(t?.targetPointType) === 10 &&
|
|
66561
|
+
(t) => Number(t?.targetPointType) === 10 && num2(t?.worldX) !== null && num2(t?.worldY) !== null
|
|
66489
66562
|
);
|
|
66490
|
-
return piles.length === 1 ? { worldX:
|
|
66563
|
+
return piles.length === 1 ? { worldX: num2(piles[0].worldX), worldY: num2(piles[0].worldY), yaw: piles[0].yaw } : null;
|
|
66491
66564
|
}
|
|
66492
66565
|
var PADBOT_OTHER_MAP_TEXT = "The robot must be on this map first.";
|
|
66493
66566
|
function padbotAlarmFault(alarm) {
|
|
@@ -66582,9 +66655,9 @@ function padbotPatrolRecord(r) {
|
|
|
66582
66655
|
result: PATROL_RESULT[r?.completionState] ?? "unknown",
|
|
66583
66656
|
startedAt: r?.startedAt ?? null,
|
|
66584
66657
|
endedAt: r?.endedAt ?? null,
|
|
66585
|
-
durationS:
|
|
66586
|
-
distanceM:
|
|
66587
|
-
alarmCount:
|
|
66658
|
+
durationS: num2(r?.duration),
|
|
66659
|
+
distanceM: num2(r?.mileage),
|
|
66660
|
+
alarmCount: num2(r?.alarmCount) ?? 0
|
|
66588
66661
|
};
|
|
66589
66662
|
}
|
|
66590
66663
|
function padbotCheckpointVisit(d) {
|
|
@@ -66594,15 +66667,15 @@ function padbotCheckpointVisit(d) {
|
|
|
66594
66667
|
skipped: d?.skipped === true,
|
|
66595
66668
|
imageUrl: d?.visibleLightImageUrl ?? null,
|
|
66596
66669
|
thermalImageUrl: d?.thermalImageUrl ?? null,
|
|
66597
|
-
centerTempC:
|
|
66598
|
-
maxTempC:
|
|
66670
|
+
centerTempC: num2(d?.centerTemperature),
|
|
66671
|
+
maxTempC: num2(d?.maxTemperature)
|
|
66599
66672
|
};
|
|
66600
66673
|
}
|
|
66601
66674
|
var asList = (d) => Array.isArray(d) ? d : Array.isArray(d?.items) ? d.items : Array.isArray(d?.list) ? d.list : Array.isArray(d?.records) ? d.records : [];
|
|
66602
66675
|
var page = (data, map) => ({
|
|
66603
66676
|
items: (Array.isArray(data?.items) ? data.items : []).map(map),
|
|
66604
|
-
total:
|
|
66605
|
-
pages:
|
|
66677
|
+
total: num2(data?.totalItems) ?? 0,
|
|
66678
|
+
pages: num2(data?.totalPages) ?? 0
|
|
66606
66679
|
});
|
|
66607
66680
|
function createPadbotClient(credentials, options = {}) {
|
|
66608
66681
|
const baseUrl = (options.baseUrl ?? padbotBaseUrl()).replace(/\/+$/, "");
|
|
@@ -66824,7 +66897,7 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
66824
66897
|
const { online, mode, statusName } = padbotMode(st, now());
|
|
66825
66898
|
const floor = st["1007"]?.floor;
|
|
66826
66899
|
const restBatteryAt = ms(st["1001"]?.updatedAt);
|
|
66827
|
-
const battery = heard?.batteryPercent !== void 0 && (!Number.isFinite(restBatteryAt) || (heard.batteryAt ?? 0) > restBatteryAt) ? heard.batteryPercent :
|
|
66900
|
+
const battery = heard?.batteryPercent !== void 0 && (!Number.isFinite(restBatteryAt) || (heard.batteryAt ?? 0) > restBatteryAt) ? heard.batteryPercent : num2(st["1001"]?.batteryPercent);
|
|
66828
66901
|
const failed = lastFailure.get(`${account}:${robotSn}`);
|
|
66829
66902
|
const showFailure = online && failed && now() - failed.at < PADBOT_FAILURE_SHOW_MS && /^(Standing by|Charging)/.test(statusName);
|
|
66830
66903
|
const robot = {
|
|
@@ -66851,15 +66924,15 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
66851
66924
|
return robot;
|
|
66852
66925
|
const [loc, openA] = await Promise.all([locRead, alarmRead]);
|
|
66853
66926
|
const alarm = robot.fault ? null : openA;
|
|
66854
|
-
const lx =
|
|
66855
|
-
const ly =
|
|
66927
|
+
const lx = num2(loc?.worldX ?? loc?.x);
|
|
66928
|
+
const ly = num2(loc?.worldY ?? loc?.y);
|
|
66856
66929
|
if (typeof loc?.mapId === "string" && loc.mapId)
|
|
66857
66930
|
robot.mapId = loc.mapId;
|
|
66858
66931
|
const map = await maps(robotSn).then((all) => padbotCurrentMap(all, [robot.mapId, st["1007"]?.mapId], robot.floorNo)).catch(() => null);
|
|
66859
66932
|
if (map)
|
|
66860
66933
|
robot.mapId = map.mapId;
|
|
66861
66934
|
if (lx !== null && ly !== null) {
|
|
66862
|
-
robot.position = { x: lx, y: ly, theta: (
|
|
66935
|
+
robot.position = { x: lx, y: ly, theta: (num2(loc.yaw ?? loc.r) ?? 0) * Math.PI / 180 };
|
|
66863
66936
|
robot.planPosition = padbotPlanShare(map, lx, ly);
|
|
66864
66937
|
}
|
|
66865
66938
|
const mo = motions.get(`${account}:${robotSn}`);
|
|
@@ -66879,7 +66952,7 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
66879
66952
|
const onCharger = [1, 2].includes(st["1002"]?.chargingState);
|
|
66880
66953
|
const pile = onCharger && !robot.position ? padbotChargingPoint(map) : null;
|
|
66881
66954
|
if (pile) {
|
|
66882
|
-
robot.position = { x: pile.worldX, y: pile.worldY, theta: (
|
|
66955
|
+
robot.position = { x: pile.worldX, y: pile.worldY, theta: (num2(pile.yaw) ?? 0) * Math.PI / 180 };
|
|
66883
66956
|
robot.planPosition = padbotPlanShare(map, pile.worldX, pile.worldY);
|
|
66884
66957
|
if (!going || going.done)
|
|
66885
66958
|
robot.statusName = `${robot.statusName} \xB7 At charger`;
|
|
@@ -66979,12 +67052,12 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
66979
67052
|
throw new BadRequestError137(block);
|
|
66980
67053
|
lastFailure.delete(`${account}:${robotSn}`);
|
|
66981
67054
|
const heard = padbotLive(account, robotSn)?.pose;
|
|
66982
|
-
const lx =
|
|
66983
|
-
const ly =
|
|
67055
|
+
const lx = num2(where?.loc?.worldX);
|
|
67056
|
+
const ly = num2(where?.loc?.worldY);
|
|
66984
67057
|
let target = null;
|
|
66985
67058
|
if (command.kind === "go-to-point") {
|
|
66986
67059
|
const pt = (where?.all ?? []).flatMap((m) => Array.isArray(m?.targetPoints) ? m.targetPoints : []).find((t) => t?.targetPointId === command.targetPointId);
|
|
66987
|
-
target = { name: String(pt?.name || "the chosen point"), x:
|
|
67060
|
+
target = { name: String(pt?.name || "the chosen point"), x: num2(pt?.worldX), y: num2(pt?.worldY) };
|
|
66988
67061
|
}
|
|
66989
67062
|
motion = {
|
|
66990
67063
|
kind: command.kind,
|
|
@@ -68036,11 +68109,11 @@ function decodeTrackingFrame(data) {
|
|
|
68036
68109
|
if (!parsed || typeof parsed !== "object")
|
|
68037
68110
|
return null;
|
|
68038
68111
|
const frame2 = parsed;
|
|
68039
|
-
const
|
|
68040
|
-
const x =
|
|
68041
|
-
const y =
|
|
68042
|
-
const theta =
|
|
68043
|
-
const statusFlag =
|
|
68112
|
+
const num4 = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
68113
|
+
const x = num4(frame2.x);
|
|
68114
|
+
const y = num4(frame2.y);
|
|
68115
|
+
const theta = num4(frame2.theta);
|
|
68116
|
+
const statusFlag = num4(frame2.status);
|
|
68044
68117
|
if (x === null || y === null || theta === null || statusFlag === null) {
|
|
68045
68118
|
return null;
|
|
68046
68119
|
}
|
|
@@ -68564,22 +68637,22 @@ function useRobotFaultSweep(deps) {
|
|
|
68564
68637
|
if (!robot)
|
|
68565
68638
|
return;
|
|
68566
68639
|
out.robots++;
|
|
68567
|
-
let
|
|
68640
|
+
let reading2;
|
|
68568
68641
|
try {
|
|
68569
68642
|
const state = deps?.readState ? await deps.readState(robot) : await readRobotState(robot, { timeoutMs: cfg.timeoutMs });
|
|
68570
68643
|
if (deps?.readState)
|
|
68571
68644
|
rememberRobotState(robot, state);
|
|
68572
|
-
|
|
68573
|
-
if (
|
|
68574
|
-
Object.assign(
|
|
68645
|
+
reading2 = { ok: true, online: state.online === true, fault: state.fault ?? null };
|
|
68646
|
+
if (reading2.fault)
|
|
68647
|
+
Object.assign(reading2.fault, { floorNo: state.floorNo ?? null });
|
|
68575
68648
|
} catch (error) {
|
|
68576
68649
|
if (deps?.readState)
|
|
68577
68650
|
rememberRobotState(robot, null);
|
|
68578
|
-
|
|
68651
|
+
reading2 = { ok: false, error: error?.message ?? "no answer" };
|
|
68579
68652
|
}
|
|
68580
68653
|
const records = byRobot2.get(String(robot._id)) ?? [];
|
|
68581
68654
|
const offlineRec = records.find((r) => r.code === OFFLINE_FAULT_CODE);
|
|
68582
|
-
const plan = planFaultChanges(records,
|
|
68655
|
+
const plan = planFaultChanges(records, reading2);
|
|
68583
68656
|
for (const id of plan.clear) {
|
|
68584
68657
|
await repo.clearFault(id);
|
|
68585
68658
|
out.cleared++;
|
|
@@ -68592,7 +68665,7 @@ function useRobotFaultSweep(deps) {
|
|
|
68592
68665
|
out.alerts++;
|
|
68593
68666
|
}
|
|
68594
68667
|
for (const f of plan.open) {
|
|
68595
|
-
const detail =
|
|
68668
|
+
const detail = reading2.ok && reading2.fault?.code === f.code ? reading2.fault : null;
|
|
68596
68669
|
const r = await openFaultRecord(robot, detail ? { ...detail, ...f } : f, { notify: true, notifyFn: deps?.notifyFn });
|
|
68597
68670
|
if (r.opened)
|
|
68598
68671
|
out.opened++;
|
|
@@ -69910,7 +69983,7 @@ function measurementScale(vertices, meas) {
|
|
|
69910
69983
|
return est.length ? est.reduce((n, v) => n + v, 0) / est.length : null;
|
|
69911
69984
|
}
|
|
69912
69985
|
var pval = (p) => Array.isArray(p) ? p[1] : p;
|
|
69913
|
-
var
|
|
69986
|
+
var num3 = (v, fallback = 0) => v !== null && v !== "" && Number.isFinite(Number(v)) ? Number(v) : fallback;
|
|
69914
69987
|
var str60 = (v) => String(v ?? "").slice(0, 60);
|
|
69915
69988
|
function decodeParams(raw) {
|
|
69916
69989
|
const out = {};
|
|
@@ -69930,7 +70003,7 @@ function fileVertexParams(raw) {
|
|
|
69930
70003
|
const v = raw[k];
|
|
69931
70004
|
if (v === void 0 || v === null)
|
|
69932
70005
|
continue;
|
|
69933
|
-
out[k] = k.startsWith("is_") ? Boolean(v) : k === "merge_radius" ? clamp3(
|
|
70006
|
+
out[k] = k.startsWith("is_") ? Boolean(v) : k === "merge_radius" ? clamp3(num3(v), 0, 100) : str60(v);
|
|
69934
70007
|
}
|
|
69935
70008
|
return out;
|
|
69936
70009
|
}
|
|
@@ -70003,14 +70076,14 @@ function fromBuildingYaml(doc) {
|
|
|
70003
70076
|
const raw = names.map((name) => {
|
|
70004
70077
|
const y = doc.levels[name] ?? {};
|
|
70005
70078
|
const vertices = (Array.isArray(y.vertices) ? y.vertices : []).map((v) => ({
|
|
70006
|
-
x:
|
|
70007
|
-
y:
|
|
70079
|
+
x: num3(v?.[0]),
|
|
70080
|
+
y: num3(v?.[1]) * flip,
|
|
70008
70081
|
name: str60(v?.[3]),
|
|
70009
70082
|
params: fileVertexParams(decodeParams(v?.[4]))
|
|
70010
70083
|
}));
|
|
70011
|
-
const fiducials = (Array.isArray(y.fiducials) ? y.fiducials : []).map((f) => ({ x:
|
|
70012
|
-
const meas = edgeList(y.measurements).map((e) => [e.a, e.b,
|
|
70013
|
-
return { name: str60(name), y, vertices, fiducials, meas, elevation:
|
|
70084
|
+
const fiducials = (Array.isArray(y.fiducials) ? y.fiducials : []).map((f) => ({ x: num3(f?.[0]), y: num3(f?.[1]) * flip, name: str60(f?.[2]) }));
|
|
70085
|
+
const meas = edgeList(y.measurements).map((e) => [e.a, e.b, num3(e.p.distance)]);
|
|
70086
|
+
return { name: str60(name), y, vertices, fiducials, meas, elevation: num3(y.elevation) };
|
|
70014
70087
|
});
|
|
70015
70088
|
const refName = raw.some((l) => l.name === doc.reference_level_name) ? String(doc.reference_level_name) : raw[0].name;
|
|
70016
70089
|
const ref = raw.find((l) => l.name === refName);
|
|
@@ -70084,20 +70157,20 @@ function fromBuildingYaml(doc) {
|
|
|
70084
70157
|
const extra = {};
|
|
70085
70158
|
if (e.p.texture_name !== void 0 && e.p.texture_name !== "default")
|
|
70086
70159
|
extra.textureName = str60(e.p.texture_name);
|
|
70087
|
-
if (e.p.alpha !== void 0 &&
|
|
70088
|
-
extra.alpha = clamp3(
|
|
70089
|
-
if (e.p.texture_height !== void 0 &&
|
|
70090
|
-
extra.textureHeight = clamp3(
|
|
70091
|
-
if (e.p.texture_width !== void 0 &&
|
|
70092
|
-
extra.textureWidth = clamp3(
|
|
70093
|
-
if (e.p.texture_scale !== void 0 &&
|
|
70094
|
-
extra.textureScale = clamp3(
|
|
70160
|
+
if (e.p.alpha !== void 0 && num3(e.p.alpha, 1) !== 1)
|
|
70161
|
+
extra.alpha = clamp3(num3(e.p.alpha, 1), 0, 1);
|
|
70162
|
+
if (e.p.texture_height !== void 0 && num3(e.p.texture_height, 2.5) !== 2.5)
|
|
70163
|
+
extra.textureHeight = clamp3(num3(e.p.texture_height, 2.5), 0, 100);
|
|
70164
|
+
if (e.p.texture_width !== void 0 && num3(e.p.texture_width, 1) !== 1)
|
|
70165
|
+
extra.textureWidth = clamp3(num3(e.p.texture_width, 1), 0, 100);
|
|
70166
|
+
if (e.p.texture_scale !== void 0 && num3(e.p.texture_scale, 1) !== 1)
|
|
70167
|
+
extra.textureScale = clamp3(num3(e.p.texture_scale, 1), 0, 100);
|
|
70095
70168
|
level2.walls.push({ v1: ids2[e.a], v2: ids2[e.b], ...extra });
|
|
70096
70169
|
}
|
|
70097
70170
|
for (const e of edgeList(lv.y.doors).filter(ok)) {
|
|
70098
70171
|
const type = String(e.p.type ?? "hinged");
|
|
70099
|
-
const degrees = clamp3(
|
|
70100
|
-
const ratio = clamp3(
|
|
70172
|
+
const degrees = clamp3(num3(e.p.motion_degrees, 90), -360, 360);
|
|
70173
|
+
const ratio = clamp3(num3(e.p.right_left_ratio, 1), 0, 10);
|
|
70101
70174
|
const plugin = str60(e.p.plugin ?? "normal");
|
|
70102
70175
|
level2.doors.push({
|
|
70103
70176
|
name: str60(e.p.name ?? "").trim() || `door_${level2.doors.length + 1}`,
|
|
@@ -70106,13 +70179,13 @@ function fromBuildingYaml(doc) {
|
|
|
70106
70179
|
type: ["hinged", "double_hinged", "sliding", "double_sliding"].includes(type) ? type : "hinged",
|
|
70107
70180
|
...e.p.motion_axis === "end" ? { motionAxis: "end" } : {},
|
|
70108
70181
|
...degrees !== 90 ? { motionDegrees: degrees } : {},
|
|
70109
|
-
...
|
|
70182
|
+
...num3(e.p.motion_direction, 1) < 0 ? { motionDirection: -1 } : {},
|
|
70110
70183
|
...ratio !== 1 ? { rightLeftRatio: ratio } : {},
|
|
70111
70184
|
...plugin !== "normal" ? { plugin } : {}
|
|
70112
70185
|
});
|
|
70113
70186
|
}
|
|
70114
70187
|
for (const e of edgeList(lv.y.lanes).filter(ok)) {
|
|
70115
|
-
const gi = Math.round(
|
|
70188
|
+
const gi = Math.round(num3(e.p.graph_idx, 0));
|
|
70116
70189
|
if (gi < 0 || gi > 8) {
|
|
70117
70190
|
warnings.push(`Floor ${lv.name}: a lane on graph ${gi} was skipped (graphs 0-8 only).`);
|
|
70118
70191
|
continue;
|
|
@@ -70125,14 +70198,14 @@ function fromBuildingYaml(doc) {
|
|
|
70125
70198
|
graphIdx: gi,
|
|
70126
70199
|
bidirectional: e.p.bidirectional === true,
|
|
70127
70200
|
...orientation ? { orientation } : {},
|
|
70128
|
-
...
|
|
70201
|
+
...num3(e.p.speed_limit) > 0 ? { speedLimit: clamp3(num3(e.p.speed_limit), 0, 20) } : {},
|
|
70129
70202
|
...e.p.mutex ? { mutex: str60(e.p.mutex) } : {},
|
|
70130
70203
|
...e.p.demo_mock_floor_name ? { demoMockFloorName: str60(e.p.demo_mock_floor_name) } : {},
|
|
70131
70204
|
...e.p.demo_mock_lift_name ? { demoMockLiftName: str60(e.p.demo_mock_lift_name) } : {}
|
|
70132
70205
|
});
|
|
70133
70206
|
}
|
|
70134
70207
|
for (const e of edgeList(lv.y.measurements).filter(ok)) {
|
|
70135
|
-
const d =
|
|
70208
|
+
const d = num3(e.p.distance);
|
|
70136
70209
|
if (d >= 0.01)
|
|
70137
70210
|
level2.measurements.push({ v1: ids2[e.a], v2: ids2[e.b], distanceM: Math.min(d, 1e4) });
|
|
70138
70211
|
}
|
|
@@ -70163,14 +70236,14 @@ function fromBuildingYaml(doc) {
|
|
|
70163
70236
|
if (ly?.reference_floor_name && !levelNames.has(ly.reference_floor_name)) {
|
|
70164
70237
|
warnings.push(`Lift ${str60(liftName)}: its reference floor "${str60(ly.reference_floor_name)}" is not in the file; ${refName} was used.`);
|
|
70165
70238
|
}
|
|
70166
|
-
const c = applyXform(xf(refFloor), { x:
|
|
70239
|
+
const c = applyXform(xf(refFloor), { x: num3(ly?.x), y: num3(ly?.y) * flip });
|
|
70167
70240
|
const doors = Object.entries(ly?.doors ?? {}).slice(0, 8).map(([dn, d]) => ({
|
|
70168
70241
|
name: str60(dn),
|
|
70169
|
-
type: MSG_LIFT_DOOR_TYPE[Math.round(
|
|
70170
|
-
x: r3(clamp3(
|
|
70171
|
-
y: r3(clamp3(
|
|
70172
|
-
widthM: r3(clamp3(
|
|
70173
|
-
axisYawRad: clamp3(
|
|
70242
|
+
type: MSG_LIFT_DOOR_TYPE[Math.round(num3(d?.door_type, 2))] ?? "double_sliding",
|
|
70243
|
+
x: r3(clamp3(num3(d?.x), -20, 20)),
|
|
70244
|
+
y: r3(clamp3(num3(d?.y), -20, 20)),
|
|
70245
|
+
widthM: r3(clamp3(num3(d?.width, 1), 0.3, 10)),
|
|
70246
|
+
axisYawRad: clamp3(num3(d?.motion_axis_orientation), -10, 10)
|
|
70174
70247
|
}));
|
|
70175
70248
|
const doorNames = new Set(doors.map((d) => d.name));
|
|
70176
70249
|
const levelDoors = Object.entries(ly?.level_doors ?? {}).filter(([level2]) => levelNames.has(level2)).map(([level2, list]) => ({ level: level2, doors: (Array.isArray(list) ? list : []).map(str60).filter((d) => doorNames.has(d)) }));
|
|
@@ -70179,9 +70252,9 @@ function fromBuildingYaml(doc) {
|
|
|
70179
70252
|
name: str60(liftName),
|
|
70180
70253
|
x: r3(c.x),
|
|
70181
70254
|
y: r3(c.y),
|
|
70182
|
-
yawRad: clamp3(
|
|
70183
|
-
widthM: r3(clamp3(
|
|
70184
|
-
depthM: r3(clamp3(
|
|
70255
|
+
yawRad: clamp3(num3(ly?.yaw), -10, 10),
|
|
70256
|
+
widthM: r3(clamp3(num3(ly?.width, 2), 0.3, 20)),
|
|
70257
|
+
depthM: r3(clamp3(num3(ly?.depth, 2), 0.3, 20)),
|
|
70185
70258
|
referenceFloor: refFloor,
|
|
70186
70259
|
...floorName(ly?.initial_floor_name) ? { initialFloor: floorName(ly.initial_floor_name) } : {},
|
|
70187
70260
|
...floorName(ly?.lowest_floor) ? { lowestFloor: floorName(ly.lowest_floor) } : {},
|
|
@@ -70235,7 +70308,7 @@ function fromNavGraph(doc, graphIdx) {
|
|
|
70235
70308
|
level2.vertices = verts.map((v, k) => {
|
|
70236
70309
|
const p = v?.[2] && typeof v[2] === "object" ? v[2] : {};
|
|
70237
70310
|
const params = fileVertexParams(p);
|
|
70238
|
-
return { id: `v${k + 1}`, x: r3(
|
|
70311
|
+
return { id: `v${k + 1}`, x: r3(num3(v?.[0])), y: r3(num3(v?.[1])), ...p.name ? { name: str60(p.name) } : {}, ...Object.keys(params).length ? { params } : {} };
|
|
70239
70312
|
});
|
|
70240
70313
|
if (Array.isArray(ly?.lanes) && ly.lanes.length > 1e4)
|
|
70241
70314
|
throw new RmfImportError(`Floor ${str60(name)} has more than 10000 one-way lanes - more than a building map can hold.`);
|
|
@@ -70275,7 +70348,7 @@ function fromNavGraph(doc, graphIdx) {
|
|
|
70275
70348
|
graphIdx,
|
|
70276
70349
|
bidirectional,
|
|
70277
70350
|
...o === "forward" || o === "backward" ? { orientation: o } : {},
|
|
70278
|
-
...
|
|
70351
|
+
...num3(p.speed_limit) > 0 ? { speedLimit: clamp3(num3(p.speed_limit), 0, 20) } : {},
|
|
70279
70352
|
...p.mutex ? { mutex: str60(p.mutex) } : {},
|
|
70280
70353
|
...p.demo_mock_floor_name ? { demoMockFloorName: str60(p.demo_mock_floor_name) } : {},
|
|
70281
70354
|
...p.demo_mock_lift_name ? { demoMockLiftName: str60(p.demo_mock_lift_name) } : {}
|
|
@@ -82668,7 +82741,7 @@ function useAccessManagementController() {
|
|
|
82668
82741
|
liftName,
|
|
82669
82742
|
unit = [],
|
|
82670
82743
|
createdAt,
|
|
82671
|
-
updatedAt,
|
|
82744
|
+
updatedAt: updatedAt2,
|
|
82672
82745
|
startDate,
|
|
82673
82746
|
endDate,
|
|
82674
82747
|
isWinsland
|
|
@@ -82704,7 +82777,7 @@ function useAccessManagementController() {
|
|
|
82704
82777
|
startDate,
|
|
82705
82778
|
endDate,
|
|
82706
82779
|
createdAt,
|
|
82707
|
-
updatedAt,
|
|
82780
|
+
updatedAt: updatedAt2,
|
|
82708
82781
|
isWinsland
|
|
82709
82782
|
});
|
|
82710
82783
|
if (error) {
|
|
@@ -82726,7 +82799,7 @@ function useAccessManagementController() {
|
|
|
82726
82799
|
startDate,
|
|
82727
82800
|
endDate,
|
|
82728
82801
|
createdAt,
|
|
82729
|
-
updatedAt,
|
|
82802
|
+
updatedAt: updatedAt2,
|
|
82730
82803
|
isWinsland
|
|
82731
82804
|
});
|
|
82732
82805
|
return res.status(201).json({
|
|
@@ -106743,6 +106816,7 @@ export {
|
|
|
106743
106816
|
OUNITECH_BRAND,
|
|
106744
106817
|
OUNITECH_BRAND_DEFINITION,
|
|
106745
106818
|
OUNITECH_CAPABILITIES,
|
|
106819
|
+
OUNITECH_FRESH_MS,
|
|
106746
106820
|
OUNITECH_PENDING_COMMANDS,
|
|
106747
106821
|
OUNITECH_REGION_BASE_URLS,
|
|
106748
106822
|
OUNITECH_TIMESTAMP_FORMAT,
|
|
@@ -107110,6 +107184,7 @@ export {
|
|
|
107110
107184
|
orgRoleSets,
|
|
107111
107185
|
orgSchema,
|
|
107112
107186
|
ounitechFault,
|
|
107187
|
+
ounitechJobWords,
|
|
107113
107188
|
ounitechRobotFromHomeRow,
|
|
107114
107189
|
overnight_parking_requests_namespace_collection,
|
|
107115
107190
|
padbotAccountKey,
|