@wandelbots/wandelbots-js-react-components 4.7.1 → 4.7.2-pr.dev-RB-3348-v1-clean-up.560.cbf9c17

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