@wandelbots/wandelbots-js-react-components 6.2.0 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/3d.cjs +1 -1
- package/dist/3d.d.ts +3 -2
- package/dist/3d.js +17 -16
- package/dist/chunks/MotionGroupVisualizer-DshWR1wY.js +1653 -0
- package/dist/chunks/MotionGroupVisualizer-eD7yFEcF.cjs +1 -0
- package/dist/components/3d-viewport/JointLimitGizmo.d.ts +34 -0
- package/dist/components/3d-viewport/jointLimitFrames.d.ts +8 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +68 -67
- package/dist/themes/themeTypes.d.ts +1 -0
- package/package.json +1 -1
- package/dist/chunks/MotionGroupVisualizer-CEiRJk_l.js +0 -1423
- package/dist/chunks/MotionGroupVisualizer-rrhU4sYi.cjs +0 -1
|
@@ -1,1423 +0,0 @@
|
|
|
1
|
-
import { jsx as r, jsxs as w, Fragment as V } from "react/jsx-runtime";
|
|
2
|
-
import * as x from "three";
|
|
3
|
-
import { Matrix4 as M, Vector3 as P, Quaternion as N } from "three";
|
|
4
|
-
import { ConvexGeometry as ue, RoundedBoxGeometry as Pe } from "three-stdlib";
|
|
5
|
-
import ke, { useMemo as D, forwardRef as Le, useRef as v, useImperativeHandle as Ge, useEffect as I, useState as k, useCallback as L, Suspense as fe } from "react";
|
|
6
|
-
import { d as Ie, v as Ae, o as Oe, e as A } from "./externalizeComponent-EDymnaGR.js";
|
|
7
|
-
import { Environment as De, Lightformer as G, Line as H, useGLTF as Fe, Bounds as te } from "@react-three/drei";
|
|
8
|
-
import { useTheme as Ee } from "@mui/material/styles";
|
|
9
|
-
import S from "@mui/material/Box";
|
|
10
|
-
import ne from "@mui/material/Button";
|
|
11
|
-
import Ue from "@mui/material/Card";
|
|
12
|
-
import re from "@mui/material/Divider";
|
|
13
|
-
import oe from "@mui/material/Typography";
|
|
14
|
-
import { useThree as he, Canvas as ie } from "@react-three/fiber";
|
|
15
|
-
import { observer as Ce } from "mobx-react-lite";
|
|
16
|
-
import { useTranslation as je } from "react-i18next";
|
|
17
|
-
import { c as pe, g as Q, b as se } from "./useSmoothedMotionState-DyDgSVYX.js";
|
|
18
|
-
import { Nova as Be, Manufacturer as _, JointTypeEnum as B } from "@wandelbots/nova-js/v2";
|
|
19
|
-
import { ErrorBoundary as de } from "react-error-boundary";
|
|
20
|
-
function Ve(e) {
|
|
21
|
-
switch (e.shape_type) {
|
|
22
|
-
case "convex_hull":
|
|
23
|
-
return new ue(
|
|
24
|
-
e.vertices.map(
|
|
25
|
-
(t) => new x.Vector3(
|
|
26
|
-
t[0] / 1e3,
|
|
27
|
-
t[1] / 1e3,
|
|
28
|
-
t[2] / 1e3
|
|
29
|
-
)
|
|
30
|
-
)
|
|
31
|
-
);
|
|
32
|
-
case "box":
|
|
33
|
-
return new x.BoxGeometry(
|
|
34
|
-
e.size_x / 1e3,
|
|
35
|
-
e.size_y / 1e3,
|
|
36
|
-
e.size_z / 1e3
|
|
37
|
-
);
|
|
38
|
-
case "sphere":
|
|
39
|
-
return new x.SphereGeometry(e.radius / 1e3);
|
|
40
|
-
case "capsule":
|
|
41
|
-
return new x.CapsuleGeometry(
|
|
42
|
-
e.radius / 1e3,
|
|
43
|
-
e.cylinder_height / 1e3
|
|
44
|
-
);
|
|
45
|
-
case "cylinder":
|
|
46
|
-
return new x.CylinderGeometry(
|
|
47
|
-
e.radius / 1e3,
|
|
48
|
-
e.radius / 1e3,
|
|
49
|
-
e.height / 1e3
|
|
50
|
-
);
|
|
51
|
-
case "rectangle":
|
|
52
|
-
return new x.BoxGeometry(e.size_x / 1e3, e.size_y / 1e3, 0);
|
|
53
|
-
default:
|
|
54
|
-
return console.warn(`${e.shape_type} is not supported`), new x.BufferGeometry();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function We({
|
|
58
|
-
name: e,
|
|
59
|
-
collider: n,
|
|
60
|
-
children: t
|
|
61
|
-
}) {
|
|
62
|
-
var f, l;
|
|
63
|
-
const a = ((f = n.pose) == null ? void 0 : f.position) ?? [0, 0, 0], i = ((l = n.pose) == null ? void 0 : l.orientation) ?? [0, 0, 0];
|
|
64
|
-
return n.margin && console.warn(`${e} margin is not supported`), /* @__PURE__ */ r(
|
|
65
|
-
"mesh",
|
|
66
|
-
{
|
|
67
|
-
name: e,
|
|
68
|
-
position: new x.Vector3(
|
|
69
|
-
a[0],
|
|
70
|
-
a[1],
|
|
71
|
-
a[2]
|
|
72
|
-
).divideScalar(1e3),
|
|
73
|
-
rotation: new x.Euler(i[0], i[1], i[2], "XYZ"),
|
|
74
|
-
geometry: Ve(n.shape),
|
|
75
|
-
children: t
|
|
76
|
-
}
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
function $e({
|
|
80
|
-
name: e,
|
|
81
|
-
colliders: n,
|
|
82
|
-
meshChildrenProvider: t,
|
|
83
|
-
...a
|
|
84
|
-
}) {
|
|
85
|
-
return /* @__PURE__ */ r("group", { name: e, ...a, children: Object.entries(n).map(([i, f]) => /* @__PURE__ */ r(
|
|
86
|
-
We,
|
|
87
|
-
{
|
|
88
|
-
name: i,
|
|
89
|
-
collider: f,
|
|
90
|
-
children: t(i, f)
|
|
91
|
-
},
|
|
92
|
-
i
|
|
93
|
-
)) });
|
|
94
|
-
}
|
|
95
|
-
function vt({
|
|
96
|
-
scene: e,
|
|
97
|
-
meshChildrenProvider: n
|
|
98
|
-
}) {
|
|
99
|
-
const t = e.colliders;
|
|
100
|
-
return /* @__PURE__ */ r("group", { children: t && /* @__PURE__ */ r(
|
|
101
|
-
$e,
|
|
102
|
-
{
|
|
103
|
-
meshChildrenProvider: n,
|
|
104
|
-
colliders: t
|
|
105
|
-
}
|
|
106
|
-
) });
|
|
107
|
-
}
|
|
108
|
-
function ae() {
|
|
109
|
-
return /* @__PURE__ */ r(De, { frames: 1, children: /* @__PURE__ */ r(Ne, {}) });
|
|
110
|
-
}
|
|
111
|
-
const Je = [2, 0, 2, 0, 2, 0, 2, 0];
|
|
112
|
-
function Ne({ positions: e = Je }) {
|
|
113
|
-
return /* @__PURE__ */ w(V, { children: [
|
|
114
|
-
/* @__PURE__ */ r(
|
|
115
|
-
G,
|
|
116
|
-
{
|
|
117
|
-
intensity: 5,
|
|
118
|
-
"rotation-x": Math.PI / 2,
|
|
119
|
-
position: [0, 5, -9],
|
|
120
|
-
scale: [10, 10, 1]
|
|
121
|
-
}
|
|
122
|
-
),
|
|
123
|
-
/* @__PURE__ */ r("group", { rotation: [0, 0.5, 0], children: /* @__PURE__ */ r("group", { children: e.map((n, t) => /* @__PURE__ */ r(
|
|
124
|
-
G,
|
|
125
|
-
{
|
|
126
|
-
form: "circle",
|
|
127
|
-
intensity: 5,
|
|
128
|
-
rotation: [Math.PI / 2, 0, 0],
|
|
129
|
-
position: [n, 4, t * 4],
|
|
130
|
-
scale: [3, 1, 1]
|
|
131
|
-
},
|
|
132
|
-
t
|
|
133
|
-
)) }) }),
|
|
134
|
-
/* @__PURE__ */ r(
|
|
135
|
-
G,
|
|
136
|
-
{
|
|
137
|
-
intensity: 40,
|
|
138
|
-
"rotation-y": Math.PI / 2,
|
|
139
|
-
position: [-5, 1, -1],
|
|
140
|
-
scale: [20, 0.1, 1]
|
|
141
|
-
}
|
|
142
|
-
),
|
|
143
|
-
/* @__PURE__ */ r(
|
|
144
|
-
G,
|
|
145
|
-
{
|
|
146
|
-
intensity: 20,
|
|
147
|
-
"rotation-y": -Math.PI,
|
|
148
|
-
position: [-5, -2, -1],
|
|
149
|
-
scale: [20, 0.1, 1]
|
|
150
|
-
}
|
|
151
|
-
),
|
|
152
|
-
/* @__PURE__ */ r(
|
|
153
|
-
G,
|
|
154
|
-
{
|
|
155
|
-
"rotation-y": Math.PI / 2,
|
|
156
|
-
position: [-5, -1, -1],
|
|
157
|
-
scale: [20, 0.5, 1],
|
|
158
|
-
intensity: 5
|
|
159
|
-
}
|
|
160
|
-
),
|
|
161
|
-
/* @__PURE__ */ r(
|
|
162
|
-
G,
|
|
163
|
-
{
|
|
164
|
-
"rotation-y": -Math.PI / 2,
|
|
165
|
-
position: [10, 1, 0],
|
|
166
|
-
scale: [20, 1, 1],
|
|
167
|
-
intensity: 10
|
|
168
|
-
}
|
|
169
|
-
),
|
|
170
|
-
/* @__PURE__ */ r(
|
|
171
|
-
G,
|
|
172
|
-
{
|
|
173
|
-
form: "ring",
|
|
174
|
-
color: "white",
|
|
175
|
-
intensity: 5,
|
|
176
|
-
scale: 10,
|
|
177
|
-
position: [-15, 4, -18],
|
|
178
|
-
target: [0, 0, 0]
|
|
179
|
-
}
|
|
180
|
-
)
|
|
181
|
-
] });
|
|
182
|
-
}
|
|
183
|
-
const ce = {
|
|
184
|
-
attach: "material",
|
|
185
|
-
color: "#009f4d",
|
|
186
|
-
opacity: 0.2,
|
|
187
|
-
depthTest: !1,
|
|
188
|
-
depthWrite: !1,
|
|
189
|
-
transparent: !0,
|
|
190
|
-
polygonOffset: !0
|
|
191
|
-
};
|
|
192
|
-
function Mt({
|
|
193
|
-
safetyZones: e,
|
|
194
|
-
dhParameters: n,
|
|
195
|
-
...t
|
|
196
|
-
}) {
|
|
197
|
-
const a = D(
|
|
198
|
-
() => Ie(n ?? []),
|
|
199
|
-
[n]
|
|
200
|
-
), i = (l, o) => {
|
|
201
|
-
var y, m;
|
|
202
|
-
if (!((y = o == null ? void 0 : o.pose) != null && y.position) || !((m = o == null ? void 0 : o.pose) != null && m.orientation))
|
|
203
|
-
return null;
|
|
204
|
-
const p = new x.Vector3(
|
|
205
|
-
o.pose.position[0] / 1e3,
|
|
206
|
-
o.pose.position[1] / 1e3,
|
|
207
|
-
o.pose.position[2] / 1e3
|
|
208
|
-
), s = new x.Vector3(
|
|
209
|
-
o.pose.orientation[0],
|
|
210
|
-
o.pose.orientation[1],
|
|
211
|
-
o.pose.orientation[2]
|
|
212
|
-
);
|
|
213
|
-
let d;
|
|
214
|
-
const c = o.shape.shape_type === "plane" ? { ...ce, side: x.DoubleSide } : { ...ce, side: x.FrontSide };
|
|
215
|
-
switch (o.shape.shape_type) {
|
|
216
|
-
/**
|
|
217
|
-
* Plane shape, uses DH parameters to calculate the size of the plane (reach distance of a robot)
|
|
218
|
-
*/
|
|
219
|
-
case "plane":
|
|
220
|
-
d = /* @__PURE__ */ r("planeGeometry", { args: [a, a] });
|
|
221
|
-
break;
|
|
222
|
-
/**
|
|
223
|
-
* Sphere shape
|
|
224
|
-
*/
|
|
225
|
-
case "sphere": {
|
|
226
|
-
const h = (o == null ? void 0 : o.shape).radius / 1e3;
|
|
227
|
-
d = /* @__PURE__ */ r("sphereGeometry", { args: [h] });
|
|
228
|
-
break;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Capsule shape
|
|
232
|
-
*/
|
|
233
|
-
case "capsule": {
|
|
234
|
-
const h = (o == null ? void 0 : o.shape).radius / 1e3, u = (o == null ? void 0 : o.shape).cylinder_height / 1e3;
|
|
235
|
-
d = /* @__PURE__ */ r("capsuleGeometry", { args: [h, u] });
|
|
236
|
-
break;
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Convex hull, checks at first if the vertices are coplanar - if yes, adds a small offset for
|
|
240
|
-
* renderer to be able to visualize the convex hull.
|
|
241
|
-
*/
|
|
242
|
-
case "convex_hull": {
|
|
243
|
-
const h = (o == null ? void 0 : o.shape).vertices.map(
|
|
244
|
-
(b) => new x.Vector3(b[0] / 1e3, b[1] / 1e3, b[2] / 1e3)
|
|
245
|
-
), u = Ae(h);
|
|
246
|
-
if (u.isCoplanar && u.normal) {
|
|
247
|
-
const g = new x.Vector3().addVectors(
|
|
248
|
-
h[0],
|
|
249
|
-
u.normal.multiplyScalar(1e-4)
|
|
250
|
-
);
|
|
251
|
-
h.push(g);
|
|
252
|
-
}
|
|
253
|
-
try {
|
|
254
|
-
d = /* @__PURE__ */ r(
|
|
255
|
-
"primitive",
|
|
256
|
-
{
|
|
257
|
-
object: new ue(h),
|
|
258
|
-
attach: "geometry"
|
|
259
|
-
}
|
|
260
|
-
);
|
|
261
|
-
} catch (b) {
|
|
262
|
-
return console.log("Error creating ConvexGeometry:", b), null;
|
|
263
|
-
}
|
|
264
|
-
break;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Convex hull around four spheres. Sphere center points in x/y-plane,
|
|
268
|
-
* offset by either combination "+/- sizeX" or "+/- sizeY".
|
|
269
|
-
* Alternative description: Rectangle in x/y-plane with a 3D padding (source: nova-api docs)
|
|
270
|
-
*
|
|
271
|
-
* Basically a rounded box with a rectangular cross-section.
|
|
272
|
-
*/
|
|
273
|
-
case "rectangular_capsule": {
|
|
274
|
-
const h = o.shape, u = h.radius / 1e3, b = h.sphere_center_distance_x / 1e3, g = h.sphere_center_distance_y / 1e3, R = u * 2;
|
|
275
|
-
d = /* @__PURE__ */ r(
|
|
276
|
-
"primitive",
|
|
277
|
-
{
|
|
278
|
-
object: new Pe(b, g, R, 2, u),
|
|
279
|
-
attach: "geometry"
|
|
280
|
-
}
|
|
281
|
-
);
|
|
282
|
-
break;
|
|
283
|
-
}
|
|
284
|
-
default:
|
|
285
|
-
console.warn(
|
|
286
|
-
"Unsupported safety zone shape type:",
|
|
287
|
-
o.shape.shape_type
|
|
288
|
-
), d = null;
|
|
289
|
-
}
|
|
290
|
-
return /* @__PURE__ */ w(
|
|
291
|
-
"mesh",
|
|
292
|
-
{
|
|
293
|
-
renderOrder: l,
|
|
294
|
-
position: p,
|
|
295
|
-
quaternion: Oe(s),
|
|
296
|
-
children: [
|
|
297
|
-
d,
|
|
298
|
-
/* @__PURE__ */ r("meshStandardMaterial", { ...c, polygonOffsetFactor: -l })
|
|
299
|
-
]
|
|
300
|
-
},
|
|
301
|
-
`safety-zone-${o.shape.shape_type}-${l}`
|
|
302
|
-
);
|
|
303
|
-
}, f = D(() => Object.values(e ?? {}).map(
|
|
304
|
-
(l, o) => i(o, l)
|
|
305
|
-
), [e, a]);
|
|
306
|
-
return /* @__PURE__ */ r("group", { ...t, children: f });
|
|
307
|
-
}
|
|
308
|
-
function St({
|
|
309
|
-
trajectory: e,
|
|
310
|
-
...n
|
|
311
|
-
}) {
|
|
312
|
-
const t = (e == null ? void 0 : e.map((a) => {
|
|
313
|
-
if (a.position && a.position.length >= 3) {
|
|
314
|
-
const [i, f, l] = a.position;
|
|
315
|
-
if (Number.isFinite(i) && Number.isFinite(f) && Number.isFinite(l))
|
|
316
|
-
return new x.Vector3(i / 1e3, l / 1e3, -f / 1e3);
|
|
317
|
-
}
|
|
318
|
-
return null;
|
|
319
|
-
}).filter((a) => a !== null)) || [];
|
|
320
|
-
return /* @__PURE__ */ r("group", { ...n, children: t.length > 0 && /* @__PURE__ */ r(
|
|
321
|
-
H,
|
|
322
|
-
{
|
|
323
|
-
points: t,
|
|
324
|
-
lineWidth: 3,
|
|
325
|
-
polygonOffset: !0,
|
|
326
|
-
polygonOffsetFactor: 10,
|
|
327
|
-
polygonOffsetUnits: 10
|
|
328
|
-
}
|
|
329
|
-
) });
|
|
330
|
-
}
|
|
331
|
-
const J = /* @__PURE__ */ new Map();
|
|
332
|
-
async function W(e, n) {
|
|
333
|
-
if (J.has(e))
|
|
334
|
-
return J.get(e);
|
|
335
|
-
const t = (async () => {
|
|
336
|
-
var l;
|
|
337
|
-
const a = n || "", i = new Be({ instanceUrl: a }), f = i.api.motionGroupModels;
|
|
338
|
-
(l = f.axios) != null && l.interceptors && f.axios.interceptors.request.use((o) => {
|
|
339
|
-
var p;
|
|
340
|
-
return (p = o.url) != null && p.includes("/glb") && (o.responseType = "blob"), o;
|
|
341
|
-
});
|
|
342
|
-
try {
|
|
343
|
-
const o = await i.api.motionGroupModels.getMotionGroupGlbModel(
|
|
344
|
-
e
|
|
345
|
-
);
|
|
346
|
-
return URL.createObjectURL(o);
|
|
347
|
-
} catch (o) {
|
|
348
|
-
throw console.error("Failed to fetch model:", o), o;
|
|
349
|
-
}
|
|
350
|
-
})();
|
|
351
|
-
return J.set(e, t), t;
|
|
352
|
-
}
|
|
353
|
-
function me(e) {
|
|
354
|
-
function n(t) {
|
|
355
|
-
return t.children.length === 0 ? [t] : [t, ...t.children.flatMap((a) => n(a))];
|
|
356
|
-
}
|
|
357
|
-
return n(e).filter((t) => ye(t));
|
|
358
|
-
}
|
|
359
|
-
function ge(e) {
|
|
360
|
-
return e.name.endsWith("_FLG");
|
|
361
|
-
}
|
|
362
|
-
function ye(e) {
|
|
363
|
-
return /_J[0-9]+$/.test(e.name);
|
|
364
|
-
}
|
|
365
|
-
function He(e, n) {
|
|
366
|
-
let t;
|
|
367
|
-
function a(i) {
|
|
368
|
-
if (ge(i)) {
|
|
369
|
-
if (t)
|
|
370
|
-
throw Error(
|
|
371
|
-
`Found multiple flange groups in robot model ${n}; first ${t.name} then ${i.name}. Only one _FLG group is allowed.`
|
|
372
|
-
);
|
|
373
|
-
t = i;
|
|
374
|
-
}
|
|
375
|
-
ye(i), i.children.map(a);
|
|
376
|
-
}
|
|
377
|
-
if (a(e.scene), !t)
|
|
378
|
-
throw Error(
|
|
379
|
-
`No flange group found in robot model ${n}. Flange must be identified with a name ending in _FLG.`
|
|
380
|
-
);
|
|
381
|
-
return { gltf: e };
|
|
382
|
-
}
|
|
383
|
-
const be = Le(
|
|
384
|
-
function({
|
|
385
|
-
rapidlyChangingMotionState: n,
|
|
386
|
-
dhParameters: t,
|
|
387
|
-
chainOffsetPosition: a,
|
|
388
|
-
chainOffsetQuaternion: i,
|
|
389
|
-
onRotationChanged: f,
|
|
390
|
-
children: l
|
|
391
|
-
}, o) {
|
|
392
|
-
const p = v(null), s = v([]), d = v(
|
|
393
|
-
n.joint_position.filter(
|
|
394
|
-
(g) => g !== void 0
|
|
395
|
-
)
|
|
396
|
-
), { invalidate: c } = he(), y = v(n);
|
|
397
|
-
y.current = n;
|
|
398
|
-
function m(g) {
|
|
399
|
-
p.current = g, g && h();
|
|
400
|
-
}
|
|
401
|
-
function h() {
|
|
402
|
-
p.current && (s.current = me(p.current), u(), c());
|
|
403
|
-
}
|
|
404
|
-
Ge(o, () => ({ recollectJoints: h }));
|
|
405
|
-
function u() {
|
|
406
|
-
const g = d.current;
|
|
407
|
-
if (f)
|
|
408
|
-
f(s.current, g);
|
|
409
|
-
else
|
|
410
|
-
for (const [R, O] of s.current.entries()) {
|
|
411
|
-
const F = t[R], q = F.theta || 0, $ = F.reverse_rotation_direction ? -1 : 1;
|
|
412
|
-
O.rotation.y = $ * (g[R] || 0) + q;
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
function b(g) {
|
|
416
|
-
d.current = g.joint_position.filter(
|
|
417
|
-
(R) => R !== void 0
|
|
418
|
-
), u(), c();
|
|
419
|
-
}
|
|
420
|
-
return pe(() => {
|
|
421
|
-
b(y.current);
|
|
422
|
-
}), I(() => {
|
|
423
|
-
b(n);
|
|
424
|
-
}, [n]), /* @__PURE__ */ r(
|
|
425
|
-
"group",
|
|
426
|
-
{
|
|
427
|
-
ref: m,
|
|
428
|
-
position: a,
|
|
429
|
-
quaternion: i,
|
|
430
|
-
children: l
|
|
431
|
-
}
|
|
432
|
-
);
|
|
433
|
-
}
|
|
434
|
-
), Qe = "line", qe = "mesh";
|
|
435
|
-
function Ye({
|
|
436
|
-
rapidlyChangingMotionState: e,
|
|
437
|
-
dhParameters: n,
|
|
438
|
-
...t
|
|
439
|
-
}) {
|
|
440
|
-
const a = new M(), i = v([]), f = v([]);
|
|
441
|
-
ke.useEffect(() => {
|
|
442
|
-
i.current = new Array(n.length).fill(null), f.current = new Array(n.length).fill(null);
|
|
443
|
-
}, [n.length]);
|
|
444
|
-
function l(s, d) {
|
|
445
|
-
const c = new P(), y = new N(), m = new P();
|
|
446
|
-
a.decompose(c, y, m);
|
|
447
|
-
const h = c.clone(), u = new M().makeRotationY(
|
|
448
|
-
s.theta + d * (s.reverse_rotation_direction ? -1 : 1)
|
|
449
|
-
).multiply(new M().makeTranslation(0, s.d / 1e3, 0)).multiply(new M().makeTranslation(s.a / 1e3, 0, 0)).multiply(new M().makeRotationX(s.alpha));
|
|
450
|
-
return a.multiply(u), a.decompose(c, y, m), { a: h, b: c };
|
|
451
|
-
}
|
|
452
|
-
function o(s, d, c, y) {
|
|
453
|
-
if (!n)
|
|
454
|
-
return;
|
|
455
|
-
const m = n[s];
|
|
456
|
-
if (!m)
|
|
457
|
-
return;
|
|
458
|
-
const { a: h, b: u } = l(m, y);
|
|
459
|
-
d.geometry.setPositions([h.toArray(), u.toArray()].flat()), c.position.set(u.x, u.y, u.z);
|
|
460
|
-
}
|
|
461
|
-
function p(s, d) {
|
|
462
|
-
a.identity();
|
|
463
|
-
for (let c = 0; c < Math.min(s.length, d.length); c++) {
|
|
464
|
-
const y = i.current[c], m = f.current[c];
|
|
465
|
-
y && m && o(c, y, m, d[c]);
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
return /* @__PURE__ */ r(
|
|
469
|
-
be,
|
|
470
|
-
{
|
|
471
|
-
rapidlyChangingMotionState: e,
|
|
472
|
-
dhParameters: n,
|
|
473
|
-
onRotationChanged: p,
|
|
474
|
-
children: /* @__PURE__ */ w("group", { ...t, name: "Scene", children: [
|
|
475
|
-
/* @__PURE__ */ w("mesh", { children: [
|
|
476
|
-
/* @__PURE__ */ r("sphereGeometry", { args: [0.01, 32, 32] }),
|
|
477
|
-
/* @__PURE__ */ r("meshStandardMaterial", { color: "black", depthTest: !0 })
|
|
478
|
-
] }),
|
|
479
|
-
n == null ? void 0 : n.map((s, d) => {
|
|
480
|
-
const { a: c, b: y } = l(
|
|
481
|
-
s,
|
|
482
|
-
e.joint_position[d] ?? 0
|
|
483
|
-
), m = `dhrobot_J0${d}`;
|
|
484
|
-
return /* @__PURE__ */ w("group", { name: m, children: [
|
|
485
|
-
/* @__PURE__ */ r(
|
|
486
|
-
H,
|
|
487
|
-
{
|
|
488
|
-
ref: (h) => {
|
|
489
|
-
i.current[d] = h;
|
|
490
|
-
},
|
|
491
|
-
name: Qe,
|
|
492
|
-
points: [c, y],
|
|
493
|
-
color: "white",
|
|
494
|
-
lineWidth: 5
|
|
495
|
-
}
|
|
496
|
-
),
|
|
497
|
-
/* @__PURE__ */ w(
|
|
498
|
-
"mesh",
|
|
499
|
-
{
|
|
500
|
-
ref: (h) => {
|
|
501
|
-
f.current[d] = h;
|
|
502
|
-
},
|
|
503
|
-
name: qe,
|
|
504
|
-
position: y,
|
|
505
|
-
children: [
|
|
506
|
-
/* @__PURE__ */ r("sphereGeometry", { args: [0.01, 32, 32] }),
|
|
507
|
-
/* @__PURE__ */ r("meshStandardMaterial", { color: "black", depthTest: !0 })
|
|
508
|
-
]
|
|
509
|
-
},
|
|
510
|
-
`mesh_${d}`
|
|
511
|
-
)
|
|
512
|
-
] }, m);
|
|
513
|
-
})
|
|
514
|
-
] })
|
|
515
|
-
}
|
|
516
|
-
);
|
|
517
|
-
}
|
|
518
|
-
const Xe = console.warn;
|
|
519
|
-
function xe() {
|
|
520
|
-
return I(() => {
|
|
521
|
-
console.warn = (e) => {
|
|
522
|
-
e !== "Cannot call the manual advancement of rafz whilst frameLoop is not set as demand" && Xe(e);
|
|
523
|
-
};
|
|
524
|
-
}, []), null;
|
|
525
|
-
}
|
|
526
|
-
function Ke(e) {
|
|
527
|
-
return e.type === "Mesh";
|
|
528
|
-
}
|
|
529
|
-
function Ze({
|
|
530
|
-
url: e,
|
|
531
|
-
flangeRef: n,
|
|
532
|
-
postModelRender: t,
|
|
533
|
-
...a
|
|
534
|
-
}) {
|
|
535
|
-
const i = Fe(e), l = He(i, "robot.glb").gltf, o = L(
|
|
536
|
-
(s) => {
|
|
537
|
-
s && t && t();
|
|
538
|
-
},
|
|
539
|
-
[t]
|
|
540
|
-
);
|
|
541
|
-
function p(s) {
|
|
542
|
-
try {
|
|
543
|
-
return Ke(s) ? s.geometry ? /* @__PURE__ */ r(
|
|
544
|
-
"mesh",
|
|
545
|
-
{
|
|
546
|
-
name: s.name,
|
|
547
|
-
geometry: s.geometry,
|
|
548
|
-
material: s.material,
|
|
549
|
-
position: s.position,
|
|
550
|
-
rotation: s.rotation
|
|
551
|
-
},
|
|
552
|
-
s.uuid
|
|
553
|
-
) : /* @__PURE__ */ r(
|
|
554
|
-
"group",
|
|
555
|
-
{
|
|
556
|
-
name: s.name,
|
|
557
|
-
position: s.position,
|
|
558
|
-
rotation: s.rotation
|
|
559
|
-
},
|
|
560
|
-
s.uuid
|
|
561
|
-
) : /* @__PURE__ */ r(
|
|
562
|
-
"group",
|
|
563
|
-
{
|
|
564
|
-
name: s.name,
|
|
565
|
-
position: s.position,
|
|
566
|
-
rotation: s.rotation,
|
|
567
|
-
ref: ge(s) ? n : void 0,
|
|
568
|
-
children: s.children.map(p)
|
|
569
|
-
},
|
|
570
|
-
s.uuid
|
|
571
|
-
);
|
|
572
|
-
} catch (d) {
|
|
573
|
-
return console.warn("Error rendering node", s.name, d), null;
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
return /* @__PURE__ */ r("group", { ...a, dispose: null, ref: o, children: p(l.scene) });
|
|
577
|
-
}
|
|
578
|
-
function we({
|
|
579
|
-
modelURL: e,
|
|
580
|
-
flangeRef: n,
|
|
581
|
-
postModelRender: t,
|
|
582
|
-
...a
|
|
583
|
-
}) {
|
|
584
|
-
const [i, f] = k(null);
|
|
585
|
-
return I(() => {
|
|
586
|
-
let l = !1;
|
|
587
|
-
return (async () => {
|
|
588
|
-
try {
|
|
589
|
-
const p = typeof e == "string" ? e : await e;
|
|
590
|
-
l || f((s) => s === p ? s : p);
|
|
591
|
-
} catch (p) {
|
|
592
|
-
console.error("Failed to resolve model URL:", p);
|
|
593
|
-
}
|
|
594
|
-
})(), () => {
|
|
595
|
-
l = !0;
|
|
596
|
-
};
|
|
597
|
-
}, [e]), i ? /* @__PURE__ */ r(
|
|
598
|
-
Ze,
|
|
599
|
-
{
|
|
600
|
-
url: i,
|
|
601
|
-
flangeRef: n,
|
|
602
|
-
postModelRender: t,
|
|
603
|
-
...a
|
|
604
|
-
}
|
|
605
|
-
) : null;
|
|
606
|
-
}
|
|
607
|
-
const Re = (e, n) => {
|
|
608
|
-
e.userData.isGhost || (e.traverse((t) => {
|
|
609
|
-
if (t instanceof x.Mesh) {
|
|
610
|
-
t.material instanceof x.Material && (t.material.colorWrite = !1);
|
|
611
|
-
const a = t.clone(), i = t.clone();
|
|
612
|
-
a.material = new x.MeshStandardMaterial({
|
|
613
|
-
depthTest: !0,
|
|
614
|
-
depthWrite: !0,
|
|
615
|
-
colorWrite: !1,
|
|
616
|
-
polygonOffset: !0,
|
|
617
|
-
polygonOffsetFactor: -1,
|
|
618
|
-
side: x.DoubleSide
|
|
619
|
-
}), a.userData.isGhost = !0, i.material = new x.MeshStandardMaterial({
|
|
620
|
-
color: n,
|
|
621
|
-
opacity: 0.3,
|
|
622
|
-
depthTest: !0,
|
|
623
|
-
depthWrite: !1,
|
|
624
|
-
transparent: !0,
|
|
625
|
-
polygonOffset: !0,
|
|
626
|
-
polygonOffsetFactor: -2,
|
|
627
|
-
side: x.DoubleSide
|
|
628
|
-
}), i.userData.isGhost = !0, t.parent && (t.parent.add(a), t.parent.add(i));
|
|
629
|
-
}
|
|
630
|
-
}), e.userData.isGhost = !0);
|
|
631
|
-
}, ve = (e) => {
|
|
632
|
-
if (!e.userData.isGhost) return;
|
|
633
|
-
const n = [];
|
|
634
|
-
e.traverse((t) => {
|
|
635
|
-
var a;
|
|
636
|
-
t instanceof x.Mesh && ((a = t.userData) != null && a.isGhost ? n.push(t) : t.material instanceof x.Material && (t.material.colorWrite = !0));
|
|
637
|
-
}), n.forEach((t) => {
|
|
638
|
-
t.parent && t.parent.remove(t);
|
|
639
|
-
}), e.userData.isGhost = !1;
|
|
640
|
-
}, Me = A(
|
|
641
|
-
({
|
|
642
|
-
rapidlyChangingMotionState: e,
|
|
643
|
-
modelFromController: n,
|
|
644
|
-
dhParameters: t,
|
|
645
|
-
chainOffsetPosition: a,
|
|
646
|
-
chainOffsetQuaternion: i,
|
|
647
|
-
getModel: f = W,
|
|
648
|
-
flangeRef: l,
|
|
649
|
-
postModelRender: o,
|
|
650
|
-
transparentColor: p,
|
|
651
|
-
instanceUrl: s,
|
|
652
|
-
...d
|
|
653
|
-
}) => {
|
|
654
|
-
const [c, y] = k(null), m = v(null), h = L((R) => {
|
|
655
|
-
y(R);
|
|
656
|
-
}, []), u = L(() => {
|
|
657
|
-
var R;
|
|
658
|
-
(R = m.current) == null || R.recollectJoints(), o == null || o();
|
|
659
|
-
}, [o]);
|
|
660
|
-
I(() => {
|
|
661
|
-
c && (p ? Re(c, p) : ve(c));
|
|
662
|
-
}, [c, p]);
|
|
663
|
-
const b = D(() => {
|
|
664
|
-
const R = f(n, s);
|
|
665
|
-
if (!R)
|
|
666
|
-
throw new Error(
|
|
667
|
-
`No model found for robot "${n}". Ensure the model is available or provide a custom getModel function.`
|
|
668
|
-
);
|
|
669
|
-
return R;
|
|
670
|
-
}, [n, s, f]), g = /* @__PURE__ */ r(
|
|
671
|
-
Ye,
|
|
672
|
-
{
|
|
673
|
-
rapidlyChangingMotionState: e,
|
|
674
|
-
dhParameters: t,
|
|
675
|
-
...d
|
|
676
|
-
}
|
|
677
|
-
);
|
|
678
|
-
return /* @__PURE__ */ w(
|
|
679
|
-
de,
|
|
680
|
-
{
|
|
681
|
-
fallback: g,
|
|
682
|
-
onError: (R) => {
|
|
683
|
-
console.warn(R);
|
|
684
|
-
},
|
|
685
|
-
children: [
|
|
686
|
-
/* @__PURE__ */ r(fe, { fallback: g, children: /* @__PURE__ */ r("group", { ref: h, children: /* @__PURE__ */ r(
|
|
687
|
-
be,
|
|
688
|
-
{
|
|
689
|
-
ref: m,
|
|
690
|
-
rapidlyChangingMotionState: e,
|
|
691
|
-
dhParameters: t,
|
|
692
|
-
chainOffsetPosition: a,
|
|
693
|
-
chainOffsetQuaternion: i,
|
|
694
|
-
children: /* @__PURE__ */ r(
|
|
695
|
-
we,
|
|
696
|
-
{
|
|
697
|
-
modelURL: b,
|
|
698
|
-
postModelRender: u,
|
|
699
|
-
flangeRef: l,
|
|
700
|
-
...d
|
|
701
|
-
}
|
|
702
|
-
)
|
|
703
|
-
}
|
|
704
|
-
) }) }),
|
|
705
|
-
/* @__PURE__ */ r(xe, {})
|
|
706
|
-
]
|
|
707
|
-
}
|
|
708
|
-
);
|
|
709
|
-
}
|
|
710
|
-
), ze = A(
|
|
711
|
-
({ rapidlyChangingMotionState: e, ...n }) => {
|
|
712
|
-
const t = Q(
|
|
713
|
-
e
|
|
714
|
-
);
|
|
715
|
-
return /* @__PURE__ */ r(
|
|
716
|
-
Me,
|
|
717
|
-
{
|
|
718
|
-
rapidlyChangingMotionState: t,
|
|
719
|
-
...n
|
|
720
|
-
}
|
|
721
|
-
);
|
|
722
|
-
}
|
|
723
|
-
);
|
|
724
|
-
function et({
|
|
725
|
-
connectedMotionGroup: e,
|
|
726
|
-
getModel: n = W,
|
|
727
|
-
flangeRef: t,
|
|
728
|
-
transparentColor: a,
|
|
729
|
-
postModelRender: i,
|
|
730
|
-
...f
|
|
731
|
-
}) {
|
|
732
|
-
if (!e.dhParameters)
|
|
733
|
-
return null;
|
|
734
|
-
const l = e.mountingPosition, o = e.mountingQuaternion;
|
|
735
|
-
return /* @__PURE__ */ r(
|
|
736
|
-
ze,
|
|
737
|
-
{
|
|
738
|
-
rapidlyChangingMotionState: e.rapidlyChangingMotionState,
|
|
739
|
-
modelFromController: e.modelFromController || "",
|
|
740
|
-
dhParameters: e.dhParameters,
|
|
741
|
-
getModel: n,
|
|
742
|
-
flangeRef: t,
|
|
743
|
-
transparentColor: a,
|
|
744
|
-
postModelRender: i,
|
|
745
|
-
chainOffsetPosition: l,
|
|
746
|
-
chainOffsetQuaternion: o,
|
|
747
|
-
...f
|
|
748
|
-
}
|
|
749
|
-
);
|
|
750
|
-
}
|
|
751
|
-
const _t = A(
|
|
752
|
-
Ce(
|
|
753
|
-
({
|
|
754
|
-
robotName: e,
|
|
755
|
-
programState: n,
|
|
756
|
-
safetyState: t,
|
|
757
|
-
operationMode: a,
|
|
758
|
-
driveToHomeEnabled: i = !1,
|
|
759
|
-
onDriveToHomePress: f,
|
|
760
|
-
onDriveToHomeRelease: l,
|
|
761
|
-
connectedMotionGroup: o,
|
|
762
|
-
robotComponent: p = et,
|
|
763
|
-
customContentComponent: s,
|
|
764
|
-
className: d
|
|
765
|
-
}) => {
|
|
766
|
-
var K;
|
|
767
|
-
const c = Ee(), { t: y } = je(), [m, h] = k(!1), u = v(null), b = v(null), [g, R] = k(!1), [O, F] = k({ width: 400, height: 600 }), [q, $] = k(0);
|
|
768
|
-
I(() => {
|
|
769
|
-
const j = () => {
|
|
770
|
-
if (b.current) {
|
|
771
|
-
const { offsetWidth: z, offsetHeight: ee } = b.current;
|
|
772
|
-
R(z > ee), F({ width: z, height: ee });
|
|
773
|
-
}
|
|
774
|
-
};
|
|
775
|
-
j();
|
|
776
|
-
const Z = new ResizeObserver(j);
|
|
777
|
-
return b.current && Z.observe(b.current), () => {
|
|
778
|
-
Z.disconnect();
|
|
779
|
-
};
|
|
780
|
-
}, []);
|
|
781
|
-
const Y = L(() => {
|
|
782
|
-
$((j) => j + 1);
|
|
783
|
-
}, []), E = L(() => {
|
|
784
|
-
!i || !f || (h(!0), f());
|
|
785
|
-
}, [i, f]), U = L(() => {
|
|
786
|
-
!i || !l || (h(!1), l());
|
|
787
|
-
}, [i, l]), X = L(() => {
|
|
788
|
-
m && l && (h(!1), l());
|
|
789
|
-
}, [m, l]), T = g ? O.width < 350 : O.height < 200, C = g ? O.height < 310 : O.height < 450;
|
|
790
|
-
return /* @__PURE__ */ r(
|
|
791
|
-
Ue,
|
|
792
|
-
{
|
|
793
|
-
ref: b,
|
|
794
|
-
className: d,
|
|
795
|
-
sx: {
|
|
796
|
-
width: "100%",
|
|
797
|
-
height: "100%",
|
|
798
|
-
display: "flex",
|
|
799
|
-
flexDirection: g ? "row" : "column",
|
|
800
|
-
position: "relative",
|
|
801
|
-
overflow: "hidden",
|
|
802
|
-
minWidth: { xs: 180, sm: 220, md: 250 },
|
|
803
|
-
minHeight: g ? { xs: 200, sm: 240, md: 260 } : { xs: 150, sm: 180, md: 220 },
|
|
804
|
-
// Allow progressive hiding in portrait mode
|
|
805
|
-
border: `1px solid ${c.palette.divider}`,
|
|
806
|
-
borderRadius: "18px",
|
|
807
|
-
boxShadow: "none",
|
|
808
|
-
backgroundColor: ((K = c.palette.backgroundPaperElevation) == null ? void 0 : K[8]) || "#292B3F",
|
|
809
|
-
backgroundImage: "none"
|
|
810
|
-
// Override any gradient from elevation
|
|
811
|
-
},
|
|
812
|
-
children: g ? /* @__PURE__ */ w(V, { children: [
|
|
813
|
-
/* @__PURE__ */ r(
|
|
814
|
-
S,
|
|
815
|
-
{
|
|
816
|
-
sx: {
|
|
817
|
-
flex: "0 0 50%",
|
|
818
|
-
position: "relative",
|
|
819
|
-
height: "100%",
|
|
820
|
-
minHeight: "100%",
|
|
821
|
-
maxHeight: "100%",
|
|
822
|
-
borderRadius: 1,
|
|
823
|
-
m: { xs: 1.5, sm: 2, md: 3 },
|
|
824
|
-
mr: { xs: 0.75, sm: 1, md: 1.5 },
|
|
825
|
-
overflow: "hidden",
|
|
826
|
-
// Prevent content from affecting container size
|
|
827
|
-
display: T ? "none" : "block"
|
|
828
|
-
},
|
|
829
|
-
children: !T && /* @__PURE__ */ w(
|
|
830
|
-
ie,
|
|
831
|
-
{
|
|
832
|
-
orthographic: !0,
|
|
833
|
-
camera: {
|
|
834
|
-
position: [3, 2, 3],
|
|
835
|
-
zoom: 1
|
|
836
|
-
},
|
|
837
|
-
shadows: !0,
|
|
838
|
-
frameloop: "demand",
|
|
839
|
-
style: {
|
|
840
|
-
borderRadius: c.shape.borderRadius,
|
|
841
|
-
width: "100%",
|
|
842
|
-
height: "100%",
|
|
843
|
-
background: "transparent",
|
|
844
|
-
position: "absolute",
|
|
845
|
-
top: 0,
|
|
846
|
-
left: 0
|
|
847
|
-
},
|
|
848
|
-
dpr: [1, 2],
|
|
849
|
-
gl: { alpha: !0, antialias: !0 },
|
|
850
|
-
children: [
|
|
851
|
-
/* @__PURE__ */ r(ae, {}),
|
|
852
|
-
/* @__PURE__ */ r(te, { fit: !0, observe: !0, margin: 1, maxDuration: 1, children: /* @__PURE__ */ r(
|
|
853
|
-
p,
|
|
854
|
-
{
|
|
855
|
-
connectedMotionGroup: o,
|
|
856
|
-
postModelRender: Y
|
|
857
|
-
}
|
|
858
|
-
) })
|
|
859
|
-
]
|
|
860
|
-
}
|
|
861
|
-
)
|
|
862
|
-
}
|
|
863
|
-
),
|
|
864
|
-
/* @__PURE__ */ w(
|
|
865
|
-
S,
|
|
866
|
-
{
|
|
867
|
-
sx: {
|
|
868
|
-
flex: "1",
|
|
869
|
-
display: "flex",
|
|
870
|
-
flexDirection: "column",
|
|
871
|
-
justifyContent: "flex-start",
|
|
872
|
-
width: T ? "100%" : "50%"
|
|
873
|
-
},
|
|
874
|
-
children: [
|
|
875
|
-
/* @__PURE__ */ w(
|
|
876
|
-
S,
|
|
877
|
-
{
|
|
878
|
-
sx: {
|
|
879
|
-
p: { xs: 1.5, sm: 2, md: 3 },
|
|
880
|
-
pb: { xs: 1, sm: 1.5, md: 2 },
|
|
881
|
-
textAlign: "left"
|
|
882
|
-
},
|
|
883
|
-
children: [
|
|
884
|
-
/* @__PURE__ */ r(oe, { variant: "h6", component: "h2", sx: { mb: 1 }, children: e }),
|
|
885
|
-
/* @__PURE__ */ r(
|
|
886
|
-
se,
|
|
887
|
-
{
|
|
888
|
-
programState: n,
|
|
889
|
-
safetyState: t,
|
|
890
|
-
operationMode: a
|
|
891
|
-
}
|
|
892
|
-
)
|
|
893
|
-
]
|
|
894
|
-
}
|
|
895
|
-
),
|
|
896
|
-
/* @__PURE__ */ w(
|
|
897
|
-
S,
|
|
898
|
-
{
|
|
899
|
-
sx: {
|
|
900
|
-
p: { xs: 1.5, sm: 2, md: 3 },
|
|
901
|
-
pt: 0,
|
|
902
|
-
flex: "1",
|
|
903
|
-
display: "flex",
|
|
904
|
-
flexDirection: "column",
|
|
905
|
-
justifyContent: "space-between"
|
|
906
|
-
},
|
|
907
|
-
children: [
|
|
908
|
-
!C && s && /* @__PURE__ */ w(S, { children: [
|
|
909
|
-
/* @__PURE__ */ r(s, {}),
|
|
910
|
-
/* @__PURE__ */ r(
|
|
911
|
-
re,
|
|
912
|
-
{
|
|
913
|
-
sx: {
|
|
914
|
-
mt: 1,
|
|
915
|
-
mb: 0,
|
|
916
|
-
borderColor: c.palette.divider,
|
|
917
|
-
opacity: 0.5
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
)
|
|
921
|
-
] }),
|
|
922
|
-
/* @__PURE__ */ r(
|
|
923
|
-
S,
|
|
924
|
-
{
|
|
925
|
-
sx: {
|
|
926
|
-
mt: !C && s ? "auto" : 0
|
|
927
|
-
},
|
|
928
|
-
children: /* @__PURE__ */ r(
|
|
929
|
-
S,
|
|
930
|
-
{
|
|
931
|
-
sx: {
|
|
932
|
-
display: "flex",
|
|
933
|
-
justifyContent: "flex-start",
|
|
934
|
-
mt: { xs: 1, sm: 1.5, md: 2 },
|
|
935
|
-
mb: { xs: 0.5, sm: 0.75, md: 1 }
|
|
936
|
-
},
|
|
937
|
-
children: /* @__PURE__ */ r(
|
|
938
|
-
ne,
|
|
939
|
-
{
|
|
940
|
-
ref: u,
|
|
941
|
-
variant: "contained",
|
|
942
|
-
color: "secondary",
|
|
943
|
-
size: "small",
|
|
944
|
-
disabled: !i,
|
|
945
|
-
onMouseDown: E,
|
|
946
|
-
onMouseUp: U,
|
|
947
|
-
onMouseLeave: X,
|
|
948
|
-
onTouchStart: E,
|
|
949
|
-
onTouchEnd: U,
|
|
950
|
-
sx: {
|
|
951
|
-
textTransform: "none",
|
|
952
|
-
px: 1.5,
|
|
953
|
-
py: 0.5
|
|
954
|
-
},
|
|
955
|
-
children: y("RobotCard.DriveToHome.bt")
|
|
956
|
-
}
|
|
957
|
-
)
|
|
958
|
-
}
|
|
959
|
-
)
|
|
960
|
-
}
|
|
961
|
-
)
|
|
962
|
-
]
|
|
963
|
-
}
|
|
964
|
-
)
|
|
965
|
-
]
|
|
966
|
-
}
|
|
967
|
-
)
|
|
968
|
-
] }) : /* @__PURE__ */ r(V, { children: /* @__PURE__ */ w(
|
|
969
|
-
S,
|
|
970
|
-
{
|
|
971
|
-
sx: {
|
|
972
|
-
p: 3,
|
|
973
|
-
height: "100%",
|
|
974
|
-
display: "flex",
|
|
975
|
-
flexDirection: "column"
|
|
976
|
-
},
|
|
977
|
-
children: [
|
|
978
|
-
/* @__PURE__ */ w(S, { children: [
|
|
979
|
-
/* @__PURE__ */ r(oe, { variant: "h6", component: "h2", sx: { mb: 1 }, children: e }),
|
|
980
|
-
/* @__PURE__ */ r(
|
|
981
|
-
se,
|
|
982
|
-
{
|
|
983
|
-
programState: n,
|
|
984
|
-
safetyState: t,
|
|
985
|
-
operationMode: a
|
|
986
|
-
}
|
|
987
|
-
)
|
|
988
|
-
] }),
|
|
989
|
-
/* @__PURE__ */ r(
|
|
990
|
-
S,
|
|
991
|
-
{
|
|
992
|
-
sx: {
|
|
993
|
-
flex: T ? 0 : 1,
|
|
994
|
-
position: "relative",
|
|
995
|
-
minHeight: T ? 0 : { xs: 120, sm: 150, md: 200 },
|
|
996
|
-
height: T ? 0 : "auto",
|
|
997
|
-
borderRadius: 1,
|
|
998
|
-
overflow: "hidden",
|
|
999
|
-
display: T ? "none" : "block"
|
|
1000
|
-
},
|
|
1001
|
-
children: !T && /* @__PURE__ */ w(
|
|
1002
|
-
ie,
|
|
1003
|
-
{
|
|
1004
|
-
orthographic: !0,
|
|
1005
|
-
camera: {
|
|
1006
|
-
position: [3, 2, 3],
|
|
1007
|
-
zoom: 1
|
|
1008
|
-
},
|
|
1009
|
-
shadows: !0,
|
|
1010
|
-
frameloop: "demand",
|
|
1011
|
-
style: {
|
|
1012
|
-
borderRadius: c.shape.borderRadius,
|
|
1013
|
-
width: "100%",
|
|
1014
|
-
height: "100%",
|
|
1015
|
-
background: "transparent",
|
|
1016
|
-
position: "absolute"
|
|
1017
|
-
},
|
|
1018
|
-
dpr: [1, 2],
|
|
1019
|
-
gl: { alpha: !0, antialias: !0 },
|
|
1020
|
-
children: [
|
|
1021
|
-
/* @__PURE__ */ r(ae, {}),
|
|
1022
|
-
/* @__PURE__ */ r(te, { fit: !0, clip: !0, observe: !0, margin: 1, maxDuration: 1, children: /* @__PURE__ */ r(
|
|
1023
|
-
p,
|
|
1024
|
-
{
|
|
1025
|
-
connectedMotionGroup: o,
|
|
1026
|
-
postModelRender: Y
|
|
1027
|
-
}
|
|
1028
|
-
) })
|
|
1029
|
-
]
|
|
1030
|
-
}
|
|
1031
|
-
)
|
|
1032
|
-
}
|
|
1033
|
-
),
|
|
1034
|
-
/* @__PURE__ */ w(S, { children: [
|
|
1035
|
-
!C && s && /* @__PURE__ */ w(V, { children: [
|
|
1036
|
-
/* @__PURE__ */ r(s, {}),
|
|
1037
|
-
/* @__PURE__ */ r(
|
|
1038
|
-
re,
|
|
1039
|
-
{
|
|
1040
|
-
sx: {
|
|
1041
|
-
mt: 1,
|
|
1042
|
-
mb: 0,
|
|
1043
|
-
borderColor: c.palette.divider,
|
|
1044
|
-
opacity: 0.5
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
)
|
|
1048
|
-
] }),
|
|
1049
|
-
/* @__PURE__ */ r(
|
|
1050
|
-
S,
|
|
1051
|
-
{
|
|
1052
|
-
sx: {
|
|
1053
|
-
display: "flex",
|
|
1054
|
-
justifyContent: "flex-start",
|
|
1055
|
-
mt: !C && s ? { xs: 1, sm: 2, md: 5 } : { xs: 0.5, sm: 1, md: 2 },
|
|
1056
|
-
mb: { xs: 0.5, sm: 0.75, md: 1 }
|
|
1057
|
-
},
|
|
1058
|
-
children: /* @__PURE__ */ r(
|
|
1059
|
-
ne,
|
|
1060
|
-
{
|
|
1061
|
-
ref: u,
|
|
1062
|
-
variant: "contained",
|
|
1063
|
-
color: "secondary",
|
|
1064
|
-
size: "small",
|
|
1065
|
-
disabled: !i,
|
|
1066
|
-
onMouseDown: E,
|
|
1067
|
-
onMouseUp: U,
|
|
1068
|
-
onMouseLeave: X,
|
|
1069
|
-
onTouchStart: E,
|
|
1070
|
-
onTouchEnd: U,
|
|
1071
|
-
sx: {
|
|
1072
|
-
textTransform: "none",
|
|
1073
|
-
px: 1.5,
|
|
1074
|
-
py: 0.5
|
|
1075
|
-
},
|
|
1076
|
-
children: y("RobotCard.DriveToHome.bt")
|
|
1077
|
-
}
|
|
1078
|
-
)
|
|
1079
|
-
}
|
|
1080
|
-
)
|
|
1081
|
-
] })
|
|
1082
|
-
]
|
|
1083
|
-
}
|
|
1084
|
-
) })
|
|
1085
|
-
}
|
|
1086
|
-
);
|
|
1087
|
-
}
|
|
1088
|
-
)
|
|
1089
|
-
), Tt = Array(6).fill(2 * Math.PI);
|
|
1090
|
-
function Se({
|
|
1091
|
-
rapidlyChangingMotionState: e,
|
|
1092
|
-
dhParameters: n,
|
|
1093
|
-
chainOffsetPosition: t,
|
|
1094
|
-
chainOffsetQuaternion: a,
|
|
1095
|
-
onTranslationChanged: i,
|
|
1096
|
-
children: f
|
|
1097
|
-
}) {
|
|
1098
|
-
const l = v([]), o = v(
|
|
1099
|
-
e.joint_position.filter(
|
|
1100
|
-
(m) => m !== void 0
|
|
1101
|
-
)
|
|
1102
|
-
), { invalidate: p } = he(), s = v(e);
|
|
1103
|
-
s.current = e;
|
|
1104
|
-
function d(m) {
|
|
1105
|
-
m && (l.current = me(m), c(), p());
|
|
1106
|
-
}
|
|
1107
|
-
function c() {
|
|
1108
|
-
const m = o.current;
|
|
1109
|
-
if (i)
|
|
1110
|
-
i(l.current, m);
|
|
1111
|
-
else
|
|
1112
|
-
for (const [h, u] of l.current.entries()) {
|
|
1113
|
-
const g = n[h].reverse_rotation_direction ? -1 : 1;
|
|
1114
|
-
u.position.y = g * (m[h] || 0) / 1e3;
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
function y(m) {
|
|
1118
|
-
o.current = m.joint_position.filter(
|
|
1119
|
-
(h) => h !== void 0
|
|
1120
|
-
), c(), p();
|
|
1121
|
-
}
|
|
1122
|
-
return pe(() => {
|
|
1123
|
-
y(s.current);
|
|
1124
|
-
}), /* @__PURE__ */ r(
|
|
1125
|
-
"group",
|
|
1126
|
-
{
|
|
1127
|
-
ref: d,
|
|
1128
|
-
position: t,
|
|
1129
|
-
quaternion: a,
|
|
1130
|
-
children: f
|
|
1131
|
-
}
|
|
1132
|
-
);
|
|
1133
|
-
}
|
|
1134
|
-
function _e({
|
|
1135
|
-
rapidlyChangingMotionState: e,
|
|
1136
|
-
dhParameters: n,
|
|
1137
|
-
...t
|
|
1138
|
-
}) {
|
|
1139
|
-
const a = new M(), i = v(null), f = v(null);
|
|
1140
|
-
function l(s) {
|
|
1141
|
-
const d = new M();
|
|
1142
|
-
for (let h = 0; h < n.length; h++) {
|
|
1143
|
-
const u = n[h], b = s[h] ?? 0, g = new M().makeRotationY(u.theta).multiply(
|
|
1144
|
-
new M().makeTranslation(
|
|
1145
|
-
u.a / 1e3,
|
|
1146
|
-
(u.d + b * (u.reverse_rotation_direction ? -1 : 1)) / 1e3,
|
|
1147
|
-
0
|
|
1148
|
-
)
|
|
1149
|
-
).multiply(new M().makeRotationX(u.alpha));
|
|
1150
|
-
d.multiply(g);
|
|
1151
|
-
}
|
|
1152
|
-
const c = new P(), y = new N(), m = new P();
|
|
1153
|
-
return d.decompose(c, y, m), c;
|
|
1154
|
-
}
|
|
1155
|
-
const o = l(
|
|
1156
|
-
e.joint_position
|
|
1157
|
-
);
|
|
1158
|
-
function p(s, d) {
|
|
1159
|
-
a.identity();
|
|
1160
|
-
let c = new P();
|
|
1161
|
-
for (let u = 0; u < n.length; u++) {
|
|
1162
|
-
const b = d[u] ?? 0, g = n[u], R = new M().makeRotationY(g.theta).multiply(
|
|
1163
|
-
new M().makeTranslation(
|
|
1164
|
-
g.a / 1e3,
|
|
1165
|
-
(g.d + b * (g.reverse_rotation_direction ? -1 : 1)) / 1e3,
|
|
1166
|
-
0
|
|
1167
|
-
)
|
|
1168
|
-
).multiply(new M().makeRotationX(g.alpha));
|
|
1169
|
-
a.multiply(R);
|
|
1170
|
-
}
|
|
1171
|
-
const y = new P(), m = new N(), h = new P();
|
|
1172
|
-
if (a.decompose(y, m, h), c = y, i.current && i.current.position.set(
|
|
1173
|
-
c.x,
|
|
1174
|
-
c.y,
|
|
1175
|
-
c.z
|
|
1176
|
-
), f.current) {
|
|
1177
|
-
const u = f.current.geometry;
|
|
1178
|
-
u != null && u.setPositions && u.setPositions([
|
|
1179
|
-
0,
|
|
1180
|
-
0,
|
|
1181
|
-
0,
|
|
1182
|
-
c.x,
|
|
1183
|
-
c.y,
|
|
1184
|
-
c.z
|
|
1185
|
-
]);
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
return /* @__PURE__ */ r(
|
|
1189
|
-
Se,
|
|
1190
|
-
{
|
|
1191
|
-
rapidlyChangingMotionState: e,
|
|
1192
|
-
dhParameters: n,
|
|
1193
|
-
onTranslationChanged: p,
|
|
1194
|
-
children: /* @__PURE__ */ w("group", { ...t, name: "Scene", children: [
|
|
1195
|
-
/* @__PURE__ */ w("mesh", { name: "Base", position: [0, 0, 0], children: [
|
|
1196
|
-
/* @__PURE__ */ r("sphereGeometry", { args: [0.02, 32, 32] }),
|
|
1197
|
-
/* @__PURE__ */ r("meshStandardMaterial", { color: "green", depthTest: !0 })
|
|
1198
|
-
] }),
|
|
1199
|
-
/* @__PURE__ */ r(
|
|
1200
|
-
H,
|
|
1201
|
-
{
|
|
1202
|
-
ref: f,
|
|
1203
|
-
points: [new P(0, 0, 0), o],
|
|
1204
|
-
color: "White",
|
|
1205
|
-
lineWidth: 5
|
|
1206
|
-
}
|
|
1207
|
-
),
|
|
1208
|
-
/* @__PURE__ */ w("mesh", { ref: i, name: "TCP", position: o, children: [
|
|
1209
|
-
/* @__PURE__ */ r("sphereGeometry", { args: [0.025, 32, 32] }),
|
|
1210
|
-
/* @__PURE__ */ r("meshStandardMaterial", { color: "red", depthTest: !0 })
|
|
1211
|
-
] })
|
|
1212
|
-
] })
|
|
1213
|
-
}
|
|
1214
|
-
);
|
|
1215
|
-
}
|
|
1216
|
-
const Te = A(
|
|
1217
|
-
({
|
|
1218
|
-
rapidlyChangingMotionState: e,
|
|
1219
|
-
modelFromController: n,
|
|
1220
|
-
dhParameters: t,
|
|
1221
|
-
chainOffsetPosition: a,
|
|
1222
|
-
chainOffsetQuaternion: i,
|
|
1223
|
-
getModel: f = W,
|
|
1224
|
-
flangeRef: l,
|
|
1225
|
-
postModelRender: o,
|
|
1226
|
-
transparentColor: p,
|
|
1227
|
-
instanceUrl: s,
|
|
1228
|
-
...d
|
|
1229
|
-
}) => {
|
|
1230
|
-
const [c, y] = k(null), m = L((u) => {
|
|
1231
|
-
y(u);
|
|
1232
|
-
}, []);
|
|
1233
|
-
I(() => {
|
|
1234
|
-
c && (p ? Re(c, p) : ve(c));
|
|
1235
|
-
}, [c, p]);
|
|
1236
|
-
const h = /* @__PURE__ */ r(
|
|
1237
|
-
_e,
|
|
1238
|
-
{
|
|
1239
|
-
rapidlyChangingMotionState: e,
|
|
1240
|
-
dhParameters: t,
|
|
1241
|
-
...d
|
|
1242
|
-
}
|
|
1243
|
-
);
|
|
1244
|
-
return /* @__PURE__ */ w(
|
|
1245
|
-
de,
|
|
1246
|
-
{
|
|
1247
|
-
fallback: h,
|
|
1248
|
-
onError: (u) => {
|
|
1249
|
-
console.warn(u);
|
|
1250
|
-
},
|
|
1251
|
-
children: [
|
|
1252
|
-
/* @__PURE__ */ r(fe, { fallback: h, children: /* @__PURE__ */ r("group", { ref: m, children: /* @__PURE__ */ r(
|
|
1253
|
-
Se,
|
|
1254
|
-
{
|
|
1255
|
-
rapidlyChangingMotionState: e,
|
|
1256
|
-
dhParameters: t,
|
|
1257
|
-
chainOffsetPosition: a,
|
|
1258
|
-
chainOffsetQuaternion: i,
|
|
1259
|
-
children: /* @__PURE__ */ r(
|
|
1260
|
-
we,
|
|
1261
|
-
{
|
|
1262
|
-
modelURL: (() => {
|
|
1263
|
-
const u = f(n, s);
|
|
1264
|
-
if (!u) {
|
|
1265
|
-
const b = new Blob([], { type: "model/gltf-binary" }), g = new File(
|
|
1266
|
-
[b],
|
|
1267
|
-
`${n}.glb`,
|
|
1268
|
-
{ type: "model/gltf-binary" }
|
|
1269
|
-
);
|
|
1270
|
-
return Promise.resolve(URL.createObjectURL(g));
|
|
1271
|
-
}
|
|
1272
|
-
return u;
|
|
1273
|
-
})(),
|
|
1274
|
-
postModelRender: o,
|
|
1275
|
-
flangeRef: l,
|
|
1276
|
-
...d
|
|
1277
|
-
}
|
|
1278
|
-
)
|
|
1279
|
-
}
|
|
1280
|
-
) }) }),
|
|
1281
|
-
/* @__PURE__ */ r(xe, {})
|
|
1282
|
-
]
|
|
1283
|
-
}
|
|
1284
|
-
);
|
|
1285
|
-
}
|
|
1286
|
-
), tt = A(
|
|
1287
|
-
({ rapidlyChangingMotionState: e, ...n }) => {
|
|
1288
|
-
const t = Q(
|
|
1289
|
-
e
|
|
1290
|
-
);
|
|
1291
|
-
return /* @__PURE__ */ r(
|
|
1292
|
-
Te,
|
|
1293
|
-
{
|
|
1294
|
-
rapidlyChangingMotionState: t,
|
|
1295
|
-
...n
|
|
1296
|
-
}
|
|
1297
|
-
);
|
|
1298
|
-
}
|
|
1299
|
-
);
|
|
1300
|
-
function Pt({
|
|
1301
|
-
connectedMotionGroup: e,
|
|
1302
|
-
getModel: n = W,
|
|
1303
|
-
flangeRef: t,
|
|
1304
|
-
transparentColor: a,
|
|
1305
|
-
postModelRender: i,
|
|
1306
|
-
...f
|
|
1307
|
-
}) {
|
|
1308
|
-
if (!e.dhParameters)
|
|
1309
|
-
return null;
|
|
1310
|
-
const l = e.mountingPosition, o = e.mountingQuaternion, p = e.modelFromController || "";
|
|
1311
|
-
return p && n(p) ? /* @__PURE__ */ r(
|
|
1312
|
-
tt,
|
|
1313
|
-
{
|
|
1314
|
-
rapidlyChangingMotionState: e.rapidlyChangingMotionState,
|
|
1315
|
-
modelFromController: p,
|
|
1316
|
-
dhParameters: e.dhParameters,
|
|
1317
|
-
getModel: n,
|
|
1318
|
-
flangeRef: t,
|
|
1319
|
-
transparentColor: a,
|
|
1320
|
-
postModelRender: i,
|
|
1321
|
-
chainOffsetPosition: l,
|
|
1322
|
-
chainOffsetQuaternion: o,
|
|
1323
|
-
...f
|
|
1324
|
-
}
|
|
1325
|
-
) : /* @__PURE__ */ r(
|
|
1326
|
-
_e,
|
|
1327
|
-
{
|
|
1328
|
-
rapidlyChangingMotionState: e.rapidlyChangingMotionState,
|
|
1329
|
-
dhParameters: e.dhParameters,
|
|
1330
|
-
chainOffsetPosition: l,
|
|
1331
|
-
chainOffsetQuaternion: o,
|
|
1332
|
-
...f
|
|
1333
|
-
}
|
|
1334
|
-
);
|
|
1335
|
-
}
|
|
1336
|
-
const le = {
|
|
1337
|
-
[_.Abb]: [0, 0, 0, 0, Math.PI / 2, 0, 0],
|
|
1338
|
-
[_.Fanuc]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
|
|
1339
|
-
[_.Yaskawa]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
|
|
1340
|
-
[_.Kuka]: [
|
|
1341
|
-
0,
|
|
1342
|
-
-Math.PI / 2,
|
|
1343
|
-
Math.PI / 2,
|
|
1344
|
-
0,
|
|
1345
|
-
Math.PI / 2,
|
|
1346
|
-
0,
|
|
1347
|
-
0
|
|
1348
|
-
],
|
|
1349
|
-
[_.Universalrobots]: [
|
|
1350
|
-
0,
|
|
1351
|
-
-Math.PI / 2,
|
|
1352
|
-
-Math.PI / 2,
|
|
1353
|
-
-Math.PI / 2,
|
|
1354
|
-
Math.PI / 2,
|
|
1355
|
-
-Math.PI / 2,
|
|
1356
|
-
0
|
|
1357
|
-
],
|
|
1358
|
-
[_.Staubli]: [0, -Math.PI / 2, Math.PI / 2, 0, 0, 0, 0]
|
|
1359
|
-
};
|
|
1360
|
-
function nt(e) {
|
|
1361
|
-
const [n] = e.split("_");
|
|
1362
|
-
switch (n) {
|
|
1363
|
-
case "ABB":
|
|
1364
|
-
return _.Abb;
|
|
1365
|
-
case "FANUC":
|
|
1366
|
-
return _.Fanuc;
|
|
1367
|
-
case "YASKAWA":
|
|
1368
|
-
return _.Yaskawa;
|
|
1369
|
-
case "KUKA":
|
|
1370
|
-
return _.Kuka;
|
|
1371
|
-
case "UniversalRobots":
|
|
1372
|
-
return _.Universalrobots;
|
|
1373
|
-
case "STAUBLI":
|
|
1374
|
-
return _.Staubli;
|
|
1375
|
-
default:
|
|
1376
|
-
return null;
|
|
1377
|
-
}
|
|
1378
|
-
}
|
|
1379
|
-
function kt(e, n) {
|
|
1380
|
-
const t = nt(e);
|
|
1381
|
-
return t && t in le ? le[t] : n || null;
|
|
1382
|
-
}
|
|
1383
|
-
const rt = A((e) => {
|
|
1384
|
-
const { inverseSolver: n, dhParameters: t, ...a } = e, [i, f] = k(
|
|
1385
|
-
B.RevoluteJoint
|
|
1386
|
-
);
|
|
1387
|
-
I(() => {
|
|
1388
|
-
t.length && f(t[0].type ?? B.RevoluteJoint);
|
|
1389
|
-
}, [t]);
|
|
1390
|
-
const l = D(() => n === null && i === B.RevoluteJoint, [n, i]), o = D(() => n === null && i === B.PrismaticJoint, [n, i]);
|
|
1391
|
-
return D(() => !!n, [n]) || l ? /* @__PURE__ */ r(Me, { dhParameters: t, ...a }) : o ? /* @__PURE__ */ r(Te, { dhParameters: t, ...a }) : null;
|
|
1392
|
-
}), Lt = A((e) => {
|
|
1393
|
-
const n = Q(
|
|
1394
|
-
e.rapidlyChangingMotionState
|
|
1395
|
-
);
|
|
1396
|
-
return /* @__PURE__ */ r(
|
|
1397
|
-
rt,
|
|
1398
|
-
{
|
|
1399
|
-
...e,
|
|
1400
|
-
rapidlyChangingMotionState: n
|
|
1401
|
-
}
|
|
1402
|
-
);
|
|
1403
|
-
});
|
|
1404
|
-
export {
|
|
1405
|
-
vt as C,
|
|
1406
|
-
Pt as L,
|
|
1407
|
-
le as M,
|
|
1408
|
-
ae as P,
|
|
1409
|
-
et as R,
|
|
1410
|
-
Mt as S,
|
|
1411
|
-
St as T,
|
|
1412
|
-
Lt as a,
|
|
1413
|
-
rt as b,
|
|
1414
|
-
_t as c,
|
|
1415
|
-
tt as d,
|
|
1416
|
-
Te as e,
|
|
1417
|
-
ze as f,
|
|
1418
|
-
Me as g,
|
|
1419
|
-
Tt as h,
|
|
1420
|
-
W as i,
|
|
1421
|
-
nt as j,
|
|
1422
|
-
kt as k
|
|
1423
|
-
};
|