@wandelbots/wandelbots-js-react-components 4.7.1 → 4.7.2-pr.dev-RB-3348-v1-clean-up.560.cbf9c17
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/README.md +11 -32
- package/dist/3d-BOCs0RwR.cjs +2 -0
- package/dist/3d-BOCs0RwR.cjs.map +1 -0
- package/dist/3d-BTtdSlR9.js +1206 -0
- package/dist/3d-BTtdSlR9.js.map +1 -0
- package/dist/3d.cjs.js +1 -2
- package/dist/3d.esm.js +2 -0
- package/dist/auth0-spa-js.production.esm-8ppNz0la.js +5007 -0
- package/dist/auth0-spa-js.production.esm-8ppNz0la.js.map +1 -0
- package/dist/auth0-spa-js.production.esm-cNFf2AtX.cjs +5 -0
- package/dist/auth0-spa-js.production.esm-cNFf2AtX.cjs.map +1 -0
- package/dist/components/3d-viewport/CoordinateSystemTransform.d.ts +1 -1
- package/dist/components/3d-viewport/CoordinateSystemTransform.d.ts.map +1 -1
- package/dist/components/3d-viewport/SafetyZonesRenderer.d.ts +1 -2
- package/dist/components/3d-viewport/SafetyZonesRenderer.d.ts.map +1 -1
- package/dist/components/3d-viewport/TrajectoryRenderer.d.ts +2 -2
- package/dist/components/3d-viewport/TrajectoryRenderer.d.ts.map +1 -1
- package/dist/components/3d-viewport/collider/ColliderCollection.d.ts +1 -1
- package/dist/components/3d-viewport/collider/ColliderElement.d.ts +1 -1
- package/dist/components/3d-viewport/collider/CollisionSceneRenderer.d.ts +2 -2
- package/dist/components/3d-viewport/collider/colliderShapeToBufferGeometry.d.ts +1 -1
- package/dist/components/jogging/JoggingStore.d.ts +5 -11
- package/dist/components/jogging/JoggingStore.d.ts.map +1 -1
- package/dist/core-DtLSGTAb.js +18258 -0
- package/dist/core-DtLSGTAb.js.map +1 -0
- package/dist/core-DufB-Zu5.cjs +52 -0
- package/dist/core-DufB-Zu5.cjs.map +1 -0
- package/dist/core.cjs.js +1 -2
- package/dist/core.esm.js +3 -0
- package/dist/index.cjs.js +1 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +4 -0
- package/dist/interpolation-BmgrXVQ7.js +5859 -0
- package/dist/interpolation-BmgrXVQ7.js.map +1 -0
- package/dist/interpolation-Cz29Pgpr.cjs +8 -0
- package/dist/interpolation-Cz29Pgpr.cjs.map +1 -0
- package/dist/lib/ConnectedMotionGroup.d.ts +2 -3
- package/dist/lib/ConnectedMotionGroup.d.ts.map +1 -1
- package/dist/lib/MotionStreamConnection.d.ts +0 -1
- package/dist/lib/MotionStreamConnection.d.ts.map +1 -1
- package/dist/themes/createDarkTheme.d.ts.map +1 -1
- package/dist/themes/themeTypes.d.ts +0 -4
- package/dist/themes/themeTypes.d.ts.map +1 -1
- package/package.json +21 -24
- package/src/components/3d-viewport/CoordinateSystemTransform.tsx +29 -18
- package/src/components/3d-viewport/SafetyZonesRenderer.tsx +13 -96
- package/src/components/3d-viewport/TrajectoryRenderer.tsx +8 -8
- package/src/components/3d-viewport/collider/ColliderCollection.tsx +1 -1
- package/src/components/3d-viewport/collider/ColliderElement.tsx +1 -1
- package/src/components/3d-viewport/collider/CollisionSceneRenderer.tsx +2 -2
- package/src/components/3d-viewport/collider/colliderShapeToBufferGeometry.ts +1 -1
- package/src/components/jogging/JoggingStore.ts +5 -5
- package/src/components/utils/interpolation.test.ts +3 -3
- package/src/index.ts +0 -1
- package/src/lib/ConnectedMotionGroup.ts +0 -5
- package/src/lib/MotionStreamConnection.ts +0 -5
- package/src/themes/createDarkTheme.ts +1 -22
- package/src/themes/themeTypes.ts +0 -5
- package/dist/3d.cjs.js.map +0 -1
- package/dist/3d.es.js +0 -19
- package/dist/3d.es.js.map +0 -1
- package/dist/LoadingCover-B3UN1lnU.js +0 -81
- package/dist/LoadingCover-B3UN1lnU.js.map +0 -1
- package/dist/LoadingCover-DXcsXWDy.cjs +0 -2
- package/dist/LoadingCover-DXcsXWDy.cjs.map +0 -1
- package/dist/MotionGroupVisualizer-7Mw9PINy.js +0 -1366
- package/dist/MotionGroupVisualizer-7Mw9PINy.js.map +0 -1
- package/dist/MotionGroupVisualizer-C0ll-LQF.cjs +0 -2
- package/dist/MotionGroupVisualizer-C0ll-LQF.cjs.map +0 -1
- package/dist/WandelscriptEditor-6sAoniLC.cjs +0 -2
- package/dist/WandelscriptEditor-6sAoniLC.cjs.map +0 -1
- package/dist/WandelscriptEditor-kWC2VyG_.js +0 -140
- package/dist/WandelscriptEditor-kWC2VyG_.js.map +0 -1
- package/dist/auth0-spa-js.production.esm-DNao6_S5.js +0 -4064
- package/dist/auth0-spa-js.production.esm-DNao6_S5.js.map +0 -1
- package/dist/auth0-spa-js.production.esm-DaBMfOV8.cjs +0 -5
- package/dist/auth0-spa-js.production.esm-DaBMfOV8.cjs.map +0 -1
- package/dist/components/wandelscript-editor/WandelscriptEditor.d.ts +0 -16
- package/dist/components/wandelscript-editor/WandelscriptEditor.d.ts.map +0 -1
- package/dist/components/wandelscript-editor/wandelscript.tmLanguage.d.ts +0 -45
- package/dist/components/wandelscript-editor/wandelscript.tmLanguage.d.ts.map +0 -1
- package/dist/core.cjs.js.map +0 -1
- package/dist/core.es.js +0 -54
- package/dist/core.es.js.map +0 -1
- package/dist/externalizeComponent-B98tgTPP.cjs +0 -24
- package/dist/externalizeComponent-B98tgTPP.cjs.map +0 -1
- package/dist/externalizeComponent-BOqKMZMc.js +0 -526
- package/dist/externalizeComponent-BOqKMZMc.js.map +0 -1
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.es.js +0 -72
- package/dist/index.es.js.map +0 -1
- package/dist/interpolation-B8AcxfdD.js +0 -7167
- package/dist/interpolation-B8AcxfdD.js.map +0 -1
- package/dist/interpolation-SWzo5zr4.cjs +0 -20
- package/dist/interpolation-SWzo5zr4.cjs.map +0 -1
- package/dist/theming-BKpqgTRM.js +0 -22360
- package/dist/theming-BKpqgTRM.js.map +0 -1
- package/dist/theming-CatQaIl_.cjs +0 -115
- package/dist/theming-CatQaIl_.cjs.map +0 -1
- package/dist/wandelscript.cjs.js +0 -2
- package/dist/wandelscript.cjs.js.map +0 -1
- package/dist/wandelscript.d.ts +0 -2
- package/dist/wandelscript.d.ts.map +0 -1
- package/dist/wandelscript.es.js +0 -5
- package/dist/wandelscript.es.js.map +0 -1
- package/src/components/wandelscript-editor/WandelscriptEditor.tsx +0 -142
- package/src/components/wandelscript-editor/wandelscript.tmLanguage.ts +0 -62
- package/src/wandelscript.ts +0 -2
|
@@ -0,0 +1,1206 @@
|
|
|
1
|
+
import { _ as e, b as t, d as n, g as r, i, l as a, m as o, s, t as c, u as l, y as u } from "./interpolation-BmgrXVQ7.js";
|
|
2
|
+
import * as d from "three";
|
|
3
|
+
import { Matrix4 as f, Quaternion as p, Vector3 as m } from "three";
|
|
4
|
+
import { ConvexGeometry as h, RoundedBoxGeometry as g } from "three-stdlib";
|
|
5
|
+
import _, { Suspense as v, useCallback as y, useEffect as b, useMemo as x, useRef as S, useState as C } from "react";
|
|
6
|
+
import { Bounds as w, Environment as T, Lightformer as E, Line as D, useGLTF as O } from "@react-three/drei";
|
|
7
|
+
import { Canvas as ee, useFrame as k, useThree as A } from "@react-three/fiber";
|
|
8
|
+
import { Box as j, Button as M, Card as te, Divider as N, Typography as ne, useTheme as re } from "@mui/material";
|
|
9
|
+
import { observer as P } from "mobx-react-lite";
|
|
10
|
+
import { useTranslation as ie } from "react-i18next";
|
|
11
|
+
import { ErrorBoundary as F } from "react-error-boundary";
|
|
12
|
+
//#region src/components/3d-viewport/collider/colliderShapeToBufferGeometry.ts
|
|
13
|
+
function I(e) {
|
|
14
|
+
switch (e.shape_type) {
|
|
15
|
+
case "convex_hull": return new h(e.vertices.map((e) => new d.Vector3(e[0] / 1e3, e[1] / 1e3, e[2] / 1e3)));
|
|
16
|
+
case "box": return new d.BoxGeometry(e.size_x / 1e3, e.size_y / 1e3, e.size_z / 1e3);
|
|
17
|
+
case "sphere": return new d.SphereGeometry(e.radius / 1e3);
|
|
18
|
+
case "capsule": return new d.CapsuleGeometry(e.radius / 1e3, e.cylinder_height / 1e3);
|
|
19
|
+
case "cylinder": return new d.CylinderGeometry(e.radius / 1e3, e.radius / 1e3, e.height / 1e3);
|
|
20
|
+
case "rectangle": return new d.BoxGeometry(e.size_x / 1e3, e.size_y / 1e3, 0);
|
|
21
|
+
default: return console.warn(`${e.shape_type} is not supported`), new d.BufferGeometry();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/components/3d-viewport/collider/ColliderElement.tsx
|
|
26
|
+
var L = t();
|
|
27
|
+
function R({ name: e, collider: t, children: n }) {
|
|
28
|
+
let r = t.pose?.position ?? [
|
|
29
|
+
0,
|
|
30
|
+
0,
|
|
31
|
+
0
|
|
32
|
+
], i = t.pose?.orientation ?? [
|
|
33
|
+
0,
|
|
34
|
+
0,
|
|
35
|
+
0
|
|
36
|
+
];
|
|
37
|
+
return t.margin && console.warn(`${e} margin is not supported`), /* @__PURE__ */ (0, L.jsx)("mesh", {
|
|
38
|
+
name: e,
|
|
39
|
+
position: new d.Vector3(r[0], r[1], r[2]).divideScalar(1e3),
|
|
40
|
+
rotation: new d.Euler(i[0], i[1], i[2], "XYZ"),
|
|
41
|
+
geometry: I(t.shape),
|
|
42
|
+
children: n
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/components/3d-viewport/collider/ColliderCollection.tsx
|
|
47
|
+
function ae({ name: e, colliders: t, meshChildrenProvider: n, ...r }) {
|
|
48
|
+
return /* @__PURE__ */ (0, L.jsx)("group", {
|
|
49
|
+
name: e,
|
|
50
|
+
...r,
|
|
51
|
+
children: Object.entries(t).map(([e, t]) => /* @__PURE__ */ (0, L.jsx)(R, {
|
|
52
|
+
name: e,
|
|
53
|
+
collider: t,
|
|
54
|
+
children: n(e, t)
|
|
55
|
+
}, e))
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/components/3d-viewport/collider/CollisionSceneRenderer.tsx
|
|
60
|
+
function oe({ scene: e, meshChildrenProvider: t }) {
|
|
61
|
+
let n = e.colliders;
|
|
62
|
+
return /* @__PURE__ */ (0, L.jsx)("group", { children: n && /* @__PURE__ */ (0, L.jsx)(ae, {
|
|
63
|
+
meshChildrenProvider: t,
|
|
64
|
+
colliders: n
|
|
65
|
+
}) });
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/components/3d-viewport/PresetEnvironment.tsx
|
|
69
|
+
function z() {
|
|
70
|
+
return /* @__PURE__ */ (0, L.jsx)(T, { children: /* @__PURE__ */ (0, L.jsx)(se, {}) });
|
|
71
|
+
}
|
|
72
|
+
function se({ positions: e = [
|
|
73
|
+
2,
|
|
74
|
+
0,
|
|
75
|
+
2,
|
|
76
|
+
0,
|
|
77
|
+
2,
|
|
78
|
+
0,
|
|
79
|
+
2,
|
|
80
|
+
0
|
|
81
|
+
] }) {
|
|
82
|
+
return /* @__PURE__ */ (0, L.jsxs)(L.Fragment, { children: [
|
|
83
|
+
/* @__PURE__ */ (0, L.jsx)(E, {
|
|
84
|
+
intensity: 5,
|
|
85
|
+
"rotation-x": Math.PI / 2,
|
|
86
|
+
position: [
|
|
87
|
+
0,
|
|
88
|
+
5,
|
|
89
|
+
-9
|
|
90
|
+
],
|
|
91
|
+
scale: [
|
|
92
|
+
10,
|
|
93
|
+
10,
|
|
94
|
+
1
|
|
95
|
+
]
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ (0, L.jsx)("group", {
|
|
98
|
+
rotation: [
|
|
99
|
+
0,
|
|
100
|
+
.5,
|
|
101
|
+
0
|
|
102
|
+
],
|
|
103
|
+
children: /* @__PURE__ */ (0, L.jsx)("group", { children: e.map((e, t) => /* @__PURE__ */ (0, L.jsx)(E, {
|
|
104
|
+
form: "circle",
|
|
105
|
+
intensity: 5,
|
|
106
|
+
rotation: [
|
|
107
|
+
Math.PI / 2,
|
|
108
|
+
0,
|
|
109
|
+
0
|
|
110
|
+
],
|
|
111
|
+
position: [
|
|
112
|
+
e,
|
|
113
|
+
4,
|
|
114
|
+
t * 4
|
|
115
|
+
],
|
|
116
|
+
scale: [
|
|
117
|
+
3,
|
|
118
|
+
1,
|
|
119
|
+
1
|
|
120
|
+
]
|
|
121
|
+
}, t)) })
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ (0, L.jsx)(E, {
|
|
124
|
+
intensity: 40,
|
|
125
|
+
"rotation-y": Math.PI / 2,
|
|
126
|
+
position: [
|
|
127
|
+
-5,
|
|
128
|
+
1,
|
|
129
|
+
-1
|
|
130
|
+
],
|
|
131
|
+
scale: [
|
|
132
|
+
20,
|
|
133
|
+
.1,
|
|
134
|
+
1
|
|
135
|
+
]
|
|
136
|
+
}),
|
|
137
|
+
/* @__PURE__ */ (0, L.jsx)(E, {
|
|
138
|
+
intensity: 20,
|
|
139
|
+
"rotation-y": -Math.PI,
|
|
140
|
+
position: [
|
|
141
|
+
-5,
|
|
142
|
+
-2,
|
|
143
|
+
-1
|
|
144
|
+
],
|
|
145
|
+
scale: [
|
|
146
|
+
20,
|
|
147
|
+
.1,
|
|
148
|
+
1
|
|
149
|
+
]
|
|
150
|
+
}),
|
|
151
|
+
/* @__PURE__ */ (0, L.jsx)(E, {
|
|
152
|
+
"rotation-y": Math.PI / 2,
|
|
153
|
+
position: [
|
|
154
|
+
-5,
|
|
155
|
+
-1,
|
|
156
|
+
-1
|
|
157
|
+
],
|
|
158
|
+
scale: [
|
|
159
|
+
20,
|
|
160
|
+
.5,
|
|
161
|
+
1
|
|
162
|
+
],
|
|
163
|
+
intensity: 5
|
|
164
|
+
}),
|
|
165
|
+
/* @__PURE__ */ (0, L.jsx)(E, {
|
|
166
|
+
"rotation-y": -Math.PI / 2,
|
|
167
|
+
position: [
|
|
168
|
+
10,
|
|
169
|
+
1,
|
|
170
|
+
0
|
|
171
|
+
],
|
|
172
|
+
scale: [
|
|
173
|
+
20,
|
|
174
|
+
1,
|
|
175
|
+
1
|
|
176
|
+
],
|
|
177
|
+
intensity: 10
|
|
178
|
+
}),
|
|
179
|
+
/* @__PURE__ */ (0, L.jsx)(E, {
|
|
180
|
+
form: "ring",
|
|
181
|
+
color: "white",
|
|
182
|
+
intensity: 5,
|
|
183
|
+
scale: 10,
|
|
184
|
+
position: [
|
|
185
|
+
-15,
|
|
186
|
+
4,
|
|
187
|
+
-18
|
|
188
|
+
],
|
|
189
|
+
target: [
|
|
190
|
+
0,
|
|
191
|
+
0,
|
|
192
|
+
0
|
|
193
|
+
]
|
|
194
|
+
})
|
|
195
|
+
] });
|
|
196
|
+
}
|
|
197
|
+
//#endregion
|
|
198
|
+
//#region src/components/3d-viewport/SafetyZonesRenderer.tsx
|
|
199
|
+
function ce({ safetyZones: t, dhParameters: n, ...i }) {
|
|
200
|
+
let a = {
|
|
201
|
+
attach: "material",
|
|
202
|
+
color: "#009f4d",
|
|
203
|
+
opacity: .2,
|
|
204
|
+
depthTest: !1,
|
|
205
|
+
depthWrite: !1,
|
|
206
|
+
transparent: !0,
|
|
207
|
+
polygonOffset: !0
|
|
208
|
+
}, o = r(n ?? []), s = (t, n) => {
|
|
209
|
+
if (!n?.pose?.position || !n?.pose?.orientation) return null;
|
|
210
|
+
let r = new d.Vector3(n.pose.position[0] / 1e3, n.pose.position[1] / 1e3, n.pose.position[2] / 1e3), i = new d.Vector3(n.pose.orientation[0], n.pose.orientation[1], n.pose.orientation[2]), s, c = n.shape.shape_type === "plane" ? {
|
|
211
|
+
...a,
|
|
212
|
+
side: d.DoubleSide
|
|
213
|
+
} : {
|
|
214
|
+
...a,
|
|
215
|
+
side: d.FrontSide
|
|
216
|
+
};
|
|
217
|
+
switch (n.shape.shape_type) {
|
|
218
|
+
case "plane":
|
|
219
|
+
s = /* @__PURE__ */ (0, L.jsx)("planeGeometry", { args: [o, o] });
|
|
220
|
+
break;
|
|
221
|
+
case "sphere":
|
|
222
|
+
s = /* @__PURE__ */ (0, L.jsx)("sphereGeometry", { args: [(n?.shape).radius / 1e3] });
|
|
223
|
+
break;
|
|
224
|
+
case "capsule":
|
|
225
|
+
s = /* @__PURE__ */ (0, L.jsx)("capsuleGeometry", { args: [(n?.shape).radius / 1e3, (n?.shape).cylinder_height / 1e3] });
|
|
226
|
+
break;
|
|
227
|
+
case "convex_hull": {
|
|
228
|
+
let e = (n?.shape).vertices.map((e) => new d.Vector3(e[0] / 1e3, e[1] / 1e3, e[2] / 1e3)), t = u(e);
|
|
229
|
+
if (t.isCoplanar && t.normal) {
|
|
230
|
+
let n = new d.Vector3().addVectors(e[0], t.normal.multiplyScalar(1e-4));
|
|
231
|
+
e.push(n);
|
|
232
|
+
}
|
|
233
|
+
try {
|
|
234
|
+
s = /* @__PURE__ */ (0, L.jsx)("primitive", {
|
|
235
|
+
object: new h(e),
|
|
236
|
+
attach: "geometry"
|
|
237
|
+
});
|
|
238
|
+
} catch (e) {
|
|
239
|
+
return console.log("Error creating ConvexGeometry:", e), null;
|
|
240
|
+
}
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
case "rectangular_capsule": {
|
|
244
|
+
let e = n.shape, t = e.radius / 1e3;
|
|
245
|
+
s = /* @__PURE__ */ (0, L.jsx)("primitive", {
|
|
246
|
+
object: new g(e.sphere_center_distance_x / 1e3, e.sphere_center_distance_y / 1e3, t * 2, 2, t),
|
|
247
|
+
attach: "geometry"
|
|
248
|
+
});
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
default: console.warn("Unsupported safety zone shape type:", n.shape.shape_type), s = null;
|
|
252
|
+
}
|
|
253
|
+
return /* @__PURE__ */ (0, L.jsxs)("mesh", {
|
|
254
|
+
renderOrder: t,
|
|
255
|
+
position: r,
|
|
256
|
+
quaternion: e(i),
|
|
257
|
+
children: [s, /* @__PURE__ */ (0, L.jsx)("meshStandardMaterial", {
|
|
258
|
+
...c,
|
|
259
|
+
polygonOffsetFactor: -t
|
|
260
|
+
})]
|
|
261
|
+
}, `safety-zone-${n.shape.shape_type}-${t}`);
|
|
262
|
+
}, c = x(() => Object.values(t ?? {}).map((e, t) => s(t, e)), [t, o]);
|
|
263
|
+
return /* @__PURE__ */ (0, L.jsx)("group", {
|
|
264
|
+
...i,
|
|
265
|
+
children: c
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
//#endregion
|
|
269
|
+
//#region src/components/3d-viewport/TrajectoryRenderer.tsx
|
|
270
|
+
function le({ trajectory: e, ...t }) {
|
|
271
|
+
let n = e?.map((e) => e.position?.length ? new d.Vector3(e.position[0] / 1e3, e.position[2] / 1e3, -e.position[1] / 1e3) : null).filter((e) => e !== null) || [];
|
|
272
|
+
return /* @__PURE__ */ (0, L.jsx)("group", {
|
|
273
|
+
...t,
|
|
274
|
+
children: n.length > 0 && /* @__PURE__ */ (0, L.jsx)(D, {
|
|
275
|
+
points: n,
|
|
276
|
+
lineWidth: 3,
|
|
277
|
+
polygonOffset: !0,
|
|
278
|
+
polygonOffsetFactor: 10,
|
|
279
|
+
polygonOffsetUnits: 10
|
|
280
|
+
})
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
//#endregion
|
|
284
|
+
//#region src/components/robots/robotModelLogic.ts
|
|
285
|
+
var B = /* @__PURE__ */ new Map();
|
|
286
|
+
async function V(e, t) {
|
|
287
|
+
if (B.has(e)) return B.get(e);
|
|
288
|
+
let n = (async () => {
|
|
289
|
+
let n = new s({ instanceUrl: t || "" }), r = n.api.motionGroupModels;
|
|
290
|
+
r.axios?.interceptors && r.axios.interceptors.request.use((e) => (e.url?.includes("/glb") && (e.responseType = "blob"), e));
|
|
291
|
+
try {
|
|
292
|
+
let t = await n.api.motionGroupModels.getMotionGroupGlbModel(e);
|
|
293
|
+
return URL.createObjectURL(t);
|
|
294
|
+
} catch (e) {
|
|
295
|
+
throw console.error("Failed to fetch model:", e), e;
|
|
296
|
+
}
|
|
297
|
+
})();
|
|
298
|
+
return B.set(e, n), n;
|
|
299
|
+
}
|
|
300
|
+
function H(e) {
|
|
301
|
+
function t(e) {
|
|
302
|
+
return e.children.length === 0 ? [e] : [e, ...e.children.flatMap((e) => t(e))];
|
|
303
|
+
}
|
|
304
|
+
return t(e).filter((e) => W(e));
|
|
305
|
+
}
|
|
306
|
+
function U(e) {
|
|
307
|
+
return e.name.endsWith("_FLG");
|
|
308
|
+
}
|
|
309
|
+
function W(e) {
|
|
310
|
+
return /_J[0-9]+$/.test(e.name);
|
|
311
|
+
}
|
|
312
|
+
function ue(e, t) {
|
|
313
|
+
let n, r = [];
|
|
314
|
+
function i(e) {
|
|
315
|
+
if (U(e)) {
|
|
316
|
+
if (n) throw Error(`Found multiple flange groups in robot model ${t}; first ${n.name} then ${e.name}. Only one _FLG group is allowed.`);
|
|
317
|
+
n = e;
|
|
318
|
+
}
|
|
319
|
+
W(e) && r.push(e), e.children.map(i);
|
|
320
|
+
}
|
|
321
|
+
if (i(e.scene), !n) throw Error(`No flange group found in robot model ${t}. Flange must be identified with a name ending in _FLG.`);
|
|
322
|
+
return { gltf: e };
|
|
323
|
+
}
|
|
324
|
+
//#endregion
|
|
325
|
+
//#region src/components/robots/RobotAnimator.tsx
|
|
326
|
+
function G({ rapidlyChangingMotionState: e, dhParameters: t, onRotationChanged: n, children: r }) {
|
|
327
|
+
let a = S([]), o = S([]), s = S(null), { invalidate: l } = A();
|
|
328
|
+
b(() => (s.current = new c(e.joint_position.filter((e) => e !== void 0), {
|
|
329
|
+
tension: 120,
|
|
330
|
+
friction: 20,
|
|
331
|
+
threshold: .001
|
|
332
|
+
}), () => {
|
|
333
|
+
s.current?.destroy();
|
|
334
|
+
}), []), k((e, t) => {
|
|
335
|
+
if (s.current) {
|
|
336
|
+
let e = s.current.update(t);
|
|
337
|
+
d(), e || l();
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
function u(e) {
|
|
341
|
+
e && (o.current = H(e), d(), l());
|
|
342
|
+
}
|
|
343
|
+
function d() {
|
|
344
|
+
let e = s.current?.getCurrentValues() || [];
|
|
345
|
+
if (n) n(o.current, e);
|
|
346
|
+
else for (let [n, r] of o.current.entries()) {
|
|
347
|
+
let i = t[n], a = i.theta || 0, o = i.reverse_rotation_direction ? -1 : 1;
|
|
348
|
+
r.rotation.y = o * (e[n] || 0) + a;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
let f = y(() => {
|
|
352
|
+
let t = e.joint_position.filter((e) => e !== void 0);
|
|
353
|
+
requestAnimationFrame(() => {
|
|
354
|
+
a.current = t, s.current?.setTarget(t);
|
|
355
|
+
});
|
|
356
|
+
}, [e]);
|
|
357
|
+
return b(() => {
|
|
358
|
+
f();
|
|
359
|
+
}, [e, f]), i(() => {
|
|
360
|
+
f();
|
|
361
|
+
}), /* @__PURE__ */ (0, L.jsx)("group", {
|
|
362
|
+
ref: u,
|
|
363
|
+
children: r
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
//#endregion
|
|
367
|
+
//#region src/components/robots/DHRobot.tsx
|
|
368
|
+
var de = "line", fe = "mesh";
|
|
369
|
+
function pe({ rapidlyChangingMotionState: e, dhParameters: t, ...n }) {
|
|
370
|
+
let r = new f(), i = S([]), a = S([]);
|
|
371
|
+
_.useEffect(() => {
|
|
372
|
+
i.current = Array(t.length).fill(null), a.current = Array(t.length).fill(null);
|
|
373
|
+
}, [t.length]);
|
|
374
|
+
function o(e, t) {
|
|
375
|
+
let n = new m(), i = new p(), a = new m();
|
|
376
|
+
r.decompose(n, i, a);
|
|
377
|
+
let o = n.clone(), s = new f().makeRotationY(e.theta + t * (e.reverse_rotation_direction ? -1 : 1)).multiply(new f().makeTranslation(0, e.d / 1e3, 0)).multiply(new f().makeTranslation(e.a / 1e3, 0, 0)).multiply(new f().makeRotationX(e.alpha));
|
|
378
|
+
return r.multiply(s), r.decompose(n, i, a), {
|
|
379
|
+
a: o,
|
|
380
|
+
b: n
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
function s(e, n, r, i) {
|
|
384
|
+
if (!t) return;
|
|
385
|
+
let a = t[e];
|
|
386
|
+
if (!a) return;
|
|
387
|
+
let { a: s, b: c } = o(a, i);
|
|
388
|
+
n.geometry.setPositions([s.toArray(), c.toArray()].flat()), r.position.set(c.x, c.y, c.z);
|
|
389
|
+
}
|
|
390
|
+
function c(e, t) {
|
|
391
|
+
r.identity();
|
|
392
|
+
for (let n = 0; n < Math.min(e.length, t.length); n++) {
|
|
393
|
+
let e = i.current[n], r = a.current[n];
|
|
394
|
+
e && r && s(n, e, r, t[n]);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
return /* @__PURE__ */ (0, L.jsx)(L.Fragment, { children: /* @__PURE__ */ (0, L.jsx)(G, {
|
|
398
|
+
rapidlyChangingMotionState: e,
|
|
399
|
+
dhParameters: t,
|
|
400
|
+
onRotationChanged: c,
|
|
401
|
+
children: /* @__PURE__ */ (0, L.jsxs)("group", {
|
|
402
|
+
...n,
|
|
403
|
+
name: "Scene",
|
|
404
|
+
children: [/* @__PURE__ */ (0, L.jsxs)("mesh", { children: [/* @__PURE__ */ (0, L.jsx)("sphereGeometry", { args: [
|
|
405
|
+
.01,
|
|
406
|
+
32,
|
|
407
|
+
32
|
|
408
|
+
] }), /* @__PURE__ */ (0, L.jsx)("meshStandardMaterial", {
|
|
409
|
+
color: "black",
|
|
410
|
+
depthTest: !0
|
|
411
|
+
})] }), t.map((t, n) => {
|
|
412
|
+
let { a: r, b: s } = o(t, e.joint_position[n] ?? 0), c = `dhrobot_J0${n}`;
|
|
413
|
+
return /* @__PURE__ */ (0, L.jsxs)("group", {
|
|
414
|
+
name: c,
|
|
415
|
+
children: [/* @__PURE__ */ (0, L.jsx)(D, {
|
|
416
|
+
ref: (e) => {
|
|
417
|
+
i.current[n] = e;
|
|
418
|
+
},
|
|
419
|
+
name: de,
|
|
420
|
+
points: [r, s],
|
|
421
|
+
color: "white",
|
|
422
|
+
lineWidth: 5
|
|
423
|
+
}), /* @__PURE__ */ (0, L.jsxs)("mesh", {
|
|
424
|
+
ref: (e) => {
|
|
425
|
+
a.current[n] = e;
|
|
426
|
+
},
|
|
427
|
+
name: fe,
|
|
428
|
+
position: s,
|
|
429
|
+
children: [/* @__PURE__ */ (0, L.jsx)("sphereGeometry", { args: [
|
|
430
|
+
.01,
|
|
431
|
+
32,
|
|
432
|
+
32
|
|
433
|
+
] }), /* @__PURE__ */ (0, L.jsx)("meshStandardMaterial", {
|
|
434
|
+
color: "black",
|
|
435
|
+
depthTest: !0
|
|
436
|
+
})]
|
|
437
|
+
}, "mesh_" + n)]
|
|
438
|
+
}, c);
|
|
439
|
+
})]
|
|
440
|
+
})
|
|
441
|
+
}) });
|
|
442
|
+
}
|
|
443
|
+
//#endregion
|
|
444
|
+
//#region src/components/ConsoleFilter.tsx
|
|
445
|
+
var me = console.warn;
|
|
446
|
+
function K() {
|
|
447
|
+
return b(() => {
|
|
448
|
+
console.warn = (e) => {
|
|
449
|
+
e !== "Cannot call the manual advancement of rafz whilst frameLoop is not set as demand" && me(e);
|
|
450
|
+
};
|
|
451
|
+
}, []), /* @__PURE__ */ (0, L.jsx)(L.Fragment, {});
|
|
452
|
+
}
|
|
453
|
+
//#endregion
|
|
454
|
+
//#region src/components/robots/GenericRobot.tsx
|
|
455
|
+
function he(e) {
|
|
456
|
+
return e.type === "Mesh";
|
|
457
|
+
}
|
|
458
|
+
function ge({ url: e, flangeRef: t, postModelRender: n, ...r }) {
|
|
459
|
+
let i = O(e), a;
|
|
460
|
+
try {
|
|
461
|
+
a = ue(i, "robot.glb").gltf;
|
|
462
|
+
} catch (e) {
|
|
463
|
+
throw e;
|
|
464
|
+
}
|
|
465
|
+
let o = y((e) => {
|
|
466
|
+
e && n && n();
|
|
467
|
+
}, [n]);
|
|
468
|
+
function s(e) {
|
|
469
|
+
try {
|
|
470
|
+
return he(e) ? e.geometry ? /* @__PURE__ */ (0, L.jsx)("mesh", {
|
|
471
|
+
name: e.name,
|
|
472
|
+
geometry: e.geometry,
|
|
473
|
+
material: e.material,
|
|
474
|
+
position: e.position,
|
|
475
|
+
rotation: e.rotation
|
|
476
|
+
}, e.uuid) : /* @__PURE__ */ (0, L.jsx)("group", {
|
|
477
|
+
name: e.name,
|
|
478
|
+
position: e.position,
|
|
479
|
+
rotation: e.rotation
|
|
480
|
+
}, e.uuid) : /* @__PURE__ */ (0, L.jsx)("group", {
|
|
481
|
+
name: e.name,
|
|
482
|
+
position: e.position,
|
|
483
|
+
rotation: e.rotation,
|
|
484
|
+
ref: U(e) ? t : void 0,
|
|
485
|
+
children: e.children.map(s)
|
|
486
|
+
}, e.uuid);
|
|
487
|
+
} catch (t) {
|
|
488
|
+
return console.warn("Error rendering node", e.name, t), null;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
return /* @__PURE__ */ (0, L.jsx)("group", {
|
|
492
|
+
...r,
|
|
493
|
+
dispose: null,
|
|
494
|
+
ref: o,
|
|
495
|
+
children: s(a.scene)
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
function q({ modelURL: e, flangeRef: t, postModelRender: n, ...r }) {
|
|
499
|
+
let [i, a] = C(null);
|
|
500
|
+
return b(() => {
|
|
501
|
+
(async () => {
|
|
502
|
+
try {
|
|
503
|
+
a(typeof e == "string" ? e : await e);
|
|
504
|
+
} catch (e) {
|
|
505
|
+
console.error("Failed to resolve model URL:", e);
|
|
506
|
+
}
|
|
507
|
+
})();
|
|
508
|
+
}, [e]), i ? /* @__PURE__ */ (0, L.jsx)(ge, {
|
|
509
|
+
url: i,
|
|
510
|
+
flangeRef: t,
|
|
511
|
+
postModelRender: n,
|
|
512
|
+
...r
|
|
513
|
+
}) : null;
|
|
514
|
+
}
|
|
515
|
+
//#endregion
|
|
516
|
+
//#region src/components/robots/ghostStyle.ts
|
|
517
|
+
var J = (e, t) => {
|
|
518
|
+
e.userData.isGhost || (e.traverse((e) => {
|
|
519
|
+
if (e instanceof d.Mesh) {
|
|
520
|
+
e.material instanceof d.Material && (e.material.colorWrite = !1);
|
|
521
|
+
let n = e.clone(), r = e.clone();
|
|
522
|
+
n.material = new d.MeshStandardMaterial({
|
|
523
|
+
depthTest: !0,
|
|
524
|
+
depthWrite: !0,
|
|
525
|
+
colorWrite: !1,
|
|
526
|
+
polygonOffset: !0,
|
|
527
|
+
polygonOffsetFactor: -1,
|
|
528
|
+
side: d.DoubleSide
|
|
529
|
+
}), n.userData.isGhost = !0, r.material = new d.MeshStandardMaterial({
|
|
530
|
+
color: t,
|
|
531
|
+
opacity: .3,
|
|
532
|
+
depthTest: !0,
|
|
533
|
+
depthWrite: !1,
|
|
534
|
+
transparent: !0,
|
|
535
|
+
polygonOffset: !0,
|
|
536
|
+
polygonOffsetFactor: -2,
|
|
537
|
+
side: d.DoubleSide
|
|
538
|
+
}), r.userData.isGhost = !0, e.parent && (e.parent.add(n), e.parent.add(r));
|
|
539
|
+
}
|
|
540
|
+
}), e.userData.isGhost = !0);
|
|
541
|
+
}, Y = (e) => {
|
|
542
|
+
if (!e.userData.isGhost) return;
|
|
543
|
+
let t = [];
|
|
544
|
+
e.traverse((e) => {
|
|
545
|
+
e instanceof d.Mesh && (e.userData?.isGhost ? t.push(e) : e.material instanceof d.Material && (e.material.colorWrite = !0));
|
|
546
|
+
}), t.forEach((e) => {
|
|
547
|
+
e.parent && e.parent.remove(e);
|
|
548
|
+
}), e.userData.isGhost = !1;
|
|
549
|
+
}, X = o(({ rapidlyChangingMotionState: e, modelFromController: t, dhParameters: n, getModel: r = V, flangeRef: i, postModelRender: a, transparentColor: o, instanceUrl: s, ...c }) => {
|
|
550
|
+
let [l, u] = C(null), d = y((e) => {
|
|
551
|
+
u(e);
|
|
552
|
+
}, []);
|
|
553
|
+
b(() => {
|
|
554
|
+
l && (o ? J(l, o) : Y(l));
|
|
555
|
+
}, [l, o]);
|
|
556
|
+
let f = /* @__PURE__ */ (0, L.jsx)(pe, {
|
|
557
|
+
rapidlyChangingMotionState: e,
|
|
558
|
+
dhParameters: n,
|
|
559
|
+
...c
|
|
560
|
+
});
|
|
561
|
+
return /* @__PURE__ */ (0, L.jsxs)(F, {
|
|
562
|
+
fallback: f,
|
|
563
|
+
onError: (e) => {
|
|
564
|
+
console.warn(e);
|
|
565
|
+
},
|
|
566
|
+
children: [/* @__PURE__ */ (0, L.jsx)(v, {
|
|
567
|
+
fallback: f,
|
|
568
|
+
children: /* @__PURE__ */ (0, L.jsx)("group", {
|
|
569
|
+
ref: d,
|
|
570
|
+
children: /* @__PURE__ */ (0, L.jsx)(G, {
|
|
571
|
+
rapidlyChangingMotionState: e,
|
|
572
|
+
dhParameters: n,
|
|
573
|
+
children: /* @__PURE__ */ (0, L.jsx)(q, {
|
|
574
|
+
modelURL: (() => {
|
|
575
|
+
let e = r(t, s);
|
|
576
|
+
if (!e) {
|
|
577
|
+
let e = new Blob([], { type: "model/gltf-binary" }), n = new File([e], `${t}.glb`, { type: "model/gltf-binary" });
|
|
578
|
+
return Promise.resolve(URL.createObjectURL(n));
|
|
579
|
+
}
|
|
580
|
+
return e;
|
|
581
|
+
})(),
|
|
582
|
+
postModelRender: a,
|
|
583
|
+
flangeRef: i,
|
|
584
|
+
...c
|
|
585
|
+
})
|
|
586
|
+
})
|
|
587
|
+
})
|
|
588
|
+
}), /* @__PURE__ */ (0, L.jsx)(K, {})]
|
|
589
|
+
});
|
|
590
|
+
});
|
|
591
|
+
//#endregion
|
|
592
|
+
//#region src/components/robots/Robot.tsx
|
|
593
|
+
function _e({ connectedMotionGroup: e, getModel: t = V, flangeRef: n, transparentColor: r, postModelRender: i, ...a }) {
|
|
594
|
+
return e.dhParameters ? /* @__PURE__ */ (0, L.jsx)(X, {
|
|
595
|
+
rapidlyChangingMotionState: e.rapidlyChangingMotionState,
|
|
596
|
+
modelFromController: e.modelFromController || "",
|
|
597
|
+
dhParameters: e.dhParameters,
|
|
598
|
+
getModel: t,
|
|
599
|
+
flangeRef: n,
|
|
600
|
+
transparentColor: r,
|
|
601
|
+
postModelRender: i,
|
|
602
|
+
...a
|
|
603
|
+
}) : null;
|
|
604
|
+
}
|
|
605
|
+
//#endregion
|
|
606
|
+
//#region src/components/RobotCard.tsx
|
|
607
|
+
var ve = o(P(({ robotName: e, programState: t, safetyState: r, operationMode: i, driveToHomeEnabled: a = !1, onDriveToHomePress: o, onDriveToHomeRelease: s, connectedMotionGroup: c, robotComponent: l = _e, customContentComponent: u, className: d }) => {
|
|
608
|
+
let f = re(), { t: p } = ie(), [m, h] = C(!1), g = S(null), _ = S(null), [v, x] = C(!1), [T, E] = C({
|
|
609
|
+
width: 400,
|
|
610
|
+
height: 600
|
|
611
|
+
}), [D, O] = C(0);
|
|
612
|
+
b(() => {
|
|
613
|
+
let e = () => {
|
|
614
|
+
if (_.current) {
|
|
615
|
+
let { offsetWidth: e, offsetHeight: t } = _.current;
|
|
616
|
+
x(e > t), E({
|
|
617
|
+
width: e,
|
|
618
|
+
height: t
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
e();
|
|
623
|
+
let t = new ResizeObserver(e);
|
|
624
|
+
return _.current && t.observe(_.current), () => {
|
|
625
|
+
t.disconnect();
|
|
626
|
+
};
|
|
627
|
+
}, []);
|
|
628
|
+
let k = y(() => {
|
|
629
|
+
O((e) => e + 1);
|
|
630
|
+
}, []), A = y(() => {
|
|
631
|
+
!a || !o || (h(!0), o());
|
|
632
|
+
}, [a, o]), P = y(() => {
|
|
633
|
+
!a || !s || (h(!1), s());
|
|
634
|
+
}, [a, s]), F = y(() => {
|
|
635
|
+
m && s && (h(!1), s());
|
|
636
|
+
}, [m, s]), I = v ? T.width < 350 : T.height < 200, R = v ? T.height < 310 : T.height < 450;
|
|
637
|
+
return /* @__PURE__ */ (0, L.jsx)(te, {
|
|
638
|
+
ref: _,
|
|
639
|
+
className: d,
|
|
640
|
+
sx: {
|
|
641
|
+
width: "100%",
|
|
642
|
+
height: "100%",
|
|
643
|
+
display: "flex",
|
|
644
|
+
flexDirection: v ? "row" : "column",
|
|
645
|
+
position: "relative",
|
|
646
|
+
overflow: "hidden",
|
|
647
|
+
minWidth: {
|
|
648
|
+
xs: 180,
|
|
649
|
+
sm: 220,
|
|
650
|
+
md: 250
|
|
651
|
+
},
|
|
652
|
+
minHeight: v ? {
|
|
653
|
+
xs: 200,
|
|
654
|
+
sm: 240,
|
|
655
|
+
md: 260
|
|
656
|
+
} : {
|
|
657
|
+
xs: 150,
|
|
658
|
+
sm: 180,
|
|
659
|
+
md: 220
|
|
660
|
+
},
|
|
661
|
+
border: `1px solid ${f.palette.divider}`,
|
|
662
|
+
borderRadius: "18px",
|
|
663
|
+
boxShadow: "none",
|
|
664
|
+
backgroundColor: f.palette.backgroundPaperElevation?.[8] || "#2A2A3F",
|
|
665
|
+
backgroundImage: "none"
|
|
666
|
+
},
|
|
667
|
+
children: v ? /* @__PURE__ */ (0, L.jsxs)(L.Fragment, { children: [/* @__PURE__ */ (0, L.jsx)(j, {
|
|
668
|
+
sx: {
|
|
669
|
+
flex: "0 0 50%",
|
|
670
|
+
position: "relative",
|
|
671
|
+
height: "100%",
|
|
672
|
+
minHeight: "100%",
|
|
673
|
+
maxHeight: "100%",
|
|
674
|
+
borderRadius: 1,
|
|
675
|
+
m: {
|
|
676
|
+
xs: 1.5,
|
|
677
|
+
sm: 2,
|
|
678
|
+
md: 3
|
|
679
|
+
},
|
|
680
|
+
mr: {
|
|
681
|
+
xs: .75,
|
|
682
|
+
sm: 1,
|
|
683
|
+
md: 1.5
|
|
684
|
+
},
|
|
685
|
+
overflow: "hidden",
|
|
686
|
+
display: I ? "none" : "block"
|
|
687
|
+
},
|
|
688
|
+
children: !I && /* @__PURE__ */ (0, L.jsxs)(ee, {
|
|
689
|
+
orthographic: !0,
|
|
690
|
+
camera: {
|
|
691
|
+
position: [
|
|
692
|
+
3,
|
|
693
|
+
2,
|
|
694
|
+
3
|
|
695
|
+
],
|
|
696
|
+
zoom: 1
|
|
697
|
+
},
|
|
698
|
+
shadows: !0,
|
|
699
|
+
frameloop: "demand",
|
|
700
|
+
style: {
|
|
701
|
+
borderRadius: f.shape.borderRadius,
|
|
702
|
+
width: "100%",
|
|
703
|
+
height: "100%",
|
|
704
|
+
background: "transparent",
|
|
705
|
+
position: "absolute",
|
|
706
|
+
top: 0,
|
|
707
|
+
left: 0
|
|
708
|
+
},
|
|
709
|
+
dpr: [1, 2],
|
|
710
|
+
gl: {
|
|
711
|
+
alpha: !0,
|
|
712
|
+
antialias: !0
|
|
713
|
+
},
|
|
714
|
+
children: [/* @__PURE__ */ (0, L.jsx)(z, {}), /* @__PURE__ */ (0, L.jsx)(w, {
|
|
715
|
+
fit: !0,
|
|
716
|
+
observe: !0,
|
|
717
|
+
margin: 1,
|
|
718
|
+
maxDuration: 1,
|
|
719
|
+
children: /* @__PURE__ */ (0, L.jsx)(l, {
|
|
720
|
+
connectedMotionGroup: c,
|
|
721
|
+
postModelRender: k
|
|
722
|
+
})
|
|
723
|
+
})]
|
|
724
|
+
})
|
|
725
|
+
}), /* @__PURE__ */ (0, L.jsxs)(j, {
|
|
726
|
+
sx: {
|
|
727
|
+
flex: "1",
|
|
728
|
+
display: "flex",
|
|
729
|
+
flexDirection: "column",
|
|
730
|
+
justifyContent: "flex-start",
|
|
731
|
+
width: I ? "100%" : "50%"
|
|
732
|
+
},
|
|
733
|
+
children: [/* @__PURE__ */ (0, L.jsxs)(j, {
|
|
734
|
+
sx: {
|
|
735
|
+
p: {
|
|
736
|
+
xs: 1.5,
|
|
737
|
+
sm: 2,
|
|
738
|
+
md: 3
|
|
739
|
+
},
|
|
740
|
+
pb: {
|
|
741
|
+
xs: 1,
|
|
742
|
+
sm: 1.5,
|
|
743
|
+
md: 2
|
|
744
|
+
},
|
|
745
|
+
textAlign: "left"
|
|
746
|
+
},
|
|
747
|
+
children: [/* @__PURE__ */ (0, L.jsx)(ne, {
|
|
748
|
+
variant: "h6",
|
|
749
|
+
component: "h2",
|
|
750
|
+
sx: { mb: 1 },
|
|
751
|
+
children: e
|
|
752
|
+
}), /* @__PURE__ */ (0, L.jsx)(n, {
|
|
753
|
+
programState: t,
|
|
754
|
+
safetyState: r,
|
|
755
|
+
operationMode: i
|
|
756
|
+
})]
|
|
757
|
+
}), /* @__PURE__ */ (0, L.jsxs)(j, {
|
|
758
|
+
sx: {
|
|
759
|
+
p: {
|
|
760
|
+
xs: 1.5,
|
|
761
|
+
sm: 2,
|
|
762
|
+
md: 3
|
|
763
|
+
},
|
|
764
|
+
pt: 0,
|
|
765
|
+
flex: "1",
|
|
766
|
+
display: "flex",
|
|
767
|
+
flexDirection: "column",
|
|
768
|
+
justifyContent: "space-between"
|
|
769
|
+
},
|
|
770
|
+
children: [!R && u && /* @__PURE__ */ (0, L.jsxs)(j, { children: [/* @__PURE__ */ (0, L.jsx)(u, {}), /* @__PURE__ */ (0, L.jsx)(N, { sx: {
|
|
771
|
+
mt: 1,
|
|
772
|
+
mb: 0,
|
|
773
|
+
borderColor: f.palette.divider,
|
|
774
|
+
opacity: .5
|
|
775
|
+
} })] }), /* @__PURE__ */ (0, L.jsx)(j, {
|
|
776
|
+
sx: { mt: !R && u ? "auto" : 0 },
|
|
777
|
+
children: /* @__PURE__ */ (0, L.jsx)(j, {
|
|
778
|
+
sx: {
|
|
779
|
+
display: "flex",
|
|
780
|
+
justifyContent: "flex-start",
|
|
781
|
+
mt: {
|
|
782
|
+
xs: 1,
|
|
783
|
+
sm: 1.5,
|
|
784
|
+
md: 2
|
|
785
|
+
},
|
|
786
|
+
mb: {
|
|
787
|
+
xs: .5,
|
|
788
|
+
sm: .75,
|
|
789
|
+
md: 1
|
|
790
|
+
}
|
|
791
|
+
},
|
|
792
|
+
children: /* @__PURE__ */ (0, L.jsx)(M, {
|
|
793
|
+
ref: g,
|
|
794
|
+
variant: "contained",
|
|
795
|
+
color: "secondary",
|
|
796
|
+
size: "small",
|
|
797
|
+
disabled: !a,
|
|
798
|
+
onMouseDown: A,
|
|
799
|
+
onMouseUp: P,
|
|
800
|
+
onMouseLeave: F,
|
|
801
|
+
onTouchStart: A,
|
|
802
|
+
onTouchEnd: P,
|
|
803
|
+
sx: {
|
|
804
|
+
textTransform: "none",
|
|
805
|
+
px: 1.5,
|
|
806
|
+
py: .5
|
|
807
|
+
},
|
|
808
|
+
children: p("RobotCard.DriveToHome.bt")
|
|
809
|
+
})
|
|
810
|
+
})
|
|
811
|
+
})]
|
|
812
|
+
})]
|
|
813
|
+
})] }) : /* @__PURE__ */ (0, L.jsx)(L.Fragment, { children: /* @__PURE__ */ (0, L.jsxs)(j, {
|
|
814
|
+
sx: {
|
|
815
|
+
p: 3,
|
|
816
|
+
height: "100%",
|
|
817
|
+
display: "flex",
|
|
818
|
+
flexDirection: "column"
|
|
819
|
+
},
|
|
820
|
+
children: [
|
|
821
|
+
/* @__PURE__ */ (0, L.jsxs)(j, { children: [/* @__PURE__ */ (0, L.jsx)(ne, {
|
|
822
|
+
variant: "h6",
|
|
823
|
+
component: "h2",
|
|
824
|
+
sx: { mb: 1 },
|
|
825
|
+
children: e
|
|
826
|
+
}), /* @__PURE__ */ (0, L.jsx)(n, {
|
|
827
|
+
programState: t,
|
|
828
|
+
safetyState: r,
|
|
829
|
+
operationMode: i
|
|
830
|
+
})] }),
|
|
831
|
+
/* @__PURE__ */ (0, L.jsx)(j, {
|
|
832
|
+
sx: {
|
|
833
|
+
flex: +!I,
|
|
834
|
+
position: "relative",
|
|
835
|
+
minHeight: I ? 0 : {
|
|
836
|
+
xs: 120,
|
|
837
|
+
sm: 150,
|
|
838
|
+
md: 200
|
|
839
|
+
},
|
|
840
|
+
height: I ? 0 : "auto",
|
|
841
|
+
borderRadius: 1,
|
|
842
|
+
overflow: "hidden",
|
|
843
|
+
display: I ? "none" : "block"
|
|
844
|
+
},
|
|
845
|
+
children: !I && /* @__PURE__ */ (0, L.jsxs)(ee, {
|
|
846
|
+
orthographic: !0,
|
|
847
|
+
camera: {
|
|
848
|
+
position: [
|
|
849
|
+
3,
|
|
850
|
+
2,
|
|
851
|
+
3
|
|
852
|
+
],
|
|
853
|
+
zoom: 1
|
|
854
|
+
},
|
|
855
|
+
shadows: !0,
|
|
856
|
+
frameloop: "demand",
|
|
857
|
+
style: {
|
|
858
|
+
borderRadius: f.shape.borderRadius,
|
|
859
|
+
width: "100%",
|
|
860
|
+
height: "100%",
|
|
861
|
+
background: "transparent",
|
|
862
|
+
position: "absolute"
|
|
863
|
+
},
|
|
864
|
+
dpr: [1, 2],
|
|
865
|
+
gl: {
|
|
866
|
+
alpha: !0,
|
|
867
|
+
antialias: !0
|
|
868
|
+
},
|
|
869
|
+
children: [/* @__PURE__ */ (0, L.jsx)(z, {}), /* @__PURE__ */ (0, L.jsx)(w, {
|
|
870
|
+
fit: !0,
|
|
871
|
+
clip: !0,
|
|
872
|
+
observe: !0,
|
|
873
|
+
margin: 1,
|
|
874
|
+
maxDuration: 1,
|
|
875
|
+
children: /* @__PURE__ */ (0, L.jsx)(l, {
|
|
876
|
+
connectedMotionGroup: c,
|
|
877
|
+
postModelRender: k
|
|
878
|
+
})
|
|
879
|
+
})]
|
|
880
|
+
})
|
|
881
|
+
}),
|
|
882
|
+
/* @__PURE__ */ (0, L.jsxs)(j, { children: [!R && u && /* @__PURE__ */ (0, L.jsxs)(L.Fragment, { children: [/* @__PURE__ */ (0, L.jsx)(u, {}), /* @__PURE__ */ (0, L.jsx)(N, { sx: {
|
|
883
|
+
mt: 1,
|
|
884
|
+
mb: 0,
|
|
885
|
+
borderColor: f.palette.divider,
|
|
886
|
+
opacity: .5
|
|
887
|
+
} })] }), /* @__PURE__ */ (0, L.jsx)(j, {
|
|
888
|
+
sx: {
|
|
889
|
+
display: "flex",
|
|
890
|
+
justifyContent: "flex-start",
|
|
891
|
+
mt: !R && u ? {
|
|
892
|
+
xs: 1,
|
|
893
|
+
sm: 2,
|
|
894
|
+
md: 5
|
|
895
|
+
} : {
|
|
896
|
+
xs: .5,
|
|
897
|
+
sm: 1,
|
|
898
|
+
md: 2
|
|
899
|
+
},
|
|
900
|
+
mb: {
|
|
901
|
+
xs: .5,
|
|
902
|
+
sm: .75,
|
|
903
|
+
md: 1
|
|
904
|
+
}
|
|
905
|
+
},
|
|
906
|
+
children: /* @__PURE__ */ (0, L.jsx)(M, {
|
|
907
|
+
ref: g,
|
|
908
|
+
variant: "contained",
|
|
909
|
+
color: "secondary",
|
|
910
|
+
size: "small",
|
|
911
|
+
disabled: !a,
|
|
912
|
+
onMouseDown: A,
|
|
913
|
+
onMouseUp: P,
|
|
914
|
+
onMouseLeave: F,
|
|
915
|
+
onTouchStart: A,
|
|
916
|
+
onTouchEnd: P,
|
|
917
|
+
sx: {
|
|
918
|
+
textTransform: "none",
|
|
919
|
+
px: 1.5,
|
|
920
|
+
py: .5
|
|
921
|
+
},
|
|
922
|
+
children: p("RobotCard.DriveToHome.bt")
|
|
923
|
+
})
|
|
924
|
+
})] })
|
|
925
|
+
]
|
|
926
|
+
}) })
|
|
927
|
+
});
|
|
928
|
+
})), ye = [
|
|
929
|
+
,
|
|
930
|
+
,
|
|
931
|
+
,
|
|
932
|
+
,
|
|
933
|
+
,
|
|
934
|
+
,
|
|
935
|
+
].fill(2 * Math.PI);
|
|
936
|
+
//#endregion
|
|
937
|
+
//#region src/components/robots/LinearAxisAnimator.tsx
|
|
938
|
+
function be({ rapidlyChangingMotionState: e, dhParameters: t, onTranslationChanged: n, children: r }) {
|
|
939
|
+
let a = S([]), o = S([]), s = S(null), { invalidate: l } = A();
|
|
940
|
+
b(() => (s.current = new c(e.joint_position.filter((e) => e !== void 0), {
|
|
941
|
+
tension: 120,
|
|
942
|
+
friction: 20,
|
|
943
|
+
threshold: .001
|
|
944
|
+
}), () => {
|
|
945
|
+
s.current?.destroy();
|
|
946
|
+
}), []), k((e, t) => {
|
|
947
|
+
if (s.current) {
|
|
948
|
+
let e = s.current.update(t);
|
|
949
|
+
d(), e || l();
|
|
950
|
+
}
|
|
951
|
+
});
|
|
952
|
+
function u(e) {
|
|
953
|
+
e && (o.current = H(e), d(), l());
|
|
954
|
+
}
|
|
955
|
+
function d() {
|
|
956
|
+
let e = s.current?.getCurrentValues() || [];
|
|
957
|
+
if (n) n(o.current, e);
|
|
958
|
+
else for (let [n, r] of o.current.entries()) {
|
|
959
|
+
let i = t[n].reverse_rotation_direction ? -1 : 1;
|
|
960
|
+
r.position.y = i * (e[n] || 0) / 1e3;
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
let f = y(() => {
|
|
964
|
+
let t = e.joint_position.filter((e) => e !== void 0);
|
|
965
|
+
requestAnimationFrame(() => {
|
|
966
|
+
a.current = t, s.current?.setTarget(t);
|
|
967
|
+
});
|
|
968
|
+
}, [e]);
|
|
969
|
+
return b(() => {
|
|
970
|
+
f();
|
|
971
|
+
}, [e, f]), i(() => {
|
|
972
|
+
f();
|
|
973
|
+
}), /* @__PURE__ */ (0, L.jsx)("group", {
|
|
974
|
+
ref: u,
|
|
975
|
+
children: r
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
//#endregion
|
|
979
|
+
//#region src/components/robots/DHLinearAxis.tsx
|
|
980
|
+
function xe({ rapidlyChangingMotionState: e, dhParameters: t, ...n }) {
|
|
981
|
+
let r = new f(), i = S(null), a = S(null);
|
|
982
|
+
function o(e) {
|
|
983
|
+
let n = new f();
|
|
984
|
+
for (let r = 0; r < t.length; r++) {
|
|
985
|
+
let i = t[r], a = e[r] ?? 0, o = new f().makeRotationY(i.theta).multiply(new f().makeTranslation(i.a / 1e3, (i.d + a * (i.reverse_rotation_direction ? -1 : 1)) / 1e3, 0)).multiply(new f().makeRotationX(i.alpha));
|
|
986
|
+
n.multiply(o);
|
|
987
|
+
}
|
|
988
|
+
let r = new m(), i = new p(), a = new m();
|
|
989
|
+
return n.decompose(r, i, a), r;
|
|
990
|
+
}
|
|
991
|
+
let s = o(e.joint_position);
|
|
992
|
+
function c(e, n) {
|
|
993
|
+
r.identity();
|
|
994
|
+
let o = new m();
|
|
995
|
+
for (let e = 0; e < t.length; e++) {
|
|
996
|
+
let i = n[e] ?? 0, a = t[e], o = new f().makeRotationY(a.theta).multiply(new f().makeTranslation(a.a / 1e3, (a.d + i * (a.reverse_rotation_direction ? -1 : 1)) / 1e3, 0)).multiply(new f().makeRotationX(a.alpha));
|
|
997
|
+
r.multiply(o);
|
|
998
|
+
}
|
|
999
|
+
let s = new m(), c = new p(), l = new m();
|
|
1000
|
+
if (r.decompose(s, c, l), o = s, i.current && i.current.position.set(o.x, o.y, o.z), a.current) {
|
|
1001
|
+
let e = a.current.geometry;
|
|
1002
|
+
e && e.setPositions && e.setPositions([
|
|
1003
|
+
0,
|
|
1004
|
+
0,
|
|
1005
|
+
0,
|
|
1006
|
+
o.x,
|
|
1007
|
+
o.y,
|
|
1008
|
+
o.z
|
|
1009
|
+
]);
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
return /* @__PURE__ */ (0, L.jsx)(L.Fragment, { children: /* @__PURE__ */ (0, L.jsx)(be, {
|
|
1013
|
+
rapidlyChangingMotionState: e,
|
|
1014
|
+
dhParameters: t,
|
|
1015
|
+
onTranslationChanged: c,
|
|
1016
|
+
children: /* @__PURE__ */ (0, L.jsxs)("group", {
|
|
1017
|
+
...n,
|
|
1018
|
+
name: "Scene",
|
|
1019
|
+
children: [
|
|
1020
|
+
/* @__PURE__ */ (0, L.jsxs)("mesh", {
|
|
1021
|
+
name: "Base",
|
|
1022
|
+
position: [
|
|
1023
|
+
0,
|
|
1024
|
+
0,
|
|
1025
|
+
0
|
|
1026
|
+
],
|
|
1027
|
+
children: [/* @__PURE__ */ (0, L.jsx)("sphereGeometry", { args: [
|
|
1028
|
+
.02,
|
|
1029
|
+
32,
|
|
1030
|
+
32
|
|
1031
|
+
] }), /* @__PURE__ */ (0, L.jsx)("meshStandardMaterial", {
|
|
1032
|
+
color: "green",
|
|
1033
|
+
depthTest: !0
|
|
1034
|
+
})]
|
|
1035
|
+
}),
|
|
1036
|
+
/* @__PURE__ */ (0, L.jsx)(D, {
|
|
1037
|
+
ref: a,
|
|
1038
|
+
points: [new m(0, 0, 0), s],
|
|
1039
|
+
color: "White",
|
|
1040
|
+
lineWidth: 5
|
|
1041
|
+
}),
|
|
1042
|
+
/* @__PURE__ */ (0, L.jsxs)("mesh", {
|
|
1043
|
+
ref: i,
|
|
1044
|
+
name: "TCP",
|
|
1045
|
+
position: s,
|
|
1046
|
+
children: [/* @__PURE__ */ (0, L.jsx)("sphereGeometry", { args: [
|
|
1047
|
+
.025,
|
|
1048
|
+
32,
|
|
1049
|
+
32
|
|
1050
|
+
] }), /* @__PURE__ */ (0, L.jsx)("meshStandardMaterial", {
|
|
1051
|
+
color: "red",
|
|
1052
|
+
depthTest: !0
|
|
1053
|
+
})]
|
|
1054
|
+
})
|
|
1055
|
+
]
|
|
1056
|
+
})
|
|
1057
|
+
}) });
|
|
1058
|
+
}
|
|
1059
|
+
//#endregion
|
|
1060
|
+
//#region src/components/robots/SupportedLinearAxis.tsx
|
|
1061
|
+
var Z = o(({ rapidlyChangingMotionState: e, modelFromController: t, dhParameters: n, getModel: r = V, flangeRef: i, postModelRender: a, transparentColor: o, instanceUrl: s, ...c }) => {
|
|
1062
|
+
let [l, u] = C(null), d = y((e) => {
|
|
1063
|
+
u(e);
|
|
1064
|
+
}, []);
|
|
1065
|
+
b(() => {
|
|
1066
|
+
l && (o ? J(l, o) : Y(l));
|
|
1067
|
+
}, [l, o]);
|
|
1068
|
+
let f = /* @__PURE__ */ (0, L.jsx)(xe, {
|
|
1069
|
+
rapidlyChangingMotionState: e,
|
|
1070
|
+
dhParameters: n,
|
|
1071
|
+
...c
|
|
1072
|
+
});
|
|
1073
|
+
return /* @__PURE__ */ (0, L.jsxs)(F, {
|
|
1074
|
+
fallback: f,
|
|
1075
|
+
onError: (e) => {
|
|
1076
|
+
console.warn(e);
|
|
1077
|
+
},
|
|
1078
|
+
children: [/* @__PURE__ */ (0, L.jsx)(v, {
|
|
1079
|
+
fallback: f,
|
|
1080
|
+
children: /* @__PURE__ */ (0, L.jsx)("group", {
|
|
1081
|
+
ref: d,
|
|
1082
|
+
children: /* @__PURE__ */ (0, L.jsx)(be, {
|
|
1083
|
+
rapidlyChangingMotionState: e,
|
|
1084
|
+
dhParameters: n,
|
|
1085
|
+
children: /* @__PURE__ */ (0, L.jsx)(q, {
|
|
1086
|
+
modelURL: (() => {
|
|
1087
|
+
let e = r(t, s);
|
|
1088
|
+
if (!e) {
|
|
1089
|
+
let e = new Blob([], { type: "model/gltf-binary" }), n = new File([e], `${t}.glb`, { type: "model/gltf-binary" });
|
|
1090
|
+
return Promise.resolve(URL.createObjectURL(n));
|
|
1091
|
+
}
|
|
1092
|
+
return e;
|
|
1093
|
+
})(),
|
|
1094
|
+
postModelRender: a,
|
|
1095
|
+
flangeRef: i,
|
|
1096
|
+
...c
|
|
1097
|
+
})
|
|
1098
|
+
})
|
|
1099
|
+
})
|
|
1100
|
+
}), /* @__PURE__ */ (0, L.jsx)(K, {})]
|
|
1101
|
+
});
|
|
1102
|
+
});
|
|
1103
|
+
//#endregion
|
|
1104
|
+
//#region src/components/robots/LinearAxis.tsx
|
|
1105
|
+
function Se({ connectedMotionGroup: e, getModel: t = V, flangeRef: n, transparentColor: r, postModelRender: i, ...a }) {
|
|
1106
|
+
if (!e.dhParameters) return null;
|
|
1107
|
+
let o = e.modelFromController || "";
|
|
1108
|
+
return o && t(o) ? /* @__PURE__ */ (0, L.jsx)(Z, {
|
|
1109
|
+
rapidlyChangingMotionState: e.rapidlyChangingMotionState,
|
|
1110
|
+
modelFromController: o,
|
|
1111
|
+
dhParameters: e.dhParameters,
|
|
1112
|
+
getModel: t,
|
|
1113
|
+
flangeRef: n,
|
|
1114
|
+
transparentColor: r,
|
|
1115
|
+
postModelRender: i,
|
|
1116
|
+
...a
|
|
1117
|
+
}) : /* @__PURE__ */ (0, L.jsx)(xe, {
|
|
1118
|
+
rapidlyChangingMotionState: e.rapidlyChangingMotionState,
|
|
1119
|
+
dhParameters: e.dhParameters,
|
|
1120
|
+
...a
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
//#endregion
|
|
1124
|
+
//#region src/components/robots/manufacturerHomePositions.ts
|
|
1125
|
+
var Q = {
|
|
1126
|
+
[l.Abb]: [
|
|
1127
|
+
0,
|
|
1128
|
+
0,
|
|
1129
|
+
0,
|
|
1130
|
+
0,
|
|
1131
|
+
Math.PI / 2,
|
|
1132
|
+
0,
|
|
1133
|
+
0
|
|
1134
|
+
],
|
|
1135
|
+
[l.Fanuc]: [
|
|
1136
|
+
0,
|
|
1137
|
+
0,
|
|
1138
|
+
0,
|
|
1139
|
+
0,
|
|
1140
|
+
-Math.PI / 2,
|
|
1141
|
+
0,
|
|
1142
|
+
0
|
|
1143
|
+
],
|
|
1144
|
+
[l.Yaskawa]: [
|
|
1145
|
+
0,
|
|
1146
|
+
0,
|
|
1147
|
+
0,
|
|
1148
|
+
0,
|
|
1149
|
+
-Math.PI / 2,
|
|
1150
|
+
0,
|
|
1151
|
+
0
|
|
1152
|
+
],
|
|
1153
|
+
[l.Kuka]: [
|
|
1154
|
+
0,
|
|
1155
|
+
-Math.PI / 2,
|
|
1156
|
+
Math.PI / 2,
|
|
1157
|
+
0,
|
|
1158
|
+
Math.PI / 2,
|
|
1159
|
+
0,
|
|
1160
|
+
0
|
|
1161
|
+
],
|
|
1162
|
+
[l.Universalrobots]: [
|
|
1163
|
+
0,
|
|
1164
|
+
-Math.PI / 2,
|
|
1165
|
+
-Math.PI / 2,
|
|
1166
|
+
-Math.PI / 2,
|
|
1167
|
+
Math.PI / 2,
|
|
1168
|
+
-Math.PI / 2,
|
|
1169
|
+
0
|
|
1170
|
+
]
|
|
1171
|
+
};
|
|
1172
|
+
function $(e) {
|
|
1173
|
+
let [t] = e.split("_");
|
|
1174
|
+
switch (t) {
|
|
1175
|
+
case "ABB": return l.Abb;
|
|
1176
|
+
case "FANUC": return l.Fanuc;
|
|
1177
|
+
case "YASKAWA": return l.Yaskawa;
|
|
1178
|
+
case "KUKA": return l.Kuka;
|
|
1179
|
+
case "UniversalRobots": return l.Universalrobots;
|
|
1180
|
+
default: return null;
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
function Ce(e, t) {
|
|
1184
|
+
let n = $(e);
|
|
1185
|
+
return n && n in Q ? Q[n] : t || null;
|
|
1186
|
+
}
|
|
1187
|
+
//#endregion
|
|
1188
|
+
//#region src/components/robots/MotionGroupVisualizer.tsx
|
|
1189
|
+
var we = o((e) => {
|
|
1190
|
+
let { inverseSolver: t, dhParameters: n, ...r } = e, [i, o] = C(a.RevoluteJoint);
|
|
1191
|
+
b(() => {
|
|
1192
|
+
n.length && o(n[0].type ?? a.RevoluteJoint);
|
|
1193
|
+
}, [n]);
|
|
1194
|
+
let s = x(() => t === null && i === a.RevoluteJoint, [t, i]), c = x(() => t === null && i === a.PrismaticJoint, [t, i]);
|
|
1195
|
+
return x(() => !!t, [t]) || s ? /* @__PURE__ */ (0, L.jsx)(X, {
|
|
1196
|
+
dhParameters: n,
|
|
1197
|
+
...r
|
|
1198
|
+
}) : c ? /* @__PURE__ */ (0, L.jsx)(Z, {
|
|
1199
|
+
dhParameters: n,
|
|
1200
|
+
...r
|
|
1201
|
+
}) : /* @__PURE__ */ (0, L.jsx)(L.Fragment, {});
|
|
1202
|
+
});
|
|
1203
|
+
//#endregion
|
|
1204
|
+
export { Se as a, ve as c, V as d, le as f, oe as h, Ce as i, _e as l, z as m, Q as n, Z as o, ce as p, $ as r, ye as s, we as t, X as u };
|
|
1205
|
+
|
|
1206
|
+
//# sourceMappingURL=3d-BTtdSlR9.js.map
|