@wandelbots/wandelbots-js-react-components 4.0.1 → 4.0.2-pr.feat-RB-3031-robot-animator.485.506a9e9
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.js +1 -1
- package/dist/3d.es.js +1 -1
- package/dist/components/robots/RobotAnimator.d.ts.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/{manufacturerHomePositions-j75MUgMb.js → manufacturerHomePositions-BD6C5qZJ.js} +60 -56
- package/dist/manufacturerHomePositions-BD6C5qZJ.js.map +1 -0
- package/dist/manufacturerHomePositions-DRNjU1pU.cjs +2 -0
- package/dist/manufacturerHomePositions-DRNjU1pU.cjs.map +1 -0
- package/package.json +1 -1
- package/src/components/robots/RobotAnimator.tsx +23 -8
- package/dist/manufacturerHomePositions-B3eJ_OqZ.cjs +0 -2
- package/dist/manufacturerHomePositions-B3eJ_OqZ.cjs.map +0 -1
- package/dist/manufacturerHomePositions-j75MUgMb.js.map +0 -1
package/dist/3d.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./manufacturerHomePositions-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./manufacturerHomePositions-DRNjU1pU.cjs");exports.CollisionSceneRenderer=e.CollisionSceneRenderer;exports.MANUFACTURER_HOME_CONFIGS=e.MANUFACTURER_HOME_CONFIGS;exports.PresetEnvironment=e.PresetEnvironment;exports.Robot=e.Robot;exports.RobotCard=e.RobotCard;exports.SafetyZonesRenderer=e.SafetyZonesRenderer;exports.SupportedRobot=e.SupportedRobot;exports.TrajectoryRenderer=e.TrajectoryRenderer;exports.defaultAxisConfig=e.defaultAxisConfig;exports.defaultGetModel=e.defaultGetModel;exports.extractManufacturer=e.extractManufacturer;exports.getDefaultHomeConfig=e.getDefaultHomeConfig;
|
|
2
2
|
//# sourceMappingURL=3d.cjs.js.map
|
package/dist/3d.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as o, M as r, P as t, R as s, a as n, S as d, b as R, T as f, d as C, c as i, e as l, g as u } from "./manufacturerHomePositions-
|
|
1
|
+
import { C as o, M as r, P as t, R as s, a as n, S as d, b as R, T as f, d as C, c as i, e as l, g as u } from "./manufacturerHomePositions-BD6C5qZJ.js";
|
|
2
2
|
export {
|
|
3
3
|
o as CollisionSceneRenderer,
|
|
4
4
|
r as MANUFACTURER_HOME_CONFIGS,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RobotAnimator.d.ts","sourceRoot":"","sources":["../../../src/components/robots/RobotAnimator.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC3E,OAAO,
|
|
1
|
+
{"version":3,"file":"RobotAnimator.d.ts","sourceRoot":"","sources":["../../../src/components/robots/RobotAnimator.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC3E,OAAO,KAAyC,MAAM,OAAO,CAAA;AAC7D,OAAO,KAAK,EAAS,QAAQ,EAAE,MAAM,OAAO,CAAA;AAK5C,KAAK,kBAAkB,GAAG;IACxB,0BAA0B,EAAE,gBAAgB,CAAA;IAC5C,YAAY,EAAE,WAAW,EAAE,CAAA;IAC3B,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IACvE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,0BAA0B,EAC1B,YAAY,EACZ,iBAAiB,EACjB,QAAQ,GACT,EAAE,kBAAkB,2CA4FpB"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./manufacturerHomePositions-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./manufacturerHomePositions-DRNjU1pU.cjs"),e=require("./theming-CPShzNuV.cjs"),r=require("./LoadingCover-CukpS_aj.cjs"),t=require("./interpolation-DAXKfoDS.cjs"),a=require("./externalizeComponent-CkVWk2F_.cjs"),n=require("./WandelscriptEditor-D6_vS5Uk.cjs");exports.CollisionSceneRenderer=o.CollisionSceneRenderer;exports.MANUFACTURER_HOME_CONFIGS=o.MANUFACTURER_HOME_CONFIGS;exports.PresetEnvironment=o.PresetEnvironment;exports.Robot=o.Robot;exports.RobotCard=o.RobotCard;exports.SafetyZonesRenderer=o.SafetyZonesRenderer;exports.SupportedRobot=o.SupportedRobot;exports.TrajectoryRenderer=o.TrajectoryRenderer;exports.defaultAxisConfig=o.defaultAxisConfig;exports.defaultGetModel=o.defaultGetModel;exports.extractManufacturer=o.extractManufacturer;exports.getDefaultHomeConfig=o.getDefaultHomeConfig;exports.AppHeader=e.AppHeader;exports.ConnectedMotionGroup=e.ConnectedMotionGroup;exports.CycleTimer=e.CycleTimer;exports.JoggerConnection=e.JoggerConnection;exports.JoggingCartesianAxisControl=e.JoggingCartesianAxisControl;exports.JoggingJointRotationControl=e.JoggingJointRotationControl;exports.JoggingPanel=e.JoggingPanel;exports.JoggingStore=e.JoggingStore;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.SafetyBar=e.SafetyBar;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.createWarningMessage=e.createWarningMessage;exports.jointValuesEqual=e.jointValuesEqual;exports.poseEqual=e.poseEqual;exports.tcpMotionEqual=e.tcpMotionEqual;exports.unwrapRotationVector=e.unwrapRotationVector;exports.LoadingCover=r.LoadingCover;exports.LoadingErrorMessage=r.LoadingErrorMessage;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.i18n=a.i18n;exports.WandelscriptEditor=n.WandelscriptEditor;
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as o, M as s, P as t, R as r, a as n, S as i, b as g, T as l, d as u, c as d, e as c, g as p } from "./manufacturerHomePositions-
|
|
1
|
+
import { C as o, M as s, P as t, R as r, a as n, S as i, b as g, T as l, d as u, c as d, e as c, g as p } from "./manufacturerHomePositions-BD6C5qZJ.js";
|
|
2
2
|
import { A as M, C, a as R, J as S, b as f, c as b, d as P, e as L, L as V, f as x, g as E, M as A, N as J, P as T, h as I, R as y, i as G, j as N, S as W, k as q, T as v, l as F, V as j, m as w, W as D, n as H, o as h, p as B, q as O, r as U, s as _, t as k, u as Z, v as z, w as K } from "./theming-Hr605E6v.js";
|
|
3
3
|
import { L as X, a as Y } from "./LoadingCover-6gWr11KP.js";
|
|
4
4
|
import { P as aa, a as ea, b as oa, V as sa, u as ta, c as ra, d as na, e as ia, f as ga } from "./interpolation-DcPbemBD.js";
|
package/dist/{manufacturerHomePositions-j75MUgMb.js → manufacturerHomePositions-BD6C5qZJ.js}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { j as t, e as K } from "./externalizeComponent-Dc3fViZA.js";
|
|
2
2
|
import * as m from "three";
|
|
3
|
-
import { Matrix4 as
|
|
3
|
+
import { Matrix4 as F, Vector3 as E, Quaternion as ie } from "three";
|
|
4
4
|
import { ConvexGeometry as X } from "three-stdlib";
|
|
5
5
|
import { useThree as ae, useFrame as le, Canvas as B } from "@react-three/fiber";
|
|
6
6
|
import { Environment as ce, Lightformer as R, Line as Z, useGLTF as ue, Bounds as W } from "@react-three/drei";
|
|
7
7
|
import { useTheme as fe, Card as de, Box as y, Typography as $, Divider as N, Button as H } from "@mui/material";
|
|
8
8
|
import { observer as he } from "mobx-react-lite";
|
|
9
|
-
import me, { useRef as
|
|
9
|
+
import me, { useRef as _, useEffect as I, useCallback as v, useState as G, Suspense as pe } from "react";
|
|
10
10
|
import { useTranslation as xe } from "react-i18next";
|
|
11
11
|
import { N as ge, V as ye, c as je, b as J, M as j } from "./interpolation-DcPbemBD.js";
|
|
12
12
|
import { ErrorBoundary as we } from "react-error-boundary";
|
|
@@ -301,8 +301,8 @@ function re({
|
|
|
301
301
|
onRotationChanged: r,
|
|
302
302
|
children: s
|
|
303
303
|
}) {
|
|
304
|
-
const o =
|
|
305
|
-
|
|
304
|
+
const o = _([]), c = _([]), a = _(null), { invalidate: f } = ae();
|
|
305
|
+
I(() => {
|
|
306
306
|
const l = e.joint_position.filter(
|
|
307
307
|
(u) => u !== void 0
|
|
308
308
|
);
|
|
@@ -319,17 +319,13 @@ function re({
|
|
|
319
319
|
}, []), le((l, u) => {
|
|
320
320
|
if (a.current) {
|
|
321
321
|
const p = a.current.update(u);
|
|
322
|
-
|
|
322
|
+
d(), p || f();
|
|
323
323
|
}
|
|
324
324
|
});
|
|
325
325
|
function i(l) {
|
|
326
|
-
l && (c.current = Ge(l),
|
|
326
|
+
l && (c.current = Ge(l), d(), f());
|
|
327
327
|
}
|
|
328
|
-
function d(
|
|
329
|
-
var u;
|
|
330
|
-
o.current = l, (u = a.current) == null || u.setTarget(l);
|
|
331
|
-
}
|
|
332
|
-
function h() {
|
|
328
|
+
function d() {
|
|
333
329
|
var u;
|
|
334
330
|
const l = ((u = a.current) == null ? void 0 : u.getCurrentValues()) || [];
|
|
335
331
|
if (r)
|
|
@@ -340,29 +336,37 @@ function re({
|
|
|
340
336
|
x.rotation.y = M * (l[p] || 0) + b;
|
|
341
337
|
}
|
|
342
338
|
}
|
|
343
|
-
|
|
339
|
+
const h = v(() => {
|
|
344
340
|
const l = e.joint_position.filter(
|
|
345
341
|
(u) => u !== void 0
|
|
346
342
|
);
|
|
347
|
-
requestAnimationFrame(() =>
|
|
343
|
+
requestAnimationFrame(() => {
|
|
344
|
+
var u;
|
|
345
|
+
o.current = l, (u = a.current) == null || u.setTarget(l);
|
|
346
|
+
});
|
|
347
|
+
}, [e]);
|
|
348
|
+
return I(() => {
|
|
349
|
+
h();
|
|
350
|
+
}, [e, h]), je(() => {
|
|
351
|
+
h();
|
|
348
352
|
}), /* @__PURE__ */ t.jsx("group", { ref: i, children: s });
|
|
349
353
|
}
|
|
350
|
-
const Fe = "line",
|
|
351
|
-
function
|
|
354
|
+
const Fe = "line", Ve = "mesh";
|
|
355
|
+
function Le({
|
|
352
356
|
rapidlyChangingMotionState: e,
|
|
353
357
|
dhParameters: n,
|
|
354
358
|
...r
|
|
355
359
|
}) {
|
|
356
|
-
const s = new
|
|
360
|
+
const s = new F(), o = _([]), c = _([]);
|
|
357
361
|
me.useEffect(() => {
|
|
358
362
|
o.current = new Array(n.length).fill(null), c.current = new Array(n.length).fill(null);
|
|
359
363
|
}, [n.length]);
|
|
360
364
|
function a(d, h) {
|
|
361
365
|
const l = new E(), u = new ie(), p = new E();
|
|
362
366
|
s.decompose(l, u, p);
|
|
363
|
-
const x = l.clone(), g = new
|
|
367
|
+
const x = l.clone(), g = new F().makeRotationY(
|
|
364
368
|
d.theta + h * (d.reverse_rotation_direction ? -1 : 1)
|
|
365
|
-
).multiply(new
|
|
369
|
+
).multiply(new F().makeTranslation(0, d.d / 1e3, 0)).multiply(new F().makeTranslation(d.a / 1e3, 0, 0)).multiply(new F().makeRotationX(d.alpha));
|
|
366
370
|
return s.multiply(g), s.decompose(l, u, p), { a: x, b: l };
|
|
367
371
|
}
|
|
368
372
|
function f(d, h, l, u) {
|
|
@@ -416,7 +420,7 @@ function Ve({
|
|
|
416
420
|
ref: (x) => {
|
|
417
421
|
c.current[h] = x;
|
|
418
422
|
},
|
|
419
|
-
name:
|
|
423
|
+
name: Ve,
|
|
420
424
|
position: u,
|
|
421
425
|
children: [
|
|
422
426
|
/* @__PURE__ */ t.jsx("sphereGeometry", { args: [0.01, 32, 32] }),
|
|
@@ -431,15 +435,15 @@ function Ve({
|
|
|
431
435
|
}
|
|
432
436
|
) });
|
|
433
437
|
}
|
|
434
|
-
const
|
|
435
|
-
function
|
|
436
|
-
return
|
|
438
|
+
const Se = console.warn;
|
|
439
|
+
function Te() {
|
|
440
|
+
return I(() => {
|
|
437
441
|
console.warn = (e) => {
|
|
438
|
-
e !== "Cannot call the manual advancement of rafz whilst frameLoop is not set as demand" &&
|
|
442
|
+
e !== "Cannot call the manual advancement of rafz whilst frameLoop is not set as demand" && Se(e);
|
|
439
443
|
};
|
|
440
444
|
}, []), /* @__PURE__ */ t.jsx(t.Fragment, {});
|
|
441
445
|
}
|
|
442
|
-
function
|
|
446
|
+
function Ce(e) {
|
|
443
447
|
return e.type === "Mesh";
|
|
444
448
|
}
|
|
445
449
|
function De({
|
|
@@ -455,7 +459,7 @@ function De({
|
|
|
455
459
|
} catch (i) {
|
|
456
460
|
throw i;
|
|
457
461
|
}
|
|
458
|
-
const a =
|
|
462
|
+
const a = v(
|
|
459
463
|
(i) => {
|
|
460
464
|
i && r && r();
|
|
461
465
|
},
|
|
@@ -463,7 +467,7 @@ function De({
|
|
|
463
467
|
);
|
|
464
468
|
function f(i) {
|
|
465
469
|
try {
|
|
466
|
-
return
|
|
470
|
+
return Ce(i) ? i.geometry ? /* @__PURE__ */ t.jsx(
|
|
467
471
|
"mesh",
|
|
468
472
|
{
|
|
469
473
|
name: i.name,
|
|
@@ -496,8 +500,8 @@ function ke({
|
|
|
496
500
|
postModelRender: r,
|
|
497
501
|
...s
|
|
498
502
|
}) {
|
|
499
|
-
const [o, c] =
|
|
500
|
-
return
|
|
503
|
+
const [o, c] = G(null);
|
|
504
|
+
return I(() => {
|
|
501
505
|
(async () => {
|
|
502
506
|
try {
|
|
503
507
|
if (typeof e == "string")
|
|
@@ -564,14 +568,14 @@ const Ae = (e, n) => {
|
|
|
564
568
|
transparentColor: a,
|
|
565
569
|
...f
|
|
566
570
|
}) => {
|
|
567
|
-
const [i, d] =
|
|
571
|
+
const [i, d] = G(null), h = v((u) => {
|
|
568
572
|
d(u);
|
|
569
573
|
}, []);
|
|
570
|
-
|
|
574
|
+
I(() => {
|
|
571
575
|
i && (a ? Ae(i, a) : Pe(i));
|
|
572
576
|
}, [i, a]);
|
|
573
577
|
const l = /* @__PURE__ */ t.jsx(
|
|
574
|
-
|
|
578
|
+
Le,
|
|
575
579
|
{
|
|
576
580
|
rapidlyChangingMotionState: e,
|
|
577
581
|
dhParameters: r,
|
|
@@ -609,7 +613,7 @@ const Ae = (e, n) => {
|
|
|
609
613
|
)
|
|
610
614
|
}
|
|
611
615
|
) }) }),
|
|
612
|
-
/* @__PURE__ */ t.jsx(
|
|
616
|
+
/* @__PURE__ */ t.jsx(Te, {})
|
|
613
617
|
]
|
|
614
618
|
}
|
|
615
619
|
);
|
|
@@ -653,29 +657,29 @@ const rt = K(
|
|
|
653
657
|
className: h
|
|
654
658
|
}) => {
|
|
655
659
|
var P;
|
|
656
|
-
const l = fe(), { t: u } = xe(), [p, x] =
|
|
657
|
-
|
|
658
|
-
const
|
|
660
|
+
const l = fe(), { t: u } = xe(), [p, x] = G(!1), g = _(null), b = _(null), [M, ne] = G(!1), [V, oe] = G({ width: 400, height: 600 }), [Ee, se] = G(0);
|
|
661
|
+
I(() => {
|
|
662
|
+
const C = () => {
|
|
659
663
|
if (b.current) {
|
|
660
664
|
const { offsetWidth: O, offsetHeight: U } = b.current;
|
|
661
665
|
ne(O > U), oe({ width: O, height: U });
|
|
662
666
|
}
|
|
663
667
|
};
|
|
664
|
-
|
|
665
|
-
const z = new ResizeObserver(
|
|
668
|
+
C();
|
|
669
|
+
const z = new ResizeObserver(C);
|
|
666
670
|
return b.current && z.observe(b.current), () => {
|
|
667
671
|
z.disconnect();
|
|
668
672
|
};
|
|
669
673
|
}, []);
|
|
670
|
-
const k =
|
|
671
|
-
se((
|
|
672
|
-
}, []),
|
|
674
|
+
const k = v(() => {
|
|
675
|
+
se((C) => C + 1);
|
|
676
|
+
}, []), L = v(() => {
|
|
673
677
|
!o || !c || (x(!0), c());
|
|
674
|
-
}, [o, c]),
|
|
678
|
+
}, [o, c]), S = v(() => {
|
|
675
679
|
!o || !a || (x(!1), a());
|
|
676
|
-
}, [o, a]), A =
|
|
680
|
+
}, [o, a]), A = v(() => {
|
|
677
681
|
p && a && (x(!1), a());
|
|
678
|
-
}, [p, a]), w = M ?
|
|
682
|
+
}, [p, a]), w = M ? V.width < 350 : V.height < 200, T = M ? V.height < 310 : V.height < 450;
|
|
679
683
|
return /* @__PURE__ */ t.jsx(
|
|
680
684
|
de,
|
|
681
685
|
{
|
|
@@ -794,7 +798,7 @@ const rt = K(
|
|
|
794
798
|
justifyContent: "space-between"
|
|
795
799
|
},
|
|
796
800
|
children: [
|
|
797
|
-
!
|
|
801
|
+
!T && d && /* @__PURE__ */ t.jsxs(y, { children: [
|
|
798
802
|
/* @__PURE__ */ t.jsx(d, {}),
|
|
799
803
|
/* @__PURE__ */ t.jsx(
|
|
800
804
|
N,
|
|
@@ -812,7 +816,7 @@ const rt = K(
|
|
|
812
816
|
y,
|
|
813
817
|
{
|
|
814
818
|
sx: {
|
|
815
|
-
mt: !
|
|
819
|
+
mt: !T && d ? "auto" : 0
|
|
816
820
|
},
|
|
817
821
|
children: /* @__PURE__ */ t.jsx(
|
|
818
822
|
y,
|
|
@@ -831,11 +835,11 @@ const rt = K(
|
|
|
831
835
|
color: "secondary",
|
|
832
836
|
size: "small",
|
|
833
837
|
disabled: !o,
|
|
834
|
-
onMouseDown:
|
|
835
|
-
onMouseUp:
|
|
838
|
+
onMouseDown: L,
|
|
839
|
+
onMouseUp: S,
|
|
836
840
|
onMouseLeave: A,
|
|
837
|
-
onTouchStart:
|
|
838
|
-
onTouchEnd:
|
|
841
|
+
onTouchStart: L,
|
|
842
|
+
onTouchEnd: S,
|
|
839
843
|
sx: {
|
|
840
844
|
textTransform: "none",
|
|
841
845
|
px: 1.5,
|
|
@@ -921,7 +925,7 @@ const rt = K(
|
|
|
921
925
|
}
|
|
922
926
|
),
|
|
923
927
|
/* @__PURE__ */ t.jsxs(y, { children: [
|
|
924
|
-
!
|
|
928
|
+
!T && d && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
925
929
|
/* @__PURE__ */ t.jsx(d, {}),
|
|
926
930
|
/* @__PURE__ */ t.jsx(
|
|
927
931
|
N,
|
|
@@ -941,7 +945,7 @@ const rt = K(
|
|
|
941
945
|
sx: {
|
|
942
946
|
display: "flex",
|
|
943
947
|
justifyContent: "flex-start",
|
|
944
|
-
mt: !
|
|
948
|
+
mt: !T && d ? { xs: 1, sm: 2, md: 5 } : { xs: 0.5, sm: 1, md: 2 },
|
|
945
949
|
mb: { xs: 0.5, sm: 0.75, md: 1 }
|
|
946
950
|
},
|
|
947
951
|
children: /* @__PURE__ */ t.jsx(
|
|
@@ -952,11 +956,11 @@ const rt = K(
|
|
|
952
956
|
color: "secondary",
|
|
953
957
|
size: "small",
|
|
954
958
|
disabled: !o,
|
|
955
|
-
onMouseDown:
|
|
956
|
-
onMouseUp:
|
|
959
|
+
onMouseDown: L,
|
|
960
|
+
onMouseUp: S,
|
|
957
961
|
onMouseLeave: A,
|
|
958
|
-
onTouchStart:
|
|
959
|
-
onTouchEnd:
|
|
962
|
+
onTouchStart: L,
|
|
963
|
+
onTouchEnd: S,
|
|
960
964
|
sx: {
|
|
961
965
|
textTransform: "none",
|
|
962
966
|
px: 1.5,
|
|
@@ -1033,4 +1037,4 @@ export {
|
|
|
1033
1037
|
Ue as e,
|
|
1034
1038
|
ot as g
|
|
1035
1039
|
};
|
|
1036
|
-
//# sourceMappingURL=manufacturerHomePositions-
|
|
1040
|
+
//# sourceMappingURL=manufacturerHomePositions-BD6C5qZJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manufacturerHomePositions-BD6C5qZJ.js","sources":["../src/components/3d-viewport/collider/colliderShapeToBufferGeometry.ts","../src/components/3d-viewport/collider/ColliderElement.tsx","../src/components/3d-viewport/collider/ColliderCollection.tsx","../src/components/3d-viewport/collider/CollisionSceneRenderer.tsx","../src/components/3d-viewport/PresetEnvironment.tsx","../src/components/3d-viewport/SafetyZonesRenderer.tsx","../src/components/3d-viewport/TrajectoryRenderer.tsx","../src/components/robots/robotModelLogic.ts","../src/components/robots/RobotAnimator.tsx","../src/components/robots/DHRobot.tsx","../src/components/ConsoleFilter.tsx","../src/components/robots/GenericRobot.tsx","../src/components/robots/ghostStyle.ts","../src/components/robots/SupportedRobot.tsx","../src/components/robots/Robot.tsx","../src/components/RobotCard.tsx","../src/components/robots/AxisConfig.ts","../src/components/robots/manufacturerHomePositions.ts"],"sourcesContent":["import type { ColliderShape } from \"@wandelbots/nova-js/v1\"\nimport * as THREE from \"three\"\nimport { ConvexGeometry } from \"three-stdlib\"\n\nexport function colliderShapeToBufferGeometry(\n shape: ColliderShape,\n): THREE.BufferGeometry {\n const shapeType = shape.shape_type\n switch (shapeType) {\n case \"convex_hull\":\n return new ConvexGeometry(\n shape.vertices.map(\n (vertex) =>\n new THREE.Vector3(\n vertex[0] / 1000,\n vertex[1] / 1000,\n vertex[2] / 1000,\n ),\n ),\n )\n case \"box\":\n return new THREE.BoxGeometry(\n shape.size_x / 1000,\n shape.size_y / 1000,\n shape.size_z / 1000,\n )\n case \"sphere\":\n return new THREE.SphereGeometry(shape.radius / 1000)\n case \"capsule\":\n return new THREE.CapsuleGeometry(\n shape.radius / 1000,\n shape.cylinder_height / 1000,\n )\n case \"cylinder\":\n return new THREE.CylinderGeometry(\n shape.radius / 1000,\n shape.radius / 1000,\n shape.height / 1000,\n )\n case \"rectangle\": {\n return new THREE.BoxGeometry(shape.size_x / 1000, shape.size_y / 1000, 0)\n }\n default: {\n console.warn(`${shape.shape_type} is not supported`)\n return new THREE.BufferGeometry()\n }\n }\n}\n","import type { Collider } from \"@wandelbots/nova-js/v1\"\nimport type React from \"react\"\nimport * as THREE from \"three\"\nimport { colliderShapeToBufferGeometry } from \"./colliderShapeToBufferGeometry\"\n\ntype ColliderElementProps = {\n name?: string\n collider: Collider\n children?: React.ReactNode\n}\n\nexport default function ColliderElement({\n name,\n collider,\n children,\n}: ColliderElementProps) {\n const position = collider.pose?.position ?? [0, 0, 0]\n const rotation = collider.pose?.orientation ?? [0, 0, 0]\n if (collider.margin) {\n console.warn(`${name} margin is not supported`)\n }\n return (\n <mesh\n name={name}\n position={new THREE.Vector3(\n position[0],\n position[1],\n position[2],\n ).divideScalar(1000)}\n rotation={new THREE.Euler(rotation[0], rotation[1], rotation[2], \"XYZ\")}\n geometry={colliderShapeToBufferGeometry(collider.shape)}\n >\n {children}\n </mesh>\n )\n}\n","import type { ThreeElements } from \"@react-three/fiber\"\nimport type { Collider } from \"@wandelbots/nova-js/v1\"\nimport ColliderElement from \"./ColliderElement\"\n\nexport type MeshChildrenProvider = (\n key: string,\n collider: Collider,\n) => React.ReactNode\n\ntype ColliderCollectionProps = {\n name?: string\n colliders: Record<string, Collider>\n meshChildrenProvider: MeshChildrenProvider\n} & ThreeElements[\"group\"]\n\nexport default function ColliderCollection({\n name,\n colliders,\n meshChildrenProvider,\n ...props\n}: ColliderCollectionProps) {\n return (\n <group name={name} {...props}>\n {Object.entries(colliders).map(([colliderKey, collider]) => (\n <ColliderElement\n key={colliderKey}\n name={colliderKey}\n collider={collider}\n children={meshChildrenProvider(colliderKey, collider)}\n />\n ))}\n </group>\n )\n}\n","import type { CollisionScene } from \"@wandelbots/nova-js/v1\"\nimport ColliderCollection, {\n type MeshChildrenProvider,\n} from \"./ColliderCollection\"\n\ntype CollisionSceneRendererProps = {\n scene: CollisionScene\n meshChildrenProvider: MeshChildrenProvider\n}\n\nexport default function CollisionSceneRenderer({\n scene,\n meshChildrenProvider,\n}: CollisionSceneRendererProps) {\n const colliders = scene.colliders\n return (\n <group>\n {colliders && (\n <ColliderCollection\n meshChildrenProvider={meshChildrenProvider}\n colliders={colliders}\n />\n )}\n </group>\n )\n}\n","import { Environment, Lightformer } from \"@react-three/drei\"\n\n/**\n * Renders a preset environment for the 3D scene.\n * This component wraps the scene with an `Environment` component\n * and builds a lightmap build with `Lightformers`.\n */\nexport function PresetEnvironment() {\n return (\n <Environment>\n <Lightformers />\n </Environment>\n )\n}\n\nfunction Lightformers({ positions = [2, 0, 2, 0, 2, 0, 2, 0] }) {\n return (\n <>\n {/* Ceiling */}\n <Lightformer\n intensity={5}\n rotation-x={Math.PI / 2}\n position={[0, 5, -9]}\n scale={[10, 10, 1]}\n />\n <group rotation={[0, 0.5, 0]}>\n <group>\n {positions.map((x, i) => (\n <Lightformer\n key={i}\n form=\"circle\"\n intensity={5}\n rotation={[Math.PI / 2, 0, 0]}\n position={[x, 4, i * 4]}\n scale={[3, 1, 1]}\n />\n ))}\n </group>\n </group>\n {/* Sides */}\n <Lightformer\n intensity={40}\n rotation-y={Math.PI / 2}\n position={[-5, 1, -1]}\n scale={[20, 0.1, 1]}\n />\n <Lightformer\n intensity={20}\n rotation-y={-Math.PI}\n position={[-5, -2, -1]}\n scale={[20, 0.1, 1]}\n />\n\n <Lightformer\n rotation-y={Math.PI / 2}\n position={[-5, -1, -1]}\n scale={[20, 0.5, 1]}\n intensity={5}\n />\n <Lightformer\n rotation-y={-Math.PI / 2}\n position={[10, 1, 0]}\n scale={[20, 1, 1]}\n intensity={10}\n />\n\n {/* Key */}\n <Lightformer\n form=\"ring\"\n color=\"white\"\n intensity={5}\n scale={10}\n position={[-15, 4, -18]}\n target={[0, 0, 0]}\n />\n </>\n )\n}\n","import { type ThreeElements } from \"@react-three/fiber\"\nimport type { Geometry, SafetySetupSafetyZone } from \"@wandelbots/nova-js/v1\"\nimport * as THREE from \"three\"\nimport { ConvexGeometry } from \"three-stdlib\"\n\nexport type SafetyZonesRendererProps = {\n safetyZones: SafetySetupSafetyZone[]\n} & ThreeElements[\"group\"]\n\ninterface CoplanarityResult {\n isCoplanar: boolean\n normal?: THREE.Vector3\n}\n\nfunction areVerticesCoplanar(vertices: THREE.Vector3[]): CoplanarityResult {\n if (vertices.length < 3) {\n console.log(\"Not enough vertices to define a plane\")\n return { isCoplanar: false }\n }\n\n // Convert Vector3d to THREE.Vector3\n const v0 = new THREE.Vector3(vertices[0].x, vertices[0].y, vertices[0].z)\n const v1 = new THREE.Vector3(vertices[1].x, vertices[1].y, vertices[1].z)\n const v2 = new THREE.Vector3(vertices[2].x, vertices[2].y, vertices[2].z)\n\n const vector1 = new THREE.Vector3().subVectors(v1, v0)\n const vector2 = new THREE.Vector3().subVectors(v2, v0)\n const normal = new THREE.Vector3().crossVectors(vector1, vector2).normalize()\n\n // Check if all remaining vertices lie on the same plane\n for (let i = 3; i < vertices.length; i++) {\n const vi = new THREE.Vector3(vertices[i].x, vertices[i].y, vertices[i].z)\n const vector = new THREE.Vector3().subVectors(vi, v0)\n const dotProduct = normal.dot(vector)\n if (Math.abs(dotProduct) > 1e-6) {\n // Allowing a small tolerance\n console.log(\"Vertices are not on the same plane\")\n return { isCoplanar: false }\n }\n }\n\n return { isCoplanar: true, normal }\n}\n\nexport function SafetyZonesRenderer({\n safetyZones,\n ...props\n}: SafetyZonesRendererProps) {\n return (\n <group {...props}>\n {safetyZones.map((zone, index) => {\n let geometries: Geometry[] = []\n if (zone.geometry) {\n if (zone.geometry.compound) {\n geometries = zone.geometry.compound.child_geometries\n } else if (zone.geometry.convex_hull) {\n geometries = [zone.geometry]\n }\n }\n\n return geometries.map((geometry, i) => {\n if (!geometry.convex_hull) return null\n\n const vertices = geometry.convex_hull.vertices.map(\n (v) => new THREE.Vector3(v.x / 1000, v.y / 1000, v.z / 1000),\n )\n\n // Check if the vertices are on the same plane and only define a plane\n // Algorithm has troubles with vertices that are on the same plane so we\n // add a new vertex slightly moved along the normal direction\n const coplanarityResult = areVerticesCoplanar(vertices)\n\n if (coplanarityResult.isCoplanar && coplanarityResult.normal) {\n // Add a new vertex slightly moved along the normal direction\n const offset = 0.0001 // Adjust the offset as needed\n const newVertex = new THREE.Vector3().addVectors(\n vertices[0],\n coplanarityResult.normal.multiplyScalar(offset),\n )\n vertices.push(newVertex)\n }\n\n let convexGeometry\n try {\n convexGeometry = new ConvexGeometry(vertices)\n } catch (error) {\n console.log(\"Error creating ConvexGeometry:\", error)\n return null\n }\n return (\n <mesh key={`${index}-${i}`} geometry={convexGeometry}>\n <meshStandardMaterial\n key={index}\n attach=\"material\"\n color=\"#009f4d\"\n opacity={0.2}\n depthTest={false}\n depthWrite={false}\n transparent\n polygonOffset\n polygonOffsetFactor={-i}\n />\n </mesh>\n )\n })\n })}\n </group>\n )\n}\n","import { Line } from \"@react-three/drei\"\nimport type { GetTrajectoryResponse } from \"@wandelbots/nova-js/v1\"\nimport * as THREE from \"three\"\n\nexport type TrajectoryRendererProps = {\n trajectory: GetTrajectoryResponse\n} & React.JSX.IntrinsicElements[\"group\"]\n\nexport function TrajectoryRenderer({\n trajectory,\n ...props\n}: TrajectoryRendererProps) {\n const points =\n trajectory.trajectory\n ?.map((point) => {\n if (point.tcp_pose) {\n return new THREE.Vector3(\n point.tcp_pose.position.x / 1000,\n point.tcp_pose.position.z / 1000,\n -point.tcp_pose.position.y / 1000,\n )\n }\n return null\n })\n .filter((point): point is THREE.Vector3 => point !== null) || []\n\n return (\n <group {...props}>\n {points.length > 0 && (\n <Line\n points={points}\n lineWidth={3}\n polygonOffset={true}\n polygonOffsetFactor={10}\n polygonOffsetUnits={10}\n />\n )}\n </group>\n )\n}\n","import { NovaClient } from \"@wandelbots/nova-js/v2\"\nimport type { Object3D } from \"three\"\nimport type { GLTF } from \"three-stdlib\"\n\nconst modelCache = new Map<string, Promise<string>>()\n\n/**\n * Revoke a cached model's object URL to prevent memory leaks.\n * Call this when a component unmounts or no longer needs the model.\n */\nexport async function revokeModelUrl(modelFromController: string): Promise<void> {\n const urlPromise = modelCache.get(modelFromController)\n if (!urlPromise) return\n\n try {\n const url = await urlPromise\n URL.revokeObjectURL(url)\n } catch (e) {\n // Ignore errors - URL may already be revoked\n }\n modelCache.delete(modelFromController)\n}\n\n/**\n * Revoke all cached model object URLs and clear the cache.\n * Useful for cleanup on app teardown.\n */\nexport async function revokeAllModelUrls(): Promise<void> {\n const entries = Array.from(modelCache.entries())\n await Promise.allSettled(\n entries.map(async ([key, urlPromise]) => {\n try {\n const url = await urlPromise\n URL.revokeObjectURL(url)\n } catch (e) {\n // Ignore errors\n }\n })\n )\n modelCache.clear()\n}\n\nexport async function defaultGetModel(modelFromController: string): Promise<string> {\n // Check cache first\n if (modelCache.has(modelFromController)) {\n return modelCache.get(modelFromController)!\n }\n \n // Create the promise and cache it immediately to prevent duplicate calls\n const modelPromise = (async () => {\n const instanceUrl = import.meta.env.WANDELAPI_BASE_URL \n const nova = new NovaClient({ instanceUrl })\n \n // Configure axios to handle binary responses for GLB files\n const apiInstance = nova.api.motionGroupModels as any\n if (apiInstance.axios?.interceptors) {\n apiInstance.axios.interceptors.request.use((config: any) => {\n if (config.url?.includes('/glb')) {\n config.responseType = 'blob'\n }\n return config\n })\n }\n \n try {\n const file = await nova.api.motionGroupModels.getMotionGroupGlbModel(modelFromController)\n \n // Create object URL from the file and return it\n const url = URL.createObjectURL(file)\n return url\n } catch (error) {\n console.error(\"Failed to fetch model:\", error)\n throw error\n }\n })()\n \n // Cache the promise\n modelCache.set(modelFromController, modelPromise)\n return modelPromise\n}\n\n/**\n * Finds all the joint groups in a GLTF tree, as identified\n * by the _Jxx name ending convention.\n */\nexport function collectJoints(rootObject: Object3D): Object3D[] {\n function getAllObjects(root: Object3D): Object3D[] {\n if (root.children.length === 0) {\n return [root]\n }\n return [root, ...root.children.flatMap((child) => getAllObjects(child))]\n }\n\n return getAllObjects(rootObject).filter((o) => isJoint(o))\n}\n\n/**\n * Checks if a specified threejs object represents the flange of a\n * robot, based on the _FLG name ending convention.\n */\nexport function isFlange(node: Object3D) {\n return node.name.endsWith(\"_FLG\")\n}\n\n/**\n * Checks if a specified threejs object represents a joint of a\n * robot, based on the _Jxx name ending convention.\n */\nexport function isJoint(node: Object3D) {\n return /_J[0-9]+$/.test(node.name)\n}\n\n/**\n * Validates that the loaded GLTF file has six joints and a flange group.\n */\nexport function parseRobotModel(gltf: GLTF, filename: string): { gltf: GLTF } {\n let flange: Object3D | undefined\n const joints: Object3D[] = []\n\n function parseNode(node: Object3D) {\n if (isFlange(node)) {\n if (flange) {\n throw Error(\n `Found multiple flange groups in robot model ${filename}; first ${flange.name} then ${node.name}. Only one _FLG group is allowed.`,\n )\n }\n\n flange = node\n }\n\n if (isJoint(node)) {\n joints.push(node)\n }\n\n node.children.map(parseNode)\n }\n\n parseNode(gltf.scene)\n\n if (!flange) {\n throw Error(\n `No flange group found in robot model ${filename}. Flange must be identified with a name ending in _FLG.`,\n )\n }\n\n return { gltf }\n}\n","import { useFrame, useThree } from \"@react-three/fiber\"\nimport type { DHParameter, MotionGroupState } from \"@wandelbots/nova-js/v2\"\nimport React, { useEffect, useRef, useCallback } from \"react\"\nimport type { Group, Object3D } from \"three\"\nimport { useAutorun } from \"../utils/hooks\"\nimport { ValueInterpolator } from \"../utils/interpolation\"\nimport { collectJoints } from \"./robotModelLogic\"\n\ntype RobotAnimatorProps = {\n rapidlyChangingMotionState: MotionGroupState\n dhParameters: DHParameter[]\n onRotationChanged?: (joints: Object3D[], jointValues: number[]) => void\n children: React.ReactNode\n}\n\nexport default function RobotAnimator({\n rapidlyChangingMotionState,\n dhParameters,\n onRotationChanged,\n children,\n}: RobotAnimatorProps) {\n const jointValues = useRef<number[]>([])\n const jointObjects = useRef<Object3D[]>([])\n const interpolatorRef = useRef<ValueInterpolator | null>(null)\n const { invalidate } = useThree()\n\n // Initialize interpolator\n useEffect(() => {\n const initialJointValues = rapidlyChangingMotionState.joint_position.filter(\n (item) => item !== undefined,\n )\n\n interpolatorRef.current = new ValueInterpolator(initialJointValues, {\n tension: 120, // Controls spring stiffness - higher values create faster, more responsive motion\n friction: 20, // Controls damping - higher values reduce oscillation and create smoother settling\n threshold: 0.001,\n })\n\n return () => {\n interpolatorRef.current?.destroy()\n }\n }, [])\n\n // Animation loop that runs at the display's refresh rate\n useFrame((state, delta) => {\n if (interpolatorRef.current) {\n const isComplete = interpolatorRef.current.update(delta)\n setRotation()\n\n // Trigger a re-render only if the animation is still running\n if (!isComplete) {\n invalidate()\n }\n }\n })\n\n function setGroupRef(group: Group | null) {\n if (!group) return\n\n jointObjects.current = collectJoints(group)\n\n // Set initial position\n setRotation()\n invalidate()\n }\n\n function setRotation() {\n const updatedJointValues = interpolatorRef.current?.getCurrentValues() || []\n\n if (onRotationChanged) {\n onRotationChanged(jointObjects.current, updatedJointValues)\n } else {\n for (const [index, object] of jointObjects.current.entries()) {\n const dhParam = dhParameters[index]\n const rotationOffset = dhParam.theta || 0\n const rotationSign = dhParam.reverse_rotation_direction ? -1 : 1\n\n object.rotation.y =\n rotationSign * (updatedJointValues[index] || 0) + rotationOffset\n }\n }\n }\n\n const updateJoints = useCallback(() => {\n const newJointValues = rapidlyChangingMotionState.joint_position.filter(\n (item) => item !== undefined,\n )\n\n requestAnimationFrame(() => {\n jointValues.current = newJointValues\n interpolatorRef.current?.setTarget(newJointValues)\n })\n }, [rapidlyChangingMotionState])\n\n /**\n * Fire an update joints call on every motion state change.\n * requestAnimationFrame used to avoid blocking main thread\n */\n useEffect(() => {\n updateJoints()\n }, [rapidlyChangingMotionState, updateJoints])\n\n /**\n * As some consumer applications (eg. storybook) deliver\n * mobx observable for rapidlyChangingMotionState, we need to\n * register the watcher to get the newest value updates\n */\n useAutorun(() => {\n updateJoints()\n })\n\n return <group ref={setGroupRef}>{children}</group>\n}\n","import { Line } from \"@react-three/drei\"\nimport type { DHParameter } from \"@wandelbots/nova-js/v2\"\nimport React, { useRef } from \"react\"\nimport type * as THREE from \"three\"\nimport { Matrix4, Quaternion, Vector3 } from \"three\"\nimport type { LineGeometry } from \"three/examples/jsm/lines/LineGeometry.js\"\nimport RobotAnimator from \"./RobotAnimator\"\nimport type { DHRobotProps } from \"./SupportedRobot\"\n\nconst CHILD_LINE = \"line\"\nconst CHILD_MESH = \"mesh\"\n\nexport function DHRobot({\n rapidlyChangingMotionState,\n dhParameters,\n ...props\n}: DHRobotProps) {\n // reused in every update\n const accumulatedMatrix = new Matrix4()\n\n // Store direct references to avoid searching by name\n const lineRefs = useRef<any[]>([])\n const meshRefs = useRef<(THREE.Mesh | null)[]>([])\n\n // Initialize refs array when dhParameters change\n React.useEffect(() => {\n lineRefs.current = new Array(dhParameters.length).fill(null)\n meshRefs.current = new Array(dhParameters.length).fill(null)\n }, [dhParameters.length])\n\n // Updates accumulatedMatrix with every execution\n // Reset the matrix to identity if you start a new position update\n function getLinePoints(\n dhParameter: DHParameter,\n jointRotation: number,\n ): {\n a: THREE.Vector3\n b: THREE.Vector3\n } {\n const position = new Vector3()\n const quaternion = new Quaternion()\n const scale = new Vector3()\n accumulatedMatrix.decompose(position, quaternion, scale)\n const prevPosition = position.clone() // Update the previous position\n\n const matrix = new Matrix4()\n .makeRotationY(\n dhParameter.theta! +\n jointRotation * (dhParameter.reverse_rotation_direction ? -1 : 1),\n ) // Rotate around Z\n .multiply(new Matrix4().makeTranslation(0, dhParameter.d! / 1000, 0)) // Translate along Z\n .multiply(new Matrix4().makeTranslation(dhParameter.a! / 1000, 0, 0)) // Translate along X\n .multiply(new Matrix4().makeRotationX(dhParameter.alpha!)) // Rotate around X\n\n // Accumulate transformations\n accumulatedMatrix.multiply(matrix)\n accumulatedMatrix.decompose(position, quaternion, scale)\n return { a: prevPosition, b: position }\n }\n\n function setJointLineRotation(\n jointIndex: number,\n line: any, // Use any for drei Line component\n mesh: THREE.Mesh,\n jointValue: number,\n ) {\n if (!dhParameters) {\n return\n }\n\n const dh_parameter = dhParameters[jointIndex]\n if (!dh_parameter) {\n return\n }\n\n const { a, b } = getLinePoints(dh_parameter, jointValue)\n const lineGeometry = line.geometry as LineGeometry\n lineGeometry.setPositions([a.toArray(), b.toArray()].flat())\n\n mesh.position.set(b.x, b.y, b.z)\n }\n\n function setRotation(joints: THREE.Object3D[], jointValues: number[]) {\n accumulatedMatrix.identity()\n\n // Use direct refs instead of searching by name\n for (\n let jointIndex = 0;\n jointIndex < Math.min(joints.length, jointValues.length);\n jointIndex++\n ) {\n const line = lineRefs.current[jointIndex]\n const mesh = meshRefs.current[jointIndex]\n\n if (line && mesh) {\n setJointLineRotation(jointIndex, line, mesh, jointValues[jointIndex]!)\n }\n }\n }\n\n return (\n <>\n <RobotAnimator\n rapidlyChangingMotionState={rapidlyChangingMotionState}\n dhParameters={dhParameters}\n onRotationChanged={setRotation}\n >\n <group {...props} name=\"Scene\">\n <mesh>\n <sphereGeometry args={[0.01, 32, 32]} />\n <meshStandardMaterial color={\"black\"} depthTest={true} />\n </mesh>\n {dhParameters!.map((param, index) => {\n const { a, b } = getLinePoints(\n param,\n rapidlyChangingMotionState.joint_position[index] ?? 0,\n )\n const jointName = `dhrobot_J0${index}`\n return (\n <group name={jointName} key={jointName}>\n <Line\n ref={(ref) => {\n lineRefs.current[index] = ref\n }}\n name={CHILD_LINE}\n points={[a, b]}\n color={\"white\"}\n lineWidth={5}\n />\n <mesh\n ref={(ref) => {\n meshRefs.current[index] = ref\n }}\n name={CHILD_MESH}\n key={\"mesh_\" + index}\n position={b}\n >\n <sphereGeometry args={[0.01, 32, 32]} />\n <meshStandardMaterial color={\"black\"} depthTest={true} />\n </mesh>\n </group>\n )\n })}\n </group>\n </RobotAnimator>\n </>\n )\n}\n","\"use client\"\nimport { useEffect } from \"react\"\n\nconst defaultWarn = console.warn\n\nexport default function ConsoleFilter() {\n useEffect(() => {\n console.warn = (data) => {\n // This message is caused by a bug from useSpring in combination with Canvas \"demand\" frameloop.\n // For now we can only suppress this warning there are no sideeffects yet\n // See https://github.com/pmndrs/react-spring/issues/1586#issuecomment-915051856\n if (\n data ===\n \"Cannot call the manual advancement of rafz whilst frameLoop is not set as demand\"\n ) {\n return\n }\n\n defaultWarn(data)\n }\n }, [])\n\n return <></>\n}\n","import { useGLTF } from \"@react-three/drei\"\nimport type { ThreeElements } from \"@react-three/fiber\"\nimport React, { useCallback, useEffect, useState } from \"react\"\nimport type { Group, Mesh } from \"three\"\nimport { type Object3D } from \"three\"\nimport { isFlange, parseRobotModel } from \"./robotModelLogic\"\n\nexport type RobotModelProps = {\n modelURL: string | Promise<string>\n /**\n * Called after a robot model has been loaded and\n * rendered into the threejs scene\n */\n postModelRender?: () => void\n flangeRef?: React.Ref<Group>\n} & ThreeElements[\"group\"]\n\nfunction isMesh(node: Object3D): node is Mesh {\n return node.type === \"Mesh\"\n}\n\n// Separate component that only renders when we have a valid URL\nfunction LoadedRobotModel({ \n url, \n flangeRef, \n postModelRender, \n ...props \n}: { \n url: string\n flangeRef?: React.Ref<Group>\n postModelRender?: () => void\n} & ThreeElements[\"group\"]) {\n const gltfResult = useGLTF(url)\n let gltf\n try {\n const parsed = parseRobotModel(gltfResult, 'robot.glb')\n gltf = parsed.gltf\n } catch (err) {\n throw err;\n }\n\n const groupRef: React.RefCallback<Group> = useCallback(\n (group) => {\n if (group && postModelRender) {\n postModelRender()\n }\n },\n [postModelRender],\n )\n\n function renderNode(node: Object3D): React.ReactNode {\n try {\n if (isMesh(node)) {\n // Defensive: only render mesh if geometry exists\n if ((node as Mesh).geometry) {\n return (\n <mesh\n name={node.name}\n key={node.uuid}\n geometry={(node as Mesh).geometry}\n material={(node as Mesh).material}\n position={node.position}\n rotation={node.rotation}\n />\n )\n }\n // Fallback to empty group if geometry is missing\n return (\n <group name={node.name} key={node.uuid} position={node.position} rotation={node.rotation} />\n )\n } else {\n return (\n <group\n name={node.name}\n key={node.uuid}\n position={node.position}\n rotation={node.rotation}\n ref={isFlange(node) ? flangeRef : undefined}\n >\n {node.children.map(renderNode)}\n </group>\n )\n }\n } catch (e) {\n console.warn('Error rendering node', node.name, e)\n return null\n }\n }\n\n return (\n <group {...props} dispose={null} ref={groupRef}>\n {renderNode(gltf.scene)}\n </group>\n )\n}\n\nexport function GenericRobot({\n modelURL,\n flangeRef,\n postModelRender,\n ...props\n}: RobotModelProps) {\n const [resolvedURL, setResolvedURL] = useState<string | null>(null)\n \n useEffect(() => {\n const resolveURL = async () => {\n try {\n if (typeof modelURL === 'string') {\n setResolvedURL(modelURL)\n } else {\n const url = await modelURL\n setResolvedURL(url)\n }\n } catch (error) {\n console.error('Failed to resolve model URL:', error)\n }\n }\n \n resolveURL()\n }, [modelURL])\n\n // Don't render until we have a resolved URL\n if (!resolvedURL) {\n return null // Loading state\n }\n \n return (\n <LoadedRobotModel \n url={resolvedURL}\n flangeRef={flangeRef}\n postModelRender={postModelRender}\n {...props}\n />\n )\n}\n","import * as THREE from \"three\"\n\nexport const applyGhostStyle = (robot: THREE.Group, color: string) => {\n if (robot.userData.isGhost) return\n\n robot.traverse((obj) => {\n if (obj instanceof THREE.Mesh) {\n if (obj.material instanceof THREE.Material) {\n obj.material.colorWrite = false\n }\n\n // Create a clone of the mesh\n const depth = obj.clone()\n const ghost = obj.clone()\n\n depth.material = new THREE.MeshStandardMaterial({\n depthTest: true,\n depthWrite: true,\n colorWrite: false,\n polygonOffset: true,\n polygonOffsetFactor: -1,\n side: THREE.DoubleSide,\n })\n depth.userData.isGhost = true\n\n // Set the material for the ghost mesh\n ghost.material = new THREE.MeshStandardMaterial({\n color: color,\n opacity: 0.3,\n depthTest: true,\n depthWrite: false,\n transparent: true,\n polygonOffset: true,\n polygonOffsetFactor: -2,\n side: THREE.DoubleSide,\n })\n ghost.userData.isGhost = true\n\n if (obj.parent) {\n obj.parent.add(depth)\n obj.parent.add(ghost)\n }\n }\n })\n\n robot.userData.isGhost = true\n}\n\nexport const removeGhostStyle = (robot: THREE.Group) => {\n if (!robot.userData.isGhost) return\n\n const objectsToRemove: THREE.Object3D[] = []\n\n robot.traverse((obj) => {\n if (obj instanceof THREE.Mesh) {\n if (obj.userData?.isGhost) {\n objectsToRemove.push(obj)\n } else if (obj.material instanceof THREE.Material) {\n obj.material.colorWrite = true\n }\n }\n })\n\n objectsToRemove.forEach((obj) => {\n if (obj.parent) {\n obj.parent.remove(obj)\n }\n })\n\n robot.userData.isGhost = false\n}\n","import type { ThreeElements } from \"@react-three/fiber\"\nimport type { DHParameter, MotionGroupState } from \"@wandelbots/nova-js/v2\"\nimport { Suspense, useCallback, useEffect, useState } from \"react\"\nimport { DHRobot } from \"./DHRobot\"\n\nimport { ErrorBoundary } from \"react-error-boundary\"\nimport type * as THREE from \"three\"\nimport { externalizeComponent } from \"../../externalizeComponent\"\nimport ConsoleFilter from \"../ConsoleFilter\"\nimport { GenericRobot } from \"./GenericRobot\"\nimport RobotAnimator from \"./RobotAnimator\"\nimport { applyGhostStyle, removeGhostStyle } from \"./ghostStyle\"\nimport { defaultGetModel } from \"./robotModelLogic\"\n\nexport type DHRobotProps = {\n rapidlyChangingMotionState: MotionGroupState\n dhParameters: Array<DHParameter>\n} & ThreeElements[\"group\"]\n\nexport type SupportedRobotProps = {\n rapidlyChangingMotionState: MotionGroupState\n modelFromController: string\n dhParameters: DHParameter[]\n flangeRef?: React.Ref<THREE.Group>\n getModel?: (modelFromController: string) => Promise<string> | undefined\n postModelRender?: () => void\n transparentColor?: string\n} & ThreeElements[\"group\"]\n\nexport const SupportedRobot = externalizeComponent(\n ({\n rapidlyChangingMotionState,\n modelFromController,\n dhParameters,\n getModel = defaultGetModel,\n flangeRef,\n postModelRender,\n transparentColor,\n ...props\n }: SupportedRobotProps) => {\n const [robotGroup, setRobotGroup] = useState<THREE.Group | null>(null)\n\n const setRobotRef = useCallback((instance: THREE.Group | null) => {\n setRobotGroup(instance)\n }, [])\n\n useEffect(() => {\n if (!robotGroup) return\n\n if (transparentColor) {\n applyGhostStyle(robotGroup, transparentColor)\n } else {\n removeGhostStyle(robotGroup)\n }\n }, [robotGroup, transparentColor])\n\n const dhrobot = (\n <DHRobot\n rapidlyChangingMotionState={rapidlyChangingMotionState}\n dhParameters={dhParameters}\n {...props}\n />\n )\n\n return (\n <ErrorBoundary\n fallback={dhrobot}\n onError={(err) => {\n // Missing model; show the fallback for now\n console.warn(err)\n }}\n >\n <Suspense fallback={dhrobot}>\n <group ref={setRobotRef}>\n <RobotAnimator\n rapidlyChangingMotionState={rapidlyChangingMotionState}\n dhParameters={dhParameters}\n >\n <GenericRobot\n modelURL={(() => {\n const result = getModel(modelFromController)\n if (!result) {\n const mockBlob = new Blob([], { type: 'model/gltf-binary' })\n const mockFile = new File([mockBlob], `${modelFromController}.glb`, { type: 'model/gltf-binary' })\n return Promise.resolve(URL.createObjectURL(mockFile))\n }\n return result\n })()}\n postModelRender={postModelRender}\n flangeRef={flangeRef}\n {...props}\n />\n </RobotAnimator>\n </group>\n </Suspense>\n <ConsoleFilter />\n </ErrorBoundary>\n )\n },\n)\n","import type { ThreeElements } from \"@react-three/fiber\"\n\nimport type { Group } from \"three\"\nimport type { ConnectedMotionGroup } from \"../../lib/ConnectedMotionGroup\"\nimport { defaultGetModel } from \"./robotModelLogic\"\nimport { SupportedRobot } from \"./SupportedRobot\"\n\nexport type RobotProps = {\n connectedMotionGroup: ConnectedMotionGroup\n getModel?: (modelFromController: string) => Promise<string>\n flangeRef?: React.Ref<Group>\n transparentColor?: string\n postModelRender?: () => void\n} & ThreeElements[\"group\"]\n\n/**\n * The Robot component is a wrapper around the SupportedRobot component\n * for usage with @wandelbots/nova-js ConnectedMotionGroup object.\n *\n * @param {RobotProps} props - The properties for the Robot component.\n * @param {ConnectedMotionGroup} props.connectedMotionGroup - The connected motion group containing motion state and parameters.\n * @param {Function} [props.getModel=defaultGetModel] - Optional function to get the model URL. Defaults to defaultGetModel.\n * @param {Object} props - Additional properties passed to the SupportedRobot component.\n *\n * @returns {JSX.Element} The rendered SupportedRobot component.\n */\nexport function Robot({\n connectedMotionGroup,\n getModel = defaultGetModel,\n flangeRef,\n transparentColor,\n postModelRender,\n ...props\n}: RobotProps) {\n if (!connectedMotionGroup.dhParameters) {\n return null\n }\n\n return (\n <SupportedRobot\n rapidlyChangingMotionState={\n connectedMotionGroup.rapidlyChangingMotionState\n }\n modelFromController={connectedMotionGroup.modelFromController || \"\"}\n dhParameters={connectedMotionGroup.dhParameters}\n getModel={getModel}\n flangeRef={flangeRef}\n transparentColor={transparentColor}\n postModelRender={postModelRender}\n {...props}\n />\n )\n}\n\nexport { defaultGetModel }\n","import { Box, Button, Card, Divider, Typography, useTheme } from \"@mui/material\"\nimport { Bounds } from \"@react-three/drei\"\nimport { Canvas } from \"@react-three/fiber\"\nimport type { OperationMode, SafetyStateType } from \"@wandelbots/nova-js/v2\"\nimport { observer } from \"mobx-react-lite\"\nimport { useCallback, useEffect, useRef, useState } from \"react\"\nimport { useTranslation } from \"react-i18next\"\nimport type { Group } from \"three\"\nimport { externalizeComponent } from \"../externalizeComponent\"\nimport type { ConnectedMotionGroup } from \"../lib/ConnectedMotionGroup\"\nimport { PresetEnvironment } from \"./3d-viewport/PresetEnvironment\"\nimport type { ProgramState } from \"./ProgramControl\"\nimport { ProgramStateIndicator } from \"./ProgramStateIndicator\"\nimport { Robot } from \"./robots/Robot\"\n\nexport interface RobotCardProps {\n /** Name of the robot displayed at the top */\n robotName: string\n /** Current program state */\n programState: ProgramState\n /** Current safety state of the robot controller */\n safetyState: SafetyStateType\n /** Current operation mode of the robot controller */\n operationMode: OperationMode\n /** Whether the \"Drive to Home\" button should be enabled */\n driveToHomeEnabled?: boolean\n /** Callback fired when \"Drive to Home\" button is pressed */\n onDriveToHomePress?: () => void\n /** Callback fired when \"Drive to Home\" button is released */\n onDriveToHomeRelease?: () => void\n /**\n * Callback fired when \"Drive to Home\" button is pressed, with the default home position.\n * If provided, this will be called instead of onDriveToHomePress, providing the recommended\n * home position joint configuration based on the robot manufacturer.\n */\n onDriveToHomePressWithConfig?: (homePosition: number[]) => void\n /**\n * Callback fired when \"Drive to Home\" button is released after using onDriveToHomePressWithConfig.\n * If provided, this will be called instead of onDriveToHomeRelease.\n */\n onDriveToHomeReleaseWithConfig?: () => void\n /**\n * Custom default joint configuration to use if manufacturer-based defaults are not available.\n * Joint values should be in radians.\n */\n defaultJointConfig?: number[]\n /** Connected motion group for the robot */\n connectedMotionGroup: ConnectedMotionGroup\n /** Custom robot component to render (optional, defaults to Robot) */\n robotComponent?: React.ComponentType<{\n connectedMotionGroup: ConnectedMotionGroup\n flangeRef?: React.Ref<Group>\n postModelRender?: () => void\n transparentColor?: string\n getModel?: (modelFromController: string) => Promise<string>\n }>\n /** Custom component to render in the content area (optional) */\n customContentComponent?: React.ComponentType<Record<string, unknown>>\n /** Additional CSS class name */\n className?: string\n}\n\n/**\n * A responsive card component that displays a 3D robot with states and controls.\n * The card automatically adapts to its container's size and aspect ratio.\n *\n * Features:\n * - Fully responsive Material-UI Card that adapts to container dimensions\n * - Automatic layout switching based on aspect ratio:\n * - Portrait mode: Vertical layout with robot in center\n * - Landscape mode: Horizontal layout with robot on left, content on right (left-aligned)\n * - Responsive 3D robot rendering:\n * - Scales dynamically with container size\n * - Hides at very small sizes to preserve usability\n * - Adaptive margin based on available space\n * - Smart spacing and padding that reduces at smaller sizes\n * - Minimum size constraints for usability while maximizing content density\n * - Robot name displayed in Typography h6 at top-left\n * - Program state indicator below the name\n * - Auto-fitting 3D robot model that scales with container size\n * - Customizable content area for displaying custom React components\n * - Transparent gray divider line\n * - \"Drive to Home\" button with press-and-hold functionality\n * - Localization support via react-i18next\n * - Material-UI theming integration\n *\n * Usage with custom content:\n * ```tsx\n * // Example custom timer component\n * const CustomTimer = () => (\n * <Box>\n * <Typography variant=\"body1\" sx={{ color: \"text.secondary\" }}>\n * Runtime\n * </Typography>\n * <Typography variant=\"h6\">05:23</Typography>\n * </Box>\n * )\n *\n * <RobotCard\n * robotName=\"UR5e Robot\"\n * programState={ProgramState.RUNNING}\n * customContentComponent={CustomTimer}\n * // ... other props\n * />\n * ```\n */\nexport const RobotCard = externalizeComponent(\n observer(\n ({\n robotName,\n programState,\n safetyState,\n operationMode,\n driveToHomeEnabled = false,\n onDriveToHomePress,\n onDriveToHomeRelease,\n connectedMotionGroup,\n robotComponent: RobotComponent = Robot,\n customContentComponent: CustomContentComponent,\n className,\n }: RobotCardProps) => {\n const theme = useTheme()\n const { t } = useTranslation()\n const [isDriveToHomePressed, setIsDriveToHomePressed] = useState(false)\n const driveButtonRef = useRef<HTMLButtonElement>(null)\n const cardRef = useRef<HTMLDivElement>(null)\n const [isLandscape, setIsLandscape] = useState(false)\n const [cardSize, setCardSize] = useState<{\n width: number\n height: number\n }>({ width: 400, height: 600 })\n const [modelRenderTrigger, setModelRenderTrigger] = useState(0)\n\n // Hook to detect aspect ratio and size changes\n useEffect(() => {\n const checkDimensions = () => {\n if (cardRef.current) {\n const { offsetWidth, offsetHeight } = cardRef.current\n setIsLandscape(offsetWidth > offsetHeight)\n setCardSize({ width: offsetWidth, height: offsetHeight })\n }\n }\n\n // Initial check\n checkDimensions()\n\n // Set up ResizeObserver to watch for size changes\n const resizeObserver = new ResizeObserver(checkDimensions)\n if (cardRef.current) {\n resizeObserver.observe(cardRef.current)\n }\n\n return () => {\n resizeObserver.disconnect()\n }\n }, [])\n\n const handleModelRender = useCallback(() => {\n // Trigger bounds refresh when model renders\n setModelRenderTrigger((prev) => prev + 1)\n }, [])\n\n const handleDriveToHomeMouseDown = useCallback(() => {\n if (!driveToHomeEnabled || !onDriveToHomePress) return\n setIsDriveToHomePressed(true)\n onDriveToHomePress()\n }, [driveToHomeEnabled, onDriveToHomePress])\n\n const handleDriveToHomeMouseUp = useCallback(() => {\n if (!driveToHomeEnabled || !onDriveToHomeRelease) return\n setIsDriveToHomePressed(false)\n onDriveToHomeRelease()\n }, [driveToHomeEnabled, onDriveToHomeRelease])\n\n const handleDriveToHomeMouseLeave = useCallback(() => {\n if (isDriveToHomePressed && onDriveToHomeRelease) {\n setIsDriveToHomePressed(false)\n onDriveToHomeRelease()\n }\n }, [isDriveToHomePressed, onDriveToHomeRelease])\n\n // Determine if robot should be hidden at small sizes to save space\n const shouldHideRobot = isLandscape\n ? cardSize.width < 350\n : cardSize.height < 200 // Hide robot at height < 200px in portrait\n\n // Determine if custom content should be hidden when height is too low\n // Custom content should be hidden BEFORE the robot (at higher threshold)\n const shouldHideCustomContent = isLandscape\n ? cardSize.height < 310 // Landscape: hide custom content at height < 310px\n : cardSize.height < 450 // Portrait: hide custom content at height < 450px\n\n return (\n <Card\n ref={cardRef}\n className={className}\n sx={{\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n flexDirection: isLandscape ? \"row\" : \"column\",\n position: \"relative\",\n overflow: \"hidden\",\n minWidth: { xs: 180, sm: 220, md: 250 },\n minHeight: isLandscape\n ? { xs: 200, sm: 240, md: 260 } // Allow runtime hiding at < 283px\n : { xs: 150, sm: 180, md: 220 }, // Allow progressive hiding in portrait mode\n border: `1px solid ${theme.palette.divider}`,\n borderRadius: \"18px\",\n boxShadow: \"none\",\n backgroundColor:\n theme.palette.backgroundPaperElevation?.[8] || \"#2A2A3F\",\n backgroundImage: \"none\", // Override any gradient from elevation\n }}\n >\n {isLandscape ? (\n <>\n {/* Landscape Layout: Robot on left, content on right */}\n <Box\n sx={{\n flex: \"0 0 50%\",\n position: \"relative\",\n height: \"100%\",\n minHeight: \"100%\",\n maxHeight: \"100%\",\n borderRadius: 1,\n m: { xs: 1.5, sm: 2, md: 3 },\n mr: { xs: 0.75, sm: 1, md: 1.5 },\n overflow: \"hidden\", // Prevent content from affecting container size\n display: shouldHideRobot ? \"none\" : \"block\",\n }}\n >\n {!shouldHideRobot && (\n <Canvas\n orthographic\n camera={{\n position: [3, 2, 3],\n zoom: 1,\n }}\n shadows\n frameloop=\"demand\"\n style={{\n borderRadius: theme.shape.borderRadius,\n width: \"100%\",\n height: \"100%\",\n background: \"transparent\",\n position: \"absolute\",\n top: 0,\n left: 0,\n }}\n dpr={[1, 2]}\n gl={{ alpha: true, antialias: true }}\n >\n <PresetEnvironment />\n <Bounds fit observe margin={1} maxDuration={1}>\n <RobotComponent\n connectedMotionGroup={connectedMotionGroup}\n postModelRender={handleModelRender}\n />\n </Bounds>\n </Canvas>\n )}\n </Box>\n\n {/* Content container on right */}\n <Box\n sx={{\n flex: shouldHideRobot ? \"1\" : \"1\",\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"flex-start\",\n width: shouldHideRobot ? \"100%\" : \"50%\",\n }}\n >\n {/* Header section with robot name and program state */}\n <Box\n sx={{\n p: { xs: 1.5, sm: 2, md: 3 },\n pb: { xs: 1, sm: 1.5, md: 2 },\n textAlign: \"left\",\n }}\n >\n <Typography variant=\"h6\" component=\"h2\" sx={{ mb: 1 }}>\n {robotName}\n </Typography>\n <ProgramStateIndicator\n programState={programState}\n safetyState={safetyState}\n operationMode={operationMode}\n />\n </Box>\n\n {/* Bottom section with custom content and button */}\n <Box\n sx={{\n p: { xs: 1.5, sm: 2, md: 3 },\n pt: 0,\n flex: \"1\",\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"space-between\",\n }}\n >\n {/* Custom content section - hidden if height is too low in landscape mode */}\n {!shouldHideCustomContent && CustomContentComponent && (\n <Box>\n <CustomContentComponent />\n\n {/* Divider */}\n <Divider\n sx={{\n mt: 1,\n mb: 0,\n borderColor: theme.palette.divider,\n opacity: 0.5,\n }}\n />\n </Box>\n )}\n\n <Box\n sx={{\n mt:\n !shouldHideCustomContent && CustomContentComponent\n ? \"auto\"\n : 0,\n }}\n >\n {/* Drive to Home button with some space */}\n <Box\n sx={{\n display: \"flex\",\n justifyContent: \"flex-start\",\n mt: { xs: 1, sm: 1.5, md: 2 },\n mb: { xs: 0.5, sm: 0.75, md: 1 },\n }}\n >\n <Button\n ref={driveButtonRef}\n variant=\"contained\"\n color=\"secondary\"\n size=\"small\"\n disabled={!driveToHomeEnabled}\n onMouseDown={handleDriveToHomeMouseDown}\n onMouseUp={handleDriveToHomeMouseUp}\n onMouseLeave={handleDriveToHomeMouseLeave}\n onTouchStart={handleDriveToHomeMouseDown}\n onTouchEnd={handleDriveToHomeMouseUp}\n sx={{\n textTransform: \"none\",\n px: 1.5,\n py: 0.5,\n }}\n >\n {t(\"RobotCard.DriveToHome.bt\")}\n </Button>\n </Box>\n </Box>\n </Box>\n </Box>\n </>\n ) : (\n <>\n {/* Portrait Layout: Header, Robot, Footer */}\n <Box\n sx={{\n p: 3,\n height: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n }}\n >\n {/* Header section with robot name and program state */}\n <Box>\n <Typography variant=\"h6\" component=\"h2\" sx={{ mb: 1 }}>\n {robotName}\n </Typography>\n <ProgramStateIndicator\n programState={programState}\n safetyState={safetyState}\n operationMode={operationMode}\n />\n </Box>\n\n {/* 3D Robot viewport in center */}\n <Box\n sx={{\n flex: shouldHideRobot ? 0 : 1,\n position: \"relative\",\n minHeight: shouldHideRobot\n ? 0\n : { xs: 120, sm: 150, md: 200 },\n height: shouldHideRobot ? 0 : \"auto\",\n borderRadius: 1,\n overflow: \"hidden\",\n display: shouldHideRobot ? \"none\" : \"block\",\n }}\n >\n {!shouldHideRobot && (\n <Canvas\n orthographic\n camera={{\n position: [3, 2, 3],\n zoom: 1,\n }}\n shadows\n frameloop=\"demand\"\n style={{\n borderRadius: theme.shape.borderRadius,\n width: \"100%\",\n height: \"100%\",\n background: \"transparent\",\n position: \"absolute\",\n }}\n dpr={[1, 2]}\n gl={{ alpha: true, antialias: true }}\n >\n <PresetEnvironment />\n <Bounds fit clip observe margin={1} maxDuration={1}>\n <RobotComponent\n connectedMotionGroup={connectedMotionGroup}\n postModelRender={handleModelRender}\n />\n </Bounds>\n </Canvas>\n )}\n </Box>\n\n {/* Bottom section with custom content and button */}\n <Box>\n {/* Custom content section - hidden if height is too low */}\n {!shouldHideCustomContent && CustomContentComponent && (\n <>\n <CustomContentComponent />\n\n {/* Divider */}\n <Divider\n sx={{\n mt: 1,\n mb: 0,\n borderColor: theme.palette.divider,\n opacity: 0.5,\n }}\n />\n </>\n )}\n\n {/* Drive to Home button with some space */}\n <Box\n sx={{\n display: \"flex\",\n justifyContent: \"flex-start\",\n mt:\n !shouldHideCustomContent && CustomContentComponent\n ? { xs: 1, sm: 2, md: 5 }\n : { xs: 0.5, sm: 1, md: 2 },\n mb: { xs: 0.5, sm: 0.75, md: 1 },\n }}\n >\n <Button\n ref={driveButtonRef}\n variant=\"contained\"\n color=\"secondary\"\n size=\"small\"\n disabled={!driveToHomeEnabled}\n onMouseDown={handleDriveToHomeMouseDown}\n onMouseUp={handleDriveToHomeMouseUp}\n onMouseLeave={handleDriveToHomeMouseLeave}\n onTouchStart={handleDriveToHomeMouseDown}\n onTouchEnd={handleDriveToHomeMouseUp}\n sx={{\n textTransform: \"none\",\n px: 1.5,\n py: 0.5,\n }}\n >\n {t(\"RobotCard.DriveToHome.bt\")}\n </Button>\n </Box>\n </Box>\n </Box>\n </>\n )}\n </Card>\n )\n },\n ),\n)\n","export type AxisConfig = number[]\n\nexport const defaultAxisConfig: AxisConfig = Array(6).fill(2 * Math.PI)\n","import { Manufacturer } from \"@wandelbots/nova-js/v2\"\n\n/**\n * Default home configs for different robot manufacturers.\n * These joint configurations represent safe home configs for each manufacturer's robots.\n * All angles are in radians.\n */\nexport const MANUFACTURER_HOME_CONFIGS: Record<Manufacturer, number[]> = {\n [Manufacturer.Abb]: [0.0, 0.0, 0.0, 0.0, Math.PI / 2, 0.0, 0.0],\n [Manufacturer.Fanuc]: [0.0, 0.0, 0.0, 0.0, -Math.PI / 2, 0.0, 0.0],\n [Manufacturer.Yaskawa]: [0.0, 0.0, 0.0, 0.0, -Math.PI / 2, 0.0, 0.0],\n [Manufacturer.Kuka]: [\n 0.0,\n -Math.PI / 2,\n Math.PI / 2,\n 0.0,\n Math.PI / 2,\n 0.0,\n 0.0,\n ],\n [Manufacturer.Universalrobots]: [\n 0.0,\n -Math.PI / 2,\n -Math.PI / 2,\n -Math.PI / 2,\n Math.PI / 2,\n -Math.PI / 2,\n 0.0,\n ],\n}\n\n/**\n * Extracts manufacturer from modelFromController string.\n * @param modelFromController - String in format \"Manufacturer_ModelName\"\n * @returns Manufacturer enum value or null if not recognized\n */\nexport function extractManufacturer(\n modelFromController: string,\n): Manufacturer | null {\n const [manufacturerString] = modelFromController.split(\"_\")\n\n // Handle the mapping from string to enum\n switch (manufacturerString) {\n case \"ABB\":\n return Manufacturer.Abb\n case \"FANUC\":\n return Manufacturer.Fanuc\n case \"YASKAWA\":\n return Manufacturer.Yaskawa\n case \"KUKA\":\n return Manufacturer.Kuka\n case \"UniversalRobots\":\n return Manufacturer.Universalrobots\n default:\n return null\n }\n}\n\n/**\n * Gets the default home config for a robot based on its model identifier.\n * @param modelFromController - String in format \"Manufacturer_ModelName\"\n * @param defaultJointConfig - Optional custom default configuration to use if manufacturer not found\n * @returns Array of joint positions in radians, or null if no configuration available\n */\nexport function getDefaultHomeConfig(\n modelFromController: string,\n defaultJointConfig?: number[],\n): number[] | null {\n const manufacturer = extractManufacturer(modelFromController)\n\n if (manufacturer && manufacturer in MANUFACTURER_HOME_CONFIGS) {\n return MANUFACTURER_HOME_CONFIGS[manufacturer]\n }\n\n return defaultJointConfig || null\n}\n"],"names":["colliderShapeToBufferGeometry","shape","ConvexGeometry","vertex","THREE","ColliderElement","name","collider","children","position","_a","rotation","_b","jsx","ColliderCollection","colliders","meshChildrenProvider","props","colliderKey","CollisionSceneRenderer","scene","PresetEnvironment","Environment","Lightformers","positions","jsxs","Fragment","Lightformer","x","i","areVerticesCoplanar","vertices","v0","v1","v2","vector1","vector2","normal","vi","vector","dotProduct","SafetyZonesRenderer","safetyZones","zone","index","geometries","geometry","v","coplanarityResult","newVertex","convexGeometry","error","TrajectoryRenderer","trajectory","points","point","Line","modelCache","defaultGetModel","modelFromController","modelPromise","nova","NovaClient","apiInstance","config","file","collectJoints","rootObject","getAllObjects","root","child","o","isJoint","isFlange","node","parseRobotModel","gltf","filename","flange","parseNode","RobotAnimator","rapidlyChangingMotionState","dhParameters","onRotationChanged","jointValues","useRef","jointObjects","interpolatorRef","invalidate","useThree","useEffect","initialJointValues","item","ValueInterpolator","useFrame","state","delta","isComplete","setRotation","setGroupRef","group","updatedJointValues","object","dhParam","rotationOffset","rotationSign","updateJoints","useCallback","newJointValues","useAutorun","CHILD_LINE","CHILD_MESH","DHRobot","accumulatedMatrix","Matrix4","lineRefs","meshRefs","React","getLinePoints","dhParameter","jointRotation","Vector3","quaternion","Quaternion","scale","prevPosition","matrix","setJointLineRotation","jointIndex","line","mesh","jointValue","dh_parameter","a","b","joints","param","jointName","ref","defaultWarn","ConsoleFilter","data","isMesh","LoadedRobotModel","url","flangeRef","postModelRender","gltfResult","useGLTF","err","groupRef","renderNode","e","GenericRobot","modelURL","resolvedURL","setResolvedURL","useState","applyGhostStyle","robot","color","obj","depth","ghost","removeGhostStyle","objectsToRemove","SupportedRobot","externalizeComponent","getModel","transparentColor","robotGroup","setRobotGroup","setRobotRef","instance","dhrobot","ErrorBoundary","Suspense","result","mockBlob","mockFile","Robot","connectedMotionGroup","RobotCard","observer","robotName","programState","safetyState","operationMode","driveToHomeEnabled","onDriveToHomePress","onDriveToHomeRelease","RobotComponent","CustomContentComponent","className","theme","useTheme","t","useTranslation","isDriveToHomePressed","setIsDriveToHomePressed","driveButtonRef","cardRef","isLandscape","setIsLandscape","cardSize","setCardSize","modelRenderTrigger","setModelRenderTrigger","checkDimensions","offsetWidth","offsetHeight","resizeObserver","handleModelRender","prev","handleDriveToHomeMouseDown","handleDriveToHomeMouseUp","handleDriveToHomeMouseLeave","shouldHideRobot","shouldHideCustomContent","Card","Box","Canvas","Bounds","Typography","ProgramStateIndicator","Divider","Button","defaultAxisConfig","MANUFACTURER_HOME_CONFIGS","Manufacturer","extractManufacturer","manufacturerString","getDefaultHomeConfig","defaultJointConfig","manufacturer"],"mappings":";;;;;;;;;;;;AAIO,SAASA,GACdC,GACsB;AAEtB,UADkBA,EAAM,YAChB;AAAA,IACN,KAAK;AACH,aAAO,IAAIC;AAAA,QACTD,EAAM,SAAS;AAAA,UACb,CAACE,MACC,IAAIC,EAAM;AAAA,YACRD,EAAO,CAAC,IAAI;AAAA,YACZA,EAAO,CAAC,IAAI;AAAA,YACZA,EAAO,CAAC,IAAI;AAAA,UAAA;AAAA,QACd;AAAA,MACJ;AAAA,IAEJ,KAAK;AACH,aAAO,IAAIC,EAAM;AAAA,QACfH,EAAM,SAAS;AAAA,QACfA,EAAM,SAAS;AAAA,QACfA,EAAM,SAAS;AAAA,MAAA;AAAA,IAEnB,KAAK;AACH,aAAO,IAAIG,EAAM,eAAeH,EAAM,SAAS,GAAI;AAAA,IACrD,KAAK;AACH,aAAO,IAAIG,EAAM;AAAA,QACfH,EAAM,SAAS;AAAA,QACfA,EAAM,kBAAkB;AAAA,MAAA;AAAA,IAE5B,KAAK;AACH,aAAO,IAAIG,EAAM;AAAA,QACfH,EAAM,SAAS;AAAA,QACfA,EAAM,SAAS;AAAA,QACfA,EAAM,SAAS;AAAA,MAAA;AAAA,IAEnB,KAAK;AACH,aAAO,IAAIG,EAAM,YAAYH,EAAM,SAAS,KAAMA,EAAM,SAAS,KAAM,CAAC;AAAA,IAE1E;AACE,qBAAQ,KAAK,GAAGA,EAAM,UAAU,mBAAmB,GAC5C,IAAIG,EAAM,eAAA;AAAA,EACnB;AAEJ;ACpCA,SAAwBC,GAAgB;AAAA,EACtC,M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,CAAC,KAAK,KAAK;AAAA,IACX,KAAK,KAAK;AAAA,IACV,CAAC,KAAK,KAAK;AAAA,IACX;AAAA,EAAA;AAEJ;AAOO,SAASC,GACd3K,GACqB;AACrB,QAAM,CAAC4K,CAAkB,IAAI5K,EAAoB,MAAM,GAAG;AAG1D,UAAQ4K,GAAA;AAAA,IACN,KAAK;AACH,aAAOF,EAAa;AAAA,IACtB,KAAK;AACH,aAAOA,EAAa;AAAA,IACtB,KAAK;AACH,aAAOA,EAAa;AAAA,IACtB,KAAK;AACH,aAAOA,EAAa;AAAA,IACtB,KAAK;AACH,aAAOA,EAAa;AAAA,IACtB;AACE,aAAO;AAAA,EAAA;AAEb;AAQO,SAASG,GACd7K,GACA8K,GACiB;AACjB,QAAMC,IAAeJ,GAAoB3K,CAAmB;AAE5D,SAAI+K,KAAgBA,KAAgBN,IAC3BA,EAA0BM,CAAY,IAGxCD,KAAsB;AAC/B;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const t=require("./externalizeComponent-CkVWk2F_.cjs"),w=require("three"),U=require("three-stdlib"),I=require("@react-three/fiber"),y=require("@react-three/drei"),j=require("@mui/material"),X=require("mobx-react-lite"),f=require("react"),Q=require("react-i18next"),g=require("./interpolation-DAXKfoDS.cjs"),ee=require("react-error-boundary");function te(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return n.default=e,Object.freeze(n)}const d=te(w);function re(e){switch(e.shape_type){case"convex_hull":return new U.ConvexGeometry(e.vertices.map(r=>new d.Vector3(r[0]/1e3,r[1]/1e3,r[2]/1e3)));case"box":return new d.BoxGeometry(e.size_x/1e3,e.size_y/1e3,e.size_z/1e3);case"sphere":return new d.SphereGeometry(e.radius/1e3);case"capsule":return new d.CapsuleGeometry(e.radius/1e3,e.cylinder_height/1e3);case"cylinder":return new d.CylinderGeometry(e.radius/1e3,e.radius/1e3,e.height/1e3);case"rectangle":return new d.BoxGeometry(e.size_x/1e3,e.size_y/1e3,0);default:return console.warn(`${e.shape_type} is not supported`),new d.BufferGeometry}}function ne({name:e,collider:n,children:r}){var c,a;const o=((c=n.pose)==null?void 0:c.position)??[0,0,0],s=((a=n.pose)==null?void 0:a.orientation)??[0,0,0];return n.margin&&console.warn(`${e} margin is not supported`),t.jsxRuntimeExports.jsx("mesh",{name:e,position:new d.Vector3(o[0],o[1],o[2]).divideScalar(1e3),rotation:new d.Euler(s[0],s[1],s[2],"XYZ"),geometry:re(n.shape),children:r})}function se({name:e,colliders:n,meshChildrenProvider:r,...o}){return t.jsxRuntimeExports.jsx("group",{name:e,...o,children:Object.entries(n).map(([s,c])=>t.jsxRuntimeExports.jsx(ne,{name:s,collider:c,children:r(s,c)},s))})}function oe({scene:e,meshChildrenProvider:n}){const r=e.colliders;return t.jsxRuntimeExports.jsx("group",{children:r&&t.jsxRuntimeExports.jsx(se,{meshChildrenProvider:n,colliders:r})})}function F(){return t.jsxRuntimeExports.jsx(y.Environment,{children:t.jsxRuntimeExports.jsx(ie,{})})}function ie({positions:e=[2,0,2,0,2,0,2,0]}){return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(y.Lightformer,{intensity:5,"rotation-x":Math.PI/2,position:[0,5,-9],scale:[10,10,1]}),t.jsxRuntimeExports.jsx("group",{rotation:[0,.5,0],children:t.jsxRuntimeExports.jsx("group",{children:e.map((n,r)=>t.jsxRuntimeExports.jsx(y.Lightformer,{form:"circle",intensity:5,rotation:[Math.PI/2,0,0],position:[n,4,r*4],scale:[3,1,1]},r))})}),t.jsxRuntimeExports.jsx(y.Lightformer,{intensity:40,"rotation-y":Math.PI/2,position:[-5,1,-1],scale:[20,.1,1]}),t.jsxRuntimeExports.jsx(y.Lightformer,{intensity:20,"rotation-y":-Math.PI,position:[-5,-2,-1],scale:[20,.1,1]}),t.jsxRuntimeExports.jsx(y.Lightformer,{"rotation-y":Math.PI/2,position:[-5,-1,-1],scale:[20,.5,1],intensity:5}),t.jsxRuntimeExports.jsx(y.Lightformer,{"rotation-y":-Math.PI/2,position:[10,1,0],scale:[20,1,1],intensity:10}),t.jsxRuntimeExports.jsx(y.Lightformer,{form:"ring",color:"white",intensity:5,scale:10,position:[-15,4,-18],target:[0,0,0]})]})}function ae(e){if(e.length<3)return console.log("Not enough vertices to define a plane"),{isCoplanar:!1};const n=new d.Vector3(e[0].x,e[0].y,e[0].z),r=new d.Vector3(e[1].x,e[1].y,e[1].z),o=new d.Vector3(e[2].x,e[2].y,e[2].z),s=new d.Vector3().subVectors(r,n),c=new d.Vector3().subVectors(o,n),a=new d.Vector3().crossVectors(s,c).normalize();for(let x=3;x<e.length;x++){const i=new d.Vector3(e[x].x,e[x].y,e[x].z),p=new d.Vector3().subVectors(i,n),m=a.dot(p);if(Math.abs(m)>1e-6)return console.log("Vertices are not on the same plane"),{isCoplanar:!1}}return{isCoplanar:!0,normal:a}}function ue({safetyZones:e,...n}){return t.jsxRuntimeExports.jsx("group",{...n,children:e.map((r,o)=>{let s=[];return r.geometry&&(r.geometry.compound?s=r.geometry.compound.child_geometries:r.geometry.convex_hull&&(s=[r.geometry])),s.map((c,a)=>{if(!c.convex_hull)return null;const x=c.convex_hull.vertices.map(m=>new d.Vector3(m.x/1e3,m.y/1e3,m.z/1e3)),i=ae(x);if(i.isCoplanar&&i.normal){const u=new d.Vector3().addVectors(x[0],i.normal.multiplyScalar(1e-4));x.push(u)}let p;try{p=new U.ConvexGeometry(x)}catch(m){return console.log("Error creating ConvexGeometry:",m),null}return t.jsxRuntimeExports.jsx("mesh",{geometry:p,children:t.jsxRuntimeExports.jsx("meshStandardMaterial",{attach:"material",color:"#009f4d",opacity:.2,depthTest:!1,depthWrite:!1,transparent:!0,polygonOffset:!0,polygonOffsetFactor:-a},o)},`${o}-${a}`)})})})}function ce({trajectory:e,...n}){var o;const r=((o=e.trajectory)==null?void 0:o.map(s=>s.tcp_pose?new d.Vector3(s.tcp_pose.position.x/1e3,s.tcp_pose.position.z/1e3,-s.tcp_pose.position.y/1e3):null).filter(s=>s!==null))||[];return t.jsxRuntimeExports.jsx("group",{...n,children:r.length>0&&t.jsxRuntimeExports.jsx(y.Line,{points:r,lineWidth:3,polygonOffset:!0,polygonOffsetFactor:10,polygonOffsetUnits:10})})}const k=new Map;async function D(e){if(k.has(e))return k.get(e);const n=(async()=>{var c;const o=new g.NovaClient({instanceUrl:""}),s=o.api.motionGroupModels;(c=s.axios)!=null&&c.interceptors&&s.axios.interceptors.request.use(a=>{var x;return(x=a.url)!=null&&x.includes("/glb")&&(a.responseType="blob"),a});try{const a=await o.api.motionGroupModels.getMotionGroupGlbModel(e);return URL.createObjectURL(a)}catch(a){throw console.error("Failed to fetch model:",a),a}})();return k.set(e,n),n}function le(e){function n(r){return r.children.length===0?[r]:[r,...r.children.flatMap(o=>n(o))]}return n(e).filter(r=>W(r))}function q(e){return e.name.endsWith("_FLG")}function W(e){return/_J[0-9]+$/.test(e.name)}function xe(e,n){let r;function o(s){if(q(s)){if(r)throw Error(`Found multiple flange groups in robot model ${n}; first ${r.name} then ${s.name}. Only one _FLG group is allowed.`);r=s}W(s),s.children.map(o)}if(o(e.scene),!r)throw Error(`No flange group found in robot model ${n}. Flange must be identified with a name ending in _FLG.`);return{gltf:e}}function H({rapidlyChangingMotionState:e,dhParameters:n,onRotationChanged:r,children:o}){const s=f.useRef([]),c=f.useRef([]),a=f.useRef(null),{invalidate:x}=I.useThree();f.useEffect(()=>{const u=e.joint_position.filter(l=>l!==void 0);return a.current=new g.ValueInterpolator(u,{tension:120,friction:20,threshold:.001}),()=>{var l;(l=a.current)==null||l.destroy()}},[]),I.useFrame((u,l)=>{if(a.current){const h=a.current.update(l);p(),h||x()}});function i(u){u&&(c.current=le(u),p(),x())}function p(){var l;const u=((l=a.current)==null?void 0:l.getCurrentValues())||[];if(r)r(c.current,u);else for(const[h,R]of c.current.entries()){const E=n[h],M=E.theta||0,v=E.reverse_rotation_direction?-1:1;R.rotation.y=v*(u[h]||0)+M}}const m=f.useCallback(()=>{const u=e.joint_position.filter(l=>l!==void 0);requestAnimationFrame(()=>{var l;s.current=u,(l=a.current)==null||l.setTarget(u)})},[e]);return f.useEffect(()=>{m()},[e,m]),g.useAutorun(()=>{m()}),t.jsxRuntimeExports.jsx("group",{ref:i,children:o})}const pe="line",me="mesh";function fe({rapidlyChangingMotionState:e,dhParameters:n,...r}){const o=new w.Matrix4,s=f.useRef([]),c=f.useRef([]);f.useEffect(()=>{s.current=new Array(n.length).fill(null),c.current=new Array(n.length).fill(null)},[n.length]);function a(p,m){const u=new w.Vector3,l=new w.Quaternion,h=new w.Vector3;o.decompose(u,l,h);const R=u.clone(),E=new w.Matrix4().makeRotationY(p.theta+m*(p.reverse_rotation_direction?-1:1)).multiply(new w.Matrix4().makeTranslation(0,p.d/1e3,0)).multiply(new w.Matrix4().makeTranslation(p.a/1e3,0,0)).multiply(new w.Matrix4().makeRotationX(p.alpha));return o.multiply(E),o.decompose(u,l,h),{a:R,b:u}}function x(p,m,u,l){if(!n)return;const h=n[p];if(!h)return;const{a:R,b:E}=a(h,l);m.geometry.setPositions([R.toArray(),E.toArray()].flat()),u.position.set(E.x,E.y,E.z)}function i(p,m){o.identity();for(let u=0;u<Math.min(p.length,m.length);u++){const l=s.current[u],h=c.current[u];l&&h&&x(u,l,h,m[u])}}return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(H,{rapidlyChangingMotionState:e,dhParameters:n,onRotationChanged:i,children:t.jsxRuntimeExports.jsxs("group",{...r,name:"Scene",children:[t.jsxRuntimeExports.jsxs("mesh",{children:[t.jsxRuntimeExports.jsx("sphereGeometry",{args:[.01,32,32]}),t.jsxRuntimeExports.jsx("meshStandardMaterial",{color:"black",depthTest:!0})]}),n.map((p,m)=>{const{a:u,b:l}=a(p,e.joint_position[m]??0),h=`dhrobot_J0${m}`;return t.jsxRuntimeExports.jsxs("group",{name:h,children:[t.jsxRuntimeExports.jsx(y.Line,{ref:R=>{s.current[m]=R},name:pe,points:[u,l],color:"white",lineWidth:5}),t.jsxRuntimeExports.jsxs("mesh",{ref:R=>{c.current[m]=R},name:me,position:l,children:[t.jsxRuntimeExports.jsx("sphereGeometry",{args:[.01,32,32]}),t.jsxRuntimeExports.jsx("meshStandardMaterial",{color:"black",depthTest:!0})]},"mesh_"+m)]},h)})]})})})}const de=console.warn;function he(){return f.useEffect(()=>{console.warn=e=>{e!=="Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"&&de(e)}},[]),t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{})}function je(e){return e.type==="Mesh"}function Re({url:e,flangeRef:n,postModelRender:r,...o}){const s=y.useGLTF(e);let c;try{c=xe(s,"robot.glb").gltf}catch(i){throw i}const a=f.useCallback(i=>{i&&r&&r()},[r]);function x(i){try{return je(i)?i.geometry?t.jsxRuntimeExports.jsx("mesh",{name:i.name,geometry:i.geometry,material:i.material,position:i.position,rotation:i.rotation},i.uuid):t.jsxRuntimeExports.jsx("group",{name:i.name,position:i.position,rotation:i.rotation},i.uuid):t.jsxRuntimeExports.jsx("group",{name:i.name,position:i.position,rotation:i.rotation,ref:q(i)?n:void 0,children:i.children.map(x)},i.uuid)}catch(p){return console.warn("Error rendering node",i.name,p),null}}return t.jsxRuntimeExports.jsx("group",{...o,dispose:null,ref:a,children:x(c.scene)})}function ge({modelURL:e,flangeRef:n,postModelRender:r,...o}){const[s,c]=f.useState(null);return f.useEffect(()=>{(async()=>{try{if(typeof e=="string")c(e);else{const x=await e;c(x)}}catch(x){console.error("Failed to resolve model URL:",x)}})()},[e]),s?t.jsxRuntimeExports.jsx(Re,{url:s,flangeRef:n,postModelRender:r,...o}):null}const ye=(e,n)=>{e.userData.isGhost||(e.traverse(r=>{if(r instanceof d.Mesh){r.material instanceof d.Material&&(r.material.colorWrite=!1);const o=r.clone(),s=r.clone();o.material=new d.MeshStandardMaterial({depthTest:!0,depthWrite:!0,colorWrite:!1,polygonOffset:!0,polygonOffsetFactor:-1,side:d.DoubleSide}),o.userData.isGhost=!0,s.material=new d.MeshStandardMaterial({color:n,opacity:.3,depthTest:!0,depthWrite:!1,transparent:!0,polygonOffset:!0,polygonOffsetFactor:-2,side:d.DoubleSide}),s.userData.isGhost=!0,r.parent&&(r.parent.add(o),r.parent.add(s))}}),e.userData.isGhost=!0)},Ee=e=>{if(!e.userData.isGhost)return;const n=[];e.traverse(r=>{var o;r instanceof d.Mesh&&((o=r.userData)!=null&&o.isGhost?n.push(r):r.material instanceof d.Material&&(r.material.colorWrite=!0))}),n.forEach(r=>{r.parent&&r.parent.remove(r)}),e.userData.isGhost=!1},N=t.externalizeComponent(({rapidlyChangingMotionState:e,modelFromController:n,dhParameters:r,getModel:o=D,flangeRef:s,postModelRender:c,transparentColor:a,...x})=>{const[i,p]=f.useState(null),m=f.useCallback(l=>{p(l)},[]);f.useEffect(()=>{i&&(a?ye(i,a):Ee(i))},[i,a]);const u=t.jsxRuntimeExports.jsx(fe,{rapidlyChangingMotionState:e,dhParameters:r,...x});return t.jsxRuntimeExports.jsxs(ee.ErrorBoundary,{fallback:u,onError:l=>{console.warn(l)},children:[t.jsxRuntimeExports.jsx(f.Suspense,{fallback:u,children:t.jsxRuntimeExports.jsx("group",{ref:m,children:t.jsxRuntimeExports.jsx(H,{rapidlyChangingMotionState:e,dhParameters:r,children:t.jsxRuntimeExports.jsx(ge,{modelURL:(()=>{const l=o(n);if(!l){const h=new Blob([],{type:"model/gltf-binary"}),R=new File([h],`${n}.glb`,{type:"model/gltf-binary"});return Promise.resolve(URL.createObjectURL(R))}return l})(),postModelRender:c,flangeRef:s,...x})})})}),t.jsxRuntimeExports.jsx(he,{})]})});function $({connectedMotionGroup:e,getModel:n=D,flangeRef:r,transparentColor:o,postModelRender:s,...c}){return e.dhParameters?t.jsxRuntimeExports.jsx(N,{rapidlyChangingMotionState:e.rapidlyChangingMotionState,modelFromController:e.modelFromController||"",dhParameters:e.dhParameters,getModel:n,flangeRef:r,transparentColor:o,postModelRender:s,...c}):null}const be=t.externalizeComponent(X.observer(({robotName:e,programState:n,safetyState:r,operationMode:o,driveToHomeEnabled:s=!1,onDriveToHomePress:c,onDriveToHomeRelease:a,connectedMotionGroup:x,robotComponent:i=$,customContentComponent:p,className:m})=>{var O;const u=j.useTheme(),{t:l}=Q.useTranslation(),[h,R]=f.useState(!1),E=f.useRef(null),M=f.useRef(null),[v,Y]=f.useState(!1),[_,K]=f.useState({width:400,height:600}),[ve,Z]=f.useState(0);f.useEffect(()=>{const L=()=>{if(M.current){const{offsetWidth:P,offsetHeight:z}=M.current;Y(P>z),K({width:P,height:z})}};L();const A=new ResizeObserver(L);return M.current&&A.observe(M.current),()=>{A.disconnect()}},[]);const V=f.useCallback(()=>{Z(L=>L+1)},[]),C=f.useCallback(()=>{!s||!c||(R(!0),c())},[s,c]),S=f.useCallback(()=>{!s||!a||(R(!1),a())},[s,a]),B=f.useCallback(()=>{h&&a&&(R(!1),a())},[h,a]),b=v?_.width<350:_.height<200,G=v?_.height<310:_.height<450;return t.jsxRuntimeExports.jsx(j.Card,{ref:M,className:m,sx:{width:"100%",height:"100%",display:"flex",flexDirection:v?"row":"column",position:"relative",overflow:"hidden",minWidth:{xs:180,sm:220,md:250},minHeight:v?{xs:200,sm:240,md:260}:{xs:150,sm:180,md:220},border:`1px solid ${u.palette.divider}`,borderRadius:"18px",boxShadow:"none",backgroundColor:((O=u.palette.backgroundPaperElevation)==null?void 0:O[8])||"#2A2A3F",backgroundImage:"none"},children:v?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(j.Box,{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:b?"none":"block"},children:!b&&t.jsxRuntimeExports.jsxs(I.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:[t.jsxRuntimeExports.jsx(F,{}),t.jsxRuntimeExports.jsx(y.Bounds,{fit:!0,observe:!0,margin:1,maxDuration:1,children:t.jsxRuntimeExports.jsx(i,{connectedMotionGroup:x,postModelRender:V})})]})}),t.jsxRuntimeExports.jsxs(j.Box,{sx:{flex:"1",display:"flex",flexDirection:"column",justifyContent:"flex-start",width:b?"100%":"50%"},children:[t.jsxRuntimeExports.jsxs(j.Box,{sx:{p:{xs:1.5,sm:2,md:3},pb:{xs:1,sm:1.5,md:2},textAlign:"left"},children:[t.jsxRuntimeExports.jsx(j.Typography,{variant:"h6",component:"h2",sx:{mb:1},children:e}),t.jsxRuntimeExports.jsx(g.ProgramStateIndicator,{programState:n,safetyState:r,operationMode:o})]}),t.jsxRuntimeExports.jsxs(j.Box,{sx:{p:{xs:1.5,sm:2,md:3},pt:0,flex:"1",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[!G&&p&&t.jsxRuntimeExports.jsxs(j.Box,{children:[t.jsxRuntimeExports.jsx(p,{}),t.jsxRuntimeExports.jsx(j.Divider,{sx:{mt:1,mb:0,borderColor:u.palette.divider,opacity:.5}})]}),t.jsxRuntimeExports.jsx(j.Box,{sx:{mt:!G&&p?"auto":0},children:t.jsxRuntimeExports.jsx(j.Box,{sx:{display:"flex",justifyContent:"flex-start",mt:{xs:1,sm:1.5,md:2},mb:{xs:.5,sm:.75,md:1}},children:t.jsxRuntimeExports.jsx(j.Button,{ref:E,variant:"contained",color:"secondary",size:"small",disabled:!s,onMouseDown:C,onMouseUp:S,onMouseLeave:B,onTouchStart:C,onTouchEnd:S,sx:{textTransform:"none",px:1.5,py:.5},children:l("RobotCard.DriveToHome.bt")})})})]})]})]}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(j.Box,{sx:{p:3,height:"100%",display:"flex",flexDirection:"column"},children:[t.jsxRuntimeExports.jsxs(j.Box,{children:[t.jsxRuntimeExports.jsx(j.Typography,{variant:"h6",component:"h2",sx:{mb:1},children:e}),t.jsxRuntimeExports.jsx(g.ProgramStateIndicator,{programState:n,safetyState:r,operationMode:o})]}),t.jsxRuntimeExports.jsx(j.Box,{sx:{flex:b?0:1,position:"relative",minHeight:b?0:{xs:120,sm:150,md:200},height:b?0:"auto",borderRadius:1,overflow:"hidden",display:b?"none":"block"},children:!b&&t.jsxRuntimeExports.jsxs(I.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:[t.jsxRuntimeExports.jsx(F,{}),t.jsxRuntimeExports.jsx(y.Bounds,{fit:!0,clip:!0,observe:!0,margin:1,maxDuration:1,children:t.jsxRuntimeExports.jsx(i,{connectedMotionGroup:x,postModelRender:V})})]})}),t.jsxRuntimeExports.jsxs(j.Box,{children:[!G&&p&&t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(p,{}),t.jsxRuntimeExports.jsx(j.Divider,{sx:{mt:1,mb:0,borderColor:u.palette.divider,opacity:.5}})]}),t.jsxRuntimeExports.jsx(j.Box,{sx:{display:"flex",justifyContent:"flex-start",mt:!G&&p?{xs:1,sm:2,md:5}:{xs:.5,sm:1,md:2},mb:{xs:.5,sm:.75,md:1}},children:t.jsxRuntimeExports.jsx(j.Button,{ref:E,variant:"contained",color:"secondary",size:"small",disabled:!s,onMouseDown:C,onMouseUp:S,onMouseLeave:B,onTouchStart:C,onTouchEnd:S,sx:{textTransform:"none",px:1.5,py:.5},children:l("RobotCard.DriveToHome.bt")})})]})]})})})})),we=Array(6).fill(2*Math.PI),T={[g.Manufacturer.Abb]:[0,0,0,0,Math.PI/2,0,0],[g.Manufacturer.Fanuc]:[0,0,0,0,-Math.PI/2,0,0],[g.Manufacturer.Yaskawa]:[0,0,0,0,-Math.PI/2,0,0],[g.Manufacturer.Kuka]:[0,-Math.PI/2,Math.PI/2,0,Math.PI/2,0,0],[g.Manufacturer.Universalrobots]:[0,-Math.PI/2,-Math.PI/2,-Math.PI/2,Math.PI/2,-Math.PI/2,0]};function J(e){const[n]=e.split("_");switch(n){case"ABB":return g.Manufacturer.Abb;case"FANUC":return g.Manufacturer.Fanuc;case"YASKAWA":return g.Manufacturer.Yaskawa;case"KUKA":return g.Manufacturer.Kuka;case"UniversalRobots":return g.Manufacturer.Universalrobots;default:return null}}function Me(e,n){const r=J(e);return r&&r in T?T[r]:n||null}exports.CollisionSceneRenderer=oe;exports.MANUFACTURER_HOME_CONFIGS=T;exports.PresetEnvironment=F;exports.Robot=$;exports.RobotCard=be;exports.SafetyZonesRenderer=ue;exports.SupportedRobot=N;exports.TrajectoryRenderer=ce;exports.defaultAxisConfig=we;exports.defaultGetModel=D;exports.extractManufacturer=J;exports.getDefaultHomeConfig=Me;
|
|
2
|
+
//# sourceMappingURL=manufacturerHomePositions-DRNjU1pU.cjs.map
|