@wandelbots/wandelbots-js-react-components 6.0.0 → 6.1.0
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 +3 -8
- package/dist/3d.cjs +1 -1
- package/dist/3d.d.ts +2 -0
- package/dist/3d.js +19 -13
- package/dist/chunks/MotionGroupVisualizer-DSm6iyOs.cjs +1 -0
- package/dist/chunks/{MotionGroupVisualizer-BRec-k-p.js → MotionGroupVisualizer-cHohruur.js} +473 -471
- package/dist/chunks/{theming-B2dYJ4Ca.js → theming-DAGR3D4x.js} +1 -1
- package/dist/chunks/{theming-BwZXb5-H.cjs → theming-DfSy4-Ic.cjs} +1 -1
- package/dist/chunks/{interpolation-DG8VTxzS.js → useSmoothedMotionState-CpGsrwj4.js} +191 -146
- package/dist/chunks/useSmoothedMotionState-VYxEIyfr.cjs +1 -0
- package/dist/components/robots/LinearAxisAnimator.d.ts +7 -0
- package/dist/components/robots/MotionGroupVisualizer.d.ts +15 -0
- package/dist/components/robots/RobotAnimator.d.ts +7 -0
- package/dist/components/robots/SupportedLinearAxis.d.ts +18 -1
- package/dist/components/robots/SupportedRobot.d.ts +20 -1
- package/dist/components/utils/useSmoothedMotionState.d.ts +31 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +1 -0
- package/dist/core.js +14 -13
- package/dist/index.cjs +1 -1
- package/dist/index.js +67 -63
- package/package.json +1 -1
- package/dist/chunks/MotionGroupVisualizer-zDM0Lgd-.cjs +0 -1
- package/dist/chunks/interpolation-C9sLsved.cjs +0 -1
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useTheme as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { observer as
|
|
6
|
-
import { useTranslation as
|
|
7
|
-
import { e as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { autorun as
|
|
14
|
-
import
|
|
15
|
-
var
|
|
16
|
-
const
|
|
17
|
-
|
|
1
|
+
import { jsx as g, jsxs as M } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme as O } from "@mui/material/styles";
|
|
3
|
+
import w from "@mui/material/Chip";
|
|
4
|
+
import F from "@mui/material/Typography";
|
|
5
|
+
import { observer as R } from "mobx-react-lite";
|
|
6
|
+
import { useTranslation as V } from "react-i18next";
|
|
7
|
+
import { e as x } from "./externalizeComponent-EDymnaGR.js";
|
|
8
|
+
import Y from "@mui/icons-material/Pause";
|
|
9
|
+
import S from "@mui/icons-material/PlayArrow";
|
|
10
|
+
import P from "@mui/icons-material/Stop";
|
|
11
|
+
import A from "@mui/material/Box";
|
|
12
|
+
import D from "@mui/material/Button";
|
|
13
|
+
import { autorun as N, reaction as U, observable as L, runInAction as C } from "mobx";
|
|
14
|
+
import b, { useEffect as _, useState as G, useRef as I } from "react";
|
|
15
|
+
var d = /* @__PURE__ */ ((t) => (t.IDLE = "idle", t.PREPARING = "preparing", t.STARTING = "starting", t.RUNNING = "running", t.PAUSING = "pausing", t.PAUSED = "paused", t.STOPPING = "stopping", t.COMPLETED = "completed", t.FAILED = "failed", t.STOPPED = "stopped", t.ERROR = "error", t))(d || {});
|
|
16
|
+
const et = x(
|
|
17
|
+
R(
|
|
18
18
|
({
|
|
19
19
|
state: t,
|
|
20
20
|
onRun: e,
|
|
21
|
-
onPause:
|
|
22
|
-
onStop:
|
|
23
|
-
onReset:
|
|
21
|
+
onPause: i,
|
|
22
|
+
onStop: s,
|
|
23
|
+
onReset: o,
|
|
24
24
|
requiresManualReset: r = !1,
|
|
25
|
-
variant:
|
|
26
|
-
className:
|
|
25
|
+
variant: a = "with_pause",
|
|
26
|
+
className: p
|
|
27
27
|
}) => {
|
|
28
|
-
const
|
|
29
|
-
const
|
|
28
|
+
const u = O(), { t: m } = V(), l = () => {
|
|
29
|
+
const n = {
|
|
30
30
|
run: {
|
|
31
31
|
enabled: t === "idle" || t === "stopped" || t === "paused" || t === "completed" || t === "failed" || t === "error",
|
|
32
32
|
label: m(t === "paused" ? "ProgramControl.Resume.bt" : t === "error" || t === "failed" ? "ProgramControl.Retry.bt" : "ProgramControl.Start.bt"),
|
|
33
|
-
color:
|
|
33
|
+
color: u.palette.success.main,
|
|
34
34
|
onClick: e
|
|
35
35
|
},
|
|
36
36
|
pause: {
|
|
37
37
|
enabled: t === "running",
|
|
38
38
|
label: m("ProgramControl.Pause.bt"),
|
|
39
39
|
color: "#FFFFFF33",
|
|
40
|
-
onClick:
|
|
40
|
+
onClick: i || (() => {
|
|
41
41
|
})
|
|
42
42
|
},
|
|
43
43
|
stop: {
|
|
44
44
|
enabled: t === "preparing" || t === "starting" || t === "running" || t === "pausing" || t === "paused",
|
|
45
45
|
label: m("ProgramControl.Stop.bt"),
|
|
46
|
-
color:
|
|
47
|
-
onClick:
|
|
46
|
+
color: u.palette.error.main,
|
|
47
|
+
onClick: s
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
-
return
|
|
51
|
-
},
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
54
|
-
return
|
|
55
|
-
switch (
|
|
50
|
+
return a === "without_pause" ? [n.run, n.stop] : [n.run, n.pause, n.stop];
|
|
51
|
+
}, h = (n) => {
|
|
52
|
+
const c = { sx: { fontSize: "55px" } };
|
|
53
|
+
if (a === "without_pause")
|
|
54
|
+
return n === 0 ? /* @__PURE__ */ g(S, { ...c }) : /* @__PURE__ */ g(P, { ...c });
|
|
55
|
+
switch (n) {
|
|
56
56
|
case 0:
|
|
57
|
-
return /* @__PURE__ */
|
|
57
|
+
return /* @__PURE__ */ g(S, { ...c });
|
|
58
58
|
case 1:
|
|
59
|
-
return /* @__PURE__ */
|
|
59
|
+
return /* @__PURE__ */ g(Y, { ...c });
|
|
60
60
|
case 2:
|
|
61
|
-
return /* @__PURE__ */
|
|
61
|
+
return /* @__PURE__ */ g(P, { ...c });
|
|
62
62
|
default:
|
|
63
63
|
return null;
|
|
64
64
|
}
|
|
65
|
-
}, T =
|
|
66
|
-
return /* @__PURE__ */
|
|
67
|
-
|
|
65
|
+
}, T = l();
|
|
66
|
+
return /* @__PURE__ */ g(
|
|
67
|
+
A,
|
|
68
68
|
{
|
|
69
|
-
className:
|
|
69
|
+
className: p,
|
|
70
70
|
sx: {
|
|
71
71
|
display: "flex",
|
|
72
72
|
flexDirection: "column",
|
|
73
73
|
alignItems: "center",
|
|
74
74
|
gap: 2
|
|
75
75
|
},
|
|
76
|
-
children: /* @__PURE__ */
|
|
77
|
-
|
|
76
|
+
children: /* @__PURE__ */ g(
|
|
77
|
+
A,
|
|
78
78
|
{
|
|
79
79
|
sx: {
|
|
80
80
|
display: "flex",
|
|
@@ -83,8 +83,8 @@ const Q = O(
|
|
|
83
83
|
justifyContent: "center",
|
|
84
84
|
alignItems: "center"
|
|
85
85
|
},
|
|
86
|
-
children: T.map((
|
|
87
|
-
|
|
86
|
+
children: T.map((n, c) => /* @__PURE__ */ M(
|
|
87
|
+
A,
|
|
88
88
|
{
|
|
89
89
|
sx: {
|
|
90
90
|
display: "flex",
|
|
@@ -93,47 +93,47 @@ const Q = O(
|
|
|
93
93
|
gap: 1
|
|
94
94
|
},
|
|
95
95
|
children: [
|
|
96
|
-
/* @__PURE__ */
|
|
97
|
-
|
|
96
|
+
/* @__PURE__ */ g(
|
|
97
|
+
D,
|
|
98
98
|
{
|
|
99
99
|
variant: "contained",
|
|
100
|
-
disabled: !
|
|
101
|
-
onClick:
|
|
100
|
+
disabled: !n.enabled || t === "preparing" || t === "starting" || t === "pausing" || t === "stopping" && !r,
|
|
101
|
+
onClick: n.onClick,
|
|
102
102
|
sx: {
|
|
103
103
|
width: "88px",
|
|
104
104
|
height: "88px",
|
|
105
105
|
borderRadius: "88px",
|
|
106
|
-
backgroundColor:
|
|
107
|
-
opacity:
|
|
106
|
+
backgroundColor: n.color,
|
|
107
|
+
opacity: n.enabled && t !== "preparing" && t !== "starting" && t !== "pausing" && !(t === "stopping" && !r) ? 1 : 0.3,
|
|
108
108
|
"&:hover": {
|
|
109
|
-
backgroundColor:
|
|
110
|
-
opacity:
|
|
109
|
+
backgroundColor: n.color,
|
|
110
|
+
opacity: n.enabled && t !== "preparing" && t !== "starting" && t !== "pausing" && !(t === "stopping" && !r) ? 0.8 : 0.3
|
|
111
111
|
},
|
|
112
112
|
"&:disabled": {
|
|
113
|
-
backgroundColor:
|
|
113
|
+
backgroundColor: n.color,
|
|
114
114
|
opacity: 0.3
|
|
115
115
|
},
|
|
116
116
|
minWidth: "88px",
|
|
117
117
|
flexShrink: 0
|
|
118
118
|
},
|
|
119
|
-
children:
|
|
119
|
+
children: h(c)
|
|
120
120
|
}
|
|
121
121
|
),
|
|
122
|
-
/* @__PURE__ */
|
|
123
|
-
|
|
122
|
+
/* @__PURE__ */ g(
|
|
123
|
+
F,
|
|
124
124
|
{
|
|
125
125
|
variant: "body1",
|
|
126
126
|
sx: {
|
|
127
|
-
color:
|
|
127
|
+
color: n.enabled && t !== "preparing" && t !== "starting" && t !== "pausing" && !(t === "stopping" && !r) ? n.color : u.palette.text.disabled,
|
|
128
128
|
textAlign: "center",
|
|
129
|
-
opacity:
|
|
129
|
+
opacity: n.enabled && t !== "preparing" && t !== "starting" && t !== "pausing" && !(t === "stopping" && !r) ? 1 : 0.3
|
|
130
130
|
},
|
|
131
|
-
children:
|
|
131
|
+
children: n.label
|
|
132
132
|
}
|
|
133
133
|
)
|
|
134
134
|
]
|
|
135
135
|
},
|
|
136
|
-
|
|
136
|
+
n.label
|
|
137
137
|
))
|
|
138
138
|
}
|
|
139
139
|
)
|
|
@@ -141,89 +141,89 @@ const Q = O(
|
|
|
141
141
|
);
|
|
142
142
|
}
|
|
143
143
|
)
|
|
144
|
-
),
|
|
145
|
-
|
|
144
|
+
), rt = x(
|
|
145
|
+
R(
|
|
146
146
|
({
|
|
147
147
|
programState: t,
|
|
148
148
|
safetyState: e,
|
|
149
|
-
operationMode:
|
|
150
|
-
className:
|
|
149
|
+
operationMode: i,
|
|
150
|
+
className: s
|
|
151
151
|
}) => {
|
|
152
|
-
const
|
|
152
|
+
const o = O(), { t: r } = V(), a = () => {
|
|
153
153
|
if (e === "SAFETY_STATE_DEVICE_EMERGENCY_STOP" || e === "SAFETY_STATE_ROBOT_EMERGENCY_STOP" || e === "SAFETY_STATE_STOP_0" || e === "SAFETY_STATE_STOP_1" || e === "SAFETY_STATE_STOP_2" || e === "SAFETY_STATE_PROTECTIVE_STOP" || e === "SAFETY_STATE_STOP" || e === "SAFETY_STATE_REDUCED" || e === "SAFETY_STATE_MASTERING" || e === "SAFETY_STATE_CONFIRM_SAFETY" || e === "SAFETY_STATE_OPERATOR_SAFETY" || e === "SAFETY_STATE_RECOVERY" || e === "SAFETY_STATE_VIOLATION")
|
|
154
154
|
return {
|
|
155
155
|
label: r("ProgramStateIndicator.EStop.lb"),
|
|
156
|
-
color:
|
|
156
|
+
color: o.palette.error.main
|
|
157
157
|
};
|
|
158
158
|
if (e === "SAFETY_STATE_UNKNOWN" || e === "SAFETY_STATE_FAULT")
|
|
159
159
|
return {
|
|
160
160
|
label: r("ProgramStateIndicator.Error.lb"),
|
|
161
|
-
color:
|
|
161
|
+
color: o.palette.error.main
|
|
162
162
|
};
|
|
163
163
|
if (e === "SAFETY_STATE_NORMAL")
|
|
164
164
|
switch (t) {
|
|
165
|
-
case
|
|
165
|
+
case d.PREPARING:
|
|
166
166
|
return {
|
|
167
167
|
label: r("ProgramStateIndicator.Preparing.lb"),
|
|
168
|
-
color:
|
|
168
|
+
color: o.palette.warning.main
|
|
169
169
|
};
|
|
170
|
-
case
|
|
170
|
+
case d.STARTING:
|
|
171
171
|
return {
|
|
172
172
|
label: r("ProgramStateIndicator.Starting.lb"),
|
|
173
|
-
color:
|
|
173
|
+
color: o.palette.warning.main
|
|
174
174
|
};
|
|
175
|
-
case
|
|
175
|
+
case d.RUNNING:
|
|
176
176
|
return {
|
|
177
177
|
label: r("ProgramStateIndicator.Running.lb"),
|
|
178
|
-
color:
|
|
178
|
+
color: o.palette.success.main
|
|
179
179
|
};
|
|
180
|
-
case
|
|
180
|
+
case d.PAUSING:
|
|
181
181
|
return {
|
|
182
182
|
label: r("ProgramStateIndicator.Pausing.lb"),
|
|
183
|
-
color:
|
|
183
|
+
color: o.palette.warning.main
|
|
184
184
|
};
|
|
185
|
-
case
|
|
185
|
+
case d.PAUSED:
|
|
186
186
|
return {
|
|
187
187
|
label: r("ProgramStateIndicator.Paused.lb"),
|
|
188
|
-
color:
|
|
188
|
+
color: o.palette.grey[600]
|
|
189
189
|
};
|
|
190
|
-
case
|
|
190
|
+
case d.STOPPING:
|
|
191
191
|
return {
|
|
192
192
|
label: r("ProgramStateIndicator.Stopping.lb"),
|
|
193
|
-
color:
|
|
193
|
+
color: o.palette.warning.main
|
|
194
194
|
};
|
|
195
|
-
case
|
|
195
|
+
case d.COMPLETED:
|
|
196
196
|
return {
|
|
197
197
|
label: r("ProgramStateIndicator.Completed.lb"),
|
|
198
|
-
color:
|
|
198
|
+
color: o.palette.success.main
|
|
199
199
|
};
|
|
200
|
-
case
|
|
200
|
+
case d.FAILED:
|
|
201
201
|
return {
|
|
202
202
|
label: r("ProgramStateIndicator.Failed.lb"),
|
|
203
|
-
color:
|
|
203
|
+
color: o.palette.error.main
|
|
204
204
|
};
|
|
205
|
-
case
|
|
205
|
+
case d.STOPPED:
|
|
206
206
|
return {
|
|
207
207
|
label: r("ProgramStateIndicator.Stopped.lb"),
|
|
208
|
-
color:
|
|
208
|
+
color: o.palette.warning.main
|
|
209
209
|
};
|
|
210
|
-
case
|
|
210
|
+
case d.ERROR:
|
|
211
211
|
return {
|
|
212
212
|
label: r("ProgramStateIndicator.Error.lb"),
|
|
213
|
-
color:
|
|
213
|
+
color: o.palette.error.main
|
|
214
214
|
};
|
|
215
215
|
default:
|
|
216
216
|
return {
|
|
217
217
|
label: r("ProgramStateIndicator.Ready.lb"),
|
|
218
|
-
color:
|
|
218
|
+
color: o.palette.success.main
|
|
219
219
|
};
|
|
220
220
|
}
|
|
221
221
|
return {
|
|
222
222
|
label: r("ProgramStateIndicator.Idle.lb"),
|
|
223
|
-
color:
|
|
223
|
+
color: o.palette.grey[600]
|
|
224
224
|
};
|
|
225
|
-
}, { label:
|
|
226
|
-
switch (
|
|
225
|
+
}, { label: p, color: u } = a(), l = `${p} / ${(() => {
|
|
226
|
+
switch (i) {
|
|
227
227
|
case "OPERATION_MODE_AUTO":
|
|
228
228
|
return r("ProgramStateIndicator.Auto.lb");
|
|
229
229
|
case "OPERATION_MODE_MANUAL":
|
|
@@ -236,12 +236,12 @@ const Q = O(
|
|
|
236
236
|
return r("ProgramStateIndicator.Auto.lb");
|
|
237
237
|
}
|
|
238
238
|
})()}`;
|
|
239
|
-
return /* @__PURE__ */
|
|
240
|
-
|
|
239
|
+
return /* @__PURE__ */ g(
|
|
240
|
+
w,
|
|
241
241
|
{
|
|
242
|
-
className:
|
|
243
|
-
label: /* @__PURE__ */
|
|
244
|
-
|
|
242
|
+
className: s,
|
|
243
|
+
label: /* @__PURE__ */ g(
|
|
244
|
+
F,
|
|
245
245
|
{
|
|
246
246
|
variant: "body2",
|
|
247
247
|
sx: {
|
|
@@ -249,13 +249,13 @@ const Q = O(
|
|
|
249
249
|
// Smaller than body2
|
|
250
250
|
lineHeight: 1.2
|
|
251
251
|
},
|
|
252
|
-
children:
|
|
252
|
+
children: l
|
|
253
253
|
}
|
|
254
254
|
),
|
|
255
255
|
variant: "filled",
|
|
256
256
|
sx: {
|
|
257
|
-
backgroundColor:
|
|
258
|
-
color:
|
|
257
|
+
backgroundColor: u,
|
|
258
|
+
color: o.palette.getContrastText(u),
|
|
259
259
|
fontWeight: 500,
|
|
260
260
|
height: "auto",
|
|
261
261
|
"& .MuiChip-label": {
|
|
@@ -268,28 +268,28 @@ const Q = O(
|
|
|
268
268
|
}
|
|
269
269
|
)
|
|
270
270
|
);
|
|
271
|
-
function
|
|
272
|
-
|
|
271
|
+
function E(t) {
|
|
272
|
+
_(t, []);
|
|
273
273
|
}
|
|
274
|
-
function
|
|
275
|
-
|
|
274
|
+
function nt(t) {
|
|
275
|
+
E(() => N(t));
|
|
276
276
|
}
|
|
277
|
-
function
|
|
278
|
-
|
|
277
|
+
function ot(t, e, i) {
|
|
278
|
+
E(() => U(t, e, i));
|
|
279
279
|
}
|
|
280
|
-
function
|
|
281
|
-
return
|
|
280
|
+
function it(t) {
|
|
281
|
+
return E(() => {
|
|
282
282
|
let e;
|
|
283
|
-
function
|
|
284
|
-
t(), e = requestAnimationFrame(
|
|
283
|
+
function i() {
|
|
284
|
+
t(), e = requestAnimationFrame(i);
|
|
285
285
|
}
|
|
286
|
-
return e = requestAnimationFrame(
|
|
286
|
+
return e = requestAnimationFrame(i), () => {
|
|
287
287
|
cancelAnimationFrame(e);
|
|
288
288
|
};
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
|
-
class
|
|
292
|
-
constructor(e = [],
|
|
291
|
+
class v {
|
|
292
|
+
constructor(e = [], i = {}) {
|
|
293
293
|
this.currentValues = [], this.targetValues = [], this.previousTargetValues = [], this.targetUpdateTime = 0, this.animationId = null, this.updateCount = 0, this.velocities = [], this.animate = () => {
|
|
294
294
|
this.update(0.016666666666666666) ? this.animationId = null : this.animationId = requestAnimationFrame(this.animate);
|
|
295
295
|
}, this.options = {
|
|
@@ -300,7 +300,7 @@ class D {
|
|
|
300
300
|
},
|
|
301
301
|
onComplete: () => {
|
|
302
302
|
},
|
|
303
|
-
...
|
|
303
|
+
...i
|
|
304
304
|
}, this.currentValues = [...e], this.targetValues = [...e], this.previousTargetValues = [...e], this.velocities = new Array(e.length).fill(0), this.targetUpdateTime = performance.now(), this.updateCount = 0;
|
|
305
305
|
}
|
|
306
306
|
/**
|
|
@@ -313,14 +313,14 @@ class D {
|
|
|
313
313
|
* @returns true when interpolation is complete (all values reached their targets)
|
|
314
314
|
*/
|
|
315
315
|
update(e = 1 / 60) {
|
|
316
|
-
let
|
|
316
|
+
let i = !1, s = !0;
|
|
317
317
|
this.updateCount++;
|
|
318
|
-
const
|
|
319
|
-
for (let
|
|
320
|
-
const
|
|
321
|
-
Math.abs(
|
|
318
|
+
const o = Math.min(e, 1 / 15), r = this.updateCount === 1 ? 0.7 : 1;
|
|
319
|
+
for (let a = 0; a < this.currentValues.length; a++) {
|
|
320
|
+
const p = this.currentValues[a], u = this.targetValues[a], m = this.velocities[a], l = u - p, h = l * this.options.tension * r, T = m * this.options.friction, n = h - T, c = m + n * o, f = p + c * o;
|
|
321
|
+
Math.abs(l) < this.options.threshold && Math.abs(c) < this.options.threshold * 10 ? this.currentValues[a] !== u && (this.currentValues[a] = u, this.velocities[a] = 0, i = !0) : (s = !1, this.currentValues[a] = f, this.velocities[a] = c, i = !0);
|
|
322
322
|
}
|
|
323
|
-
return
|
|
323
|
+
return i && this.options.onChange(this.currentValues), s && this.options.onComplete(this.currentValues), s;
|
|
324
324
|
}
|
|
325
325
|
/**
|
|
326
326
|
* Set new target values for the interpolation to move towards
|
|
@@ -329,16 +329,16 @@ class D {
|
|
|
329
329
|
* to prevent jarring movements when targets change frequently.
|
|
330
330
|
*/
|
|
331
331
|
setTarget(e) {
|
|
332
|
-
const
|
|
333
|
-
this.previousTargetValues = [...this.targetValues], this.targetValues = [...e], this.targetUpdateTime =
|
|
334
|
-
const
|
|
335
|
-
(r,
|
|
332
|
+
const i = performance.now(), s = i - this.targetUpdateTime;
|
|
333
|
+
this.previousTargetValues = [...this.targetValues], this.targetValues = [...e], this.targetUpdateTime = i, this.updateCount = 0;
|
|
334
|
+
const o = this.previousTargetValues.every(
|
|
335
|
+
(r, a) => r === this.currentValues[a]
|
|
336
336
|
);
|
|
337
|
-
if (
|
|
338
|
-
const r = Math.min(
|
|
339
|
-
for (let
|
|
340
|
-
const
|
|
341
|
-
Math.abs(
|
|
337
|
+
if (s < 8 && s > 0 && this.previousTargetValues.length > 0 && !o) {
|
|
338
|
+
const r = Math.min(s / 8, 1);
|
|
339
|
+
for (let a = 0; a < this.targetValues.length; a++) {
|
|
340
|
+
const p = this.previousTargetValues[a] || 0, u = e[a] || 0;
|
|
341
|
+
Math.abs(u - p) > 0.1 && (this.targetValues[a] = p + (u - p) * r);
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
for (; this.currentValues.length < e.length; )
|
|
@@ -410,24 +410,69 @@ class D {
|
|
|
410
410
|
this.animationId === null && this.animate();
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
|
-
function
|
|
414
|
-
const
|
|
415
|
-
return
|
|
416
|
-
var
|
|
417
|
-
(
|
|
418
|
-
}, [e]),
|
|
413
|
+
function at(t = [], e = {}) {
|
|
414
|
+
const i = b.useRef(null);
|
|
415
|
+
return i.current || (i.current = new v(t, e)), b.useEffect(() => {
|
|
416
|
+
var s;
|
|
417
|
+
(s = i.current) == null || s.updateOptions(e);
|
|
418
|
+
}, [e]), b.useEffect(() => () => {
|
|
419
|
+
var s;
|
|
420
|
+
(s = i.current) == null || s.destroy();
|
|
421
|
+
}, []), [i.current];
|
|
422
|
+
}
|
|
423
|
+
function st(t, e) {
|
|
424
|
+
const [i] = G(
|
|
425
|
+
() => L({ ...t })
|
|
426
|
+
), s = I(null), o = I(null), r = I(0);
|
|
427
|
+
function a() {
|
|
428
|
+
o.current !== null && (cancelAnimationFrame(o.current), o.current = null);
|
|
429
|
+
}
|
|
430
|
+
function p() {
|
|
431
|
+
const l = s.current;
|
|
432
|
+
if (!l) return;
|
|
433
|
+
const h = performance.now(), T = (h - r.current) / 1e3;
|
|
434
|
+
r.current = h;
|
|
435
|
+
const n = l.update(T);
|
|
436
|
+
C(() => {
|
|
437
|
+
i.joint_position = l.getCurrentValues();
|
|
438
|
+
}), o.current = n ? null : requestAnimationFrame(p);
|
|
439
|
+
}
|
|
440
|
+
function u() {
|
|
441
|
+
o.current === null && (r.current = performance.now(), o.current = requestAnimationFrame(p));
|
|
442
|
+
}
|
|
443
|
+
function m(l) {
|
|
444
|
+
var T;
|
|
445
|
+
const h = l.joint_position.filter(
|
|
446
|
+
(n) => n !== void 0
|
|
447
|
+
);
|
|
448
|
+
(T = s.current) == null || T.setTarget(h), C(() => {
|
|
449
|
+
const n = l, c = i;
|
|
450
|
+
for (const f of Object.keys(n))
|
|
451
|
+
f !== "joint_position" && c[f] !== n[f] && (c[f] = n[f]);
|
|
452
|
+
}), u();
|
|
453
|
+
}
|
|
454
|
+
return E(() => {
|
|
455
|
+
const l = t.joint_position.filter(
|
|
456
|
+
(h) => h !== void 0
|
|
457
|
+
);
|
|
458
|
+
return s.current = new v(l, e), () => {
|
|
459
|
+
var h;
|
|
460
|
+
a(), (h = s.current) == null || h.destroy();
|
|
461
|
+
};
|
|
462
|
+
}), _(() => {
|
|
419
463
|
var l;
|
|
420
|
-
(l =
|
|
421
|
-
}, []), [
|
|
464
|
+
e && ((l = s.current) == null || l.updateOptions(e));
|
|
465
|
+
}, [e]), _(() => N(() => m(t)), [t]), i;
|
|
422
466
|
}
|
|
423
467
|
export {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
468
|
+
d as P,
|
|
469
|
+
v as V,
|
|
470
|
+
et as a,
|
|
471
|
+
rt as b,
|
|
472
|
+
E as c,
|
|
473
|
+
nt as d,
|
|
474
|
+
ot as e,
|
|
475
|
+
it as f,
|
|
476
|
+
at as g,
|
|
477
|
+
st as u
|
|
433
478
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const g=require("react/jsx-runtime"),C=require("@mui/material/styles"),V=require("@mui/material/Chip"),x=require("@mui/material/Typography"),O=require("mobx-react-lite"),R=require("react-i18next"),F=require("./externalizeComponent-OO4jcrz5.cjs"),N=require("@mui/icons-material/Pause"),_=require("@mui/icons-material/PlayArrow"),P=require("@mui/icons-material/Stop"),f=require("@mui/material/Box"),v=require("@mui/material/Button"),b=require("mobx"),T=require("react");var m=(e=>(e.IDLE="idle",e.PREPARING="preparing",e.STARTING="starting",e.RUNNING="running",e.PAUSING="pausing",e.PAUSED="paused",e.STOPPING="stopping",e.COMPLETED="completed",e.FAILED="failed",e.STOPPED="stopped",e.ERROR="error",e))(m||{});const M=F.externalizeComponent(O.observer(({state:e,onRun:t,onPause:i,onStop:s,onReset:o,requiresManualReset:r=!1,variant:a="with_pause",className:p})=>{const u=C.useTheme(),{t:d}=R.useTranslation(),l=()=>{const n={run:{enabled:e==="idle"||e==="stopped"||e==="paused"||e==="completed"||e==="failed"||e==="error",label:d(e==="paused"?"ProgramControl.Resume.bt":e==="error"||e==="failed"?"ProgramControl.Retry.bt":"ProgramControl.Start.bt"),color:u.palette.success.main,onClick:t},pause:{enabled:e==="running",label:d("ProgramControl.Pause.bt"),color:"#FFFFFF33",onClick:i||(()=>{})},stop:{enabled:e==="preparing"||e==="starting"||e==="running"||e==="pausing"||e==="paused",label:d("ProgramControl.Stop.bt"),color:u.palette.error.main,onClick:s}};return a==="without_pause"?[n.run,n.stop]:[n.run,n.pause,n.stop]},h=n=>{const c={sx:{fontSize:"55px"}};if(a==="without_pause")return n===0?g.jsx(_,{...c}):g.jsx(P,{...c});switch(n){case 0:return g.jsx(_,{...c});case 1:return g.jsx(N,{...c});case 2:return g.jsx(P,{...c});default:return null}},A=l();return g.jsx(f,{className:p,sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:2},children:g.jsx(f,{sx:{display:"flex",gap:"40px",flexWrap:"wrap",justifyContent:"center",alignItems:"center"},children:A.map((n,c)=>g.jsxs(f,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:1},children:[g.jsx(v,{variant:"contained",disabled:!n.enabled||e==="preparing"||e==="starting"||e==="pausing"||e==="stopping"&&!r,onClick:n.onClick,sx:{width:"88px",height:"88px",borderRadius:"88px",backgroundColor:n.color,opacity:n.enabled&&e!=="preparing"&&e!=="starting"&&e!=="pausing"&&!(e==="stopping"&&!r)?1:.3,"&:hover":{backgroundColor:n.color,opacity:n.enabled&&e!=="preparing"&&e!=="starting"&&e!=="pausing"&&!(e==="stopping"&&!r)?.8:.3},"&:disabled":{backgroundColor:n.color,opacity:.3},minWidth:"88px",flexShrink:0},children:h(c)}),g.jsx(x,{variant:"body1",sx:{color:n.enabled&&e!=="preparing"&&e!=="starting"&&e!=="pausing"&&!(e==="stopping"&&!r)?n.color:u.palette.text.disabled,textAlign:"center",opacity:n.enabled&&e!=="preparing"&&e!=="starting"&&e!=="pausing"&&!(e==="stopping"&&!r)?1:.3},children:n.label})]},n.label))})})})),w=F.externalizeComponent(O.observer(({programState:e,safetyState:t,operationMode:i,className:s})=>{const o=C.useTheme(),{t:r}=R.useTranslation(),a=()=>{if(t==="SAFETY_STATE_DEVICE_EMERGENCY_STOP"||t==="SAFETY_STATE_ROBOT_EMERGENCY_STOP"||t==="SAFETY_STATE_STOP_0"||t==="SAFETY_STATE_STOP_1"||t==="SAFETY_STATE_STOP_2"||t==="SAFETY_STATE_PROTECTIVE_STOP"||t==="SAFETY_STATE_STOP"||t==="SAFETY_STATE_REDUCED"||t==="SAFETY_STATE_MASTERING"||t==="SAFETY_STATE_CONFIRM_SAFETY"||t==="SAFETY_STATE_OPERATOR_SAFETY"||t==="SAFETY_STATE_RECOVERY"||t==="SAFETY_STATE_VIOLATION")return{label:r("ProgramStateIndicator.EStop.lb"),color:o.palette.error.main};if(t==="SAFETY_STATE_UNKNOWN"||t==="SAFETY_STATE_FAULT")return{label:r("ProgramStateIndicator.Error.lb"),color:o.palette.error.main};if(t==="SAFETY_STATE_NORMAL")switch(e){case m.PREPARING:return{label:r("ProgramStateIndicator.Preparing.lb"),color:o.palette.warning.main};case m.STARTING:return{label:r("ProgramStateIndicator.Starting.lb"),color:o.palette.warning.main};case m.RUNNING:return{label:r("ProgramStateIndicator.Running.lb"),color:o.palette.success.main};case m.PAUSING:return{label:r("ProgramStateIndicator.Pausing.lb"),color:o.palette.warning.main};case m.PAUSED:return{label:r("ProgramStateIndicator.Paused.lb"),color:o.palette.grey[600]};case m.STOPPING:return{label:r("ProgramStateIndicator.Stopping.lb"),color:o.palette.warning.main};case m.COMPLETED:return{label:r("ProgramStateIndicator.Completed.lb"),color:o.palette.success.main};case m.FAILED:return{label:r("ProgramStateIndicator.Failed.lb"),color:o.palette.error.main};case m.STOPPED:return{label:r("ProgramStateIndicator.Stopped.lb"),color:o.palette.warning.main};case m.ERROR:return{label:r("ProgramStateIndicator.Error.lb"),color:o.palette.error.main};default:return{label:r("ProgramStateIndicator.Ready.lb"),color:o.palette.success.main}}return{label:r("ProgramStateIndicator.Idle.lb"),color:o.palette.grey[600]}},{label:p,color:u}=a(),l=`${p} / ${(()=>{switch(i){case"OPERATION_MODE_AUTO":return r("ProgramStateIndicator.Auto.lb");case"OPERATION_MODE_MANUAL":return r("ProgramStateIndicator.Manual.lb");case"OPERATION_MODE_MANUAL_T1":return r("ProgramStateIndicator.ManualT1.lb");case"OPERATION_MODE_MANUAL_T2":return r("ProgramStateIndicator.ManualT2.lb");default:return r("ProgramStateIndicator.Auto.lb")}})()}`;return g.jsx(V,{className:s,label:g.jsx(x,{variant:"body2",sx:{fontSize:"0.75rem",lineHeight:1.2},children:l}),variant:"filled",sx:{backgroundColor:u,color:o.palette.getContrastText(u),fontWeight:500,height:"auto","& .MuiChip-label":{paddingX:1.5,paddingY:.5}}})}));function I(e){T.useEffect(e,[])}function Y(e){I(()=>b.autorun(e))}function j(e,t,i){I(()=>b.reaction(e,t,i))}function D(e){return I(()=>{let t;function i(){e(),t=requestAnimationFrame(i)}return t=requestAnimationFrame(i),()=>{cancelAnimationFrame(t)}})}class S{constructor(t=[],i={}){this.currentValues=[],this.targetValues=[],this.previousTargetValues=[],this.targetUpdateTime=0,this.animationId=null,this.updateCount=0,this.velocities=[],this.animate=()=>{this.update(.016666666666666666)?this.animationId=null:this.animationId=requestAnimationFrame(this.animate)},this.options={tension:120,friction:20,threshold:.001,onChange:()=>{},onComplete:()=>{},...i},this.currentValues=[...t],this.targetValues=[...t],this.previousTargetValues=[...t],this.velocities=new Array(t.length).fill(0),this.targetUpdateTime=performance.now(),this.updateCount=0}update(t=1/60){let i=!1,s=!0;this.updateCount++;const o=Math.min(t,1/15),r=this.updateCount===1?.7:1;for(let a=0;a<this.currentValues.length;a++){const p=this.currentValues[a],u=this.targetValues[a],d=this.velocities[a],l=u-p,h=l*this.options.tension*r,A=d*this.options.friction,n=h-A,c=d+n*o,E=p+c*o;Math.abs(l)<this.options.threshold&&Math.abs(c)<this.options.threshold*10?this.currentValues[a]!==u&&(this.currentValues[a]=u,this.velocities[a]=0,i=!0):(s=!1,this.currentValues[a]=E,this.velocities[a]=c,i=!0)}return i&&this.options.onChange(this.currentValues),s&&this.options.onComplete(this.currentValues),s}setTarget(t){const i=performance.now(),s=i-this.targetUpdateTime;this.previousTargetValues=[...this.targetValues],this.targetValues=[...t],this.targetUpdateTime=i,this.updateCount=0;const o=this.previousTargetValues.every((r,a)=>r===this.currentValues[a]);if(s<8&&s>0&&this.previousTargetValues.length>0&&!o){const r=Math.min(s/8,1);for(let a=0;a<this.targetValues.length;a++){const p=this.previousTargetValues[a]||0,u=t[a]||0;Math.abs(u-p)>.1&&(this.targetValues[a]=p+(u-p)*r)}}for(;this.currentValues.length<t.length;)this.currentValues.push(t[this.currentValues.length]),this.velocities.push(0);this.currentValues.length>t.length&&(this.currentValues=this.currentValues.slice(0,t.length),this.velocities=this.velocities.slice(0,t.length))}getCurrentValues(){return[...this.currentValues]}getValue(t){return this.currentValues[t]??0}isInterpolating(){return this.animationId!==null}stop(){this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null)}setImmediate(t){this.stop(),this.currentValues=[...t],this.targetValues=[...t],this.previousTargetValues=[...t],this.velocities=new Array(t.length).fill(0),this.targetUpdateTime=performance.now(),this.updateCount=0,this.options.onChange(this.currentValues)}updateOptions(t){this.options={...this.options,...t}}startAutoInterpolation(){this.startInterpolation()}destroy(){this.stop()}startInterpolation(){this.animationId===null&&this.animate()}}function U(e=[],t={}){const i=T.useRef(null);return i.current||(i.current=new S(e,t)),T.useEffect(()=>{var s;(s=i.current)==null||s.updateOptions(t)},[t]),T.useEffect(()=>()=>{var s;(s=i.current)==null||s.destroy()},[]),[i.current]}function L(e,t){const[i]=T.useState(()=>b.observable({...e})),s=T.useRef(null),o=T.useRef(null),r=T.useRef(0);function a(){o.current!==null&&(cancelAnimationFrame(o.current),o.current=null)}function p(){const l=s.current;if(!l)return;const h=performance.now(),A=(h-r.current)/1e3;r.current=h;const n=l.update(A);b.runInAction(()=>{i.joint_position=l.getCurrentValues()}),o.current=n?null:requestAnimationFrame(p)}function u(){o.current===null&&(r.current=performance.now(),o.current=requestAnimationFrame(p))}function d(l){var A;const h=l.joint_position.filter(n=>n!==void 0);(A=s.current)==null||A.setTarget(h),b.runInAction(()=>{const n=l,c=i;for(const E of Object.keys(n))E!=="joint_position"&&c[E]!==n[E]&&(c[E]=n[E])}),u()}return I(()=>{const l=e.joint_position.filter(h=>h!==void 0);return s.current=new S(l,t),()=>{var h;a(),(h=s.current)==null||h.destroy()}}),T.useEffect(()=>{var l;t&&((l=s.current)==null||l.updateOptions(t))},[t]),T.useEffect(()=>b.autorun(()=>d(e)),[e]),i}exports.ProgramControl=M;exports.ProgramState=m;exports.ProgramStateIndicator=w;exports.ValueInterpolator=S;exports.useAnimationFrame=D;exports.useAutorun=Y;exports.useInterpolation=U;exports.useMounted=I;exports.useReaction=j;exports.useSmoothedMotionState=L;
|
|
@@ -7,5 +7,12 @@ type LinearAxisAnimatorProps = {
|
|
|
7
7
|
onTranslationChanged?: (joints: Object3D[], jointValues: number[]) => void;
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Applies the incoming motion state to the linear axis, as-is.
|
|
12
|
+
*
|
|
13
|
+
* This component performs no smoothing: it renders exactly the pose it is
|
|
14
|
+
* given. If damped/spring transitions are desired, run the motion state
|
|
15
|
+
* through {@link useSmoothedMotionState} before passing it here.
|
|
16
|
+
*/
|
|
10
17
|
export default function LinearAxisAnimator({ rapidlyChangingMotionState, dhParameters, onTranslationChanged, children, }: LinearAxisAnimatorProps): import("react/jsx-runtime").JSX.Element;
|
|
11
18
|
export {};
|
|
@@ -5,5 +5,20 @@ export type MotionGroupVisualizerProps = {
|
|
|
5
5
|
instanceUrl: string;
|
|
6
6
|
inverseSolver?: string | null;
|
|
7
7
|
} & (SupportedRobotProps | SupportedLinearAxisProps);
|
|
8
|
+
/**
|
|
9
|
+
* Picks the right visualizer for the motion group (robot, turntable or linear
|
|
10
|
+
* axis) and renders it at exactly the pose it is given — no smoothing.
|
|
11
|
+
*
|
|
12
|
+
* For spring-damped transitions, use {@link MotionGroupVisualizer}.
|
|
13
|
+
*/
|
|
14
|
+
export declare const MotionGroupVisualizerExact: React.FC<MotionGroupVisualizerProps>;
|
|
15
|
+
/**
|
|
16
|
+
* Motion group visualizer with built-in spring smoothing of the joint stream.
|
|
17
|
+
*
|
|
18
|
+
* Thin wrapper that runs the incoming motion state through
|
|
19
|
+
* {@link useSmoothedMotionState} and renders {@link MotionGroupVisualizerExact}.
|
|
20
|
+
* It is the batteries-included default; drop down to `MotionGroupVisualizerExact`
|
|
21
|
+
* when you need to control or disable smoothing.
|
|
22
|
+
*/
|
|
8
23
|
export declare const MotionGroupVisualizer: React.FC<MotionGroupVisualizerProps>;
|
|
9
24
|
export default MotionGroupVisualizer;
|
|
@@ -16,5 +16,12 @@ type RobotAnimatorProps = {
|
|
|
16
16
|
onRotationChanged?: (joints: Object3D[], jointValues: number[]) => void;
|
|
17
17
|
children: React.ReactNode;
|
|
18
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* Applies the incoming motion state to the robot's joints, as-is.
|
|
21
|
+
*
|
|
22
|
+
* This component performs no smoothing: it renders exactly the pose it is
|
|
23
|
+
* given. If damped/spring transitions are desired, run the motion state
|
|
24
|
+
* through {@link useSmoothedMotionState} before passing it here.
|
|
25
|
+
*/
|
|
19
26
|
declare const RobotAnimator: React.ForwardRefExoticComponent<RobotAnimatorProps & React.RefAttributes<RobotAnimatorHandle>>;
|
|
20
27
|
export default RobotAnimator;
|
|
@@ -15,5 +15,22 @@ export type SupportedLinearAxisProps = {
|
|
|
15
15
|
postModelRender?: () => void;
|
|
16
16
|
transparentColor?: string;
|
|
17
17
|
} & ThreeElements["group"];
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Renders the linear axis at exactly the pose it is given, frame by frame — no
|
|
20
|
+
* smoothing, so it tracks the streamed motion state with no lag or overshoot.
|
|
21
|
+
*
|
|
22
|
+
* Use this when the incoming stream is already the exact pose to display. For
|
|
23
|
+
* spring-damped transitions, use {@link SupportedLinearAxis}, or compose
|
|
24
|
+
* {@link useSmoothedMotionState} with this component yourself.
|
|
25
|
+
*/
|
|
26
|
+
export declare const SupportedLinearAxisExact: ({ rapidlyChangingMotionState, modelFromController, dhParameters, getModel, flangeRef, postModelRender, transparentColor, instanceUrl, ...props }: SupportedLinearAxisProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
/**
|
|
28
|
+
* Linear axis visualizer with built-in spring smoothing of the joint stream.
|
|
29
|
+
*
|
|
30
|
+
* Thin wrapper that runs the incoming motion state through
|
|
31
|
+
* {@link useSmoothedMotionState} and renders {@link SupportedLinearAxisExact}.
|
|
32
|
+
* It is the batteries-included default; drop down to `SupportedLinearAxisExact`
|
|
33
|
+
* when you need to control or disable smoothing.
|
|
34
|
+
*/
|
|
35
|
+
export declare const SupportedLinearAxis: ({ rapidlyChangingMotionState, ...props }: SupportedLinearAxisProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
36
|
export default SupportedLinearAxis;
|