@7365admin1/core 3.94.0 → 3.95.0
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 +10 -0
- package/dist/index.d.ts +367 -115
- package/dist/index.js +779 -217
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +871 -329
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/test/e2e/harness.mjs +1 -0
- package/test/e2e/open-rmf.e2e.test.mjs +185 -0
- package/test/fixtures/open-rmf/building_map.json +1168 -0
- package/test/fixtures/open-rmf/door_state.json +10 -0
- package/test/fixtures/open-rmf/fleets.json +109 -0
- package/test/fixtures/open-rmf/lift_state.json +19 -0
- package/test/fixtures/open-rmf/robot_task_response.json +42 -0
- package/test/fixtures/open-rmf/schemas/LICENSE.md +201 -0
- package/test/fixtures/open-rmf/schemas/NOTICE.md +7 -0
- package/test/fixtures/open-rmf/schemas/cancel_task_request.json +24 -0
- package/test/fixtures/open-rmf/schemas/fleet_state.json +15 -0
- package/test/fixtures/open-rmf/schemas/interrupt_task_request.json +24 -0
- package/test/fixtures/open-rmf/schemas/location_2D.json +14 -0
- package/test/fixtures/open-rmf/schemas/resume_task_request.json +30 -0
- package/test/fixtures/open-rmf/schemas/robot_state.json +69 -0
- package/test/fixtures/open-rmf/schemas/robot_task_request.json +24 -0
- package/test/fixtures/open-rmf/schemas/task_request.json +42 -0
- package/test/fixtures/open-rmf/schemas/task_state.json +278 -0
- package/test/fixtures/open-rmf/task_state_clean_completed.json +119 -0
- package/test/fixtures/open-rmf/task_state_patrol.json +1 -0
- package/test/open-rmf.test.mjs +297 -0
package/dist/index.js
CHANGED
|
@@ -86,6 +86,7 @@ __export(src_exports, {
|
|
|
86
86
|
DEMO_ROUTES: () => DEMO_ROUTES,
|
|
87
87
|
DEVICE_STATUS: () => DEVICE_STATUS,
|
|
88
88
|
DOBStatus: () => DOBStatus,
|
|
89
|
+
DOOR_MODE: () => DOOR_MODE,
|
|
89
90
|
DUPLICATE_TERMS_VERSION_MESSAGE: () => DUPLICATE_TERMS_VERSION_MESSAGE,
|
|
90
91
|
DayOfWeek: () => DayOfWeek,
|
|
91
92
|
E164: () => E164,
|
|
@@ -225,6 +226,9 @@ __export(src_exports, {
|
|
|
225
226
|
NotificationModule: () => NotificationModule,
|
|
226
227
|
NotificationService: () => NotificationService,
|
|
227
228
|
OFFLINE_FAULT_CODE: () => OFFLINE_FAULT_CODE,
|
|
229
|
+
OPEN_RMF_BRAND: () => OPEN_RMF_BRAND,
|
|
230
|
+
OPEN_RMF_CAPABILITIES: () => OPEN_RMF_CAPABILITIES,
|
|
231
|
+
OPEN_RMF_DISPLAY_NAME: () => OPEN_RMF_DISPLAY_NAME,
|
|
228
232
|
ORG_MARKETPLACE_VENDOR_FIELD: () => ORG_MARKETPLACE_VENDOR_FIELD,
|
|
229
233
|
ORG_OWNER_REPAIR_CLAIM_STALE_MS: () => ORG_OWNER_REPAIR_CLAIM_STALE_MS,
|
|
230
234
|
ORG_OWNER_REPAIR_CLAIM_TAKEN_REASON: () => ORG_OWNER_REPAIR_CLAIM_TAKEN_REASON,
|
|
@@ -233,6 +237,7 @@ __export(src_exports, {
|
|
|
233
237
|
OUNITECH_BRAND: () => OUNITECH_BRAND,
|
|
234
238
|
OUNITECH_CAPABILITIES: () => OUNITECH_CAPABILITIES,
|
|
235
239
|
OUNITECH_PENDING_COMMANDS: () => OUNITECH_PENDING_COMMANDS,
|
|
240
|
+
OpenRmfError: () => OpenRmfError,
|
|
236
241
|
OrgNature: () => OrgNature,
|
|
237
242
|
OvernightParkingRequestSort: () => OvernightParkingRequestSort,
|
|
238
243
|
OvernightParkingRequestStatus: () => OvernightParkingRequestStatus,
|
|
@@ -329,6 +334,7 @@ __export(src_exports, {
|
|
|
329
334
|
attendanceSchema: () => attendanceSchema,
|
|
330
335
|
attendanceSettingsSchema: () => attendanceSettingsSchema,
|
|
331
336
|
buildSelfServiceEmailContext: () => buildSelfServiceEmailContext,
|
|
337
|
+
buildingFromRmf: () => buildingFromRmf,
|
|
332
338
|
buildingMapBodySchema: () => buildingMapBodySchema,
|
|
333
339
|
buildingMapCreateSchema: () => buildingMapCreateSchema,
|
|
334
340
|
buildingMapFromRobotMaps: () => buildingMapFromRobotMaps,
|
|
@@ -370,6 +376,8 @@ __export(src_exports, {
|
|
|
370
376
|
createDemoAdapter: () => createDemoAdapter,
|
|
371
377
|
createLiftSimulator: () => createLiftSimulator,
|
|
372
378
|
createManpowerRemarksDaily: () => createManpowerRemarksDaily,
|
|
379
|
+
createOpenRmfAdapter: () => createOpenRmfAdapter,
|
|
380
|
+
createOpenRmfClient: () => createOpenRmfClient,
|
|
373
381
|
createOunitechAdapter: () => createOunitechAdapter,
|
|
374
382
|
createSseParser: () => createSseParser,
|
|
375
383
|
customerSchema: () => customerSchema,
|
|
@@ -392,6 +400,7 @@ __export(src_exports, {
|
|
|
392
400
|
deviceHttpTimeoutMs: () => deviceHttpTimeoutMs,
|
|
393
401
|
deviceProbeTtlSeconds: () => deviceProbeTtlSeconds,
|
|
394
402
|
disconnectedState: () => disconnectedState,
|
|
403
|
+
doorModeOf: () => doorModeOf,
|
|
395
404
|
emitNotificationCreated: () => emitNotificationCreated,
|
|
396
405
|
emptyPersonalEmergencyChain: () => emptyPersonalEmergencyChain,
|
|
397
406
|
encodeGreyscalePng: () => encodeGreyscalePng,
|
|
@@ -408,6 +417,7 @@ __export(src_exports, {
|
|
|
408
417
|
ffmpegFrameArgs: () => ffmpegFrameArgs,
|
|
409
418
|
ffmpegPath: () => ffmpegPath,
|
|
410
419
|
filterByAccess: () => filterByAccess,
|
|
420
|
+
floorNoOf: () => floorNoOf,
|
|
411
421
|
formatCapabilityTrace: () => formatCapabilityTrace,
|
|
412
422
|
formatDahuaDate: () => formatDahuaDate,
|
|
413
423
|
getIO: () => getIO,
|
|
@@ -430,6 +440,7 @@ __export(src_exports, {
|
|
|
430
440
|
isAvailableForWork: () => isAvailableForWork,
|
|
431
441
|
isCameraEntitled: () => isCameraEntitled,
|
|
432
442
|
isDispatchable: () => isDispatchable,
|
|
443
|
+
isDoorPassable: () => isDoorPassable,
|
|
433
444
|
isDuplicateMemberError: () => isDuplicateMemberError,
|
|
434
445
|
isDuplicateVersionError: () => isDuplicateVersionError,
|
|
435
446
|
isLiftAvailable: () => isLiftAvailable,
|
|
@@ -484,6 +495,9 @@ __export(src_exports, {
|
|
|
484
495
|
occurrence_book_namespace_collection: () => occurrence_book_namespace_collection,
|
|
485
496
|
onBookTimezonesChanged: () => onBookTimezonesChanged,
|
|
486
497
|
online_forms_namespace_collection: () => online_forms_namespace_collection,
|
|
498
|
+
openRmfConfig: () => openRmfConfig,
|
|
499
|
+
openRmfDoorDriver: () => openRmfDoorDriver,
|
|
500
|
+
openRmfLiftDriver: () => openRmfLiftDriver,
|
|
487
501
|
orgLevelRoles: () => orgLevelRoles,
|
|
488
502
|
orgModulesHandlers: () => orgModulesHandlers,
|
|
489
503
|
orgOwnerRepairHandlers: () => orgOwnerRepairHandlers,
|
|
@@ -506,6 +520,7 @@ __export(src_exports, {
|
|
|
506
520
|
planDayFromJsDay: () => planDayFromJsDay,
|
|
507
521
|
planDemoRobots: () => planDemoRobots,
|
|
508
522
|
planOrgOwnerRepair: () => planOrgOwnerRepair,
|
|
523
|
+
planShareOf: () => planShareOf,
|
|
509
524
|
platform_terms_namespace_collection: () => platform_terms_namespace_collection,
|
|
510
525
|
playbackRelays: () => playbackRelays,
|
|
511
526
|
playbackWindowRefusal: () => playbackWindowRefusal,
|
|
@@ -522,6 +537,7 @@ __export(src_exports, {
|
|
|
522
537
|
refuseServiceProviderInviteAction: () => refuseServiceProviderInviteAction,
|
|
523
538
|
registerCameraTransport: () => registerCameraTransport,
|
|
524
539
|
registerDemoBrand: () => registerDemoBrand,
|
|
540
|
+
registerOpenRmfBrand: () => registerOpenRmfBrand,
|
|
525
541
|
registerOunitechBrand: () => registerOunitechBrand,
|
|
526
542
|
registerRobotBrand: () => registerRobotBrand,
|
|
527
543
|
registeredRobotBrands: () => registeredRobotBrands,
|
|
@@ -722,6 +738,7 @@ __export(src_exports, {
|
|
|
722
738
|
site_people_namespace_collection: () => site_people_namespace_collection,
|
|
723
739
|
snapshotEndpoint: () => snapshotEndpoint,
|
|
724
740
|
snapshotRefusalReason: () => snapshotRefusalReason,
|
|
741
|
+
splitRobotSn: () => splitRobotSn,
|
|
725
742
|
staffMayBypass: () => staffMayBypass,
|
|
726
743
|
startDemoTracking: () => startDemoTracking,
|
|
727
744
|
startRobotTracking: () => startRobotTracking,
|
|
@@ -731,6 +748,8 @@ __export(src_exports, {
|
|
|
731
748
|
subscriptionPlanSchema: () => subscriptionPlanSchema,
|
|
732
749
|
summariseBulkCameraPlan: () => summariseBulkCameraPlan,
|
|
733
750
|
supports: () => supports,
|
|
751
|
+
taskRequestFor: () => taskRequestFor,
|
|
752
|
+
toAdapterRobot: () => toAdapterRobot,
|
|
734
753
|
trackingBackoffMs: () => trackingBackoffMs,
|
|
735
754
|
uncontrollableFleetWarning: () => uncontrollableFleetWarning,
|
|
736
755
|
updateRemarksStatusEod: () => updateRemarksStatusEod,
|
|
@@ -988,6 +1007,7 @@ __export(src_exports, {
|
|
|
988
1007
|
visitors_namespace_collection: () => visitors_namespace_collection,
|
|
989
1008
|
wallConfig: () => wallConfig,
|
|
990
1009
|
wallsFromOccupancyGrid: () => wallsFromOccupancyGrid,
|
|
1010
|
+
waypointsFor: () => waypointsFor,
|
|
991
1011
|
withLiveLink: () => withLiveLink,
|
|
992
1012
|
workOrderSchema: () => workOrderSchema,
|
|
993
1013
|
work_orders2_namespace_collection: () => work_orders2_namespace_collection,
|
|
@@ -11019,11 +11039,11 @@ function moduleGateData() {
|
|
|
11019
11039
|
};
|
|
11020
11040
|
}
|
|
11021
11041
|
function memoisedGateData(data) {
|
|
11022
|
-
const
|
|
11042
|
+
const cache2 = /* @__PURE__ */ new Map();
|
|
11023
11043
|
const once = (key, load) => {
|
|
11024
|
-
if (!
|
|
11025
|
-
|
|
11026
|
-
return
|
|
11044
|
+
if (!cache2.has(key))
|
|
11045
|
+
cache2.set(key, load());
|
|
11046
|
+
return cache2.get(key);
|
|
11027
11047
|
};
|
|
11028
11048
|
return {
|
|
11029
11049
|
...data,
|
|
@@ -60921,7 +60941,7 @@ var OUNITECH_PENDING_COMMANDS = ["pause", "resume", "cancel"].map(
|
|
|
60921
60941
|
);
|
|
60922
60942
|
function createOunitechAdapter(credentials, options) {
|
|
60923
60943
|
const cloud = useRobotCloudService(credentials, options);
|
|
60924
|
-
function
|
|
60944
|
+
function toAdapterRobot2(raw) {
|
|
60925
60945
|
return {
|
|
60926
60946
|
robotSn: raw.robotSn,
|
|
60927
60947
|
name: raw.robotName,
|
|
@@ -60943,7 +60963,7 @@ function createOunitechAdapter(credentials, options) {
|
|
|
60943
60963
|
capabilities: OUNITECH_CAPABILITIES,
|
|
60944
60964
|
async listRobots() {
|
|
60945
60965
|
const fleet2 = await cloud.getRobots();
|
|
60946
|
-
return fleet2.map(
|
|
60966
|
+
return fleet2.map(toAdapterRobot2);
|
|
60947
60967
|
},
|
|
60948
60968
|
async getRobot(robotSn) {
|
|
60949
60969
|
const fleet2 = await cloud.getRobots();
|
|
@@ -60960,7 +60980,7 @@ function createOunitechAdapter(credentials, options) {
|
|
|
60960
60980
|
position: null
|
|
60961
60981
|
};
|
|
60962
60982
|
}
|
|
60963
|
-
return
|
|
60983
|
+
return toAdapterRobot2(match);
|
|
60964
60984
|
},
|
|
60965
60985
|
async sendCommand(robotSn, command) {
|
|
60966
60986
|
const options2 = {
|
|
@@ -61498,6 +61518,708 @@ function registerDemoBrand() {
|
|
|
61498
61518
|
}
|
|
61499
61519
|
registerDemoBrand();
|
|
61500
61520
|
|
|
61521
|
+
// src/utils/lift-contract.util.ts
|
|
61522
|
+
var LIFT_DOOR = {
|
|
61523
|
+
CLOSED: 0,
|
|
61524
|
+
MOVING: 1,
|
|
61525
|
+
OPEN: 2
|
|
61526
|
+
};
|
|
61527
|
+
var LIFT_MOTION = {
|
|
61528
|
+
STOPPED: 0,
|
|
61529
|
+
UP: 1,
|
|
61530
|
+
DOWN: 2,
|
|
61531
|
+
UNKNOWN: 3
|
|
61532
|
+
};
|
|
61533
|
+
var LIFT_MODE = {
|
|
61534
|
+
UNKNOWN: 0,
|
|
61535
|
+
HUMAN: 1,
|
|
61536
|
+
AGV: 2,
|
|
61537
|
+
FIRE: 3,
|
|
61538
|
+
OFFLINE: 4,
|
|
61539
|
+
EMERGENCY: 5
|
|
61540
|
+
};
|
|
61541
|
+
var LIFT_REQUEST = {
|
|
61542
|
+
END_SESSION: 0,
|
|
61543
|
+
AGV_MODE: 1,
|
|
61544
|
+
HUMAN_MODE: 2
|
|
61545
|
+
};
|
|
61546
|
+
function isLiftAvailable(state) {
|
|
61547
|
+
if (!state)
|
|
61548
|
+
return false;
|
|
61549
|
+
return state.currentMode === LIFT_MODE.HUMAN || state.currentMode === LIFT_MODE.AGV;
|
|
61550
|
+
}
|
|
61551
|
+
function isSafeToCross(state, floor) {
|
|
61552
|
+
if (!isLiftAvailable(state) || !state)
|
|
61553
|
+
return false;
|
|
61554
|
+
if (state.currentFloor !== floor)
|
|
61555
|
+
return false;
|
|
61556
|
+
if (state.motionState !== LIFT_MOTION.STOPPED)
|
|
61557
|
+
return false;
|
|
61558
|
+
return state.doorState === LIFT_DOOR.OPEN;
|
|
61559
|
+
}
|
|
61560
|
+
function holdsLift(state, sessionId) {
|
|
61561
|
+
if (!state || !sessionId)
|
|
61562
|
+
return false;
|
|
61563
|
+
return state.sessionId === sessionId;
|
|
61564
|
+
}
|
|
61565
|
+
function servesFloor(state, floor) {
|
|
61566
|
+
if (!state || !floor)
|
|
61567
|
+
return false;
|
|
61568
|
+
return state.availableFloors.includes(floor);
|
|
61569
|
+
}
|
|
61570
|
+
function createLiftSimulator(options) {
|
|
61571
|
+
const { name, floors } = options;
|
|
61572
|
+
if (floors.length === 0)
|
|
61573
|
+
throw new Error("A lift must serve some floors.");
|
|
61574
|
+
const msPerFloor = options.msPerFloor ?? 2e3;
|
|
61575
|
+
const doorDwellMs = options.doorDwellMs ?? 5e3;
|
|
61576
|
+
const state = {
|
|
61577
|
+
liftName: name,
|
|
61578
|
+
liftTime: 0,
|
|
61579
|
+
availableFloors: [...floors],
|
|
61580
|
+
currentFloor: options.startFloor ?? floors[0],
|
|
61581
|
+
destinationFloor: options.startFloor ?? floors[0],
|
|
61582
|
+
doorState: LIFT_DOOR.CLOSED,
|
|
61583
|
+
motionState: LIFT_MOTION.STOPPED,
|
|
61584
|
+
currentMode: LIFT_MODE.HUMAN,
|
|
61585
|
+
sessionId: ""
|
|
61586
|
+
};
|
|
61587
|
+
let travelRemaining = 0;
|
|
61588
|
+
let doorTimer = 0;
|
|
61589
|
+
function tick(ms) {
|
|
61590
|
+
state.liftTime += ms;
|
|
61591
|
+
if (state.motionState !== LIFT_MOTION.STOPPED) {
|
|
61592
|
+
travelRemaining -= ms;
|
|
61593
|
+
if (travelRemaining <= 0) {
|
|
61594
|
+
state.currentFloor = state.destinationFloor;
|
|
61595
|
+
state.motionState = LIFT_MOTION.STOPPED;
|
|
61596
|
+
state.doorState = LIFT_DOOR.OPEN;
|
|
61597
|
+
doorTimer = doorDwellMs;
|
|
61598
|
+
}
|
|
61599
|
+
return;
|
|
61600
|
+
}
|
|
61601
|
+
if (state.doorState === LIFT_DOOR.OPEN) {
|
|
61602
|
+
doorTimer -= ms;
|
|
61603
|
+
if (doorTimer <= 0)
|
|
61604
|
+
state.doorState = LIFT_DOOR.CLOSED;
|
|
61605
|
+
}
|
|
61606
|
+
}
|
|
61607
|
+
return {
|
|
61608
|
+
name,
|
|
61609
|
+
state,
|
|
61610
|
+
tick,
|
|
61611
|
+
async read() {
|
|
61612
|
+
return { ...state, availableFloors: [...state.availableFloors] };
|
|
61613
|
+
},
|
|
61614
|
+
async request(request2) {
|
|
61615
|
+
if (request2.requestType === LIFT_REQUEST.END_SESSION) {
|
|
61616
|
+
if (state.sessionId === request2.sessionId) {
|
|
61617
|
+
state.sessionId = "";
|
|
61618
|
+
state.currentMode = LIFT_MODE.HUMAN;
|
|
61619
|
+
}
|
|
61620
|
+
return;
|
|
61621
|
+
}
|
|
61622
|
+
if (state.sessionId && state.sessionId !== request2.sessionId) {
|
|
61623
|
+
throw new Error(`Lift ${name} is held by ${state.sessionId}.`);
|
|
61624
|
+
}
|
|
61625
|
+
if (!state.availableFloors.includes(request2.destinationFloor)) {
|
|
61626
|
+
throw new Error(
|
|
61627
|
+
`Lift ${name} does not serve ${request2.destinationFloor}.`
|
|
61628
|
+
);
|
|
61629
|
+
}
|
|
61630
|
+
state.sessionId = request2.sessionId;
|
|
61631
|
+
state.currentMode = request2.requestType === LIFT_REQUEST.AGV_MODE ? LIFT_MODE.AGV : LIFT_MODE.HUMAN;
|
|
61632
|
+
state.destinationFloor = request2.destinationFloor;
|
|
61633
|
+
if (state.currentFloor === request2.destinationFloor) {
|
|
61634
|
+
state.motionState = LIFT_MOTION.STOPPED;
|
|
61635
|
+
state.doorState = LIFT_DOOR.OPEN;
|
|
61636
|
+
doorTimer = doorDwellMs;
|
|
61637
|
+
return;
|
|
61638
|
+
}
|
|
61639
|
+
const from = state.availableFloors.indexOf(state.currentFloor);
|
|
61640
|
+
const to = state.availableFloors.indexOf(request2.destinationFloor);
|
|
61641
|
+
state.motionState = to > from ? LIFT_MOTION.UP : LIFT_MOTION.DOWN;
|
|
61642
|
+
state.doorState = LIFT_DOOR.CLOSED;
|
|
61643
|
+
travelRemaining = Math.abs(to - from) * msPerFloor;
|
|
61644
|
+
},
|
|
61645
|
+
async refresh(sessionId) {
|
|
61646
|
+
if (state.sessionId !== sessionId)
|
|
61647
|
+
return;
|
|
61648
|
+
if (state.doorState === LIFT_DOOR.OPEN)
|
|
61649
|
+
doorTimer = doorDwellMs;
|
|
61650
|
+
},
|
|
61651
|
+
async release(sessionId) {
|
|
61652
|
+
if (state.sessionId !== sessionId)
|
|
61653
|
+
return;
|
|
61654
|
+
state.sessionId = "";
|
|
61655
|
+
state.currentMode = LIFT_MODE.HUMAN;
|
|
61656
|
+
}
|
|
61657
|
+
};
|
|
61658
|
+
}
|
|
61659
|
+
var LIFT_QUEUE_TTL_MS = 10 * 6e4;
|
|
61660
|
+
var LIFT_LEASE_MS = 3 * 6e4;
|
|
61661
|
+
var LIFT_SIM_MS_PER_FLOOR = 4e3;
|
|
61662
|
+
var LIFT_SIM_DOOR_DWELL_MS = 8e3;
|
|
61663
|
+
var LIFT_SIM_BOARD_MS = 6e3;
|
|
61664
|
+
var LIFT_SESSION_STATUS = [
|
|
61665
|
+
"queued",
|
|
61666
|
+
"active",
|
|
61667
|
+
"released",
|
|
61668
|
+
"expired",
|
|
61669
|
+
"cancelled"
|
|
61670
|
+
];
|
|
61671
|
+
async function simulatedLiftState(options) {
|
|
61672
|
+
const sim = createLiftSimulator({
|
|
61673
|
+
name: options.name,
|
|
61674
|
+
floors: options.floors,
|
|
61675
|
+
msPerFloor: LIFT_SIM_MS_PER_FLOOR,
|
|
61676
|
+
doorDwellMs: LIFT_SIM_DOOR_DWELL_MS
|
|
61677
|
+
});
|
|
61678
|
+
const session = options.session;
|
|
61679
|
+
if (!session || !options.floors.includes(session.fromFloor) || !options.floors.includes(session.toFloor)) {
|
|
61680
|
+
return { state: await sim.read(), phase: "idle" };
|
|
61681
|
+
}
|
|
61682
|
+
const STEP = 250;
|
|
61683
|
+
const elapsed = Math.max(0, options.now - session.activeAt);
|
|
61684
|
+
let phase = "to-pickup";
|
|
61685
|
+
let boardingLeft = LIFT_SIM_BOARD_MS;
|
|
61686
|
+
await sim.request({
|
|
61687
|
+
liftName: options.name,
|
|
61688
|
+
sessionId: session.id,
|
|
61689
|
+
requestType: LIFT_REQUEST.AGV_MODE,
|
|
61690
|
+
destinationFloor: session.fromFloor,
|
|
61691
|
+
doorState: LIFT_DOOR.OPEN
|
|
61692
|
+
});
|
|
61693
|
+
if (isSafeToCross(sim.state, session.fromFloor))
|
|
61694
|
+
phase = "boarding";
|
|
61695
|
+
for (let t = 0; t < elapsed; t += STEP) {
|
|
61696
|
+
const ms = Math.min(STEP, elapsed - t);
|
|
61697
|
+
sim.tick(ms);
|
|
61698
|
+
const s = sim.state;
|
|
61699
|
+
if (phase === "to-pickup") {
|
|
61700
|
+
if (isSafeToCross(s, session.fromFloor))
|
|
61701
|
+
phase = "boarding";
|
|
61702
|
+
} else if (phase === "boarding") {
|
|
61703
|
+
await sim.refresh(session.id);
|
|
61704
|
+
boardingLeft -= ms;
|
|
61705
|
+
if (boardingLeft <= 0) {
|
|
61706
|
+
phase = "to-destination";
|
|
61707
|
+
await sim.request({
|
|
61708
|
+
liftName: options.name,
|
|
61709
|
+
sessionId: session.id,
|
|
61710
|
+
requestType: LIFT_REQUEST.AGV_MODE,
|
|
61711
|
+
destinationFloor: session.toFloor,
|
|
61712
|
+
doorState: LIFT_DOOR.CLOSED
|
|
61713
|
+
});
|
|
61714
|
+
}
|
|
61715
|
+
} else if (phase === "to-destination") {
|
|
61716
|
+
if (isSafeToCross(s, session.toFloor))
|
|
61717
|
+
phase = "arrived";
|
|
61718
|
+
} else if (phase === "arrived") {
|
|
61719
|
+
await sim.refresh(session.id);
|
|
61720
|
+
}
|
|
61721
|
+
}
|
|
61722
|
+
return { state: await sim.read(), phase };
|
|
61723
|
+
}
|
|
61724
|
+
function liftQueueKey(mapId, liftName) {
|
|
61725
|
+
return `${mapId}:${liftName}`;
|
|
61726
|
+
}
|
|
61727
|
+
|
|
61728
|
+
// src/utils/door-contract.util.ts
|
|
61729
|
+
var DOOR_MODE = {
|
|
61730
|
+
CLOSED: 0,
|
|
61731
|
+
MOVING: 1,
|
|
61732
|
+
OPEN: 2,
|
|
61733
|
+
OFFLINE: 3,
|
|
61734
|
+
UNKNOWN: 4
|
|
61735
|
+
};
|
|
61736
|
+
var MODES = new Set(Object.values(DOOR_MODE));
|
|
61737
|
+
function doorModeOf(value) {
|
|
61738
|
+
return typeof value === "number" && MODES.has(value) ? value : DOOR_MODE.UNKNOWN;
|
|
61739
|
+
}
|
|
61740
|
+
function isDoorPassable(state) {
|
|
61741
|
+
return state?.currentMode === DOOR_MODE.OPEN;
|
|
61742
|
+
}
|
|
61743
|
+
|
|
61744
|
+
// src/services/open-rmf.adapter.ts
|
|
61745
|
+
var OPEN_RMF_BRAND = "fleet-core";
|
|
61746
|
+
var OPEN_RMF_DISPLAY_NAME = "HERO Fleet Core";
|
|
61747
|
+
var OPEN_RMF_CAPABILITIES = {
|
|
61748
|
+
readLocation: true,
|
|
61749
|
+
// robot_state.location {map, x, y, yaw}
|
|
61750
|
+
battery: true,
|
|
61751
|
+
// robot_state.battery 0..1
|
|
61752
|
+
floorReporting: true,
|
|
61753
|
+
// location.map = level name
|
|
61754
|
+
multiFloor: true,
|
|
61755
|
+
// RMF rides lifts itself (lift supervisor)
|
|
61756
|
+
startProcess: true,
|
|
61757
|
+
// clean / patrol tasks
|
|
61758
|
+
pauseProcess: true,
|
|
61759
|
+
// interrupt_task / resume_task / cancel_task
|
|
61760
|
+
pauseResume: true,
|
|
61761
|
+
// same calls
|
|
61762
|
+
processCompletion: true,
|
|
61763
|
+
// task_state.status
|
|
61764
|
+
pathAndEta: true,
|
|
61765
|
+
// task_state.estimate_millis
|
|
61766
|
+
sendToDock: true,
|
|
61767
|
+
// go_to_place the robot's charger waypoint
|
|
61768
|
+
navigateToPoint: false,
|
|
61769
|
+
// api takes waypoint names only
|
|
61770
|
+
relocalize: false,
|
|
61771
|
+
// no api call
|
|
61772
|
+
spotClean: false
|
|
61773
|
+
// clean zones are named waypoints, not points
|
|
61774
|
+
};
|
|
61775
|
+
function openRmfConfig(env2 = process.env) {
|
|
61776
|
+
const baseUrl = (env2.OPEN_RMF_API_URL ?? "").trim().replace(/\/+$/, "");
|
|
61777
|
+
if (!/^https?:\/\/\S+$/.test(baseUrl))
|
|
61778
|
+
return null;
|
|
61779
|
+
return { baseUrl, token: (env2.OPEN_RMF_TOKEN ?? "").trim() };
|
|
61780
|
+
}
|
|
61781
|
+
var OpenRmfError = class extends Error {
|
|
61782
|
+
};
|
|
61783
|
+
var TIMEOUT_MS = 4e3;
|
|
61784
|
+
var cache = /* @__PURE__ */ new Map();
|
|
61785
|
+
function createOpenRmfClient(config2, deps) {
|
|
61786
|
+
const doFetch = deps?.fetch ?? globalThis.fetch;
|
|
61787
|
+
const now = deps?.now ?? Date.now;
|
|
61788
|
+
async function call(method, path5, body) {
|
|
61789
|
+
if (!config2)
|
|
61790
|
+
throw new OpenRmfError("Fleet Core is not configured on this server.");
|
|
61791
|
+
let res;
|
|
61792
|
+
try {
|
|
61793
|
+
res = await doFetch(config2.baseUrl + path5, {
|
|
61794
|
+
method,
|
|
61795
|
+
headers: {
|
|
61796
|
+
...config2.token ? { Authorization: `Bearer ${config2.token}` } : {},
|
|
61797
|
+
...body === void 0 ? {} : { "Content-Type": "application/json" }
|
|
61798
|
+
},
|
|
61799
|
+
body: body === void 0 ? void 0 : JSON.stringify(body),
|
|
61800
|
+
signal: AbortSignal.timeout(deps?.timeoutMs ?? TIMEOUT_MS)
|
|
61801
|
+
});
|
|
61802
|
+
} catch (e) {
|
|
61803
|
+
throw new OpenRmfError(
|
|
61804
|
+
`The fleet server did not answer (${e?.name === "TimeoutError" ? "timed out" : "unreachable"}).`
|
|
61805
|
+
);
|
|
61806
|
+
}
|
|
61807
|
+
const text2 = await res.text();
|
|
61808
|
+
if (!res.ok)
|
|
61809
|
+
throw new OpenRmfError(`The fleet server refused ${method} ${path5.split("?")[0]} (HTTP ${res.status}).`);
|
|
61810
|
+
try {
|
|
61811
|
+
return text2 ? JSON.parse(text2) : null;
|
|
61812
|
+
} catch {
|
|
61813
|
+
throw new OpenRmfError("The fleet server sent a reply that is not JSON.");
|
|
61814
|
+
}
|
|
61815
|
+
}
|
|
61816
|
+
function cached(key, ttlMs, load) {
|
|
61817
|
+
const k = `${config2?.baseUrl}|${key}`;
|
|
61818
|
+
const hit = cache.get(k);
|
|
61819
|
+
if (hit && now() - hit.at < ttlMs)
|
|
61820
|
+
return hit.value;
|
|
61821
|
+
const value = load();
|
|
61822
|
+
cache.set(k, { at: now(), value });
|
|
61823
|
+
value.catch(() => cache.delete(k));
|
|
61824
|
+
return value;
|
|
61825
|
+
}
|
|
61826
|
+
const enc2 = encodeURIComponent;
|
|
61827
|
+
return {
|
|
61828
|
+
fleets: () => cached("fleets", 1500, () => call("GET", "/fleets")),
|
|
61829
|
+
buildingMap: () => cached("building_map", 6e4, () => call("GET", "/building_map")),
|
|
61830
|
+
doors: () => call("GET", "/doors"),
|
|
61831
|
+
doorState: (name) => call("GET", `/doors/${enc2(name)}/state`),
|
|
61832
|
+
doorRequest: (name, mode) => call("POST", `/doors/${enc2(name)}/request`, { mode }),
|
|
61833
|
+
liftState: (name) => call("GET", `/lifts/${enc2(name)}/state`),
|
|
61834
|
+
liftRequest: (name, body) => call("POST", `/lifts/${enc2(name)}/request`, body),
|
|
61835
|
+
robotTask: (fleet2, robot, request2) => call("POST", "/tasks/robot_task", {
|
|
61836
|
+
type: "robot_task_request",
|
|
61837
|
+
fleet: fleet2,
|
|
61838
|
+
robot,
|
|
61839
|
+
request: request2
|
|
61840
|
+
}),
|
|
61841
|
+
cancelTask: (taskId) => call("POST", "/tasks/cancel_task", { type: "cancel_task_request", task_id: taskId }),
|
|
61842
|
+
interruptTask: (taskId) => call("POST", "/tasks/interrupt_task", { type: "interrupt_task_request", task_id: taskId, labels: ["iservice365"] }),
|
|
61843
|
+
// RMF answers a resume only when it names the interruption tokens to discard.
|
|
61844
|
+
resumeTask: (taskId, tokens) => call("POST", "/tasks/resume_task", {
|
|
61845
|
+
type: "resume_task_request",
|
|
61846
|
+
for_task: taskId,
|
|
61847
|
+
for_tokens: tokens,
|
|
61848
|
+
labels: ["iservice365"]
|
|
61849
|
+
}),
|
|
61850
|
+
taskState: (taskId) => call("GET", `/tasks/${enc2(taskId)}/state`)
|
|
61851
|
+
};
|
|
61852
|
+
}
|
|
61853
|
+
function floorNoOf(map) {
|
|
61854
|
+
if (typeof map !== "string")
|
|
61855
|
+
return null;
|
|
61856
|
+
const m = /^(L|B)(\d{1,3})$/i.exec(map.trim());
|
|
61857
|
+
if (m)
|
|
61858
|
+
return m[1].toUpperCase() === "B" ? -Number(m[2]) : Number(m[2]);
|
|
61859
|
+
return /^G$/i.test(map.trim()) ? 0 : null;
|
|
61860
|
+
}
|
|
61861
|
+
function splitRobotSn(robotSn) {
|
|
61862
|
+
const i = robotSn.indexOf("/");
|
|
61863
|
+
if (i <= 0 || i === robotSn.length - 1)
|
|
61864
|
+
return null;
|
|
61865
|
+
return { fleet: robotSn.slice(0, i), robot: robotSn.slice(i + 1) };
|
|
61866
|
+
}
|
|
61867
|
+
var hasParam = (v, p) => (v.params ?? []).some((x) => x.name === p);
|
|
61868
|
+
function levelBounds(building, map) {
|
|
61869
|
+
const level2 = building?.levels.find((l) => l.name === map);
|
|
61870
|
+
if (!level2)
|
|
61871
|
+
return null;
|
|
61872
|
+
const xs = [];
|
|
61873
|
+
const ys = [];
|
|
61874
|
+
for (const g of level2.nav_graphs)
|
|
61875
|
+
for (const v of g.vertices)
|
|
61876
|
+
xs.push(v.x), ys.push(v.y);
|
|
61877
|
+
for (const d of level2.doors)
|
|
61878
|
+
xs.push(d.v1_x, d.v2_x), ys.push(d.v1_y, d.v2_y);
|
|
61879
|
+
if (!xs.length)
|
|
61880
|
+
return null;
|
|
61881
|
+
const pad = 3;
|
|
61882
|
+
return { minX: Math.min(...xs) - pad, maxX: Math.max(...xs) + pad, minY: Math.min(...ys) - pad, maxY: Math.max(...ys) + pad };
|
|
61883
|
+
}
|
|
61884
|
+
function planShareOf(building, loc) {
|
|
61885
|
+
if (!loc)
|
|
61886
|
+
return null;
|
|
61887
|
+
const b = levelBounds(building, loc.map);
|
|
61888
|
+
if (!b)
|
|
61889
|
+
return null;
|
|
61890
|
+
const pct = (v) => Math.round(Math.min(100, Math.max(0, v)) * 10) / 10;
|
|
61891
|
+
return { x: pct((loc.x - b.minX) / (b.maxX - b.minX) * 100), y: pct((b.maxY - loc.y) / (b.maxY - b.minY) * 100) };
|
|
61892
|
+
}
|
|
61893
|
+
var MODE_BY_STATUS2 = {
|
|
61894
|
+
idle: "IDLE",
|
|
61895
|
+
working: "WORKING",
|
|
61896
|
+
charging: "CHARGING_CYCLE",
|
|
61897
|
+
error: "MAINTENANCE"
|
|
61898
|
+
};
|
|
61899
|
+
function toAdapterRobot(fleet2, name, s, building, paused = false) {
|
|
61900
|
+
const status = s.status ?? "uninitialized";
|
|
61901
|
+
const online = !["offline", "shutdown", "uninitialized"].includes(status);
|
|
61902
|
+
let mode = online ? MODE_BY_STATUS2[status] ?? "UNAVAILABLE" : "UNAVAILABLE";
|
|
61903
|
+
if (mode === "CHARGING_CYCLE" && (s.battery ?? 0) >= 0.995)
|
|
61904
|
+
mode = "CHARGED";
|
|
61905
|
+
if (paused && mode === "WORKING")
|
|
61906
|
+
mode = "PAUSED";
|
|
61907
|
+
const issue = (s.issues ?? []).find((i) => i?.category);
|
|
61908
|
+
const loc = s.location ?? null;
|
|
61909
|
+
const floorNo2 = floorNoOf(loc?.map);
|
|
61910
|
+
return {
|
|
61911
|
+
robotSn: `${fleet2}/${name}`,
|
|
61912
|
+
name,
|
|
61913
|
+
model: fleet2,
|
|
61914
|
+
online,
|
|
61915
|
+
mode,
|
|
61916
|
+
statusName: s.task_id ? `${status} \xB7 task ${s.task_id.slice(0, 8)}` : status,
|
|
61917
|
+
batteryPercent: typeof s.battery === "number" ? Math.round(s.battery * 100) : null,
|
|
61918
|
+
floorNo: floorNo2,
|
|
61919
|
+
floorKnown: floorNo2 !== null,
|
|
61920
|
+
position: loc ? { x: loc.x, y: loc.y, theta: loc.yaw } : null,
|
|
61921
|
+
planPosition: planShareOf(building, loc),
|
|
61922
|
+
fault: issue ? {
|
|
61923
|
+
code: String(issue.category).slice(0, 60),
|
|
61924
|
+
message: (typeof issue.detail === "string" ? issue.detail : JSON.stringify(issue.detail ?? "")).slice(0, 200)
|
|
61925
|
+
} : null
|
|
61926
|
+
};
|
|
61927
|
+
}
|
|
61928
|
+
function robotGraphIndex(building, loc) {
|
|
61929
|
+
const level2 = loc && building?.levels.find((l) => l.name === loc.map);
|
|
61930
|
+
if (!level2)
|
|
61931
|
+
return null;
|
|
61932
|
+
let best = null;
|
|
61933
|
+
for (const g of level2.nav_graphs) {
|
|
61934
|
+
for (const v of g.vertices) {
|
|
61935
|
+
const d = (v.x - loc.x) ** 2 + (v.y - loc.y) ** 2;
|
|
61936
|
+
if (!best || d < best.d)
|
|
61937
|
+
best = { name: g.name, d };
|
|
61938
|
+
}
|
|
61939
|
+
}
|
|
61940
|
+
return best?.name ?? null;
|
|
61941
|
+
}
|
|
61942
|
+
function waypointsFor(building, loc) {
|
|
61943
|
+
const graph = robotGraphIndex(building, loc);
|
|
61944
|
+
const level2 = loc && building?.levels.find((l) => l.name === loc.map);
|
|
61945
|
+
const vertices = level2?.nav_graphs.find((g) => g.name === graph)?.vertices.filter((v) => v.name) ?? [];
|
|
61946
|
+
return {
|
|
61947
|
+
chargers: vertices.filter((v) => hasParam(v, "is_charger")),
|
|
61948
|
+
cleaningZones: vertices.filter((v) => hasParam(v, "is_cleaning_zone")),
|
|
61949
|
+
places: vertices.filter((v) => !hasParam(v, "is_charger") && !hasParam(v, "is_cleaning_zone"))
|
|
61950
|
+
};
|
|
61951
|
+
}
|
|
61952
|
+
function cleanActivities(zone) {
|
|
61953
|
+
return [
|
|
61954
|
+
{ category: "go_to_place", description: zone },
|
|
61955
|
+
{
|
|
61956
|
+
category: "perform_action",
|
|
61957
|
+
description: {
|
|
61958
|
+
unix_millis_action_duration_estimate: 6e4,
|
|
61959
|
+
category: "clean",
|
|
61960
|
+
expected_finish_location: zone,
|
|
61961
|
+
description: { zone },
|
|
61962
|
+
use_tool_sink: true
|
|
61963
|
+
}
|
|
61964
|
+
}
|
|
61965
|
+
];
|
|
61966
|
+
}
|
|
61967
|
+
var composed = (category, activities) => ({
|
|
61968
|
+
category: "compose",
|
|
61969
|
+
requester: "iservice365",
|
|
61970
|
+
description: {
|
|
61971
|
+
category,
|
|
61972
|
+
phases: [{ activity: { category: "sequence", description: { activities } } }]
|
|
61973
|
+
}
|
|
61974
|
+
});
|
|
61975
|
+
function taskRequestFor(command, robotType, wp) {
|
|
61976
|
+
const pick = (names, allowed, what) => {
|
|
61977
|
+
const known = new Set(allowed.map((v) => v.name));
|
|
61978
|
+
const bad = names.filter((n) => !known.has(n));
|
|
61979
|
+
if (!names.length || bad.length) {
|
|
61980
|
+
throw new OpenRmfError(
|
|
61981
|
+
`Unknown ${what}${bad.length ? `: ${bad.join(", ")}` : ""}. Known: ${[...known].join(", ") || "none"}.`
|
|
61982
|
+
);
|
|
61983
|
+
}
|
|
61984
|
+
return names;
|
|
61985
|
+
};
|
|
61986
|
+
switch (command.kind) {
|
|
61987
|
+
case "full":
|
|
61988
|
+
if (robotType === "security") {
|
|
61989
|
+
return { category: "patrol", requester: "iservice365", description: { places: pick(wp.places.map((v) => v.name), wp.places, "patrol places"), rounds: 1 } };
|
|
61990
|
+
}
|
|
61991
|
+
return composed("clean", pick(wp.cleaningZones.map((v) => v.name), wp.cleaningZones, "cleaning zones").flatMap(cleanActivities));
|
|
61992
|
+
case "area":
|
|
61993
|
+
if (robotType === "security") {
|
|
61994
|
+
return { category: "patrol", requester: "iservice365", description: { places: command.areas.slice(0, 20), rounds: 1 } };
|
|
61995
|
+
}
|
|
61996
|
+
return composed("clean", pick(command.areas.slice(0, 20), wp.cleaningZones, "cleaning zones").flatMap(cleanActivities));
|
|
61997
|
+
case "return": {
|
|
61998
|
+
const charger = wp.chargers[0]?.name;
|
|
61999
|
+
if (!charger)
|
|
62000
|
+
throw new OpenRmfError("This robot has no charger on its current floor.");
|
|
62001
|
+
return composed("go_to_place", [{ category: "go_to_place", description: charger }]);
|
|
62002
|
+
}
|
|
62003
|
+
default:
|
|
62004
|
+
throw new OpenRmfError(`These robots do not take "${command.kind}".`);
|
|
62005
|
+
}
|
|
62006
|
+
}
|
|
62007
|
+
var DOOR_TYPE_SLIDING = /* @__PURE__ */ new Set([1, 2, 3, 4]);
|
|
62008
|
+
function buildingFromRmf(building) {
|
|
62009
|
+
const levels = building.levels.slice(0, 200);
|
|
62010
|
+
const floorOf = (name, i) => floorNoOf(name) ?? i + 1;
|
|
62011
|
+
const byName = new Map(levels.map((l, i) => [l.name, floorOf(l.name, i)]));
|
|
62012
|
+
return {
|
|
62013
|
+
name: String(building.name ?? "Building").slice(0, 60),
|
|
62014
|
+
levels: levels.map((l, i) => ({ floorNo: floorOf(l.name, i), name: l.name, elevationM: l.elevation })),
|
|
62015
|
+
doors: levels.flatMap(
|
|
62016
|
+
(l, i) => l.doors.map((d) => ({
|
|
62017
|
+
name: d.name,
|
|
62018
|
+
floorNo: floorOf(l.name, i),
|
|
62019
|
+
type: DOOR_TYPE_SLIDING.has(d.door_type) ? "sliding" : "hinged",
|
|
62020
|
+
start: { x: d.v1_x, y: d.v1_y },
|
|
62021
|
+
end: { x: d.v2_x, y: d.v2_y }
|
|
62022
|
+
}))
|
|
62023
|
+
),
|
|
62024
|
+
lifts: building.lifts.map((l) => ({
|
|
62025
|
+
name: l.name,
|
|
62026
|
+
x: l.ref_x,
|
|
62027
|
+
y: l.ref_y,
|
|
62028
|
+
widthM: l.width,
|
|
62029
|
+
depthM: l.depth,
|
|
62030
|
+
floors: l.levels.map((n) => byName.get(n)).filter((n) => typeof n === "number")
|
|
62031
|
+
}))
|
|
62032
|
+
};
|
|
62033
|
+
}
|
|
62034
|
+
function openRmfDoorDriver(client, doorName) {
|
|
62035
|
+
return {
|
|
62036
|
+
name: doorName,
|
|
62037
|
+
async read() {
|
|
62038
|
+
const s = await client.doorState(doorName).catch((e) => {
|
|
62039
|
+
if (/HTTP 404/.test(String(e?.message)))
|
|
62040
|
+
return null;
|
|
62041
|
+
throw e;
|
|
62042
|
+
});
|
|
62043
|
+
if (!s)
|
|
62044
|
+
return null;
|
|
62045
|
+
const t = s.door_time ?? {};
|
|
62046
|
+
return {
|
|
62047
|
+
doorName: s.door_name ?? doorName,
|
|
62048
|
+
doorTime: Number(t.sec ?? 0) * 1e3 + Math.round(Number(t.nanosec ?? 0) / 1e6),
|
|
62049
|
+
currentMode: doorModeOf(s.current_mode?.value)
|
|
62050
|
+
};
|
|
62051
|
+
},
|
|
62052
|
+
async request(request2) {
|
|
62053
|
+
if (request2.requestedMode !== DOOR_MODE.OPEN && request2.requestedMode !== DOOR_MODE.CLOSED) {
|
|
62054
|
+
throw new OpenRmfError("A door can only be asked to open or close.");
|
|
62055
|
+
}
|
|
62056
|
+
await client.doorRequest(doorName, request2.requestedMode);
|
|
62057
|
+
}
|
|
62058
|
+
};
|
|
62059
|
+
}
|
|
62060
|
+
function openRmfLiftDriver(client, liftName) {
|
|
62061
|
+
const destinations = /* @__PURE__ */ new Map();
|
|
62062
|
+
const send2 = (requestType, sessionId, destination, doorState) => client.liftRequest(liftName, {
|
|
62063
|
+
request_type: requestType,
|
|
62064
|
+
door_mode: doorState,
|
|
62065
|
+
destination,
|
|
62066
|
+
additional_session_ids: [sessionId]
|
|
62067
|
+
});
|
|
62068
|
+
return {
|
|
62069
|
+
name: liftName,
|
|
62070
|
+
async read() {
|
|
62071
|
+
const s = await client.liftState(liftName).catch((e) => {
|
|
62072
|
+
if (/HTTP 404/.test(String(e?.message)))
|
|
62073
|
+
return null;
|
|
62074
|
+
throw e;
|
|
62075
|
+
});
|
|
62076
|
+
if (!s)
|
|
62077
|
+
return null;
|
|
62078
|
+
const t = s.lift_time ?? {};
|
|
62079
|
+
return {
|
|
62080
|
+
liftName: s.lift_name ?? liftName,
|
|
62081
|
+
liftTime: Number(t.sec ?? 0) * 1e3 + Math.round(Number(t.nanosec ?? 0) / 1e6),
|
|
62082
|
+
availableFloors: Array.isArray(s.available_floors) ? s.available_floors.map(String) : [],
|
|
62083
|
+
currentFloor: String(s.current_floor ?? ""),
|
|
62084
|
+
destinationFloor: String(s.destination_floor ?? ""),
|
|
62085
|
+
doorState: [0, 1, 2].includes(s.door_state) ? s.door_state : 0,
|
|
62086
|
+
motionState: [0, 1, 2, 3].includes(s.motion_state) ? s.motion_state : 3,
|
|
62087
|
+
currentMode: [0, 1, 2, 3, 4, 5].includes(s.current_mode) ? s.current_mode : 0,
|
|
62088
|
+
sessionId: String(s.session_id ?? "")
|
|
62089
|
+
};
|
|
62090
|
+
},
|
|
62091
|
+
async request(r) {
|
|
62092
|
+
destinations.set(r.sessionId, r.destinationFloor);
|
|
62093
|
+
await send2(r.requestType, r.sessionId, r.destinationFloor, r.doorState);
|
|
62094
|
+
},
|
|
62095
|
+
async refresh(sessionId) {
|
|
62096
|
+
const destination = destinations.get(sessionId);
|
|
62097
|
+
if (destination)
|
|
62098
|
+
await send2(LIFT_REQUEST.AGV_MODE, sessionId, destination, 2);
|
|
62099
|
+
},
|
|
62100
|
+
async release(sessionId) {
|
|
62101
|
+
destinations.delete(sessionId);
|
|
62102
|
+
await send2(LIFT_REQUEST.END_SESSION, sessionId, "", 0);
|
|
62103
|
+
}
|
|
62104
|
+
};
|
|
62105
|
+
}
|
|
62106
|
+
function createOpenRmfAdapter(options) {
|
|
62107
|
+
const client = createOpenRmfClient(options && "config" in options ? options.config ?? null : openRmfConfig(), {
|
|
62108
|
+
fetch: options?.fetch,
|
|
62109
|
+
timeoutMs: options?.timeoutMs
|
|
62110
|
+
});
|
|
62111
|
+
async function states() {
|
|
62112
|
+
const [fleets, building] = await Promise.all([client.fleets(), client.buildingMap().catch(() => null)]);
|
|
62113
|
+
return { fleets: fleets ?? [], building };
|
|
62114
|
+
}
|
|
62115
|
+
async function openInterruptions(taskId) {
|
|
62116
|
+
if (!taskId)
|
|
62117
|
+
return [];
|
|
62118
|
+
const t = await client.taskState(taskId).catch(() => null);
|
|
62119
|
+
return Object.entries(t?.interruptions ?? {}).filter(([, v]) => !v?.resumed_by).map(([token]) => token);
|
|
62120
|
+
}
|
|
62121
|
+
async function find(robotSn) {
|
|
62122
|
+
const key = splitRobotSn(robotSn);
|
|
62123
|
+
if (!key)
|
|
62124
|
+
return null;
|
|
62125
|
+
const { fleets, building } = await states();
|
|
62126
|
+
const s = fleets.find((f) => f.name === key.fleet)?.robots?.[key.robot];
|
|
62127
|
+
return s ? { key, s, building } : null;
|
|
62128
|
+
}
|
|
62129
|
+
return {
|
|
62130
|
+
client,
|
|
62131
|
+
brand: OPEN_RMF_BRAND,
|
|
62132
|
+
displayName: OPEN_RMF_DISPLAY_NAME,
|
|
62133
|
+
capabilities: OPEN_RMF_CAPABILITIES,
|
|
62134
|
+
async listRobots() {
|
|
62135
|
+
const { fleets, building } = await states();
|
|
62136
|
+
return fleets.flatMap((f) => Object.entries(f.robots ?? {}).map(([n, s]) => toAdapterRobot(f.name, n, s, building)));
|
|
62137
|
+
},
|
|
62138
|
+
async getRobot(robotSn) {
|
|
62139
|
+
const hit = await find(robotSn);
|
|
62140
|
+
if (!hit)
|
|
62141
|
+
return null;
|
|
62142
|
+
return toAdapterRobot(hit.key.fleet, hit.key.robot, hit.s, hit.building, (await openInterruptions(hit.s.task_id)).length > 0);
|
|
62143
|
+
},
|
|
62144
|
+
async sendCommand(robotSn, command) {
|
|
62145
|
+
const hit = await find(robotSn);
|
|
62146
|
+
if (!hit)
|
|
62147
|
+
throw new OpenRmfError(`The fleet server does not list the robot "${robotSn}".`);
|
|
62148
|
+
const taskId = hit.s.task_id ?? "";
|
|
62149
|
+
if (command.kind === "pause" || command.kind === "resume" || command.kind === "cancel") {
|
|
62150
|
+
if (!taskId)
|
|
62151
|
+
throw new OpenRmfError("This robot has no task to " + command.kind + ".");
|
|
62152
|
+
let res2;
|
|
62153
|
+
if (command.kind === "resume") {
|
|
62154
|
+
const tokens = await openInterruptions(taskId);
|
|
62155
|
+
if (!tokens.length)
|
|
62156
|
+
throw new OpenRmfError("This robot's task is not paused.");
|
|
62157
|
+
res2 = await client.resumeTask(taskId, tokens);
|
|
62158
|
+
} else {
|
|
62159
|
+
res2 = command.kind === "pause" ? await client.interruptTask(taskId) : await client.cancelTask(taskId);
|
|
62160
|
+
}
|
|
62161
|
+
if (res2 && res2.success === false)
|
|
62162
|
+
throw new OpenRmfError(`The fleet server refused to ${command.kind} the task.`);
|
|
62163
|
+
return;
|
|
62164
|
+
}
|
|
62165
|
+
const wp = waypointsFor(hit.building, hit.s.location);
|
|
62166
|
+
const request2 = taskRequestFor(command, wp.cleaningZones.length ? "cleaning" : "security", wp);
|
|
62167
|
+
const res = await client.robotTask(hit.key.fleet, hit.key.robot, request2);
|
|
62168
|
+
if (!res?.success)
|
|
62169
|
+
throw new OpenRmfError("The fleet server did not accept the task.");
|
|
62170
|
+
},
|
|
62171
|
+
/**
|
|
62172
|
+
* The robot's current patrol, from its task state: each phase is
|
|
62173
|
+
* "Go to [place:<name>]", in order, and the active phase is the checkpoint
|
|
62174
|
+
* it is heading for. (A direct robot task keeps no request record on the
|
|
62175
|
+
* api-server, so the state is the only source.)
|
|
62176
|
+
*/
|
|
62177
|
+
async getPatrolRoutes(robotSn) {
|
|
62178
|
+
const none = { routes: [], schedule: [] };
|
|
62179
|
+
const hit = await find(robotSn);
|
|
62180
|
+
const taskId = hit?.s.task_id;
|
|
62181
|
+
if (!hit || !taskId)
|
|
62182
|
+
return none;
|
|
62183
|
+
const t = await client.taskState(taskId).catch(() => null);
|
|
62184
|
+
if (!t || !/^patrol$/i.test(String(t.category ?? "")))
|
|
62185
|
+
return none;
|
|
62186
|
+
const level2 = hit.building?.levels.find((l) => l.name === hit.s.location?.map);
|
|
62187
|
+
const vertex = (name) => level2?.nav_graphs.flatMap((g) => g.vertices).find((v) => v.name === name);
|
|
62188
|
+
const phases = Object.entries(t.phases ?? {}).sort(([a], [b]) => Number(a) - Number(b)).map(([id, p]) => ({ id: Number(id), place: /\[place:([^\]]+)\]/.exec(String(p?.category ?? ""))?.[1] ?? "" })).filter((p) => p.place && vertex(p.place));
|
|
62189
|
+
const checkpoints = phases.map((p) => {
|
|
62190
|
+
const v = vertex(p.place);
|
|
62191
|
+
return { name: p.place, ...planShareOf(hit.building, { map: level2.name, x: v.x, y: v.y, yaw: 0 }) };
|
|
62192
|
+
});
|
|
62193
|
+
const current = phases.findIndex((p) => p.id === t.active);
|
|
62194
|
+
return {
|
|
62195
|
+
routes: [
|
|
62196
|
+
{
|
|
62197
|
+
id: taskId,
|
|
62198
|
+
name: `Patrol \xB7 ${checkpoints.map((c) => c.name).join(" \u2192 ")}`.slice(0, 80),
|
|
62199
|
+
floorNo: floorNoOf(level2?.name),
|
|
62200
|
+
checkpoints,
|
|
62201
|
+
currentCheckpoint: current >= 0 ? current : null
|
|
62202
|
+
}
|
|
62203
|
+
],
|
|
62204
|
+
schedule: []
|
|
62205
|
+
};
|
|
62206
|
+
}
|
|
62207
|
+
};
|
|
62208
|
+
}
|
|
62209
|
+
function registerOpenRmfBrand(env2 = process.env) {
|
|
62210
|
+
if (!openRmfConfig(env2))
|
|
62211
|
+
return false;
|
|
62212
|
+
registerRobotBrand({
|
|
62213
|
+
brand: OPEN_RMF_BRAND,
|
|
62214
|
+
displayName: OPEN_RMF_DISPLAY_NAME,
|
|
62215
|
+
capabilities: OPEN_RMF_CAPABILITIES,
|
|
62216
|
+
types: ["cleaning", "security"],
|
|
62217
|
+
create: () => createOpenRmfAdapter()
|
|
62218
|
+
});
|
|
62219
|
+
return true;
|
|
62220
|
+
}
|
|
62221
|
+
registerOpenRmfBrand();
|
|
62222
|
+
|
|
61501
62223
|
// src/services/robot-fleet.service.ts
|
|
61502
62224
|
function useRobotFleetService(deps) {
|
|
61503
62225
|
const adapterFor = deps?.adapterFor ?? ((robot) => adapterForRobot(robot));
|
|
@@ -62045,213 +62767,6 @@ function robotActionsFor(actor) {
|
|
|
62045
62767
|
);
|
|
62046
62768
|
}
|
|
62047
62769
|
|
|
62048
|
-
// src/utils/lift-contract.util.ts
|
|
62049
|
-
var LIFT_DOOR = {
|
|
62050
|
-
CLOSED: 0,
|
|
62051
|
-
MOVING: 1,
|
|
62052
|
-
OPEN: 2
|
|
62053
|
-
};
|
|
62054
|
-
var LIFT_MOTION = {
|
|
62055
|
-
STOPPED: 0,
|
|
62056
|
-
UP: 1,
|
|
62057
|
-
DOWN: 2,
|
|
62058
|
-
UNKNOWN: 3
|
|
62059
|
-
};
|
|
62060
|
-
var LIFT_MODE = {
|
|
62061
|
-
UNKNOWN: 0,
|
|
62062
|
-
HUMAN: 1,
|
|
62063
|
-
AGV: 2,
|
|
62064
|
-
FIRE: 3,
|
|
62065
|
-
OFFLINE: 4,
|
|
62066
|
-
EMERGENCY: 5
|
|
62067
|
-
};
|
|
62068
|
-
var LIFT_REQUEST = {
|
|
62069
|
-
END_SESSION: 0,
|
|
62070
|
-
AGV_MODE: 1,
|
|
62071
|
-
HUMAN_MODE: 2
|
|
62072
|
-
};
|
|
62073
|
-
function isLiftAvailable(state) {
|
|
62074
|
-
if (!state)
|
|
62075
|
-
return false;
|
|
62076
|
-
return state.currentMode === LIFT_MODE.HUMAN || state.currentMode === LIFT_MODE.AGV;
|
|
62077
|
-
}
|
|
62078
|
-
function isSafeToCross(state, floor) {
|
|
62079
|
-
if (!isLiftAvailable(state) || !state)
|
|
62080
|
-
return false;
|
|
62081
|
-
if (state.currentFloor !== floor)
|
|
62082
|
-
return false;
|
|
62083
|
-
if (state.motionState !== LIFT_MOTION.STOPPED)
|
|
62084
|
-
return false;
|
|
62085
|
-
return state.doorState === LIFT_DOOR.OPEN;
|
|
62086
|
-
}
|
|
62087
|
-
function holdsLift(state, sessionId) {
|
|
62088
|
-
if (!state || !sessionId)
|
|
62089
|
-
return false;
|
|
62090
|
-
return state.sessionId === sessionId;
|
|
62091
|
-
}
|
|
62092
|
-
function servesFloor(state, floor) {
|
|
62093
|
-
if (!state || !floor)
|
|
62094
|
-
return false;
|
|
62095
|
-
return state.availableFloors.includes(floor);
|
|
62096
|
-
}
|
|
62097
|
-
function createLiftSimulator(options) {
|
|
62098
|
-
const { name, floors } = options;
|
|
62099
|
-
if (floors.length === 0)
|
|
62100
|
-
throw new Error("A lift must serve some floors.");
|
|
62101
|
-
const msPerFloor = options.msPerFloor ?? 2e3;
|
|
62102
|
-
const doorDwellMs = options.doorDwellMs ?? 5e3;
|
|
62103
|
-
const state = {
|
|
62104
|
-
liftName: name,
|
|
62105
|
-
liftTime: 0,
|
|
62106
|
-
availableFloors: [...floors],
|
|
62107
|
-
currentFloor: options.startFloor ?? floors[0],
|
|
62108
|
-
destinationFloor: options.startFloor ?? floors[0],
|
|
62109
|
-
doorState: LIFT_DOOR.CLOSED,
|
|
62110
|
-
motionState: LIFT_MOTION.STOPPED,
|
|
62111
|
-
currentMode: LIFT_MODE.HUMAN,
|
|
62112
|
-
sessionId: ""
|
|
62113
|
-
};
|
|
62114
|
-
let travelRemaining = 0;
|
|
62115
|
-
let doorTimer = 0;
|
|
62116
|
-
function tick(ms) {
|
|
62117
|
-
state.liftTime += ms;
|
|
62118
|
-
if (state.motionState !== LIFT_MOTION.STOPPED) {
|
|
62119
|
-
travelRemaining -= ms;
|
|
62120
|
-
if (travelRemaining <= 0) {
|
|
62121
|
-
state.currentFloor = state.destinationFloor;
|
|
62122
|
-
state.motionState = LIFT_MOTION.STOPPED;
|
|
62123
|
-
state.doorState = LIFT_DOOR.OPEN;
|
|
62124
|
-
doorTimer = doorDwellMs;
|
|
62125
|
-
}
|
|
62126
|
-
return;
|
|
62127
|
-
}
|
|
62128
|
-
if (state.doorState === LIFT_DOOR.OPEN) {
|
|
62129
|
-
doorTimer -= ms;
|
|
62130
|
-
if (doorTimer <= 0)
|
|
62131
|
-
state.doorState = LIFT_DOOR.CLOSED;
|
|
62132
|
-
}
|
|
62133
|
-
}
|
|
62134
|
-
return {
|
|
62135
|
-
name,
|
|
62136
|
-
state,
|
|
62137
|
-
tick,
|
|
62138
|
-
async read() {
|
|
62139
|
-
return { ...state, availableFloors: [...state.availableFloors] };
|
|
62140
|
-
},
|
|
62141
|
-
async request(request2) {
|
|
62142
|
-
if (request2.requestType === LIFT_REQUEST.END_SESSION) {
|
|
62143
|
-
if (state.sessionId === request2.sessionId) {
|
|
62144
|
-
state.sessionId = "";
|
|
62145
|
-
state.currentMode = LIFT_MODE.HUMAN;
|
|
62146
|
-
}
|
|
62147
|
-
return;
|
|
62148
|
-
}
|
|
62149
|
-
if (state.sessionId && state.sessionId !== request2.sessionId) {
|
|
62150
|
-
throw new Error(`Lift ${name} is held by ${state.sessionId}.`);
|
|
62151
|
-
}
|
|
62152
|
-
if (!state.availableFloors.includes(request2.destinationFloor)) {
|
|
62153
|
-
throw new Error(
|
|
62154
|
-
`Lift ${name} does not serve ${request2.destinationFloor}.`
|
|
62155
|
-
);
|
|
62156
|
-
}
|
|
62157
|
-
state.sessionId = request2.sessionId;
|
|
62158
|
-
state.currentMode = request2.requestType === LIFT_REQUEST.AGV_MODE ? LIFT_MODE.AGV : LIFT_MODE.HUMAN;
|
|
62159
|
-
state.destinationFloor = request2.destinationFloor;
|
|
62160
|
-
if (state.currentFloor === request2.destinationFloor) {
|
|
62161
|
-
state.motionState = LIFT_MOTION.STOPPED;
|
|
62162
|
-
state.doorState = LIFT_DOOR.OPEN;
|
|
62163
|
-
doorTimer = doorDwellMs;
|
|
62164
|
-
return;
|
|
62165
|
-
}
|
|
62166
|
-
const from = state.availableFloors.indexOf(state.currentFloor);
|
|
62167
|
-
const to = state.availableFloors.indexOf(request2.destinationFloor);
|
|
62168
|
-
state.motionState = to > from ? LIFT_MOTION.UP : LIFT_MOTION.DOWN;
|
|
62169
|
-
state.doorState = LIFT_DOOR.CLOSED;
|
|
62170
|
-
travelRemaining = Math.abs(to - from) * msPerFloor;
|
|
62171
|
-
},
|
|
62172
|
-
async refresh(sessionId) {
|
|
62173
|
-
if (state.sessionId !== sessionId)
|
|
62174
|
-
return;
|
|
62175
|
-
if (state.doorState === LIFT_DOOR.OPEN)
|
|
62176
|
-
doorTimer = doorDwellMs;
|
|
62177
|
-
},
|
|
62178
|
-
async release(sessionId) {
|
|
62179
|
-
if (state.sessionId !== sessionId)
|
|
62180
|
-
return;
|
|
62181
|
-
state.sessionId = "";
|
|
62182
|
-
state.currentMode = LIFT_MODE.HUMAN;
|
|
62183
|
-
}
|
|
62184
|
-
};
|
|
62185
|
-
}
|
|
62186
|
-
var LIFT_QUEUE_TTL_MS = 10 * 6e4;
|
|
62187
|
-
var LIFT_LEASE_MS = 3 * 6e4;
|
|
62188
|
-
var LIFT_SIM_MS_PER_FLOOR = 4e3;
|
|
62189
|
-
var LIFT_SIM_DOOR_DWELL_MS = 8e3;
|
|
62190
|
-
var LIFT_SIM_BOARD_MS = 6e3;
|
|
62191
|
-
var LIFT_SESSION_STATUS = [
|
|
62192
|
-
"queued",
|
|
62193
|
-
"active",
|
|
62194
|
-
"released",
|
|
62195
|
-
"expired",
|
|
62196
|
-
"cancelled"
|
|
62197
|
-
];
|
|
62198
|
-
async function simulatedLiftState(options) {
|
|
62199
|
-
const sim = createLiftSimulator({
|
|
62200
|
-
name: options.name,
|
|
62201
|
-
floors: options.floors,
|
|
62202
|
-
msPerFloor: LIFT_SIM_MS_PER_FLOOR,
|
|
62203
|
-
doorDwellMs: LIFT_SIM_DOOR_DWELL_MS
|
|
62204
|
-
});
|
|
62205
|
-
const session = options.session;
|
|
62206
|
-
if (!session || !options.floors.includes(session.fromFloor) || !options.floors.includes(session.toFloor)) {
|
|
62207
|
-
return { state: await sim.read(), phase: "idle" };
|
|
62208
|
-
}
|
|
62209
|
-
const STEP = 250;
|
|
62210
|
-
const elapsed = Math.max(0, options.now - session.activeAt);
|
|
62211
|
-
let phase = "to-pickup";
|
|
62212
|
-
let boardingLeft = LIFT_SIM_BOARD_MS;
|
|
62213
|
-
await sim.request({
|
|
62214
|
-
liftName: options.name,
|
|
62215
|
-
sessionId: session.id,
|
|
62216
|
-
requestType: LIFT_REQUEST.AGV_MODE,
|
|
62217
|
-
destinationFloor: session.fromFloor,
|
|
62218
|
-
doorState: LIFT_DOOR.OPEN
|
|
62219
|
-
});
|
|
62220
|
-
if (isSafeToCross(sim.state, session.fromFloor))
|
|
62221
|
-
phase = "boarding";
|
|
62222
|
-
for (let t = 0; t < elapsed; t += STEP) {
|
|
62223
|
-
const ms = Math.min(STEP, elapsed - t);
|
|
62224
|
-
sim.tick(ms);
|
|
62225
|
-
const s = sim.state;
|
|
62226
|
-
if (phase === "to-pickup") {
|
|
62227
|
-
if (isSafeToCross(s, session.fromFloor))
|
|
62228
|
-
phase = "boarding";
|
|
62229
|
-
} else if (phase === "boarding") {
|
|
62230
|
-
await sim.refresh(session.id);
|
|
62231
|
-
boardingLeft -= ms;
|
|
62232
|
-
if (boardingLeft <= 0) {
|
|
62233
|
-
phase = "to-destination";
|
|
62234
|
-
await sim.request({
|
|
62235
|
-
liftName: options.name,
|
|
62236
|
-
sessionId: session.id,
|
|
62237
|
-
requestType: LIFT_REQUEST.AGV_MODE,
|
|
62238
|
-
destinationFloor: session.toFloor,
|
|
62239
|
-
doorState: LIFT_DOOR.CLOSED
|
|
62240
|
-
});
|
|
62241
|
-
}
|
|
62242
|
-
} else if (phase === "to-destination") {
|
|
62243
|
-
if (isSafeToCross(s, session.toFloor))
|
|
62244
|
-
phase = "arrived";
|
|
62245
|
-
} else if (phase === "arrived") {
|
|
62246
|
-
await sim.refresh(session.id);
|
|
62247
|
-
}
|
|
62248
|
-
}
|
|
62249
|
-
return { state: await sim.read(), phase };
|
|
62250
|
-
}
|
|
62251
|
-
function liftQueueKey(mapId, liftName) {
|
|
62252
|
-
return `${mapId}:${liftName}`;
|
|
62253
|
-
}
|
|
62254
|
-
|
|
62255
62770
|
// src/utils/building-map.util.ts
|
|
62256
62771
|
var WALL_HEIGHT_M = 2.5;
|
|
62257
62772
|
var WALL_THICKNESS_M = 0.1;
|
|
@@ -62995,7 +63510,7 @@ function useRobotFleetController(deps) {
|
|
|
62995
63510
|
|
|
62996
63511
|
`);
|
|
62997
63512
|
};
|
|
62998
|
-
const handle = robot.brand === DEMO_BRAND ? startDemoTracking(getFleet2().adapterFor(robot), robotSn, send2) : startRobotTracking({
|
|
63513
|
+
const handle = robot.brand === DEMO_BRAND || robot.brand === OPEN_RMF_BRAND ? startDemoTracking(getFleet2().adapterFor(robot), robotSn, send2) : startRobotTracking({
|
|
62999
63514
|
credentials: {
|
|
63000
63515
|
appid: (robot.appKey ?? "").trim(),
|
|
63001
63516
|
secret: (robot.appToken ?? "").trim()
|
|
@@ -63698,7 +64213,34 @@ function useRobotMapController(deps) {
|
|
|
63698
64213
|
fail(next, e);
|
|
63699
64214
|
}
|
|
63700
64215
|
}
|
|
64216
|
+
async function getOpenRmfBuilding(req, res, next) {
|
|
64217
|
+
const { error, value } = import_joi78.default.object({ site: hexId, appSlug: import_joi78.default.string().allow("") }).validate(req.query);
|
|
64218
|
+
if (error)
|
|
64219
|
+
return fail(next, new import_node_server_utils162.BadRequestError(error.message));
|
|
64220
|
+
try {
|
|
64221
|
+
await requireSiteReach(req, value.site);
|
|
64222
|
+
const config2 = openRmfConfig();
|
|
64223
|
+
if (!config2)
|
|
64224
|
+
throw new import_node_server_utils162.NotFoundError("Fleet Core is not configured on this server.");
|
|
64225
|
+
const client = createOpenRmfClient(config2);
|
|
64226
|
+
const building = buildingFromRmf(await client.buildingMap());
|
|
64227
|
+
const [doorStates, liftStates] = await Promise.all([
|
|
64228
|
+
Promise.all(building.doors.slice(0, 100).map((d) => openRmfDoorDriver(client, d.name).read().catch(() => null))),
|
|
64229
|
+
Promise.all(building.lifts.slice(0, 20).map((l) => openRmfLiftDriver(client, l.name).read().catch(() => null)))
|
|
64230
|
+
]);
|
|
64231
|
+
res.json({
|
|
64232
|
+
source: "fleet-core",
|
|
64233
|
+
readOnly: true,
|
|
64234
|
+
...building,
|
|
64235
|
+
doorStates: doorStates.filter(Boolean),
|
|
64236
|
+
liftStates: liftStates.filter(Boolean)
|
|
64237
|
+
});
|
|
64238
|
+
} catch (e) {
|
|
64239
|
+
fail(next, e instanceof OpenRmfError ? new import_node_server_utils162.AppError(e.message, 502) : e);
|
|
64240
|
+
}
|
|
64241
|
+
}
|
|
63701
64242
|
return {
|
|
64243
|
+
getOpenRmfBuilding,
|
|
63702
64244
|
listMaps,
|
|
63703
64245
|
getMap,
|
|
63704
64246
|
createMap,
|
|
@@ -64014,7 +64556,7 @@ function useRobotSiteController() {
|
|
|
64014
64556
|
}
|
|
64015
64557
|
|
|
64016
64558
|
// src/controllers/robot-network.controller.ts
|
|
64017
|
-
var
|
|
64559
|
+
var MODES2 = ["IDLE", "CHARGED", "WORKING", "PAUSED", "CHARGING_CYCLE", "MAINTENANCE", "IN_TRANSIT", "MANUAL", "UNAVAILABLE"];
|
|
64018
64560
|
var NETWORK_STATES_MAX = 50;
|
|
64019
64561
|
function useRobotNetworkController() {
|
|
64020
64562
|
const hex = import_joi80.default.string().hex().length(24).allow("", null);
|
|
@@ -64030,7 +64572,7 @@ function useRobotNetworkController() {
|
|
|
64030
64572
|
brand: import_joi80.default.string().trim().max(60).allow("", null),
|
|
64031
64573
|
faultsOnly: import_joi80.default.boolean().default(false),
|
|
64032
64574
|
offlineOnly: import_joi80.default.boolean().default(false),
|
|
64033
|
-
status: import_joi80.default.string().valid(...
|
|
64575
|
+
status: import_joi80.default.string().valid(...MODES2).allow("", null)
|
|
64034
64576
|
});
|
|
64035
64577
|
const faultsSchema = import_joi80.default.object({
|
|
64036
64578
|
page: import_joi80.default.number().integer().min(1).max(1e4).default(1),
|
|
@@ -97502,6 +98044,7 @@ function usePersonalEmergencyChainController() {
|
|
|
97502
98044
|
DEMO_ROUTES,
|
|
97503
98045
|
DEVICE_STATUS,
|
|
97504
98046
|
DOBStatus,
|
|
98047
|
+
DOOR_MODE,
|
|
97505
98048
|
DUPLICATE_TERMS_VERSION_MESSAGE,
|
|
97506
98049
|
DayOfWeek,
|
|
97507
98050
|
E164,
|
|
@@ -97641,6 +98184,9 @@ function usePersonalEmergencyChainController() {
|
|
|
97641
98184
|
NotificationModule,
|
|
97642
98185
|
NotificationService,
|
|
97643
98186
|
OFFLINE_FAULT_CODE,
|
|
98187
|
+
OPEN_RMF_BRAND,
|
|
98188
|
+
OPEN_RMF_CAPABILITIES,
|
|
98189
|
+
OPEN_RMF_DISPLAY_NAME,
|
|
97644
98190
|
ORG_MARKETPLACE_VENDOR_FIELD,
|
|
97645
98191
|
ORG_OWNER_REPAIR_CLAIM_STALE_MS,
|
|
97646
98192
|
ORG_OWNER_REPAIR_CLAIM_TAKEN_REASON,
|
|
@@ -97649,6 +98195,7 @@ function usePersonalEmergencyChainController() {
|
|
|
97649
98195
|
OUNITECH_BRAND,
|
|
97650
98196
|
OUNITECH_CAPABILITIES,
|
|
97651
98197
|
OUNITECH_PENDING_COMMANDS,
|
|
98198
|
+
OpenRmfError,
|
|
97652
98199
|
OrgNature,
|
|
97653
98200
|
OvernightParkingRequestSort,
|
|
97654
98201
|
OvernightParkingRequestStatus,
|
|
@@ -97745,6 +98292,7 @@ function usePersonalEmergencyChainController() {
|
|
|
97745
98292
|
attendanceSchema,
|
|
97746
98293
|
attendanceSettingsSchema,
|
|
97747
98294
|
buildSelfServiceEmailContext,
|
|
98295
|
+
buildingFromRmf,
|
|
97748
98296
|
buildingMapBodySchema,
|
|
97749
98297
|
buildingMapCreateSchema,
|
|
97750
98298
|
buildingMapFromRobotMaps,
|
|
@@ -97786,6 +98334,8 @@ function usePersonalEmergencyChainController() {
|
|
|
97786
98334
|
createDemoAdapter,
|
|
97787
98335
|
createLiftSimulator,
|
|
97788
98336
|
createManpowerRemarksDaily,
|
|
98337
|
+
createOpenRmfAdapter,
|
|
98338
|
+
createOpenRmfClient,
|
|
97789
98339
|
createOunitechAdapter,
|
|
97790
98340
|
createSseParser,
|
|
97791
98341
|
customerSchema,
|
|
@@ -97808,6 +98358,7 @@ function usePersonalEmergencyChainController() {
|
|
|
97808
98358
|
deviceHttpTimeoutMs,
|
|
97809
98359
|
deviceProbeTtlSeconds,
|
|
97810
98360
|
disconnectedState,
|
|
98361
|
+
doorModeOf,
|
|
97811
98362
|
emitNotificationCreated,
|
|
97812
98363
|
emptyPersonalEmergencyChain,
|
|
97813
98364
|
encodeGreyscalePng,
|
|
@@ -97824,6 +98375,7 @@ function usePersonalEmergencyChainController() {
|
|
|
97824
98375
|
ffmpegFrameArgs,
|
|
97825
98376
|
ffmpegPath,
|
|
97826
98377
|
filterByAccess,
|
|
98378
|
+
floorNoOf,
|
|
97827
98379
|
formatCapabilityTrace,
|
|
97828
98380
|
formatDahuaDate,
|
|
97829
98381
|
getIO,
|
|
@@ -97846,6 +98398,7 @@ function usePersonalEmergencyChainController() {
|
|
|
97846
98398
|
isAvailableForWork,
|
|
97847
98399
|
isCameraEntitled,
|
|
97848
98400
|
isDispatchable,
|
|
98401
|
+
isDoorPassable,
|
|
97849
98402
|
isDuplicateMemberError,
|
|
97850
98403
|
isDuplicateVersionError,
|
|
97851
98404
|
isLiftAvailable,
|
|
@@ -97900,6 +98453,9 @@ function usePersonalEmergencyChainController() {
|
|
|
97900
98453
|
occurrence_book_namespace_collection,
|
|
97901
98454
|
onBookTimezonesChanged,
|
|
97902
98455
|
online_forms_namespace_collection,
|
|
98456
|
+
openRmfConfig,
|
|
98457
|
+
openRmfDoorDriver,
|
|
98458
|
+
openRmfLiftDriver,
|
|
97903
98459
|
orgLevelRoles,
|
|
97904
98460
|
orgModulesHandlers,
|
|
97905
98461
|
orgOwnerRepairHandlers,
|
|
@@ -97922,6 +98478,7 @@ function usePersonalEmergencyChainController() {
|
|
|
97922
98478
|
planDayFromJsDay,
|
|
97923
98479
|
planDemoRobots,
|
|
97924
98480
|
planOrgOwnerRepair,
|
|
98481
|
+
planShareOf,
|
|
97925
98482
|
platform_terms_namespace_collection,
|
|
97926
98483
|
playbackRelays,
|
|
97927
98484
|
playbackWindowRefusal,
|
|
@@ -97938,6 +98495,7 @@ function usePersonalEmergencyChainController() {
|
|
|
97938
98495
|
refuseServiceProviderInviteAction,
|
|
97939
98496
|
registerCameraTransport,
|
|
97940
98497
|
registerDemoBrand,
|
|
98498
|
+
registerOpenRmfBrand,
|
|
97941
98499
|
registerOunitechBrand,
|
|
97942
98500
|
registerRobotBrand,
|
|
97943
98501
|
registeredRobotBrands,
|
|
@@ -98138,6 +98696,7 @@ function usePersonalEmergencyChainController() {
|
|
|
98138
98696
|
site_people_namespace_collection,
|
|
98139
98697
|
snapshotEndpoint,
|
|
98140
98698
|
snapshotRefusalReason,
|
|
98699
|
+
splitRobotSn,
|
|
98141
98700
|
staffMayBypass,
|
|
98142
98701
|
startDemoTracking,
|
|
98143
98702
|
startRobotTracking,
|
|
@@ -98147,6 +98706,8 @@ function usePersonalEmergencyChainController() {
|
|
|
98147
98706
|
subscriptionPlanSchema,
|
|
98148
98707
|
summariseBulkCameraPlan,
|
|
98149
98708
|
supports,
|
|
98709
|
+
taskRequestFor,
|
|
98710
|
+
toAdapterRobot,
|
|
98150
98711
|
trackingBackoffMs,
|
|
98151
98712
|
uncontrollableFleetWarning,
|
|
98152
98713
|
updateRemarksStatusEod,
|
|
@@ -98404,6 +98965,7 @@ function usePersonalEmergencyChainController() {
|
|
|
98404
98965
|
visitors_namespace_collection,
|
|
98405
98966
|
wallConfig,
|
|
98406
98967
|
wallsFromOccupancyGrid,
|
|
98968
|
+
waypointsFor,
|
|
98407
98969
|
withLiveLink,
|
|
98408
98970
|
workOrderSchema,
|
|
98409
98971
|
work_orders2_namespace_collection,
|