@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.js
CHANGED
|
@@ -250,6 +250,7 @@ __export(src_exports, {
|
|
|
250
250
|
OUNITECH_BRAND: () => OUNITECH_BRAND,
|
|
251
251
|
OUNITECH_BRAND_DEFINITION: () => OUNITECH_BRAND_DEFINITION,
|
|
252
252
|
OUNITECH_CAPABILITIES: () => OUNITECH_CAPABILITIES,
|
|
253
|
+
OUNITECH_FRESH_MS: () => OUNITECH_FRESH_MS,
|
|
253
254
|
OUNITECH_PENDING_COMMANDS: () => OUNITECH_PENDING_COMMANDS,
|
|
254
255
|
OUNITECH_REGION_BASE_URLS: () => OUNITECH_REGION_BASE_URLS,
|
|
255
256
|
OUNITECH_TIMESTAMP_FORMAT: () => OUNITECH_TIMESTAMP_FORMAT,
|
|
@@ -617,6 +618,7 @@ __export(src_exports, {
|
|
|
617
618
|
orgRoleSets: () => orgRoleSets,
|
|
618
619
|
orgSchema: () => orgSchema,
|
|
619
620
|
ounitechFault: () => ounitechFault,
|
|
621
|
+
ounitechJobWords: () => ounitechJobWords,
|
|
620
622
|
ounitechRobotFromHomeRow: () => ounitechRobotFromHomeRow,
|
|
621
623
|
overnight_parking_requests_namespace_collection: () => overnight_parking_requests_namespace_collection,
|
|
622
624
|
padbotAccountKey: () => padbotAccountKey,
|
|
@@ -11254,15 +11256,15 @@ function robotConnectionText(robotName, online, minutes) {
|
|
|
11254
11256
|
}
|
|
11255
11257
|
var OFFLINE_FAULT_CODE = "OFFLINE";
|
|
11256
11258
|
var SAME_OCCURRENCE_MS = 1e3;
|
|
11257
|
-
function planFaultChanges(open,
|
|
11259
|
+
function planFaultChanges(open, reading2) {
|
|
11258
11260
|
const byCode = new Map(open.map((r) => [r.code, r]));
|
|
11259
11261
|
const want = [];
|
|
11260
|
-
const offline = !
|
|
11262
|
+
const offline = !reading2.ok || reading2.online === false;
|
|
11261
11263
|
if (offline) {
|
|
11262
|
-
const reason =
|
|
11264
|
+
const reason = reading2.ok ? "" : String(reading2.error ?? "").slice(0, 200);
|
|
11263
11265
|
want.push({ code: OFFLINE_FAULT_CODE, message: reason ? `Not reporting: ${reason}` : "Not reporting" });
|
|
11264
11266
|
}
|
|
11265
|
-
const fault =
|
|
11267
|
+
const fault = reading2.ok && reading2.fault?.code ? reading2.fault : null;
|
|
11266
11268
|
if (fault)
|
|
11267
11269
|
want.push({ code: fault.code, message: fault.message || fault.code, since: fault.since });
|
|
11268
11270
|
const clear = [];
|
|
@@ -11294,12 +11296,12 @@ function planFaultChanges(open, reading) {
|
|
|
11294
11296
|
return { open: toOpen, clear, refresh };
|
|
11295
11297
|
}
|
|
11296
11298
|
function robotFaultSweepConfig(env2 = process.env) {
|
|
11297
|
-
const
|
|
11299
|
+
const num4 = (v, def, min, max) => {
|
|
11298
11300
|
const n = Math.floor(Number(v));
|
|
11299
11301
|
return Number.isFinite(n) && String(v ?? "").trim() !== "" ? Math.min(max, Math.max(min, n)) : def;
|
|
11300
11302
|
};
|
|
11301
11303
|
const enabled = String(env2.ROBOT_FAULT_SWEEP ?? "on").trim().toLowerCase() !== "off";
|
|
11302
|
-
const asked =
|
|
11304
|
+
const asked = num4(env2.ROBOT_FAULT_SWEEP_SECONDS, 60, 10, 3600);
|
|
11303
11305
|
const pick = (steps, v) => steps.filter((d) => d <= v).pop() ?? steps[0];
|
|
11304
11306
|
const subMinute = asked < 60;
|
|
11305
11307
|
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));
|
|
@@ -11309,9 +11311,9 @@ function robotFaultSweepConfig(env2 = process.env) {
|
|
|
11309
11311
|
enabled,
|
|
11310
11312
|
seconds,
|
|
11311
11313
|
cron: cron2,
|
|
11312
|
-
concurrency:
|
|
11313
|
-
timeoutMs:
|
|
11314
|
-
offlineAlertMinutes:
|
|
11314
|
+
concurrency: num4(env2.ROBOT_FAULT_SWEEP_CONCURRENCY, 4, 1, 16),
|
|
11315
|
+
timeoutMs: num4(env2.ROBOT_FAULT_SWEEP_TIMEOUT_MS, 1e4, 1e3, 6e4),
|
|
11316
|
+
offlineAlertMinutes: num4(env2.ROBOT_OFFLINE_ALERT_MINUTES, 10, 1, 1440)
|
|
11315
11317
|
};
|
|
11316
11318
|
}
|
|
11317
11319
|
function withTimeout(promise, ms2, label2 = "Timed out") {
|
|
@@ -27119,7 +27121,7 @@ function usePersonRepo() {
|
|
|
27119
27121
|
}
|
|
27120
27122
|
async function pushVehicleById(id, plate, session) {
|
|
27121
27123
|
const { plateNumber, recNo } = plate;
|
|
27122
|
-
const
|
|
27124
|
+
const updatedAt2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
27123
27125
|
const _id = (0, import_node_server_utils64.toObjectId)(id);
|
|
27124
27126
|
try {
|
|
27125
27127
|
const updateExisting = await collection.updateOne(
|
|
@@ -27130,7 +27132,7 @@ function usePersonRepo() {
|
|
|
27130
27132
|
{
|
|
27131
27133
|
$set: {
|
|
27132
27134
|
"plates.$.recNo": recNo,
|
|
27133
|
-
updatedAt
|
|
27135
|
+
updatedAt: updatedAt2
|
|
27134
27136
|
}
|
|
27135
27137
|
},
|
|
27136
27138
|
{ session }
|
|
@@ -27146,7 +27148,7 @@ function usePersonRepo() {
|
|
|
27146
27148
|
}
|
|
27147
27149
|
},
|
|
27148
27150
|
$set: {
|
|
27149
|
-
updatedAt
|
|
27151
|
+
updatedAt: updatedAt2
|
|
27150
27152
|
}
|
|
27151
27153
|
},
|
|
27152
27154
|
{ session }
|
|
@@ -27157,7 +27159,7 @@ function usePersonRepo() {
|
|
|
27157
27159
|
}
|
|
27158
27160
|
}
|
|
27159
27161
|
async function pullVehicleByRecNo(recNo, scope, session) {
|
|
27160
|
-
const
|
|
27162
|
+
const updatedAt2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
27161
27163
|
const owner = scope?.peopleId ? (0, import_node_server_utils64.toObjectId)(scope.peopleId) : null;
|
|
27162
27164
|
const site = scope?.site ? (0, import_node_server_utils64.toObjectId)(scope.site) : null;
|
|
27163
27165
|
if (!owner && !site) {
|
|
@@ -27196,7 +27198,7 @@ function usePersonRepo() {
|
|
|
27196
27198
|
plates: match
|
|
27197
27199
|
},
|
|
27198
27200
|
$set: {
|
|
27199
|
-
updatedAt
|
|
27201
|
+
updatedAt: updatedAt2
|
|
27200
27202
|
}
|
|
27201
27203
|
},
|
|
27202
27204
|
{ session }
|
|
@@ -48418,7 +48420,7 @@ var MKeyLog = class {
|
|
|
48418
48420
|
organization = "",
|
|
48419
48421
|
serviceProvider = "",
|
|
48420
48422
|
createdAt = /* @__PURE__ */ new Date(),
|
|
48421
|
-
updatedAt = /* @__PURE__ */ new Date(),
|
|
48423
|
+
updatedAt: updatedAt2 = /* @__PURE__ */ new Date(),
|
|
48422
48424
|
template,
|
|
48423
48425
|
status = "Available",
|
|
48424
48426
|
updatedBy = "",
|
|
@@ -48439,7 +48441,7 @@ var MKeyLog = class {
|
|
|
48439
48441
|
this.organization = organization;
|
|
48440
48442
|
this.serviceProvider = serviceProvider;
|
|
48441
48443
|
this.createdAt = createdAt;
|
|
48442
|
-
this.updatedAt =
|
|
48444
|
+
this.updatedAt = updatedAt2;
|
|
48443
48445
|
this.template = template;
|
|
48444
48446
|
this.status = status;
|
|
48445
48447
|
this.updatedBy = updatedBy;
|
|
@@ -57078,7 +57080,7 @@ var MAccessCard = class {
|
|
|
57078
57080
|
isLiftCard,
|
|
57079
57081
|
liftAccessLevel,
|
|
57080
57082
|
createdAt,
|
|
57081
|
-
updatedAt,
|
|
57083
|
+
updatedAt: updatedAt2,
|
|
57082
57084
|
assignedUnit,
|
|
57083
57085
|
userType,
|
|
57084
57086
|
doorName,
|
|
@@ -57105,7 +57107,7 @@ var MAccessCard = class {
|
|
|
57105
57107
|
this.isLiftCard = isLiftCard;
|
|
57106
57108
|
this.liftAccessLevel = liftAccessLevel;
|
|
57107
57109
|
this.createdAt = createdAt;
|
|
57108
|
-
this.updatedAt =
|
|
57110
|
+
this.updatedAt = updatedAt2;
|
|
57109
57111
|
this.assignedUnit = assignedUnit;
|
|
57110
57112
|
this.userType = userType;
|
|
57111
57113
|
this.doorName = doorName;
|
|
@@ -57284,8 +57286,8 @@ function encryptPayload(payloadHex) {
|
|
|
57284
57286
|
);
|
|
57285
57287
|
return encrypted.toString("base64");
|
|
57286
57288
|
}
|
|
57287
|
-
function toHex(
|
|
57288
|
-
return
|
|
57289
|
+
function toHex(num4, length) {
|
|
57290
|
+
return num4.toString(16).padStart(length * 2, "0");
|
|
57289
57291
|
}
|
|
57290
57292
|
function buildPayload(cardNumber, validityMinutes) {
|
|
57291
57293
|
const randomHex = import_crypto5.default.randomBytes(2).toString("hex");
|
|
@@ -57465,8 +57467,8 @@ function UseAccessManagementRepo() {
|
|
|
57465
57467
|
}
|
|
57466
57468
|
}
|
|
57467
57469
|
function generateCardNo() {
|
|
57468
|
-
const
|
|
57469
|
-
return
|
|
57470
|
+
const num4 = Math.floor(Math.random() * 65536);
|
|
57471
|
+
return num4.toString().padStart(10, "0");
|
|
57470
57472
|
}
|
|
57471
57473
|
async function createQrData({
|
|
57472
57474
|
cardNumber,
|
|
@@ -58706,13 +58708,13 @@ function UseAccessManagementRepo() {
|
|
|
58706
58708
|
const prevCard = res && res?.[1]?.cardNo || "-1";
|
|
58707
58709
|
const currentCard = res && res?.[0]?.cardNo || "0";
|
|
58708
58710
|
let availableCardNo = [];
|
|
58709
|
-
let
|
|
58711
|
+
let num4 = parseInt(prevCard, 10) + 1;
|
|
58710
58712
|
while (availableCardNo.length < (unit.length > 0 ? unit.length : quantity)) {
|
|
58711
|
-
if (
|
|
58712
|
-
|
|
58713
|
+
if (num4 === parseInt(currentCard, 10)) {
|
|
58714
|
+
num4++;
|
|
58713
58715
|
}
|
|
58714
|
-
availableCardNo.push(
|
|
58715
|
-
|
|
58716
|
+
availableCardNo.push(num4);
|
|
58717
|
+
num4++;
|
|
58716
58718
|
}
|
|
58717
58719
|
const cardNumbers = availableCardNo.map(
|
|
58718
58720
|
(no2) => no2.toString().padStart(10, "0")
|
|
@@ -64431,13 +64433,13 @@ function parseRobotCommand(body) {
|
|
|
64431
64433
|
if (has2(k))
|
|
64432
64434
|
return { ok: false, message: `${k} is not valid for a ${kind} command.` };
|
|
64433
64435
|
}
|
|
64434
|
-
const
|
|
64435
|
-
if (!
|
|
64436
|
+
const num4 = (k) => typeof b[k] === "number" && Number.isFinite(b[k]);
|
|
64437
|
+
if (!num4("x") || !num4("y"))
|
|
64436
64438
|
return { ok: false, message: `${kind} needs x and y (metres).` };
|
|
64437
64439
|
if (kind === "navigate") {
|
|
64438
64440
|
if (has2("floorNo"))
|
|
64439
64441
|
return { ok: false, message: "floorNo is not valid for a navigate command." };
|
|
64440
|
-
if (has2("theta") && !
|
|
64442
|
+
if (has2("theta") && !num4("theta"))
|
|
64441
64443
|
return { ok: false, message: "theta must be a number (radians)." };
|
|
64442
64444
|
return {
|
|
64443
64445
|
ok: true,
|
|
@@ -64449,7 +64451,7 @@ function parseRobotCommand(body) {
|
|
|
64449
64451
|
}
|
|
64450
64452
|
};
|
|
64451
64453
|
}
|
|
64452
|
-
if (!
|
|
64454
|
+
if (!num4("theta"))
|
|
64453
64455
|
return { ok: false, message: "relocalize needs theta (radians)." };
|
|
64454
64456
|
if (!Number.isInteger(b.floorNo))
|
|
64455
64457
|
return { ok: false, message: "relocalize needs an integer floorNo." };
|
|
@@ -64873,23 +64875,81 @@ var OUNITECH_CAPABILITIES = {
|
|
|
64873
64875
|
var OUNITECH_PENDING_COMMANDS = ["pause", "resume", "cancel"].map(
|
|
64874
64876
|
(kind) => ({ kind, reason: "awaiting Ounitech's robot-control action numbers" })
|
|
64875
64877
|
);
|
|
64876
|
-
function propertyNumber(row, key) {
|
|
64877
|
-
const p = row.robotState?.properties?.find((x) => x?.key === key);
|
|
64878
|
-
const n = p?.value != null && String(p.value).trim() !== "" ? Number(p.value) : NaN;
|
|
64879
|
-
return Number.isFinite(n) ? n : null;
|
|
64880
|
-
}
|
|
64881
64878
|
var finite = (v) => typeof v === "number" && Number.isFinite(v);
|
|
64882
|
-
function
|
|
64883
|
-
|
|
64884
|
-
|
|
64885
|
-
|
|
64879
|
+
function num(v) {
|
|
64880
|
+
if (finite(v))
|
|
64881
|
+
return v;
|
|
64882
|
+
if (typeof v === "string" && v.trim() !== "") {
|
|
64883
|
+
const n = Number(v);
|
|
64884
|
+
return Number.isFinite(n) ? n : void 0;
|
|
64885
|
+
}
|
|
64886
|
+
return void 0;
|
|
64887
|
+
}
|
|
64888
|
+
function reading(st, key) {
|
|
64889
|
+
const v = st.properties?.find((x) => x?.key === key)?.value;
|
|
64890
|
+
return v == null || String(v).trim() === "" ? void 0 : String(v).trim();
|
|
64891
|
+
}
|
|
64892
|
+
var OUNITECH_FRESH_MS = 3 * 6e4;
|
|
64893
|
+
var STATUS_CODE_BY_READING = {
|
|
64894
|
+
\u5F85\u673A: 1,
|
|
64895
|
+
\u7A7A\u95F2: 1,
|
|
64896
|
+
\u6E05\u626B\u4E2D: 2,
|
|
64897
|
+
\u5DE5\u4F5C\u4E2D: 2,
|
|
64898
|
+
\u6682\u505C: 3,
|
|
64899
|
+
\u6682\u505C\u4E2D: 3,
|
|
64900
|
+
\u5EFA\u56FE\u4E2D: 4,
|
|
64901
|
+
\u56DE\u5145\u4E2D: 6,
|
|
64902
|
+
\u8FD4\u56DE\u5145\u7535: 6,
|
|
64903
|
+
\u6545\u969C: 7,
|
|
64904
|
+
\u5F02\u5E38: 7,
|
|
64905
|
+
\u5145\u7535\u4E2D: 8,
|
|
64906
|
+
\u65AD\u70B9\u5145\u7535\u4E2D: 16,
|
|
64907
|
+
\u5DF2\u5145\u6EE1: 9,
|
|
64908
|
+
\u5145\u6EE1: 9,
|
|
64909
|
+
\u6025\u505C: 11,
|
|
64910
|
+
\u5173\u673A: 14,
|
|
64911
|
+
\u79BB\u7EBF: 99
|
|
64912
|
+
};
|
|
64913
|
+
var JOB_WORDS = {
|
|
64914
|
+
\u5DF2\u7ED3\u675F: "job finished",
|
|
64915
|
+
\u5DF2\u5B8C\u6210: "job finished",
|
|
64916
|
+
\u5B8C\u6210: "job finished",
|
|
64917
|
+
\u6E05\u626B\u4E2D: "job in progress",
|
|
64918
|
+
\u8FDB\u884C\u4E2D: "job in progress",
|
|
64919
|
+
\u6682\u505C: "job paused",
|
|
64920
|
+
\u6682\u505C\u4E2D: "job paused",
|
|
64921
|
+
\u672A\u5F00\u59CB: "no job started",
|
|
64922
|
+
\u5DF2\u53D6\u6D88: "job cancelled",
|
|
64923
|
+
\u53D6\u6D88: "job cancelled"
|
|
64924
|
+
};
|
|
64925
|
+
function ounitechJobWords(st) {
|
|
64926
|
+
const v = reading(st, "job");
|
|
64927
|
+
return v ? JOB_WORDS[v] ?? null : null;
|
|
64928
|
+
}
|
|
64929
|
+
function updatedAt(v) {
|
|
64930
|
+
const n = num(v);
|
|
64931
|
+
if (n !== void 0)
|
|
64932
|
+
return n < 1e12 ? n * 1e3 : n;
|
|
64933
|
+
const t = typeof v === "string" ? Date.parse(v) : NaN;
|
|
64934
|
+
return Number.isFinite(t) ? t : null;
|
|
64935
|
+
}
|
|
64936
|
+
function ounitechRobotFromHomeRow(row, live2, now = Date.now()) {
|
|
64937
|
+
const listed = row.robotState ?? {};
|
|
64938
|
+
const st = live2 ? { ...listed, ...live2, properties: live2.properties?.length ? live2.properties : listed.properties } : listed;
|
|
64939
|
+
const statusReading = reading(st, "status");
|
|
64940
|
+
const flag = num(st.statusFlag) ?? (statusReading ? STATUS_CODE_BY_READING[statusReading] : void 0);
|
|
64941
|
+
const at2 = updatedAt(st.updateOn);
|
|
64942
|
+
const fresh = at2 !== null && now - at2 <= OUNITECH_FRESH_MS;
|
|
64943
|
+
const online = flag !== 99 && (flag !== void 0 || fresh);
|
|
64886
64944
|
const mode = online ? robotMode(flag) : "UNAVAILABLE";
|
|
64887
|
-
const pct =
|
|
64945
|
+
const pct = num(reading(st, "battery-percent")) ?? num(st.battery) ?? null;
|
|
64888
64946
|
const task = row.taskState;
|
|
64889
64947
|
const jobPct = task && String(task.statusFlag) === "1" && finite(task.accPercent) ? Math.round(task.accPercent) : null;
|
|
64890
|
-
const words = flag
|
|
64948
|
+
const words = flag !== void 0 ? ROBOT_STATUS_NAMES[flag] ?? `Status ${flag}` : online ? "Online - status not reported" : "Unknown";
|
|
64891
64949
|
const model = String(row.modelCode || row.modelName || "").trim().slice(0, 40);
|
|
64892
|
-
|
|
64950
|
+
const x = num(st.x);
|
|
64951
|
+
const y = num(st.y);
|
|
64952
|
+
const robot = {
|
|
64893
64953
|
robotSn: row.robotSn,
|
|
64894
64954
|
name: row.aliasName || row.robotName,
|
|
64895
64955
|
...model ? { model } : {},
|
|
@@ -64899,8 +64959,16 @@ function ounitechRobotFromHomeRow(row) {
|
|
|
64899
64959
|
batteryPercent: online && pct !== null && pct >= 0 && pct <= 100 ? Math.round(pct) : null,
|
|
64900
64960
|
floorNo: Number.isInteger(row.floorNo) ? row.floorNo : null,
|
|
64901
64961
|
floorKnown: Number.isInteger(row.floorNo),
|
|
64902
|
-
position: online &&
|
|
64962
|
+
position: online && x !== void 0 && y !== void 0 ? { x, y, theta: num(st.theta) ?? 0 } : null
|
|
64903
64963
|
};
|
|
64964
|
+
if (online && (flag === 7 || Array.isArray(st.rtFaultList) && st.rtFaultList.length)) {
|
|
64965
|
+
robot.fault = ounitechFault(st.rtFaultList);
|
|
64966
|
+
}
|
|
64967
|
+
return robot;
|
|
64968
|
+
}
|
|
64969
|
+
function needsLiveState(row) {
|
|
64970
|
+
const f = num(row.robotState?.statusFlag);
|
|
64971
|
+
return finite(row.robotId) && (f === void 0 || f === 99 || f === 7);
|
|
64904
64972
|
}
|
|
64905
64973
|
function ounitechFault(list) {
|
|
64906
64974
|
const f = Array.isArray(list) ? list[0] : null;
|
|
@@ -64917,6 +64985,9 @@ function ounitechFault(list) {
|
|
|
64917
64985
|
var robotTime = (d) => robotCloudTimestamp(d, "yyyy-MM-dd HH:mm:ss", "Asia/Shanghai");
|
|
64918
64986
|
function createOunitechAdapter(credentials, options) {
|
|
64919
64987
|
const cloud = useRobotCloudService(credentials, options);
|
|
64988
|
+
async function liveFor(row) {
|
|
64989
|
+
return needsLiveState(row) ? cloud.getRobotState(row.robotId).catch(() => null) : null;
|
|
64990
|
+
}
|
|
64920
64991
|
async function rowFor(robotSn) {
|
|
64921
64992
|
return (await cloud.getHomeRobots()).find((r) => r.robotSn === robotSn) ?? null;
|
|
64922
64993
|
}
|
|
@@ -64925,7 +64996,7 @@ function createOunitechAdapter(credentials, options) {
|
|
|
64925
64996
|
displayName: "Ounitech (Q3-G / Q3-W)",
|
|
64926
64997
|
capabilities: OUNITECH_CAPABILITIES,
|
|
64927
64998
|
async listRobots() {
|
|
64928
|
-
return (await cloud.getHomeRobots()).map(ounitechRobotFromHomeRow);
|
|
64999
|
+
return Promise.all((await cloud.getHomeRobots()).map(async (row) => ounitechRobotFromHomeRow(row, await liveFor(row))));
|
|
64929
65000
|
},
|
|
64930
65001
|
async getRobot(robotSn) {
|
|
64931
65002
|
const row = await rowFor(robotSn);
|
|
@@ -64941,12 +65012,7 @@ function createOunitechAdapter(credentials, options) {
|
|
|
64941
65012
|
position: null
|
|
64942
65013
|
};
|
|
64943
65014
|
}
|
|
64944
|
-
|
|
64945
|
-
if (row.robotState?.statusFlag === 7 && finite(row.robotId)) {
|
|
64946
|
-
const state = await cloud.getRobotState(row.robotId).catch(() => null);
|
|
64947
|
-
robot.fault = ounitechFault(state?.rtFaultList);
|
|
64948
|
-
}
|
|
64949
|
-
return robot;
|
|
65015
|
+
return ounitechRobotFromHomeRow(row, await liveFor(row));
|
|
64950
65016
|
},
|
|
64951
65017
|
async sendCommand(robotSn, command) {
|
|
64952
65018
|
const options2 = {
|
|
@@ -65061,10 +65127,19 @@ function createOunitechAdapter(credentials, options) {
|
|
|
65061
65127
|
const window = { timeFrom: robotTime(from), timeTo: robotTime(to) };
|
|
65062
65128
|
await run("live state (get-robot-state-v2.0)", ROBOT_CLOUD_PATHS.robotState, { robotId }, async () => {
|
|
65063
65129
|
const s = await cloud.getRobotState(robotId);
|
|
65130
|
+
const r = ounitechRobotFromHomeRow(row, s);
|
|
65131
|
+
const level2 = (...keys) => keys.map((k) => num(reading(s, k))).find((n) => n !== void 0) ?? null;
|
|
65132
|
+
const at2 = updatedAt(s.updateOn);
|
|
65064
65133
|
return {
|
|
65134
|
+
online: r.online,
|
|
65135
|
+
status: r.statusName,
|
|
65136
|
+
job: ounitechJobWords(s),
|
|
65137
|
+
battery: r.batteryPercent,
|
|
65138
|
+
cleanWater: level2("clean-water", "clean-percent"),
|
|
65139
|
+
dirtyWater: level2("dirty-water", "dirty-percent"),
|
|
65140
|
+
fault: r.fault ?? null,
|
|
65065
65141
|
statusFlag: s.statusFlag,
|
|
65066
|
-
|
|
65067
|
-
updateOn: s.updateOn ? new Date(s.updateOn).toISOString() : null,
|
|
65142
|
+
updateOn: at2 !== null ? new Date(at2).toISOString() : null,
|
|
65068
65143
|
x: s.x,
|
|
65069
65144
|
y: s.y,
|
|
65070
65145
|
theta: s.theta,
|
|
@@ -66996,7 +67071,7 @@ function statesByType(entry) {
|
|
|
66996
67071
|
}
|
|
66997
67072
|
var PADBOT_ONLINE_WINDOW_MS = 12e4;
|
|
66998
67073
|
var ms = (t) => typeof t === "string" ? Date.parse(t) : NaN;
|
|
66999
|
-
var
|
|
67074
|
+
var num2 = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
67000
67075
|
function padbotMode(states, now = Date.now()) {
|
|
67001
67076
|
const hb = ms(states["1000"]?.updatedAt);
|
|
67002
67077
|
const online = Number.isFinite(hb) && now - hb <= PADBOT_ONLINE_WINDOW_MS;
|
|
@@ -67004,7 +67079,7 @@ function padbotMode(states, now = Date.now()) {
|
|
|
67004
67079
|
return { online: false, mode: "UNAVAILABLE", statusName: "Not reporting to PadBot" };
|
|
67005
67080
|
const nav = states["1003"] ?? {};
|
|
67006
67081
|
const work = states["1010"] ?? {};
|
|
67007
|
-
const battery =
|
|
67082
|
+
const battery = num2(states["1001"]?.batteryPercent);
|
|
67008
67083
|
const charging = states["1002"]?.chargingState === 1;
|
|
67009
67084
|
const type = Number(nav.actionType) || 0;
|
|
67010
67085
|
const st = Number(nav.actionState) || 0;
|
|
@@ -67041,7 +67116,7 @@ function padbotCommandBlock(states, kind, now = Date.now()) {
|
|
|
67041
67116
|
return "The robot is not reporting to PadBot, so it cannot take a command. Check it is switched on and connected.";
|
|
67042
67117
|
if (states["1006"]?.emergencyStopState === 1)
|
|
67043
67118
|
return "The robot's emergency stop button is pressed. Release the red button on the robot, then try again.";
|
|
67044
|
-
const battery =
|
|
67119
|
+
const battery = num2(states["1001"]?.batteryPercent);
|
|
67045
67120
|
if (kind !== "return" && battery !== null && battery < 10)
|
|
67046
67121
|
return `The battery is at ${battery}%. PadBot robots do not start jobs under 10%; send it to charge first.`;
|
|
67047
67122
|
if (kind === "return" && [1, 2].includes(states["1002"]?.chargingState))
|
|
@@ -67063,7 +67138,7 @@ function padbotReadiness(states, now = Date.now()) {
|
|
|
67063
67138
|
heartbeatAt: st["1000"]?.updatedAt ?? null,
|
|
67064
67139
|
emergencyStopPressed: es.emergencyStopState === 1,
|
|
67065
67140
|
wheelLockState: es.wheelLockState ?? null,
|
|
67066
|
-
batteryPercent:
|
|
67141
|
+
batteryPercent: num2(st["1001"]?.batteryPercent),
|
|
67067
67142
|
chargingState: charging ?? null,
|
|
67068
67143
|
map: { id: st["1007"]?.mapId ?? null, name: st["1007"]?.mapDisplayName ?? null, floor: st["1007"]?.floor ?? null },
|
|
67069
67144
|
navigation: { actionType: nav.actionType ?? null, actionState: nav.actionState ?? null, message: nav.message ?? null, updatedAt: nav.updatedAt ?? null },
|
|
@@ -67120,19 +67195,19 @@ function padbotMotion(m, now) {
|
|
|
67120
67195
|
}
|
|
67121
67196
|
function networkText(net) {
|
|
67122
67197
|
const say = (label2, v) => v < 0 ? ` \xB7 ${label2} ${v} dBm` : ` \xB7 ${label2} signal ${v}`;
|
|
67123
|
-
const wifi =
|
|
67198
|
+
const wifi = num2(net?.wifi?.signalStrength);
|
|
67124
67199
|
if (wifi !== null)
|
|
67125
67200
|
return say("Wi-Fi", wifi);
|
|
67126
|
-
const cell =
|
|
67201
|
+
const cell = num2(net?.cellular?.signalStrength);
|
|
67127
67202
|
return cell !== null ? say("Mobile", cell) : "";
|
|
67128
67203
|
}
|
|
67129
67204
|
function padbotPlanShare(frame2, x, y) {
|
|
67130
|
-
const w =
|
|
67131
|
-
const wx =
|
|
67205
|
+
const w = num2(frame2?.width), h = num2(frame2?.height), r = num2(frame2?.resolution);
|
|
67206
|
+
const wx = num2(x), wy = num2(y);
|
|
67132
67207
|
if (!w || !h || !r || r <= 0 || wx === null || wy === null)
|
|
67133
67208
|
return null;
|
|
67134
|
-
const px = (wx - (
|
|
67135
|
-
const pyUp = (wy - (
|
|
67209
|
+
const px = (wx - (num2(frame2?.originX) ?? 0)) / r;
|
|
67210
|
+
const pyUp = (wy - (num2(frame2?.originY) ?? 0)) / r;
|
|
67136
67211
|
const sx = px / w * 100, sy = 100 - pyUp / h * 100;
|
|
67137
67212
|
if (sx < 0 || sx > 100 || sy < 0 || sy > 100)
|
|
67138
67213
|
return null;
|
|
@@ -67162,9 +67237,9 @@ function padbotCurrentMap(maps, ids2, floor) {
|
|
|
67162
67237
|
}
|
|
67163
67238
|
function padbotChargingPoint(map) {
|
|
67164
67239
|
const piles = (Array.isArray(map?.targetPoints) ? map.targetPoints : []).filter(
|
|
67165
|
-
(t) => Number(t?.targetPointType) === 10 &&
|
|
67240
|
+
(t) => Number(t?.targetPointType) === 10 && num2(t?.worldX) !== null && num2(t?.worldY) !== null
|
|
67166
67241
|
);
|
|
67167
|
-
return piles.length === 1 ? { worldX:
|
|
67242
|
+
return piles.length === 1 ? { worldX: num2(piles[0].worldX), worldY: num2(piles[0].worldY), yaw: piles[0].yaw } : null;
|
|
67168
67243
|
}
|
|
67169
67244
|
var PADBOT_OTHER_MAP_TEXT = "The robot must be on this map first.";
|
|
67170
67245
|
function padbotAlarmFault(alarm) {
|
|
@@ -67259,9 +67334,9 @@ function padbotPatrolRecord(r) {
|
|
|
67259
67334
|
result: PATROL_RESULT[r?.completionState] ?? "unknown",
|
|
67260
67335
|
startedAt: r?.startedAt ?? null,
|
|
67261
67336
|
endedAt: r?.endedAt ?? null,
|
|
67262
|
-
durationS:
|
|
67263
|
-
distanceM:
|
|
67264
|
-
alarmCount:
|
|
67337
|
+
durationS: num2(r?.duration),
|
|
67338
|
+
distanceM: num2(r?.mileage),
|
|
67339
|
+
alarmCount: num2(r?.alarmCount) ?? 0
|
|
67265
67340
|
};
|
|
67266
67341
|
}
|
|
67267
67342
|
function padbotCheckpointVisit(d) {
|
|
@@ -67271,15 +67346,15 @@ function padbotCheckpointVisit(d) {
|
|
|
67271
67346
|
skipped: d?.skipped === true,
|
|
67272
67347
|
imageUrl: d?.visibleLightImageUrl ?? null,
|
|
67273
67348
|
thermalImageUrl: d?.thermalImageUrl ?? null,
|
|
67274
|
-
centerTempC:
|
|
67275
|
-
maxTempC:
|
|
67349
|
+
centerTempC: num2(d?.centerTemperature),
|
|
67350
|
+
maxTempC: num2(d?.maxTemperature)
|
|
67276
67351
|
};
|
|
67277
67352
|
}
|
|
67278
67353
|
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 : [];
|
|
67279
67354
|
var page = (data, map) => ({
|
|
67280
67355
|
items: (Array.isArray(data?.items) ? data.items : []).map(map),
|
|
67281
|
-
total:
|
|
67282
|
-
pages:
|
|
67356
|
+
total: num2(data?.totalItems) ?? 0,
|
|
67357
|
+
pages: num2(data?.totalPages) ?? 0
|
|
67283
67358
|
});
|
|
67284
67359
|
function createPadbotClient(credentials, options = {}) {
|
|
67285
67360
|
const baseUrl = (options.baseUrl ?? padbotBaseUrl()).replace(/\/+$/, "");
|
|
@@ -67501,7 +67576,7 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
67501
67576
|
const { online, mode, statusName } = padbotMode(st, now());
|
|
67502
67577
|
const floor = st["1007"]?.floor;
|
|
67503
67578
|
const restBatteryAt = ms(st["1001"]?.updatedAt);
|
|
67504
|
-
const battery = heard?.batteryPercent !== void 0 && (!Number.isFinite(restBatteryAt) || (heard.batteryAt ?? 0) > restBatteryAt) ? heard.batteryPercent :
|
|
67579
|
+
const battery = heard?.batteryPercent !== void 0 && (!Number.isFinite(restBatteryAt) || (heard.batteryAt ?? 0) > restBatteryAt) ? heard.batteryPercent : num2(st["1001"]?.batteryPercent);
|
|
67505
67580
|
const failed = lastFailure.get(`${account}:${robotSn}`);
|
|
67506
67581
|
const showFailure = online && failed && now() - failed.at < PADBOT_FAILURE_SHOW_MS && /^(Standing by|Charging)/.test(statusName);
|
|
67507
67582
|
const robot = {
|
|
@@ -67528,15 +67603,15 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
67528
67603
|
return robot;
|
|
67529
67604
|
const [loc, openA] = await Promise.all([locRead, alarmRead]);
|
|
67530
67605
|
const alarm = robot.fault ? null : openA;
|
|
67531
|
-
const lx =
|
|
67532
|
-
const ly =
|
|
67606
|
+
const lx = num2(loc?.worldX ?? loc?.x);
|
|
67607
|
+
const ly = num2(loc?.worldY ?? loc?.y);
|
|
67533
67608
|
if (typeof loc?.mapId === "string" && loc.mapId)
|
|
67534
67609
|
robot.mapId = loc.mapId;
|
|
67535
67610
|
const map = await maps(robotSn).then((all) => padbotCurrentMap(all, [robot.mapId, st["1007"]?.mapId], robot.floorNo)).catch(() => null);
|
|
67536
67611
|
if (map)
|
|
67537
67612
|
robot.mapId = map.mapId;
|
|
67538
67613
|
if (lx !== null && ly !== null) {
|
|
67539
|
-
robot.position = { x: lx, y: ly, theta: (
|
|
67614
|
+
robot.position = { x: lx, y: ly, theta: (num2(loc.yaw ?? loc.r) ?? 0) * Math.PI / 180 };
|
|
67540
67615
|
robot.planPosition = padbotPlanShare(map, lx, ly);
|
|
67541
67616
|
}
|
|
67542
67617
|
const mo = motions.get(`${account}:${robotSn}`);
|
|
@@ -67556,7 +67631,7 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
67556
67631
|
const onCharger = [1, 2].includes(st["1002"]?.chargingState);
|
|
67557
67632
|
const pile = onCharger && !robot.position ? padbotChargingPoint(map) : null;
|
|
67558
67633
|
if (pile) {
|
|
67559
|
-
robot.position = { x: pile.worldX, y: pile.worldY, theta: (
|
|
67634
|
+
robot.position = { x: pile.worldX, y: pile.worldY, theta: (num2(pile.yaw) ?? 0) * Math.PI / 180 };
|
|
67560
67635
|
robot.planPosition = padbotPlanShare(map, pile.worldX, pile.worldY);
|
|
67561
67636
|
if (!going || going.done)
|
|
67562
67637
|
robot.statusName = `${robot.statusName} \xB7 At charger`;
|
|
@@ -67656,12 +67731,12 @@ function createPadbotAdapter(credentials, options = {}) {
|
|
|
67656
67731
|
throw new import_node_server_utils164.BadRequestError(block);
|
|
67657
67732
|
lastFailure.delete(`${account}:${robotSn}`);
|
|
67658
67733
|
const heard = padbotLive(account, robotSn)?.pose;
|
|
67659
|
-
const lx =
|
|
67660
|
-
const ly =
|
|
67734
|
+
const lx = num2(where?.loc?.worldX);
|
|
67735
|
+
const ly = num2(where?.loc?.worldY);
|
|
67661
67736
|
let target = null;
|
|
67662
67737
|
if (command.kind === "go-to-point") {
|
|
67663
67738
|
const pt = (where?.all ?? []).flatMap((m) => Array.isArray(m?.targetPoints) ? m.targetPoints : []).find((t) => t?.targetPointId === command.targetPointId);
|
|
67664
|
-
target = { name: String(pt?.name || "the chosen point"), x:
|
|
67739
|
+
target = { name: String(pt?.name || "the chosen point"), x: num2(pt?.worldX), y: num2(pt?.worldY) };
|
|
67665
67740
|
}
|
|
67666
67741
|
motion = {
|
|
67667
67742
|
kind: command.kind,
|
|
@@ -68713,11 +68788,11 @@ function decodeTrackingFrame(data) {
|
|
|
68713
68788
|
if (!parsed || typeof parsed !== "object")
|
|
68714
68789
|
return null;
|
|
68715
68790
|
const frame2 = parsed;
|
|
68716
|
-
const
|
|
68717
|
-
const x =
|
|
68718
|
-
const y =
|
|
68719
|
-
const theta =
|
|
68720
|
-
const statusFlag =
|
|
68791
|
+
const num4 = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
68792
|
+
const x = num4(frame2.x);
|
|
68793
|
+
const y = num4(frame2.y);
|
|
68794
|
+
const theta = num4(frame2.theta);
|
|
68795
|
+
const statusFlag = num4(frame2.status);
|
|
68721
68796
|
if (x === null || y === null || theta === null || statusFlag === null) {
|
|
68722
68797
|
return null;
|
|
68723
68798
|
}
|
|
@@ -69241,22 +69316,22 @@ function useRobotFaultSweep(deps) {
|
|
|
69241
69316
|
if (!robot)
|
|
69242
69317
|
return;
|
|
69243
69318
|
out.robots++;
|
|
69244
|
-
let
|
|
69319
|
+
let reading2;
|
|
69245
69320
|
try {
|
|
69246
69321
|
const state = deps?.readState ? await deps.readState(robot) : await readRobotState(robot, { timeoutMs: cfg.timeoutMs });
|
|
69247
69322
|
if (deps?.readState)
|
|
69248
69323
|
rememberRobotState(robot, state);
|
|
69249
|
-
|
|
69250
|
-
if (
|
|
69251
|
-
Object.assign(
|
|
69324
|
+
reading2 = { ok: true, online: state.online === true, fault: state.fault ?? null };
|
|
69325
|
+
if (reading2.fault)
|
|
69326
|
+
Object.assign(reading2.fault, { floorNo: state.floorNo ?? null });
|
|
69252
69327
|
} catch (error) {
|
|
69253
69328
|
if (deps?.readState)
|
|
69254
69329
|
rememberRobotState(robot, null);
|
|
69255
|
-
|
|
69330
|
+
reading2 = { ok: false, error: error?.message ?? "no answer" };
|
|
69256
69331
|
}
|
|
69257
69332
|
const records = byRobot2.get(String(robot._id)) ?? [];
|
|
69258
69333
|
const offlineRec = records.find((r) => r.code === OFFLINE_FAULT_CODE);
|
|
69259
|
-
const plan = planFaultChanges(records,
|
|
69334
|
+
const plan = planFaultChanges(records, reading2);
|
|
69260
69335
|
for (const id of plan.clear) {
|
|
69261
69336
|
await repo.clearFault(id);
|
|
69262
69337
|
out.cleared++;
|
|
@@ -69269,7 +69344,7 @@ function useRobotFaultSweep(deps) {
|
|
|
69269
69344
|
out.alerts++;
|
|
69270
69345
|
}
|
|
69271
69346
|
for (const f of plan.open) {
|
|
69272
|
-
const detail =
|
|
69347
|
+
const detail = reading2.ok && reading2.fault?.code === f.code ? reading2.fault : null;
|
|
69273
69348
|
const r = await openFaultRecord(robot, detail ? { ...detail, ...f } : f, { notify: true, notifyFn: deps?.notifyFn });
|
|
69274
69349
|
if (r.opened)
|
|
69275
69350
|
out.opened++;
|
|
@@ -70587,7 +70662,7 @@ function measurementScale(vertices, meas) {
|
|
|
70587
70662
|
return est.length ? est.reduce((n, v) => n + v, 0) / est.length : null;
|
|
70588
70663
|
}
|
|
70589
70664
|
var pval = (p) => Array.isArray(p) ? p[1] : p;
|
|
70590
|
-
var
|
|
70665
|
+
var num3 = (v, fallback = 0) => v !== null && v !== "" && Number.isFinite(Number(v)) ? Number(v) : fallback;
|
|
70591
70666
|
var str60 = (v) => String(v ?? "").slice(0, 60);
|
|
70592
70667
|
function decodeParams(raw) {
|
|
70593
70668
|
const out = {};
|
|
@@ -70607,7 +70682,7 @@ function fileVertexParams(raw) {
|
|
|
70607
70682
|
const v = raw[k];
|
|
70608
70683
|
if (v === void 0 || v === null)
|
|
70609
70684
|
continue;
|
|
70610
|
-
out[k] = k.startsWith("is_") ? Boolean(v) : k === "merge_radius" ? clamp3(
|
|
70685
|
+
out[k] = k.startsWith("is_") ? Boolean(v) : k === "merge_radius" ? clamp3(num3(v), 0, 100) : str60(v);
|
|
70611
70686
|
}
|
|
70612
70687
|
return out;
|
|
70613
70688
|
}
|
|
@@ -70680,14 +70755,14 @@ function fromBuildingYaml(doc) {
|
|
|
70680
70755
|
const raw = names.map((name) => {
|
|
70681
70756
|
const y = doc.levels[name] ?? {};
|
|
70682
70757
|
const vertices = (Array.isArray(y.vertices) ? y.vertices : []).map((v) => ({
|
|
70683
|
-
x:
|
|
70684
|
-
y:
|
|
70758
|
+
x: num3(v?.[0]),
|
|
70759
|
+
y: num3(v?.[1]) * flip,
|
|
70685
70760
|
name: str60(v?.[3]),
|
|
70686
70761
|
params: fileVertexParams(decodeParams(v?.[4]))
|
|
70687
70762
|
}));
|
|
70688
|
-
const fiducials = (Array.isArray(y.fiducials) ? y.fiducials : []).map((f) => ({ x:
|
|
70689
|
-
const meas = edgeList(y.measurements).map((e) => [e.a, e.b,
|
|
70690
|
-
return { name: str60(name), y, vertices, fiducials, meas, elevation:
|
|
70763
|
+
const fiducials = (Array.isArray(y.fiducials) ? y.fiducials : []).map((f) => ({ x: num3(f?.[0]), y: num3(f?.[1]) * flip, name: str60(f?.[2]) }));
|
|
70764
|
+
const meas = edgeList(y.measurements).map((e) => [e.a, e.b, num3(e.p.distance)]);
|
|
70765
|
+
return { name: str60(name), y, vertices, fiducials, meas, elevation: num3(y.elevation) };
|
|
70691
70766
|
});
|
|
70692
70767
|
const refName = raw.some((l) => l.name === doc.reference_level_name) ? String(doc.reference_level_name) : raw[0].name;
|
|
70693
70768
|
const ref = raw.find((l) => l.name === refName);
|
|
@@ -70761,20 +70836,20 @@ function fromBuildingYaml(doc) {
|
|
|
70761
70836
|
const extra = {};
|
|
70762
70837
|
if (e.p.texture_name !== void 0 && e.p.texture_name !== "default")
|
|
70763
70838
|
extra.textureName = str60(e.p.texture_name);
|
|
70764
|
-
if (e.p.alpha !== void 0 &&
|
|
70765
|
-
extra.alpha = clamp3(
|
|
70766
|
-
if (e.p.texture_height !== void 0 &&
|
|
70767
|
-
extra.textureHeight = clamp3(
|
|
70768
|
-
if (e.p.texture_width !== void 0 &&
|
|
70769
|
-
extra.textureWidth = clamp3(
|
|
70770
|
-
if (e.p.texture_scale !== void 0 &&
|
|
70771
|
-
extra.textureScale = clamp3(
|
|
70839
|
+
if (e.p.alpha !== void 0 && num3(e.p.alpha, 1) !== 1)
|
|
70840
|
+
extra.alpha = clamp3(num3(e.p.alpha, 1), 0, 1);
|
|
70841
|
+
if (e.p.texture_height !== void 0 && num3(e.p.texture_height, 2.5) !== 2.5)
|
|
70842
|
+
extra.textureHeight = clamp3(num3(e.p.texture_height, 2.5), 0, 100);
|
|
70843
|
+
if (e.p.texture_width !== void 0 && num3(e.p.texture_width, 1) !== 1)
|
|
70844
|
+
extra.textureWidth = clamp3(num3(e.p.texture_width, 1), 0, 100);
|
|
70845
|
+
if (e.p.texture_scale !== void 0 && num3(e.p.texture_scale, 1) !== 1)
|
|
70846
|
+
extra.textureScale = clamp3(num3(e.p.texture_scale, 1), 0, 100);
|
|
70772
70847
|
level2.walls.push({ v1: ids2[e.a], v2: ids2[e.b], ...extra });
|
|
70773
70848
|
}
|
|
70774
70849
|
for (const e of edgeList(lv.y.doors).filter(ok)) {
|
|
70775
70850
|
const type = String(e.p.type ?? "hinged");
|
|
70776
|
-
const degrees = clamp3(
|
|
70777
|
-
const ratio = clamp3(
|
|
70851
|
+
const degrees = clamp3(num3(e.p.motion_degrees, 90), -360, 360);
|
|
70852
|
+
const ratio = clamp3(num3(e.p.right_left_ratio, 1), 0, 10);
|
|
70778
70853
|
const plugin = str60(e.p.plugin ?? "normal");
|
|
70779
70854
|
level2.doors.push({
|
|
70780
70855
|
name: str60(e.p.name ?? "").trim() || `door_${level2.doors.length + 1}`,
|
|
@@ -70783,13 +70858,13 @@ function fromBuildingYaml(doc) {
|
|
|
70783
70858
|
type: ["hinged", "double_hinged", "sliding", "double_sliding"].includes(type) ? type : "hinged",
|
|
70784
70859
|
...e.p.motion_axis === "end" ? { motionAxis: "end" } : {},
|
|
70785
70860
|
...degrees !== 90 ? { motionDegrees: degrees } : {},
|
|
70786
|
-
...
|
|
70861
|
+
...num3(e.p.motion_direction, 1) < 0 ? { motionDirection: -1 } : {},
|
|
70787
70862
|
...ratio !== 1 ? { rightLeftRatio: ratio } : {},
|
|
70788
70863
|
...plugin !== "normal" ? { plugin } : {}
|
|
70789
70864
|
});
|
|
70790
70865
|
}
|
|
70791
70866
|
for (const e of edgeList(lv.y.lanes).filter(ok)) {
|
|
70792
|
-
const gi = Math.round(
|
|
70867
|
+
const gi = Math.round(num3(e.p.graph_idx, 0));
|
|
70793
70868
|
if (gi < 0 || gi > 8) {
|
|
70794
70869
|
warnings.push(`Floor ${lv.name}: a lane on graph ${gi} was skipped (graphs 0-8 only).`);
|
|
70795
70870
|
continue;
|
|
@@ -70802,14 +70877,14 @@ function fromBuildingYaml(doc) {
|
|
|
70802
70877
|
graphIdx: gi,
|
|
70803
70878
|
bidirectional: e.p.bidirectional === true,
|
|
70804
70879
|
...orientation ? { orientation } : {},
|
|
70805
|
-
...
|
|
70880
|
+
...num3(e.p.speed_limit) > 0 ? { speedLimit: clamp3(num3(e.p.speed_limit), 0, 20) } : {},
|
|
70806
70881
|
...e.p.mutex ? { mutex: str60(e.p.mutex) } : {},
|
|
70807
70882
|
...e.p.demo_mock_floor_name ? { demoMockFloorName: str60(e.p.demo_mock_floor_name) } : {},
|
|
70808
70883
|
...e.p.demo_mock_lift_name ? { demoMockLiftName: str60(e.p.demo_mock_lift_name) } : {}
|
|
70809
70884
|
});
|
|
70810
70885
|
}
|
|
70811
70886
|
for (const e of edgeList(lv.y.measurements).filter(ok)) {
|
|
70812
|
-
const d =
|
|
70887
|
+
const d = num3(e.p.distance);
|
|
70813
70888
|
if (d >= 0.01)
|
|
70814
70889
|
level2.measurements.push({ v1: ids2[e.a], v2: ids2[e.b], distanceM: Math.min(d, 1e4) });
|
|
70815
70890
|
}
|
|
@@ -70840,14 +70915,14 @@ function fromBuildingYaml(doc) {
|
|
|
70840
70915
|
if (ly?.reference_floor_name && !levelNames.has(ly.reference_floor_name)) {
|
|
70841
70916
|
warnings.push(`Lift ${str60(liftName)}: its reference floor "${str60(ly.reference_floor_name)}" is not in the file; ${refName} was used.`);
|
|
70842
70917
|
}
|
|
70843
|
-
const c = applyXform(xf(refFloor), { x:
|
|
70918
|
+
const c = applyXform(xf(refFloor), { x: num3(ly?.x), y: num3(ly?.y) * flip });
|
|
70844
70919
|
const doors = Object.entries(ly?.doors ?? {}).slice(0, 8).map(([dn, d]) => ({
|
|
70845
70920
|
name: str60(dn),
|
|
70846
|
-
type: MSG_LIFT_DOOR_TYPE[Math.round(
|
|
70847
|
-
x: r3(clamp3(
|
|
70848
|
-
y: r3(clamp3(
|
|
70849
|
-
widthM: r3(clamp3(
|
|
70850
|
-
axisYawRad: clamp3(
|
|
70921
|
+
type: MSG_LIFT_DOOR_TYPE[Math.round(num3(d?.door_type, 2))] ?? "double_sliding",
|
|
70922
|
+
x: r3(clamp3(num3(d?.x), -20, 20)),
|
|
70923
|
+
y: r3(clamp3(num3(d?.y), -20, 20)),
|
|
70924
|
+
widthM: r3(clamp3(num3(d?.width, 1), 0.3, 10)),
|
|
70925
|
+
axisYawRad: clamp3(num3(d?.motion_axis_orientation), -10, 10)
|
|
70851
70926
|
}));
|
|
70852
70927
|
const doorNames = new Set(doors.map((d) => d.name));
|
|
70853
70928
|
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)) }));
|
|
@@ -70856,9 +70931,9 @@ function fromBuildingYaml(doc) {
|
|
|
70856
70931
|
name: str60(liftName),
|
|
70857
70932
|
x: r3(c.x),
|
|
70858
70933
|
y: r3(c.y),
|
|
70859
|
-
yawRad: clamp3(
|
|
70860
|
-
widthM: r3(clamp3(
|
|
70861
|
-
depthM: r3(clamp3(
|
|
70934
|
+
yawRad: clamp3(num3(ly?.yaw), -10, 10),
|
|
70935
|
+
widthM: r3(clamp3(num3(ly?.width, 2), 0.3, 20)),
|
|
70936
|
+
depthM: r3(clamp3(num3(ly?.depth, 2), 0.3, 20)),
|
|
70862
70937
|
referenceFloor: refFloor,
|
|
70863
70938
|
...floorName(ly?.initial_floor_name) ? { initialFloor: floorName(ly.initial_floor_name) } : {},
|
|
70864
70939
|
...floorName(ly?.lowest_floor) ? { lowestFloor: floorName(ly.lowest_floor) } : {},
|
|
@@ -70912,7 +70987,7 @@ function fromNavGraph(doc, graphIdx) {
|
|
|
70912
70987
|
level2.vertices = verts.map((v, k) => {
|
|
70913
70988
|
const p = v?.[2] && typeof v[2] === "object" ? v[2] : {};
|
|
70914
70989
|
const params = fileVertexParams(p);
|
|
70915
|
-
return { id: `v${k + 1}`, x: r3(
|
|
70990
|
+
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 } : {} };
|
|
70916
70991
|
});
|
|
70917
70992
|
if (Array.isArray(ly?.lanes) && ly.lanes.length > 1e4)
|
|
70918
70993
|
throw new RmfImportError(`Floor ${str60(name)} has more than 10000 one-way lanes - more than a building map can hold.`);
|
|
@@ -70952,7 +71027,7 @@ function fromNavGraph(doc, graphIdx) {
|
|
|
70952
71027
|
graphIdx,
|
|
70953
71028
|
bidirectional,
|
|
70954
71029
|
...o === "forward" || o === "backward" ? { orientation: o } : {},
|
|
70955
|
-
...
|
|
71030
|
+
...num3(p.speed_limit) > 0 ? { speedLimit: clamp3(num3(p.speed_limit), 0, 20) } : {},
|
|
70956
71031
|
...p.mutex ? { mutex: str60(p.mutex) } : {},
|
|
70957
71032
|
...p.demo_mock_floor_name ? { demoMockFloorName: str60(p.demo_mock_floor_name) } : {},
|
|
70958
71033
|
...p.demo_mock_lift_name ? { demoMockLiftName: str60(p.demo_mock_lift_name) } : {}
|
|
@@ -83171,7 +83246,7 @@ function useAccessManagementController() {
|
|
|
83171
83246
|
liftName,
|
|
83172
83247
|
unit = [],
|
|
83173
83248
|
createdAt,
|
|
83174
|
-
updatedAt,
|
|
83249
|
+
updatedAt: updatedAt2,
|
|
83175
83250
|
startDate,
|
|
83176
83251
|
endDate,
|
|
83177
83252
|
isWinsland
|
|
@@ -83207,7 +83282,7 @@ function useAccessManagementController() {
|
|
|
83207
83282
|
startDate,
|
|
83208
83283
|
endDate,
|
|
83209
83284
|
createdAt,
|
|
83210
|
-
updatedAt,
|
|
83285
|
+
updatedAt: updatedAt2,
|
|
83211
83286
|
isWinsland
|
|
83212
83287
|
});
|
|
83213
83288
|
if (error) {
|
|
@@ -83229,7 +83304,7 @@ function useAccessManagementController() {
|
|
|
83229
83304
|
startDate,
|
|
83230
83305
|
endDate,
|
|
83231
83306
|
createdAt,
|
|
83232
|
-
updatedAt,
|
|
83307
|
+
updatedAt: updatedAt2,
|
|
83233
83308
|
isWinsland
|
|
83234
83309
|
});
|
|
83235
83310
|
return res.status(201).json({
|
|
@@ -106932,6 +107007,7 @@ function usePersonalEmergencyChainController() {
|
|
|
106932
107007
|
OUNITECH_BRAND,
|
|
106933
107008
|
OUNITECH_BRAND_DEFINITION,
|
|
106934
107009
|
OUNITECH_CAPABILITIES,
|
|
107010
|
+
OUNITECH_FRESH_MS,
|
|
106935
107011
|
OUNITECH_PENDING_COMMANDS,
|
|
106936
107012
|
OUNITECH_REGION_BASE_URLS,
|
|
106937
107013
|
OUNITECH_TIMESTAMP_FORMAT,
|
|
@@ -107299,6 +107375,7 @@ function usePersonalEmergencyChainController() {
|
|
|
107299
107375
|
orgRoleSets,
|
|
107300
107376
|
orgSchema,
|
|
107301
107377
|
ounitechFault,
|
|
107378
|
+
ounitechJobWords,
|
|
107302
107379
|
ounitechRobotFromHomeRow,
|
|
107303
107380
|
overnight_parking_requests_namespace_collection,
|
|
107304
107381
|
padbotAccountKey,
|