@wandelbots/wandelbots-js-react-components 3.7.2 → 3.7.4-pr.feat-add-linear-axis-support.509.8e469ba
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/README.md +46 -0
- package/dist/3d.cjs.js +1 -1
- package/dist/3d.d.ts +2 -1
- package/dist/3d.d.ts.map +1 -1
- package/dist/3d.es.js +8 -7
- package/dist/{LoadingCover-Dr9hDTku.js → LoadingCover-6gWr11KP.js} +11 -10
- package/dist/{LoadingCover-Dr9hDTku.js.map → LoadingCover-6gWr11KP.js.map} +1 -1
- package/dist/LoadingCover-CukpS_aj.cjs +2 -0
- package/dist/{LoadingCover-r2yhJZF9.cjs.map → LoadingCover-CukpS_aj.cjs.map} +1 -1
- package/dist/SupportedLinearAxis-Cc5zohcs.cjs +2 -0
- package/dist/SupportedLinearAxis-Cc5zohcs.cjs.map +1 -0
- package/dist/SupportedLinearAxis-DAK0IyqZ.js +1228 -0
- package/dist/SupportedLinearAxis-DAK0IyqZ.js.map +1 -0
- package/dist/{WandelscriptEditor-DnJvITTA.js → WandelscriptEditor-7eN-Yw7m.js} +3 -3
- package/dist/{WandelscriptEditor-DnJvITTA.js.map → WandelscriptEditor-7eN-Yw7m.js.map} +1 -1
- package/dist/WandelscriptEditor-D6_vS5Uk.cjs +2 -0
- package/dist/{WandelscriptEditor-Dj7TBCkF.cjs.map → WandelscriptEditor-D6_vS5Uk.cjs.map} +1 -1
- package/dist/auth0-spa-js.production.esm-D_IhPirK.cjs +5 -0
- package/dist/auth0-spa-js.production.esm-D_IhPirK.cjs.map +1 -0
- package/dist/auth0-spa-js.production.esm-mvPojIrB.js +4043 -0
- package/dist/auth0-spa-js.production.esm-mvPojIrB.js.map +1 -0
- package/dist/components/RobotCard.d.ts +1 -1
- package/dist/components/RobotCard.d.ts.map +1 -1
- package/dist/components/robots/DHLinearAxis.d.ts +3 -0
- package/dist/components/robots/DHLinearAxis.d.ts.map +1 -0
- package/dist/components/robots/GenericRobot.d.ts +2 -2
- package/dist/components/robots/GenericRobot.d.ts.map +1 -1
- package/dist/components/robots/LinearAxis.d.ts +25 -0
- package/dist/components/robots/LinearAxis.d.ts.map +1 -0
- package/dist/components/robots/LinearAxisAnimator.d.ts +12 -0
- package/dist/components/robots/LinearAxisAnimator.d.ts.map +1 -0
- package/dist/components/robots/Robot.d.ts +3 -1
- package/dist/components/robots/Robot.d.ts.map +1 -1
- package/dist/components/robots/SupportedLinearAxis.d.ts +18 -0
- package/dist/components/robots/SupportedLinearAxis.d.ts.map +1 -0
- package/dist/components/robots/SupportedRobot.d.ts +1 -1
- package/dist/components/robots/SupportedRobot.d.ts.map +1 -1
- package/dist/components/robots/robotModelLogic.d.ts +11 -1
- package/dist/components/robots/robotModelLogic.d.ts.map +1 -1
- package/dist/core.cjs.js +1 -1
- package/dist/core.es.js +4 -4
- package/dist/externalizeComponent-CkVWk2F_.cjs +24 -0
- package/dist/externalizeComponent-CkVWk2F_.cjs.map +1 -0
- package/dist/externalizeComponent-Dc3fViZA.js +489 -0
- package/dist/externalizeComponent-Dc3fViZA.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +58 -57
- package/dist/interpolation-DZhBKo-u.cjs +20 -0
- package/dist/interpolation-DZhBKo-u.cjs.map +1 -0
- package/dist/interpolation-baUmFLkh.js +6924 -0
- package/dist/interpolation-baUmFLkh.js.map +1 -0
- package/dist/lib/JoggerConnection.d.ts.map +1 -1
- package/dist/{theming-DxiD0Q3m.js → theming-BTlS2afw.js} +4951 -6394
- package/dist/theming-BTlS2afw.js.map +1 -0
- package/dist/theming-DPoEjzxv.cjs +115 -0
- package/dist/theming-DPoEjzxv.cjs.map +1 -0
- package/dist/wandelscript.cjs.js +1 -1
- package/dist/wandelscript.es.js +1 -1
- package/package.json +16 -6
- package/src/3d.ts +3 -2
- package/src/components/RobotCard.tsx +1 -1
- package/src/components/robots/DHLinearAxis.tsx +128 -0
- package/src/components/robots/GenericRobot.tsx +97 -36
- package/src/components/robots/LinearAxis.tsx +73 -0
- package/src/components/robots/LinearAxisAnimator.tsx +115 -0
- package/src/components/robots/Robot.tsx +3 -1
- package/src/components/robots/RobotAnimator.test.tsx +1 -1
- package/src/components/robots/SupportedLinearAxis.tsx +99 -0
- package/src/components/robots/SupportedRobot.tsx +11 -3
- package/src/components/robots/robotModelLogic.ts +75 -6
- package/src/env.d.ts +3 -0
- package/src/lib/JoggerConnection.ts +10 -10
- package/src/lib/MotionStreamConnection.ts +1 -1
- package/dist/LoadingCover-r2yhJZF9.cjs +0 -2
- package/dist/WandelscriptEditor-Dj7TBCkF.cjs +0 -2
- package/dist/auth0-spa-js.production.esm-DL9f1uDJ.js +0 -1438
- package/dist/auth0-spa-js.production.esm-DL9f1uDJ.js.map +0 -1
- package/dist/auth0-spa-js.production.esm-DTiWXa87.cjs +0 -5
- package/dist/auth0-spa-js.production.esm-DTiWXa87.cjs.map +0 -1
- package/dist/index-CAib4NKw.js +0 -2261
- package/dist/index-CAib4NKw.js.map +0 -1
- package/dist/index-CqMZL0FV.cjs +0 -2
- package/dist/index-CqMZL0FV.cjs.map +0 -1
- package/dist/index-CxasuX80.js +0 -5212
- package/dist/index-CxasuX80.js.map +0 -1
- package/dist/index-DxwppshT.cjs +0 -29
- package/dist/index-DxwppshT.cjs.map +0 -1
- package/dist/manufacturerHomePositions-BW0KbWeg.js +0 -980
- package/dist/manufacturerHomePositions-BW0KbWeg.js.map +0 -1
- package/dist/manufacturerHomePositions-r9dAEtsx.cjs +0 -2
- package/dist/manufacturerHomePositions-r9dAEtsx.cjs.map +0 -1
- package/dist/theming-CKlFOjJ_.cjs +0 -133
- package/dist/theming-CKlFOjJ_.cjs.map +0 -1
- package/dist/theming-DxiD0Q3m.js.map +0 -1
|
@@ -0,0 +1,1228 @@
|
|
|
1
|
+
import { j as t, e as z } from "./externalizeComponent-Dc3fViZA.js";
|
|
2
|
+
import * as x from "three";
|
|
3
|
+
import { Matrix4 as w, Vector3 as T, Quaternion as U } from "three";
|
|
4
|
+
import { ConvexGeometry as te } from "three-stdlib";
|
|
5
|
+
import { useThree as ne, useFrame as re, Canvas as N } from "@react-three/fiber";
|
|
6
|
+
import { Environment as je, Lightformer as V, Line as O, useGLTF as we, Bounds as Y } from "@react-three/drei";
|
|
7
|
+
import { useTheme as be, Card as Re, Box as b, Typography as q, Divider as X, Button as K } from "@mui/material";
|
|
8
|
+
import { observer as ve } from "mobx-react-lite";
|
|
9
|
+
import Me, { useRef as R, useEffect as G, useCallback as _, useState as L, Suspense as oe } from "react";
|
|
10
|
+
import { useTranslation as _e } from "react-i18next";
|
|
11
|
+
import { N as Ge, V as se, c as ie, b as Z, M as v } from "./interpolation-baUmFLkh.js";
|
|
12
|
+
import { ErrorBoundary as ae } from "react-error-boundary";
|
|
13
|
+
function Te(e) {
|
|
14
|
+
switch (e.shape_type) {
|
|
15
|
+
case "convex_hull":
|
|
16
|
+
return new te(
|
|
17
|
+
e.vertices.map(
|
|
18
|
+
(n) => new x.Vector3(
|
|
19
|
+
n[0] / 1e3,
|
|
20
|
+
n[1] / 1e3,
|
|
21
|
+
n[2] / 1e3
|
|
22
|
+
)
|
|
23
|
+
)
|
|
24
|
+
);
|
|
25
|
+
case "box":
|
|
26
|
+
return new x.BoxGeometry(
|
|
27
|
+
e.size_x / 1e3,
|
|
28
|
+
e.size_y / 1e3,
|
|
29
|
+
e.size_z / 1e3
|
|
30
|
+
);
|
|
31
|
+
case "sphere":
|
|
32
|
+
return new x.SphereGeometry(e.radius / 1e3);
|
|
33
|
+
case "capsule":
|
|
34
|
+
return new x.CapsuleGeometry(
|
|
35
|
+
e.radius / 1e3,
|
|
36
|
+
e.cylinder_height / 1e3
|
|
37
|
+
);
|
|
38
|
+
case "cylinder":
|
|
39
|
+
return new x.CylinderGeometry(
|
|
40
|
+
e.radius / 1e3,
|
|
41
|
+
e.radius / 1e3,
|
|
42
|
+
e.height / 1e3
|
|
43
|
+
);
|
|
44
|
+
case "rectangle":
|
|
45
|
+
return new x.BoxGeometry(e.size_x / 1e3, e.size_y / 1e3, 0);
|
|
46
|
+
default:
|
|
47
|
+
return console.warn(`${e.shape_type} is not supported`), new x.BufferGeometry();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function Ve({
|
|
51
|
+
name: e,
|
|
52
|
+
collider: r,
|
|
53
|
+
children: n
|
|
54
|
+
}) {
|
|
55
|
+
var u, c;
|
|
56
|
+
const a = ((u = r.pose) == null ? void 0 : u.position) ?? [0, 0, 0], s = ((c = r.pose) == null ? void 0 : c.orientation) ?? [0, 0, 0];
|
|
57
|
+
return r.margin && console.warn(`${e} margin is not supported`), /* @__PURE__ */ t.jsx(
|
|
58
|
+
"mesh",
|
|
59
|
+
{
|
|
60
|
+
name: e,
|
|
61
|
+
position: new x.Vector3(
|
|
62
|
+
a[0],
|
|
63
|
+
a[1],
|
|
64
|
+
a[2]
|
|
65
|
+
).divideScalar(1e3),
|
|
66
|
+
rotation: new x.Euler(s[0], s[1], s[2], "XYZ"),
|
|
67
|
+
geometry: Te(r.shape),
|
|
68
|
+
children: n
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
function Le({
|
|
73
|
+
name: e,
|
|
74
|
+
colliders: r,
|
|
75
|
+
meshChildrenProvider: n,
|
|
76
|
+
...a
|
|
77
|
+
}) {
|
|
78
|
+
return /* @__PURE__ */ t.jsx("group", { name: e, ...a, children: Object.entries(r).map(([s, u]) => /* @__PURE__ */ t.jsx(
|
|
79
|
+
Ve,
|
|
80
|
+
{
|
|
81
|
+
name: s,
|
|
82
|
+
collider: u,
|
|
83
|
+
children: n(s, u)
|
|
84
|
+
},
|
|
85
|
+
s
|
|
86
|
+
)) });
|
|
87
|
+
}
|
|
88
|
+
function tt({
|
|
89
|
+
scene: e,
|
|
90
|
+
meshChildrenProvider: r
|
|
91
|
+
}) {
|
|
92
|
+
const n = e.colliders;
|
|
93
|
+
return /* @__PURE__ */ t.jsx("group", { children: n && /* @__PURE__ */ t.jsx(
|
|
94
|
+
Le,
|
|
95
|
+
{
|
|
96
|
+
meshChildrenProvider: r,
|
|
97
|
+
colliders: n
|
|
98
|
+
}
|
|
99
|
+
) });
|
|
100
|
+
}
|
|
101
|
+
function Q() {
|
|
102
|
+
return /* @__PURE__ */ t.jsx(je, { children: /* @__PURE__ */ t.jsx(ke, {}) });
|
|
103
|
+
}
|
|
104
|
+
function ke({ positions: e = [2, 0, 2, 0, 2, 0, 2, 0] }) {
|
|
105
|
+
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
106
|
+
/* @__PURE__ */ t.jsx(
|
|
107
|
+
V,
|
|
108
|
+
{
|
|
109
|
+
intensity: 5,
|
|
110
|
+
"rotation-x": Math.PI / 2,
|
|
111
|
+
position: [0, 5, -9],
|
|
112
|
+
scale: [10, 10, 1]
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
/* @__PURE__ */ t.jsx("group", { rotation: [0, 0.5, 0], children: /* @__PURE__ */ t.jsx("group", { children: e.map((r, n) => /* @__PURE__ */ t.jsx(
|
|
116
|
+
V,
|
|
117
|
+
{
|
|
118
|
+
form: "circle",
|
|
119
|
+
intensity: 5,
|
|
120
|
+
rotation: [Math.PI / 2, 0, 0],
|
|
121
|
+
position: [r, 4, n * 4],
|
|
122
|
+
scale: [3, 1, 1]
|
|
123
|
+
},
|
|
124
|
+
n
|
|
125
|
+
)) }) }),
|
|
126
|
+
/* @__PURE__ */ t.jsx(
|
|
127
|
+
V,
|
|
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__ */ t.jsx(
|
|
136
|
+
V,
|
|
137
|
+
{
|
|
138
|
+
intensity: 20,
|
|
139
|
+
"rotation-y": -Math.PI,
|
|
140
|
+
position: [-5, -2, -1],
|
|
141
|
+
scale: [20, 0.1, 1]
|
|
142
|
+
}
|
|
143
|
+
),
|
|
144
|
+
/* @__PURE__ */ t.jsx(
|
|
145
|
+
V,
|
|
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__ */ t.jsx(
|
|
154
|
+
V,
|
|
155
|
+
{
|
|
156
|
+
"rotation-y": -Math.PI / 2,
|
|
157
|
+
position: [10, 1, 0],
|
|
158
|
+
scale: [20, 1, 1],
|
|
159
|
+
intensity: 10
|
|
160
|
+
}
|
|
161
|
+
),
|
|
162
|
+
/* @__PURE__ */ t.jsx(
|
|
163
|
+
V,
|
|
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 Fe(e) {
|
|
176
|
+
if (e.length < 3)
|
|
177
|
+
return console.log("Not enough vertices to define a plane"), { isCoplanar: !1 };
|
|
178
|
+
const r = new x.Vector3(e[0].x, e[0].y, e[0].z), n = new x.Vector3(e[1].x, e[1].y, e[1].z), a = new x.Vector3(e[2].x, e[2].y, e[2].z), s = new x.Vector3().subVectors(n, r), u = new x.Vector3().subVectors(a, r), c = new x.Vector3().crossVectors(s, u).normalize();
|
|
179
|
+
for (let f = 3; f < e.length; f++) {
|
|
180
|
+
const l = new x.Vector3(e[f].x, e[f].y, e[f].z), m = new x.Vector3().subVectors(l, r), d = c.dot(m);
|
|
181
|
+
if (Math.abs(d) > 1e-6)
|
|
182
|
+
return console.log("Vertices are not on the same plane"), { isCoplanar: !1 };
|
|
183
|
+
}
|
|
184
|
+
return { isCoplanar: !0, normal: c };
|
|
185
|
+
}
|
|
186
|
+
function nt({
|
|
187
|
+
safetyZones: e,
|
|
188
|
+
...r
|
|
189
|
+
}) {
|
|
190
|
+
return /* @__PURE__ */ t.jsx("group", { ...r, children: e.map((n, a) => {
|
|
191
|
+
let s = [];
|
|
192
|
+
return n.geometry && (n.geometry.compound ? s = n.geometry.compound.child_geometries : n.geometry.convex_hull && (s = [n.geometry])), s.map((u, c) => {
|
|
193
|
+
if (!u.convex_hull) return null;
|
|
194
|
+
const f = u.convex_hull.vertices.map(
|
|
195
|
+
(d) => new x.Vector3(d.x / 1e3, d.y / 1e3, d.z / 1e3)
|
|
196
|
+
), l = Fe(f);
|
|
197
|
+
if (l.isCoplanar && l.normal) {
|
|
198
|
+
const o = new x.Vector3().addVectors(
|
|
199
|
+
f[0],
|
|
200
|
+
l.normal.multiplyScalar(1e-4)
|
|
201
|
+
);
|
|
202
|
+
f.push(o);
|
|
203
|
+
}
|
|
204
|
+
let m;
|
|
205
|
+
try {
|
|
206
|
+
m = new te(f);
|
|
207
|
+
} catch (d) {
|
|
208
|
+
return console.log("Error creating ConvexGeometry:", d), null;
|
|
209
|
+
}
|
|
210
|
+
return /* @__PURE__ */ t.jsx("mesh", { geometry: m, children: /* @__PURE__ */ t.jsx(
|
|
211
|
+
"meshStandardMaterial",
|
|
212
|
+
{
|
|
213
|
+
attach: "material",
|
|
214
|
+
color: "#009f4d",
|
|
215
|
+
opacity: 0.2,
|
|
216
|
+
depthTest: !1,
|
|
217
|
+
depthWrite: !1,
|
|
218
|
+
transparent: !0,
|
|
219
|
+
polygonOffset: !0,
|
|
220
|
+
polygonOffsetFactor: -c
|
|
221
|
+
},
|
|
222
|
+
a
|
|
223
|
+
) }, `${a}-${c}`);
|
|
224
|
+
});
|
|
225
|
+
}) });
|
|
226
|
+
}
|
|
227
|
+
function rt({
|
|
228
|
+
trajectory: e,
|
|
229
|
+
...r
|
|
230
|
+
}) {
|
|
231
|
+
var a;
|
|
232
|
+
const n = ((a = e.trajectory) == null ? void 0 : a.map((s) => s.tcp_pose ? new x.Vector3(
|
|
233
|
+
s.tcp_pose.position.x / 1e3,
|
|
234
|
+
s.tcp_pose.position.z / 1e3,
|
|
235
|
+
-s.tcp_pose.position.y / 1e3
|
|
236
|
+
) : null).filter((s) => s !== null)) || [];
|
|
237
|
+
return /* @__PURE__ */ t.jsx("group", { ...r, children: n.length > 0 && /* @__PURE__ */ t.jsx(
|
|
238
|
+
O,
|
|
239
|
+
{
|
|
240
|
+
points: n,
|
|
241
|
+
lineWidth: 3,
|
|
242
|
+
polygonOffset: !0,
|
|
243
|
+
polygonOffsetFactor: 10,
|
|
244
|
+
polygonOffsetUnits: 10
|
|
245
|
+
}
|
|
246
|
+
) });
|
|
247
|
+
}
|
|
248
|
+
const P = /* @__PURE__ */ new Map();
|
|
249
|
+
async function C(e) {
|
|
250
|
+
if (P.has(e))
|
|
251
|
+
return P.get(e);
|
|
252
|
+
const r = (async () => {
|
|
253
|
+
var u;
|
|
254
|
+
const a = new Ge({ instanceUrl: "" }), s = a.api.motionGroupModels;
|
|
255
|
+
(u = s.axios) != null && u.interceptors && s.axios.interceptors.request.use((c) => {
|
|
256
|
+
var f;
|
|
257
|
+
return (f = c.url) != null && f.includes("/glb") && (c.responseType = "blob"), c;
|
|
258
|
+
});
|
|
259
|
+
try {
|
|
260
|
+
const c = await a.api.motionGroupModels.getMotionGroupGlbModel(e);
|
|
261
|
+
return URL.createObjectURL(c);
|
|
262
|
+
} catch (c) {
|
|
263
|
+
throw console.error("Failed to fetch model:", c), c;
|
|
264
|
+
}
|
|
265
|
+
})();
|
|
266
|
+
return P.set(e, r), r;
|
|
267
|
+
}
|
|
268
|
+
function ce(e) {
|
|
269
|
+
function r(n) {
|
|
270
|
+
return n.children.length === 0 ? [n] : [n, ...n.children.flatMap((a) => r(a))];
|
|
271
|
+
}
|
|
272
|
+
return r(e).filter((n) => ue(n));
|
|
273
|
+
}
|
|
274
|
+
function le(e) {
|
|
275
|
+
return e.name.endsWith("_FLG");
|
|
276
|
+
}
|
|
277
|
+
function ue(e) {
|
|
278
|
+
return /_J[0-9]+$/.test(e.name);
|
|
279
|
+
}
|
|
280
|
+
function Ie(e, r) {
|
|
281
|
+
let n;
|
|
282
|
+
function a(s) {
|
|
283
|
+
if (le(s)) {
|
|
284
|
+
if (n)
|
|
285
|
+
throw Error(
|
|
286
|
+
`Found multiple flange groups in robot model ${r}; first ${n.name} then ${s.name}. Only one _FLG group is allowed.`
|
|
287
|
+
);
|
|
288
|
+
n = s;
|
|
289
|
+
}
|
|
290
|
+
ue(s), s.children.map(a);
|
|
291
|
+
}
|
|
292
|
+
if (a(e.scene), !n)
|
|
293
|
+
throw Error(
|
|
294
|
+
`No flange group found in robot model ${r}. Flange must be identified with a name ending in _FLG.`
|
|
295
|
+
);
|
|
296
|
+
return { gltf: e };
|
|
297
|
+
}
|
|
298
|
+
function fe({
|
|
299
|
+
rapidlyChangingMotionState: e,
|
|
300
|
+
dhParameters: r,
|
|
301
|
+
onRotationChanged: n,
|
|
302
|
+
children: a
|
|
303
|
+
}) {
|
|
304
|
+
const s = R([]), u = R([]), c = R(null), { invalidate: f } = ne();
|
|
305
|
+
G(() => {
|
|
306
|
+
const o = e.joint_position.filter(
|
|
307
|
+
(i) => i !== void 0
|
|
308
|
+
);
|
|
309
|
+
return c.current = new se(o, {
|
|
310
|
+
tension: 120,
|
|
311
|
+
// Controls spring stiffness - higher values create faster, more responsive motion
|
|
312
|
+
friction: 20,
|
|
313
|
+
// Controls damping - higher values reduce oscillation and create smoother settling
|
|
314
|
+
threshold: 1e-3
|
|
315
|
+
}), () => {
|
|
316
|
+
var i;
|
|
317
|
+
(i = c.current) == null || i.destroy();
|
|
318
|
+
};
|
|
319
|
+
}, []), re((o, i) => {
|
|
320
|
+
if (c.current) {
|
|
321
|
+
const p = c.current.update(i);
|
|
322
|
+
m(), p || f();
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
function l(o) {
|
|
326
|
+
o && (u.current = ce(o), m(), f());
|
|
327
|
+
}
|
|
328
|
+
function m() {
|
|
329
|
+
var i;
|
|
330
|
+
const o = ((i = c.current) == null ? void 0 : i.getCurrentValues()) || [];
|
|
331
|
+
if (n)
|
|
332
|
+
n(u.current, o);
|
|
333
|
+
else
|
|
334
|
+
for (const [p, y] of u.current.entries()) {
|
|
335
|
+
const h = r[p], j = h.theta || 0, g = h.reverse_rotation_direction ? -1 : 1;
|
|
336
|
+
y.rotation.y = g * (o[p] || 0) + j;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
const d = _(() => {
|
|
340
|
+
const o = e.joint_position.filter(
|
|
341
|
+
(i) => i !== void 0
|
|
342
|
+
);
|
|
343
|
+
requestAnimationFrame(() => {
|
|
344
|
+
var i;
|
|
345
|
+
s.current = o, (i = c.current) == null || i.setTarget(o);
|
|
346
|
+
});
|
|
347
|
+
}, [e]);
|
|
348
|
+
return G(() => {
|
|
349
|
+
d();
|
|
350
|
+
}, [e, d]), ie(() => {
|
|
351
|
+
d();
|
|
352
|
+
}), /* @__PURE__ */ t.jsx("group", { ref: l, children: a });
|
|
353
|
+
}
|
|
354
|
+
const Ae = "line", Se = "mesh";
|
|
355
|
+
function De({
|
|
356
|
+
rapidlyChangingMotionState: e,
|
|
357
|
+
dhParameters: r,
|
|
358
|
+
...n
|
|
359
|
+
}) {
|
|
360
|
+
const a = new w(), s = R([]), u = R([]);
|
|
361
|
+
Me.useEffect(() => {
|
|
362
|
+
s.current = new Array(r.length).fill(null), u.current = new Array(r.length).fill(null);
|
|
363
|
+
}, [r.length]);
|
|
364
|
+
function c(m, d) {
|
|
365
|
+
const o = new T(), i = new U(), p = new T();
|
|
366
|
+
a.decompose(o, i, p);
|
|
367
|
+
const y = o.clone(), h = new w().makeRotationY(
|
|
368
|
+
m.theta + d * (m.reverse_rotation_direction ? -1 : 1)
|
|
369
|
+
).multiply(new w().makeTranslation(0, m.d / 1e3, 0)).multiply(new w().makeTranslation(m.a / 1e3, 0, 0)).multiply(new w().makeRotationX(m.alpha));
|
|
370
|
+
return a.multiply(h), a.decompose(o, i, p), { a: y, b: o };
|
|
371
|
+
}
|
|
372
|
+
function f(m, d, o, i) {
|
|
373
|
+
if (!r)
|
|
374
|
+
return;
|
|
375
|
+
const p = r[m];
|
|
376
|
+
if (!p)
|
|
377
|
+
return;
|
|
378
|
+
const { a: y, b: h } = c(p, i);
|
|
379
|
+
d.geometry.setPositions([y.toArray(), h.toArray()].flat()), o.position.set(h.x, h.y, h.z);
|
|
380
|
+
}
|
|
381
|
+
function l(m, d) {
|
|
382
|
+
a.identity();
|
|
383
|
+
for (let o = 0; o < Math.min(m.length, d.length); o++) {
|
|
384
|
+
const i = s.current[o], p = u.current[o];
|
|
385
|
+
i && p && f(o, i, p, d[o]);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
return /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsx(
|
|
389
|
+
fe,
|
|
390
|
+
{
|
|
391
|
+
rapidlyChangingMotionState: e,
|
|
392
|
+
dhParameters: r,
|
|
393
|
+
onRotationChanged: l,
|
|
394
|
+
children: /* @__PURE__ */ t.jsxs("group", { ...n, name: "Scene", children: [
|
|
395
|
+
/* @__PURE__ */ t.jsxs("mesh", { children: [
|
|
396
|
+
/* @__PURE__ */ t.jsx("sphereGeometry", { args: [0.01, 32, 32] }),
|
|
397
|
+
/* @__PURE__ */ t.jsx("meshStandardMaterial", { color: "black", depthTest: !0 })
|
|
398
|
+
] }),
|
|
399
|
+
r.map((m, d) => {
|
|
400
|
+
const { a: o, b: i } = c(
|
|
401
|
+
m,
|
|
402
|
+
e.joint_position[d] ?? 0
|
|
403
|
+
), p = `dhrobot_J0${d}`;
|
|
404
|
+
return /* @__PURE__ */ t.jsxs("group", { name: p, children: [
|
|
405
|
+
/* @__PURE__ */ t.jsx(
|
|
406
|
+
O,
|
|
407
|
+
{
|
|
408
|
+
ref: (y) => {
|
|
409
|
+
s.current[d] = y;
|
|
410
|
+
},
|
|
411
|
+
name: Ae,
|
|
412
|
+
points: [o, i],
|
|
413
|
+
color: "white",
|
|
414
|
+
lineWidth: 5
|
|
415
|
+
}
|
|
416
|
+
),
|
|
417
|
+
/* @__PURE__ */ t.jsxs(
|
|
418
|
+
"mesh",
|
|
419
|
+
{
|
|
420
|
+
ref: (y) => {
|
|
421
|
+
u.current[d] = y;
|
|
422
|
+
},
|
|
423
|
+
name: Se,
|
|
424
|
+
position: i,
|
|
425
|
+
children: [
|
|
426
|
+
/* @__PURE__ */ t.jsx("sphereGeometry", { args: [0.01, 32, 32] }),
|
|
427
|
+
/* @__PURE__ */ t.jsx("meshStandardMaterial", { color: "black", depthTest: !0 })
|
|
428
|
+
]
|
|
429
|
+
},
|
|
430
|
+
"mesh_" + d
|
|
431
|
+
)
|
|
432
|
+
] }, p);
|
|
433
|
+
})
|
|
434
|
+
] })
|
|
435
|
+
}
|
|
436
|
+
) });
|
|
437
|
+
}
|
|
438
|
+
const Pe = console.warn;
|
|
439
|
+
function de() {
|
|
440
|
+
return G(() => {
|
|
441
|
+
console.warn = (e) => {
|
|
442
|
+
e !== "Cannot call the manual advancement of rafz whilst frameLoop is not set as demand" && Pe(e);
|
|
443
|
+
};
|
|
444
|
+
}, []), /* @__PURE__ */ t.jsx(t.Fragment, {});
|
|
445
|
+
}
|
|
446
|
+
function Ue(e) {
|
|
447
|
+
return e.type === "Mesh";
|
|
448
|
+
}
|
|
449
|
+
function ze({
|
|
450
|
+
url: e,
|
|
451
|
+
flangeRef: r,
|
|
452
|
+
postModelRender: n,
|
|
453
|
+
...a
|
|
454
|
+
}) {
|
|
455
|
+
const s = we(e);
|
|
456
|
+
let u;
|
|
457
|
+
try {
|
|
458
|
+
u = Ie(s, "robot.glb").gltf;
|
|
459
|
+
} catch (l) {
|
|
460
|
+
throw l;
|
|
461
|
+
}
|
|
462
|
+
const c = _(
|
|
463
|
+
(l) => {
|
|
464
|
+
l && n && n();
|
|
465
|
+
},
|
|
466
|
+
[n]
|
|
467
|
+
);
|
|
468
|
+
function f(l) {
|
|
469
|
+
try {
|
|
470
|
+
return Ue(l) ? l.geometry ? /* @__PURE__ */ t.jsx(
|
|
471
|
+
"mesh",
|
|
472
|
+
{
|
|
473
|
+
name: l.name,
|
|
474
|
+
geometry: l.geometry,
|
|
475
|
+
material: l.material,
|
|
476
|
+
position: l.position,
|
|
477
|
+
rotation: l.rotation
|
|
478
|
+
},
|
|
479
|
+
l.uuid
|
|
480
|
+
) : /* @__PURE__ */ t.jsx("group", { name: l.name, position: l.position, rotation: l.rotation }, l.uuid) : /* @__PURE__ */ t.jsx(
|
|
481
|
+
"group",
|
|
482
|
+
{
|
|
483
|
+
name: l.name,
|
|
484
|
+
position: l.position,
|
|
485
|
+
rotation: l.rotation,
|
|
486
|
+
ref: le(l) ? r : void 0,
|
|
487
|
+
children: l.children.map(f)
|
|
488
|
+
},
|
|
489
|
+
l.uuid
|
|
490
|
+
);
|
|
491
|
+
} catch (m) {
|
|
492
|
+
return console.warn("Error rendering node", l.name, m), null;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
return /* @__PURE__ */ t.jsx("group", { ...a, dispose: null, ref: c, children: f(u.scene) });
|
|
496
|
+
}
|
|
497
|
+
function me({
|
|
498
|
+
modelURL: e,
|
|
499
|
+
flangeRef: r,
|
|
500
|
+
postModelRender: n,
|
|
501
|
+
...a
|
|
502
|
+
}) {
|
|
503
|
+
const [s, u] = L(null);
|
|
504
|
+
return G(() => {
|
|
505
|
+
(async () => {
|
|
506
|
+
try {
|
|
507
|
+
if (typeof e == "string")
|
|
508
|
+
u(e);
|
|
509
|
+
else {
|
|
510
|
+
const f = await e;
|
|
511
|
+
u(f);
|
|
512
|
+
}
|
|
513
|
+
} catch (f) {
|
|
514
|
+
console.error("Failed to resolve model URL:", f);
|
|
515
|
+
}
|
|
516
|
+
})();
|
|
517
|
+
}, [e]), s ? /* @__PURE__ */ t.jsx(
|
|
518
|
+
ze,
|
|
519
|
+
{
|
|
520
|
+
url: s,
|
|
521
|
+
flangeRef: r,
|
|
522
|
+
postModelRender: n,
|
|
523
|
+
...a
|
|
524
|
+
}
|
|
525
|
+
) : null;
|
|
526
|
+
}
|
|
527
|
+
const pe = (e, r) => {
|
|
528
|
+
e.userData.isGhost || (e.traverse((n) => {
|
|
529
|
+
if (n instanceof x.Mesh) {
|
|
530
|
+
n.material instanceof x.Material && (n.material.colorWrite = !1);
|
|
531
|
+
const a = n.clone(), s = n.clone();
|
|
532
|
+
a.material = new x.MeshStandardMaterial({
|
|
533
|
+
depthTest: !0,
|
|
534
|
+
depthWrite: !0,
|
|
535
|
+
colorWrite: !1,
|
|
536
|
+
polygonOffset: !0,
|
|
537
|
+
polygonOffsetFactor: -1,
|
|
538
|
+
side: x.DoubleSide
|
|
539
|
+
}), a.userData.isGhost = !0, s.material = new x.MeshStandardMaterial({
|
|
540
|
+
color: r,
|
|
541
|
+
opacity: 0.3,
|
|
542
|
+
depthTest: !0,
|
|
543
|
+
depthWrite: !1,
|
|
544
|
+
transparent: !0,
|
|
545
|
+
polygonOffset: !0,
|
|
546
|
+
polygonOffsetFactor: -2,
|
|
547
|
+
side: x.DoubleSide
|
|
548
|
+
}), s.userData.isGhost = !0, n.parent && (n.parent.add(a), n.parent.add(s));
|
|
549
|
+
}
|
|
550
|
+
}), e.userData.isGhost = !0);
|
|
551
|
+
}, he = (e) => {
|
|
552
|
+
if (!e.userData.isGhost) return;
|
|
553
|
+
const r = [];
|
|
554
|
+
e.traverse((n) => {
|
|
555
|
+
var a;
|
|
556
|
+
n instanceof x.Mesh && ((a = n.userData) != null && a.isGhost ? r.push(n) : n.material instanceof x.Material && (n.material.colorWrite = !0));
|
|
557
|
+
}), r.forEach((n) => {
|
|
558
|
+
n.parent && n.parent.remove(n);
|
|
559
|
+
}), e.userData.isGhost = !1;
|
|
560
|
+
}, Oe = z(
|
|
561
|
+
({
|
|
562
|
+
rapidlyChangingMotionState: e,
|
|
563
|
+
modelFromController: r,
|
|
564
|
+
dhParameters: n,
|
|
565
|
+
getModel: a = C,
|
|
566
|
+
flangeRef: s,
|
|
567
|
+
postModelRender: u,
|
|
568
|
+
transparentColor: c,
|
|
569
|
+
...f
|
|
570
|
+
}) => {
|
|
571
|
+
const [l, m] = L(null), d = _((i) => {
|
|
572
|
+
m(i);
|
|
573
|
+
}, []);
|
|
574
|
+
G(() => {
|
|
575
|
+
l && (c ? pe(l, c) : he(l));
|
|
576
|
+
}, [l, c]);
|
|
577
|
+
const o = /* @__PURE__ */ t.jsx(
|
|
578
|
+
De,
|
|
579
|
+
{
|
|
580
|
+
rapidlyChangingMotionState: e,
|
|
581
|
+
dhParameters: n,
|
|
582
|
+
...f
|
|
583
|
+
}
|
|
584
|
+
);
|
|
585
|
+
return /* @__PURE__ */ t.jsxs(
|
|
586
|
+
ae,
|
|
587
|
+
{
|
|
588
|
+
fallback: o,
|
|
589
|
+
onError: (i) => {
|
|
590
|
+
console.warn(i);
|
|
591
|
+
},
|
|
592
|
+
children: [
|
|
593
|
+
/* @__PURE__ */ t.jsx(oe, { fallback: o, children: /* @__PURE__ */ t.jsx("group", { ref: d, children: /* @__PURE__ */ t.jsx(
|
|
594
|
+
fe,
|
|
595
|
+
{
|
|
596
|
+
rapidlyChangingMotionState: e,
|
|
597
|
+
dhParameters: n,
|
|
598
|
+
children: /* @__PURE__ */ t.jsx(
|
|
599
|
+
me,
|
|
600
|
+
{
|
|
601
|
+
modelURL: (() => {
|
|
602
|
+
const i = a(r);
|
|
603
|
+
if (!i) {
|
|
604
|
+
const p = new Blob([], { type: "model/gltf-binary" }), y = new File([p], `${r}.glb`, { type: "model/gltf-binary" });
|
|
605
|
+
return Promise.resolve(URL.createObjectURL(y));
|
|
606
|
+
}
|
|
607
|
+
return i;
|
|
608
|
+
})(),
|
|
609
|
+
postModelRender: u,
|
|
610
|
+
flangeRef: s,
|
|
611
|
+
...f
|
|
612
|
+
}
|
|
613
|
+
)
|
|
614
|
+
}
|
|
615
|
+
) }) }),
|
|
616
|
+
/* @__PURE__ */ t.jsx(de, {})
|
|
617
|
+
]
|
|
618
|
+
}
|
|
619
|
+
);
|
|
620
|
+
}
|
|
621
|
+
);
|
|
622
|
+
function Ce({
|
|
623
|
+
connectedMotionGroup: e,
|
|
624
|
+
getModel: r = C,
|
|
625
|
+
flangeRef: n,
|
|
626
|
+
transparentColor: a,
|
|
627
|
+
postModelRender: s,
|
|
628
|
+
...u
|
|
629
|
+
}) {
|
|
630
|
+
return e.dhParameters ? /* @__PURE__ */ t.jsx(
|
|
631
|
+
Oe,
|
|
632
|
+
{
|
|
633
|
+
rapidlyChangingMotionState: e.rapidlyChangingMotionState,
|
|
634
|
+
modelFromController: e.modelFromController || "",
|
|
635
|
+
dhParameters: e.dhParameters,
|
|
636
|
+
getModel: r,
|
|
637
|
+
flangeRef: n,
|
|
638
|
+
transparentColor: a,
|
|
639
|
+
postModelRender: s,
|
|
640
|
+
...u
|
|
641
|
+
}
|
|
642
|
+
) : null;
|
|
643
|
+
}
|
|
644
|
+
const ot = z(
|
|
645
|
+
ve(
|
|
646
|
+
({
|
|
647
|
+
robotName: e,
|
|
648
|
+
programState: r,
|
|
649
|
+
safetyState: n,
|
|
650
|
+
operationMode: a,
|
|
651
|
+
driveToHomeEnabled: s = !1,
|
|
652
|
+
onDriveToHomePress: u,
|
|
653
|
+
onDriveToHomeRelease: c,
|
|
654
|
+
connectedMotionGroup: f,
|
|
655
|
+
robotComponent: l = Ce,
|
|
656
|
+
customContentComponent: m,
|
|
657
|
+
className: d
|
|
658
|
+
}) => {
|
|
659
|
+
var W;
|
|
660
|
+
const o = be(), { t: i } = _e(), [p, y] = L(!1), h = R(null), j = R(null), [g, D] = L(!1), [k, ye] = L({ width: 400, height: 600 }), [We, ge] = L(0);
|
|
661
|
+
G(() => {
|
|
662
|
+
const S = () => {
|
|
663
|
+
if (j.current) {
|
|
664
|
+
const { offsetWidth: $, offsetHeight: H } = j.current;
|
|
665
|
+
D($ > H), ye({ width: $, height: H });
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
S();
|
|
669
|
+
const J = new ResizeObserver(S);
|
|
670
|
+
return j.current && J.observe(j.current), () => {
|
|
671
|
+
J.disconnect();
|
|
672
|
+
};
|
|
673
|
+
}, []);
|
|
674
|
+
const E = _(() => {
|
|
675
|
+
ge((S) => S + 1);
|
|
676
|
+
}, []), F = _(() => {
|
|
677
|
+
!s || !u || (y(!0), u());
|
|
678
|
+
}, [s, u]), I = _(() => {
|
|
679
|
+
!s || !c || (y(!1), c());
|
|
680
|
+
}, [s, c]), B = _(() => {
|
|
681
|
+
p && c && (y(!1), c());
|
|
682
|
+
}, [p, c]), M = g ? k.width < 350 : k.height < 200, A = g ? k.height < 310 : k.height < 450;
|
|
683
|
+
return /* @__PURE__ */ t.jsx(
|
|
684
|
+
Re,
|
|
685
|
+
{
|
|
686
|
+
ref: j,
|
|
687
|
+
className: d,
|
|
688
|
+
sx: {
|
|
689
|
+
width: "100%",
|
|
690
|
+
height: "100%",
|
|
691
|
+
display: "flex",
|
|
692
|
+
flexDirection: g ? "row" : "column",
|
|
693
|
+
position: "relative",
|
|
694
|
+
overflow: "hidden",
|
|
695
|
+
minWidth: { xs: 180, sm: 220, md: 250 },
|
|
696
|
+
minHeight: g ? { xs: 200, sm: 240, md: 260 } : { xs: 150, sm: 180, md: 220 },
|
|
697
|
+
// Allow progressive hiding in portrait mode
|
|
698
|
+
border: `1px solid ${o.palette.divider}`,
|
|
699
|
+
borderRadius: "18px",
|
|
700
|
+
boxShadow: "none",
|
|
701
|
+
backgroundColor: ((W = o.palette.backgroundPaperElevation) == null ? void 0 : W[8]) || "#2A2A3F",
|
|
702
|
+
backgroundImage: "none"
|
|
703
|
+
// Override any gradient from elevation
|
|
704
|
+
},
|
|
705
|
+
children: g ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
706
|
+
/* @__PURE__ */ t.jsx(
|
|
707
|
+
b,
|
|
708
|
+
{
|
|
709
|
+
sx: {
|
|
710
|
+
flex: "0 0 50%",
|
|
711
|
+
position: "relative",
|
|
712
|
+
height: "100%",
|
|
713
|
+
minHeight: "100%",
|
|
714
|
+
maxHeight: "100%",
|
|
715
|
+
borderRadius: 1,
|
|
716
|
+
m: { xs: 1.5, sm: 2, md: 3 },
|
|
717
|
+
mr: { xs: 0.75, sm: 1, md: 1.5 },
|
|
718
|
+
overflow: "hidden",
|
|
719
|
+
// Prevent content from affecting container size
|
|
720
|
+
display: M ? "none" : "block"
|
|
721
|
+
},
|
|
722
|
+
children: !M && /* @__PURE__ */ t.jsxs(
|
|
723
|
+
N,
|
|
724
|
+
{
|
|
725
|
+
orthographic: !0,
|
|
726
|
+
camera: {
|
|
727
|
+
position: [3, 2, 3],
|
|
728
|
+
zoom: 1
|
|
729
|
+
},
|
|
730
|
+
shadows: !0,
|
|
731
|
+
frameloop: "demand",
|
|
732
|
+
style: {
|
|
733
|
+
borderRadius: o.shape.borderRadius,
|
|
734
|
+
width: "100%",
|
|
735
|
+
height: "100%",
|
|
736
|
+
background: "transparent",
|
|
737
|
+
position: "absolute",
|
|
738
|
+
top: 0,
|
|
739
|
+
left: 0
|
|
740
|
+
},
|
|
741
|
+
dpr: [1, 2],
|
|
742
|
+
gl: { alpha: !0, antialias: !0 },
|
|
743
|
+
children: [
|
|
744
|
+
/* @__PURE__ */ t.jsx(Q, {}),
|
|
745
|
+
/* @__PURE__ */ t.jsx(Y, { fit: !0, observe: !0, margin: 1, maxDuration: 1, children: /* @__PURE__ */ t.jsx(
|
|
746
|
+
l,
|
|
747
|
+
{
|
|
748
|
+
connectedMotionGroup: f,
|
|
749
|
+
postModelRender: E
|
|
750
|
+
}
|
|
751
|
+
) })
|
|
752
|
+
]
|
|
753
|
+
}
|
|
754
|
+
)
|
|
755
|
+
}
|
|
756
|
+
),
|
|
757
|
+
/* @__PURE__ */ t.jsxs(
|
|
758
|
+
b,
|
|
759
|
+
{
|
|
760
|
+
sx: {
|
|
761
|
+
flex: "1",
|
|
762
|
+
display: "flex",
|
|
763
|
+
flexDirection: "column",
|
|
764
|
+
justifyContent: "flex-start",
|
|
765
|
+
width: M ? "100%" : "50%"
|
|
766
|
+
},
|
|
767
|
+
children: [
|
|
768
|
+
/* @__PURE__ */ t.jsxs(
|
|
769
|
+
b,
|
|
770
|
+
{
|
|
771
|
+
sx: {
|
|
772
|
+
p: { xs: 1.5, sm: 2, md: 3 },
|
|
773
|
+
pb: { xs: 1, sm: 1.5, md: 2 },
|
|
774
|
+
textAlign: "left"
|
|
775
|
+
},
|
|
776
|
+
children: [
|
|
777
|
+
/* @__PURE__ */ t.jsx(q, { variant: "h6", component: "h2", sx: { mb: 1 }, children: e }),
|
|
778
|
+
/* @__PURE__ */ t.jsx(
|
|
779
|
+
Z,
|
|
780
|
+
{
|
|
781
|
+
programState: r,
|
|
782
|
+
safetyState: n,
|
|
783
|
+
operationMode: a
|
|
784
|
+
}
|
|
785
|
+
)
|
|
786
|
+
]
|
|
787
|
+
}
|
|
788
|
+
),
|
|
789
|
+
/* @__PURE__ */ t.jsxs(
|
|
790
|
+
b,
|
|
791
|
+
{
|
|
792
|
+
sx: {
|
|
793
|
+
p: { xs: 1.5, sm: 2, md: 3 },
|
|
794
|
+
pt: 0,
|
|
795
|
+
flex: "1",
|
|
796
|
+
display: "flex",
|
|
797
|
+
flexDirection: "column",
|
|
798
|
+
justifyContent: "space-between"
|
|
799
|
+
},
|
|
800
|
+
children: [
|
|
801
|
+
!A && m && /* @__PURE__ */ t.jsxs(b, { children: [
|
|
802
|
+
/* @__PURE__ */ t.jsx(m, {}),
|
|
803
|
+
/* @__PURE__ */ t.jsx(
|
|
804
|
+
X,
|
|
805
|
+
{
|
|
806
|
+
sx: {
|
|
807
|
+
mt: 1,
|
|
808
|
+
mb: 0,
|
|
809
|
+
borderColor: o.palette.divider,
|
|
810
|
+
opacity: 0.5
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
)
|
|
814
|
+
] }),
|
|
815
|
+
/* @__PURE__ */ t.jsx(
|
|
816
|
+
b,
|
|
817
|
+
{
|
|
818
|
+
sx: {
|
|
819
|
+
mt: !A && m ? "auto" : 0
|
|
820
|
+
},
|
|
821
|
+
children: /* @__PURE__ */ t.jsx(
|
|
822
|
+
b,
|
|
823
|
+
{
|
|
824
|
+
sx: {
|
|
825
|
+
display: "flex",
|
|
826
|
+
justifyContent: "flex-start",
|
|
827
|
+
mt: { xs: 1, sm: 1.5, md: 2 },
|
|
828
|
+
mb: { xs: 0.5, sm: 0.75, md: 1 }
|
|
829
|
+
},
|
|
830
|
+
children: /* @__PURE__ */ t.jsx(
|
|
831
|
+
K,
|
|
832
|
+
{
|
|
833
|
+
ref: h,
|
|
834
|
+
variant: "contained",
|
|
835
|
+
color: "secondary",
|
|
836
|
+
size: "small",
|
|
837
|
+
disabled: !s,
|
|
838
|
+
onMouseDown: F,
|
|
839
|
+
onMouseUp: I,
|
|
840
|
+
onMouseLeave: B,
|
|
841
|
+
onTouchStart: F,
|
|
842
|
+
onTouchEnd: I,
|
|
843
|
+
sx: {
|
|
844
|
+
textTransform: "none",
|
|
845
|
+
px: 1.5,
|
|
846
|
+
py: 0.5
|
|
847
|
+
},
|
|
848
|
+
children: i("RobotCard.DriveToHome.bt")
|
|
849
|
+
}
|
|
850
|
+
)
|
|
851
|
+
}
|
|
852
|
+
)
|
|
853
|
+
}
|
|
854
|
+
)
|
|
855
|
+
]
|
|
856
|
+
}
|
|
857
|
+
)
|
|
858
|
+
]
|
|
859
|
+
}
|
|
860
|
+
)
|
|
861
|
+
] }) : /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsxs(
|
|
862
|
+
b,
|
|
863
|
+
{
|
|
864
|
+
sx: {
|
|
865
|
+
p: 3,
|
|
866
|
+
height: "100%",
|
|
867
|
+
display: "flex",
|
|
868
|
+
flexDirection: "column"
|
|
869
|
+
},
|
|
870
|
+
children: [
|
|
871
|
+
/* @__PURE__ */ t.jsxs(b, { children: [
|
|
872
|
+
/* @__PURE__ */ t.jsx(q, { variant: "h6", component: "h2", sx: { mb: 1 }, children: e }),
|
|
873
|
+
/* @__PURE__ */ t.jsx(
|
|
874
|
+
Z,
|
|
875
|
+
{
|
|
876
|
+
programState: r,
|
|
877
|
+
safetyState: n,
|
|
878
|
+
operationMode: a
|
|
879
|
+
}
|
|
880
|
+
)
|
|
881
|
+
] }),
|
|
882
|
+
/* @__PURE__ */ t.jsx(
|
|
883
|
+
b,
|
|
884
|
+
{
|
|
885
|
+
sx: {
|
|
886
|
+
flex: M ? 0 : 1,
|
|
887
|
+
position: "relative",
|
|
888
|
+
minHeight: M ? 0 : { xs: 120, sm: 150, md: 200 },
|
|
889
|
+
height: M ? 0 : "auto",
|
|
890
|
+
borderRadius: 1,
|
|
891
|
+
overflow: "hidden",
|
|
892
|
+
display: M ? "none" : "block"
|
|
893
|
+
},
|
|
894
|
+
children: !M && /* @__PURE__ */ t.jsxs(
|
|
895
|
+
N,
|
|
896
|
+
{
|
|
897
|
+
orthographic: !0,
|
|
898
|
+
camera: {
|
|
899
|
+
position: [3, 2, 3],
|
|
900
|
+
zoom: 1
|
|
901
|
+
},
|
|
902
|
+
shadows: !0,
|
|
903
|
+
frameloop: "demand",
|
|
904
|
+
style: {
|
|
905
|
+
borderRadius: o.shape.borderRadius,
|
|
906
|
+
width: "100%",
|
|
907
|
+
height: "100%",
|
|
908
|
+
background: "transparent",
|
|
909
|
+
position: "absolute"
|
|
910
|
+
},
|
|
911
|
+
dpr: [1, 2],
|
|
912
|
+
gl: { alpha: !0, antialias: !0 },
|
|
913
|
+
children: [
|
|
914
|
+
/* @__PURE__ */ t.jsx(Q, {}),
|
|
915
|
+
/* @__PURE__ */ t.jsx(Y, { fit: !0, clip: !0, observe: !0, margin: 1, maxDuration: 1, children: /* @__PURE__ */ t.jsx(
|
|
916
|
+
l,
|
|
917
|
+
{
|
|
918
|
+
connectedMotionGroup: f,
|
|
919
|
+
postModelRender: E
|
|
920
|
+
}
|
|
921
|
+
) })
|
|
922
|
+
]
|
|
923
|
+
}
|
|
924
|
+
)
|
|
925
|
+
}
|
|
926
|
+
),
|
|
927
|
+
/* @__PURE__ */ t.jsxs(b, { children: [
|
|
928
|
+
!A && m && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
929
|
+
/* @__PURE__ */ t.jsx(m, {}),
|
|
930
|
+
/* @__PURE__ */ t.jsx(
|
|
931
|
+
X,
|
|
932
|
+
{
|
|
933
|
+
sx: {
|
|
934
|
+
mt: 1,
|
|
935
|
+
mb: 0,
|
|
936
|
+
borderColor: o.palette.divider,
|
|
937
|
+
opacity: 0.5
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
)
|
|
941
|
+
] }),
|
|
942
|
+
/* @__PURE__ */ t.jsx(
|
|
943
|
+
b,
|
|
944
|
+
{
|
|
945
|
+
sx: {
|
|
946
|
+
display: "flex",
|
|
947
|
+
justifyContent: "flex-start",
|
|
948
|
+
mt: !A && m ? { xs: 1, sm: 2, md: 5 } : { xs: 0.5, sm: 1, md: 2 },
|
|
949
|
+
mb: { xs: 0.5, sm: 0.75, md: 1 }
|
|
950
|
+
},
|
|
951
|
+
children: /* @__PURE__ */ t.jsx(
|
|
952
|
+
K,
|
|
953
|
+
{
|
|
954
|
+
ref: h,
|
|
955
|
+
variant: "contained",
|
|
956
|
+
color: "secondary",
|
|
957
|
+
size: "small",
|
|
958
|
+
disabled: !s,
|
|
959
|
+
onMouseDown: F,
|
|
960
|
+
onMouseUp: I,
|
|
961
|
+
onMouseLeave: B,
|
|
962
|
+
onTouchStart: F,
|
|
963
|
+
onTouchEnd: I,
|
|
964
|
+
sx: {
|
|
965
|
+
textTransform: "none",
|
|
966
|
+
px: 1.5,
|
|
967
|
+
py: 0.5
|
|
968
|
+
},
|
|
969
|
+
children: i("RobotCard.DriveToHome.bt")
|
|
970
|
+
}
|
|
971
|
+
)
|
|
972
|
+
}
|
|
973
|
+
)
|
|
974
|
+
] })
|
|
975
|
+
]
|
|
976
|
+
}
|
|
977
|
+
) })
|
|
978
|
+
}
|
|
979
|
+
);
|
|
980
|
+
}
|
|
981
|
+
)
|
|
982
|
+
), st = Array(6).fill(2 * Math.PI), ee = {
|
|
983
|
+
[v.Abb]: [0, 0, 0, 0, Math.PI / 2, 0, 0],
|
|
984
|
+
[v.Fanuc]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
|
|
985
|
+
[v.Yaskawa]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
|
|
986
|
+
[v.Kuka]: [
|
|
987
|
+
0,
|
|
988
|
+
-Math.PI / 2,
|
|
989
|
+
Math.PI / 2,
|
|
990
|
+
0,
|
|
991
|
+
Math.PI / 2,
|
|
992
|
+
0,
|
|
993
|
+
0
|
|
994
|
+
],
|
|
995
|
+
[v.Universalrobots]: [
|
|
996
|
+
0,
|
|
997
|
+
-Math.PI / 2,
|
|
998
|
+
-Math.PI / 2,
|
|
999
|
+
-Math.PI / 2,
|
|
1000
|
+
Math.PI / 2,
|
|
1001
|
+
-Math.PI / 2,
|
|
1002
|
+
0
|
|
1003
|
+
]
|
|
1004
|
+
};
|
|
1005
|
+
function Ee(e) {
|
|
1006
|
+
const [r] = e.split("_");
|
|
1007
|
+
switch (r) {
|
|
1008
|
+
case "ABB":
|
|
1009
|
+
return v.Abb;
|
|
1010
|
+
case "FANUC":
|
|
1011
|
+
return v.Fanuc;
|
|
1012
|
+
case "YASKAWA":
|
|
1013
|
+
return v.Yaskawa;
|
|
1014
|
+
case "KUKA":
|
|
1015
|
+
return v.Kuka;
|
|
1016
|
+
case "UniversalRobots":
|
|
1017
|
+
return v.Universalrobots;
|
|
1018
|
+
default:
|
|
1019
|
+
return null;
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
function it(e, r) {
|
|
1023
|
+
const n = Ee(e);
|
|
1024
|
+
return n && n in ee ? ee[n] : r || null;
|
|
1025
|
+
}
|
|
1026
|
+
function xe({
|
|
1027
|
+
rapidlyChangingMotionState: e,
|
|
1028
|
+
dhParameters: r,
|
|
1029
|
+
onTranslationChanged: n,
|
|
1030
|
+
children: a
|
|
1031
|
+
}) {
|
|
1032
|
+
const s = R([]), u = R([]), c = R(null), { invalidate: f } = ne();
|
|
1033
|
+
G(() => {
|
|
1034
|
+
const o = e.joint_position.filter(
|
|
1035
|
+
(i) => i !== void 0
|
|
1036
|
+
);
|
|
1037
|
+
return c.current = new se(o, {
|
|
1038
|
+
tension: 120,
|
|
1039
|
+
// Controls spring stiffness - higher values create faster, more responsive motion
|
|
1040
|
+
friction: 20,
|
|
1041
|
+
// Controls damping - higher values reduce oscillation and create smoother settling
|
|
1042
|
+
threshold: 1e-3
|
|
1043
|
+
}), () => {
|
|
1044
|
+
var i;
|
|
1045
|
+
(i = c.current) == null || i.destroy();
|
|
1046
|
+
};
|
|
1047
|
+
}, []), re((o, i) => {
|
|
1048
|
+
if (c.current) {
|
|
1049
|
+
const p = c.current.update(i);
|
|
1050
|
+
m(), p || f();
|
|
1051
|
+
}
|
|
1052
|
+
});
|
|
1053
|
+
function l(o) {
|
|
1054
|
+
o && (u.current = ce(o), m(), f());
|
|
1055
|
+
}
|
|
1056
|
+
function m() {
|
|
1057
|
+
var i;
|
|
1058
|
+
const o = ((i = c.current) == null ? void 0 : i.getCurrentValues()) || [];
|
|
1059
|
+
if (n)
|
|
1060
|
+
n(u.current, o);
|
|
1061
|
+
else
|
|
1062
|
+
for (const [p, y] of u.current.entries()) {
|
|
1063
|
+
const j = r[p].reverse_rotation_direction ? -1 : 1;
|
|
1064
|
+
y.position.y = j * (o[p] || 0) / 1e3;
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
const d = _(() => {
|
|
1068
|
+
const o = e.joint_position.filter(
|
|
1069
|
+
(i) => i !== void 0
|
|
1070
|
+
);
|
|
1071
|
+
requestAnimationFrame(() => {
|
|
1072
|
+
var i;
|
|
1073
|
+
s.current = o, (i = c.current) == null || i.setTarget(o);
|
|
1074
|
+
});
|
|
1075
|
+
}, [e]);
|
|
1076
|
+
return G(() => {
|
|
1077
|
+
d();
|
|
1078
|
+
}, [e, d]), ie(() => {
|
|
1079
|
+
d();
|
|
1080
|
+
}), /* @__PURE__ */ t.jsx("group", { ref: l, children: a });
|
|
1081
|
+
}
|
|
1082
|
+
function Be({
|
|
1083
|
+
rapidlyChangingMotionState: e,
|
|
1084
|
+
dhParameters: r,
|
|
1085
|
+
...n
|
|
1086
|
+
}) {
|
|
1087
|
+
const a = new w(), s = R(null), u = R(null);
|
|
1088
|
+
function c(m) {
|
|
1089
|
+
const d = new w();
|
|
1090
|
+
for (let y = 0; y < r.length; y++) {
|
|
1091
|
+
const h = r[y], j = m[y] ?? 0, g = new w().makeRotationY(h.theta).multiply(
|
|
1092
|
+
new w().makeTranslation(
|
|
1093
|
+
h.a / 1e3,
|
|
1094
|
+
(h.d + j * (h.reverse_rotation_direction ? -1 : 1)) / 1e3,
|
|
1095
|
+
0
|
|
1096
|
+
)
|
|
1097
|
+
).multiply(new w().makeRotationX(h.alpha));
|
|
1098
|
+
d.multiply(g);
|
|
1099
|
+
}
|
|
1100
|
+
const o = new T(), i = new U(), p = new T();
|
|
1101
|
+
return d.decompose(o, i, p), o;
|
|
1102
|
+
}
|
|
1103
|
+
const f = c(e.joint_position);
|
|
1104
|
+
function l(m, d) {
|
|
1105
|
+
a.identity();
|
|
1106
|
+
let o = new T();
|
|
1107
|
+
for (let h = 0; h < r.length; h++) {
|
|
1108
|
+
const j = d[h] ?? 0, g = r[h], D = new w().makeRotationY(g.theta).multiply(
|
|
1109
|
+
new w().makeTranslation(
|
|
1110
|
+
g.a / 1e3,
|
|
1111
|
+
(g.d + j * (g.reverse_rotation_direction ? -1 : 1)) / 1e3,
|
|
1112
|
+
0
|
|
1113
|
+
)
|
|
1114
|
+
).multiply(new w().makeRotationX(g.alpha));
|
|
1115
|
+
a.multiply(D);
|
|
1116
|
+
}
|
|
1117
|
+
const i = new T(), p = new U(), y = new T();
|
|
1118
|
+
if (a.decompose(i, p, y), o = i, s.current && s.current.position.set(o.x, o.y, o.z), u.current) {
|
|
1119
|
+
const h = u.current.geometry;
|
|
1120
|
+
h && h.setPositions && h.setPositions([0, 0, 0, o.x, o.y, o.z]);
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
return /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsx(
|
|
1124
|
+
xe,
|
|
1125
|
+
{
|
|
1126
|
+
rapidlyChangingMotionState: e,
|
|
1127
|
+
dhParameters: r,
|
|
1128
|
+
onTranslationChanged: l,
|
|
1129
|
+
children: /* @__PURE__ */ t.jsxs("group", { ...n, name: "Scene", children: [
|
|
1130
|
+
/* @__PURE__ */ t.jsxs("mesh", { name: "Base", position: [0, 0, 0], children: [
|
|
1131
|
+
/* @__PURE__ */ t.jsx("sphereGeometry", { args: [0.02, 32, 32] }),
|
|
1132
|
+
/* @__PURE__ */ t.jsx("meshStandardMaterial", { color: "green", depthTest: !0 })
|
|
1133
|
+
] }),
|
|
1134
|
+
/* @__PURE__ */ t.jsx(
|
|
1135
|
+
O,
|
|
1136
|
+
{
|
|
1137
|
+
ref: u,
|
|
1138
|
+
points: [new T(0, 0, 0), f],
|
|
1139
|
+
color: "White",
|
|
1140
|
+
lineWidth: 5
|
|
1141
|
+
}
|
|
1142
|
+
),
|
|
1143
|
+
/* @__PURE__ */ t.jsxs("mesh", { ref: s, name: "TCP", position: f, children: [
|
|
1144
|
+
/* @__PURE__ */ t.jsx("sphereGeometry", { args: [0.025, 32, 32] }),
|
|
1145
|
+
/* @__PURE__ */ t.jsx("meshStandardMaterial", { color: "red", depthTest: !0 })
|
|
1146
|
+
] })
|
|
1147
|
+
] })
|
|
1148
|
+
}
|
|
1149
|
+
) });
|
|
1150
|
+
}
|
|
1151
|
+
const at = z(
|
|
1152
|
+
({
|
|
1153
|
+
rapidlyChangingMotionState: e,
|
|
1154
|
+
modelFromController: r,
|
|
1155
|
+
dhParameters: n,
|
|
1156
|
+
getModel: a = C,
|
|
1157
|
+
flangeRef: s,
|
|
1158
|
+
postModelRender: u,
|
|
1159
|
+
transparentColor: c,
|
|
1160
|
+
...f
|
|
1161
|
+
}) => {
|
|
1162
|
+
const [l, m] = L(null), d = _((i) => {
|
|
1163
|
+
m(i);
|
|
1164
|
+
}, []);
|
|
1165
|
+
G(() => {
|
|
1166
|
+
l && (c ? pe(l, c) : he(l));
|
|
1167
|
+
}, [l, c]);
|
|
1168
|
+
const o = /* @__PURE__ */ t.jsx(
|
|
1169
|
+
Be,
|
|
1170
|
+
{
|
|
1171
|
+
rapidlyChangingMotionState: e,
|
|
1172
|
+
dhParameters: n,
|
|
1173
|
+
...f
|
|
1174
|
+
}
|
|
1175
|
+
);
|
|
1176
|
+
return /* @__PURE__ */ t.jsxs(
|
|
1177
|
+
ae,
|
|
1178
|
+
{
|
|
1179
|
+
fallback: o,
|
|
1180
|
+
onError: (i) => {
|
|
1181
|
+
console.warn(i);
|
|
1182
|
+
},
|
|
1183
|
+
children: [
|
|
1184
|
+
/* @__PURE__ */ t.jsx(oe, { fallback: o, children: /* @__PURE__ */ t.jsx("group", { ref: d, children: /* @__PURE__ */ t.jsx(
|
|
1185
|
+
xe,
|
|
1186
|
+
{
|
|
1187
|
+
rapidlyChangingMotionState: e,
|
|
1188
|
+
dhParameters: n,
|
|
1189
|
+
children: /* @__PURE__ */ t.jsx(
|
|
1190
|
+
me,
|
|
1191
|
+
{
|
|
1192
|
+
modelURL: (() => {
|
|
1193
|
+
const i = a(r);
|
|
1194
|
+
if (!i) {
|
|
1195
|
+
const p = new Blob([], { type: "model/gltf-binary" }), y = new File([p], `${r}.glb`, { type: "model/gltf-binary" });
|
|
1196
|
+
return Promise.resolve(URL.createObjectURL(y));
|
|
1197
|
+
}
|
|
1198
|
+
return i;
|
|
1199
|
+
})(),
|
|
1200
|
+
postModelRender: u,
|
|
1201
|
+
flangeRef: s,
|
|
1202
|
+
...f
|
|
1203
|
+
}
|
|
1204
|
+
)
|
|
1205
|
+
}
|
|
1206
|
+
) }) }),
|
|
1207
|
+
/* @__PURE__ */ t.jsx(de, {})
|
|
1208
|
+
]
|
|
1209
|
+
}
|
|
1210
|
+
);
|
|
1211
|
+
}
|
|
1212
|
+
);
|
|
1213
|
+
export {
|
|
1214
|
+
tt as C,
|
|
1215
|
+
ee as M,
|
|
1216
|
+
Q as P,
|
|
1217
|
+
Ce as R,
|
|
1218
|
+
nt as S,
|
|
1219
|
+
rt as T,
|
|
1220
|
+
ot as a,
|
|
1221
|
+
at as b,
|
|
1222
|
+
Oe as c,
|
|
1223
|
+
st as d,
|
|
1224
|
+
C as e,
|
|
1225
|
+
Ee as f,
|
|
1226
|
+
it as g
|
|
1227
|
+
};
|
|
1228
|
+
//# sourceMappingURL=SupportedLinearAxis-DAK0IyqZ.js.map
|