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