@wandelbots/wandelbots-js-react-components 6.0.0-pr.docs-remove-outdated-refs.623.2d4b028 → 6.0.0-pr.motion-smoothing-stream.625.fc2b591
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/3d.cjs +1 -1
- package/dist/3d.d.ts +2 -0
- package/dist/3d.js +15 -12
- package/dist/chunks/{MotionGroupVisualizer-BRec-k-p.js → MotionGroupVisualizer-DNIwFJGs.js} +464 -502
- package/dist/chunks/MotionGroupVisualizer-x3q27PW3.cjs +1 -0
- package/dist/chunks/{theming-BwZXb5-H.cjs → theming-7p1lHeGJ.cjs} +1 -1
- package/dist/chunks/{theming-B2dYJ4Ca.js → theming-p2Ld02o1.js} +1 -1
- package/dist/chunks/useSmoothedMotionState-CG9saPbM.cjs +1 -0
- package/dist/chunks/{interpolation-DG8VTxzS.js → useSmoothedMotionState-DfXIZchM.js} +188 -138
- package/dist/components/robots/LinearAxisAnimator.d.ts +7 -0
- package/dist/components/robots/RobotAnimator.d.ts +7 -0
- 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 +59 -58
- package/package.json +1 -1
- package/dist/chunks/MotionGroupVisualizer-zDM0Lgd-.cjs +0 -1
- package/dist/chunks/interpolation-C9sLsved.cjs +0 -1
|
@@ -1,70 +1,70 @@
|
|
|
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 F } from "@mui/material/styles";
|
|
3
|
+
import w from "@mui/material/Chip";
|
|
4
|
+
import R from "@mui/material/Typography";
|
|
5
|
+
import { observer as V } from "mobx-react-lite";
|
|
6
|
+
import { useTranslation as x } from "react-i18next";
|
|
7
|
+
import { e as N } from "./externalizeComponent-EDymnaGR.js";
|
|
8
|
+
import Y from "@mui/icons-material/Pause";
|
|
9
|
+
import P from "@mui/icons-material/PlayArrow";
|
|
10
|
+
import C from "@mui/icons-material/Stop";
|
|
11
|
+
import I from "@mui/material/Box";
|
|
12
|
+
import D from "@mui/material/Button";
|
|
13
|
+
import { autorun as U, reaction as L, observable as G, runInAction as O } from "mobx";
|
|
14
|
+
import _, { useEffect as S, useState as k, useRef as E } 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 rt = N(
|
|
17
|
+
V(
|
|
18
18
|
({
|
|
19
19
|
state: t,
|
|
20
20
|
onRun: e,
|
|
21
|
-
onPause:
|
|
21
|
+
onPause: i,
|
|
22
22
|
onStop: l,
|
|
23
|
-
onReset:
|
|
23
|
+
onReset: n,
|
|
24
24
|
requiresManualReset: r = !1,
|
|
25
|
-
variant:
|
|
25
|
+
variant: a = "with_pause",
|
|
26
26
|
className: h
|
|
27
27
|
}) => {
|
|
28
|
-
const
|
|
29
|
-
const
|
|
28
|
+
const u = F(), { t: m } = x(), T = () => {
|
|
29
|
+
const o = {
|
|
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:
|
|
46
|
+
color: u.palette.error.main,
|
|
47
47
|
onClick: l
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
-
return
|
|
51
|
-
},
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
54
|
-
return
|
|
55
|
-
switch (
|
|
50
|
+
return a === "without_pause" ? [o.run, o.stop] : [o.run, o.pause, o.stop];
|
|
51
|
+
}, c = (o) => {
|
|
52
|
+
const s = { sx: { fontSize: "55px" } };
|
|
53
|
+
if (a === "without_pause")
|
|
54
|
+
return o === 0 ? /* @__PURE__ */ g(P, { ...s }) : /* @__PURE__ */ g(C, { ...s });
|
|
55
|
+
switch (o) {
|
|
56
56
|
case 0:
|
|
57
|
-
return /* @__PURE__ */
|
|
57
|
+
return /* @__PURE__ */ g(P, { ...s });
|
|
58
58
|
case 1:
|
|
59
|
-
return /* @__PURE__ */
|
|
59
|
+
return /* @__PURE__ */ g(Y, { ...s });
|
|
60
60
|
case 2:
|
|
61
|
-
return /* @__PURE__ */
|
|
61
|
+
return /* @__PURE__ */ g(C, { ...s });
|
|
62
62
|
default:
|
|
63
63
|
return null;
|
|
64
64
|
}
|
|
65
|
-
},
|
|
66
|
-
return /* @__PURE__ */
|
|
67
|
-
|
|
65
|
+
}, p = T();
|
|
66
|
+
return /* @__PURE__ */ g(
|
|
67
|
+
I,
|
|
68
68
|
{
|
|
69
69
|
className: h,
|
|
70
70
|
sx: {
|
|
@@ -73,8 +73,8 @@ const Q = O(
|
|
|
73
73
|
alignItems: "center",
|
|
74
74
|
gap: 2
|
|
75
75
|
},
|
|
76
|
-
children: /* @__PURE__ */
|
|
77
|
-
|
|
76
|
+
children: /* @__PURE__ */ g(
|
|
77
|
+
I,
|
|
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:
|
|
87
|
-
|
|
86
|
+
children: p.map((o, s) => /* @__PURE__ */ M(
|
|
87
|
+
I,
|
|
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: !o.enabled || t === "preparing" || t === "starting" || t === "pausing" || t === "stopping" && !r,
|
|
101
|
+
onClick: o.onClick,
|
|
102
102
|
sx: {
|
|
103
103
|
width: "88px",
|
|
104
104
|
height: "88px",
|
|
105
105
|
borderRadius: "88px",
|
|
106
|
-
backgroundColor:
|
|
107
|
-
opacity:
|
|
106
|
+
backgroundColor: o.color,
|
|
107
|
+
opacity: o.enabled && t !== "preparing" && t !== "starting" && t !== "pausing" && !(t === "stopping" && !r) ? 1 : 0.3,
|
|
108
108
|
"&:hover": {
|
|
109
|
-
backgroundColor:
|
|
110
|
-
opacity:
|
|
109
|
+
backgroundColor: o.color,
|
|
110
|
+
opacity: o.enabled && t !== "preparing" && t !== "starting" && t !== "pausing" && !(t === "stopping" && !r) ? 0.8 : 0.3
|
|
111
111
|
},
|
|
112
112
|
"&:disabled": {
|
|
113
|
-
backgroundColor:
|
|
113
|
+
backgroundColor: o.color,
|
|
114
114
|
opacity: 0.3
|
|
115
115
|
},
|
|
116
116
|
minWidth: "88px",
|
|
117
117
|
flexShrink: 0
|
|
118
118
|
},
|
|
119
|
-
children:
|
|
119
|
+
children: c(s)
|
|
120
120
|
}
|
|
121
121
|
),
|
|
122
|
-
/* @__PURE__ */
|
|
123
|
-
|
|
122
|
+
/* @__PURE__ */ g(
|
|
123
|
+
R,
|
|
124
124
|
{
|
|
125
125
|
variant: "body1",
|
|
126
126
|
sx: {
|
|
127
|
-
color:
|
|
127
|
+
color: o.enabled && t !== "preparing" && t !== "starting" && t !== "pausing" && !(t === "stopping" && !r) ? o.color : u.palette.text.disabled,
|
|
128
128
|
textAlign: "center",
|
|
129
|
-
opacity:
|
|
129
|
+
opacity: o.enabled && t !== "preparing" && t !== "starting" && t !== "pausing" && !(t === "stopping" && !r) ? 1 : 0.3
|
|
130
130
|
},
|
|
131
|
-
children:
|
|
131
|
+
children: o.label
|
|
132
132
|
}
|
|
133
133
|
)
|
|
134
134
|
]
|
|
135
135
|
},
|
|
136
|
-
|
|
136
|
+
o.label
|
|
137
137
|
))
|
|
138
138
|
}
|
|
139
139
|
)
|
|
@@ -141,89 +141,89 @@ const Q = O(
|
|
|
141
141
|
);
|
|
142
142
|
}
|
|
143
143
|
)
|
|
144
|
-
),
|
|
145
|
-
|
|
144
|
+
), nt = N(
|
|
145
|
+
V(
|
|
146
146
|
({
|
|
147
147
|
programState: t,
|
|
148
148
|
safetyState: e,
|
|
149
|
-
operationMode:
|
|
149
|
+
operationMode: i,
|
|
150
150
|
className: l
|
|
151
151
|
}) => {
|
|
152
|
-
const
|
|
152
|
+
const n = F(), { t: r } = x(), 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: n.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: n.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: n.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: n.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: n.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: n.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: n.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: n.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: n.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: n.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: n.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: n.palette.error.main
|
|
214
214
|
};
|
|
215
215
|
default:
|
|
216
216
|
return {
|
|
217
217
|
label: r("ProgramStateIndicator.Ready.lb"),
|
|
218
|
-
color:
|
|
218
|
+
color: n.palette.success.main
|
|
219
219
|
};
|
|
220
220
|
}
|
|
221
221
|
return {
|
|
222
222
|
label: r("ProgramStateIndicator.Idle.lb"),
|
|
223
|
-
color:
|
|
223
|
+
color: n.palette.grey[600]
|
|
224
224
|
};
|
|
225
|
-
}, { label: h, color:
|
|
226
|
-
switch (
|
|
225
|
+
}, { label: h, color: u } = a(), T = `${h} / ${(() => {
|
|
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
242
|
className: l,
|
|
243
|
-
label: /* @__PURE__ */
|
|
244
|
-
|
|
243
|
+
label: /* @__PURE__ */ g(
|
|
244
|
+
R,
|
|
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: T
|
|
253
253
|
}
|
|
254
254
|
),
|
|
255
255
|
variant: "filled",
|
|
256
256
|
sx: {
|
|
257
|
-
backgroundColor:
|
|
258
|
-
color:
|
|
257
|
+
backgroundColor: u,
|
|
258
|
+
color: n.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 A(t) {
|
|
272
|
+
S(t, []);
|
|
273
273
|
}
|
|
274
|
-
function
|
|
275
|
-
|
|
274
|
+
function y(t) {
|
|
275
|
+
A(() => U(t));
|
|
276
276
|
}
|
|
277
|
-
function
|
|
278
|
-
|
|
277
|
+
function ot(t, e, i) {
|
|
278
|
+
A(() => L(t, e, i));
|
|
279
279
|
}
|
|
280
|
-
function
|
|
281
|
-
return
|
|
280
|
+
function it(t) {
|
|
281
|
+
return A(() => {
|
|
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, l = !0;
|
|
317
317
|
this.updateCount++;
|
|
318
|
-
const
|
|
319
|
-
for (let
|
|
320
|
-
const h = this.currentValues[
|
|
321
|
-
Math.abs(
|
|
318
|
+
const n = Math.min(e, 1 / 15), r = this.updateCount === 1 ? 0.7 : 1;
|
|
319
|
+
for (let a = 0; a < this.currentValues.length; a++) {
|
|
320
|
+
const h = this.currentValues[a], u = this.targetValues[a], m = this.velocities[a], T = u - h, c = T * this.options.tension * r, p = m * this.options.friction, o = c - p, s = m + o * n, b = h + s * n;
|
|
321
|
+
Math.abs(T) < this.options.threshold && Math.abs(s) < this.options.threshold * 10 ? this.currentValues[a] !== u && (this.currentValues[a] = u, this.velocities[a] = 0, i = !0) : (l = !1, this.currentValues[a] = b, this.velocities[a] = s, i = !0);
|
|
322
322
|
}
|
|
323
|
-
return
|
|
323
|
+
return i && this.options.onChange(this.currentValues), l && this.options.onComplete(this.currentValues), l;
|
|
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(), l = i - this.targetUpdateTime;
|
|
333
|
+
this.previousTargetValues = [...this.targetValues], this.targetValues = [...e], this.targetUpdateTime = i, this.updateCount = 0;
|
|
334
|
+
const n = this.previousTargetValues.every(
|
|
335
|
+
(r, a) => r === this.currentValues[a]
|
|
336
336
|
);
|
|
337
|
-
if (l < 8 && l > 0 && this.previousTargetValues.length > 0 && !
|
|
337
|
+
if (l < 8 && l > 0 && this.previousTargetValues.length > 0 && !n) {
|
|
338
338
|
const r = Math.min(l / 8, 1);
|
|
339
|
-
for (let
|
|
340
|
-
const h = this.previousTargetValues[
|
|
341
|
-
Math.abs(
|
|
339
|
+
for (let a = 0; a < this.targetValues.length; a++) {
|
|
340
|
+
const h = this.previousTargetValues[a] || 0, u = e[a] || 0;
|
|
341
|
+
Math.abs(u - h) > 0.1 && (this.targetValues[a] = h + (u - h) * r);
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
for (; this.currentValues.length < e.length; )
|
|
@@ -410,24 +410,74 @@ class D {
|
|
|
410
410
|
this.animationId === null && this.animate();
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
|
-
function
|
|
414
|
-
const
|
|
415
|
-
return
|
|
413
|
+
function at(t = [], e = {}) {
|
|
414
|
+
const i = _.useRef(null);
|
|
415
|
+
return i.current || (i.current = new v(t, e)), _.useEffect(() => {
|
|
416
416
|
var l;
|
|
417
|
-
(l =
|
|
418
|
-
}, [e]),
|
|
417
|
+
(l = i.current) == null || l.updateOptions(e);
|
|
418
|
+
}, [e]), _.useEffect(() => () => {
|
|
419
419
|
var l;
|
|
420
|
-
(l =
|
|
421
|
-
}, []), [
|
|
420
|
+
(l = i.current) == null || l.destroy();
|
|
421
|
+
}, []), [i.current];
|
|
422
|
+
}
|
|
423
|
+
function lt(t, e) {
|
|
424
|
+
const [i] = k(
|
|
425
|
+
() => G({ ...t })
|
|
426
|
+
), l = E(null), n = E(null), r = E(0), a = E(t);
|
|
427
|
+
a.current = t;
|
|
428
|
+
function h() {
|
|
429
|
+
n.current !== null && (cancelAnimationFrame(n.current), n.current = null);
|
|
430
|
+
}
|
|
431
|
+
function u() {
|
|
432
|
+
const c = l.current;
|
|
433
|
+
if (!c) return;
|
|
434
|
+
const p = performance.now(), o = (p - r.current) / 1e3;
|
|
435
|
+
r.current = p;
|
|
436
|
+
const s = c.update(o);
|
|
437
|
+
O(() => {
|
|
438
|
+
i.joint_position = c.getCurrentValues();
|
|
439
|
+
}), n.current = s ? null : requestAnimationFrame(u);
|
|
440
|
+
}
|
|
441
|
+
function m() {
|
|
442
|
+
n.current === null && (r.current = performance.now(), n.current = requestAnimationFrame(u));
|
|
443
|
+
}
|
|
444
|
+
function T(c) {
|
|
445
|
+
var o;
|
|
446
|
+
const p = c.joint_position.filter(
|
|
447
|
+
(s) => s !== void 0
|
|
448
|
+
);
|
|
449
|
+
(o = l.current) == null || o.setTarget(p), O(() => {
|
|
450
|
+
const s = c, b = i;
|
|
451
|
+
for (const f of Object.keys(s))
|
|
452
|
+
f !== "joint_position" && (b[f] = s[f]);
|
|
453
|
+
}), m();
|
|
454
|
+
}
|
|
455
|
+
return A(() => {
|
|
456
|
+
const c = t.joint_position.filter(
|
|
457
|
+
(p) => p !== void 0
|
|
458
|
+
);
|
|
459
|
+
return l.current = new v(c, e), () => {
|
|
460
|
+
var p;
|
|
461
|
+
h(), (p = l.current) == null || p.destroy();
|
|
462
|
+
};
|
|
463
|
+
}), S(() => {
|
|
464
|
+
var c;
|
|
465
|
+
e && ((c = l.current) == null || c.updateOptions(e));
|
|
466
|
+
}, [e == null ? void 0 : e.tension, e == null ? void 0 : e.friction, e == null ? void 0 : e.threshold]), y(() => {
|
|
467
|
+
T(a.current);
|
|
468
|
+
}), S(() => {
|
|
469
|
+
T(t);
|
|
470
|
+
}, [t]), i;
|
|
422
471
|
}
|
|
423
472
|
export {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
473
|
+
d as P,
|
|
474
|
+
v as V,
|
|
475
|
+
rt as a,
|
|
476
|
+
nt as b,
|
|
477
|
+
A as c,
|
|
478
|
+
y as d,
|
|
479
|
+
ot as e,
|
|
480
|
+
it as f,
|
|
481
|
+
at as g,
|
|
482
|
+
lt as u
|
|
433
483
|
};
|
|
@@ -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 {};
|
|
@@ -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;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { MotionGroupState } from "@wandelbots/nova-js/v2";
|
|
2
|
+
import { type InterpolationOptions } from "./interpolation";
|
|
3
|
+
/**
|
|
4
|
+
* Smooths the joint stream of a `MotionGroupState` and returns a new, derived
|
|
5
|
+
* motion state to feed the robot visualizer.
|
|
6
|
+
*
|
|
7
|
+
* Smoothing is a transformation over the joint stream, not a concern of the
|
|
8
|
+
* visualizer: the visualizer renders whatever pose it is given, as-is. This
|
|
9
|
+
* hook sits in front of it — `raw stream → useSmoothedMotionState → visualizer`
|
|
10
|
+
* — so consumers who want spring-damped previews opt in, and consumers who
|
|
11
|
+
* stream already-exact poses (e.g. scrubbing a planned trajectory) simply skip
|
|
12
|
+
* it and get frame-accurate tracking.
|
|
13
|
+
*
|
|
14
|
+
* The returned object is a **stable, MobX-observable** motion state whose
|
|
15
|
+
* `joint_position` is mutated in place every animation frame while the spring
|
|
16
|
+
* settles. Because the object identity never changes, passing it to
|
|
17
|
+
* `<SupportedRobot rapidlyChangingMotionState={...} />` triggers no React
|
|
18
|
+
* re-renders — the visualizer's own MobX autorun reacts to the mutation and
|
|
19
|
+
* updates the scene directly. All non-joint fields mirror the latest input.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* const smoothed = useSmoothedMotionState(
|
|
24
|
+
* connectedMotionGroup.rapidlyChangingMotionState,
|
|
25
|
+
* { tension: 120, friction: 20 },
|
|
26
|
+
* )
|
|
27
|
+
*
|
|
28
|
+
* <SupportedRobot rapidlyChangingMotionState={smoothed} {...props} />
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function useSmoothedMotionState(motionState: MotionGroupState, options?: InterpolationOptions): MotionGroupState;
|
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/theming-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/theming-7p1lHeGJ.cjs"),o=require("./chunks/useSmoothedMotionState-CG9saPbM.cjs"),t=require("./chunks/externalizeComponent-OO4jcrz5.cjs"),a=require("./chunks/SafetyBar-DPrv_OQA.cjs");exports.AdornedTextField=e.AdornedTextField;exports.AppHeader=e.AppHeader;exports.ConnectedMotionGroup=e.ConnectedMotionGroup;exports.CycleTimer=e.CycleTimer;exports.JoggerConnection=e.JoggerConnection;exports.JoggingCartesianAxisControl=e.JoggingCartesianAxisControl;exports.JoggingJointValueControl=e.JoggingJointValueControl;exports.JoggingPanel=e.JoggingPanel;exports.JoggingStore=e.JoggingStore;exports.LoadingCover=e.LoadingCover;exports.LoadingErrorMessage=e.LoadingErrorMessage;exports.LogPanel=e.LogPanel;exports.LogStore=e.LogStore;exports.LogViewer=e.LogViewer;exports.MotionStreamConnection=e.MotionStreamConnection;exports.NoMotionGroupModal=e.NoMotionGroupModal;exports.PoseCartesianValues=e.PoseCartesianValues;exports.PoseJointValues=e.PoseJointValues;exports.RobotListItem=e.RobotListItem;exports.RobotSetupReadinessIndicator=e.RobotSetupReadinessIndicator;exports.RobotSetupReadinessState=e.RobotSetupReadinessState;exports.SelectableFab=e.SelectableFab;exports.TabBar=e.TabBar;exports.Timer=e.Timer;exports.VelocitySlider=e.VelocitySlider;exports.VelocitySliderLabel=e.VelocitySliderLabel;exports.WandelbotsDataGrid=e.WandelbotsDataGrid;exports.createDebugMessage=e.createDebugMessage;exports.createErrorMessage=e.createErrorMessage;exports.createInfoMessage=e.createInfoMessage;exports.createLogMessage=e.createLogMessage;exports.createNovaMuiTheme=e.createNovaMuiTheme;exports.createNovaTheme=e.createNovaTheme;exports.createWarningMessage=e.createWarningMessage;exports.jointValuesEqual=e.jointValuesEqual;exports.poseEqual=e.poseEqual;exports.tcpMotionEqual=e.tcpMotionEqual;exports.unwrapRotationVector=e.unwrapRotationVector;exports.ProgramControl=o.ProgramControl;exports.ProgramState=o.ProgramState;exports.ProgramStateIndicator=o.ProgramStateIndicator;exports.ValueInterpolator=o.ValueInterpolator;exports.useAnimationFrame=o.useAnimationFrame;exports.useAutorun=o.useAutorun;exports.useInterpolation=o.useInterpolation;exports.useMounted=o.useMounted;exports.useReaction=o.useReaction;exports.useSmoothedMotionState=o.useSmoothedMotionState;exports.i18n=t.i18n;exports.SafetyBar=a.SafetyBar;
|
package/dist/core.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export * from "./components/TabBar";
|
|
|
22
22
|
export * from "./components/Timer";
|
|
23
23
|
export * from "./components/utils/hooks";
|
|
24
24
|
export * from "./components/utils/interpolation";
|
|
25
|
+
export * from "./components/utils/useSmoothedMotionState";
|
|
25
26
|
export * from "./components/VelocitySlider";
|
|
26
27
|
export * from "./i18n/config";
|
|
27
28
|
export * from "./lib/ConnectedMotionGroup";
|