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