@wandelbots/wandelbots-js-react-components 5.10.0 → 6.0.0-pr.motion-smoothing-config.624.f0bfa13
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 +8 -16
- package/dist/3d.cjs +1 -1
- package/dist/3d.d.ts +1 -0
- package/dist/3d.js +13 -10
- package/dist/SafetyBar/index.cjs +1 -1
- package/dist/SafetyBar/index.js +1 -1
- package/dist/chunks/MotionGroupVisualizer-Cdruoxq4.cjs +1 -0
- package/dist/chunks/{MotionGroupVisualizer-BRec-k-p.js → MotionGroupVisualizer-DqUGHRK7.js} +445 -444
- package/dist/chunks/SafetyBar-Cy9DiXp9.js +453 -0
- package/dist/chunks/SafetyBar-DPrv_OQA.cjs +1 -0
- package/dist/chunks/{interpolation-DG8VTxzS.js → interpolation-jnKIUiIm.js} +5 -5
- package/dist/chunks/{theming-D4Vvwf6q.js → theming-AUvtT-C3.js} +948 -919
- package/dist/chunks/theming-BwZXb5-H.cjs +4 -0
- package/dist/components/robots/LinearAxisAnimator.d.ts +9 -1
- package/dist/components/robots/RobotAnimator.d.ts +8 -0
- package/dist/components/robots/SupportedLinearAxis.d.ts +9 -1
- package/dist/components/robots/SupportedRobot.d.ts +9 -1
- package/dist/components/utils/interpolation.d.ts +32 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +60 -85
- package/package.json +1 -6
- package/dist/SafetyBar/icons/index.d.ts +0 -10
- package/dist/chunks/MotionGroupVisualizer-zDM0Lgd-.cjs +0 -1
- package/dist/chunks/SafetyBar-CxxIVVeR.js +0 -413
- package/dist/chunks/SafetyBar-VvOZ9aRM.cjs +0 -1
- package/dist/chunks/robot-Cy9ST5-m.js +0 -40
- package/dist/chunks/robot-SEtfVAmf.cjs +0 -1
- package/dist/chunks/safety-state-stop-CJW5CKkp.js +0 -55
- package/dist/chunks/safety-state-stop-CgPfwC18.cjs +0 -1
- package/dist/chunks/theming-DL6p0QAr.cjs +0 -4
- package/dist/chunks/wbLogo-CObCmqTw.js +0 -30
- package/dist/chunks/wbLogo-G_IfZ03l.cjs +0 -1
- package/dist/wb-icons.cjs +0 -1
- package/dist/wb-icons.d.ts +0 -2
- package/dist/wb-icons.js +0 -27
package/README.md
CHANGED
|
@@ -33,37 +33,33 @@ For 3D-enabled components, use `/3d`:
|
|
|
33
33
|
import { Robot, RobotCard } from "@wandelbots/wandelbots-js-react-components/3d"
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
For
|
|
36
|
+
For icons, use the dedicated [`@wandelbots/icons`](https://www.npmjs.com/package/@wandelbots/icons) package (the `/wb-icons` entry point has been removed). Each icon is imported from its own subpath — there is no bulk export:
|
|
37
37
|
|
|
38
38
|
```typescript
|
|
39
|
-
import {
|
|
40
|
-
|
|
41
|
-
HomeIcon,
|
|
42
|
-
ControllerTypeVirtualIcon,
|
|
43
|
-
SafetyStateNormalIcon,
|
|
44
|
-
} from "@wandelbots/wandelbots-js-react-components/wb-icons"
|
|
39
|
+
import { Home } from "@wandelbots/icons/Home"
|
|
40
|
+
import { Robot } from "@wandelbots/icons/Robot"
|
|
45
41
|
```
|
|
46
42
|
|
|
43
|
+
Browse the full icon set at https://wandelbotsgmbh.github.io/nova-design-system/#icons
|
|
44
|
+
|
|
47
45
|
You can also import from the top-level package, but then you'll need to provide all optional dependencies:
|
|
48
46
|
|
|
49
47
|
```bash
|
|
50
48
|
pnpm add @wandelbots/wandelbots-js-react-components \
|
|
51
49
|
react react-dom \
|
|
52
50
|
@mui/material @mui/icons-material @emotion/react @emotion/styled \
|
|
53
|
-
three @react-three/fiber @react-three/drei three-stdlib
|
|
54
|
-
@monaco-editor/react shiki @shikijs/monaco
|
|
51
|
+
three @react-three/fiber @react-three/drei three-stdlib
|
|
55
52
|
```
|
|
56
53
|
|
|
57
54
|
**Available Entry Points:**
|
|
58
55
|
|
|
59
56
|
- **`.`** (Main) — All components. Requires: React 18+, MUI v6/v7, @emotion/react, @emotion/styled, @mui/icons-material + all below.
|
|
60
57
|
- **`/core`** — Base components (AppHeader, ProgramControl, SafetyBar, VelocitySlider, JoggingPanel, DataGrid, Timer, themes, i18n, etc.). Requires: React 18+, MUI v6/v7, @emotion/react, @emotion/styled, @mui/icons-material.
|
|
61
|
-
- **`/wb-icons`** — SVG icon components (general UI icons, safety bar icons, jogging icons, axis icons). Requires: React 18+.
|
|
62
58
|
- **`/3d`** — 3D visualization (Robot, RobotCard, CollisionSceneRenderer, SafetyZonesRenderer, TrajectoryRenderer). Requires: all from `/core` + three, @react-three/fiber, @react-three/drei, three-stdlib.
|
|
63
59
|
|
|
64
|
-
##
|
|
60
|
+
## Migration & Breaking Changes
|
|
65
61
|
|
|
66
|
-
|
|
62
|
+
Breaking changes for each major version are documented in the [GitHub Releases](https://github.com/wandelbotsgmbh/wandelbots-js-react-components/releases).
|
|
67
63
|
|
|
68
64
|
## 4.x Core Changes
|
|
69
65
|
|
|
@@ -87,10 +83,6 @@ interface DHParameter {
|
|
|
87
83
|
}
|
|
88
84
|
```
|
|
89
85
|
|
|
90
|
-
## 2.x to 3.x Migration Guide
|
|
91
|
-
|
|
92
|
-
See section in [Migration Guide](https://wandelbotsgmbh.github.io/wandelbots-js-react-components/?path=/docs/migration-guide--docs) for assistance.
|
|
93
|
-
|
|
94
86
|
## Components
|
|
95
87
|
|
|
96
88
|
### Robot Control & Jogging
|
package/dist/3d.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/MotionGroupVisualizer-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/MotionGroupVisualizer-Cdruoxq4.cjs"),o=require("./chunks/interpolation-C9sLsved.cjs");exports.CollisionSceneRenderer=e.CollisionSceneRenderer;exports.LinearAxis=e.LinearAxis;exports.MANUFACTURER_HOME_CONFIGS=e.MANUFACTURER_HOME_CONFIGS;exports.MotionGroupVisualizer=e.MotionGroupVisualizer;exports.PresetEnvironment=e.PresetEnvironment;exports.Robot=e.Robot;exports.RobotCard=e.RobotCard;exports.SafetyZonesRenderer=e.SafetyZonesRenderer;exports.SupportedLinearAxis=e.SupportedLinearAxis;exports.SupportedRobot=e.SupportedRobot;exports.TrajectoryRenderer=e.TrajectoryRenderer;exports.defaultAxisConfig=e.defaultAxisConfig;exports.defaultGetModel=e.defaultGetModel;exports.extractManufacturer=e.extractManufacturer;exports.getDefaultHomeConfig=e.getDefaultHomeConfig;exports.ValueInterpolator=o.ValueInterpolator;exports.useInterpolation=o.useInterpolation;
|
package/dist/3d.d.ts
CHANGED
|
@@ -11,3 +11,4 @@ export { defaultGetModel } from "./components/robots/robotModelLogic";
|
|
|
11
11
|
export * from "./components/robots/SupportedLinearAxis";
|
|
12
12
|
export * from "./components/robots/SupportedRobot";
|
|
13
13
|
export * from "./components/robots/MotionGroupVisualizer";
|
|
14
|
+
export * from "./components/utils/interpolation";
|
package/dist/3d.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { C as o, L as r, M as s, h as t, P as n, b as i, R as
|
|
1
|
+
import { C as o, L as r, M as s, h as t, P as n, b as i, R as u, S as d, c as f, f as l, T as p, a as R, d as C, e as x, g as M } from "./chunks/MotionGroupVisualizer-DqUGHRK7.js";
|
|
2
|
+
import { V as c, u as A } from "./chunks/interpolation-jnKIUiIm.js";
|
|
2
3
|
export {
|
|
3
4
|
o as CollisionSceneRenderer,
|
|
4
5
|
r as LinearAxis,
|
|
@@ -6,13 +7,15 @@ export {
|
|
|
6
7
|
t as MotionGroupVisualizer,
|
|
7
8
|
n as PresetEnvironment,
|
|
8
9
|
i as Robot,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
u as RobotCard,
|
|
11
|
+
d as SafetyZonesRenderer,
|
|
12
|
+
f as SupportedLinearAxis,
|
|
13
|
+
l as SupportedRobot,
|
|
14
|
+
p as TrajectoryRenderer,
|
|
15
|
+
c as ValueInterpolator,
|
|
16
|
+
R as defaultAxisConfig,
|
|
17
|
+
C as defaultGetModel,
|
|
18
|
+
x as extractManufacturer,
|
|
19
|
+
M as getDefaultHomeConfig,
|
|
20
|
+
A as useInterpolation
|
|
18
21
|
};
|
package/dist/SafetyBar/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/SafetyBar-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/SafetyBar-DPrv_OQA.cjs");exports.SafetyBar=e.SafetyBar;exports.default=e.SafetyBar;
|
package/dist/SafetyBar/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),b=require("three"),J=require("three-stdlib"),u=require("react"),L=require("./externalizeComponent-OO4jcrz5.cjs"),S=require("@react-three/drei"),he=require("@mui/material/styles"),_=require("@mui/material/Box"),Z=require("@mui/material/Button"),me=require("@mui/material/Card"),K=require("@mui/material/Divider"),z=require("@mui/material/Typography"),k=require("@react-three/fiber"),xe=require("mobx-react-lite"),ye=require("react-i18next"),I=require("./interpolation-C9sLsved.cjs"),M=require("@wandelbots/nova-js/v2"),te=require("react-error-boundary");function ge(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 w=ge(b);function je(e){switch(e.shape_type){case"convex_hull":return new J.ConvexGeometry(e.vertices.map(r=>new w.Vector3(r[0]/1e3,r[1]/1e3,r[2]/1e3)));case"box":return new w.BoxGeometry(e.size_x/1e3,e.size_y/1e3,e.size_z/1e3);case"sphere":return new w.SphereGeometry(e.radius/1e3);case"capsule":return new w.CapsuleGeometry(e.radius/1e3,e.cylinder_height/1e3);case"cylinder":return new w.CylinderGeometry(e.radius/1e3,e.radius/1e3,e.height/1e3);case"rectangle":return new w.BoxGeometry(e.size_x/1e3,e.size_y/1e3,0);default:return console.warn(`${e.shape_type} is not supported`),new w.BufferGeometry}}function be({name:e,collider:n,children:r}){var d,l;const o=((d=n.pose)==null?void 0:d.position)??[0,0,0],a=((l=n.pose)==null?void 0:l.orientation)??[0,0,0];return n.margin&&console.warn(`${e} margin is not supported`),t.jsx("mesh",{name:e,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:e,colliders:n,meshChildrenProvider:r,...o}){return t.jsx("group",{name:e,...o,children:Object.entries(n).map(([a,d])=>t.jsx(be,{name:a,collider:d,children:r(a,d)},a))})}function Re({scene:e,meshChildrenProvider:n}){const r=e.colliders;return t.jsx("group",{children:r&&t.jsx(we,{meshChildrenProvider:n,colliders:r})})}function U(){return t.jsx(S.Environment,{frames:1,children:t.jsx(ve,{})})}const Me=[2,0,2,0,2,0,2,0];function ve({positions:e=Me}){return t.jsxs(t.Fragment,{children:[t.jsx(S.Lightformer,{intensity:5,"rotation-x":Math.PI/2,position:[0,5,-9],scale:[10,10,1]}),t.jsx("group",{rotation:[0,.5,0],children:t.jsx("group",{children:e.map((n,r)=>t.jsx(S.Lightformer,{form:"circle",intensity:5,rotation:[Math.PI/2,0,0],position:[n,4,r*4],scale:[3,1,1]},r))})}),t.jsx(S.Lightformer,{intensity:40,"rotation-y":Math.PI/2,position:[-5,1,-1],scale:[20,.1,1]}),t.jsx(S.Lightformer,{intensity:20,"rotation-y":-Math.PI,position:[-5,-2,-1],scale:[20,.1,1]}),t.jsx(S.Lightformer,{"rotation-y":Math.PI/2,position:[-5,-1,-1],scale:[20,.5,1],intensity:5}),t.jsx(S.Lightformer,{"rotation-y":-Math.PI/2,position:[10,1,0],scale:[20,1,1],intensity:10}),t.jsx(S.Lightformer,{form:"ring",color:"white",intensity:5,scale:10,position:[-15,4,-18],target:[0,0,0]})]})}const ee={attach:"material",color:"#009f4d",opacity:.2,depthTest:!1,depthWrite:!1,transparent:!0,polygonOffset:!0};function Se({safetyZones:e,dhParameters:n,...r}){const o=u.useMemo(()=>L.dhParametersToPlaneSize(n??[]),[n]),a=(l,s)=>{var g,m;if(!((g=s==null?void 0:s.pose)!=null&&g.position)||!((m=s==null?void 0:s.pose)!=null&&m.orientation))return null;const y=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 p;const h=s.shape.shape_type==="plane"?{...ee,side:w.DoubleSide}:{...ee,side:w.FrontSide};switch(s.shape.shape_type){case"plane":p=t.jsx("planeGeometry",{args:[o,o]});break;case"sphere":{const c=(s==null?void 0:s.shape).radius/1e3;p=t.jsx("sphereGeometry",{args:[c]});break}case"capsule":{const c=(s==null?void 0:s.shape).radius/1e3,f=(s==null?void 0:s.shape).cylinder_height/1e3;p=t.jsx("capsuleGeometry",{args:[c,f]});break}case"convex_hull":{const c=(s==null?void 0:s.shape).vertices.map(j=>new w.Vector3(j[0]/1e3,j[1]/1e3,j[2]/1e3)),f=L.verticesToCoplanarity(c);if(f.isCoplanar&&f.normal){const x=new w.Vector3().addVectors(c[0],f.normal.multiplyScalar(1e-4));c.push(x)}try{p=t.jsx("primitive",{object:new J.ConvexGeometry(c),attach:"geometry"})}catch(j){return console.log("Error creating ConvexGeometry:",j),null}break}case"rectangular_capsule":{const c=s.shape,f=c.radius/1e3,j=c.sphere_center_distance_x/1e3,x=c.sphere_center_distance_y/1e3,R=f*2;p=t.jsx("primitive",{object:new J.RoundedBoxGeometry(j,x,R,2,f),attach:"geometry"});break}default:console.warn("Unsupported safety zone shape type:",s.shape.shape_type),p=null}return t.jsxs("mesh",{renderOrder:l,position:y,quaternion:L.orientationToQuaternion(i),children:[p,t.jsx("meshStandardMaterial",{...h,polygonOffsetFactor:-l})]},`safety-zone-${s.shape.shape_type}-${l}`)},d=u.useMemo(()=>Object.values(e??{}).map((l,s)=>a(s,l)),[e,o]);return t.jsx("group",{...r,children:d})}function _e({trajectory:e,...n}){const r=(e==null?void 0:e.map(o=>{if(o.position&&o.position.length>=3){const[a,d,l]=o.position;if(Number.isFinite(a)&&Number.isFinite(d)&&Number.isFinite(l))return new w.Vector3(a/1e3,l/1e3,-d/1e3)}return null}).filter(o=>o!==null))||[];return t.jsx("group",{...n,children:r.length>0&&t.jsx(S.Line,{points:r,lineWidth:3,polygonOffset:!0,polygonOffsetFactor:10,polygonOffsetUnits:10})})}const q=new Map;async function E(e,n){if(q.has(e))return q.get(e);const r=(async()=>{var l;const o=n||"",a=new M.Nova({instanceUrl:o}),d=a.api.motionGroupModels;(l=d.axios)!=null&&l.interceptors&&d.axios.interceptors.request.use(s=>{var y;return(y=s.url)!=null&&y.includes("/glb")&&(s.responseType="blob"),s});try{const s=await a.api.motionGroupModels.getMotionGroupGlbModel(e);return URL.createObjectURL(s)}catch(s){throw console.error("Failed to fetch model:",s),s}})();return q.set(e,r),r}function re(e){function n(r){return r.children.length===0?[r]:[r,...r.children.flatMap(o=>n(o))]}return n(e).filter(r=>se(r))}function ne(e){return e.name.endsWith("_FLG")}function se(e){return/_J[0-9]+$/.test(e.name)}function Te(e,n){let r;function o(a){if(ne(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}se(a),a.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}}const Le=e=>new I.ValueInterpolator(e),oe=u.forwardRef(function({rapidlyChangingMotionState:n,dhParameters:r,onRotationChanged:o,createInterpolator:a=Le,children:d},l){const s=u.useRef(null),y=u.useRef([]),i=u.useRef(null),{invalidate:p}=k.useThree(),h=u.useRef(n);h.current=n;const g=u.useRef(a);u.useEffect(()=>{const x=n.joint_position.filter(R=>R!==void 0);return i.current=g.current(x),()=>{var R,v;(v=(R=i.current)==null?void 0:R.destroy)==null||v.call(R)}},[]),k.useFrame((x,R)=>{if(!i.current)return;y.current.length===0&&s.current&&c();const v=i.current.update(R);f(),v||p()});function m(x){s.current=x,x&&c()}function c(){s.current&&(y.current=re(s.current),f(),p())}u.useImperativeHandle(l,()=>({recollectJoints:c}));function f(){var R;const x=((R=i.current)==null?void 0:R.getCurrentValues())||[];if(o)o(y.current,x);else for(const[v,C]of y.current.entries()){const O=r[v],D=O.theta||0,G=O.reverse_rotation_direction?-1:1;C.rotation.y=G*(x[v]||0)+D}}function j(x){var v;const R=x.joint_position.filter(C=>C!==void 0);(v=i.current)==null||v.setTarget(R),p()}return I.useAutorun(()=>{j(h.current)}),u.useEffect(()=>{j(n)},[n]),t.jsx("group",{ref:m,children:d})}),ke="line",Ie="mesh";function Ce({rapidlyChangingMotionState:e,dhParameters:n,...r}){const o=new b.Matrix4,a=u.useRef([]),d=u.useRef([]);u.useEffect(()=>{a.current=new Array(n.length).fill(null),d.current=new Array(n.length).fill(null)},[n.length]);function l(i,p){const h=new b.Vector3,g=new b.Quaternion,m=new b.Vector3;o.decompose(h,g,m);const c=h.clone(),f=new b.Matrix4().makeRotationY(i.theta+p*(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(h,g,m),{a:c,b:h}}function s(i,p,h,g){if(!n)return;const m=n[i];if(!m)return;const{a:c,b:f}=l(m,g);p.geometry.setPositions([c.toArray(),f.toArray()].flat()),h.position.set(f.x,f.y,f.z)}function y(i,p){o.identity();for(let h=0;h<Math.min(i.length,p.length);h++){const g=a.current[h],m=d.current[h];g&&m&&s(h,g,m,p[h])}}return t.jsx(oe,{rapidlyChangingMotionState:e,dhParameters:n,onRotationChanged:y,children:t.jsxs("group",{...r,name:"Scene",children:[t.jsxs("mesh",{children:[t.jsx("sphereGeometry",{args:[.01,32,32]}),t.jsx("meshStandardMaterial",{color:"black",depthTest:!0})]}),n==null?void 0:n.map((i,p)=>{const{a:h,b:g}=l(i,e.joint_position[p]??0),m=`dhrobot_J0${p}`;return t.jsxs("group",{name:m,children:[t.jsx(S.Line,{ref:c=>{a.current[p]=c},name:ke,points:[h,g],color:"white",lineWidth:5}),t.jsxs("mesh",{ref:c=>{d.current[p]=c},name:Ie,position:g,children:[t.jsx("sphereGeometry",{args:[.01,32,32]}),t.jsx("meshStandardMaterial",{color:"black",depthTest:!0})]},`mesh_${p}`)]},m)})]})})}const Ee=console.warn;function ie(){return u.useEffect(()=>{console.warn=e=>{e!=="Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"&&Ee(e)}},[]),null}function Ge(e){return e.type==="Mesh"}function Ae({url:e,flangeRef:n,postModelRender:r,...o}){const a=S.useGLTF(e),l=Te(a,"robot.glb").gltf,s=u.useCallback(i=>{i&&r&&r()},[r]);function y(i){try{return Ge(i)?i.geometry?t.jsx("mesh",{name:i.name,geometry:i.geometry,material:i.material,position:i.position,rotation:i.rotation},i.uuid):t.jsx("group",{name:i.name,position:i.position,rotation:i.rotation},i.uuid):t.jsx("group",{name:i.name,position:i.position,rotation:i.rotation,ref:ne(i)?n:void 0,children:i.children.map(y)},i.uuid)}catch(p){return console.warn("Error rendering node",i.name,p),null}}return t.jsx("group",{...o,dispose:null,ref:s,children:y(l.scene)})}function ae({modelURL:e,flangeRef:n,postModelRender:r,...o}){const[a,d]=u.useState(null);return u.useEffect(()=>{let l=!1;return(async()=>{try{const y=typeof e=="string"?e:await e;l||d(i=>i===y?i:y)}catch(y){console.error("Failed to resolve model URL:",y)}})(),()=>{l=!0}},[e]),a?t.jsx(Ae,{url:a,flangeRef:n,postModelRender:r,...o}):null}const ce=(e,n)=>{e.userData.isGhost||(e.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))}}),e.userData.isGhost=!0)},ue=e=>{if(!e.userData.isGhost)return;const n=[];e.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)}),e.userData.isGhost=!1},N=L.externalizeComponent(({rapidlyChangingMotionState:e,modelFromController:n,dhParameters:r,getModel:o=E,flangeRef:a,postModelRender:d,transparentColor:l,instanceUrl:s,createInterpolator:y,...i})=>{const[p,h]=u.useState(null),g=u.useRef(null),m=u.useCallback(x=>{h(x)},[]),c=u.useCallback(()=>{var x;(x=g.current)==null||x.recollectJoints(),d==null||d()},[d]);u.useEffect(()=>{p&&(l?ce(p,l):ue(p))},[p,l]);const f=u.useMemo(()=>{const x=o(n,s);if(!x)throw new Error(`No model found for robot "${n}". Ensure the model is available or provide a custom getModel function.`);return x},[n,s,o]),j=t.jsx(Ce,{rapidlyChangingMotionState:e,dhParameters:r,...i});return t.jsxs(te.ErrorBoundary,{fallback:j,onError:x=>{console.warn(x)},children:[t.jsx(u.Suspense,{fallback:j,children:t.jsx("group",{ref:m,children:t.jsx(oe,{ref:g,rapidlyChangingMotionState:e,dhParameters:r,createInterpolator:y,children:t.jsx(ae,{modelURL:f,postModelRender:c,flangeRef:a,...i})})})}),t.jsx(ie,{})]})});function le({connectedMotionGroup:e,getModel:n=E,flangeRef:r,transparentColor:o,postModelRender:a,...d}){return e.dhParameters?t.jsx(N,{rapidlyChangingMotionState:e.rapidlyChangingMotionState,modelFromController:e.modelFromController||"",dhParameters:e.dhParameters,getModel:n,flangeRef:r,transparentColor:o,postModelRender:a,...d}):null}const Pe=L.externalizeComponent(xe.observer(({robotName:e,programState:n,safetyState:r,operationMode:o,driveToHomeEnabled:a=!1,onDriveToHomePress:d,onDriveToHomeRelease:l,connectedMotionGroup:s,robotComponent:y=le,customContentComponent:i,className:p})=>{var H;const h=he.useTheme(),{t:g}=ye.useTranslation(),[m,c]=u.useState(!1),f=u.useRef(null),j=u.useRef(null),[x,R]=u.useState(!1),[v,C]=u.useState({width:400,height:600}),[O,D]=u.useState(0);u.useEffect(()=>{const V=()=>{if(j.current){const{offsetWidth:Q,offsetHeight:X}=j.current;R(Q>X),C({width:Q,height:X})}};V();const Y=new ResizeObserver(V);return j.current&&Y.observe(j.current),()=>{Y.disconnect()}},[]);const G=u.useCallback(()=>{D(V=>V+1)},[]),A=u.useCallback(()=>{!a||!d||(c(!0),d())},[a,d]),P=u.useCallback(()=>{!a||!l||(c(!1),l())},[a,l]),$=u.useCallback(()=>{m&&l&&(c(!1),l())},[m,l]),T=x?v.width<350:v.height<200,F=x?v.height<310:v.height<450;return t.jsx(me,{ref:j,className:p,sx:{width:"100%",height:"100%",display:"flex",flexDirection:x?"row":"column",position:"relative",overflow:"hidden",minWidth:{xs:180,sm:220,md:250},minHeight:x?{xs:200,sm:240,md:260}:{xs:150,sm:180,md:220},border:`1px solid ${h.palette.divider}`,borderRadius:"18px",boxShadow:"none",backgroundColor:((H=h.palette.backgroundPaperElevation)==null?void 0:H[8])||"#292B3F",backgroundImage:"none"},children:x?t.jsxs(t.Fragment,{children:[t.jsx(_,{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:T?"none":"block"},children:!T&&t.jsxs(k.Canvas,{orthographic:!0,camera:{position:[3,2,3],zoom:1},shadows:!0,frameloop:"demand",style:{borderRadius:h.shape.borderRadius,width:"100%",height:"100%",background:"transparent",position:"absolute",top:0,left:0},dpr:[1,2],gl:{alpha:!0,antialias:!0},children:[t.jsx(U,{}),t.jsx(S.Bounds,{fit:!0,observe:!0,margin:1,maxDuration:1,children:t.jsx(y,{connectedMotionGroup:s,postModelRender:G})})]})}),t.jsxs(_,{sx:{flex:"1",display:"flex",flexDirection:"column",justifyContent:"flex-start",width:T?"100%":"50%"},children:[t.jsxs(_,{sx:{p:{xs:1.5,sm:2,md:3},pb:{xs:1,sm:1.5,md:2},textAlign:"left"},children:[t.jsx(z,{variant:"h6",component:"h2",sx:{mb:1},children:e}),t.jsx(I.ProgramStateIndicator,{programState:n,safetyState:r,operationMode:o})]}),t.jsxs(_,{sx:{p:{xs:1.5,sm:2,md:3},pt:0,flex:"1",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[!F&&i&&t.jsxs(_,{children:[t.jsx(i,{}),t.jsx(K,{sx:{mt:1,mb:0,borderColor:h.palette.divider,opacity:.5}})]}),t.jsx(_,{sx:{mt:!F&&i?"auto":0},children:t.jsx(_,{sx:{display:"flex",justifyContent:"flex-start",mt:{xs:1,sm:1.5,md:2},mb:{xs:.5,sm:.75,md:1}},children:t.jsx(Z,{ref:f,variant:"contained",color:"secondary",size:"small",disabled:!a,onMouseDown:A,onMouseUp:P,onMouseLeave:$,onTouchStart:A,onTouchEnd:P,sx:{textTransform:"none",px:1.5,py:.5},children:g("RobotCard.DriveToHome.bt")})})})]})]})]}):t.jsx(t.Fragment,{children:t.jsxs(_,{sx:{p:3,height:"100%",display:"flex",flexDirection:"column"},children:[t.jsxs(_,{children:[t.jsx(z,{variant:"h6",component:"h2",sx:{mb:1},children:e}),t.jsx(I.ProgramStateIndicator,{programState:n,safetyState:r,operationMode:o})]}),t.jsx(_,{sx:{flex:T?0:1,position:"relative",minHeight:T?0:{xs:120,sm:150,md:200},height:T?0:"auto",borderRadius:1,overflow:"hidden",display:T?"none":"block"},children:!T&&t.jsxs(k.Canvas,{orthographic:!0,camera:{position:[3,2,3],zoom:1},shadows:!0,frameloop:"demand",style:{borderRadius:h.shape.borderRadius,width:"100%",height:"100%",background:"transparent",position:"absolute"},dpr:[1,2],gl:{alpha:!0,antialias:!0},children:[t.jsx(U,{}),t.jsx(S.Bounds,{fit:!0,clip:!0,observe:!0,margin:1,maxDuration:1,children:t.jsx(y,{connectedMotionGroup:s,postModelRender:G})})]})}),t.jsxs(_,{children:[!F&&i&&t.jsxs(t.Fragment,{children:[t.jsx(i,{}),t.jsx(K,{sx:{mt:1,mb:0,borderColor:h.palette.divider,opacity:.5}})]}),t.jsx(_,{sx:{display:"flex",justifyContent:"flex-start",mt:!F&&i?{xs:1,sm:2,md:5}:{xs:.5,sm:1,md:2},mb:{xs:.5,sm:.75,md:1}},children:t.jsx(Z,{ref:f,variant:"contained",color:"secondary",size:"small",disabled:!a,onMouseDown:A,onMouseUp:P,onMouseLeave:$,onTouchStart:A,onTouchEnd:P,sx:{textTransform:"none",px:1.5,py:.5},children:g("RobotCard.DriveToHome.bt")})})]})]})})})})),Fe=Array(6).fill(2*Math.PI),Ve=e=>new I.ValueInterpolator(e);function fe({rapidlyChangingMotionState:e,dhParameters:n,onTranslationChanged:r,createInterpolator:o=Ve,children:a}){const d=u.useRef([]),l=u.useRef([]),s=u.useRef(null),{invalidate:y}=k.useThree(),i=u.useRef(o);u.useEffect(()=>{const m=e.joint_position.filter(c=>c!==void 0);return s.current=i.current(m),()=>{var c,f;(f=(c=s.current)==null?void 0:c.destroy)==null||f.call(c)}},[]),k.useFrame((m,c)=>{if(s.current){const f=s.current.update(c);h(),f||y()}});function p(m){m&&(l.current=re(m),h(),y())}function h(){var c;const m=((c=s.current)==null?void 0:c.getCurrentValues())||[];if(r)r(l.current,m);else for(const[f,j]of l.current.entries()){const R=n[f].reverse_rotation_direction?-1:1;j.position.y=R*(m[f]||0)/1e3}}const g=u.useCallback(()=>{const m=e.joint_position.filter(c=>c!==void 0);requestAnimationFrame(()=>{var c;d.current=m,(c=s.current)==null||c.setTarget(m)})},[e]);return u.useEffect(()=>{g()},[e,g]),I.useAutorun(()=>{g()}),t.jsx("group",{ref:p,children:a})}function de({rapidlyChangingMotionState:e,dhParameters:n,...r}){const o=new b.Matrix4,a=u.useRef(null),d=u.useRef(null);function l(i){const p=new b.Matrix4;for(let c=0;c<n.length;c++){const f=n[c],j=i[c]??0,x=new b.Matrix4().makeRotationY(f.theta).multiply(new b.Matrix4().makeTranslation(f.a/1e3,(f.d+j*(f.reverse_rotation_direction?-1:1))/1e3,0)).multiply(new b.Matrix4().makeRotationX(f.alpha));p.multiply(x)}const h=new b.Vector3,g=new b.Quaternion,m=new b.Vector3;return p.decompose(h,g,m),h}const s=l(e.joint_position);function y(i,p){o.identity();let h=new b.Vector3;for(let f=0;f<n.length;f++){const j=p[f]??0,x=n[f],R=new b.Matrix4().makeRotationY(x.theta).multiply(new b.Matrix4().makeTranslation(x.a/1e3,(x.d+j*(x.reverse_rotation_direction?-1:1))/1e3,0)).multiply(new b.Matrix4().makeRotationX(x.alpha));o.multiply(R)}const g=new b.Vector3,m=new b.Quaternion,c=new b.Vector3;if(o.decompose(g,m,c),h=g,a.current&&a.current.position.set(h.x,h.y,h.z),d.current){const f=d.current.geometry;f!=null&&f.setPositions&&f.setPositions([0,0,0,h.x,h.y,h.z])}}return t.jsx(fe,{rapidlyChangingMotionState:e,dhParameters:n,onTranslationChanged:y,children:t.jsxs("group",{...r,name:"Scene",children:[t.jsxs("mesh",{name:"Base",position:[0,0,0],children:[t.jsx("sphereGeometry",{args:[.02,32,32]}),t.jsx("meshStandardMaterial",{color:"green",depthTest:!0})]}),t.jsx(S.Line,{ref:d,points:[new b.Vector3(0,0,0),s],color:"White",lineWidth:5}),t.jsxs("mesh",{ref:a,name:"TCP",position:s,children:[t.jsx("sphereGeometry",{args:[.025,32,32]}),t.jsx("meshStandardMaterial",{color:"red",depthTest:!0})]})]})})}const W=L.externalizeComponent(({rapidlyChangingMotionState:e,modelFromController:n,dhParameters:r,getModel:o=E,flangeRef:a,postModelRender:d,transparentColor:l,instanceUrl:s,createInterpolator:y,...i})=>{const[p,h]=u.useState(null),g=u.useCallback(c=>{h(c)},[]);u.useEffect(()=>{p&&(l?ce(p,l):ue(p))},[p,l]);const m=t.jsx(de,{rapidlyChangingMotionState:e,dhParameters:r,...i});return t.jsxs(te.ErrorBoundary,{fallback:m,onError:c=>{console.warn(c)},children:[t.jsx(u.Suspense,{fallback:m,children:t.jsx("group",{ref:g,children:t.jsx(fe,{rapidlyChangingMotionState:e,dhParameters:r,createInterpolator:y,children:t.jsx(ae,{modelURL:(()=>{const c=o(n,s);if(!c){const f=new Blob([],{type:"model/gltf-binary"}),j=new File([f],`${n}.glb`,{type:"model/gltf-binary"});return Promise.resolve(URL.createObjectURL(j))}return c})(),postModelRender:d,flangeRef:a,...i})})})}),t.jsx(ie,{})]})});function Oe({connectedMotionGroup:e,getModel:n=E,flangeRef:r,transparentColor:o,postModelRender:a,...d}){if(!e.dhParameters)return null;const l=e.modelFromController||"";return l&&n(l)?t.jsx(W,{rapidlyChangingMotionState:e.rapidlyChangingMotionState,modelFromController:l,dhParameters:e.dhParameters,getModel:n,flangeRef:r,transparentColor:o,postModelRender:a,...d}):t.jsx(de,{rapidlyChangingMotionState:e.rapidlyChangingMotionState,dhParameters:e.dhParameters,...d})}const B={[M.Manufacturer.Abb]:[0,0,0,0,Math.PI/2,0,0],[M.Manufacturer.Fanuc]:[0,0,0,0,-Math.PI/2,0,0],[M.Manufacturer.Yaskawa]:[0,0,0,0,-Math.PI/2,0,0],[M.Manufacturer.Kuka]:[0,-Math.PI/2,Math.PI/2,0,Math.PI/2,0,0],[M.Manufacturer.Universalrobots]:[0,-Math.PI/2,-Math.PI/2,-Math.PI/2,Math.PI/2,-Math.PI/2,0],[M.Manufacturer.Staubli]:[0,-Math.PI/2,Math.PI/2,0,0,0,0]};function pe(e){const[n]=e.split("_");switch(n){case"ABB":return M.Manufacturer.Abb;case"FANUC":return M.Manufacturer.Fanuc;case"YASKAWA":return M.Manufacturer.Yaskawa;case"KUKA":return M.Manufacturer.Kuka;case"UniversalRobots":return M.Manufacturer.Universalrobots;case"STAUBLI":return M.Manufacturer.Staubli;default:return null}}function De(e,n){const r=pe(e);return r&&r in B?B[r]:n||null}const qe=L.externalizeComponent(e=>{const{inverseSolver:n,dhParameters:r,...o}=e,[a,d]=u.useState(M.JointTypeEnum.RevoluteJoint);u.useEffect(()=>{r.length&&d(r[0].type??M.JointTypeEnum.RevoluteJoint)},[r]);const l=u.useMemo(()=>n===null&&a===M.JointTypeEnum.RevoluteJoint,[n,a]),s=u.useMemo(()=>n===null&&a===M.JointTypeEnum.PrismaticJoint,[n,a]);return u.useMemo(()=>!!n,[n])||l?t.jsx(N,{dhParameters:r,...o}):s?t.jsx(W,{dhParameters:r,...o}):null});exports.CollisionSceneRenderer=Re;exports.LinearAxis=Oe;exports.MANUFACTURER_HOME_CONFIGS=B;exports.MotionGroupVisualizer=qe;exports.PresetEnvironment=U;exports.Robot=le;exports.RobotCard=Pe;exports.SafetyZonesRenderer=Se;exports.SupportedLinearAxis=W;exports.SupportedRobot=N;exports.TrajectoryRenderer=_e;exports.defaultAxisConfig=Fe;exports.defaultGetModel=E;exports.extractManufacturer=pe;exports.getDefaultHomeConfig=De;
|