@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
|
@@ -15,5 +15,24 @@ export type SupportedRobotProps = {
|
|
|
15
15
|
postModelRender?: () => void;
|
|
16
16
|
transparentColor?: string;
|
|
17
17
|
} & ThreeElements["group"];
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Renders the robot 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 (e.g.
|
|
23
|
+
* scrubbing a planned trajectory). For spring-damped transitions, use
|
|
24
|
+
* {@link SupportedRobot}, or compose {@link useSmoothedMotionState} with this
|
|
25
|
+
* component yourself.
|
|
26
|
+
*/
|
|
27
|
+
export declare const SupportedRobotExact: ({ rapidlyChangingMotionState, modelFromController, dhParameters, getModel, flangeRef, postModelRender, transparentColor, instanceUrl, ...props }: SupportedRobotProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
/**
|
|
29
|
+
* Robot visualizer with built-in spring smoothing of the joint stream.
|
|
30
|
+
*
|
|
31
|
+
* This is a thin wrapper that runs the incoming motion state through
|
|
32
|
+
* {@link useSmoothedMotionState} and renders {@link SupportedRobotExact}. It is
|
|
33
|
+
* the batteries-included default; drop down to `SupportedRobotExact` (optionally
|
|
34
|
+
* with your own {@link useSmoothedMotionState} configuration) when you need to
|
|
35
|
+
* control or disable smoothing.
|
|
36
|
+
*/
|
|
37
|
+
export declare const SupportedRobot: ({ rapidlyChangingMotionState, ...props }: SupportedRobotProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
38
|
export default SupportedRobot;
|
|
@@ -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-DfSy4-Ic.cjs"),o=require("./chunks/useSmoothedMotionState-VYxEIyfr.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";
|
package/dist/core.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as o, b as s, u as t, C as r, v as n, d as i, e as g, f as l, J as u, h as c, i as d, j as m, L as p, p as
|
|
2
|
-
import { a as D, P as k, b as z, V as H,
|
|
3
|
-
import { i as
|
|
4
|
-
import { S as
|
|
1
|
+
import { A as o, b as s, u as t, C as r, v as n, d as i, e as g, f as l, J as u, h as c, i as d, j as m, L as p, p as S, M, N as b, P as C, g as V, R as L, r as P, q as f, S as J, T as R, s as x, V as T, t as A, W as I, l as y, o as E, m as h, k as q, a as v, c as N, n as w, w as F, x as G, y as W, z as j } from "./chunks/theming-DAGR3D4x.js";
|
|
2
|
+
import { a as D, P as k, b as z, V as H, f as K, d as O, g as Q, c as U, e as X, u as Y } from "./chunks/useSmoothedMotionState-CpGsrwj4.js";
|
|
3
|
+
import { i as _ } from "./chunks/externalizeComponent-EDymnaGR.js";
|
|
4
|
+
import { S as aa } from "./chunks/SafetyBar-Cy9DiXp9.js";
|
|
5
5
|
export {
|
|
6
6
|
o as AdornedTextField,
|
|
7
7
|
s as AppHeader,
|
|
@@ -16,8 +16,8 @@ export {
|
|
|
16
16
|
d as LoadingErrorMessage,
|
|
17
17
|
m as LogPanel,
|
|
18
18
|
p as LogStore,
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
S as LogViewer,
|
|
20
|
+
M as MotionStreamConnection,
|
|
21
21
|
b as NoMotionGroupModal,
|
|
22
22
|
C as PoseCartesianValues,
|
|
23
23
|
V as PoseJointValues,
|
|
@@ -27,7 +27,7 @@ export {
|
|
|
27
27
|
L as RobotListItem,
|
|
28
28
|
P as RobotSetupReadinessIndicator,
|
|
29
29
|
f as RobotSetupReadinessState,
|
|
30
|
-
|
|
30
|
+
aa as SafetyBar,
|
|
31
31
|
J as SelectableFab,
|
|
32
32
|
R as TabBar,
|
|
33
33
|
x as Timer,
|
|
@@ -37,12 +37,12 @@ export {
|
|
|
37
37
|
I as WandelbotsDataGrid,
|
|
38
38
|
y as createDebugMessage,
|
|
39
39
|
E as createErrorMessage,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
h as createInfoMessage,
|
|
41
|
+
q as createLogMessage,
|
|
42
|
+
v as createNovaMuiTheme,
|
|
43
|
+
N as createNovaTheme,
|
|
44
44
|
w as createWarningMessage,
|
|
45
|
-
|
|
45
|
+
_ as i18n,
|
|
46
46
|
F as jointValuesEqual,
|
|
47
47
|
G as poseEqual,
|
|
48
48
|
W as tcpMotionEqual,
|
|
@@ -51,5 +51,6 @@ export {
|
|
|
51
51
|
O as useAutorun,
|
|
52
52
|
Q as useInterpolation,
|
|
53
53
|
U as useMounted,
|
|
54
|
-
X as useReaction
|
|
54
|
+
X as useReaction,
|
|
55
|
+
Y as useSmoothedMotionState
|
|
55
56
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./chunks/MotionGroupVisualizer-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./chunks/MotionGroupVisualizer-DSm6iyOs.cjs"),t=require("./chunks/useSmoothedMotionState-VYxEIyfr.cjs"),e=require("./chunks/theming-DfSy4-Ic.cjs"),r=require("./chunks/externalizeComponent-OO4jcrz5.cjs"),a=require("./chunks/SafetyBar-DPrv_OQA.cjs");exports.CollisionSceneRenderer=o.CollisionSceneRenderer;exports.LinearAxis=o.LinearAxis;exports.MANUFACTURER_HOME_CONFIGS=o.MANUFACTURER_HOME_CONFIGS;exports.MotionGroupVisualizer=o.MotionGroupVisualizer;exports.MotionGroupVisualizerExact=o.MotionGroupVisualizerExact;exports.PresetEnvironment=o.PresetEnvironment;exports.Robot=o.Robot;exports.RobotCard=o.RobotCard;exports.SafetyZonesRenderer=o.SafetyZonesRenderer;exports.SupportedLinearAxis=o.SupportedLinearAxis;exports.SupportedLinearAxisExact=o.SupportedLinearAxisExact;exports.SupportedRobot=o.SupportedRobot;exports.SupportedRobotExact=o.SupportedRobotExact;exports.TrajectoryRenderer=o.TrajectoryRenderer;exports.defaultAxisConfig=o.defaultAxisConfig;exports.defaultGetModel=o.defaultGetModel;exports.extractManufacturer=o.extractManufacturer;exports.getDefaultHomeConfig=o.getDefaultHomeConfig;exports.ProgramControl=t.ProgramControl;exports.ProgramState=t.ProgramState;exports.ProgramStateIndicator=t.ProgramStateIndicator;exports.ValueInterpolator=t.ValueInterpolator;exports.useAnimationFrame=t.useAnimationFrame;exports.useAutorun=t.useAutorun;exports.useInterpolation=t.useInterpolation;exports.useMounted=t.useMounted;exports.useReaction=t.useReaction;exports.useSmoothedMotionState=t.useSmoothedMotionState;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.i18n=r.i18n;exports.SafetyBar=a.SafetyBar;
|
package/dist/index.js
CHANGED
|
@@ -1,71 +1,75 @@
|
|
|
1
|
-
import { C as o, L as s, M as t,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { i as
|
|
5
|
-
import { S as
|
|
1
|
+
import { C as o, L as s, M as t, k as r, j as n, P as i, b as u, R as g, S as l, f as d, c, i as p, h as S, T as M, a as m, d as C, e as R, g as f } from "./chunks/MotionGroupVisualizer-cHohruur.js";
|
|
2
|
+
import { a as x, P as L, b as V, V as A, f as E, d as P, g as T, c as J, e as y, u as G } from "./chunks/useSmoothedMotionState-CpGsrwj4.js";
|
|
3
|
+
import { A as N, b as h, u as v, C as F, v as j, d as q, e as w, f as z, J as D, h as H, i as W, j as k, L as B, p as O, M as U, N as _, P as Z, g as K, R as Q, r as X, q as Y, S as $, T as aa, s as ea, V as oa, t as sa, W as ta, l as ra, o as na, m as ia, k as ua, a as ga, c as la, n as da, w as ca, x as pa, y as Sa, z as Ma } from "./chunks/theming-DAGR3D4x.js";
|
|
4
|
+
import { i as Ca } from "./chunks/externalizeComponent-EDymnaGR.js";
|
|
5
|
+
import { S as fa } from "./chunks/SafetyBar-Cy9DiXp9.js";
|
|
6
6
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
N as AdornedTextField,
|
|
8
|
+
h as AppHeader,
|
|
9
9
|
o as CollisionSceneRenderer,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
v as ConnectedMotionGroup,
|
|
11
|
+
F as CycleTimer,
|
|
12
|
+
j as JoggerConnection,
|
|
13
|
+
q as JoggingCartesianAxisControl,
|
|
14
|
+
w as JoggingJointValueControl,
|
|
15
|
+
z as JoggingPanel,
|
|
16
|
+
D as JoggingStore,
|
|
17
17
|
s as LinearAxis,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
H as LoadingCover,
|
|
19
|
+
W as LoadingErrorMessage,
|
|
20
|
+
k as LogPanel,
|
|
21
|
+
B as LogStore,
|
|
22
|
+
O as LogViewer,
|
|
23
23
|
t as MANUFACTURER_HOME_CONFIGS,
|
|
24
24
|
r as MotionGroupVisualizer,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
n as MotionGroupVisualizerExact,
|
|
26
|
+
U as MotionStreamConnection,
|
|
27
|
+
_ as NoMotionGroupModal,
|
|
28
|
+
Z as PoseCartesianValues,
|
|
29
|
+
K as PoseJointValues,
|
|
30
|
+
i as PresetEnvironment,
|
|
31
|
+
x as ProgramControl,
|
|
32
|
+
L as ProgramState,
|
|
33
|
+
V as ProgramStateIndicator,
|
|
34
|
+
u as Robot,
|
|
34
35
|
g as RobotCard,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
Q as RobotListItem,
|
|
37
|
+
X as RobotSetupReadinessIndicator,
|
|
38
|
+
Y as RobotSetupReadinessState,
|
|
39
|
+
fa as SafetyBar,
|
|
39
40
|
l as SafetyZonesRenderer,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
41
|
+
$ as SelectableFab,
|
|
42
|
+
d as SupportedLinearAxis,
|
|
43
|
+
c as SupportedLinearAxisExact,
|
|
44
|
+
p as SupportedRobot,
|
|
45
|
+
S as SupportedRobotExact,
|
|
46
|
+
aa as TabBar,
|
|
47
|
+
ea as Timer,
|
|
48
|
+
M as TrajectoryRenderer,
|
|
49
|
+
A as ValueInterpolator,
|
|
50
|
+
oa as VelocitySlider,
|
|
51
|
+
sa as VelocitySliderLabel,
|
|
52
|
+
ta as WandelbotsDataGrid,
|
|
53
|
+
ra as createDebugMessage,
|
|
54
|
+
na as createErrorMessage,
|
|
55
|
+
ia as createInfoMessage,
|
|
56
|
+
ua as createLogMessage,
|
|
57
|
+
ga as createNovaMuiTheme,
|
|
58
|
+
la as createNovaTheme,
|
|
59
|
+
da as createWarningMessage,
|
|
60
|
+
m as defaultAxisConfig,
|
|
61
|
+
C as defaultGetModel,
|
|
62
|
+
R as extractManufacturer,
|
|
63
|
+
f as getDefaultHomeConfig,
|
|
64
|
+
Ca as i18n,
|
|
65
|
+
ca as jointValuesEqual,
|
|
66
|
+
pa as poseEqual,
|
|
67
|
+
Sa as tcpMotionEqual,
|
|
68
|
+
Ma as unwrapRotationVector,
|
|
69
|
+
E as useAnimationFrame,
|
|
70
|
+
P as useAutorun,
|
|
71
|
+
T as useInterpolation,
|
|
72
|
+
J as useMounted,
|
|
73
|
+
y as useReaction,
|
|
74
|
+
G as useSmoothedMotionState
|
|
71
75
|
};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),b=require("three"),O=require("three-stdlib"),l=require("react"),L=require("./externalizeComponent-OO4jcrz5.cjs"),M=require("@react-three/drei"),he=require("@mui/material/styles"),v=require("@mui/material/Box"),X=require("@mui/material/Button"),me=require("@mui/material/Card"),Z=require("@mui/material/Divider"),K=require("@mui/material/Typography"),k=require("@react-three/fiber"),xe=require("mobx-react-lite"),ye=require("react-i18next"),E=require("./interpolation-C9sLsved.cjs"),R=require("@wandelbots/nova-js/v2"),ee=require("react-error-boundary");function ge(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return n.default=t,Object.freeze(n)}const w=ge(b);function je(t){switch(t.shape_type){case"convex_hull":return new O.ConvexGeometry(t.vertices.map(r=>new w.Vector3(r[0]/1e3,r[1]/1e3,r[2]/1e3)));case"box":return new w.BoxGeometry(t.size_x/1e3,t.size_y/1e3,t.size_z/1e3);case"sphere":return new w.SphereGeometry(t.radius/1e3);case"capsule":return new w.CapsuleGeometry(t.radius/1e3,t.cylinder_height/1e3);case"cylinder":return new w.CylinderGeometry(t.radius/1e3,t.radius/1e3,t.height/1e3);case"rectangle":return new w.BoxGeometry(t.size_x/1e3,t.size_y/1e3,0);default:return console.warn(`${t.shape_type} is not supported`),new w.BufferGeometry}}function be({name:t,collider:n,children:r}){var d,c;const o=((d=n.pose)==null?void 0:d.position)??[0,0,0],a=((c=n.pose)==null?void 0:c.orientation)??[0,0,0];return n.margin&&console.warn(`${t} margin is not supported`),e.jsx("mesh",{name:t,position:new w.Vector3(o[0],o[1],o[2]).divideScalar(1e3),rotation:new w.Euler(a[0],a[1],a[2],"XYZ"),geometry:je(n.shape),children:r})}function we({name:t,colliders:n,meshChildrenProvider:r,...o}){return e.jsx("group",{name:t,...o,children:Object.entries(n).map(([a,d])=>e.jsx(be,{name:a,collider:d,children:r(a,d)},a))})}function Re({scene:t,meshChildrenProvider:n}){const r=t.colliders;return e.jsx("group",{children:r&&e.jsx(we,{meshChildrenProvider:n,colliders:r})})}function D(){return e.jsx(M.Environment,{frames:1,children:e.jsx(ve,{})})}const Me=[2,0,2,0,2,0,2,0];function ve({positions:t=Me}){return e.jsxs(e.Fragment,{children:[e.jsx(M.Lightformer,{intensity:5,"rotation-x":Math.PI/2,position:[0,5,-9],scale:[10,10,1]}),e.jsx("group",{rotation:[0,.5,0],children:e.jsx("group",{children:t.map((n,r)=>e.jsx(M.Lightformer,{form:"circle",intensity:5,rotation:[Math.PI/2,0,0],position:[n,4,r*4],scale:[3,1,1]},r))})}),e.jsx(M.Lightformer,{intensity:40,"rotation-y":Math.PI/2,position:[-5,1,-1],scale:[20,.1,1]}),e.jsx(M.Lightformer,{intensity:20,"rotation-y":-Math.PI,position:[-5,-2,-1],scale:[20,.1,1]}),e.jsx(M.Lightformer,{"rotation-y":Math.PI/2,position:[-5,-1,-1],scale:[20,.5,1],intensity:5}),e.jsx(M.Lightformer,{"rotation-y":-Math.PI/2,position:[10,1,0],scale:[20,1,1],intensity:10}),e.jsx(M.Lightformer,{form:"ring",color:"white",intensity:5,scale:10,position:[-15,4,-18],target:[0,0,0]})]})}const z={attach:"material",color:"#009f4d",opacity:.2,depthTest:!1,depthWrite:!1,transparent:!0,polygonOffset:!0};function Se({safetyZones:t,dhParameters:n,...r}){const o=l.useMemo(()=>L.dhParametersToPlaneSize(n??[]),[n]),a=(c,s)=>{var p,y;if(!((p=s==null?void 0:s.pose)!=null&&p.position)||!((y=s==null?void 0:s.pose)!=null&&y.orientation))return null;const g=new w.Vector3(s.pose.position[0]/1e3,s.pose.position[1]/1e3,s.pose.position[2]/1e3),i=new w.Vector3(s.pose.orientation[0],s.pose.orientation[1],s.pose.orientation[2]);let m;const u=s.shape.shape_type==="plane"?{...z,side:w.DoubleSide}:{...z,side:w.FrontSide};switch(s.shape.shape_type){case"plane":m=e.jsx("planeGeometry",{args:[o,o]});break;case"sphere":{const x=(s==null?void 0:s.shape).radius/1e3;m=e.jsx("sphereGeometry",{args:[x]});break}case"capsule":{const x=(s==null?void 0:s.shape).radius/1e3,f=(s==null?void 0:s.shape).cylinder_height/1e3;m=e.jsx("capsuleGeometry",{args:[x,f]});break}case"convex_hull":{const x=(s==null?void 0:s.shape).vertices.map(h=>new w.Vector3(h[0]/1e3,h[1]/1e3,h[2]/1e3)),f=L.verticesToCoplanarity(x);if(f.isCoplanar&&f.normal){const j=new w.Vector3().addVectors(x[0],f.normal.multiplyScalar(1e-4));x.push(j)}try{m=e.jsx("primitive",{object:new O.ConvexGeometry(x),attach:"geometry"})}catch(h){return console.log("Error creating ConvexGeometry:",h),null}break}case"rectangular_capsule":{const x=s.shape,f=x.radius/1e3,h=x.sphere_center_distance_x/1e3,j=x.sphere_center_distance_y/1e3,S=f*2;m=e.jsx("primitive",{object:new O.RoundedBoxGeometry(h,j,S,2,f),attach:"geometry"});break}default:console.warn("Unsupported safety zone shape type:",s.shape.shape_type),m=null}return e.jsxs("mesh",{renderOrder:c,position:g,quaternion:L.orientationToQuaternion(i),children:[m,e.jsx("meshStandardMaterial",{...u,polygonOffsetFactor:-c})]},`safety-zone-${s.shape.shape_type}-${c}`)},d=l.useMemo(()=>Object.values(t??{}).map((c,s)=>a(s,c)),[t,o]);return e.jsx("group",{...r,children:d})}function _e({trajectory:t,...n}){const r=(t==null?void 0:t.map(o=>{if(o.position&&o.position.length>=3){const[a,d,c]=o.position;if(Number.isFinite(a)&&Number.isFinite(d)&&Number.isFinite(c))return new w.Vector3(a/1e3,c/1e3,-d/1e3)}return null}).filter(o=>o!==null))||[];return e.jsx("group",{...n,children:r.length>0&&e.jsx(M.Line,{points:r,lineWidth:3,polygonOffset:!0,polygonOffsetFactor:10,polygonOffsetUnits:10})})}const V=new Map;async function G(t,n){if(V.has(t))return V.get(t);const r=(async()=>{var c;const o=n||"",a=new R.Nova({instanceUrl:o}),d=a.api.motionGroupModels;(c=d.axios)!=null&&c.interceptors&&d.axios.interceptors.request.use(s=>{var g;return(g=s.url)!=null&&g.includes("/glb")&&(s.responseType="blob"),s});try{const s=await a.api.motionGroupModels.getMotionGroupGlbModel(t);return URL.createObjectURL(s)}catch(s){throw console.error("Failed to fetch model:",s),s}})();return V.set(t,r),r}function te(t){function n(r){return r.children.length===0?[r]:[r,...r.children.flatMap(o=>n(o))]}return n(t).filter(r=>ne(r))}function re(t){return t.name.endsWith("_FLG")}function ne(t){return/_J[0-9]+$/.test(t.name)}function Te(t,n){let r;function o(a){if(re(a)){if(r)throw Error(`Found multiple flange groups in robot model ${n}; first ${r.name} then ${a.name}. Only one _FLG group is allowed.`);r=a}ne(a),a.children.map(o)}if(o(t.scene),!r)throw Error(`No flange group found in robot model ${n}. Flange must be identified with a name ending in _FLG.`);return{gltf:t}}const se=l.forwardRef(function({rapidlyChangingMotionState:n,dhParameters:r,onRotationChanged:o,children:a},d){const c=l.useRef(null),s=l.useRef([]),g=l.useRef(null),{invalidate:i}=k.useThree(),m=l.useRef(n);m.current=n,l.useEffect(()=>{const f=n.joint_position.filter(h=>h!==void 0);return g.current=new E.ValueInterpolator(f,{tension:120,friction:20,threshold:.001}),()=>{var h;(h=g.current)==null||h.destroy()}},[]),k.useFrame((f,h)=>{if(!g.current)return;s.current.length===0&&c.current&&p();const j=g.current.update(h);y(),j||i()});function u(f){c.current=f,f&&p()}function p(){c.current&&(s.current=te(c.current),y(),i())}l.useImperativeHandle(d,()=>({recollectJoints:p}));function y(){var h;const f=((h=g.current)==null?void 0:h.getCurrentValues())||[];if(o)o(s.current,f);else for(const[j,S]of s.current.entries()){const T=r[j],F=T.theta||0,B=T.reverse_rotation_direction?-1:1;S.rotation.y=B*(f[j]||0)+F}}function x(f){var j;const h=f.joint_position.filter(S=>S!==void 0);(j=g.current)==null||j.setTarget(h),i()}return E.useAutorun(()=>{x(m.current)}),l.useEffect(()=>{x(n)},[n]),e.jsx("group",{ref:u,children:a})}),Le="line",ke="mesh";function Ee({rapidlyChangingMotionState:t,dhParameters:n,...r}){const o=new b.Matrix4,a=l.useRef([]),d=l.useRef([]);l.useEffect(()=>{a.current=new Array(n.length).fill(null),d.current=new Array(n.length).fill(null)},[n.length]);function c(i,m){const u=new b.Vector3,p=new b.Quaternion,y=new b.Vector3;o.decompose(u,p,y);const x=u.clone(),f=new b.Matrix4().makeRotationY(i.theta+m*(i.reverse_rotation_direction?-1:1)).multiply(new b.Matrix4().makeTranslation(0,i.d/1e3,0)).multiply(new b.Matrix4().makeTranslation(i.a/1e3,0,0)).multiply(new b.Matrix4().makeRotationX(i.alpha));return o.multiply(f),o.decompose(u,p,y),{a:x,b:u}}function s(i,m,u,p){if(!n)return;const y=n[i];if(!y)return;const{a:x,b:f}=c(y,p);m.geometry.setPositions([x.toArray(),f.toArray()].flat()),u.position.set(f.x,f.y,f.z)}function g(i,m){o.identity();for(let u=0;u<Math.min(i.length,m.length);u++){const p=a.current[u],y=d.current[u];p&&y&&s(u,p,y,m[u])}}return e.jsx(se,{rapidlyChangingMotionState:t,dhParameters:n,onRotationChanged:g,children:e.jsxs("group",{...r,name:"Scene",children:[e.jsxs("mesh",{children:[e.jsx("sphereGeometry",{args:[.01,32,32]}),e.jsx("meshStandardMaterial",{color:"black",depthTest:!0})]}),n==null?void 0:n.map((i,m)=>{const{a:u,b:p}=c(i,t.joint_position[m]??0),y=`dhrobot_J0${m}`;return e.jsxs("group",{name:y,children:[e.jsx(M.Line,{ref:x=>{a.current[m]=x},name:Le,points:[u,p],color:"white",lineWidth:5}),e.jsxs("mesh",{ref:x=>{d.current[m]=x},name:ke,position:p,children:[e.jsx("sphereGeometry",{args:[.01,32,32]}),e.jsx("meshStandardMaterial",{color:"black",depthTest:!0})]},`mesh_${m}`)]},y)})]})})}const Ge=console.warn;function oe(){return l.useEffect(()=>{console.warn=t=>{t!=="Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"&&Ge(t)}},[]),null}function Ce(t){return t.type==="Mesh"}function Ie({url:t,flangeRef:n,postModelRender:r,...o}){const a=M.useGLTF(t),c=Te(a,"robot.glb").gltf,s=l.useCallback(i=>{i&&r&&r()},[r]);function g(i){try{return Ce(i)?i.geometry?e.jsx("mesh",{name:i.name,geometry:i.geometry,material:i.material,position:i.position,rotation:i.rotation},i.uuid):e.jsx("group",{name:i.name,position:i.position,rotation:i.rotation},i.uuid):e.jsx("group",{name:i.name,position:i.position,rotation:i.rotation,ref:re(i)?n:void 0,children:i.children.map(g)},i.uuid)}catch(m){return console.warn("Error rendering node",i.name,m),null}}return e.jsx("group",{...o,dispose:null,ref:s,children:g(c.scene)})}function ie({modelURL:t,flangeRef:n,postModelRender:r,...o}){const[a,d]=l.useState(null);return l.useEffect(()=>{let c=!1;return(async()=>{try{const g=typeof t=="string"?t:await t;c||d(i=>i===g?i:g)}catch(g){console.error("Failed to resolve model URL:",g)}})(),()=>{c=!0}},[t]),a?e.jsx(Ie,{url:a,flangeRef:n,postModelRender:r,...o}):null}const ae=(t,n)=>{t.userData.isGhost||(t.traverse(r=>{if(r instanceof w.Mesh){r.material instanceof w.Material&&(r.material.colorWrite=!1);const o=r.clone(),a=r.clone();o.material=new w.MeshStandardMaterial({depthTest:!0,depthWrite:!0,colorWrite:!1,polygonOffset:!0,polygonOffsetFactor:-1,side:w.DoubleSide}),o.userData.isGhost=!0,a.material=new w.MeshStandardMaterial({color:n,opacity:.3,depthTest:!0,depthWrite:!1,transparent:!0,polygonOffset:!0,polygonOffsetFactor:-2,side:w.DoubleSide}),a.userData.isGhost=!0,r.parent&&(r.parent.add(o),r.parent.add(a))}}),t.userData.isGhost=!0)},ce=t=>{if(!t.userData.isGhost)return;const n=[];t.traverse(r=>{var o;r instanceof w.Mesh&&((o=r.userData)!=null&&o.isGhost?n.push(r):r.material instanceof w.Material&&(r.material.colorWrite=!0))}),n.forEach(r=>{r.parent&&r.parent.remove(r)}),t.userData.isGhost=!1},J=L.externalizeComponent(({rapidlyChangingMotionState:t,modelFromController:n,dhParameters:r,getModel:o=G,flangeRef:a,postModelRender:d,transparentColor:c,instanceUrl:s,...g})=>{const[i,m]=l.useState(null),u=l.useRef(null),p=l.useCallback(h=>{m(h)},[]),y=l.useCallback(()=>{var h;(h=u.current)==null||h.recollectJoints(),d==null||d()},[d]);l.useEffect(()=>{i&&(c?ae(i,c):ce(i))},[i,c]);const x=l.useMemo(()=>{const h=o(n,s);if(!h)throw new Error(`No model found for robot "${n}". Ensure the model is available or provide a custom getModel function.`);return h},[n,s,o]),f=e.jsx(Ee,{rapidlyChangingMotionState:t,dhParameters:r,...g});return e.jsxs(ee.ErrorBoundary,{fallback:f,onError:h=>{console.warn(h)},children:[e.jsx(l.Suspense,{fallback:f,children:e.jsx("group",{ref:p,children:e.jsx(se,{ref:u,rapidlyChangingMotionState:t,dhParameters:r,children:e.jsx(ie,{modelURL:x,postModelRender:y,flangeRef:a,...g})})})}),e.jsx(oe,{})]})});function ue({connectedMotionGroup:t,getModel:n=G,flangeRef:r,transparentColor:o,postModelRender:a,...d}){return t.dhParameters?e.jsx(J,{rapidlyChangingMotionState:t.rapidlyChangingMotionState,modelFromController:t.modelFromController||"",dhParameters:t.dhParameters,getModel:n,flangeRef:r,transparentColor:o,postModelRender:a,...d}):null}const Ae=L.externalizeComponent(xe.observer(({robotName:t,programState:n,safetyState:r,operationMode:o,driveToHomeEnabled:a=!1,onDriveToHomePress:d,onDriveToHomeRelease:c,connectedMotionGroup:s,robotComponent:g=ue,customContentComponent:i,className:m})=>{var H;const u=he.useTheme(),{t:p}=ye.useTranslation(),[y,x]=l.useState(!1),f=l.useRef(null),h=l.useRef(null),[j,S]=l.useState(!1),[T,F]=l.useState({width:400,height:600}),[B,pe]=l.useState(0);l.useEffect(()=>{const P=()=>{if(h.current){const{offsetWidth:Y,offsetHeight:Q}=h.current;S(Y>Q),F({width:Y,height:Q})}};P();const $=new ResizeObserver(P);return h.current&&$.observe(h.current),()=>{$.disconnect()}},[]);const N=l.useCallback(()=>{pe(P=>P+1)},[]),C=l.useCallback(()=>{!a||!d||(x(!0),d())},[a,d]),I=l.useCallback(()=>{!a||!c||(x(!1),c())},[a,c]),W=l.useCallback(()=>{y&&c&&(x(!1),c())},[y,c]),_=j?T.width<350:T.height<200,A=j?T.height<310:T.height<450;return e.jsx(me,{ref:h,className:m,sx:{width:"100%",height:"100%",display:"flex",flexDirection:j?"row":"column",position:"relative",overflow:"hidden",minWidth:{xs:180,sm:220,md:250},minHeight:j?{xs:200,sm:240,md:260}:{xs:150,sm:180,md:220},border:`1px solid ${u.palette.divider}`,borderRadius:"18px",boxShadow:"none",backgroundColor:((H=u.palette.backgroundPaperElevation)==null?void 0:H[8])||"#292B3F",backgroundImage:"none"},children:j?e.jsxs(e.Fragment,{children:[e.jsx(v,{sx:{flex:"0 0 50%",position:"relative",height:"100%",minHeight:"100%",maxHeight:"100%",borderRadius:1,m:{xs:1.5,sm:2,md:3},mr:{xs:.75,sm:1,md:1.5},overflow:"hidden",display:_?"none":"block"},children:!_&&e.jsxs(k.Canvas,{orthographic:!0,camera:{position:[3,2,3],zoom:1},shadows:!0,frameloop:"demand",style:{borderRadius:u.shape.borderRadius,width:"100%",height:"100%",background:"transparent",position:"absolute",top:0,left:0},dpr:[1,2],gl:{alpha:!0,antialias:!0},children:[e.jsx(D,{}),e.jsx(M.Bounds,{fit:!0,observe:!0,margin:1,maxDuration:1,children:e.jsx(g,{connectedMotionGroup:s,postModelRender:N})})]})}),e.jsxs(v,{sx:{flex:"1",display:"flex",flexDirection:"column",justifyContent:"flex-start",width:_?"100%":"50%"},children:[e.jsxs(v,{sx:{p:{xs:1.5,sm:2,md:3},pb:{xs:1,sm:1.5,md:2},textAlign:"left"},children:[e.jsx(K,{variant:"h6",component:"h2",sx:{mb:1},children:t}),e.jsx(E.ProgramStateIndicator,{programState:n,safetyState:r,operationMode:o})]}),e.jsxs(v,{sx:{p:{xs:1.5,sm:2,md:3},pt:0,flex:"1",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[!A&&i&&e.jsxs(v,{children:[e.jsx(i,{}),e.jsx(Z,{sx:{mt:1,mb:0,borderColor:u.palette.divider,opacity:.5}})]}),e.jsx(v,{sx:{mt:!A&&i?"auto":0},children:e.jsx(v,{sx:{display:"flex",justifyContent:"flex-start",mt:{xs:1,sm:1.5,md:2},mb:{xs:.5,sm:.75,md:1}},children:e.jsx(X,{ref:f,variant:"contained",color:"secondary",size:"small",disabled:!a,onMouseDown:C,onMouseUp:I,onMouseLeave:W,onTouchStart:C,onTouchEnd:I,sx:{textTransform:"none",px:1.5,py:.5},children:p("RobotCard.DriveToHome.bt")})})})]})]})]}):e.jsx(e.Fragment,{children:e.jsxs(v,{sx:{p:3,height:"100%",display:"flex",flexDirection:"column"},children:[e.jsxs(v,{children:[e.jsx(K,{variant:"h6",component:"h2",sx:{mb:1},children:t}),e.jsx(E.ProgramStateIndicator,{programState:n,safetyState:r,operationMode:o})]}),e.jsx(v,{sx:{flex:_?0:1,position:"relative",minHeight:_?0:{xs:120,sm:150,md:200},height:_?0:"auto",borderRadius:1,overflow:"hidden",display:_?"none":"block"},children:!_&&e.jsxs(k.Canvas,{orthographic:!0,camera:{position:[3,2,3],zoom:1},shadows:!0,frameloop:"demand",style:{borderRadius:u.shape.borderRadius,width:"100%",height:"100%",background:"transparent",position:"absolute"},dpr:[1,2],gl:{alpha:!0,antialias:!0},children:[e.jsx(D,{}),e.jsx(M.Bounds,{fit:!0,clip:!0,observe:!0,margin:1,maxDuration:1,children:e.jsx(g,{connectedMotionGroup:s,postModelRender:N})})]})}),e.jsxs(v,{children:[!A&&i&&e.jsxs(e.Fragment,{children:[e.jsx(i,{}),e.jsx(Z,{sx:{mt:1,mb:0,borderColor:u.palette.divider,opacity:.5}})]}),e.jsx(v,{sx:{display:"flex",justifyContent:"flex-start",mt:!A&&i?{xs:1,sm:2,md:5}:{xs:.5,sm:1,md:2},mb:{xs:.5,sm:.75,md:1}},children:e.jsx(X,{ref:f,variant:"contained",color:"secondary",size:"small",disabled:!a,onMouseDown:C,onMouseUp:I,onMouseLeave:W,onTouchStart:C,onTouchEnd:I,sx:{textTransform:"none",px:1.5,py:.5},children:p("RobotCard.DriveToHome.bt")})})]})]})})})})),Pe=Array(6).fill(2*Math.PI);function le({rapidlyChangingMotionState:t,dhParameters:n,onTranslationChanged:r,children:o}){const a=l.useRef([]),d=l.useRef([]),c=l.useRef(null),{invalidate:s}=k.useThree();l.useEffect(()=>{const u=t.joint_position.filter(p=>p!==void 0);return c.current=new E.ValueInterpolator(u,{tension:120,friction:20,threshold:.001}),()=>{var p;(p=c.current)==null||p.destroy()}},[]),k.useFrame((u,p)=>{if(c.current){const y=c.current.update(p);i(),y||s()}});function g(u){u&&(d.current=te(u),i(),s())}function i(){var p;const u=((p=c.current)==null?void 0:p.getCurrentValues())||[];if(r)r(d.current,u);else for(const[y,x]of d.current.entries()){const h=n[y].reverse_rotation_direction?-1:1;x.position.y=h*(u[y]||0)/1e3}}const m=l.useCallback(()=>{const u=t.joint_position.filter(p=>p!==void 0);requestAnimationFrame(()=>{var p;a.current=u,(p=c.current)==null||p.setTarget(u)})},[t]);return l.useEffect(()=>{m()},[t,m]),E.useAutorun(()=>{m()}),e.jsx("group",{ref:g,children:o})}function fe({rapidlyChangingMotionState:t,dhParameters:n,...r}){const o=new b.Matrix4,a=l.useRef(null),d=l.useRef(null);function c(i){const m=new b.Matrix4;for(let x=0;x<n.length;x++){const f=n[x],h=i[x]??0,j=new b.Matrix4().makeRotationY(f.theta).multiply(new b.Matrix4().makeTranslation(f.a/1e3,(f.d+h*(f.reverse_rotation_direction?-1:1))/1e3,0)).multiply(new b.Matrix4().makeRotationX(f.alpha));m.multiply(j)}const u=new b.Vector3,p=new b.Quaternion,y=new b.Vector3;return m.decompose(u,p,y),u}const s=c(t.joint_position);function g(i,m){o.identity();let u=new b.Vector3;for(let f=0;f<n.length;f++){const h=m[f]??0,j=n[f],S=new b.Matrix4().makeRotationY(j.theta).multiply(new b.Matrix4().makeTranslation(j.a/1e3,(j.d+h*(j.reverse_rotation_direction?-1:1))/1e3,0)).multiply(new b.Matrix4().makeRotationX(j.alpha));o.multiply(S)}const p=new b.Vector3,y=new b.Quaternion,x=new b.Vector3;if(o.decompose(p,y,x),u=p,a.current&&a.current.position.set(u.x,u.y,u.z),d.current){const f=d.current.geometry;f!=null&&f.setPositions&&f.setPositions([0,0,0,u.x,u.y,u.z])}}return e.jsx(le,{rapidlyChangingMotionState:t,dhParameters:n,onTranslationChanged:g,children:e.jsxs("group",{...r,name:"Scene",children:[e.jsxs("mesh",{name:"Base",position:[0,0,0],children:[e.jsx("sphereGeometry",{args:[.02,32,32]}),e.jsx("meshStandardMaterial",{color:"green",depthTest:!0})]}),e.jsx(M.Line,{ref:d,points:[new b.Vector3(0,0,0),s],color:"White",lineWidth:5}),e.jsxs("mesh",{ref:a,name:"TCP",position:s,children:[e.jsx("sphereGeometry",{args:[.025,32,32]}),e.jsx("meshStandardMaterial",{color:"red",depthTest:!0})]})]})})}const U=L.externalizeComponent(({rapidlyChangingMotionState:t,modelFromController:n,dhParameters:r,getModel:o=G,flangeRef:a,postModelRender:d,transparentColor:c,instanceUrl:s,...g})=>{const[i,m]=l.useState(null),u=l.useCallback(y=>{m(y)},[]);l.useEffect(()=>{i&&(c?ae(i,c):ce(i))},[i,c]);const p=e.jsx(fe,{rapidlyChangingMotionState:t,dhParameters:r,...g});return e.jsxs(ee.ErrorBoundary,{fallback:p,onError:y=>{console.warn(y)},children:[e.jsx(l.Suspense,{fallback:p,children:e.jsx("group",{ref:u,children:e.jsx(le,{rapidlyChangingMotionState:t,dhParameters:r,children:e.jsx(ie,{modelURL:(()=>{const y=o(n,s);if(!y){const x=new Blob([],{type:"model/gltf-binary"}),f=new File([x],`${n}.glb`,{type:"model/gltf-binary"});return Promise.resolve(URL.createObjectURL(f))}return y})(),postModelRender:d,flangeRef:a,...g})})})}),e.jsx(oe,{})]})});function Fe({connectedMotionGroup:t,getModel:n=G,flangeRef:r,transparentColor:o,postModelRender:a,...d}){if(!t.dhParameters)return null;const c=t.modelFromController||"";return c&&n(c)?e.jsx(U,{rapidlyChangingMotionState:t.rapidlyChangingMotionState,modelFromController:c,dhParameters:t.dhParameters,getModel:n,flangeRef:r,transparentColor:o,postModelRender:a,...d}):e.jsx(fe,{rapidlyChangingMotionState:t.rapidlyChangingMotionState,dhParameters:t.dhParameters,...d})}const q={[R.Manufacturer.Abb]:[0,0,0,0,Math.PI/2,0,0],[R.Manufacturer.Fanuc]:[0,0,0,0,-Math.PI/2,0,0],[R.Manufacturer.Yaskawa]:[0,0,0,0,-Math.PI/2,0,0],[R.Manufacturer.Kuka]:[0,-Math.PI/2,Math.PI/2,0,Math.PI/2,0,0],[R.Manufacturer.Universalrobots]:[0,-Math.PI/2,-Math.PI/2,-Math.PI/2,Math.PI/2,-Math.PI/2,0],[R.Manufacturer.Staubli]:[0,-Math.PI/2,Math.PI/2,0,0,0,0]};function de(t){const[n]=t.split("_");switch(n){case"ABB":return R.Manufacturer.Abb;case"FANUC":return R.Manufacturer.Fanuc;case"YASKAWA":return R.Manufacturer.Yaskawa;case"KUKA":return R.Manufacturer.Kuka;case"UniversalRobots":return R.Manufacturer.Universalrobots;case"STAUBLI":return R.Manufacturer.Staubli;default:return null}}function Ve(t,n){const r=de(t);return r&&r in q?q[r]:n||null}const Oe=L.externalizeComponent(t=>{const{inverseSolver:n,dhParameters:r,...o}=t,[a,d]=l.useState(R.JointTypeEnum.RevoluteJoint);l.useEffect(()=>{r.length&&d(r[0].type??R.JointTypeEnum.RevoluteJoint)},[r]);const c=l.useMemo(()=>n===null&&a===R.JointTypeEnum.RevoluteJoint,[n,a]),s=l.useMemo(()=>n===null&&a===R.JointTypeEnum.PrismaticJoint,[n,a]);return l.useMemo(()=>!!n,[n])||c?e.jsx(J,{dhParameters:r,...o}):s?e.jsx(U,{dhParameters:r,...o}):null});exports.CollisionSceneRenderer=Re;exports.LinearAxis=Fe;exports.MANUFACTURER_HOME_CONFIGS=q;exports.MotionGroupVisualizer=Oe;exports.PresetEnvironment=D;exports.Robot=ue;exports.RobotCard=Ae;exports.SafetyZonesRenderer=Se;exports.SupportedLinearAxis=U;exports.SupportedRobot=J;exports.TrajectoryRenderer=_e;exports.defaultAxisConfig=Pe;exports.defaultGetModel=G;exports.extractManufacturer=de;exports.getDefaultHomeConfig=Ve;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const u=require("react/jsx-runtime"),P=require("@mui/material/styles"),V=require("@mui/material/Chip"),_=require("@mui/material/Typography"),C=require("mobx-react-lite"),x=require("react-i18next"),O=require("./externalizeComponent-OO4jcrz5.cjs"),N=require("@mui/icons-material/Pause"),I=require("@mui/icons-material/PlayArrow"),S=require("@mui/icons-material/Stop"),b=require("@mui/material/Box"),v=require("@mui/material/Button"),f=require("mobx"),m=require("react");var c=(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))(c||{});const M=O.externalizeComponent(C.observer(({state:e,onRun:t,onPause:n,onStop:s,onReset:a,requiresManualReset:r=!1,variant:o="with_pause",className:h})=>{const l=P.useTheme(),{t:g}=x.useTranslation(),d=()=>{const i={run:{enabled:e==="idle"||e==="stopped"||e==="paused"||e==="completed"||e==="failed"||e==="error",label:g(e==="paused"?"ProgramControl.Resume.bt":e==="error"||e==="failed"?"ProgramControl.Retry.bt":"ProgramControl.Start.bt"),color:l.palette.success.main,onClick:t},pause:{enabled:e==="running",label:g("ProgramControl.Pause.bt"),color:"#FFFFFF33",onClick:n||(()=>{})},stop:{enabled:e==="preparing"||e==="starting"||e==="running"||e==="pausing"||e==="paused",label:g("ProgramControl.Stop.bt"),color:l.palette.error.main,onClick:s}};return o==="without_pause"?[i.run,i.stop]:[i.run,i.pause,i.stop]},E=i=>{const p={sx:{fontSize:"55px"}};if(o==="without_pause")return i===0?u.jsx(I,{...p}):u.jsx(S,{...p});switch(i){case 0:return u.jsx(I,{...p});case 1:return u.jsx(N,{...p});case 2:return u.jsx(S,{...p});default:return null}},A=d();return u.jsx(b,{className:h,sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:2},children:u.jsx(b,{sx:{display:"flex",gap:"40px",flexWrap:"wrap",justifyContent:"center",alignItems:"center"},children:A.map((i,p)=>u.jsxs(b,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:1},children:[u.jsx(v,{variant:"contained",disabled:!i.enabled||e==="preparing"||e==="starting"||e==="pausing"||e==="stopping"&&!r,onClick:i.onClick,sx:{width:"88px",height:"88px",borderRadius:"88px",backgroundColor:i.color,opacity:i.enabled&&e!=="preparing"&&e!=="starting"&&e!=="pausing"&&!(e==="stopping"&&!r)?1:.3,"&:hover":{backgroundColor:i.color,opacity:i.enabled&&e!=="preparing"&&e!=="starting"&&e!=="pausing"&&!(e==="stopping"&&!r)?.8:.3},"&:disabled":{backgroundColor:i.color,opacity:.3},minWidth:"88px",flexShrink:0},children:E(p)}),u.jsx(_,{variant:"body1",sx:{color:i.enabled&&e!=="preparing"&&e!=="starting"&&e!=="pausing"&&!(e==="stopping"&&!r)?i.color:l.palette.text.disabled,textAlign:"center",opacity:i.enabled&&e!=="preparing"&&e!=="starting"&&e!=="pausing"&&!(e==="stopping"&&!r)?1:.3},children:i.label})]},i.label))})})})),Y=O.externalizeComponent(C.observer(({programState:e,safetyState:t,operationMode:n,className:s})=>{const a=P.useTheme(),{t:r}=x.useTranslation(),o=()=>{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:a.palette.error.main};if(t==="SAFETY_STATE_UNKNOWN"||t==="SAFETY_STATE_FAULT")return{label:r("ProgramStateIndicator.Error.lb"),color:a.palette.error.main};if(t==="SAFETY_STATE_NORMAL")switch(e){case c.PREPARING:return{label:r("ProgramStateIndicator.Preparing.lb"),color:a.palette.warning.main};case c.STARTING:return{label:r("ProgramStateIndicator.Starting.lb"),color:a.palette.warning.main};case c.RUNNING:return{label:r("ProgramStateIndicator.Running.lb"),color:a.palette.success.main};case c.PAUSING:return{label:r("ProgramStateIndicator.Pausing.lb"),color:a.palette.warning.main};case c.PAUSED:return{label:r("ProgramStateIndicator.Paused.lb"),color:a.palette.grey[600]};case c.STOPPING:return{label:r("ProgramStateIndicator.Stopping.lb"),color:a.palette.warning.main};case c.COMPLETED:return{label:r("ProgramStateIndicator.Completed.lb"),color:a.palette.success.main};case c.FAILED:return{label:r("ProgramStateIndicator.Failed.lb"),color:a.palette.error.main};case c.STOPPED:return{label:r("ProgramStateIndicator.Stopped.lb"),color:a.palette.warning.main};case c.ERROR:return{label:r("ProgramStateIndicator.Error.lb"),color:a.palette.error.main};default:return{label:r("ProgramStateIndicator.Ready.lb"),color:a.palette.success.main}}return{label:r("ProgramStateIndicator.Idle.lb"),color:a.palette.grey[600]}},{label:h,color:l}=o(),d=`${h} / ${(()=>{switch(n){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 u.jsx(V,{className:s,label:u.jsx(_,{variant:"body2",sx:{fontSize:"0.75rem",lineHeight:1.2},children:d}),variant:"filled",sx:{backgroundColor:l,color:a.palette.getContrastText(l),fontWeight:500,height:"auto","& .MuiChip-label":{paddingX:1.5,paddingY:.5}}})}));function T(e){m.useEffect(e,[])}function D(e){T(()=>f.autorun(e))}function U(e,t,n){T(()=>f.reaction(e,t,n))}function w(e){return T(()=>{let t;function n(){e(),t=requestAnimationFrame(n)}return t=requestAnimationFrame(n),()=>{cancelAnimationFrame(t)}})}class F{constructor(t=[],n={}){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:()=>{},...n},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 n=!1,s=!0;this.updateCount++;const a=Math.min(t,1/15),r=this.updateCount===1?.7:1;for(let o=0;o<this.currentValues.length;o++){const h=this.currentValues[o],l=this.targetValues[o],g=this.velocities[o],d=l-h,E=d*this.options.tension*r,A=g*this.options.friction,i=E-A,p=g+i*a,R=h+p*a;Math.abs(d)<this.options.threshold&&Math.abs(p)<this.options.threshold*10?this.currentValues[o]!==l&&(this.currentValues[o]=l,this.velocities[o]=0,n=!0):(s=!1,this.currentValues[o]=R,this.velocities[o]=p,n=!0)}return n&&this.options.onChange(this.currentValues),s&&this.options.onComplete(this.currentValues),s}setTarget(t){const n=performance.now(),s=n-this.targetUpdateTime;this.previousTargetValues=[...this.targetValues],this.targetValues=[...t],this.targetUpdateTime=n,this.updateCount=0;const a=this.previousTargetValues.every((r,o)=>r===this.currentValues[o]);if(s<8&&s>0&&this.previousTargetValues.length>0&&!a){const r=Math.min(s/8,1);for(let o=0;o<this.targetValues.length;o++){const h=this.previousTargetValues[o]||0,l=t[o]||0;Math.abs(l-h)>.1&&(this.targetValues[o]=h+(l-h)*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 j(e=[],t={}){const n=m.useRef(null);return n.current||(n.current=new F(e,t)),m.useEffect(()=>{var s;(s=n.current)==null||s.updateOptions(t)},[t]),m.useEffect(()=>()=>{var s;(s=n.current)==null||s.destroy()},[]),[n.current]}exports.ProgramControl=M;exports.ProgramState=c;exports.ProgramStateIndicator=Y;exports.ValueInterpolator=F;exports.useAnimationFrame=w;exports.useAutorun=D;exports.useInterpolation=j;exports.useMounted=T;exports.useReaction=U;
|