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