@wandelbots/wandelbots-js-react-components 5.5.5-pr.feat-RB-3582-limits-from-api.605.66e875e → 5.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/3d.cjs +1 -1
- package/dist/3d.js +1 -1
- package/dist/SafetyBar/index.cjs +1 -1
- package/dist/SafetyBar/index.js +1 -1
- package/dist/chunks/{MotionGroupVisualizer-BA7MMr0D.js → MotionGroupVisualizer-BXDggjVD.js} +2 -2
- package/dist/chunks/{MotionGroupVisualizer-CitUaicN.cjs → MotionGroupVisualizer-EN8Nw5xP.cjs} +1 -1
- package/dist/chunks/{SafetyBar-CCnreqqV.js → SafetyBar-C8whliAf.js} +1 -1
- package/dist/chunks/{SafetyBar-BJDym6Qa.cjs → SafetyBar-CLm3UQRA.cjs} +1 -1
- package/dist/chunks/{externalizeComponent-C0uo1MS5.cjs → externalizeComponent-BHZdH14U.cjs} +2 -2
- package/dist/chunks/{externalizeComponent-C-PcuvQd.js → externalizeComponent-D6S3WLFc.js} +15 -23
- package/dist/chunks/{interpolation-d6gm3wgz.cjs → interpolation-B84QX33C.cjs} +1 -1
- package/dist/chunks/{interpolation-wc5fVisY.js → interpolation-D9WFd-j_.js} +1 -1
- package/dist/chunks/theming-CxOImT4p.cjs +4 -0
- package/dist/chunks/{theming-Ba2fo-Ez.js → theming-iMsXEbX7.js} +1045 -1119
- package/dist/components/jogging/JoggingStore.d.ts +8 -32
- package/dist/components/jogging/JoggingVelocitySlider.d.ts +1 -2
- package/dist/core.cjs +1 -1
- package/dist/core.js +4 -4
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/package.json +1 -1
- package/dist/chunks/theming-B2zxZyTN.cjs +0 -4
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-EN8Nw5xP.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;
|
package/dist/3d.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as o, L as r, M as s, h as t, P as n, b as i, R as d, S as f, c as u, f as R, T as l, a as C, d as p, e as M, g as S } from "./chunks/MotionGroupVisualizer-
|
|
1
|
+
import { C as o, L as r, M as s, h as t, P as n, b as i, R as d, S as f, c as u, f as R, T as l, a as C, d as p, e as M, g as S } from "./chunks/MotionGroupVisualizer-BXDggjVD.js";
|
|
2
2
|
export {
|
|
3
3
|
o as CollisionSceneRenderer,
|
|
4
4
|
r as LinearAxis,
|
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-CLm3UQRA.cjs");exports.SafetyBar=e.SafetyBar;exports.default=e.SafetyBar;
|
package/dist/SafetyBar/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as g from "three";
|
|
|
3
3
|
import { Matrix4 as R, Vector3 as k, Quaternion as W } from "three";
|
|
4
4
|
import { ConvexGeometry as se, RoundedBoxGeometry as ke } from "three-stdlib";
|
|
5
5
|
import Ge, { useMemo as I, useRef as M, useEffect as T, useState as G, useCallback as L, Suspense as ae } from "react";
|
|
6
|
-
import { d as Le, v as Ae, o as Ie, e as J } from "./externalizeComponent-
|
|
6
|
+
import { d as Le, v as Ae, o as Ie, e as J } from "./externalizeComponent-D6S3WLFc.js";
|
|
7
7
|
import { Environment as Pe, Lightformer as A, Line as $, useGLTF as Fe, Bounds as Z } from "@react-three/drei";
|
|
8
8
|
import { useTheme as De } from "@mui/material/styles";
|
|
9
9
|
import v from "@mui/material/Box";
|
|
@@ -14,7 +14,7 @@ import ee from "@mui/material/Typography";
|
|
|
14
14
|
import { useThree as le, useFrame as ce, Canvas as te } from "@react-three/fiber";
|
|
15
15
|
import { observer as Ve } from "mobx-react-lite";
|
|
16
16
|
import { useTranslation as Ee } from "react-i18next";
|
|
17
|
-
import { V as ue, c as fe, b as re } from "./interpolation-
|
|
17
|
+
import { V as ue, c as fe, b as re } from "./interpolation-D9WFd-j_.js";
|
|
18
18
|
import { NovaClient as Ce, Manufacturer as _, JointTypeEnum as C } from "@wandelbots/nova-js/v2";
|
|
19
19
|
import { ErrorBoundary as pe } from "react-error-boundary";
|
|
20
20
|
function Ue(e) {
|
package/dist/chunks/{MotionGroupVisualizer-CitUaicN.cjs → MotionGroupVisualizer-EN8Nw5xP.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("react/jsx-runtime"),g=require("three"),V=require("three-stdlib"),d=require("react"),S=require("./externalizeComponent-C0uo1MS5.cjs"),M=require("@react-three/drei"),pe=require("@mui/material/styles"),v=require("@mui/material/Box"),Y=require("@mui/material/Button"),he=require("@mui/material/Card"),Q=require("@mui/material/Divider"),X=require("@mui/material/Typography"),T=require("@react-three/fiber"),me=require("mobx-react-lite"),xe=require("react-i18next"),L=require("./interpolation-d6gm3wgz.cjs"),R=require("@wandelbots/nova-js/v2"),K=require("react-error-boundary");function ye(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 j=ye(g);function ge(e){switch(e.shape_type){case"convex_hull":return new V.ConvexGeometry(e.vertices.map(r=>new j.Vector3(r[0]/1e3,r[1]/1e3,r[2]/1e3)));case"box":return new j.BoxGeometry(e.size_x/1e3,e.size_y/1e3,e.size_z/1e3);case"sphere":return new j.SphereGeometry(e.radius/1e3);case"capsule":return new j.CapsuleGeometry(e.radius/1e3,e.cylinder_height/1e3);case"cylinder":return new j.CylinderGeometry(e.radius/1e3,e.radius/1e3,e.height/1e3);case"rectangle":return new j.BoxGeometry(e.size_x/1e3,e.size_y/1e3,0);default:return console.warn(`${e.shape_type} is not supported`),new j.BufferGeometry}}function je({name:e,collider:n,children:r}){var f,u;const o=((f=n.pose)==null?void 0:f.position)??[0,0,0],i=((u=n.pose)==null?void 0:u.orientation)??[0,0,0];return n.margin&&console.warn(`${e} margin is not supported`),t.jsx("mesh",{name:e,position:new j.Vector3(o[0],o[1],o[2]).divideScalar(1e3),rotation:new j.Euler(i[0],i[1],i[2],"XYZ"),geometry:ge(n.shape),children:r})}function be({name:e,colliders:n,meshChildrenProvider:r,...o}){return t.jsx("group",{name:e,...o,children:Object.entries(n).map(([i,f])=>t.jsx(je,{name:i,collider:f,children:r(i,f)},i))})}function we({scene:e,meshChildrenProvider:n}){const r=e.colliders;return t.jsx("group",{children:r&&t.jsx(be,{meshChildrenProvider:n,colliders:r})})}function O(){return t.jsx(M.Environment,{frames:1,children:t.jsx(Me,{})})}const Re=[2,0,2,0,2,0,2,0];function Me({positions:e=Re}){return t.jsxs(t.Fragment,{children:[t.jsx(M.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(M.Lightformer,{form:"circle",intensity:5,rotation:[Math.PI/2,0,0],position:[n,4,r*4],scale:[3,1,1]},r))})}),t.jsx(M.Lightformer,{intensity:40,"rotation-y":Math.PI/2,position:[-5,1,-1],scale:[20,.1,1]}),t.jsx(M.Lightformer,{intensity:20,"rotation-y":-Math.PI,position:[-5,-2,-1],scale:[20,.1,1]}),t.jsx(M.Lightformer,{"rotation-y":Math.PI/2,position:[-5,-1,-1],scale:[20,.5,1],intensity:5}),t.jsx(M.Lightformer,{"rotation-y":-Math.PI/2,position:[10,1,0],scale:[20,1,1],intensity:10}),t.jsx(M.Lightformer,{form:"ring",color:"white",intensity:5,scale:10,position:[-15,4,-18],target:[0,0,0]})]})}const Z={attach:"material",color:"#009f4d",opacity:.2,depthTest:!1,depthWrite:!1,transparent:!0,polygonOffset:!0};function ve({safetyZones:e,dhParameters:n,...r}){const o=d.useMemo(()=>S.dhParametersToPlaneSize(n??[]),[n]),i=(u,s)=>{var l,h;if(!((l=s==null?void 0:s.pose)!=null&&l.position)||!((h=s==null?void 0:s.pose)!=null&&h.orientation))return null;const y=new j.Vector3(s.pose.position[0]/1e3,s.pose.position[1]/1e3,s.pose.position[2]/1e3),a=new j.Vector3(s.pose.orientation[0],s.pose.orientation[1],s.pose.orientation[2]);let m;const c=s.shape.shape_type==="plane"?{...Z,side:j.DoubleSide}:{...Z,side:j.FrontSide};switch(s.shape.shape_type){case"plane":m=t.jsx("planeGeometry",{args:[o,o]});break;case"sphere":{const p=(s==null?void 0:s.shape).radius/1e3;m=t.jsx("sphereGeometry",{args:[p]});break}case"capsule":{const p=(s==null?void 0:s.shape).radius/1e3,x=(s==null?void 0:s.shape).cylinder_height/1e3;m=t.jsx("capsuleGeometry",{args:[p,x]});break}case"convex_hull":{const p=(s==null?void 0:s.shape).vertices.map(b=>new j.Vector3(b[0]/1e3,b[1]/1e3,b[2]/1e3)),x=S.verticesToCoplanarity(p);if(x.isCoplanar&&x.normal){const w=new j.Vector3().addVectors(p[0],x.normal.multiplyScalar(1e-4));p.push(w)}try{m=t.jsx("primitive",{object:new V.ConvexGeometry(p),attach:"geometry"})}catch(b){return console.log("Error creating ConvexGeometry:",b),null}break}case"rectangular_capsule":{const p=s.shape,x=p.radius/1e3,b=p.sphere_center_distance_x/1e3,w=p.sphere_center_distance_y/1e3,k=x*2;m=t.jsx("primitive",{object:new V.RoundedBoxGeometry(b,w,k,2,x),attach:"geometry"});break}default:console.warn("Unsupported safety zone shape type:",s.shape.shape_type),m=null}return t.jsxs("mesh",{renderOrder:u,position:y,quaternion:S.orientationToQuaternion(a),children:[m,t.jsx("meshStandardMaterial",{...c,polygonOffsetFactor:-u})]},`safety-zone-${s.shape.shape_type}-${u}`)},f=d.useMemo(()=>Object.values(e??{}).map((u,s)=>i(s,u)),[e,o]);return t.jsx("group",{...r,children:f})}function _e({trajectory:e,...n}){const r=(e==null?void 0:e.map(o=>{if(o.position&&o.position.length>=3){const[i,f,u]=o.position;if(Number.isFinite(i)&&Number.isFinite(f)&&Number.isFinite(u))return new j.Vector3(i/1e3,u/1e3,-f/1e3)}return null}).filter(o=>o!==null))||[];return t.jsx("group",{...n,children:r.length>0&&t.jsx(M.Line,{points:r,lineWidth:3,polygonOffset:!0,polygonOffsetFactor:10,polygonOffsetUnits:10})})}const P=new Map;async function E(e,n){if(P.has(e))return P.get(e);const r=(async()=>{var u;const o=n||"",i=new R.NovaClient({instanceUrl:o}),f=i.api.motionGroupModels;(u=f.axios)!=null&&u.interceptors&&f.axios.interceptors.request.use(s=>{var y;return(y=s.url)!=null&&y.includes("/glb")&&(s.responseType="blob"),s});try{const s=await i.api.motionGroupModels.getMotionGroupGlbModel(e);return URL.createObjectURL(s)}catch(s){throw console.error("Failed to fetch model:",s),s}})();return P.set(e,r),r}function z(e){function n(r){return r.children.length===0?[r]:[r,...r.children.flatMap(o=>n(o))]}return n(e).filter(r=>te(r))}function ee(e){return e.name.endsWith("_FLG")}function te(e){return/_J[0-9]+$/.test(e.name)}function Se(e,n){let r;function o(i){if(ee(i)){if(r)throw Error(`Found multiple flange groups in robot model ${n}; first ${r.name} then ${i.name}. Only one _FLG group is allowed.`);r=i}te(i),i.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 re({rapidlyChangingMotionState:e,dhParameters:n,onRotationChanged:r,children:o}){const i=d.useRef([]),f=d.useRef(null),{invalidate:u}=T.useThree(),s=d.useRef(e);s.current=e,d.useEffect(()=>{const c=e.joint_position.filter(l=>l!==void 0);return f.current=new L.ValueInterpolator(c,{tension:120,friction:20,threshold:.001}),()=>{var l;(l=f.current)==null||l.destroy()}},[]),T.useFrame((c,l)=>{if(f.current){const h=f.current.update(l);a(),h||u()}});function y(c){c&&(i.current=z(c),a(),u())}function a(){var l;const c=((l=f.current)==null?void 0:l.getCurrentValues())||[];if(r)r(i.current,c);else for(const[h,p]of i.current.entries()){const x=n[h],b=x.theta||0,w=x.reverse_rotation_direction?-1:1;p.rotation.y=w*(c[h]||0)+b}}function m(c){var h;const l=c.joint_position.filter(p=>p!==void 0);(h=f.current)==null||h.setTarget(l),u()}return L.useAutorun(()=>{m(s.current)}),d.useEffect(()=>{m(e)},[e]),t.jsx("group",{ref:y,children:o})}const Te="line",Le="mesh";function ke({rapidlyChangingMotionState:e,dhParameters:n,...r}){const o=new g.Matrix4,i=d.useRef([]),f=d.useRef([]);d.useEffect(()=>{i.current=new Array(n.length).fill(null),f.current=new Array(n.length).fill(null)},[n.length]);function u(a,m){const c=new g.Vector3,l=new g.Quaternion,h=new g.Vector3;o.decompose(c,l,h);const p=c.clone(),x=new g.Matrix4().makeRotationY(a.theta+m*(a.reverse_rotation_direction?-1:1)).multiply(new g.Matrix4().makeTranslation(0,a.d/1e3,0)).multiply(new g.Matrix4().makeTranslation(a.a/1e3,0,0)).multiply(new g.Matrix4().makeRotationX(a.alpha));return o.multiply(x),o.decompose(c,l,h),{a:p,b:c}}function s(a,m,c,l){if(!n)return;const h=n[a];if(!h)return;const{a:p,b:x}=u(h,l);m.geometry.setPositions([p.toArray(),x.toArray()].flat()),c.position.set(x.x,x.y,x.z)}function y(a,m){o.identity();for(let c=0;c<Math.min(a.length,m.length);c++){const l=i.current[c],h=f.current[c];l&&h&&s(c,l,h,m[c])}}return t.jsx(re,{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((a,m)=>{const{a:c,b:l}=u(a,e.joint_position[m]??0),h=`dhrobot_J0${m}`;return t.jsxs("group",{name:h,children:[t.jsx(M.Line,{ref:p=>{i.current[m]=p},name:Te,points:[c,l],color:"white",lineWidth:5}),t.jsxs("mesh",{ref:p=>{f.current[m]=p},name:Le,position:l,children:[t.jsx("sphereGeometry",{args:[.01,32,32]}),t.jsx("meshStandardMaterial",{color:"black",depthTest:!0})]},`mesh_${m}`)]},h)})]})})}const Ee=console.warn;function ne(){return d.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 Ce({url:e,flangeRef:n,postModelRender:r,...o}){const i=M.useGLTF(e),u=Se(i,"robot.glb").gltf,s=d.useCallback(a=>{a&&r&&r()},[r]);function y(a){try{return Ge(a)?a.geometry?t.jsx("mesh",{name:a.name,geometry:a.geometry,material:a.material,position:a.position,rotation:a.rotation},a.uuid):t.jsx("group",{name:a.name,position:a.position,rotation:a.rotation},a.uuid):t.jsx("group",{name:a.name,position:a.position,rotation:a.rotation,ref:ee(a)?n:void 0,children:a.children.map(y)},a.uuid)}catch(m){return console.warn("Error rendering node",a.name,m),null}}return t.jsx("group",{...o,dispose:null,ref:s,children:y(u.scene)})}function se({modelURL:e,flangeRef:n,postModelRender:r,...o}){const[i,f]=d.useState(null);return d.useEffect(()=>{let u=!1;return(async()=>{try{const y=typeof e=="string"?e:await e;u||f(a=>a===y?a:y)}catch(y){console.error("Failed to resolve model URL:",y)}})(),()=>{u=!0}},[e]),i?t.jsx(Ce,{url:i,flangeRef:n,postModelRender:r,...o}):null}const oe=(e,n)=>{e.userData.isGhost||(e.traverse(r=>{if(r instanceof j.Mesh){r.material instanceof j.Material&&(r.material.colorWrite=!1);const o=r.clone(),i=r.clone();o.material=new j.MeshStandardMaterial({depthTest:!0,depthWrite:!0,colorWrite:!1,polygonOffset:!0,polygonOffsetFactor:-1,side:j.DoubleSide}),o.userData.isGhost=!0,i.material=new j.MeshStandardMaterial({color:n,opacity:.3,depthTest:!0,depthWrite:!1,transparent:!0,polygonOffset:!0,polygonOffsetFactor:-2,side:j.DoubleSide}),i.userData.isGhost=!0,r.parent&&(r.parent.add(o),r.parent.add(i))}}),e.userData.isGhost=!0)},ie=e=>{if(!e.userData.isGhost)return;const n=[];e.traverse(r=>{var o;r instanceof j.Mesh&&((o=r.userData)!=null&&o.isGhost?n.push(r):r.material instanceof j.Material&&(r.material.colorWrite=!0))}),n.forEach(r=>{r.parent&&r.parent.remove(r)}),e.userData.isGhost=!1},q=S.externalizeComponent(({rapidlyChangingMotionState:e,modelFromController:n,dhParameters:r,getModel:o=E,flangeRef:i,postModelRender:f,transparentColor:u,instanceUrl:s,...y})=>{const[a,m]=d.useState(null),c=d.useCallback(p=>{m(p)},[]);d.useEffect(()=>{a&&(u?oe(a,u):ie(a))},[a,u]);const l=d.useMemo(()=>{const p=o(n,s);if(!p)throw new Error(`No model found for robot "${n}". Ensure the model is available or provide a custom getModel function.`);return p},[n,s,o]),h=t.jsx(ke,{rapidlyChangingMotionState:e,dhParameters:r,...y});return t.jsxs(K.ErrorBoundary,{fallback:h,onError:p=>{console.warn(p)},children:[t.jsx(d.Suspense,{fallback:h,children:t.jsx("group",{ref:c,children:t.jsx(re,{rapidlyChangingMotionState:e,dhParameters:r,children:t.jsx(se,{modelURL:l,postModelRender:f,flangeRef:i,...y})})})}),t.jsx(ne,{})]})});function ae({connectedMotionGroup:e,getModel:n=E,flangeRef:r,transparentColor:o,postModelRender:i,...f}){return e.dhParameters?t.jsx(q,{rapidlyChangingMotionState:e.rapidlyChangingMotionState,modelFromController:e.modelFromController||"",dhParameters:e.dhParameters,getModel:n,flangeRef:r,transparentColor:o,postModelRender:i,...f}):null}const Ae=S.externalizeComponent(me.observer(({robotName:e,programState:n,safetyState:r,operationMode:o,driveToHomeEnabled:i=!1,onDriveToHomePress:f,onDriveToHomeRelease:u,connectedMotionGroup:s,robotComponent:y=ae,customContentComponent:a,className:m})=>{var N;const c=pe.useTheme(),{t:l}=xe.useTranslation(),[h,p]=d.useState(!1),x=d.useRef(null),b=d.useRef(null),[w,k]=d.useState(!1),[G,fe]=d.useState({width:400,height:600}),[Oe,de]=d.useState(0);d.useEffect(()=>{const F=()=>{if(b.current){const{offsetWidth:$,offsetHeight:H}=b.current;k($>H),fe({width:$,height:H})}};F();const W=new ResizeObserver(F);return b.current&&W.observe(b.current),()=>{W.disconnect()}},[]);const J=d.useCallback(()=>{de(F=>F+1)},[]),C=d.useCallback(()=>{!i||!f||(p(!0),f())},[i,f]),A=d.useCallback(()=>{!i||!u||(p(!1),u())},[i,u]),B=d.useCallback(()=>{h&&u&&(p(!1),u())},[h,u]),_=w?G.width<350:G.height<200,I=w?G.height<310:G.height<450;return t.jsx(he,{ref:b,className:m,sx:{width:"100%",height:"100%",display:"flex",flexDirection:w?"row":"column",position:"relative",overflow:"hidden",minWidth:{xs:180,sm:220,md:250},minHeight:w?{xs:200,sm:240,md:260}:{xs:150,sm:180,md:220},border:`1px solid ${c.palette.divider}`,borderRadius:"18px",boxShadow:"none",backgroundColor:((N=c.palette.backgroundPaperElevation)==null?void 0:N[8])||"#2A2A3F",backgroundImage:"none"},children:w?t.jsxs(t.Fragment,{children:[t.jsx(v,{sx:{flex:"0 0 50%",position:"relative",height:"100%",minHeight:"100%",maxHeight:"100%",borderRadius:1,m:{xs:1.5,sm:2,md:3},mr:{xs:.75,sm:1,md:1.5},overflow:"hidden",display:_?"none":"block"},children:!_&&t.jsxs(T.Canvas,{orthographic:!0,camera:{position:[3,2,3],zoom:1},shadows:!0,frameloop:"demand",style:{borderRadius:c.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(O,{}),t.jsx(M.Bounds,{fit:!0,observe:!0,margin:1,maxDuration:1,children:t.jsx(y,{connectedMotionGroup:s,postModelRender:J})})]})}),t.jsxs(v,{sx:{flex:"1",display:"flex",flexDirection:"column",justifyContent:"flex-start",width:_?"100%":"50%"},children:[t.jsxs(v,{sx:{p:{xs:1.5,sm:2,md:3},pb:{xs:1,sm:1.5,md:2},textAlign:"left"},children:[t.jsx(X,{variant:"h6",component:"h2",sx:{mb:1},children:e}),t.jsx(L.ProgramStateIndicator,{programState:n,safetyState:r,operationMode:o})]}),t.jsxs(v,{sx:{p:{xs:1.5,sm:2,md:3},pt:0,flex:"1",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[!I&&a&&t.jsxs(v,{children:[t.jsx(a,{}),t.jsx(Q,{sx:{mt:1,mb:0,borderColor:c.palette.divider,opacity:.5}})]}),t.jsx(v,{sx:{mt:!I&&a?"auto":0},children:t.jsx(v,{sx:{display:"flex",justifyContent:"flex-start",mt:{xs:1,sm:1.5,md:2},mb:{xs:.5,sm:.75,md:1}},children:t.jsx(Y,{ref:x,variant:"contained",color:"secondary",size:"small",disabled:!i,onMouseDown:C,onMouseUp:A,onMouseLeave:B,onTouchStart:C,onTouchEnd:A,sx:{textTransform:"none",px:1.5,py:.5},children:l("RobotCard.DriveToHome.bt")})})})]})]})]}):t.jsx(t.Fragment,{children:t.jsxs(v,{sx:{p:3,height:"100%",display:"flex",flexDirection:"column"},children:[t.jsxs(v,{children:[t.jsx(X,{variant:"h6",component:"h2",sx:{mb:1},children:e}),t.jsx(L.ProgramStateIndicator,{programState:n,safetyState:r,operationMode:o})]}),t.jsx(v,{sx:{flex:_?0:1,position:"relative",minHeight:_?0:{xs:120,sm:150,md:200},height:_?0:"auto",borderRadius:1,overflow:"hidden",display:_?"none":"block"},children:!_&&t.jsxs(T.Canvas,{orthographic:!0,camera:{position:[3,2,3],zoom:1},shadows:!0,frameloop:"demand",style:{borderRadius:c.shape.borderRadius,width:"100%",height:"100%",background:"transparent",position:"absolute"},dpr:[1,2],gl:{alpha:!0,antialias:!0},children:[t.jsx(O,{}),t.jsx(M.Bounds,{fit:!0,clip:!0,observe:!0,margin:1,maxDuration:1,children:t.jsx(y,{connectedMotionGroup:s,postModelRender:J})})]})}),t.jsxs(v,{children:[!I&&a&&t.jsxs(t.Fragment,{children:[t.jsx(a,{}),t.jsx(Q,{sx:{mt:1,mb:0,borderColor:c.palette.divider,opacity:.5}})]}),t.jsx(v,{sx:{display:"flex",justifyContent:"flex-start",mt:!I&&a?{xs:1,sm:2,md:5}:{xs:.5,sm:1,md:2},mb:{xs:.5,sm:.75,md:1}},children:t.jsx(Y,{ref:x,variant:"contained",color:"secondary",size:"small",disabled:!i,onMouseDown:C,onMouseUp:A,onMouseLeave:B,onTouchStart:C,onTouchEnd:A,sx:{textTransform:"none",px:1.5,py:.5},children:l("RobotCard.DriveToHome.bt")})})]})]})})})})),Ie=Array(6).fill(2*Math.PI);function ce({rapidlyChangingMotionState:e,dhParameters:n,onTranslationChanged:r,children:o}){const i=d.useRef([]),f=d.useRef([]),u=d.useRef(null),{invalidate:s}=T.useThree();d.useEffect(()=>{const c=e.joint_position.filter(l=>l!==void 0);return u.current=new L.ValueInterpolator(c,{tension:120,friction:20,threshold:.001}),()=>{var l;(l=u.current)==null||l.destroy()}},[]),T.useFrame((c,l)=>{if(u.current){const h=u.current.update(l);a(),h||s()}});function y(c){c&&(f.current=z(c),a(),s())}function a(){var l;const c=((l=u.current)==null?void 0:l.getCurrentValues())||[];if(r)r(f.current,c);else for(const[h,p]of f.current.entries()){const b=n[h].reverse_rotation_direction?-1:1;p.position.y=b*(c[h]||0)/1e3}}const m=d.useCallback(()=>{const c=e.joint_position.filter(l=>l!==void 0);requestAnimationFrame(()=>{var l;i.current=c,(l=u.current)==null||l.setTarget(c)})},[e]);return d.useEffect(()=>{m()},[e,m]),L.useAutorun(()=>{m()}),t.jsx("group",{ref:y,children:o})}function ue({rapidlyChangingMotionState:e,dhParameters:n,...r}){const o=new g.Matrix4,i=d.useRef(null),f=d.useRef(null);function u(a){const m=new g.Matrix4;for(let p=0;p<n.length;p++){const x=n[p],b=a[p]??0,w=new g.Matrix4().makeRotationY(x.theta).multiply(new g.Matrix4().makeTranslation(x.a/1e3,(x.d+b*(x.reverse_rotation_direction?-1:1))/1e3,0)).multiply(new g.Matrix4().makeRotationX(x.alpha));m.multiply(w)}const c=new g.Vector3,l=new g.Quaternion,h=new g.Vector3;return m.decompose(c,l,h),c}const s=u(e.joint_position);function y(a,m){o.identity();let c=new g.Vector3;for(let x=0;x<n.length;x++){const b=m[x]??0,w=n[x],k=new g.Matrix4().makeRotationY(w.theta).multiply(new g.Matrix4().makeTranslation(w.a/1e3,(w.d+b*(w.reverse_rotation_direction?-1:1))/1e3,0)).multiply(new g.Matrix4().makeRotationX(w.alpha));o.multiply(k)}const l=new g.Vector3,h=new g.Quaternion,p=new g.Vector3;if(o.decompose(l,h,p),c=l,i.current&&i.current.position.set(c.x,c.y,c.z),f.current){const x=f.current.geometry;x!=null&&x.setPositions&&x.setPositions([0,0,0,c.x,c.y,c.z])}}return t.jsx(ce,{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(M.Line,{ref:f,points:[new g.Vector3(0,0,0),s],color:"White",lineWidth:5}),t.jsxs("mesh",{ref:i,name:"TCP",position:s,children:[t.jsx("sphereGeometry",{args:[.025,32,32]}),t.jsx("meshStandardMaterial",{color:"red",depthTest:!0})]})]})})}const U=S.externalizeComponent(({rapidlyChangingMotionState:e,modelFromController:n,dhParameters:r,getModel:o=E,flangeRef:i,postModelRender:f,transparentColor:u,instanceUrl:s,...y})=>{const[a,m]=d.useState(null),c=d.useCallback(h=>{m(h)},[]);d.useEffect(()=>{a&&(u?oe(a,u):ie(a))},[a,u]);const l=t.jsx(ue,{rapidlyChangingMotionState:e,dhParameters:r,...y});return t.jsxs(K.ErrorBoundary,{fallback:l,onError:h=>{console.warn(h)},children:[t.jsx(d.Suspense,{fallback:l,children:t.jsx("group",{ref:c,children:t.jsx(ce,{rapidlyChangingMotionState:e,dhParameters:r,children:t.jsx(se,{modelURL:(()=>{const h=o(n,s);if(!h){const p=new Blob([],{type:"model/gltf-binary"}),x=new File([p],`${n}.glb`,{type:"model/gltf-binary"});return Promise.resolve(URL.createObjectURL(x))}return h})(),postModelRender:f,flangeRef:i,...y})})})}),t.jsx(ne,{})]})});function Fe({connectedMotionGroup:e,getModel:n=E,flangeRef:r,transparentColor:o,postModelRender:i,...f}){if(!e.dhParameters)return null;const u=e.modelFromController||"";return u&&n(u)?t.jsx(U,{rapidlyChangingMotionState:e.rapidlyChangingMotionState,modelFromController:u,dhParameters:e.dhParameters,getModel:n,flangeRef:r,transparentColor:o,postModelRender:i,...f}):t.jsx(ue,{rapidlyChangingMotionState:e.rapidlyChangingMotionState,dhParameters:e.dhParameters,...f})}const D={[R.Manufacturer.Abb]:[0,0,0,0,Math.PI/2,0,0],[R.Manufacturer.Fanuc]:[0,0,0,0,-Math.PI/2,0,0],[R.Manufacturer.Yaskawa]:[0,0,0,0,-Math.PI/2,0,0],[R.Manufacturer.Kuka]:[0,-Math.PI/2,Math.PI/2,0,Math.PI/2,0,0],[R.Manufacturer.Universalrobots]:[0,-Math.PI/2,-Math.PI/2,-Math.PI/2,Math.PI/2,-Math.PI/2,0]};function le(e){const[n]=e.split("_");switch(n){case"ABB":return R.Manufacturer.Abb;case"FANUC":return R.Manufacturer.Fanuc;case"YASKAWA":return R.Manufacturer.Yaskawa;case"KUKA":return R.Manufacturer.Kuka;case"UniversalRobots":return R.Manufacturer.Universalrobots;default:return null}}function Pe(e,n){const r=le(e);return r&&r in D?D[r]:n||null}const Ve=S.externalizeComponent(e=>{const{inverseSolver:n,dhParameters:r,...o}=e,[i,f]=d.useState(R.JointTypeEnum.RevoluteJoint);d.useEffect(()=>{r.length&&f(r[0].type??R.JointTypeEnum.RevoluteJoint)},[r]);const u=d.useMemo(()=>n===null&&i===R.JointTypeEnum.RevoluteJoint,[n,i]),s=d.useMemo(()=>n===null&&i===R.JointTypeEnum.PrismaticJoint,[n,i]);return d.useMemo(()=>!!n,[n])||u?t.jsx(q,{dhParameters:r,...o}):s?t.jsx(U,{dhParameters:r,...o}):null});exports.CollisionSceneRenderer=we;exports.LinearAxis=Fe;exports.MANUFACTURER_HOME_CONFIGS=D;exports.MotionGroupVisualizer=Ve;exports.PresetEnvironment=O;exports.Robot=ae;exports.RobotCard=Ae;exports.SafetyZonesRenderer=ve;exports.SupportedLinearAxis=U;exports.SupportedRobot=q;exports.TrajectoryRenderer=_e;exports.defaultAxisConfig=Ie;exports.defaultGetModel=E;exports.extractManufacturer=le;exports.getDefaultHomeConfig=Pe;
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),g=require("three"),V=require("three-stdlib"),d=require("react"),S=require("./externalizeComponent-BHZdH14U.cjs"),M=require("@react-three/drei"),pe=require("@mui/material/styles"),v=require("@mui/material/Box"),Y=require("@mui/material/Button"),he=require("@mui/material/Card"),Q=require("@mui/material/Divider"),X=require("@mui/material/Typography"),T=require("@react-three/fiber"),me=require("mobx-react-lite"),xe=require("react-i18next"),L=require("./interpolation-B84QX33C.cjs"),R=require("@wandelbots/nova-js/v2"),K=require("react-error-boundary");function ye(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 j=ye(g);function ge(e){switch(e.shape_type){case"convex_hull":return new V.ConvexGeometry(e.vertices.map(r=>new j.Vector3(r[0]/1e3,r[1]/1e3,r[2]/1e3)));case"box":return new j.BoxGeometry(e.size_x/1e3,e.size_y/1e3,e.size_z/1e3);case"sphere":return new j.SphereGeometry(e.radius/1e3);case"capsule":return new j.CapsuleGeometry(e.radius/1e3,e.cylinder_height/1e3);case"cylinder":return new j.CylinderGeometry(e.radius/1e3,e.radius/1e3,e.height/1e3);case"rectangle":return new j.BoxGeometry(e.size_x/1e3,e.size_y/1e3,0);default:return console.warn(`${e.shape_type} is not supported`),new j.BufferGeometry}}function je({name:e,collider:n,children:r}){var f,u;const o=((f=n.pose)==null?void 0:f.position)??[0,0,0],i=((u=n.pose)==null?void 0:u.orientation)??[0,0,0];return n.margin&&console.warn(`${e} margin is not supported`),t.jsx("mesh",{name:e,position:new j.Vector3(o[0],o[1],o[2]).divideScalar(1e3),rotation:new j.Euler(i[0],i[1],i[2],"XYZ"),geometry:ge(n.shape),children:r})}function be({name:e,colliders:n,meshChildrenProvider:r,...o}){return t.jsx("group",{name:e,...o,children:Object.entries(n).map(([i,f])=>t.jsx(je,{name:i,collider:f,children:r(i,f)},i))})}function we({scene:e,meshChildrenProvider:n}){const r=e.colliders;return t.jsx("group",{children:r&&t.jsx(be,{meshChildrenProvider:n,colliders:r})})}function O(){return t.jsx(M.Environment,{frames:1,children:t.jsx(Me,{})})}const Re=[2,0,2,0,2,0,2,0];function Me({positions:e=Re}){return t.jsxs(t.Fragment,{children:[t.jsx(M.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(M.Lightformer,{form:"circle",intensity:5,rotation:[Math.PI/2,0,0],position:[n,4,r*4],scale:[3,1,1]},r))})}),t.jsx(M.Lightformer,{intensity:40,"rotation-y":Math.PI/2,position:[-5,1,-1],scale:[20,.1,1]}),t.jsx(M.Lightformer,{intensity:20,"rotation-y":-Math.PI,position:[-5,-2,-1],scale:[20,.1,1]}),t.jsx(M.Lightformer,{"rotation-y":Math.PI/2,position:[-5,-1,-1],scale:[20,.5,1],intensity:5}),t.jsx(M.Lightformer,{"rotation-y":-Math.PI/2,position:[10,1,0],scale:[20,1,1],intensity:10}),t.jsx(M.Lightformer,{form:"ring",color:"white",intensity:5,scale:10,position:[-15,4,-18],target:[0,0,0]})]})}const Z={attach:"material",color:"#009f4d",opacity:.2,depthTest:!1,depthWrite:!1,transparent:!0,polygonOffset:!0};function ve({safetyZones:e,dhParameters:n,...r}){const o=d.useMemo(()=>S.dhParametersToPlaneSize(n??[]),[n]),i=(u,s)=>{var l,h;if(!((l=s==null?void 0:s.pose)!=null&&l.position)||!((h=s==null?void 0:s.pose)!=null&&h.orientation))return null;const y=new j.Vector3(s.pose.position[0]/1e3,s.pose.position[1]/1e3,s.pose.position[2]/1e3),a=new j.Vector3(s.pose.orientation[0],s.pose.orientation[1],s.pose.orientation[2]);let m;const c=s.shape.shape_type==="plane"?{...Z,side:j.DoubleSide}:{...Z,side:j.FrontSide};switch(s.shape.shape_type){case"plane":m=t.jsx("planeGeometry",{args:[o,o]});break;case"sphere":{const p=(s==null?void 0:s.shape).radius/1e3;m=t.jsx("sphereGeometry",{args:[p]});break}case"capsule":{const p=(s==null?void 0:s.shape).radius/1e3,x=(s==null?void 0:s.shape).cylinder_height/1e3;m=t.jsx("capsuleGeometry",{args:[p,x]});break}case"convex_hull":{const p=(s==null?void 0:s.shape).vertices.map(b=>new j.Vector3(b[0]/1e3,b[1]/1e3,b[2]/1e3)),x=S.verticesToCoplanarity(p);if(x.isCoplanar&&x.normal){const w=new j.Vector3().addVectors(p[0],x.normal.multiplyScalar(1e-4));p.push(w)}try{m=t.jsx("primitive",{object:new V.ConvexGeometry(p),attach:"geometry"})}catch(b){return console.log("Error creating ConvexGeometry:",b),null}break}case"rectangular_capsule":{const p=s.shape,x=p.radius/1e3,b=p.sphere_center_distance_x/1e3,w=p.sphere_center_distance_y/1e3,k=x*2;m=t.jsx("primitive",{object:new V.RoundedBoxGeometry(b,w,k,2,x),attach:"geometry"});break}default:console.warn("Unsupported safety zone shape type:",s.shape.shape_type),m=null}return t.jsxs("mesh",{renderOrder:u,position:y,quaternion:S.orientationToQuaternion(a),children:[m,t.jsx("meshStandardMaterial",{...c,polygonOffsetFactor:-u})]},`safety-zone-${s.shape.shape_type}-${u}`)},f=d.useMemo(()=>Object.values(e??{}).map((u,s)=>i(s,u)),[e,o]);return t.jsx("group",{...r,children:f})}function _e({trajectory:e,...n}){const r=(e==null?void 0:e.map(o=>{if(o.position&&o.position.length>=3){const[i,f,u]=o.position;if(Number.isFinite(i)&&Number.isFinite(f)&&Number.isFinite(u))return new j.Vector3(i/1e3,u/1e3,-f/1e3)}return null}).filter(o=>o!==null))||[];return t.jsx("group",{...n,children:r.length>0&&t.jsx(M.Line,{points:r,lineWidth:3,polygonOffset:!0,polygonOffsetFactor:10,polygonOffsetUnits:10})})}const P=new Map;async function E(e,n){if(P.has(e))return P.get(e);const r=(async()=>{var u;const o=n||"",i=new R.NovaClient({instanceUrl:o}),f=i.api.motionGroupModels;(u=f.axios)!=null&&u.interceptors&&f.axios.interceptors.request.use(s=>{var y;return(y=s.url)!=null&&y.includes("/glb")&&(s.responseType="blob"),s});try{const s=await i.api.motionGroupModels.getMotionGroupGlbModel(e);return URL.createObjectURL(s)}catch(s){throw console.error("Failed to fetch model:",s),s}})();return P.set(e,r),r}function z(e){function n(r){return r.children.length===0?[r]:[r,...r.children.flatMap(o=>n(o))]}return n(e).filter(r=>te(r))}function ee(e){return e.name.endsWith("_FLG")}function te(e){return/_J[0-9]+$/.test(e.name)}function Se(e,n){let r;function o(i){if(ee(i)){if(r)throw Error(`Found multiple flange groups in robot model ${n}; first ${r.name} then ${i.name}. Only one _FLG group is allowed.`);r=i}te(i),i.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 re({rapidlyChangingMotionState:e,dhParameters:n,onRotationChanged:r,children:o}){const i=d.useRef([]),f=d.useRef(null),{invalidate:u}=T.useThree(),s=d.useRef(e);s.current=e,d.useEffect(()=>{const c=e.joint_position.filter(l=>l!==void 0);return f.current=new L.ValueInterpolator(c,{tension:120,friction:20,threshold:.001}),()=>{var l;(l=f.current)==null||l.destroy()}},[]),T.useFrame((c,l)=>{if(f.current){const h=f.current.update(l);a(),h||u()}});function y(c){c&&(i.current=z(c),a(),u())}function a(){var l;const c=((l=f.current)==null?void 0:l.getCurrentValues())||[];if(r)r(i.current,c);else for(const[h,p]of i.current.entries()){const x=n[h],b=x.theta||0,w=x.reverse_rotation_direction?-1:1;p.rotation.y=w*(c[h]||0)+b}}function m(c){var h;const l=c.joint_position.filter(p=>p!==void 0);(h=f.current)==null||h.setTarget(l),u()}return L.useAutorun(()=>{m(s.current)}),d.useEffect(()=>{m(e)},[e]),t.jsx("group",{ref:y,children:o})}const Te="line",Le="mesh";function ke({rapidlyChangingMotionState:e,dhParameters:n,...r}){const o=new g.Matrix4,i=d.useRef([]),f=d.useRef([]);d.useEffect(()=>{i.current=new Array(n.length).fill(null),f.current=new Array(n.length).fill(null)},[n.length]);function u(a,m){const c=new g.Vector3,l=new g.Quaternion,h=new g.Vector3;o.decompose(c,l,h);const p=c.clone(),x=new g.Matrix4().makeRotationY(a.theta+m*(a.reverse_rotation_direction?-1:1)).multiply(new g.Matrix4().makeTranslation(0,a.d/1e3,0)).multiply(new g.Matrix4().makeTranslation(a.a/1e3,0,0)).multiply(new g.Matrix4().makeRotationX(a.alpha));return o.multiply(x),o.decompose(c,l,h),{a:p,b:c}}function s(a,m,c,l){if(!n)return;const h=n[a];if(!h)return;const{a:p,b:x}=u(h,l);m.geometry.setPositions([p.toArray(),x.toArray()].flat()),c.position.set(x.x,x.y,x.z)}function y(a,m){o.identity();for(let c=0;c<Math.min(a.length,m.length);c++){const l=i.current[c],h=f.current[c];l&&h&&s(c,l,h,m[c])}}return t.jsx(re,{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((a,m)=>{const{a:c,b:l}=u(a,e.joint_position[m]??0),h=`dhrobot_J0${m}`;return t.jsxs("group",{name:h,children:[t.jsx(M.Line,{ref:p=>{i.current[m]=p},name:Te,points:[c,l],color:"white",lineWidth:5}),t.jsxs("mesh",{ref:p=>{f.current[m]=p},name:Le,position:l,children:[t.jsx("sphereGeometry",{args:[.01,32,32]}),t.jsx("meshStandardMaterial",{color:"black",depthTest:!0})]},`mesh_${m}`)]},h)})]})})}const Ee=console.warn;function ne(){return d.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 Ce({url:e,flangeRef:n,postModelRender:r,...o}){const i=M.useGLTF(e),u=Se(i,"robot.glb").gltf,s=d.useCallback(a=>{a&&r&&r()},[r]);function y(a){try{return Ge(a)?a.geometry?t.jsx("mesh",{name:a.name,geometry:a.geometry,material:a.material,position:a.position,rotation:a.rotation},a.uuid):t.jsx("group",{name:a.name,position:a.position,rotation:a.rotation},a.uuid):t.jsx("group",{name:a.name,position:a.position,rotation:a.rotation,ref:ee(a)?n:void 0,children:a.children.map(y)},a.uuid)}catch(m){return console.warn("Error rendering node",a.name,m),null}}return t.jsx("group",{...o,dispose:null,ref:s,children:y(u.scene)})}function se({modelURL:e,flangeRef:n,postModelRender:r,...o}){const[i,f]=d.useState(null);return d.useEffect(()=>{let u=!1;return(async()=>{try{const y=typeof e=="string"?e:await e;u||f(a=>a===y?a:y)}catch(y){console.error("Failed to resolve model URL:",y)}})(),()=>{u=!0}},[e]),i?t.jsx(Ce,{url:i,flangeRef:n,postModelRender:r,...o}):null}const oe=(e,n)=>{e.userData.isGhost||(e.traverse(r=>{if(r instanceof j.Mesh){r.material instanceof j.Material&&(r.material.colorWrite=!1);const o=r.clone(),i=r.clone();o.material=new j.MeshStandardMaterial({depthTest:!0,depthWrite:!0,colorWrite:!1,polygonOffset:!0,polygonOffsetFactor:-1,side:j.DoubleSide}),o.userData.isGhost=!0,i.material=new j.MeshStandardMaterial({color:n,opacity:.3,depthTest:!0,depthWrite:!1,transparent:!0,polygonOffset:!0,polygonOffsetFactor:-2,side:j.DoubleSide}),i.userData.isGhost=!0,r.parent&&(r.parent.add(o),r.parent.add(i))}}),e.userData.isGhost=!0)},ie=e=>{if(!e.userData.isGhost)return;const n=[];e.traverse(r=>{var o;r instanceof j.Mesh&&((o=r.userData)!=null&&o.isGhost?n.push(r):r.material instanceof j.Material&&(r.material.colorWrite=!0))}),n.forEach(r=>{r.parent&&r.parent.remove(r)}),e.userData.isGhost=!1},q=S.externalizeComponent(({rapidlyChangingMotionState:e,modelFromController:n,dhParameters:r,getModel:o=E,flangeRef:i,postModelRender:f,transparentColor:u,instanceUrl:s,...y})=>{const[a,m]=d.useState(null),c=d.useCallback(p=>{m(p)},[]);d.useEffect(()=>{a&&(u?oe(a,u):ie(a))},[a,u]);const l=d.useMemo(()=>{const p=o(n,s);if(!p)throw new Error(`No model found for robot "${n}". Ensure the model is available or provide a custom getModel function.`);return p},[n,s,o]),h=t.jsx(ke,{rapidlyChangingMotionState:e,dhParameters:r,...y});return t.jsxs(K.ErrorBoundary,{fallback:h,onError:p=>{console.warn(p)},children:[t.jsx(d.Suspense,{fallback:h,children:t.jsx("group",{ref:c,children:t.jsx(re,{rapidlyChangingMotionState:e,dhParameters:r,children:t.jsx(se,{modelURL:l,postModelRender:f,flangeRef:i,...y})})})}),t.jsx(ne,{})]})});function ae({connectedMotionGroup:e,getModel:n=E,flangeRef:r,transparentColor:o,postModelRender:i,...f}){return e.dhParameters?t.jsx(q,{rapidlyChangingMotionState:e.rapidlyChangingMotionState,modelFromController:e.modelFromController||"",dhParameters:e.dhParameters,getModel:n,flangeRef:r,transparentColor:o,postModelRender:i,...f}):null}const Ae=S.externalizeComponent(me.observer(({robotName:e,programState:n,safetyState:r,operationMode:o,driveToHomeEnabled:i=!1,onDriveToHomePress:f,onDriveToHomeRelease:u,connectedMotionGroup:s,robotComponent:y=ae,customContentComponent:a,className:m})=>{var N;const c=pe.useTheme(),{t:l}=xe.useTranslation(),[h,p]=d.useState(!1),x=d.useRef(null),b=d.useRef(null),[w,k]=d.useState(!1),[G,fe]=d.useState({width:400,height:600}),[Oe,de]=d.useState(0);d.useEffect(()=>{const F=()=>{if(b.current){const{offsetWidth:$,offsetHeight:H}=b.current;k($>H),fe({width:$,height:H})}};F();const W=new ResizeObserver(F);return b.current&&W.observe(b.current),()=>{W.disconnect()}},[]);const J=d.useCallback(()=>{de(F=>F+1)},[]),C=d.useCallback(()=>{!i||!f||(p(!0),f())},[i,f]),A=d.useCallback(()=>{!i||!u||(p(!1),u())},[i,u]),B=d.useCallback(()=>{h&&u&&(p(!1),u())},[h,u]),_=w?G.width<350:G.height<200,I=w?G.height<310:G.height<450;return t.jsx(he,{ref:b,className:m,sx:{width:"100%",height:"100%",display:"flex",flexDirection:w?"row":"column",position:"relative",overflow:"hidden",minWidth:{xs:180,sm:220,md:250},minHeight:w?{xs:200,sm:240,md:260}:{xs:150,sm:180,md:220},border:`1px solid ${c.palette.divider}`,borderRadius:"18px",boxShadow:"none",backgroundColor:((N=c.palette.backgroundPaperElevation)==null?void 0:N[8])||"#2A2A3F",backgroundImage:"none"},children:w?t.jsxs(t.Fragment,{children:[t.jsx(v,{sx:{flex:"0 0 50%",position:"relative",height:"100%",minHeight:"100%",maxHeight:"100%",borderRadius:1,m:{xs:1.5,sm:2,md:3},mr:{xs:.75,sm:1,md:1.5},overflow:"hidden",display:_?"none":"block"},children:!_&&t.jsxs(T.Canvas,{orthographic:!0,camera:{position:[3,2,3],zoom:1},shadows:!0,frameloop:"demand",style:{borderRadius:c.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(O,{}),t.jsx(M.Bounds,{fit:!0,observe:!0,margin:1,maxDuration:1,children:t.jsx(y,{connectedMotionGroup:s,postModelRender:J})})]})}),t.jsxs(v,{sx:{flex:"1",display:"flex",flexDirection:"column",justifyContent:"flex-start",width:_?"100%":"50%"},children:[t.jsxs(v,{sx:{p:{xs:1.5,sm:2,md:3},pb:{xs:1,sm:1.5,md:2},textAlign:"left"},children:[t.jsx(X,{variant:"h6",component:"h2",sx:{mb:1},children:e}),t.jsx(L.ProgramStateIndicator,{programState:n,safetyState:r,operationMode:o})]}),t.jsxs(v,{sx:{p:{xs:1.5,sm:2,md:3},pt:0,flex:"1",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[!I&&a&&t.jsxs(v,{children:[t.jsx(a,{}),t.jsx(Q,{sx:{mt:1,mb:0,borderColor:c.palette.divider,opacity:.5}})]}),t.jsx(v,{sx:{mt:!I&&a?"auto":0},children:t.jsx(v,{sx:{display:"flex",justifyContent:"flex-start",mt:{xs:1,sm:1.5,md:2},mb:{xs:.5,sm:.75,md:1}},children:t.jsx(Y,{ref:x,variant:"contained",color:"secondary",size:"small",disabled:!i,onMouseDown:C,onMouseUp:A,onMouseLeave:B,onTouchStart:C,onTouchEnd:A,sx:{textTransform:"none",px:1.5,py:.5},children:l("RobotCard.DriveToHome.bt")})})})]})]})]}):t.jsx(t.Fragment,{children:t.jsxs(v,{sx:{p:3,height:"100%",display:"flex",flexDirection:"column"},children:[t.jsxs(v,{children:[t.jsx(X,{variant:"h6",component:"h2",sx:{mb:1},children:e}),t.jsx(L.ProgramStateIndicator,{programState:n,safetyState:r,operationMode:o})]}),t.jsx(v,{sx:{flex:_?0:1,position:"relative",minHeight:_?0:{xs:120,sm:150,md:200},height:_?0:"auto",borderRadius:1,overflow:"hidden",display:_?"none":"block"},children:!_&&t.jsxs(T.Canvas,{orthographic:!0,camera:{position:[3,2,3],zoom:1},shadows:!0,frameloop:"demand",style:{borderRadius:c.shape.borderRadius,width:"100%",height:"100%",background:"transparent",position:"absolute"},dpr:[1,2],gl:{alpha:!0,antialias:!0},children:[t.jsx(O,{}),t.jsx(M.Bounds,{fit:!0,clip:!0,observe:!0,margin:1,maxDuration:1,children:t.jsx(y,{connectedMotionGroup:s,postModelRender:J})})]})}),t.jsxs(v,{children:[!I&&a&&t.jsxs(t.Fragment,{children:[t.jsx(a,{}),t.jsx(Q,{sx:{mt:1,mb:0,borderColor:c.palette.divider,opacity:.5}})]}),t.jsx(v,{sx:{display:"flex",justifyContent:"flex-start",mt:!I&&a?{xs:1,sm:2,md:5}:{xs:.5,sm:1,md:2},mb:{xs:.5,sm:.75,md:1}},children:t.jsx(Y,{ref:x,variant:"contained",color:"secondary",size:"small",disabled:!i,onMouseDown:C,onMouseUp:A,onMouseLeave:B,onTouchStart:C,onTouchEnd:A,sx:{textTransform:"none",px:1.5,py:.5},children:l("RobotCard.DriveToHome.bt")})})]})]})})})})),Ie=Array(6).fill(2*Math.PI);function ce({rapidlyChangingMotionState:e,dhParameters:n,onTranslationChanged:r,children:o}){const i=d.useRef([]),f=d.useRef([]),u=d.useRef(null),{invalidate:s}=T.useThree();d.useEffect(()=>{const c=e.joint_position.filter(l=>l!==void 0);return u.current=new L.ValueInterpolator(c,{tension:120,friction:20,threshold:.001}),()=>{var l;(l=u.current)==null||l.destroy()}},[]),T.useFrame((c,l)=>{if(u.current){const h=u.current.update(l);a(),h||s()}});function y(c){c&&(f.current=z(c),a(),s())}function a(){var l;const c=((l=u.current)==null?void 0:l.getCurrentValues())||[];if(r)r(f.current,c);else for(const[h,p]of f.current.entries()){const b=n[h].reverse_rotation_direction?-1:1;p.position.y=b*(c[h]||0)/1e3}}const m=d.useCallback(()=>{const c=e.joint_position.filter(l=>l!==void 0);requestAnimationFrame(()=>{var l;i.current=c,(l=u.current)==null||l.setTarget(c)})},[e]);return d.useEffect(()=>{m()},[e,m]),L.useAutorun(()=>{m()}),t.jsx("group",{ref:y,children:o})}function ue({rapidlyChangingMotionState:e,dhParameters:n,...r}){const o=new g.Matrix4,i=d.useRef(null),f=d.useRef(null);function u(a){const m=new g.Matrix4;for(let p=0;p<n.length;p++){const x=n[p],b=a[p]??0,w=new g.Matrix4().makeRotationY(x.theta).multiply(new g.Matrix4().makeTranslation(x.a/1e3,(x.d+b*(x.reverse_rotation_direction?-1:1))/1e3,0)).multiply(new g.Matrix4().makeRotationX(x.alpha));m.multiply(w)}const c=new g.Vector3,l=new g.Quaternion,h=new g.Vector3;return m.decompose(c,l,h),c}const s=u(e.joint_position);function y(a,m){o.identity();let c=new g.Vector3;for(let x=0;x<n.length;x++){const b=m[x]??0,w=n[x],k=new g.Matrix4().makeRotationY(w.theta).multiply(new g.Matrix4().makeTranslation(w.a/1e3,(w.d+b*(w.reverse_rotation_direction?-1:1))/1e3,0)).multiply(new g.Matrix4().makeRotationX(w.alpha));o.multiply(k)}const l=new g.Vector3,h=new g.Quaternion,p=new g.Vector3;if(o.decompose(l,h,p),c=l,i.current&&i.current.position.set(c.x,c.y,c.z),f.current){const x=f.current.geometry;x!=null&&x.setPositions&&x.setPositions([0,0,0,c.x,c.y,c.z])}}return t.jsx(ce,{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(M.Line,{ref:f,points:[new g.Vector3(0,0,0),s],color:"White",lineWidth:5}),t.jsxs("mesh",{ref:i,name:"TCP",position:s,children:[t.jsx("sphereGeometry",{args:[.025,32,32]}),t.jsx("meshStandardMaterial",{color:"red",depthTest:!0})]})]})})}const U=S.externalizeComponent(({rapidlyChangingMotionState:e,modelFromController:n,dhParameters:r,getModel:o=E,flangeRef:i,postModelRender:f,transparentColor:u,instanceUrl:s,...y})=>{const[a,m]=d.useState(null),c=d.useCallback(h=>{m(h)},[]);d.useEffect(()=>{a&&(u?oe(a,u):ie(a))},[a,u]);const l=t.jsx(ue,{rapidlyChangingMotionState:e,dhParameters:r,...y});return t.jsxs(K.ErrorBoundary,{fallback:l,onError:h=>{console.warn(h)},children:[t.jsx(d.Suspense,{fallback:l,children:t.jsx("group",{ref:c,children:t.jsx(ce,{rapidlyChangingMotionState:e,dhParameters:r,children:t.jsx(se,{modelURL:(()=>{const h=o(n,s);if(!h){const p=new Blob([],{type:"model/gltf-binary"}),x=new File([p],`${n}.glb`,{type:"model/gltf-binary"});return Promise.resolve(URL.createObjectURL(x))}return h})(),postModelRender:f,flangeRef:i,...y})})})}),t.jsx(ne,{})]})});function Fe({connectedMotionGroup:e,getModel:n=E,flangeRef:r,transparentColor:o,postModelRender:i,...f}){if(!e.dhParameters)return null;const u=e.modelFromController||"";return u&&n(u)?t.jsx(U,{rapidlyChangingMotionState:e.rapidlyChangingMotionState,modelFromController:u,dhParameters:e.dhParameters,getModel:n,flangeRef:r,transparentColor:o,postModelRender:i,...f}):t.jsx(ue,{rapidlyChangingMotionState:e.rapidlyChangingMotionState,dhParameters:e.dhParameters,...f})}const D={[R.Manufacturer.Abb]:[0,0,0,0,Math.PI/2,0,0],[R.Manufacturer.Fanuc]:[0,0,0,0,-Math.PI/2,0,0],[R.Manufacturer.Yaskawa]:[0,0,0,0,-Math.PI/2,0,0],[R.Manufacturer.Kuka]:[0,-Math.PI/2,Math.PI/2,0,Math.PI/2,0,0],[R.Manufacturer.Universalrobots]:[0,-Math.PI/2,-Math.PI/2,-Math.PI/2,Math.PI/2,-Math.PI/2,0]};function le(e){const[n]=e.split("_");switch(n){case"ABB":return R.Manufacturer.Abb;case"FANUC":return R.Manufacturer.Fanuc;case"YASKAWA":return R.Manufacturer.Yaskawa;case"KUKA":return R.Manufacturer.Kuka;case"UniversalRobots":return R.Manufacturer.Universalrobots;default:return null}}function Pe(e,n){const r=le(e);return r&&r in D?D[r]:n||null}const Ve=S.externalizeComponent(e=>{const{inverseSolver:n,dhParameters:r,...o}=e,[i,f]=d.useState(R.JointTypeEnum.RevoluteJoint);d.useEffect(()=>{r.length&&f(r[0].type??R.JointTypeEnum.RevoluteJoint)},[r]);const u=d.useMemo(()=>n===null&&i===R.JointTypeEnum.RevoluteJoint,[n,i]),s=d.useMemo(()=>n===null&&i===R.JointTypeEnum.PrismaticJoint,[n,i]);return d.useMemo(()=>!!n,[n])||u?t.jsx(q,{dhParameters:r,...o}):s?t.jsx(U,{dhParameters:r,...o}):null});exports.CollisionSceneRenderer=we;exports.LinearAxis=Fe;exports.MANUFACTURER_HOME_CONFIGS=D;exports.MotionGroupVisualizer=Ve;exports.PresetEnvironment=O;exports.Robot=ae;exports.RobotCard=Ae;exports.SafetyZonesRenderer=ve;exports.SupportedLinearAxis=U;exports.SupportedRobot=q;exports.TrajectoryRenderer=_e;exports.defaultAxisConfig=Ie;exports.defaultGetModel=E;exports.extractManufacturer=le;exports.getDefaultHomeConfig=Pe;
|
|
@@ -2,7 +2,7 @@ import { jsxs as f, Fragment as B, jsx as t } from "react/jsx-runtime";
|
|
|
2
2
|
import h from "@mui/material/Divider";
|
|
3
3
|
import y from "@mui/material/Stack";
|
|
4
4
|
import { observer as d, useLocalObservable as M } from "mobx-react-lite";
|
|
5
|
-
import { t as v, e as O } from "./externalizeComponent-
|
|
5
|
+
import { t as v, e as O } from "./externalizeComponent-D6S3WLFc.js";
|
|
6
6
|
import { useTheme as E } from "@mui/material/styles";
|
|
7
7
|
import { useId as T } from "react";
|
|
8
8
|
import { useTranslation as m, Trans as s } from "react-i18next";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),x=require("@mui/material/Divider"),T=require("@mui/material/Stack"),d=require("mobx-react-lite"),h=require("./externalizeComponent-
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),x=require("@mui/material/Divider"),T=require("@mui/material/Stack"),d=require("mobx-react-lite"),h=require("./externalizeComponent-BHZdH14U.cjs"),f=require("@mui/material/styles"),E=require("react"),i=require("react-i18next"),c=require("./safety-state-stop-CgPfwC18.cjs"),j=require("@mui/material/Popover"),B=require("@mui/material/SvgIcon"),y=require("@mui/material/Typography"),b=require("axios");function v(a,o){throw new Error(`${o} ${JSON.stringify(a)}`)}function M(a){var o,r,n,t;return a instanceof b.AxiosError&&a.code==="ERR_NETWORK"?"Failed to connect to the server. Please check your internet connection.":a instanceof b.AxiosError&&a.response?`${(o=a.response)==null?void 0:o.status} ${(r=a.response)==null?void 0:r.statusText} from ${(n=a.response)==null?void 0:n.config.url}: ${JSON.stringify((t=a.response)==null?void 0:t.data)}`:a instanceof Error?a.message:`Unexpected error: ${h.tryStringifyJson(a)||a}`}const S=d.observer(({id:a,icon:o,color:r,title:n,name:t,label:l,explanation:s,literalValue:p,anchorOrigin:m,transformOrigin:A})=>{const u=d.useLocalObservable(()=>({anchorEl:null,get isPopoverOpen(){return!!u.anchorEl},openPopover(_){u.anchorEl=_.currentTarget},closePopover(){u.anchorEl=null}}));return e.jsxs(e.Fragment,{children:[e.jsxs(T,{"aria-owns":u.isPopoverOpen?a:void 0,"aria-haspopup":"true",onMouseEnter:u.openPopover,onMouseLeave:u.closePopover,direction:"row",spacing:1,sx:{cursor:"pointer"},children:[e.jsx(B,{component:o,sx:{color:r}}),l&&e.jsx("div",{style:{color:r},children:l})]}),e.jsx(j,{id:a,sx:{pointerEvents:"none"},open:u.isPopoverOpen,anchorEl:u.anchorEl,anchorOrigin:m??{vertical:"bottom",horizontal:"left"},transformOrigin:A??{vertical:"top",horizontal:"left"},onClose:u.closePopover,disableRestoreFocus:!0,children:e.jsxs(T,{gap:"1rem",padding:2,maxWidth:"450px",sx:{wordWrap:"break-word"},children:[e.jsxs("div",{children:[n&&e.jsx(y,{component:"span",fontSize:"14px",children:`${n}: `}),e.jsx(y,{component:"span",color:r,fontWeight:"bold",fontSize:"14px",children:t})]}),e.jsx(y,{fontSize:"14px",children:s}),p&&e.jsx(y,{fontSize:"12px",children:p})]})})]})}),O=d.observer(({isVirtual:a,motionGroupId:o,anchorOrigin:r,transformOrigin:n,compact:t})=>{const l=f.useTheme(),s=E.useId(),{t:p}=i.useTranslation();return a?e.jsx(S,{id:`motion-group-virtual-${s}`,icon:c.ForwardRef$1,color:l.palette.tertiary.main,name:p("SafetyBar.ControllerType.Virtual.lb"),label:t?null:p("SafetyBar.ControllerType.Virtual.lb"),explanation:e.jsxs(i.Trans,{i18nKey:"SafetyBar.MotionGroup.Virtual.Explanation.lb",values:{motionGroupId:o},children:["Motion group ",e.jsx("code",{children:o})," refers to a virtual robot with no physical counterpart. It can be freely manipulated without special safety precautions."]}),anchorOrigin:r,transformOrigin:n}):e.jsx(S,{id:`motion-group-physical-${s}`,icon:c.ForwardRef,color:l.palette.primary.main,name:p("SafetyBar.ControllerType.Physical.lb"),label:t?null:p("SafetyBar.ControllerType.Physical.lb"),explanation:e.jsx(i.Trans,{i18nKey:"SafetyBar.MotionGroup.Physical.Explanation.lb",values:{motionGroupId:o},components:{code:e.jsx("code",{}),strong:e.jsx("strong",{})}}),anchorOrigin:r,transformOrigin:n})}),R=d.observer(({operationMode:a,anchorOrigin:o,transformOrigin:r,compact:n})=>{const{t}=i.useTranslation(),l=f.useTheme(),s=E.useId();switch(a){case"OPERATION_MODE_AUTO":return e.jsx(S,{id:`operation-mode-auto-${s}`,icon:c.ForwardRef$2,title:t("SafetyBar.OperationMode.ti"),name:t("SafetyBar.OperationMode.Automatic.ti"),label:n?null:t("SafetyBar.OperationMode.Automatic.ti"),color:l.palette.text.secondary,explanation:e.jsx(i.Trans,{i18nKey:"SafetyBar.OperationMode.Auto.Explanation.lb",children:"The robot controller is in automatic operation mode. Automated movement without manual confirmation is possible in this mode."}),anchorOrigin:o,transformOrigin:r});case"OPERATION_MODE_MANUAL":case"OPERATION_MODE_MANUAL_T1":case"OPERATION_MODE_MANUAL_T2":return e.jsx(S,{id:`operation-mode-manual-${s}`,icon:c.ForwardRef$4,color:l.palette.warning.main,title:t("SafetyBar.OperationMode.ti"),name:t("SafetyBar.OperationMode.Manual.lb"),label:n?null:t("SafetyBar.OperationMode.Manual.lb"),explanation:e.jsx(i.Trans,{i18nKey:"SafetyBar.OperationMode.Manual.Explanation.lb",children:"The robot controller is in manual operation mode. On a physical robot, this generally indicates that an enabling switch must be held for the robot to move successfully."}),literalValue:a,anchorOrigin:o,transformOrigin:r});default:return e.jsx(S,{id:`operation-mode-error-${s}`,icon:c.ForwardRef$3,color:l.palette.warning.main,title:t("SafetyBar.OperationMode.ti"),name:t("SafetyBar.OperationMode.Error.lb"),label:n?null:t("SafetyBar.OperationMode.Error.lb"),explanation:e.jsx(i.Trans,{i18nKey:"SafetyBar.OperationMode.Error.Explanation.lb",children:"The robot controller has entered an unexpected operation mode. Motion group movement may not be possible."}),literalValue:a,anchorOrigin:o,transformOrigin:r})}}),F=d.observer(({safetyState:a,anchorOrigin:o,transformOrigin:r,compact:n})=>{const{t}=i.useTranslation(),l=f.useTheme(),s=E.useId();switch(a){case"SAFETY_STATE_NORMAL":return e.jsx(S,{id:`safety-state-normal-${s}`,title:t("SafetyBar.SafetyState.ti"),name:t("SafetyBar.SafetyState.Normal.lb"),label:n?null:t("SafetyBar.SafetyState.Normal.lb"),icon:c.ForwardRef$8,color:l.palette.text.secondary,explanation:e.jsx(i.Trans,{i18nKey:"SafetyBar.SafetyState.Normal.Explanation.lb",children:"The robot controller is in a normal safety state. Movement is not prevented by this state."}),anchorOrigin:o,transformOrigin:r});case"SAFETY_STATE_DEVICE_EMERGENCY_STOP":case"SAFETY_STATE_ROBOT_EMERGENCY_STOP":return e.jsx(S,{id:`safety-state-estop-${s}`,title:t("SafetyBar.SafetyState.ti"),name:t("SafetyBar.SafetyState.Estop.lb"),label:n?null:t("SafetyBar.SafetyState.Estop.lb"),icon:c.ForwardRef$6,color:l.palette.error.main,explanation:e.jsx(i.Trans,{i18nKey:"SafetyBar.StopState.Estop.Explanation.lb",children:"An emergency stop of the robot controller has been triggered. Movement of the robot is no longer possible until the estop is released."}),literalValue:a,anchorOrigin:o,transformOrigin:r});case"SAFETY_STATE_STOP_0":case"SAFETY_STATE_STOP_1":case"SAFETY_STATE_STOP_2":case"SAFETY_STATE_PROTECTIVE_STOP":case"SAFETY_STATE_STOP":return e.jsx(S,{id:`safety-state-stop-${s}`,icon:c.ForwardRef$9,title:t("SafetyBar.SafetyState.ti"),name:t("SafetyBar.SafetyState.Stop.lb"),label:n?null:t("SafetyBar.SafetyState.Stop.lb"),color:l.palette.warning.main,explanation:e.jsx(i.Trans,{i18nKey:"SafetyBar.SafetyState.Stop.Explanation.lb",children:"The robot controller has entered a stop state. Movement is no longer possible until the stop state is resolved."}),literalValue:a,anchorOrigin:o,transformOrigin:r});case"SAFETY_STATE_REDUCED":case"SAFETY_STATE_MASTERING":case"SAFETY_STATE_CONFIRM_SAFETY":case"SAFETY_STATE_OPERATOR_SAFETY":case"SAFETY_STATE_RECOVERY":case"SAFETY_STATE_VIOLATION":return e.jsx(S,{id:`safety-state-manual-action-required-${s}`,icon:c.ForwardRef$7,color:l.palette.warning.main,title:t("SafetyBar.SafetyState.ti"),name:t("SafetyBar.SafetyState.ManualActionRequired.lb"),label:n?null:t("SafetyBar.SafetyState.ManualActionRequired.lb"),explanation:e.jsx(i.Trans,{i18nKey:"SafetyBar.SafetyState.ManualActionRequired.Explanation.lb",children:"The robot controller has entered a safety state requiring manual action to resolve."}),literalValue:a,anchorOrigin:o,transformOrigin:r});case"SAFETY_STATE_UNKNOWN":case"SAFETY_STATE_FAULT":return e.jsx(S,{id:`safety-state-error-${s}`,icon:c.ForwardRef$5,color:l.palette.error.main,title:t("SafetyBar.SafetyState.ti"),name:t("SafetyBar.SafetyState.Error.lb"),label:n?null:t("SafetyBar.SafetyState.Error.lb"),explanation:e.jsx(i.Trans,{i18nKey:"SafetyBar.SafetyState.Error.Explanation.lb",children:"The robot controller has entered an unexpected safety state."}),literalValue:a,anchorOrigin:o,transformOrigin:r});default:v(a,`Unknown safety state ${a}`)}}),w=h.externalizeComponent(d.observer(({isVirtual:a,motionGroupId:o,operationMode:r,safetyState:n,anchorOrigin:t,transformOrigin:l,compact:s=!0})=>{const p=s?1:2;return e.jsxs(T,{direction:"row",gap:p,alignItems:"center",sx:{height:"24px"},children:[e.jsx(F,{safetyState:n,anchorOrigin:t,transformOrigin:l,compact:s}),e.jsx(x,{orientation:"vertical",flexItem:!0}),e.jsx(R,{operationMode:r,anchorOrigin:t,transformOrigin:l,compact:s}),e.jsx(x,{orientation:"vertical",flexItem:!0}),e.jsx(O,{isVirtual:a,motionGroupId:o,anchorOrigin:t,transformOrigin:l,compact:s})]})}));exports.SafetyBar=w;exports.makeErrorMessage=M;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const m=require("three"),s=require("react/jsx-runtime"),S=require("react"),y=require("react-i18next"),p=require("i18next"),f=require("i18next-browser-languagedetector");function h(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const o=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,o.get?o:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const n=h(m);function R(e){
|
|
2
|
-
Bei einem physischen Roboter bedeutet dies im Allgemeinen, dass ein Freigabeschalter gedrückt werden muss, damit sich der Roboter erfolgreich bewegen kann.`,"SafetyBar.OperationMode.Manual.lb":"Manuell","SafetyBar.OperationMode.ti":"Betriebsmodus","SafetyBar.SafetyState.Error.Explanation.lb":"Die Robotersteuerung ist in einen unerwarteten Sicherheitszustand eingetreten.","SafetyBar.SafetyState.Error.lb":"Fehler","SafetyBar.SafetyState.Estop.lb":"NOT-AUS","SafetyBar.SafetyState.ManualActionRequired.Explanation.lb":"Die Robotersteuerung ist in einen Sicherheitszustand eingetreten, der manuelle Maßnahmen zur Behebung erfordert.","SafetyBar.SafetyState.ManualActionRequired.lb":"Aktion erforderlich","SafetyBar.SafetyState.Normal.Explanation.lb":"Die Robotersteuerung befindet sich in einem sicheren Zustand. Roboterbewegungen sind möglich.","SafetyBar.SafetyState.Normal.lb":"Sicher","SafetyBar.SafetyState.Stop.Explanation.lb":"Die Robotersteuerung ist in einen Stoppzustand übergegangen. Bis der Stoppzustand aufgelöst ist, ist keine Bewegung mehr möglich.","SafetyBar.SafetyState.Stop.lb":"Stopp","SafetyBar.SafetyState.ti":"Sicherheitszustand","SafetyBar.StopState.Estop.Explanation.lb":"NOT-AUS aktiviert. NOT-AUS freischalten, um Roboter zu bewegen.","Jogging.Increment.hlb":"Schrittgröße","Jogging.CoordinateSystem.hlb":"Koordinatensystem","Jogging.Cartesian.bt":"Kartesisch","Jogging.Joints.bt":"Gelenke","Jogging.Velocity.bt":"Geschwindigkeit","CycleTimer.RemainingTime.lb":"Verbleibende Zeit","CycleTimer.OfTime.lb":"von {{time}}","CycleTimer.Time.lb":"{{time}}","CycleTimer.Error.lb":"Fehler","CycleTimer.WaitingForCycle.lb":"Warten auf Programmzyklus","CycleTimer.CycleTime.lb":"Zykluszeit","CycleTimer.Measuring.lb":"wird gemessen...","CycleTimer.Determined.lb":"bestimmt","Timer.error":"Fehler","ProgramControl.Start.bt":"Start","ProgramControl.Resume.bt":"Weiter","ProgramControl.Retry.bt":"Wiederholen","ProgramControl.Pause.bt":"Pause","ProgramControl.Stop.bt":"Stopp","ProgramStateIndicator.Preparing.lb":"Vorbereitung","ProgramStateIndicator.Starting.lb":"Startet","ProgramStateIndicator.Running.lb":"In Betrieb","ProgramStateIndicator.Pausing.lb":"Pausiert","ProgramStateIndicator.Stopping.lb":"Stoppt","ProgramStateIndicator.Completed.lb":"Abgeschlossen","ProgramStateIndicator.Failed.lb":"Fehlgeschlagen","ProgramStateIndicator.Error.lb":"Fehler","ProgramStateIndicator.EStop.lb":"Not-Aus","ProgramStateIndicator.Idle.lb":"Leerlauf","ProgramStateIndicator.Paused.lb":"Pausiert","ProgramStateIndicator.Ready.lb":"Bereit","ProgramStateIndicator.Stopped.lb":"Gestoppt","ProgramStateIndicator.Auto.lb":"Auto","ProgramStateIndicator.Manual.lb":"Manuell","ProgramStateIndicator.ManualT1.lb":"Manuell T1","ProgramStateIndicator.ManualT2.lb":"Manuell T2","RobotSetupReadinessIndicator.Ready.lb":"Bereit","RobotSetupReadinessIndicator.RobotDisconnected.lb":"Roboter getrennt","RobotSetupReadinessIndicator.CellOpen.lb":"Zelle offen","RobotSetupReadinessIndicator.EStop.lb":"Not-Stopp","RobotSetupReadinessIndicator.ManualMode.lb":"Manueller Modus","RobotSetupReadinessIndicator.PreconditionNotFulfilled.lb":"Voraussetzung nicht erfüllt","RobotCard.Runtime.lb":"Laufzeit","RobotCard.DriveToHome.bt":"Zur Home-Position fahren"},
|
|
1
|
+
"use strict";const m=require("three"),s=require("react/jsx-runtime"),S=require("react"),y=require("react-i18next"),p=require("i18next"),f=require("i18next-browser-languagedetector");function h(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const o=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,o.get?o:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const n=h(m);function R(e){try{return JSON.stringify(e)}catch{return}}function P(e){const t=e.length(),a=new n.Quaternion;if(t>1e-6){const o=e.clone().normalize();a.setFromAxisAngle(o,t)}return a}function C(e){if(!e||e.length===0)return 5;const o=e.reduce((l,i)=>l+Math.abs(i.a??0)/1e3+Math.abs(i.d??0)/1e3,0)*2;return!Number.isFinite(o)||o<=0?5:o}function T(e){if(e.length<3)return console.log("Not enough vertices to define a plane"),{isCoplanar:!1};const t=new n.Vector3(e[0].x,e[0].y,e[0].z),a=new n.Vector3(e[1].x,e[1].y,e[1].z),o=new n.Vector3(e[2].x,e[2].y,e[2].z),l=new n.Vector3().subVectors(a,t),i=new n.Vector3().subVectors(o,t),c=new n.Vector3().crossVectors(l,i).normalize();for(let r=3;r<e.length;r++){const b=new n.Vector3(e[r].x,e[r].y,e[r].z),u=new n.Vector3().subVectors(b,t),d=c.dot(u);if(Math.abs(d)>1e-6)return console.log("Vertices are not on the same plane"),{isCoplanar:!1}}return{isCoplanar:!0,normal:c}}const B={"Jogging.Cartesian.Translation.velocityMmPerSec.lb":"{{amount}} mm/s","Jogging.Cartesian.Rotation.velocityDegPerSec.lb":"{{amount}}°/s","Jogging.Velocity.lb":"Geschwindigkeit","General.degree.variable":"{{amount}}°","General.mm.variable":"{{amount}} mm","Jogging.Blocked.ti":"Verbindung blockiert","Jogging.Blocked.lb":"Ein anderer Client kontrolliert das Jogging.","Jogging.Blocked.Reenable.bt":"Neu verbinden","Jogging.Cartesian.MotionType.lb":"Bewegungstyp","Jogging.Cartesian.Translation.bt":"Translation","Jogging.Cartesian.Rotation.bt":"Rotation","Jogging.Joints.JointValues.lb":"Gelenkwerte","Jogging.Increment.Continuous.dd":"Fortlaufend","Jogging.Cartesian.Orientation.lb":"Orientierung","Jogging.JointLimitsReached.lb":"Gelenkgrenzen für Gelenk {{jointNumbers}} erreicht","Jogging.Orientation.coordsys":"Roboterbasis","Jogging.Orientation.tool":"Werkzeug","SafetyBar.ActivationToggle.Activate.bt":"Aktivieren","SafetyBar.ActivationToggle.Activated.bt":"Aktiviert","SafetyBar.ActivationToggle.Activating.bt":"Wird aktiviert…","SafetyBar.ActivationToggle.Deactivating.bt":"Wird deaktiviert…","SafetyBar.ControllerType.Physical.lb":"Physisch","SafetyBar.ControllerType.Virtual.lb":"Virtuell","SafetyBar.MotionGroup.Physical.Explanation.lb":"<code>{{motionGroupId}}</code> ist ein physische Robotersteuerung. Für die Bewegung dieses Roboters sind <strong>Sicherheitsmaßnahmen</strong> aktiv.","SafetyBar.MotionGroup.Virtual.Explanation.lb":"<1>{{motionGroupId}}</1> ist eine virtuelle Robotersteuerung ohne physisches Gegenstück. Der Roboter kann ohne Sicherheitsmaßnahmen bewegt werden.","SafetyBar.OperationMode.Auto.Explanation.lb":"Automatischer Betriebsmodus der Robotersteuerung aktiv. Automatisierte Bewegung ohne manuelle Bestätigung freigegeben.","SafetyBar.OperationMode.Automatic.ti":"Automatisch","SafetyBar.OperationMode.Error.Explanation.lb":"Fehler beim Abrufen des Betriebsmodus. Originalhandbediengerät des Roboters verwenden, um Fehler zu lösen.","SafetyBar.OperationMode.Error.lb":"Fehler","SafetyBar.OperationMode.Manual.Explanation.lb":`Die Robotersteuerung befindet sich im manuellen Betriebsmodus.
|
|
2
|
+
Bei einem physischen Roboter bedeutet dies im Allgemeinen, dass ein Freigabeschalter gedrückt werden muss, damit sich der Roboter erfolgreich bewegen kann.`,"SafetyBar.OperationMode.Manual.lb":"Manuell","SafetyBar.OperationMode.ti":"Betriebsmodus","SafetyBar.SafetyState.Error.Explanation.lb":"Die Robotersteuerung ist in einen unerwarteten Sicherheitszustand eingetreten.","SafetyBar.SafetyState.Error.lb":"Fehler","SafetyBar.SafetyState.Estop.lb":"NOT-AUS","SafetyBar.SafetyState.ManualActionRequired.Explanation.lb":"Die Robotersteuerung ist in einen Sicherheitszustand eingetreten, der manuelle Maßnahmen zur Behebung erfordert.","SafetyBar.SafetyState.ManualActionRequired.lb":"Aktion erforderlich","SafetyBar.SafetyState.Normal.Explanation.lb":"Die Robotersteuerung befindet sich in einem sicheren Zustand. Roboterbewegungen sind möglich.","SafetyBar.SafetyState.Normal.lb":"Sicher","SafetyBar.SafetyState.Stop.Explanation.lb":"Die Robotersteuerung ist in einen Stoppzustand übergegangen. Bis der Stoppzustand aufgelöst ist, ist keine Bewegung mehr möglich.","SafetyBar.SafetyState.Stop.lb":"Stopp","SafetyBar.SafetyState.ti":"Sicherheitszustand","SafetyBar.StopState.Estop.Explanation.lb":"NOT-AUS aktiviert. NOT-AUS freischalten, um Roboter zu bewegen.","Jogging.Increment.hlb":"Schrittgröße","Jogging.CoordinateSystem.hlb":"Koordinatensystem","Jogging.Cartesian.bt":"Kartesisch","Jogging.Joints.bt":"Gelenke","Jogging.Velocity.bt":"Geschwindigkeit","CycleTimer.RemainingTime.lb":"Verbleibende Zeit","CycleTimer.OfTime.lb":"von {{time}}","CycleTimer.Time.lb":"{{time}}","CycleTimer.Error.lb":"Fehler","CycleTimer.WaitingForCycle.lb":"Warten auf Programmzyklus","CycleTimer.CycleTime.lb":"Zykluszeit","CycleTimer.Measuring.lb":"wird gemessen...","CycleTimer.Determined.lb":"bestimmt","Timer.error":"Fehler","ProgramControl.Start.bt":"Start","ProgramControl.Resume.bt":"Weiter","ProgramControl.Retry.bt":"Wiederholen","ProgramControl.Pause.bt":"Pause","ProgramControl.Stop.bt":"Stopp","ProgramStateIndicator.Preparing.lb":"Vorbereitung","ProgramStateIndicator.Starting.lb":"Startet","ProgramStateIndicator.Running.lb":"In Betrieb","ProgramStateIndicator.Pausing.lb":"Pausiert","ProgramStateIndicator.Stopping.lb":"Stoppt","ProgramStateIndicator.Completed.lb":"Abgeschlossen","ProgramStateIndicator.Failed.lb":"Fehlgeschlagen","ProgramStateIndicator.Error.lb":"Fehler","ProgramStateIndicator.EStop.lb":"Not-Aus","ProgramStateIndicator.Idle.lb":"Leerlauf","ProgramStateIndicator.Paused.lb":"Pausiert","ProgramStateIndicator.Ready.lb":"Bereit","ProgramStateIndicator.Stopped.lb":"Gestoppt","ProgramStateIndicator.Auto.lb":"Auto","ProgramStateIndicator.Manual.lb":"Manuell","ProgramStateIndicator.ManualT1.lb":"Manuell T1","ProgramStateIndicator.ManualT2.lb":"Manuell T2","RobotSetupReadinessIndicator.Ready.lb":"Bereit","RobotSetupReadinessIndicator.RobotDisconnected.lb":"Roboter getrennt","RobotSetupReadinessIndicator.CellOpen.lb":"Zelle offen","RobotSetupReadinessIndicator.EStop.lb":"Not-Stopp","RobotSetupReadinessIndicator.ManualMode.lb":"Manueller Modus","RobotSetupReadinessIndicator.PreconditionNotFulfilled.lb":"Voraussetzung nicht erfüllt","RobotCard.Runtime.lb":"Laufzeit","RobotCard.DriveToHome.bt":"Zur Home-Position fahren"},M={"Jogging.Cartesian.Translation.velocityMmPerSec.lb":"{{amount}} mm/s","Jogging.Cartesian.Rotation.velocityDegPerSec.lb":"{{amount}}°/s","Jogging.Velocity.lb":"Velocity","General.degree.variable":"{{amount}}°","General.mm.variable":"{{amount}} mm","Jogging.Blocked.ti":"Connection blocked","Jogging.Blocked.lb":"Another client is currently controlling the jogging.","Jogging.Blocked.Reenable.bt":"Reconnect","Jogging.Cartesian.MotionType.lb":"Motion type","Jogging.Cartesian.Translation.bt":"Translation","Jogging.Cartesian.Rotation.bt":"Rotation","Jogging.Joints.JointValues.lb":"Joint values","Jogging.Increment.Continuous.dd":"Continuous","Jogging.Cartesian.Orientation.lb":"Orientation","Jogging.Activating.lb":"Activating jogging","Jogging.JointLimitsReached.lb":"Joint limit reached for joint {{jointNumbers}}","Jogging.Orientation.coordsys":"Robot base","Jogging.Orientation.tool":"Tool","SafetyBar.ActivationToggle.Activate.bt":"Activate","SafetyBar.ActivationToggle.Activated.bt":"Activated","SafetyBar.ActivationToggle.Activating.bt":"Activating","SafetyBar.ActivationToggle.Deactivating.bt":"Deactivating","SafetyBar.ControllerType.Physical.lb":"Physical","SafetyBar.ControllerType.Virtual.lb":"Virtual","SafetyBar.MotionGroup.Physical.Explanation.lb":"<code>{{motionGroupId}}</code> is a physical robot controller. <strong>Safety precautions</strong> are active for the movement of this robot.","SafetyBar.MotionGroup.Virtual.Explanation.lb":"<1>{{motionGroupId}}</1> is a virtual robot controller with no physical counterpart. It can be freely manipulated without safety precautions.","SafetyBar.OperationMode.Auto.Explanation.lb":"Automatic operation mode active. Automated movement without manual confirmation enabled.","SafetyBar.OperationMode.Automatic.ti":"Automatic","SafetyBar.OperationMode.Error.Explanation.lb":"Failed to get operation mode. Use the original control panel to resolve the error.","SafetyBar.OperationMode.Error.lb":"Error","SafetyBar.OperationMode.Manual.Explanation.lb":"The robot controller is in manual operation mode. On a physical robot, this generally indicates that an enabling switch must be held for the robot to move successfully.","SafetyBar.OperationMode.Manual.lb":"Manual","SafetyBar.OperationMode.ti":"Operation mode","SafetyBar.SafetyState.Error.Explanation.lb":"The robot controller has entered an unexpected safety state.","SafetyBar.SafetyState.Error.lb":"Error","SafetyBar.SafetyState.Estop.lb":"E-Stop","SafetyBar.SafetyState.ManualActionRequired.Explanation.lb":"The robot controller has entered a safety state requiring manual action to resolve.","SafetyBar.SafetyState.ManualActionRequired.lb":"Action required","SafetyBar.SafetyState.Normal.Explanation.lb":"The robot controller is in a safe state. Robot movement is enabled.","SafetyBar.SafetyState.Normal.lb":"Safe","SafetyBar.SafetyState.Stop.Explanation.lb":"The robot controller has entered a stop state. Movement is no longer possible until the stop state is resolved.","SafetyBar.SafetyState.Stop.lb":"Stop","SafetyBar.SafetyState.ti":"Safety state","SafetyBar.StopState.Estop.Explanation.lb":"An emergency stop of the robot controller has been triggered. Movement of the robot is no longer possible until the estop is released.","Jogging.Increment.hlb":"Increment","Jogging.CoordinateSystem.hlb":"Coordinate system","Jogging.Cartesian.bt":"Cartesian","Jogging.Joints.bt":"Joints","Jogging.Velocity.bt":"Velocity","CycleTimer.RemainingTime.lb":"Time remaining","CycleTimer.OfTime.lb":"of {{time}}","CycleTimer.Time.lb":"{{time}}","CycleTimer.Error.lb":"Error","CycleTimer.WaitingForCycle.lb":"Waiting for program cycle","CycleTimer.CycleTime.lb":"Cycle Time","CycleTimer.Measuring.lb":"measuring...","CycleTimer.Determined.lb":"determined","Timer.error":"Error","ProgramControl.Start.bt":"Start","ProgramControl.Resume.bt":"Resume","ProgramControl.Retry.bt":"Retry","ProgramControl.Pause.bt":"Pause","ProgramControl.Stop.bt":"Stop","ProgramStateIndicator.Preparing.lb":"Preparing","ProgramStateIndicator.Starting.lb":"Starting","ProgramStateIndicator.Running.lb":"Running","ProgramStateIndicator.Pausing.lb":"Pausing","ProgramStateIndicator.Stopping.lb":"Stopping","ProgramStateIndicator.Completed.lb":"Completed","ProgramStateIndicator.Failed.lb":"Failed","ProgramStateIndicator.Error.lb":"Error","ProgramStateIndicator.EStop.lb":"E-Stop","ProgramStateIndicator.Idle.lb":"Idle","ProgramStateIndicator.Paused.lb":"Paused","ProgramStateIndicator.Ready.lb":"Ready","ProgramStateIndicator.Stopped.lb":"Stopped","ProgramStateIndicator.Auto.lb":"Auto","ProgramStateIndicator.Manual.lb":"Manual","ProgramStateIndicator.ManualT1.lb":"Manual T1","ProgramStateIndicator.ManualT2.lb":"Manual T2","RobotSetupReadinessIndicator.Ready.lb":"Ready","RobotSetupReadinessIndicator.RobotDisconnected.lb":"Robot disconnected","RobotSetupReadinessIndicator.CellOpen.lb":"Cell open","RobotSetupReadinessIndicator.EStop.lb":"E-Stop","RobotSetupReadinessIndicator.ManualMode.lb":"Manual mode","RobotSetupReadinessIndicator.PreconditionNotFulfilled.lb":"Precondition not fulfilled","RobotCard.Runtime.lb":"Runtime","RobotCard.DriveToHome.bt":"Drive to Home"},g=p.createInstance();g.use(f).init({supportedLngs:["en","de"],resources:{en:{translations:M},de:{translations:B}},ns:["translations"],defaultNS:"translations",detection:{order:["navigator","htmlTag"]}});function I(e){const t=S.memo(e);return(o=>s.jsx(v,{children:s.jsx(t,{...o})}))}const v=({children:e})=>s.jsx(y.I18nextProvider,{i18n:g,children:e});exports.dhParametersToPlaneSize=C;exports.externalizeComponent=I;exports.i18n=g;exports.orientationToQuaternion=P;exports.tryStringifyJson=R;exports.verticesToCoplanarity=T;
|
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
import * as a from "three";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
3
3
|
import { memo as m } from "react";
|
|
4
4
|
import { I18nextProvider as S } from "react-i18next";
|
|
5
5
|
import p from "i18next";
|
|
6
6
|
import y from "i18next-browser-languagedetector";
|
|
7
7
|
function I(e) {
|
|
8
|
-
return e * (180 / Math.PI);
|
|
9
|
-
}
|
|
10
|
-
function v(e) {
|
|
11
|
-
return e * (Math.PI / 180);
|
|
12
|
-
}
|
|
13
|
-
function J(e) {
|
|
14
8
|
try {
|
|
15
9
|
return JSON.stringify(e);
|
|
16
10
|
} catch {
|
|
17
11
|
return;
|
|
18
12
|
}
|
|
19
13
|
}
|
|
20
|
-
function
|
|
14
|
+
function v(e) {
|
|
21
15
|
const t = e.length(), n = new a.Quaternion();
|
|
22
16
|
if (t > 1e-6) {
|
|
23
17
|
const o = e.clone().normalize();
|
|
@@ -25,22 +19,22 @@ function A(e) {
|
|
|
25
19
|
}
|
|
26
20
|
return n;
|
|
27
21
|
}
|
|
28
|
-
function
|
|
22
|
+
function J(e) {
|
|
29
23
|
if (!e || e.length === 0)
|
|
30
24
|
return 5;
|
|
31
25
|
const o = e.reduce((l, i) => l + Math.abs(i.a ?? 0) / 1e3 + Math.abs(i.d ?? 0) / 1e3, 0) * 2;
|
|
32
26
|
return !Number.isFinite(o) || o <= 0 ? 5 : o;
|
|
33
27
|
}
|
|
34
|
-
function
|
|
28
|
+
function A(e) {
|
|
35
29
|
if (e.length < 3)
|
|
36
30
|
return console.log("Not enough vertices to define a plane"), { isCoplanar: !1 };
|
|
37
|
-
const t = new a.Vector3(e[0].x, e[0].y, e[0].z), n = new a.Vector3(e[1].x, e[1].y, e[1].z), o = new a.Vector3(e[2].x, e[2].y, e[2].z), l = new a.Vector3().subVectors(n, t), i = new a.Vector3().subVectors(o, t),
|
|
31
|
+
const t = new a.Vector3(e[0].x, e[0].y, e[0].z), n = new a.Vector3(e[1].x, e[1].y, e[1].z), o = new a.Vector3(e[2].x, e[2].y, e[2].z), l = new a.Vector3().subVectors(n, t), i = new a.Vector3().subVectors(o, t), s = new a.Vector3().crossVectors(l, i).normalize();
|
|
38
32
|
for (let r = 3; r < e.length; r++) {
|
|
39
|
-
const b = new a.Vector3(e[r].x, e[r].y, e[r].z), d = new a.Vector3().subVectors(b, t), u =
|
|
33
|
+
const b = new a.Vector3(e[r].x, e[r].y, e[r].z), d = new a.Vector3().subVectors(b, t), u = s.dot(d);
|
|
40
34
|
if (Math.abs(u) > 1e-6)
|
|
41
35
|
return console.log("Vertices are not on the same plane"), { isCoplanar: !1 };
|
|
42
36
|
}
|
|
43
|
-
return { isCoplanar: !0, normal:
|
|
37
|
+
return { isCoplanar: !0, normal: s };
|
|
44
38
|
}
|
|
45
39
|
const f = {
|
|
46
40
|
"Jogging.Cartesian.Translation.velocityMmPerSec.lb": "{{amount}} mm/s",
|
|
@@ -237,20 +231,18 @@ c.use(y).init({
|
|
|
237
231
|
order: ["navigator", "htmlTag"]
|
|
238
232
|
}
|
|
239
233
|
});
|
|
240
|
-
function
|
|
234
|
+
function E(e) {
|
|
241
235
|
const t = m(e);
|
|
242
|
-
return ((o) => /* @__PURE__ */
|
|
236
|
+
return ((o) => /* @__PURE__ */ g(R, { children: /* @__PURE__ */ g(t, { ...o }) }));
|
|
243
237
|
}
|
|
244
238
|
const R = ({
|
|
245
239
|
children: e
|
|
246
|
-
}) => /* @__PURE__ */
|
|
240
|
+
}) => /* @__PURE__ */ g(S, { i18n: c, children: e });
|
|
247
241
|
export {
|
|
248
|
-
|
|
249
|
-
E as
|
|
250
|
-
x as e,
|
|
242
|
+
J as d,
|
|
243
|
+
E as e,
|
|
251
244
|
c as i,
|
|
252
|
-
|
|
253
|
-
I as
|
|
254
|
-
|
|
255
|
-
O as v
|
|
245
|
+
v as o,
|
|
246
|
+
I as t,
|
|
247
|
+
A as v
|
|
256
248
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const u=require("react/jsx-runtime"),P=require("@mui/material/styles"),V=require("@mui/material/Chip"),_=require("@mui/material/Typography"),C=require("mobx-react-lite"),x=require("react-i18next"),O=require("./externalizeComponent-
|
|
1
|
+
"use strict";const u=require("react/jsx-runtime"),P=require("@mui/material/styles"),V=require("@mui/material/Chip"),_=require("@mui/material/Typography"),C=require("mobx-react-lite"),x=require("react-i18next"),O=require("./externalizeComponent-BHZdH14U.cjs"),N=require("@mui/icons-material/Pause"),I=require("@mui/icons-material/PlayArrow"),S=require("@mui/icons-material/Stop"),b=require("@mui/material/Box"),v=require("@mui/material/Button"),f=require("mobx"),m=require("react");var c=(e=>(e.IDLE="idle",e.PREPARING="preparing",e.STARTING="starting",e.RUNNING="running",e.PAUSING="pausing",e.PAUSED="paused",e.STOPPING="stopping",e.COMPLETED="completed",e.FAILED="failed",e.STOPPED="stopped",e.ERROR="error",e))(c||{});const M=O.externalizeComponent(C.observer(({state:e,onRun:t,onPause:n,onStop:s,onReset:a,requiresManualReset:r=!1,variant:o="with_pause",className:h})=>{const l=P.useTheme(),{t:g}=x.useTranslation(),d=()=>{const i={run:{enabled:e==="idle"||e==="stopped"||e==="paused"||e==="completed"||e==="failed"||e==="error",label:g(e==="paused"?"ProgramControl.Resume.bt":e==="error"||e==="failed"?"ProgramControl.Retry.bt":"ProgramControl.Start.bt"),color:l.palette.success.main,onClick:t},pause:{enabled:e==="running",label:g("ProgramControl.Pause.bt"),color:"#FFFFFF33",onClick:n||(()=>{})},stop:{enabled:e==="preparing"||e==="starting"||e==="running"||e==="pausing"||e==="paused",label:g("ProgramControl.Stop.bt"),color:l.palette.error.main,onClick:s}};return o==="without_pause"?[i.run,i.stop]:[i.run,i.pause,i.stop]},E=i=>{const p={sx:{fontSize:"55px"}};if(o==="without_pause")return i===0?u.jsx(I,{...p}):u.jsx(S,{...p});switch(i){case 0:return u.jsx(I,{...p});case 1:return u.jsx(N,{...p});case 2:return u.jsx(S,{...p});default:return null}},A=d();return u.jsx(b,{className:h,sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:2},children:u.jsx(b,{sx:{display:"flex",gap:"40px",flexWrap:"wrap",justifyContent:"center",alignItems:"center"},children:A.map((i,p)=>u.jsxs(b,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:1},children:[u.jsx(v,{variant:"contained",disabled:!i.enabled||e==="preparing"||e==="starting"||e==="pausing"||e==="stopping"&&!r,onClick:i.onClick,sx:{width:"88px",height:"88px",borderRadius:"88px",backgroundColor:i.color,opacity:i.enabled&&e!=="preparing"&&e!=="starting"&&e!=="pausing"&&!(e==="stopping"&&!r)?1:.3,"&:hover":{backgroundColor:i.color,opacity:i.enabled&&e!=="preparing"&&e!=="starting"&&e!=="pausing"&&!(e==="stopping"&&!r)?.8:.3},"&:disabled":{backgroundColor:i.color,opacity:.3},minWidth:"88px",flexShrink:0},children:E(p)}),u.jsx(_,{variant:"body1",sx:{color:i.enabled&&e!=="preparing"&&e!=="starting"&&e!=="pausing"&&!(e==="stopping"&&!r)?i.color:l.palette.text.disabled,textAlign:"center",opacity:i.enabled&&e!=="preparing"&&e!=="starting"&&e!=="pausing"&&!(e==="stopping"&&!r)?1:.3},children:i.label})]},i.label))})})})),Y=O.externalizeComponent(C.observer(({programState:e,safetyState:t,operationMode:n,className:s})=>{const a=P.useTheme(),{t:r}=x.useTranslation(),o=()=>{if(t==="SAFETY_STATE_DEVICE_EMERGENCY_STOP"||t==="SAFETY_STATE_ROBOT_EMERGENCY_STOP"||t==="SAFETY_STATE_STOP_0"||t==="SAFETY_STATE_STOP_1"||t==="SAFETY_STATE_STOP_2"||t==="SAFETY_STATE_PROTECTIVE_STOP"||t==="SAFETY_STATE_STOP"||t==="SAFETY_STATE_REDUCED"||t==="SAFETY_STATE_MASTERING"||t==="SAFETY_STATE_CONFIRM_SAFETY"||t==="SAFETY_STATE_OPERATOR_SAFETY"||t==="SAFETY_STATE_RECOVERY"||t==="SAFETY_STATE_VIOLATION")return{label:r("ProgramStateIndicator.EStop.lb"),color:a.palette.error.main};if(t==="SAFETY_STATE_UNKNOWN"||t==="SAFETY_STATE_FAULT")return{label:r("ProgramStateIndicator.Error.lb"),color:a.palette.error.main};if(t==="SAFETY_STATE_NORMAL")switch(e){case c.PREPARING:return{label:r("ProgramStateIndicator.Preparing.lb"),color:a.palette.warning.main};case c.STARTING:return{label:r("ProgramStateIndicator.Starting.lb"),color:a.palette.warning.main};case c.RUNNING:return{label:r("ProgramStateIndicator.Running.lb"),color:a.palette.success.main};case c.PAUSING:return{label:r("ProgramStateIndicator.Pausing.lb"),color:a.palette.warning.main};case c.PAUSED:return{label:r("ProgramStateIndicator.Paused.lb"),color:a.palette.grey[600]};case c.STOPPING:return{label:r("ProgramStateIndicator.Stopping.lb"),color:a.palette.warning.main};case c.COMPLETED:return{label:r("ProgramStateIndicator.Completed.lb"),color:a.palette.success.main};case c.FAILED:return{label:r("ProgramStateIndicator.Failed.lb"),color:a.palette.error.main};case c.STOPPED:return{label:r("ProgramStateIndicator.Stopped.lb"),color:a.palette.warning.main};case c.ERROR:return{label:r("ProgramStateIndicator.Error.lb"),color:a.palette.error.main};default:return{label:r("ProgramStateIndicator.Ready.lb"),color:a.palette.success.main}}return{label:r("ProgramStateIndicator.Idle.lb"),color:a.palette.grey[600]}},{label:h,color:l}=o(),d=`${h} / ${(()=>{switch(n){case"OPERATION_MODE_AUTO":return r("ProgramStateIndicator.Auto.lb");case"OPERATION_MODE_MANUAL":return r("ProgramStateIndicator.Manual.lb");case"OPERATION_MODE_MANUAL_T1":return r("ProgramStateIndicator.ManualT1.lb");case"OPERATION_MODE_MANUAL_T2":return r("ProgramStateIndicator.ManualT2.lb");default:return r("ProgramStateIndicator.Auto.lb")}})()}`;return u.jsx(V,{className:s,label:u.jsx(_,{variant:"body2",sx:{fontSize:"0.75rem",lineHeight:1.2},children:d}),variant:"filled",sx:{backgroundColor:l,color:a.palette.getContrastText(l),fontWeight:500,height:"auto","& .MuiChip-label":{paddingX:1.5,paddingY:.5}}})}));function T(e){m.useEffect(e,[])}function D(e){T(()=>f.autorun(e))}function U(e,t,n){T(()=>f.reaction(e,t,n))}function w(e){return T(()=>{let t;function n(){e(),t=requestAnimationFrame(n)}return t=requestAnimationFrame(n),()=>{cancelAnimationFrame(t)}})}class F{constructor(t=[],n={}){this.currentValues=[],this.targetValues=[],this.previousTargetValues=[],this.targetUpdateTime=0,this.animationId=null,this.updateCount=0,this.velocities=[],this.animate=()=>{this.update(.016666666666666666)?this.animationId=null:this.animationId=requestAnimationFrame(this.animate)},this.options={tension:120,friction:20,threshold:.001,onChange:()=>{},onComplete:()=>{},...n},this.currentValues=[...t],this.targetValues=[...t],this.previousTargetValues=[...t],this.velocities=new Array(t.length).fill(0),this.targetUpdateTime=performance.now(),this.updateCount=0}update(t=1/60){let n=!1,s=!0;this.updateCount++;const a=Math.min(t,1/15),r=this.updateCount===1?.7:1;for(let o=0;o<this.currentValues.length;o++){const h=this.currentValues[o],l=this.targetValues[o],g=this.velocities[o],d=l-h,E=d*this.options.tension*r,A=g*this.options.friction,i=E-A,p=g+i*a,R=h+p*a;Math.abs(d)<this.options.threshold&&Math.abs(p)<this.options.threshold*10?this.currentValues[o]!==l&&(this.currentValues[o]=l,this.velocities[o]=0,n=!0):(s=!1,this.currentValues[o]=R,this.velocities[o]=p,n=!0)}return n&&this.options.onChange(this.currentValues),s&&this.options.onComplete(this.currentValues),s}setTarget(t){const n=performance.now(),s=n-this.targetUpdateTime;this.previousTargetValues=[...this.targetValues],this.targetValues=[...t],this.targetUpdateTime=n,this.updateCount=0;const a=this.previousTargetValues.every((r,o)=>r===this.currentValues[o]);if(s<8&&s>0&&this.previousTargetValues.length>0&&!a){const r=Math.min(s/8,1);for(let o=0;o<this.targetValues.length;o++){const h=this.previousTargetValues[o]||0,l=t[o]||0;Math.abs(l-h)>.1&&(this.targetValues[o]=h+(l-h)*r)}}for(;this.currentValues.length<t.length;)this.currentValues.push(t[this.currentValues.length]),this.velocities.push(0);this.currentValues.length>t.length&&(this.currentValues=this.currentValues.slice(0,t.length),this.velocities=this.velocities.slice(0,t.length))}getCurrentValues(){return[...this.currentValues]}getValue(t){return this.currentValues[t]??0}isInterpolating(){return this.animationId!==null}stop(){this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null)}setImmediate(t){this.stop(),this.currentValues=[...t],this.targetValues=[...t],this.previousTargetValues=[...t],this.velocities=new Array(t.length).fill(0),this.targetUpdateTime=performance.now(),this.updateCount=0,this.options.onChange(this.currentValues)}updateOptions(t){this.options={...this.options,...t}}startAutoInterpolation(){this.startInterpolation()}destroy(){this.stop()}startInterpolation(){this.animationId===null&&this.animate()}}function j(e=[],t={}){const n=m.useRef(null);return n.current||(n.current=new F(e,t)),m.useEffect(()=>{var s;(s=n.current)==null||s.updateOptions(t)},[t]),m.useEffect(()=>()=>{var s;(s=n.current)==null||s.destroy()},[]),[n.current]}exports.ProgramControl=M;exports.ProgramState=c;exports.ProgramStateIndicator=Y;exports.ValueInterpolator=F;exports.useAnimationFrame=w;exports.useAutorun=D;exports.useInterpolation=j;exports.useMounted=T;exports.useReaction=U;
|
|
@@ -4,7 +4,7 @@ import R from "@mui/material/Chip";
|
|
|
4
4
|
import _ from "@mui/material/Typography";
|
|
5
5
|
import { observer as P } from "mobx-react-lite";
|
|
6
6
|
import { useTranslation as C } from "react-i18next";
|
|
7
|
-
import { e as O } from "./externalizeComponent-
|
|
7
|
+
import { e as O } from "./externalizeComponent-D6S3WLFc.js";
|
|
8
8
|
import x from "@mui/icons-material/Pause";
|
|
9
9
|
import I from "@mui/icons-material/PlayArrow";
|
|
10
10
|
import S from "@mui/icons-material/Stop";
|