@operato/scene-storage 10.0.0-beta.33 → 10.0.0-beta.34
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 +14 -0
- package/dist/crane-3d.d.ts +14 -0
- package/dist/crane-3d.js +238 -0
- package/dist/crane-3d.js.map +1 -0
- package/dist/crane.d.ts +157 -0
- package/dist/crane.js +440 -0
- package/dist/crane.js.map +1 -0
- package/dist/index.d.ts +13 -6
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/mobile-storage-rack.d.ts +17 -0
- package/dist/mobile-storage-rack.js +55 -0
- package/dist/mobile-storage-rack.js.map +1 -0
- package/dist/rack-column.d.ts +35 -0
- package/dist/rack-column.js +258 -0
- package/dist/rack-column.js.map +1 -0
- package/dist/rack-grid-3d.d.ts +13 -0
- package/dist/rack-grid-3d.js +94 -0
- package/dist/rack-grid-3d.js.map +1 -0
- package/dist/rack-grid-cell.d.ts +341 -0
- package/dist/rack-grid-cell.js +321 -0
- package/dist/rack-grid-cell.js.map +1 -0
- package/dist/rack-grid-helpers.d.ts +28 -0
- package/dist/rack-grid-helpers.js +71 -0
- package/dist/rack-grid-helpers.js.map +1 -0
- package/dist/rack-grid-location.d.ts +37 -0
- package/dist/rack-grid-location.js +227 -0
- package/dist/rack-grid-location.js.map +1 -0
- package/dist/rack-grid.d.ts +80 -0
- package/dist/rack-grid.js +829 -0
- package/dist/rack-grid.js.map +1 -0
- package/dist/stock.d.ts +78 -0
- package/dist/stock.js +333 -0
- package/dist/stock.js.map +1 -0
- package/dist/{rack-cell-3d.d.ts → storage-cell-3d.d.ts} +1 -1
- package/dist/{rack-cell-3d.js → storage-cell-3d.js} +3 -3
- package/dist/storage-cell-3d.js.map +1 -0
- package/dist/{rack-cell.d.ts → storage-cell.d.ts} +12 -6
- package/dist/{rack-cell.js → storage-cell.js} +9 -9
- package/dist/storage-cell.js.map +1 -0
- package/dist/{asrs-rack-3d.d.ts → storage-rack-3d.d.ts} +1 -1
- package/dist/{asrs-rack-3d.js → storage-rack-3d.js} +4 -4
- package/dist/storage-rack-3d.js.map +1 -0
- package/dist/{asrs-rack.d.ts → storage-rack.d.ts} +22 -16
- package/dist/{asrs-rack.js → storage-rack.js} +32 -26
- package/dist/storage-rack.js.map +1 -0
- package/dist/templates/index.d.ts +60 -0
- package/dist/templates/index.js +59 -17
- package/dist/templates/index.js.map +1 -1
- package/package.json +2 -2
- package/src/crane-3d.ts +273 -0
- package/src/crane.ts +538 -0
- package/src/index.ts +13 -6
- package/src/mobile-storage-rack.ts +56 -0
- package/src/rack-column.ts +340 -0
- package/src/rack-grid-3d.ts +128 -0
- package/src/rack-grid-cell.ts +404 -0
- package/src/rack-grid-helpers.ts +77 -0
- package/src/rack-grid-location.ts +286 -0
- package/src/rack-grid.ts +994 -0
- package/src/stock.ts +426 -0
- package/src/{rack-cell-3d.ts → storage-cell-3d.ts} +2 -2
- package/src/{rack-cell.ts → storage-cell.ts} +19 -13
- package/src/{asrs-rack-3d.ts → storage-rack-3d.ts} +3 -3
- package/src/{asrs-rack.ts → storage-rack.ts} +31 -25
- package/src/templates/index.ts +59 -17
- package/test/test-rack-grid-crane.ts +212 -0
- package/test/test-rack-grid.ts +77 -0
- package/test/{test-asrs-crane.ts → test-storage-rack-crane.ts} +8 -8
- package/translations/en.json +55 -7
- package/translations/ja.json +52 -4
- package/translations/ko.json +52 -4
- package/translations/ms.json +55 -7
- package/translations/zh.json +52 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/asrs-crane-3d.d.ts +0 -17
- package/dist/asrs-crane-3d.js +0 -181
- package/dist/asrs-crane-3d.js.map +0 -1
- package/dist/asrs-crane.d.ts +0 -98
- package/dist/asrs-crane.js +0 -216
- package/dist/asrs-crane.js.map +0 -1
- package/dist/asrs-rack-3d.js.map +0 -1
- package/dist/asrs-rack.js.map +0 -1
- package/dist/rack-cell-3d.js.map +0 -1
- package/dist/rack-cell.js.map +0 -1
- package/src/asrs-crane-3d.ts +0 -211
- package/src/asrs-crane.ts +0 -275
- /package/icons/{asrs-crane.png → crane.png} +0 -0
- /package/icons/{asrs-rack.png → storage-rack.png} +0 -0
package/dist/asrs-crane-3d.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { RealObjectGroup } from '@hatiolab/things-scene';
|
|
3
|
-
export declare class AsrsCrane3D extends RealObjectGroup {
|
|
4
|
-
build(): void;
|
|
5
|
-
/** Sub-frame where carriers attach during transport (fork tool-centre-point). */
|
|
6
|
-
private _carriageFrame?;
|
|
7
|
-
/**
|
|
8
|
-
* Return the carriage TCP anchor. Carriers attached to this frame will
|
|
9
|
-
* follow carriage movement as `carriageHeight` changes and the crane rebuilds.
|
|
10
|
-
*
|
|
11
|
-
* Callers should re-fetch this after any state change that triggers rebuild.
|
|
12
|
-
*/
|
|
13
|
-
getCarriageFrame(): THREE.Object3D | undefined;
|
|
14
|
-
updateDimension(): void;
|
|
15
|
-
onchange(after: Record<string, unknown>, before: Record<string, unknown>): void;
|
|
16
|
-
updateAlpha(): void;
|
|
17
|
-
}
|
package/dist/asrs-crane-3d.js
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* AsrsCrane 3D — stacker crane for AS/RS aisles.
|
|
5
|
-
*
|
|
6
|
-
* LO-POLY but structurally complete. The signature parts:
|
|
7
|
-
*
|
|
8
|
-
* - tall vertical mast (the dominant element — runs floor → ceiling)
|
|
9
|
-
* - base unit (motor housing at floor level, runs on the floor rail)
|
|
10
|
-
* - top guide (sliding block at ceiling that runs on the ceiling rail —
|
|
11
|
-
* stabilizes the mast under acceleration)
|
|
12
|
-
* - carriage (horizontal block that slides up/down the mast at
|
|
13
|
-
* `state.carriageHeight`)
|
|
14
|
-
* - shuttle/fork attachment on the carriage (extends sideways into a cell
|
|
15
|
-
* to extract / insert a pallet)
|
|
16
|
-
* - status lamp on top of the base unit
|
|
17
|
-
*
|
|
18
|
-
* The base unit + top guide combo is what visually distinguishes a stacker
|
|
19
|
-
* crane from a forklift — the stacker is *constrained* to the aisle, riding
|
|
20
|
-
* rails top and bottom, and that constraint is the visual signature.
|
|
21
|
-
*/
|
|
22
|
-
import * as THREE from 'three';
|
|
23
|
-
import { RealObjectGroup } from '@hatiolab/things-scene';
|
|
24
|
-
const MAST_COLOR = 0x4a5060;
|
|
25
|
-
const BASE_COLOR = 0x33394a;
|
|
26
|
-
const SHUTTLE_COLOR = 0x222233;
|
|
27
|
-
const RAIL_COLOR = 0x222222;
|
|
28
|
-
export class AsrsCrane3D extends RealObjectGroup {
|
|
29
|
-
build() {
|
|
30
|
-
super.build();
|
|
31
|
-
const { width, height, depth = 200 } = this.component.state;
|
|
32
|
-
const bodyColor = this.component.state.bodyColor || '#888';
|
|
33
|
-
const emissiveColor = this.component.state.lampEmissive || '#222222';
|
|
34
|
-
const status = this.component.state.status;
|
|
35
|
-
const lampIntensity = status && status !== 'idle' ? 1.5 : 0.2;
|
|
36
|
-
// Clamp carriageHeight to the available mast travel — keeps the carriage
|
|
37
|
-
// inside the shaft even if state.carriageHeight is stale (e.g. left over
|
|
38
|
-
// from an older height-scale convention).
|
|
39
|
-
const carriageRaw = this.component.state.carriageHeight ?? depth * 0.4;
|
|
40
|
-
const carriageHeight = Math.max(0, Math.min(carriageRaw, depth * 0.85));
|
|
41
|
-
const baseY = -depth / 2;
|
|
42
|
-
// Proportions
|
|
43
|
-
const baseH = depth * 0.10;
|
|
44
|
-
const topGuideH = depth * 0.05;
|
|
45
|
-
const mastH = depth - baseH - topGuideH;
|
|
46
|
-
const mastW = width * 0.35;
|
|
47
|
-
const mastD = height * 0.35;
|
|
48
|
-
const bodyMaterial = new THREE.MeshStandardMaterial({
|
|
49
|
-
color: bodyColor,
|
|
50
|
-
metalness: 0.4,
|
|
51
|
-
roughness: 0.5
|
|
52
|
-
});
|
|
53
|
-
const mastMaterial = new THREE.MeshStandardMaterial({
|
|
54
|
-
color: MAST_COLOR,
|
|
55
|
-
metalness: 0.85,
|
|
56
|
-
roughness: 0.3
|
|
57
|
-
});
|
|
58
|
-
const baseMaterial = new THREE.MeshStandardMaterial({
|
|
59
|
-
color: BASE_COLOR,
|
|
60
|
-
metalness: 0.7,
|
|
61
|
-
roughness: 0.4
|
|
62
|
-
});
|
|
63
|
-
const shuttleMaterial = new THREE.MeshStandardMaterial({
|
|
64
|
-
color: SHUTTLE_COLOR,
|
|
65
|
-
metalness: 0.85,
|
|
66
|
-
roughness: 0.3
|
|
67
|
-
});
|
|
68
|
-
// ── Floor rail (visible track under the base) ─────────────────────
|
|
69
|
-
const railH = baseH * 0.25;
|
|
70
|
-
const railGeo = new THREE.BoxGeometry(width * 1.15, railH, mastD * 0.4);
|
|
71
|
-
const railMesh = new THREE.Mesh(railGeo, new THREE.MeshStandardMaterial({ color: RAIL_COLOR, metalness: 0.9, roughness: 0.3 }));
|
|
72
|
-
railMesh.position.set(0, baseY + railH / 2, 0);
|
|
73
|
-
railMesh.receiveShadow = true;
|
|
74
|
-
this.object3d.add(railMesh);
|
|
75
|
-
// ── Base unit (motor housing on floor rail) ───────────────────────
|
|
76
|
-
const baseGeo = new THREE.BoxGeometry(width * 0.95, baseH, height * 0.85);
|
|
77
|
-
const baseMesh = new THREE.Mesh(baseGeo, baseMaterial);
|
|
78
|
-
baseMesh.position.set(0, baseY + railH + baseH / 2, 0);
|
|
79
|
-
baseMesh.castShadow = true;
|
|
80
|
-
baseMesh.receiveShadow = true;
|
|
81
|
-
this.object3d.add(baseMesh);
|
|
82
|
-
// Body color tint band on base unit (subtle status indication)
|
|
83
|
-
const tintH = baseH * 0.15;
|
|
84
|
-
const tintGeo = new THREE.BoxGeometry(width * 0.95, tintH, height * 0.85);
|
|
85
|
-
const tintMaterial = new THREE.MeshStandardMaterial({
|
|
86
|
-
color: bodyColor,
|
|
87
|
-
transparent: true,
|
|
88
|
-
opacity: 0.6,
|
|
89
|
-
metalness: 0.1,
|
|
90
|
-
roughness: 0.6
|
|
91
|
-
});
|
|
92
|
-
const tintMesh = new THREE.Mesh(tintGeo, tintMaterial);
|
|
93
|
-
tintMesh.position.set(0, baseY + railH + baseH - tintH / 2, 0);
|
|
94
|
-
this.object3d.add(tintMesh);
|
|
95
|
-
// ── Mast (vertical column from base top to ceiling) ───────────────
|
|
96
|
-
const mastY = baseY + railH + baseH + mastH / 2;
|
|
97
|
-
const mastGeo = new THREE.BoxGeometry(mastW, mastH, mastD);
|
|
98
|
-
const mastMesh = new THREE.Mesh(mastGeo, mastMaterial);
|
|
99
|
-
mastMesh.position.set(0, mastY, 0);
|
|
100
|
-
mastMesh.castShadow = true;
|
|
101
|
-
this.object3d.add(mastMesh);
|
|
102
|
-
// ── Carriage (horizontal block sliding on mast at carriageHeight) ─
|
|
103
|
-
const carriageW = width * 0.85;
|
|
104
|
-
const carriageH = baseH * 0.7;
|
|
105
|
-
const carriageD = mastD * 1.4;
|
|
106
|
-
const carriageY = baseY + railH + baseH + carriageHeight + carriageH / 2;
|
|
107
|
-
const carriageGeo = new THREE.BoxGeometry(carriageW, carriageH, carriageD);
|
|
108
|
-
const carriageMesh = new THREE.Mesh(carriageGeo, bodyMaterial);
|
|
109
|
-
carriageMesh.position.set(0, carriageY, 0);
|
|
110
|
-
carriageMesh.castShadow = true;
|
|
111
|
-
this.object3d.add(carriageMesh);
|
|
112
|
-
// ── Shuttle / fork attachment on carriage (extends sideways) ──────
|
|
113
|
-
const shuttleW = width * 1.05;
|
|
114
|
-
const shuttleH = carriageH * 0.5;
|
|
115
|
-
const shuttleD = carriageD * 0.6;
|
|
116
|
-
const shuttleGeo = new THREE.BoxGeometry(shuttleW, shuttleH, shuttleD);
|
|
117
|
-
const shuttleMesh = new THREE.Mesh(shuttleGeo, shuttleMaterial);
|
|
118
|
-
shuttleMesh.position.set(0, carriageY - carriageH / 2 - shuttleH / 2, 0);
|
|
119
|
-
shuttleMesh.castShadow = true;
|
|
120
|
-
this.object3d.add(shuttleMesh);
|
|
121
|
-
// ── Top guide (sliding block on ceiling rail) ─────────────────────
|
|
122
|
-
const topGuideGeo = new THREE.BoxGeometry(width * 0.7, topGuideH, height * 0.6);
|
|
123
|
-
const topGuideMesh = new THREE.Mesh(topGuideGeo, baseMaterial);
|
|
124
|
-
topGuideMesh.position.set(0, baseY + depth - topGuideH / 2, 0);
|
|
125
|
-
topGuideMesh.castShadow = true;
|
|
126
|
-
this.object3d.add(topGuideMesh);
|
|
127
|
-
// Ceiling rail (small visual cue at very top)
|
|
128
|
-
const ceilingRailGeo = new THREE.BoxGeometry(width * 1.15, topGuideH * 0.4, mastD * 0.4);
|
|
129
|
-
const ceilingRailMesh = new THREE.Mesh(ceilingRailGeo, new THREE.MeshStandardMaterial({ color: RAIL_COLOR, metalness: 0.9, roughness: 0.3 }));
|
|
130
|
-
ceilingRailMesh.position.set(0, baseY + depth - topGuideH * 0.2, 0);
|
|
131
|
-
this.object3d.add(ceilingRailMesh);
|
|
132
|
-
// ── Status lamp on top of base unit ───────────────────────────────
|
|
133
|
-
const lampR = Math.min(width, height) * 0.04;
|
|
134
|
-
const lampH = lampR * 1.5;
|
|
135
|
-
const lampMaterial = new THREE.MeshStandardMaterial({
|
|
136
|
-
color: emissiveColor,
|
|
137
|
-
emissive: emissiveColor,
|
|
138
|
-
emissiveIntensity: lampIntensity,
|
|
139
|
-
metalness: 0,
|
|
140
|
-
roughness: 0.3
|
|
141
|
-
});
|
|
142
|
-
const lampGeo = new THREE.CylinderGeometry(lampR, lampR * 0.85, lampH, 12);
|
|
143
|
-
const lampMesh = new THREE.Mesh(lampGeo, lampMaterial);
|
|
144
|
-
// Place lamp near the corner of the base, away from the mast
|
|
145
|
-
lampMesh.position.set(width * 0.3, baseY + railH + baseH + lampH / 2, height * 0.3);
|
|
146
|
-
this.object3d.add(lampMesh);
|
|
147
|
-
// ── Carriage frame (invisible anchor for carrier attach) ──────────
|
|
148
|
-
// Placed at the top of the shuttle, where cargo rests.
|
|
149
|
-
this._carriageFrame = new THREE.Object3D();
|
|
150
|
-
this._carriageFrame.name = 'crane-carriage-tcp';
|
|
151
|
-
this._carriageFrame.position.set(0, carriageY - carriageH / 2 - shuttleH, 0);
|
|
152
|
-
this.object3d.add(this._carriageFrame);
|
|
153
|
-
}
|
|
154
|
-
/** Sub-frame where carriers attach during transport (fork tool-centre-point). */
|
|
155
|
-
_carriageFrame;
|
|
156
|
-
/**
|
|
157
|
-
* Return the carriage TCP anchor. Carriers attached to this frame will
|
|
158
|
-
* follow carriage movement as `carriageHeight` changes and the crane rebuilds.
|
|
159
|
-
*
|
|
160
|
-
* Callers should re-fetch this after any state change that triggers rebuild.
|
|
161
|
-
*/
|
|
162
|
-
getCarriageFrame() {
|
|
163
|
-
return this._carriageFrame;
|
|
164
|
-
}
|
|
165
|
-
updateDimension() { }
|
|
166
|
-
onchange(after, before) {
|
|
167
|
-
if ('status' in after ||
|
|
168
|
-
'bodyColor' in after ||
|
|
169
|
-
'lampEmissive' in after ||
|
|
170
|
-
'carriageHeight' in after ||
|
|
171
|
-
'width' in after ||
|
|
172
|
-
'height' in after ||
|
|
173
|
-
'depth' in after) {
|
|
174
|
-
this.update();
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
super.onchange(after, before);
|
|
178
|
-
}
|
|
179
|
-
updateAlpha() { }
|
|
180
|
-
}
|
|
181
|
-
//# sourceMappingURL=asrs-crane-3d.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"asrs-crane-3d.js","sourceRoot":"","sources":["../src/asrs-crane-3d.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,MAAM,UAAU,GAAG,QAAQ,CAAA;AAC3B,MAAM,UAAU,GAAG,QAAQ,CAAA;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IACxC,CAAC;IAED,iFAAiF;IACzE,cAAc,CAAiB;IAEvC;;;;;OAKG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,cAAc,CAAA;IAC5B,CAAC;IAED,eAAe,KAAI,CAAC;IAEpB,QAAQ,CAAC,KAA8B,EAAE,MAA+B;QACtE,IACE,QAAQ,IAAI,KAAK;YACjB,WAAW,IAAI,KAAK;YACpB,cAAc,IAAI,KAAK;YACvB,gBAAgB,IAAI,KAAK;YACzB,OAAO,IAAI,KAAK;YAChB,QAAQ,IAAI,KAAK;YACjB,OAAO,IAAI,KAAK,EAChB,CAAC;YACD,IAAI,CAAC,MAAM,EAAE,CAAA;YACb,OAAM;QACR,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IAC/B,CAAC;IAED,WAAW,KAAI,CAAC;CACjB","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n *\n * AsrsCrane 3D — stacker crane for AS/RS aisles.\n *\n * LO-POLY but structurally complete. The signature parts:\n *\n * - tall vertical mast (the dominant element — runs floor → ceiling)\n * - base unit (motor housing at floor level, runs on the floor rail)\n * - top guide (sliding block at ceiling that runs on the ceiling rail —\n * stabilizes the mast under acceleration)\n * - carriage (horizontal block that slides up/down the mast at\n * `state.carriageHeight`)\n * - shuttle/fork attachment on the carriage (extends sideways into a cell\n * to extract / insert a pallet)\n * - status lamp on top of the base unit\n *\n * The base unit + top guide combo is what visually distinguishes a stacker\n * crane from a forklift — the stacker is *constrained* to the aisle, riding\n * rails top and bottom, and that constraint is the visual signature.\n */\n\nimport * as THREE from 'three'\nimport * as BufferGeometryUtils from 'three/examples/jsm/utils/BufferGeometryUtils.js'\nimport { RealObjectGroup } from '@hatiolab/things-scene'\n\nconst MAST_COLOR = 0x4a5060\nconst BASE_COLOR = 0x33394a\nconst SHUTTLE_COLOR = 0x222233\nconst RAIL_COLOR = 0x222222\n\nexport class AsrsCrane3D extends RealObjectGroup {\n build() {\n super.build()\n\n const { width, height, depth = 200 } = this.component.state\n const bodyColor = (this.component.state.bodyColor as string) || '#888'\n const emissiveColor = (this.component.state.lampEmissive as string) || '#222222'\n const status = this.component.state.status\n const lampIntensity = status && status !== 'idle' ? 1.5 : 0.2\n // Clamp carriageHeight to the available mast travel — keeps the carriage\n // inside the shaft even if state.carriageHeight is stale (e.g. left over\n // from an older height-scale convention).\n const carriageRaw = (this.component.state.carriageHeight as number) ?? depth * 0.4\n const carriageHeight = Math.max(0, Math.min(carriageRaw, depth * 0.85))\n\n const baseY = -depth / 2\n\n // Proportions\n const baseH = depth * 0.10\n const topGuideH = depth * 0.05\n const mastH = depth - baseH - topGuideH\n const mastW = width * 0.35\n const mastD = height * 0.35\n\n const bodyMaterial = new THREE.MeshStandardMaterial({\n color: bodyColor,\n metalness: 0.4,\n roughness: 0.5\n })\n const mastMaterial = new THREE.MeshStandardMaterial({\n color: MAST_COLOR,\n metalness: 0.85,\n roughness: 0.3\n })\n const baseMaterial = new THREE.MeshStandardMaterial({\n color: BASE_COLOR,\n metalness: 0.7,\n roughness: 0.4\n })\n const shuttleMaterial = new THREE.MeshStandardMaterial({\n color: SHUTTLE_COLOR,\n metalness: 0.85,\n roughness: 0.3\n })\n\n // ── Floor rail (visible track under the base) ─────────────────────\n const railH = baseH * 0.25\n const railGeo = new THREE.BoxGeometry(width * 1.15, railH, mastD * 0.4)\n const railMesh = new THREE.Mesh(\n railGeo,\n new THREE.MeshStandardMaterial({ color: RAIL_COLOR, metalness: 0.9, roughness: 0.3 })\n )\n railMesh.position.set(0, baseY + railH / 2, 0)\n railMesh.receiveShadow = true\n this.object3d.add(railMesh)\n\n // ── Base unit (motor housing on floor rail) ───────────────────────\n const baseGeo = new THREE.BoxGeometry(width * 0.95, baseH, height * 0.85)\n const baseMesh = new THREE.Mesh(baseGeo, baseMaterial)\n baseMesh.position.set(0, baseY + railH + baseH / 2, 0)\n baseMesh.castShadow = true\n baseMesh.receiveShadow = true\n this.object3d.add(baseMesh)\n\n // Body color tint band on base unit (subtle status indication)\n const tintH = baseH * 0.15\n const tintGeo = new THREE.BoxGeometry(width * 0.95, tintH, height * 0.85)\n const tintMaterial = new THREE.MeshStandardMaterial({\n color: bodyColor,\n transparent: true,\n opacity: 0.6,\n metalness: 0.1,\n roughness: 0.6\n })\n const tintMesh = new THREE.Mesh(tintGeo, tintMaterial)\n tintMesh.position.set(0, baseY + railH + baseH - tintH / 2, 0)\n this.object3d.add(tintMesh)\n\n // ── Mast (vertical column from base top to ceiling) ───────────────\n const mastY = baseY + railH + baseH + mastH / 2\n const mastGeo = new THREE.BoxGeometry(mastW, mastH, mastD)\n const mastMesh = new THREE.Mesh(mastGeo, mastMaterial)\n mastMesh.position.set(0, mastY, 0)\n mastMesh.castShadow = true\n this.object3d.add(mastMesh)\n\n // ── Carriage (horizontal block sliding on mast at carriageHeight) ─\n const carriageW = width * 0.85\n const carriageH = baseH * 0.7\n const carriageD = mastD * 1.4\n const carriageY = baseY + railH + baseH + carriageHeight + carriageH / 2\n const carriageGeo = new THREE.BoxGeometry(carriageW, carriageH, carriageD)\n const carriageMesh = new THREE.Mesh(carriageGeo, bodyMaterial)\n carriageMesh.position.set(0, carriageY, 0)\n carriageMesh.castShadow = true\n this.object3d.add(carriageMesh)\n\n // ── Shuttle / fork attachment on carriage (extends sideways) ──────\n const shuttleW = width * 1.05\n const shuttleH = carriageH * 0.5\n const shuttleD = carriageD * 0.6\n const shuttleGeo = new THREE.BoxGeometry(shuttleW, shuttleH, shuttleD)\n const shuttleMesh = new THREE.Mesh(shuttleGeo, shuttleMaterial)\n shuttleMesh.position.set(0, carriageY - carriageH / 2 - shuttleH / 2, 0)\n shuttleMesh.castShadow = true\n this.object3d.add(shuttleMesh)\n\n // ── Top guide (sliding block on ceiling rail) ─────────────────────\n const topGuideGeo = new THREE.BoxGeometry(width * 0.7, topGuideH, height * 0.6)\n const topGuideMesh = new THREE.Mesh(topGuideGeo, baseMaterial)\n topGuideMesh.position.set(0, baseY + depth - topGuideH / 2, 0)\n topGuideMesh.castShadow = true\n this.object3d.add(topGuideMesh)\n\n // Ceiling rail (small visual cue at very top)\n const ceilingRailGeo = new THREE.BoxGeometry(width * 1.15, topGuideH * 0.4, mastD * 0.4)\n const ceilingRailMesh = new THREE.Mesh(\n ceilingRailGeo,\n new THREE.MeshStandardMaterial({ color: RAIL_COLOR, metalness: 0.9, roughness: 0.3 })\n )\n ceilingRailMesh.position.set(0, baseY + depth - topGuideH * 0.2, 0)\n this.object3d.add(ceilingRailMesh)\n\n // ── Status lamp on top of base unit ───────────────────────────────\n const lampR = Math.min(width, height) * 0.04\n const lampH = lampR * 1.5\n const lampMaterial = new THREE.MeshStandardMaterial({\n color: emissiveColor,\n emissive: emissiveColor,\n emissiveIntensity: lampIntensity,\n metalness: 0,\n roughness: 0.3\n })\n const lampGeo = new THREE.CylinderGeometry(lampR, lampR * 0.85, lampH, 12)\n const lampMesh = new THREE.Mesh(lampGeo, lampMaterial)\n // Place lamp near the corner of the base, away from the mast\n lampMesh.position.set(width * 0.3, baseY + railH + baseH + lampH / 2, height * 0.3)\n this.object3d.add(lampMesh)\n\n // ── Carriage frame (invisible anchor for carrier attach) ──────────\n // Placed at the top of the shuttle, where cargo rests.\n this._carriageFrame = new THREE.Object3D()\n this._carriageFrame.name = 'crane-carriage-tcp'\n this._carriageFrame.position.set(0, carriageY - carriageH / 2 - shuttleH, 0)\n this.object3d.add(this._carriageFrame)\n }\n\n /** Sub-frame where carriers attach during transport (fork tool-centre-point). */\n private _carriageFrame?: THREE.Object3D\n\n /**\n * Return the carriage TCP anchor. Carriers attached to this frame will\n * follow carriage movement as `carriageHeight` changes and the crane rebuilds.\n *\n * Callers should re-fetch this after any state change that triggers rebuild.\n */\n getCarriageFrame(): THREE.Object3D | undefined {\n return this._carriageFrame\n }\n\n updateDimension() {}\n\n onchange(after: Record<string, unknown>, before: Record<string, unknown>) {\n if (\n 'status' in after ||\n 'bodyColor' in after ||\n 'lampEmissive' in after ||\n 'carriageHeight' in after ||\n 'width' in after ||\n 'height' in after ||\n 'depth' in after\n ) {\n this.update()\n return\n }\n super.onchange(after, before)\n }\n\n updateAlpha() {}\n}\n"]}
|
package/dist/asrs-crane.d.ts
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { Component, ComponentNature, RealObject } from '@hatiolab/things-scene';
|
|
2
|
-
import type { SlotDef, State, Material3D } from '@hatiolab/things-scene';
|
|
3
|
-
import { type AttachFrame, type Alignment, type Heights, type LegendBinding, type MoveOptions, type PlacementArchetype } from '@operato/scene-base';
|
|
4
|
-
import { AsrsCrane3D } from './asrs-crane-3d.js';
|
|
5
|
-
/**
|
|
6
|
-
* AsrsCrane status — the operating state of a stacker crane in an AS/RS aisle.
|
|
7
|
-
*
|
|
8
|
-
* - `idle` — parked at home position
|
|
9
|
-
* - `moving` — translating along the aisle (horizontal) or along the
|
|
10
|
-
* mast (vertical); the two motions are typically combined
|
|
11
|
-
* - `loading` — extracting a pallet from a rack cell
|
|
12
|
-
* - `unloading` — placing a pallet into a rack cell
|
|
13
|
-
* - `error` — fault / e-stop / collision warning
|
|
14
|
-
*/
|
|
15
|
-
export type AsrsCraneStatus = 'idle' | 'moving' | 'loading' | 'unloading' | 'error';
|
|
16
|
-
/** AsrsCrane 컴포넌트 state */
|
|
17
|
-
export interface AsrsCraneState extends State {
|
|
18
|
-
status?: AsrsCraneStatus;
|
|
19
|
-
carriageHeight?: number;
|
|
20
|
-
material3d?: Material3D;
|
|
21
|
-
}
|
|
22
|
-
declare const AsrsCrane_base: any;
|
|
23
|
-
/**
|
|
24
|
-
* AsrsCrane — the stacker / retrieval crane that runs in the aisle of an
|
|
25
|
-
* AS/RS, moving cargo between the load port and the rack cells.
|
|
26
|
-
*
|
|
27
|
-
* Structure: a tall vertical mast that translates along a floor + ceiling
|
|
28
|
-
* rail (the aisle), with a carriage that slides up/down the mast carrying a
|
|
29
|
-
* shuttle / forks.
|
|
30
|
-
*
|
|
31
|
-
* **Monitoring mode**: crane status is driven by data binding
|
|
32
|
-
* (`state.status`, `state.carriageHeight`). The carrier is referenced
|
|
33
|
-
* via data binding — it is NOT a child of the crane in monitoring mode.
|
|
34
|
-
*
|
|
35
|
-
* **Simulation mode**: call `crane.pick(carrier)` / `crane.place(carrier, rackCell)`
|
|
36
|
-
* (or `crane.pickAndPlace(carrier, rackCell)`). Mover handles navigation +
|
|
37
|
-
* engage + reparent. During transit the carrier IS a child of the crane.
|
|
38
|
-
*/
|
|
39
|
-
export default class AsrsCrane extends AsrsCrane_base {
|
|
40
|
-
state: AsrsCraneState;
|
|
41
|
-
_realObject?: AsrsCrane3D;
|
|
42
|
-
static legends: Record<string, LegendBinding>;
|
|
43
|
-
static placement: PlacementArchetype;
|
|
44
|
-
static align: Alignment;
|
|
45
|
-
static defaultDepth: (h: Heights) => number;
|
|
46
|
-
/** Yaw offset: crane model is drawn with the aisle axis along X (right = forward). */
|
|
47
|
-
static yawOffset: number;
|
|
48
|
-
/**
|
|
49
|
-
* Phase H — ASRS crane 은 telescoping forks 로 rack cell 안의 carrier 픽업.
|
|
50
|
-
* forklift-fork 와 동일 mechanism — pallet 의 fork pocket 진입.
|
|
51
|
-
* (Mover mixin chain 이 :any 라 override 키워드 불가, getter 만 정의.)
|
|
52
|
-
*/
|
|
53
|
-
get toolType(): string;
|
|
54
|
-
get nature(): ComponentNature;
|
|
55
|
-
get anchors(): never[];
|
|
56
|
-
/** Stacker crane carries at most one load at a time on its forks. */
|
|
57
|
-
get slots(): SlotDef[];
|
|
58
|
-
/**
|
|
59
|
-
* Return the 3D attach frame on the crane's carriage (fork tip).
|
|
60
|
-
* Carriers are attached here while the crane is in transit (pick phase).
|
|
61
|
-
*
|
|
62
|
-
* The AsrsCrane3D exposes `getCarriageFrame()` — a sub-Object3D that
|
|
63
|
-
* tracks the carriage height and sits at the fork TCP. If the 3D object
|
|
64
|
-
* isn't built yet (e.g. before scene initialization), fall back to the
|
|
65
|
-
* crane's own object3d centre.
|
|
66
|
-
*/
|
|
67
|
-
attachPointFor(carrier: Component): AttachFrame | null;
|
|
68
|
-
/**
|
|
69
|
-
* Domain-specific actuation between arrival and reparent.
|
|
70
|
-
*
|
|
71
|
-
* Simulation sequence for PICK:
|
|
72
|
-
* 1. Mover.pick() navigates crane to carrier position (moveTo).
|
|
73
|
-
* 2. engage('pick') → snap carriage height + status 'loading'.
|
|
74
|
-
* 3. Carrier is reparented to crane (becomes child).
|
|
75
|
-
*
|
|
76
|
-
* For now: set status and snap carriage height. A full ASRS simulation
|
|
77
|
-
* would tween the carriageHeight here (animate AsrsCrane3D).
|
|
78
|
-
*
|
|
79
|
-
* Status lifecycle:
|
|
80
|
-
* idle → (moveTo running) → engage fires → loading/unloading → (reparent) → idle
|
|
81
|
-
* The 'moving' state is not set from Mover.moveTo() because TypeScript
|
|
82
|
-
* can't call super.moveTo() on an `: any`-typed mixin. WCS data binding
|
|
83
|
-
* sets 'moving' in monitoring mode; override pick()/place() to set it
|
|
84
|
-
* in full simulation environments.
|
|
85
|
-
*/
|
|
86
|
-
engage(target: Component, kind: 'pick' | 'place', _options?: MoveOptions): Promise<void>;
|
|
87
|
-
/** Fetch a carrier from a rack cell (semantically = pick). */
|
|
88
|
-
fetch(carrier: Component, options?: MoveOptions): Promise<void>;
|
|
89
|
-
/** Deposit a carrier into a rack cell (semantically = place). */
|
|
90
|
-
deposit(carrier: Component, cell: Component, options?: MoveOptions): Promise<void>;
|
|
91
|
-
/**
|
|
92
|
-
* 2D — top-down rectangle showing the crane's footprint along the aisle.
|
|
93
|
-
* The crane is much taller than wide, so the 2D mark is small.
|
|
94
|
-
*/
|
|
95
|
-
render(ctx: CanvasRenderingContext2D): void;
|
|
96
|
-
buildRealObject(): RealObject | undefined;
|
|
97
|
-
}
|
|
98
|
-
export {};
|
package/dist/asrs-crane.js
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
4
|
-
*/
|
|
5
|
-
import { ContainerAbstract, ContainerCapacity, sceneComponent } from '@hatiolab/things-scene';
|
|
6
|
-
import { CarrierHolder, Legendable, Mover, Placeable } from '@operato/scene-base';
|
|
7
|
-
import { AsrsCrane3D } from './asrs-crane-3d.js';
|
|
8
|
-
const BODY_LEGEND = {
|
|
9
|
-
idle: '#888',
|
|
10
|
-
moving: '#aabbcc',
|
|
11
|
-
loading: '#ffaa00',
|
|
12
|
-
unloading: '#ffaa00',
|
|
13
|
-
error: '#c66',
|
|
14
|
-
default: '#888'
|
|
15
|
-
};
|
|
16
|
-
const LAMP_EMISSIVE_LEGEND = {
|
|
17
|
-
idle: '#222222',
|
|
18
|
-
moving: '#44ff44',
|
|
19
|
-
loading: '#ffaa00',
|
|
20
|
-
unloading: '#ffaa00',
|
|
21
|
-
error: '#ff3333',
|
|
22
|
-
default: '#222222'
|
|
23
|
-
};
|
|
24
|
-
const NATURE = {
|
|
25
|
-
mutable: false,
|
|
26
|
-
resizable: true,
|
|
27
|
-
rotatable: true,
|
|
28
|
-
properties: [
|
|
29
|
-
{
|
|
30
|
-
type: 'select',
|
|
31
|
-
label: 'status',
|
|
32
|
-
name: 'status',
|
|
33
|
-
property: {
|
|
34
|
-
options: [
|
|
35
|
-
{ display: 'Idle', value: 'idle' },
|
|
36
|
-
{ display: 'Moving', value: 'moving' },
|
|
37
|
-
{ display: 'Loading', value: 'loading' },
|
|
38
|
-
{ display: 'Unloading', value: 'unloading' },
|
|
39
|
-
{ display: 'Error', value: 'error' }
|
|
40
|
-
]
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
type: 'number',
|
|
45
|
-
label: 'carriage-height',
|
|
46
|
-
name: 'carriageHeight',
|
|
47
|
-
placeholder: 'mm — height of carriage on mast'
|
|
48
|
-
}
|
|
49
|
-
],
|
|
50
|
-
help: 'scene/component/asrs-crane'
|
|
51
|
-
};
|
|
52
|
-
// Mixin chain: Mover → CarrierHolder → ContainerCapacity → Legendable → Placeable → ContainerAbstract
|
|
53
|
-
//
|
|
54
|
-
// Mover: pick / place / pickAndPlace / moveTo / engage primitives
|
|
55
|
-
// CarrierHolder: attachPointFor() — where the carrier sits on the crane (carriage fork)
|
|
56
|
-
// ContainerCapacity: receive() / dispatch() / canReceive() / slots — slot tracking +
|
|
57
|
-
// TRANSFER_SLOT_KEY bookkeeping during transit
|
|
58
|
-
// Legendable: status → bodyColor / lampEmissive colour mapping
|
|
59
|
-
// Placeable: floor-archetype 3D positioning
|
|
60
|
-
// ContainerAbstract: child management — carrier becomes a child while in transit
|
|
61
|
-
//
|
|
62
|
-
// Note: ContainerAbstract replaces Shape. The 2D outline is drawn manually in
|
|
63
|
-
// render() below (a simple top-down rectangle), matching the old Shape output
|
|
64
|
-
// without the Shape base-class overhead.
|
|
65
|
-
/**
|
|
66
|
-
* AsrsCrane — the stacker / retrieval crane that runs in the aisle of an
|
|
67
|
-
* AS/RS, moving cargo between the load port and the rack cells.
|
|
68
|
-
*
|
|
69
|
-
* Structure: a tall vertical mast that translates along a floor + ceiling
|
|
70
|
-
* rail (the aisle), with a carriage that slides up/down the mast carrying a
|
|
71
|
-
* shuttle / forks.
|
|
72
|
-
*
|
|
73
|
-
* **Monitoring mode**: crane status is driven by data binding
|
|
74
|
-
* (`state.status`, `state.carriageHeight`). The carrier is referenced
|
|
75
|
-
* via data binding — it is NOT a child of the crane in monitoring mode.
|
|
76
|
-
*
|
|
77
|
-
* **Simulation mode**: call `crane.pick(carrier)` / `crane.place(carrier, rackCell)`
|
|
78
|
-
* (or `crane.pickAndPlace(carrier, rackCell)`). Mover handles navigation +
|
|
79
|
-
* engage + reparent. During transit the carrier IS a child of the crane.
|
|
80
|
-
*/
|
|
81
|
-
let AsrsCrane = class AsrsCrane extends Mover(CarrierHolder(ContainerCapacity(Legendable(Placeable(ContainerAbstract))))) {
|
|
82
|
-
static legends = {
|
|
83
|
-
bodyColor: { from: 'status', legend: BODY_LEGEND },
|
|
84
|
-
lampEmissive: { from: 'status', legend: LAMP_EMISSIVE_LEGEND }
|
|
85
|
-
};
|
|
86
|
-
static placement = 'floor';
|
|
87
|
-
static align = 'bottom';
|
|
88
|
-
static defaultDepth = (h) => h.ceiling - h.floor;
|
|
89
|
-
/** Yaw offset: crane model is drawn with the aisle axis along X (right = forward). */
|
|
90
|
-
static yawOffset = 0;
|
|
91
|
-
/**
|
|
92
|
-
* Phase H — ASRS crane 은 telescoping forks 로 rack cell 안의 carrier 픽업.
|
|
93
|
-
* forklift-fork 와 동일 mechanism — pallet 의 fork pocket 진입.
|
|
94
|
-
* (Mover mixin chain 이 :any 라 override 키워드 불가, getter 만 정의.)
|
|
95
|
-
*/
|
|
96
|
-
get toolType() {
|
|
97
|
-
return 'forklift-fork';
|
|
98
|
-
}
|
|
99
|
-
get nature() {
|
|
100
|
-
return NATURE;
|
|
101
|
-
}
|
|
102
|
-
get anchors() {
|
|
103
|
-
return [];
|
|
104
|
-
}
|
|
105
|
-
// ── ContainerCapacity ─────────────────────────────────────────────────────
|
|
106
|
-
/** Stacker crane carries at most one load at a time on its forks. */
|
|
107
|
-
get slots() {
|
|
108
|
-
return [{ id: 'forks', maxCount: 1 }];
|
|
109
|
-
}
|
|
110
|
-
// ── CarrierHolder — attach frame (carriage fork position) ─────────────────
|
|
111
|
-
/**
|
|
112
|
-
* Return the 3D attach frame on the crane's carriage (fork tip).
|
|
113
|
-
* Carriers are attached here while the crane is in transit (pick phase).
|
|
114
|
-
*
|
|
115
|
-
* The AsrsCrane3D exposes `getCarriageFrame()` — a sub-Object3D that
|
|
116
|
-
* tracks the carriage height and sits at the fork TCP. If the 3D object
|
|
117
|
-
* isn't built yet (e.g. before scene initialization), fall back to the
|
|
118
|
-
* crane's own object3d centre.
|
|
119
|
-
*/
|
|
120
|
-
attachPointFor(carrier) {
|
|
121
|
-
const ro = this._realObject;
|
|
122
|
-
const frame = ro?.getCarriageFrame?.();
|
|
123
|
-
if (frame) {
|
|
124
|
-
const carrierDepth = resolveCarrierDepth(carrier);
|
|
125
|
-
return { attach: frame, localPosition: { x: 0, y: carrierDepth / 2, z: 0 } };
|
|
126
|
-
}
|
|
127
|
-
const root = this._realObject?.object3d;
|
|
128
|
-
if (!root)
|
|
129
|
-
return null;
|
|
130
|
-
return { attach: root };
|
|
131
|
-
}
|
|
132
|
-
// ── Mover overrides ───────────────────────────────────────────────────────
|
|
133
|
-
/**
|
|
134
|
-
* Domain-specific actuation between arrival and reparent.
|
|
135
|
-
*
|
|
136
|
-
* Simulation sequence for PICK:
|
|
137
|
-
* 1. Mover.pick() navigates crane to carrier position (moveTo).
|
|
138
|
-
* 2. engage('pick') → snap carriage height + status 'loading'.
|
|
139
|
-
* 3. Carrier is reparented to crane (becomes child).
|
|
140
|
-
*
|
|
141
|
-
* For now: set status and snap carriage height. A full ASRS simulation
|
|
142
|
-
* would tween the carriageHeight here (animate AsrsCrane3D).
|
|
143
|
-
*
|
|
144
|
-
* Status lifecycle:
|
|
145
|
-
* idle → (moveTo running) → engage fires → loading/unloading → (reparent) → idle
|
|
146
|
-
* The 'moving' state is not set from Mover.moveTo() because TypeScript
|
|
147
|
-
* can't call super.moveTo() on an `: any`-typed mixin. WCS data binding
|
|
148
|
-
* sets 'moving' in monitoring mode; override pick()/place() to set it
|
|
149
|
-
* in full simulation environments.
|
|
150
|
-
*/
|
|
151
|
-
async engage(target, kind, _options = {}) {
|
|
152
|
-
if (kind === 'pick') {
|
|
153
|
-
this.setState({ status: 'loading' });
|
|
154
|
-
const carrierY = resolveCarrierCenterY(target);
|
|
155
|
-
if (carrierY !== null) {
|
|
156
|
-
this.setState({ carriageHeight: carrierY });
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
this.setState({ status: 'unloading' });
|
|
161
|
-
}
|
|
162
|
-
// In a full simulation: await carriage-motion tween here.
|
|
163
|
-
}
|
|
164
|
-
// ── Domain aliases ────────────────────────────────────────────────────────
|
|
165
|
-
/** Fetch a carrier from a rack cell (semantically = pick). */
|
|
166
|
-
fetch(carrier, options) {
|
|
167
|
-
return this.pick(carrier, options);
|
|
168
|
-
}
|
|
169
|
-
/** Deposit a carrier into a rack cell (semantically = place). */
|
|
170
|
-
deposit(carrier, cell, options) {
|
|
171
|
-
return this.place(carrier, cell, options);
|
|
172
|
-
}
|
|
173
|
-
// ── 2D rendering ─────────────────────────────────────────────────────────
|
|
174
|
-
/**
|
|
175
|
-
* 2D — top-down rectangle showing the crane's footprint along the aisle.
|
|
176
|
-
* The crane is much taller than wide, so the 2D mark is small.
|
|
177
|
-
*/
|
|
178
|
-
render(ctx) {
|
|
179
|
-
const { width, height, left, top } = this.state;
|
|
180
|
-
const fillColor = this.state.bodyColor || '#888';
|
|
181
|
-
ctx.save();
|
|
182
|
-
ctx.fillStyle = fillColor;
|
|
183
|
-
ctx.beginPath();
|
|
184
|
-
ctx.rect(left, top, width, height);
|
|
185
|
-
ctx.fill();
|
|
186
|
-
ctx.restore();
|
|
187
|
-
}
|
|
188
|
-
// ── 3D ───────────────────────────────────────────────────────────────────
|
|
189
|
-
buildRealObject() {
|
|
190
|
-
return new AsrsCrane3D(this);
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
AsrsCrane = __decorate([
|
|
194
|
-
sceneComponent('asrs-crane')
|
|
195
|
-
], AsrsCrane);
|
|
196
|
-
export default AsrsCrane;
|
|
197
|
-
function resolveCarrierDepth(c) {
|
|
198
|
-
const eff = c._realObject?.effectiveDepth;
|
|
199
|
-
if (typeof eff === 'number' && Number.isFinite(eff))
|
|
200
|
-
return eff;
|
|
201
|
-
return numOr(c?.state?.depth, 0);
|
|
202
|
-
}
|
|
203
|
-
function resolveCarrierCenterY(c) {
|
|
204
|
-
const pos = c.state;
|
|
205
|
-
if (!pos)
|
|
206
|
-
return null;
|
|
207
|
-
// zPos is the 3D Y center of a Placeable component in things-scene
|
|
208
|
-
const zPos = numOr(pos.zPos, NaN);
|
|
209
|
-
if (!Number.isNaN(zPos))
|
|
210
|
-
return zPos;
|
|
211
|
-
return null;
|
|
212
|
-
}
|
|
213
|
-
function numOr(v, dflt) {
|
|
214
|
-
return typeof v === 'number' && Number.isFinite(v) ? v : dflt;
|
|
215
|
-
}
|
|
216
|
-
//# sourceMappingURL=asrs-crane.js.map
|
package/dist/asrs-crane.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"asrs-crane.js","sourceRoot":"","sources":["../src/asrs-crane.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,OAAO,EAA8B,iBAAiB,EAAE,iBAAiB,EAAc,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAErI,OAAO,EACL,aAAa,EACb,UAAU,EACV,KAAK,EACL,SAAS,EAOV,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AA0BhD,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,SAAS;IACpB,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,MAAM;CAChB,CAAA;AAED,MAAM,oBAAoB,GAAG;IAC3B,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,SAAS;IACpB,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,SAAS;CACnB,CAAA;AAED,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;YACf,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE;gBACR,OAAO,EAAE;oBACP,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;oBAClC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;oBAC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AClD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAA;IAC/D,OAAO,KAAK,CAAE,CAAS,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA;AAC3C,CAAC;AAED,SAAS,qBAAqB,CAAC,CAAY;IACzC,MAAM,GAAG,GAAI,CAAS,CAAC,KAAK,CAAA;IAC5B,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAA;IACrB,mEAAmE;IACnE,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IACjC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IACpC,OAAO,IAAI,CAAA;AACb,CAAC;AAED,SAAS,KAAK,CAAC,CAAU,EAAE,IAAY;IACrC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AAC/D,CAAC","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport { Component, ComponentNature, ContainerAbstract, ContainerCapacity, RealObject, sceneComponent } from '@hatiolab/things-scene'\nimport type { SlotDef, State, Material3D } from '@hatiolab/things-scene'\nimport {\n CarrierHolder,\n Legendable,\n Mover,\n Placeable,\n type AttachFrame,\n type Alignment,\n type Heights,\n type LegendBinding,\n type MoveOptions,\n type PlacementArchetype\n} from '@operato/scene-base'\n\nimport { AsrsCrane3D } from './asrs-crane-3d.js'\n\n/**\n * AsrsCrane status — the operating state of a stacker crane in an AS/RS aisle.\n *\n * - `idle` — parked at home position\n * - `moving` — translating along the aisle (horizontal) or along the\n * mast (vertical); the two motions are typically combined\n * - `loading` — extracting a pallet from a rack cell\n * - `unloading` — placing a pallet into a rack cell\n * - `error` — fault / e-stop / collision warning\n */\nexport type AsrsCraneStatus = 'idle' | 'moving' | 'loading' | 'unloading' | 'error'\n\n/** AsrsCrane 컴포넌트 state */\nexport interface AsrsCraneState extends State {\n // ── 운영 상태 ──\n status?: AsrsCraneStatus\n\n // ── 액추에이터 ──\n carriageHeight?: number\n\n // ── 3D 재질 ──\n material3d?: Material3D\n}\n\nconst BODY_LEGEND = {\n idle: '#888',\n moving: '#aabbcc',\n loading: '#ffaa00',\n unloading: '#ffaa00',\n error: '#c66',\n default: '#888'\n}\n\nconst LAMP_EMISSIVE_LEGEND = {\n idle: '#222222',\n moving: '#44ff44',\n loading: '#ffaa00',\n unloading: '#ffaa00',\n error: '#ff3333',\n default: '#222222'\n}\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'select',\n label: 'status',\n name: 'status',\n property: {\n options: [\n { display: 'Idle', value: 'idle' },\n { display: 'Moving', value: 'moving' },\n { display: 'Loading', value: 'loading' },\n { display: 'Unloading', value: 'unloading' },\n { display: 'Error', value: 'error' }\n ]\n }\n },\n {\n type: 'number',\n label: 'carriage-height',\n name: 'carriageHeight',\n placeholder: 'mm — height of carriage on mast'\n }\n ],\n help: 'scene/component/asrs-crane'\n}\n\n// Mixin chain: Mover → CarrierHolder → ContainerCapacity → Legendable → Placeable → ContainerAbstract\n//\n// Mover: pick / place / pickAndPlace / moveTo / engage primitives\n// CarrierHolder: attachPointFor() — where the carrier sits on the crane (carriage fork)\n// ContainerCapacity: receive() / dispatch() / canReceive() / slots — slot tracking +\n// TRANSFER_SLOT_KEY bookkeeping during transit\n// Legendable: status → bodyColor / lampEmissive colour mapping\n// Placeable: floor-archetype 3D positioning\n// ContainerAbstract: child management — carrier becomes a child while in transit\n//\n// Note: ContainerAbstract replaces Shape. The 2D outline is drawn manually in\n// render() below (a simple top-down rectangle), matching the old Shape output\n// without the Shape base-class overhead.\n/**\n * AsrsCrane — the stacker / retrieval crane that runs in the aisle of an\n * AS/RS, moving cargo between the load port and the rack cells.\n *\n * Structure: a tall vertical mast that translates along a floor + ceiling\n * rail (the aisle), with a carriage that slides up/down the mast carrying a\n * shuttle / forks.\n *\n * **Monitoring mode**: crane status is driven by data binding\n * (`state.status`, `state.carriageHeight`). The carrier is referenced\n * via data binding — it is NOT a child of the crane in monitoring mode.\n *\n * **Simulation mode**: call `crane.pick(carrier)` / `crane.place(carrier, rackCell)`\n * (or `crane.pickAndPlace(carrier, rackCell)`). Mover handles navigation +\n * engage + reparent. During transit the carrier IS a child of the crane.\n */\n@sceneComponent('asrs-crane')\nexport default class AsrsCrane extends Mover(CarrierHolder(ContainerCapacity(Legendable(Placeable(ContainerAbstract))))) {\n declare state: AsrsCraneState\n declare _realObject?: AsrsCrane3D\n\n static legends: Record<string, LegendBinding> = {\n bodyColor: { from: 'status', legend: BODY_LEGEND },\n lampEmissive: { from: 'status', legend: LAMP_EMISSIVE_LEGEND }\n }\n\n static placement: PlacementArchetype = 'floor'\n static align: Alignment = 'bottom'\n static defaultDepth = (h: Heights) => h.ceiling - h.floor\n\n /** Yaw offset: crane model is drawn with the aisle axis along X (right = forward). */\n static yawOffset = 0\n\n /**\n * Phase H — ASRS crane 은 telescoping forks 로 rack cell 안의 carrier 픽업.\n * forklift-fork 와 동일 mechanism — pallet 의 fork pocket 진입.\n * (Mover mixin chain 이 :any 라 override 키워드 불가, getter 만 정의.)\n */\n get toolType(): string {\n return 'forklift-fork'\n }\n\n get nature() {\n return NATURE\n }\n\n get anchors() {\n return []\n }\n\n // ── ContainerCapacity ─────────────────────────────────────────────────────\n\n /** Stacker crane carries at most one load at a time on its forks. */\n get slots(): SlotDef[] {\n return [{ id: 'forks', maxCount: 1 }]\n }\n\n // ── CarrierHolder — attach frame (carriage fork position) ─────────────────\n\n /**\n * Return the 3D attach frame on the crane's carriage (fork tip).\n * Carriers are attached here while the crane is in transit (pick phase).\n *\n * The AsrsCrane3D exposes `getCarriageFrame()` — a sub-Object3D that\n * tracks the carriage height and sits at the fork TCP. If the 3D object\n * isn't built yet (e.g. before scene initialization), fall back to the\n * crane's own object3d centre.\n */\n attachPointFor(carrier: Component): AttachFrame | null {\n const ro = this._realObject\n const frame = ro?.getCarriageFrame?.()\n if (frame) {\n const carrierDepth = resolveCarrierDepth(carrier)\n return { attach: frame, localPosition: { x: 0, y: carrierDepth / 2, z: 0 } }\n }\n const root = this._realObject?.object3d\n if (!root) return null\n return { attach: root }\n }\n\n // ── Mover overrides ───────────────────────────────────────────────────────\n\n /**\n * Domain-specific actuation between arrival and reparent.\n *\n * Simulation sequence for PICK:\n * 1. Mover.pick() navigates crane to carrier position (moveTo).\n * 2. engage('pick') → snap carriage height + status 'loading'.\n * 3. Carrier is reparented to crane (becomes child).\n *\n * For now: set status and snap carriage height. A full ASRS simulation\n * would tween the carriageHeight here (animate AsrsCrane3D).\n *\n * Status lifecycle:\n * idle → (moveTo running) → engage fires → loading/unloading → (reparent) → idle\n * The 'moving' state is not set from Mover.moveTo() because TypeScript\n * can't call super.moveTo() on an `: any`-typed mixin. WCS data binding\n * sets 'moving' in monitoring mode; override pick()/place() to set it\n * in full simulation environments.\n */\n async engage(\n target: Component,\n kind: 'pick' | 'place',\n _options: MoveOptions = {}\n ): Promise<void> {\n if (kind === 'pick') {\n this.setState({ status: 'loading' as AsrsCraneStatus })\n const carrierY = resolveCarrierCenterY(target)\n if (carrierY !== null) {\n this.setState({ carriageHeight: carrierY })\n }\n } else {\n this.setState({ status: 'unloading' as AsrsCraneStatus })\n }\n // In a full simulation: await carriage-motion tween here.\n }\n\n // ── Domain aliases ────────────────────────────────────────────────────────\n\n /** Fetch a carrier from a rack cell (semantically = pick). */\n fetch(carrier: Component, options?: MoveOptions): Promise<void> {\n return this.pick(carrier, options)\n }\n\n /** Deposit a carrier into a rack cell (semantically = place). */\n deposit(carrier: Component, cell: Component, options?: MoveOptions): Promise<void> {\n return this.place(carrier, cell, options)\n }\n\n // ── 2D rendering ─────────────────────────────────────────────────────────\n\n /**\n * 2D — top-down rectangle showing the crane's footprint along the aisle.\n * The crane is much taller than wide, so the 2D mark is small.\n */\n render(ctx: CanvasRenderingContext2D) {\n const { width, height, left, top } = this.state\n const fillColor = (this.state.bodyColor as string) || '#888'\n ctx.save()\n ctx.fillStyle = fillColor\n ctx.beginPath()\n ctx.rect(left, top, width, height)\n ctx.fill()\n ctx.restore()\n }\n\n // ── 3D ───────────────────────────────────────────────────────────────────\n\n buildRealObject(): RealObject | undefined {\n return new AsrsCrane3D(this)\n }\n}\n\nfunction resolveCarrierDepth(c: Component): number {\n const eff = (c as any)._realObject?.effectiveDepth\n if (typeof eff === 'number' && Number.isFinite(eff)) return eff\n return numOr((c as any)?.state?.depth, 0)\n}\n\nfunction resolveCarrierCenterY(c: Component): number | null {\n const pos = (c as any).state\n if (!pos) return null\n // zPos is the 3D Y center of a Placeable component in things-scene\n const zPos = numOr(pos.zPos, NaN)\n if (!Number.isNaN(zPos)) return zPos\n return null\n}\n\nfunction numOr(v: unknown, dflt: number): number {\n return typeof v === 'number' && Number.isFinite(v) ? v : dflt\n}\n"]}
|
package/dist/asrs-rack-3d.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"asrs-rack-3d.js","sourceRoot":"","sources":["../src/asrs-rack-3d.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,mBAAmB,MAAM,iDAAiD,CAAA;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,MAAM,UAAU,GAAG,QAAQ,CAAA;AAC3B,MAAM,UAAU,GAAG,QAAQ,CAAA;AAC3B,MAAM,WAAW,GAAG,QAAQ,CAAA;AAE5B,MAAM,OAAO,UAAW,SAAQ,eAAe;IAC7C,KAAK;QACH,KAAK,CAAC,KAAK,EAAE,CAAA;QAEb,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,IAAI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;IAED,WAAW,KAAI,CAAC;CACjB","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n *\n * AsrsRack 3D — multi-level high-bay storage rack.\n *\n * LO-POLY but visually unambiguous as a rack. The signature parts:\n *\n * - 4 corner uprights (vertical posts running floor → top)\n * - intermediate uprights between bays (one between each adjacent bay pair)\n * - horizontal beams at each level on both front and back faces (defining\n * the cell decks)\n * - diagonal cross-bracing on the back face (the \"X\" pattern that says\n * this is a load-bearing storage rack, not just a generic frame)\n *\n * No floor / ceiling panels — the rack is open by design (cells are accessed\n * by the stacker crane from the front/aisle side).\n *\n * Cargo (pallets, boxes) added as children render at their own z position.\n * The rack itself is purely structural geometry.\n */\n\nimport * as THREE from 'three'\nimport * as BufferGeometryUtils from 'three/examples/jsm/utils/BufferGeometryUtils.js'\nimport { RealObjectGroup } from '@hatiolab/things-scene'\n\nconst POST_COLOR = 0x6a7080\nconst BEAM_COLOR = 0x556070\nconst BRACE_COLOR = 0x556070\n\nexport class AsrsRack3D extends RealObjectGroup {\n build() {\n super.build()\n\n const { width, height, depth = 3000 } = this.component.state\n const levels = Math.max(1, Math.floor((this.component.state.levels as number) || 4))\n const bays = Math.max(1, Math.floor((this.component.state.bays as number) || 5))\n\n const baseY = -depth / 2\n const postW = Math.min(width / bays, height) * 0.06\n const beamH = depth * 0.025\n const braceT = postW * 0.6\n\n const postMaterial = new THREE.MeshStandardMaterial({\n color: POST_COLOR,\n metalness: 0.7,\n roughness: 0.4\n })\n const beamMaterial = new THREE.MeshStandardMaterial({\n color: BEAM_COLOR,\n metalness: 0.7,\n roughness: 0.4\n })\n const braceMaterial = new THREE.MeshStandardMaterial({\n color: BRACE_COLOR,\n metalness: 0.7,\n roughness: 0.4\n })\n\n // ── Uprights (vertical posts at every bay boundary) ──────────────\n // bays + 1 vertical positions; for each, one front post + one back post.\n const postGeos: THREE.BufferGeometry[] = []\n for (let i = 0; i <= bays; i++) {\n const xFrac = i / bays - 0.5\n const x = xFrac * width\n // Front + back posts\n for (const zSign of [-1, 1]) {\n const post = new THREE.BoxGeometry(postW, depth, postW)\n post.translate(x, 0, zSign * (height / 2 - postW / 2))\n postGeos.push(post)\n }\n }\n const postMesh = new THREE.Mesh(BufferGeometryUtils.mergeGeometries(postGeos), postMaterial)\n postMesh.castShadow = true\n postMesh.receiveShadow = true\n this.object3d.add(postMesh)\n\n // ── Horizontal beams (front + back faces at each level) ──────────\n // levels + 1 vertical positions (level 0 = ground, level N = top).\n const beamGeos: THREE.BufferGeometry[] = []\n for (let lv = 0; lv <= levels; lv++) {\n const yFrac = lv / levels\n const y = baseY + yFrac * depth - beamH / 2 + (lv === 0 ? beamH : 0)\n\n for (const zSign of [-1, 1]) {\n const beam = new THREE.BoxGeometry(width, beamH, beamH)\n beam.translate(0, y, zSign * (height / 2 - beamH / 2))\n beamGeos.push(beam)\n }\n }\n const beamMesh = new THREE.Mesh(BufferGeometryUtils.mergeGeometries(beamGeos), beamMaterial)\n beamMesh.castShadow = true\n beamMesh.receiveShadow = true\n this.object3d.add(beamMesh)\n\n // ── Diagonal cross-bracing on the back face (the \"X\" pattern) ────\n // Two diagonals per level — \"/\" and \"\\\" — making an X across each\n // bay-tall cell. Visual signature of a load-bearing rack.\n const braceGeos: THREE.BufferGeometry[] = []\n const cellW = width / bays\n const cellH = depth / levels\n const braceLen = Math.sqrt(cellW * cellW + cellH * cellH)\n const braceAngle = Math.atan2(cellH, cellW)\n const backZ = height / 2 - postW * 0.6\n\n for (let bay = 0; bay < bays; bay++) {\n // Brace only every other bay to keep things visually open\n if (bay % 2 !== 0) continue\n\n const cellCenterX = (bay - bays / 2 + 0.5) * cellW\n\n for (let lv = 0; lv < levels; lv++) {\n const cellCenterY = baseY + (lv + 0.5) * cellH\n\n for (const sign of [-1, 1]) {\n const brace = new THREE.BoxGeometry(braceLen, braceT, braceT)\n brace.rotateZ(sign * braceAngle)\n brace.translate(cellCenterX, cellCenterY, backZ)\n braceGeos.push(brace)\n }\n }\n }\n if (braceGeos.length > 0) {\n const braceMesh = new THREE.Mesh(BufferGeometryUtils.mergeGeometries(braceGeos), braceMaterial)\n braceMesh.castShadow = true\n this.object3d.add(braceMesh)\n }\n }\n\n updateDimension() {}\n\n onchange(after: Record<string, unknown>, before: Record<string, unknown>) {\n if (\n 'levels' in after ||\n 'bays' in after ||\n 'width' in after ||\n 'height' in after ||\n 'depth' in after\n ) {\n this.update()\n return\n }\n super.onchange(after, before)\n }\n\n updateAlpha() {}\n}\n"]}
|
package/dist/asrs-rack.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"asrs-rack.js","sourceRoot":"","sources":["../src/asrs-rack.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAmB,iBAAiB,EAAc,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAElH,OAAO,EACL,aAAa,EACb,OAAO,EACP,aAAa,EACb,SAAS,EAKV,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAe9C,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;YACf,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,kCAAkC;SAChD;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,MAAM;YACb,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,kCAAkC;SAChD;KACF;IACD,IAAI,EAAE,2BAA2B;CAClC,CAAA;AAED,2FAA2F;AAC3F,mEAAmE;AACnE,uEAAuE;AACvE,EAAE;AACF,6EAA6E;AAC7E,2FAA2F;AAC3F,gFAAgF;AAChF,+CAA+C;AAC/C,kDAAkD;AAClD;;;;;;;;;;;;;;;;GAgBG;AAEY,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,aAAa,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B,cAAc,CAAC,WAAW,CAAC;GACP,QAAQ,CAmJ5B;eAnJoB,QAAQ","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport { Component, ComponentNature, ContainerAbstract, RealObject, sceneComponent } from '@hatiolab/things-scene'\nimport type { State, Material3D } from '@hatiolab/things-scene'\nimport {\n CellContainer,\n CellMap,\n CarrierHolder,\n Placeable,\n type AttachFrame,\n type Alignment,\n type Heights,\n type PlacementArchetype\n} from '@operato/scene-base'\n\nimport { AsrsRack3D } from './asrs-rack-3d.js'\n\n/** AsrsRack 컴포넌트 state */\nexport interface AsrsRackState extends State {\n // ── 토폴로지 ──\n bays?: number\n levels?: number\n\n // ── 디버그 ──\n debugCells?: boolean\n\n // ── 3D 재질 ──\n material3d?: Material3D\n}\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'number',\n label: 'levels',\n name: 'levels',\n placeholder: '# of vertical levels (default 4)'\n },\n {\n type: 'number',\n label: 'bays',\n name: 'bays',\n placeholder: '# of horizontal bays (default 5)'\n }\n ],\n help: 'scene/component/asrs-rack'\n}\n\n// `ContainerAbstract` (not `Container`) — Container = MixinHTMLElement(ContainerAbstract),\n// which forces `isHTMLElement(): true` and trips the 3D pipeline's\n// addObject DOM-skip gate. ASRS rack lives only in the 3D scene graph.\n//\n// Mixin chain: CellContainer → CarrierHolder → Placeable → ContainerAbstract\n// CellContainer: cell topology (cellMap, cell(), findAvailableCell(), occupiedCellIds())\n// CarrierHolder: 3D attach-point protocol (attachPointFor, containable gates)\n// Placeable: floor-archetype positioning\n// ContainerAbstract: child component management\n/**\n * AsrsRack — a multi-level high-bay storage rack, the structural backbone of\n * an AS/RS (Automated Storage / Retrieval System).\n *\n * `levels` × `bays` cells form a vertical grid. Each cell holds one logistics\n * package (Pallet / Box / Parcel). A pair of AsrsRacks separated by an aisle\n * (where an AsrsCrane runs) is the typical AS/RS configuration.\n *\n * **Monitoring mode** (default): pallets/boxes are direct children of the rack,\n * placed by the WCS data binding. No RackCell children are created.\n *\n * **Simulation mode**: call `rack._buildCells()` after placing the rack on the\n * scene. This creates RackCell children at the correct 3D positions. The\n * AsrsCrane then navigates to individual RackCells for pick-and-place.\n *\n * **Placement**: `floor` archetype, full ceiling depth by default.\n */\n@sceneComponent('asrs-rack')\nexport default class AsrsRack extends CellContainer(CarrierHolder(Placeable(ContainerAbstract))) {\n declare state: AsrsRackState\n\n static placement: PlacementArchetype = 'floor'\n static align: Alignment = 'bottom'\n static defaultDepth = (h: Heights) => h.ceiling - h.floor\n\n get nature() {\n return NATURE\n }\n\n get anchors() {\n return []\n }\n\n // ── CellContainer ─────────────────────────────────────────────────────────\n\n /**\n * Derive the cell topology from the rack's current dimensions and bay/level\n * counts. The CellMap is rebuilt fresh each time (state changes trigger\n * re-reads via things-scene's invalidation pipeline).\n *\n * Coordinate convention (matches things-scene 3D):\n * X = bay axis (left → right)\n * Y = level axis (floor → ceiling, the rack's `depth` state property)\n * Z = row axis (front → back, the rack's `height` state property)\n */\n get cellMap(): CellMap {\n const bays = Math.max(1, Math.floor((this.state.bays as number) || 5))\n const levels = Math.max(1, Math.floor((this.state.levels as number) || 4))\n const width = (this.state.width as number) || 1000\n const rackDepth = (this.state.depth as number) || 3000 // Y: floor→ceiling\n const rackHeight = (this.state.height as number) || 600 // Z: front→back\n\n return CellMap.grid({\n bays,\n rows: 1,\n levels,\n bayWidth: width / bays,\n rowDepth: rackHeight,\n levelHeight: rackDepth / levels\n })\n }\n\n /**\n * Create RackCell child components for each cell in the CellMap.\n *\n * Called explicitly to enter simulation mode — monitoring-mode racks\n * never call this (pallets are direct children, no explicit cells).\n *\n * Idempotent: removes existing rack-cell children first.\n */\n _buildCells(): void {\n // Remove existing rack-cell children\n const existing = (this.components as Component[] | undefined) ?? []\n for (const child of [...existing]) {\n if ((child as any).state?.type === 'rack-cell') {\n this.removeComponent(child)\n }\n }\n\n // Create a RackCell for each cell in the map\n const RackCellClass = (Component as any).register('rack-cell') as (new (...args: any[]) => Component) | undefined\n if (!RackCellClass) {\n console.warn('AsrsRack._buildCells: rack-cell type not registered. Import rack-cell.ts first.')\n return\n }\n\n const context = this._app\n for (const cell of this.cellMap.cells) {\n const model = {\n type: 'rack-cell',\n cellId: cell.id,\n width: cell.size.width,\n height: cell.size.depth, // 2D height = 3D Z depth\n depth: cell.size.height // 3D Y = level height\n }\n const rackCell = new RackCellClass(model, context)\n this.addComponent(rackCell)\n }\n }\n\n // ── Container gates ───────────────────────────────────────────────────────\n\n /**\n * Allow:\n * - Carriable components (pallets, boxes, parcels) — direct children in monitoring mode.\n * - RackCell — created by _buildCells() in simulation mode.\n *\n * Block:\n * - Everything else (sensors, labels, etc. can be siblings of the rack, not children).\n */\n containable(component: Component): boolean {\n if ((component as any).state?.type === 'rack-cell') return true\n const archetype = (component.constructor as any).placement\n if (archetype === 'operation') return true\n return component.isDescendible(this)\n }\n\n // ── CarrierHolder — attach frame for direct carrier children ─────────────\n\n /**\n * Attach frame for carriers that are DIRECT children of the rack\n * (monitoring mode, where pallets go directly into the rack without\n * explicit RackCell components).\n *\n * In simulation mode, carriers become children of their RackCell,\n * and each RackCell provides its own attachPointFor(). So this method\n * is only invoked on direct-child carriers in monitoring mode — it\n * returns the rack's own object3d as the attach frame (default behavior).\n */\n attachPointFor(_carrier: Component): AttachFrame | null {\n const root = this._realObject?.object3d\n if (!root) return null\n return { attach: root }\n }\n\n // ── 2D rendering ─────────────────────────────────────────────────────────\n\n /**\n * 2D — top-down rectangle showing the rack footprint, with subdivisions\n * suggesting the bay layout (lines parallel to the aisle).\n */\n render(ctx: CanvasRenderingContext2D) {\n const { width, height, left, top } = this.state\n const bays = Math.max(1, Math.floor((this.state.bays as number) || 5))\n\n ctx.beginPath()\n // Outer rectangle\n ctx.rect(left, top, width, height)\n // Bay subdivisions (vertical lines)\n for (let i = 1; i < bays; i++) {\n const x = left + (width * i) / bays\n ctx.moveTo(x, top)\n ctx.lineTo(x, top + height)\n }\n }\n\n get fillStyle() {\n return '#a0a0a8'\n }\n\n // ── 3D ───────────────────────────────────────────────────────────────────\n\n buildRealObject(): RealObject | undefined {\n return new AsrsRack3D(this)\n }\n}\n"]}
|