@wandelbots/wandelbots-js-react-components 6.3.0 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +185 -124
- package/dist/3d.cjs +1 -1
- package/dist/3d.d.ts +0 -3
- package/dist/3d.js +16 -21
- package/dist/SafetyBar/index.cjs +1 -1
- package/dist/SafetyBar/index.js +1 -1
- package/dist/chunks/ConnectedMotionGroup-BewSDQvD.cjs +4 -0
- package/dist/chunks/ConnectedMotionGroup-D6-4wBkk.js +2654 -0
- package/dist/chunks/Robot-C0uICTOn.js +1271 -0
- package/dist/chunks/Robot-D6RUDXEz.cjs +1 -0
- package/dist/chunks/{SafetyBar-Cy9DiXp9.js → SafetyBar-C2-H1ifP.js} +1 -1
- package/dist/chunks/{SafetyBar-DPrv_OQA.cjs → SafetyBar-Cq_WsuK2.cjs} +1 -1
- package/dist/chunks/externalizeComponent-Bue3-Wra.cjs +2 -0
- package/dist/chunks/{externalizeComponent-EDymnaGR.js → externalizeComponent-C0cVcPE2.js} +29 -107
- package/dist/chunks/useSmoothedMotionState-COMJRcOt.js +214 -0
- package/dist/chunks/useSmoothedMotionState-Con0E5Bx.cjs +1 -0
- package/dist/components/AppHeader.d.ts +1 -1
- package/dist/components/jogging/JoggingCartesianAxisControl.d.ts +1 -1
- package/dist/components/jogging/JoggingJointTab.d.ts +1 -1
- package/dist/components/jogging/JoggingPanel.d.ts +6 -3
- package/dist/components/jogging/JoggingStore.d.ts +5 -1
- package/dist/components/jogging/joggingColors.d.ts +18 -0
- package/dist/components/robots/GenericRobot.d.ts +2 -1
- package/dist/components/robots/LinearAxis.d.ts +1 -1
- package/dist/components/robots/LinearAxisAnimator.d.ts +11 -2
- package/dist/components/robots/Robot.d.ts +1 -1
- package/dist/components/robots/robotModelLogic.d.ts +11 -9
- package/dist/components/utils/hooks.d.ts +1 -6
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +3 -18
- package/dist/core.js +27 -54
- package/dist/index.cjs +1 -1
- package/dist/index.js +39 -71
- package/dist/lib/ConnectedMotionGroup.d.ts +5 -7
- package/dist/lib/JoggerConnection.d.ts +29 -5
- package/dist/lib/MotionStreamConnection.d.ts +4 -6
- package/dist/lib/novaConnection.d.ts +23 -0
- package/package.json +31 -66
- package/dist/Setup.d.ts +0 -11
- package/dist/chunks/MotionGroupVisualizer-DshWR1wY.js +0 -1653
- package/dist/chunks/MotionGroupVisualizer-eD7yFEcF.cjs +0 -1
- package/dist/chunks/externalizeComponent-OO4jcrz5.cjs +0 -2
- package/dist/chunks/theming-DfSy4-Ic.cjs +0 -4
- package/dist/chunks/theming-mF9Rt8SS.js +0 -5542
- package/dist/chunks/useSmoothedMotionState-DyDgSVYX.js +0 -478
- package/dist/chunks/useSmoothedMotionState-VYxEIyfr.cjs +0 -1
- package/dist/components/3d-viewport/CoordinateSystemTransform.d.ts +0 -11
- package/dist/components/AdornedTextField.d.ts +0 -7
- package/dist/components/CopyableText.d.ts +0 -6
- package/dist/components/CycleTimer/CycleTimer.d.ts +0 -3
- package/dist/components/CycleTimer/DefaultVariant.d.ts +0 -9
- package/dist/components/CycleTimer/SmallVariant.d.ts +0 -10
- package/dist/components/CycleTimer/index.d.ts +0 -27
- package/dist/components/CycleTimer/types.d.ts +0 -49
- package/dist/components/CycleTimer/useAnimations.d.ts +0 -14
- package/dist/components/CycleTimer/useTimerLogic.d.ts +0 -24
- package/dist/components/CycleTimer/utils.d.ts +0 -21
- package/dist/components/CycleTimer.d.ts +0 -3
- package/dist/components/DataGrid.d.ts +0 -66
- package/dist/components/LogPanel.d.ts +0 -38
- package/dist/components/LogStore.d.ts +0 -12
- package/dist/components/LogViewer.d.ts +0 -46
- package/dist/components/ProgramControl.d.ts +0 -55
- package/dist/components/ProgramStateIndicator.d.ts +0 -26
- package/dist/components/RobotCard.d.ts +0 -98
- package/dist/components/RobotListItem.d.ts +0 -34
- package/dist/components/RobotSetupReadinessIndicator.d.ts +0 -37
- package/dist/components/SelectableFab.d.ts +0 -7
- package/dist/components/TabBar.d.ts +0 -45
- package/dist/components/ThemeSelect.d.ts +0 -6
- package/dist/components/Timer/Timer.d.ts +0 -3
- package/dist/components/Timer/TimerDefaultVariant.d.ts +0 -9
- package/dist/components/Timer/TimerSmallVariant.d.ts +0 -10
- package/dist/components/Timer/index.d.ts +0 -19
- package/dist/components/Timer/types.d.ts +0 -35
- package/dist/components/Timer/useTimerAnimations.d.ts +0 -10
- package/dist/components/Timer/useTimerLogic.d.ts +0 -19
- package/dist/components/Timer/utils.d.ts +0 -17
- package/dist/components/Timer.d.ts +0 -3
- package/dist/components/TransparentOverlay.d.ts +0 -4
- package/dist/components/jogging/JoggingFreedriveTab.d.ts +0 -1
- package/dist/components/jogging/PoseCartesianValues.d.ts +0 -9
- package/dist/components/jogging/PoseJointValues.d.ts +0 -8
- package/dist/components/robots/AxisConfig.d.ts +0 -2
- package/dist/components/robots/manufacturerHomePositions.d.ts +0 -20
- package/dist/icons/DropdownArrowIcon.d.ts +0 -2
- package/dist/icons/index.d.ts +0 -12
- package/dist/lib/novaCompat.d.ts +0 -16
- package/dist/themes/createDarkTheme.d.ts +0 -7
- package/dist/themes/themeTypes.d.ts +0 -40
- package/dist/themes/theming.d.ts +0 -24
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const o=require("react/jsx-runtime"),w=require("three"),V=require("three-stdlib"),S=require("@react-three/drei"),m=require("react"),v=require("./externalizeComponent-Bue3-Wra.cjs"),O=require("@wandelbots/nova-js/v2"),L=require("./useSmoothedMotionState-Con0E5Bx.cjs"),N=require("react-error-boundary"),D=require("@react-three/fiber");function oe(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const R=oe(w);function re(e){switch(e.shape_type){case"convex_hull":return new V.ConvexGeometry(e.vertices.map(t=>new R.Vector3(t[0]/1e3,t[1]/1e3,t[2]/1e3)));case"box":return new R.BoxGeometry(e.size_x/1e3,e.size_y/1e3,e.size_z/1e3);case"sphere":return new R.SphereGeometry(e.radius/1e3);case"capsule":return new R.CapsuleGeometry(e.radius/1e3,e.cylinder_height/1e3);case"cylinder":return new R.CylinderGeometry(e.radius/1e3,e.radius/1e3,e.height/1e3);case"rectangle":return new R.BoxGeometry(e.size_x/1e3,e.size_y/1e3,0);default:return console.warn(`${e.shape_type} is not supported`),new R.BufferGeometry}}function ie({name:e,collider:n,children:t}){var c,l;const r=((c=n.pose)==null?void 0:c.position)??[0,0,0],i=((l=n.pose)==null?void 0:l.orientation)??[0,0,0];return n.margin&&console.warn(`${e} margin is not supported`),o.jsx("mesh",{name:e,position:new R.Vector3(r[0],r[1],r[2]).divideScalar(1e3),rotation:new R.Euler(i[0],i[1],i[2],"XYZ"),geometry:re(n.shape),children:t})}function se({name:e,colliders:n,meshChildrenProvider:t,...r}){return o.jsx("group",{name:e,...r,children:Object.entries(n).map(([i,c])=>o.jsx(ie,{name:i,collider:c,children:t(i,c)},i))})}function ae({scene:e,meshChildrenProvider:n}){const t=e.colliders;return o.jsx("group",{children:t&&o.jsx(se,{meshChildrenProvider:n,colliders:t})})}function ce(e){const n=(e==null?void 0:e.position)??[],t=(e==null?void 0:e.orientation)??[],r=new w.Vector3(t[0]??0,t[1]??0,t[2]??0),i=r.length(),c=i>0?new w.Quaternion().setFromAxisAngle(r.normalize(),i):new w.Quaternion;return new w.Matrix4().compose(new w.Vector3(n[0]??0,n[1]??0,n[2]??0).divideScalar(1e3),c,new w.Vector3(1,1,1))}function le(e,n=null,t=[]){const r=ce(n);return e.map((i,c)=>{const l=r.clone(),s=(i.reverse_rotation_direction?-1:1)*(t[c]??0),a=i.type==="PRISMATIC_JOINT",f=(i.theta??0)+(a?0:s),p=(i.d??0)+(a?s:0);return r.multiply(new w.Matrix4().makeRotationZ(f)).multiply(new w.Matrix4().makeTranslation((i.a??0)/1e3,0,p/1e3)).multiply(new w.Matrix4().makeRotationX(i.alpha??0)),l})}const A="#ff4b4b",F="#2fa8ff",ue="#8a8d9e",fe=96,pe=.15,me=new R.Vector3(0,1,0),he=.2,de=2;function xe(e){const{lower_limit:n,upper_limit:t}=e??{};return typeof n!="number"||typeof t!="number"||!Number.isFinite(n)||!Number.isFinite(t)||!(n<t)?null:{lower_limit:n,upper_limit:t}}function P({base:e,direction:n,size:t,color:r,opacity:i}){const c=new R.Quaternion().setFromUnitVectors(me,n.clone().normalize()),l=e.clone().addScaledVector(n.clone().normalize(),t/2);return o.jsxs("mesh",{position:l,quaternion:c,renderOrder:10,children:[o.jsx("coneGeometry",{args:[t*.35,t,16]}),o.jsx("meshBasicMaterial",{color:r,depthTest:!1,transparent:!0,opacity:i})]})}function k({points:e,color:n,width:t,opacity:r}){return o.jsx(S.Line,{points:e,color:n,lineWidth:t,depthTest:!1,transparent:!0,opacity:r,renderOrder:10})}function J(e,n){const t=[...e];let r=n;for(;t.length>1;){const i=t[t.length-1],c=t[t.length-2],l=i.distanceTo(c);if(l>r)return t[t.length-1]=i.clone().lerp(c,r/l),t;r-=l,t.pop()}return t}function ge(e,n,t,r){const i=t*e,c=t*n,l=Math.abs(c-i),s=Math.max(2,Math.ceil(l/(2*Math.PI)*fe));return Array.from({length:s+1},(a,f)=>{const p=i+(c-i)*f/s,u=l*f/s/(2*Math.PI),y=r*(1+pe*u);return new R.Vector3(Math.cos(p)*y,Math.sin(p)*y,0)})}function ye(e,n,t,r){const i=e.theta??0,c=e.d??0,l=e.type==="PRISMATIC_JOINT",s=e.reverse_rotation_direction?-1:1,{lower_limit:a,upper_limit:f}=n;return m.useMemo(()=>{const p=new R.Matrix4().makeRotationZ(i).multiply(new R.Matrix4().makeTranslation(0,0,l?c/1e3:0)),u=(M,_,T)=>new R.Vector3(M,_,T).applyMatrix4(p),y=new R.Vector3().applyMatrix4(p),j=u(0,0,t),d=(l?[u(t*.25,0,s*a/1e3),u(t*.25,0,s*f/1e3)]:ge(a,f,s,t*.6)).map(M=>l?M:M.applyMatrix4(p)),h=u(l?t*.25:t*.6,0,0),b=d.slice(1).reduce((M,_,T)=>M+_.distanceTo(d[T]),0),x=Math.min(r,b/3),g=J(J(d,x).reverse(),x).reverse();return{axisPoints:[y,j],axisTip:j,origin:y,restPoints:[y,h],range:d,limitPoints:g,rangeStart:g[0],rangeEnd:g[g.length-1]}},[i,c,l,s,t,a,f,r])}function je({frame:e,dh:n,limit:t,size:r,emphasis:i}){const c=i==="highlighted"?de:1,l=i==="dimmed"?he:1,s=r*.2*(i==="highlighted"?1.4:1),a=2*c,{axisPoints:f,axisTip:p,origin:u,restPoints:y,range:j,limitPoints:d,rangeStart:h,rangeEnd:b}=ye(n,t,r,s),{position:x,quaternion:g}=m.useMemo(()=>{const M=new R.Vector3,_=new R.Quaternion;return e.decompose(M,_,new R.Vector3),{position:M,quaternion:_}},[e]);return o.jsxs("group",{position:x,quaternion:g,children:[o.jsx(k,{points:f,color:F,width:a,opacity:l}),o.jsx(P,{base:p,direction:p.clone().sub(u),size:s,color:F,opacity:l}),o.jsx(k,{points:y,color:ue,width:1.5*c,opacity:l}),o.jsx(k,{points:d,color:A,width:a,opacity:l}),o.jsx(P,{base:h,direction:j[0].clone().sub(h),size:h.distanceTo(j[0]),color:A,opacity:l}),o.jsx(P,{base:b,direction:j[j.length-1].clone().sub(b),size:b.distanceTo(j[j.length-1]),color:A,opacity:l})]})}function we({dhParameters:e,chainOffset:n=null,limits:t,jointPositions:r,size:i=.15,highlightedJoint:c=null}){const l=m.useMemo(()=>le(e,n,r),[e,n,r]);return o.jsx("group",{children:l.map((s,a)=>{const f=xe(t[a]);return f?o.jsx(je,{frame:s,dh:e[a],limit:f,size:i,emphasis:c===null?"normal":c===a?"highlighted":"dimmed"},a):null})})}function Re(){return o.jsx(S.Environment,{frames:1,children:o.jsx(Me,{})})}const be=[2,0,2,0,2,0,2,0];function Me({positions:e=be}){return o.jsxs(o.Fragment,{children:[o.jsx(S.Lightformer,{intensity:5,"rotation-x":Math.PI/2,position:[0,5,-9],scale:[10,10,1]}),o.jsx("group",{rotation:[0,.5,0],children:o.jsx("group",{children:e.map((n,t)=>o.jsx(S.Lightformer,{form:"circle",intensity:5,rotation:[Math.PI/2,0,0],position:[n,4,t*4],scale:[3,1,1]},t))})}),o.jsx(S.Lightformer,{intensity:40,"rotation-y":Math.PI/2,position:[-5,1,-1],scale:[20,.1,1]}),o.jsx(S.Lightformer,{intensity:20,"rotation-y":-Math.PI,position:[-5,-2,-1],scale:[20,.1,1]}),o.jsx(S.Lightformer,{"rotation-y":Math.PI/2,position:[-5,-1,-1],scale:[20,.5,1],intensity:5}),o.jsx(S.Lightformer,{"rotation-y":-Math.PI/2,position:[10,1,0],scale:[20,1,1],intensity:10}),o.jsx(S.Lightformer,{form:"ring",color:"white",intensity:5,scale:10,position:[-15,4,-18],target:[0,0,0]})]})}const q={attach:"material",color:"#009f4d",opacity:.2,depthTest:!1,depthWrite:!1,transparent:!0,polygonOffset:!0};function Se({safetyZones:e,dhParameters:n,...t}){const r=m.useMemo(()=>v.dhParametersToPlaneSize(n??[]),[n]),i=(l,s)=>{var y,j;if(!((y=s==null?void 0:s.pose)!=null&&y.position)||!((j=s==null?void 0:s.pose)!=null&&j.orientation))return null;const a=new R.Vector3(s.pose.position[0]/1e3,s.pose.position[1]/1e3,s.pose.position[2]/1e3),f=new R.Vector3(s.pose.orientation[0],s.pose.orientation[1],s.pose.orientation[2]);let p;const u=s.shape.shape_type==="plane"?{...q,side:R.DoubleSide}:{...q,side:R.FrontSide};switch(s.shape.shape_type){case"plane":p=o.jsx("planeGeometry",{args:[r,r]});break;case"sphere":{const d=(s==null?void 0:s.shape).radius/1e3;p=o.jsx("sphereGeometry",{args:[d]});break}case"capsule":{const d=(s==null?void 0:s.shape).radius/1e3,h=(s==null?void 0:s.shape).cylinder_height/1e3;p=o.jsx("capsuleGeometry",{args:[d,h]});break}case"convex_hull":{const d=(s==null?void 0:s.shape).vertices.map(b=>new R.Vector3(b[0]/1e3,b[1]/1e3,b[2]/1e3)),h=v.verticesToCoplanarity(d);if(h.isCoplanar&&h.normal){const x=new R.Vector3().addVectors(d[0],h.normal.multiplyScalar(1e-4));d.push(x)}try{p=o.jsx("primitive",{object:new V.ConvexGeometry(d),attach:"geometry"})}catch(b){return console.log("Error creating ConvexGeometry:",b),null}break}case"rectangular_capsule":{const d=s.shape,h=d.radius/1e3,b=d.sphere_center_distance_x/1e3,x=d.sphere_center_distance_y/1e3,g=h*2;p=o.jsx("primitive",{object:new V.RoundedBoxGeometry(b,x,g,2,h),attach:"geometry"});break}default:console.warn("Unsupported safety zone shape type:",s.shape.shape_type),p=null}return o.jsxs("mesh",{renderOrder:l,position:a,quaternion:v.orientationToQuaternion(f),children:[p,o.jsx("meshStandardMaterial",{...u,polygonOffsetFactor:-l})]},`safety-zone-${s.shape.shape_type}-${l}`)},c=m.useMemo(()=>Object.values(e??{}).map((l,s)=>i(s,l)),[e,r]);return o.jsx("group",{...t,children:c})}function _e({trajectory:e,...n}){const t=(e==null?void 0:e.map(r=>{if(r.position&&r.position.length>=3){const[i,c,l]=r.position;if(Number.isFinite(i)&&Number.isFinite(c)&&Number.isFinite(l))return new R.Vector3(i/1e3,l/1e3,-c/1e3)}return null}).filter(r=>r!==null))||[];return o.jsx("group",{...n,children:t.length>0&&o.jsx(S.Line,{points:t,lineWidth:3,polygonOffset:!0,polygonOffsetFactor:10,polygonOffsetUnits:10})})}const G=new Map;async function E(e,n){const t=n||"";if(!t)throw new Error(`Cannot download the model "${e}": no NOVA instance. Give defaultGetModel the URL of the instance or a NOVA client, or give the component its instanceUrl or getModel.`);const r=`${ve(t)} ${e}`,i=G.get(r);if(i)return i;const c=(async()=>{const l=L.createNovaClient(t);try{const s=await l.api.motionGroupModels.getMotionGroupGlbModel(e,{responseType:"blob"});return URL.createObjectURL(s)}catch(s){throw console.error("Failed to fetch model:",s),s}})();return G.set(r,c),c.catch(()=>{G.get(r)===c&&G.delete(r)}),c}function ve(e){return typeof e=="string"?e:e.config.instanceUrl}function $(e){function n(t){return t.children.length===0?[t]:[t,...t.children.flatMap(r=>n(r))]}return n(e).filter(t=>U(t))}function Q(e){return e.name.endsWith("_FLG")}function U(e){return/_J[0-9]+$/.test(e.name)}function Te(e,n){let t;function r(i){if(Q(i)){if(t)throw Error(`Found multiple flange groups in robot model ${n}; first ${t.name} then ${i.name}. Only one _FLG group is allowed.`);t=i}U(i),i.children.map(r)}if(r(e.scene),!t)throw Error(`No flange group found in robot model ${n}. Flange must be identified with a name ending in _FLG.`);return{gltf:e}}const W=m.forwardRef(function({rapidlyChangingMotionState:n,dhParameters:t,chainOffsetPosition:r,chainOffsetQuaternion:i,onTranslationChanged:c,children:l},s){const a=m.useRef(null),f=m.useRef([]),p=m.useRef(n.joint_position.filter(x=>x!==void 0)),{invalidate:u}=D.useThree(),y=m.useRef(n);y.current=n;function j(x){a.current=x,x&&d()}function d(){a.current&&(f.current=$(a.current),h(),u())}m.useImperativeHandle(s,()=>({recollectJoints:d}));function h(){const x=p.current;if(c)c(f.current,x);else for(const[g,M]of f.current.entries()){const T=t[g].reverse_rotation_direction?-1:1;M.position.y=T*(x[g]||0)/1e3}}function b(x){p.current=x.joint_position.filter(g=>g!==void 0),h(),u()}return L.useAutorun(()=>{b(y.current)}),o.jsx("group",{ref:j,position:r,quaternion:i,children:l})});function H({rapidlyChangingMotionState:e,dhParameters:n,...t}){const r=new w.Matrix4,i=m.useRef(null),c=m.useRef(null);function l(f){const p=new w.Matrix4;for(let d=0;d<n.length;d++){const h=n[d],b=f[d]??0,x=new w.Matrix4().makeRotationY(h.theta).multiply(new w.Matrix4().makeTranslation(h.a/1e3,(h.d+b*(h.reverse_rotation_direction?-1:1))/1e3,0)).multiply(new w.Matrix4().makeRotationX(h.alpha));p.multiply(x)}const u=new w.Vector3,y=new w.Quaternion,j=new w.Vector3;return p.decompose(u,y,j),u}const s=l(e.joint_position);function a(f,p){r.identity();let u=new w.Vector3;for(let h=0;h<n.length;h++){const b=p[h]??0,x=n[h],g=new w.Matrix4().makeRotationY(x.theta).multiply(new w.Matrix4().makeTranslation(x.a/1e3,(x.d+b*(x.reverse_rotation_direction?-1:1))/1e3,0)).multiply(new w.Matrix4().makeRotationX(x.alpha));r.multiply(g)}const y=new w.Vector3,j=new w.Quaternion,d=new w.Vector3;if(r.decompose(y,j,d),u=y,i.current&&i.current.position.set(u.x,u.y,u.z),c.current){const h=c.current.geometry;h!=null&&h.setPositions&&h.setPositions([0,0,0,u.x,u.y,u.z])}}return o.jsx(W,{rapidlyChangingMotionState:e,dhParameters:n,onTranslationChanged:a,children:o.jsxs("group",{...t,name:"Scene",children:[o.jsxs("mesh",{name:"Base",position:[0,0,0],children:[o.jsx("sphereGeometry",{args:[.02,32,32]}),o.jsx("meshStandardMaterial",{color:"green",depthTest:!0})]}),o.jsx(S.Line,{ref:c,points:[new w.Vector3(0,0,0),s],color:"White",lineWidth:5}),o.jsxs("mesh",{ref:i,name:"TCP",position:s,children:[o.jsx("sphereGeometry",{args:[.025,32,32]}),o.jsx("meshStandardMaterial",{color:"red",depthTest:!0})]})]})})}const Le=console.warn;function B(){return m.useEffect(()=>{console.warn=e=>{e!=="Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"&&Le(e)}},[]),null}function Ee(e){return e.type==="Mesh"}function Oe({url:e,flangeRef:n,postModelRender:t,...r}){const i=S.useGLTF(e),l=Te(i,"robot.glb").gltf;m.useEffect(()=>{t==null||t()},[e,t]);function s(a){try{return Ee(a)?a.geometry?o.jsx("mesh",{name:a.name,geometry:a.geometry,material:a.material,position:a.position,rotation:a.rotation},a.uuid):o.jsx("group",{name:a.name,position:a.position,rotation:a.rotation},a.uuid):o.jsx("group",{name:a.name,position:a.position,rotation:a.rotation,ref:Q(a)?n:void 0,children:a.children.map(s)},a.uuid)}catch(f){return console.warn("Error rendering node",a.name,f),null}}return o.jsx("group",{...r,dispose:null,children:s(l.scene)})}function X({modelURL:e,flangeRef:n,postModelRender:t,...r}){const[i,c]=m.useState(null);return m.useEffect(()=>{let l=!1;return(async()=>{try{const a=typeof e=="string"?e:await e;l||c(f=>f===a?f:a)}catch(a){console.error("Failed to resolve model URL:",a)}})(),()=>{l=!0}},[e]),i?o.jsx(Oe,{url:i,flangeRef:n,postModelRender:t,...r}):null}const Y=(e,n)=>{e.userData.isGhost||(e.traverse(t=>{if(t instanceof R.Mesh){t.material instanceof R.Material&&(t.material.colorWrite=!1);const r=t.clone(),i=t.clone();r.material=new R.MeshStandardMaterial({depthTest:!0,depthWrite:!0,colorWrite:!1,polygonOffset:!0,polygonOffsetFactor:-1,side:R.DoubleSide}),r.userData.isGhost=!0,i.material=new R.MeshStandardMaterial({color:n,opacity:.3,depthTest:!0,depthWrite:!1,transparent:!0,polygonOffset:!0,polygonOffsetFactor:-2,side:R.DoubleSide}),i.userData.isGhost=!0,t.parent&&(t.parent.add(r),t.parent.add(i))}}),e.userData.isGhost=!0)},Z=e=>{if(!e.userData.isGhost)return;const n=[];e.traverse(t=>{var r;t instanceof R.Mesh&&((r=t.userData)!=null&&r.isGhost?n.push(t):t.material instanceof R.Material&&(t.material.colorWrite=!0))}),n.forEach(t=>{t.parent&&t.parent.remove(t)}),e.userData.isGhost=!1},C=v.externalizeComponent(({rapidlyChangingMotionState:e,modelFromController:n,dhParameters:t,chainOffsetPosition:r,chainOffsetQuaternion:i,getModel:c=E,flangeRef:l,postModelRender:s,transparentColor:a,instanceUrl:f,...p})=>{const[u,y]=m.useState(null),j=m.useRef(null),d=m.useCallback(g=>{y(g)},[]),h=m.useCallback(()=>{var g;(g=j.current)==null||g.recollectJoints(),s==null||s()},[s]);m.useEffect(()=>{u&&(a?Y(u,a):Z(u))},[u,a]);const b=m.useMemo(()=>{const g=c(n,f);if(!g){const M=new Blob([],{type:"model/gltf-binary"}),_=new File([M],`${n}.glb`,{type:"model/gltf-binary"});return Promise.resolve(URL.createObjectURL(_))}return g},[n,f,c]),x=o.jsx(H,{rapidlyChangingMotionState:e,dhParameters:t,...p});return o.jsxs(N.ErrorBoundary,{fallback:x,onError:g=>{console.warn(g)},children:[o.jsx(m.Suspense,{fallback:x,children:o.jsx("group",{ref:d,children:o.jsx(W,{ref:j,rapidlyChangingMotionState:e,dhParameters:t,chainOffsetPosition:r,chainOffsetQuaternion:i,children:o.jsx(X,{modelURL:b,postModelRender:h,flangeRef:l,...p})})})}),o.jsx(B,{})]})}),K=v.externalizeComponent(({rapidlyChangingMotionState:e,...n})=>{const t=L.useSmoothedMotionState(e);return o.jsx(C,{rapidlyChangingMotionState:t,...n})});function Ge({connectedMotionGroup:e,getModel:n,flangeRef:t,transparentColor:r,postModelRender:i,...c}){const l=m.useCallback(y=>E(y,e.nova),[e]),s=n??l;if(!e.dhParameters)return null;const a=e.mountingPosition,f=e.mountingQuaternion,p=e.modelFromController||"";return p?o.jsx(K,{rapidlyChangingMotionState:e.rapidlyChangingMotionState,modelFromController:p,dhParameters:e.dhParameters,getModel:s,flangeRef:t,transparentColor:r,postModelRender:i,chainOffsetPosition:a,chainOffsetQuaternion:f,...c}):o.jsx(H,{rapidlyChangingMotionState:e.rapidlyChangingMotionState,dhParameters:e.dhParameters,chainOffsetPosition:a,chainOffsetQuaternion:f,...c})}const z=m.forwardRef(function({rapidlyChangingMotionState:n,dhParameters:t,chainOffsetPosition:r,chainOffsetQuaternion:i,onRotationChanged:c,children:l},s){const a=m.useRef(null),f=m.useRef([]),p=m.useRef(n.joint_position.filter(x=>x!==void 0)),{invalidate:u}=D.useThree(),y=m.useRef(n);y.current=n;function j(x){a.current=x,x&&d()}function d(){a.current&&(f.current=$(a.current),h(),u())}m.useImperativeHandle(s,()=>({recollectJoints:d}));function h(){const x=p.current;if(c)c(f.current,x);else for(const[g,M]of f.current.entries()){const _=t[g],T=_.theta||0,ne=_.reverse_rotation_direction?-1:1;M.rotation.y=ne*(x[g]||0)+T}}function b(x){p.current=x.joint_position.filter(g=>g!==void 0),h(),u()}return L.useAutorun(()=>{b(y.current)}),m.useEffect(()=>{b(n)},[n]),o.jsx("group",{ref:j,position:r,quaternion:i,children:l})}),Ae="line",Pe="mesh";function ke({rapidlyChangingMotionState:e,dhParameters:n,...t}){const r=new w.Matrix4,i=m.useRef([]),c=m.useRef([]);m.useEffect(()=>{i.current=new Array(n.length).fill(null),c.current=new Array(n.length).fill(null)},[n.length]);function l(f,p){const u=new w.Vector3,y=new w.Quaternion,j=new w.Vector3;r.decompose(u,y,j);const d=u.clone(),h=new w.Matrix4().makeRotationY(f.theta+p*(f.reverse_rotation_direction?-1:1)).multiply(new w.Matrix4().makeTranslation(0,f.d/1e3,0)).multiply(new w.Matrix4().makeTranslation(f.a/1e3,0,0)).multiply(new w.Matrix4().makeRotationX(f.alpha));return r.multiply(h),r.decompose(u,y,j),{a:d,b:u}}function s(f,p,u,y){if(!n)return;const j=n[f];if(!j)return;const{a:d,b:h}=l(j,y);p.geometry.setPositions([d.toArray(),h.toArray()].flat()),u.position.set(h.x,h.y,h.z)}function a(f,p){r.identity();for(let u=0;u<Math.min(f.length,p.length);u++){const y=i.current[u],j=c.current[u];y&&j&&s(u,y,j,p[u])}}return o.jsx(z,{rapidlyChangingMotionState:e,dhParameters:n,onRotationChanged:a,children:o.jsxs("group",{...t,name:"Scene",children:[o.jsxs("mesh",{children:[o.jsx("sphereGeometry",{args:[.01,32,32]}),o.jsx("meshStandardMaterial",{color:"black",depthTest:!0})]}),n==null?void 0:n.map((f,p)=>{const{a:u,b:y}=l(f,e.joint_position[p]??0),j=`dhrobot_J0${p}`;return o.jsxs("group",{name:j,children:[o.jsx(S.Line,{ref:d=>{i.current[p]=d},name:Ae,points:[u,y],color:"white",lineWidth:5}),o.jsxs("mesh",{ref:d=>{c.current[p]=d},name:Pe,position:y,children:[o.jsx("sphereGeometry",{args:[.01,32,32]}),o.jsx("meshStandardMaterial",{color:"black",depthTest:!0})]},`mesh_${p}`)]},j)})]})})}const I=v.externalizeComponent(({rapidlyChangingMotionState:e,modelFromController:n,dhParameters:t,chainOffsetPosition:r,chainOffsetQuaternion:i,getModel:c=E,flangeRef:l,postModelRender:s,transparentColor:a,instanceUrl:f,...p})=>{const[u,y]=m.useState(null),j=m.useRef(null),d=m.useCallback(g=>{y(g)},[]),h=m.useCallback(()=>{var g;(g=j.current)==null||g.recollectJoints(),s==null||s()},[s]);m.useEffect(()=>{u&&(a?Y(u,a):Z(u))},[u,a]);const b=m.useMemo(()=>{const g=c(n,f);if(!g)throw new Error(`No model found for robot "${n}". Ensure the model is available or provide a custom getModel function.`);return g},[n,f,c]),x=o.jsx(ke,{rapidlyChangingMotionState:e,dhParameters:t,...p});return o.jsxs(N.ErrorBoundary,{fallback:x,onError:g=>{console.warn(g)},children:[o.jsx(m.Suspense,{fallback:x,children:o.jsx("group",{ref:d,children:o.jsx(z,{ref:j,rapidlyChangingMotionState:e,dhParameters:t,chainOffsetPosition:r,chainOffsetQuaternion:i,children:o.jsx(X,{modelURL:b,postModelRender:h,flangeRef:l,...p})})})}),o.jsx(B,{})]})}),ee=v.externalizeComponent(({rapidlyChangingMotionState:e,...n})=>{const t=L.useSmoothedMotionState(e);return o.jsx(I,{rapidlyChangingMotionState:t,...n})}),te=v.externalizeComponent(e=>{const{inverseSolver:n,dhParameters:t,...r}=e,[i,c]=m.useState(O.JointTypeEnum.RevoluteJoint);m.useEffect(()=>{t.length&&c(t[0].type??O.JointTypeEnum.RevoluteJoint)},[t]);const l=m.useMemo(()=>n===null&&i===O.JointTypeEnum.RevoluteJoint,[n,i]),s=m.useMemo(()=>n===null&&i===O.JointTypeEnum.PrismaticJoint,[n,i]);return m.useMemo(()=>!!n,[n])||l?o.jsx(I,{dhParameters:t,...r}):s?o.jsx(C,{dhParameters:t,...r}):null}),Ve=v.externalizeComponent(e=>{const n=L.useSmoothedMotionState(e.rapidlyChangingMotionState);return o.jsx(te,{...e,rapidlyChangingMotionState:n})});function Ce({connectedMotionGroup:e,getModel:n,flangeRef:t,transparentColor:r,postModelRender:i,...c}){const l=m.useCallback(f=>E(f,e.nova),[e]);if(!e.dhParameters)return null;const s=e.mountingPosition,a=e.mountingQuaternion;return o.jsx(ee,{rapidlyChangingMotionState:e.rapidlyChangingMotionState,modelFromController:e.modelFromController||"",dhParameters:e.dhParameters,getModel:n??l,flangeRef:t,transparentColor:r,postModelRender:i,chainOffsetPosition:s,chainOffsetQuaternion:a,...c})}exports.CollisionSceneRenderer=ae;exports.JointLimitGizmo=we;exports.LinearAxis=Ge;exports.MotionGroupVisualizer=Ve;exports.MotionGroupVisualizerExact=te;exports.PresetEnvironment=Re;exports.Robot=Ce;exports.SafetyZonesRenderer=Se;exports.SupportedLinearAxis=K;exports.SupportedLinearAxisExact=C;exports.SupportedRobot=ee;exports.SupportedRobotExact=I;exports.TrajectoryRenderer=_e;exports.defaultGetModel=E;
|
|
@@ -2,7 +2,7 @@ import { jsxs as m, Fragment as x, jsx as n } from "react/jsx-runtime";
|
|
|
2
2
|
import b from "@mui/material/Divider";
|
|
3
3
|
import u from "@mui/material/Stack";
|
|
4
4
|
import { observer as f, useLocalObservable as _ } from "mobx-react-lite";
|
|
5
|
-
import { t as R, e as O } from "./externalizeComponent-
|
|
5
|
+
import { t as R, e as O } from "./externalizeComponent-C0cVcPE2.js";
|
|
6
6
|
import { useTheme as y } from "@mui/material/styles";
|
|
7
7
|
import * as r from "react";
|
|
8
8
|
import { forwardRef as d, useId as v } from "react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const r=require("react/jsx-runtime"),m=require("@mui/material/Divider"),E=require("@mui/material/Stack"),f=require("mobx-react-lite"),x=require("./externalizeComponent-OO4jcrz5.cjs"),y=require("@mui/material/styles"),c=require("react"),d=require("react-i18next"),A=require("@mui/material/Popover"),g=require("@mui/material/SvgIcon"),h=require("@mui/material/Typography"),T=require("axios");function M(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,n.get?n:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const l=M(c);function _(e,t){throw new Error(`${t} ${JSON.stringify(e)}`)}function R(e){var t,a,n,o;return e instanceof T.AxiosError&&e.code==="ERR_NETWORK"?"Failed to connect to the server. Please check your internet connection.":e instanceof T.AxiosError&&e.response?`${(t=e.response)==null?void 0:t.status} ${(a=e.response)==null?void 0:a.statusText} from ${(n=e.response)==null?void 0:n.config.url}: ${JSON.stringify((o=e.response)==null?void 0:o.data)}`:e instanceof Error?e.message:`Unexpected error: ${x.tryStringifyJson(e)||e}`}const O=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M5.248 21c-.334 0-.619-.116-.853-.35a1.153 1.153 0 0 1-.351-.848c0-.333.117-.616.351-.85.234-.233.519-.35.853-.35H7.24L4.558 9.87a2.881 2.881 0 0 1-1.126-1.042A2.77 2.77 0 0 1 3 7.317c0-.793.28-1.467.838-2.023a2.774 2.774 0 0 1 2.033-.834 2.71 2.71 0 0 1 1.728.585c.494.389.832.887 1.014 1.493h3.58V5.239c0-.22.076-.406.226-.555a.76.76 0 0 1 .558-.224c.136 0 .263.035.381.104.118.07.209.167.273.292v.14l1.835-1.702a.979.979 0 0 1 .52-.279.881.881 0 0 1 .58.091l4.01 1.85a.74.74 0 0 1 .36.364.537.537 0 0 1-.002.474.592.592 0 0 1-.366.323.657.657 0 0 1-.477-.039l-3.858-1.774L13.76 6.59v1.454l2.473 2.233 3.858-1.774a.648.648 0 0 1 .485-.03.571.571 0 0 1 .358.314.513.513 0 0 1 .01.482.79.79 0 0 1-.367.357l-4.011 1.882a.881.881 0 0 1-.58.09.979.979 0 0 1-.52-.278L13.63 9.638v.14a.92.92 0 0 1-.273.275.665.665 0 0 1-.381.12.76.76 0 0 1-.558-.224.752.752 0 0 1-.225-.555V8.096h-3.58a2.82 2.82 0 0 1-.215.54 2.552 2.552 0 0 1-.323.479l5.139 9.488h2.673c.335 0 .62.116.854.35.234.233.35.516.35.849 0 .332-.116.615-.35.849a1.167 1.167 0 0 1-.854.349H5.248Zm.623-12.385c.362 0 .67-.126.924-.378a1.25 1.25 0 0 0 .38-.92 1.25 1.25 0 0 0-.38-.92 1.261 1.261 0 0 0-.924-.379 1.26 1.26 0 0 0-.925.379 1.25 1.25 0 0 0-.38.92c0 .36.127.667.38.92.254.252.562.378.925.378Z"})),j=c.forwardRef(O),B=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"m13.37 9.12 1.69 1.69 2.99-2.99-3.73-3.73-.95-.95-7.66 7.66-.95.95 3.99 3.99v3.44h7.55v-3.55l-4.72-4.72 1.79-1.79Zm-.91-2.99.91-.91 2.6 2.6-.91.91-2.6-2.6Zm-2.25 10.24h3.74l-1.34-1.34-.04-.04h-2.5l-3.25-3.25 4.59-4.59.92.92L9.5 10.9l5.33 5.33v1.48H10.2v-1.35l.01.01ZM2 2v4.99h1.41V3.4h3.58V2H2ZM22.21 2h-4.98v1.41h3.59v3.58h1.4V2h-.01ZM20.81 20.65h-3.58v1.4h4.98v-4.99h-1.4v3.59ZM3.4 17.06H2v4.98h4.99v-1.4H3.4v-3.58Z"})),F=c.forwardRef(B),p=f.observer(({id:e,icon:t,color:a,title:n,name:o,label:s,explanation:i,literalValue:S,anchorOrigin:b,transformOrigin:v})=>{const u=f.useLocalObservable(()=>({anchorEl:null,get isPopoverOpen(){return!!u.anchorEl},openPopover(w){u.anchorEl=w.currentTarget},closePopover(){u.anchorEl=null}}));return r.jsxs(r.Fragment,{children:[r.jsxs(E,{"aria-owns":u.isPopoverOpen?e:void 0,"aria-haspopup":"true",onMouseEnter:u.openPopover,onMouseLeave:u.closePopover,direction:"row",spacing:1,sx:{cursor:"pointer"},children:[r.jsx(g,{component:t,sx:{color:a}}),s&&r.jsx("div",{style:{color:a},children:s})]}),r.jsx(A,{id:e,sx:{pointerEvents:"none"},open:u.isPopoverOpen,anchorEl:u.anchorEl,anchorOrigin:b??{vertical:"bottom",horizontal:"left"},transformOrigin:v??{vertical:"top",horizontal:"left"},onClose:u.closePopover,disableRestoreFocus:!0,children:r.jsxs(E,{gap:"1rem",padding:2,maxWidth:"450px",sx:{wordWrap:"break-word"},children:[r.jsxs("div",{children:[n&&r.jsx(h,{component:"span",fontSize:"14px",children:`${n}: `}),r.jsx(h,{component:"span",color:a,fontWeight:"bold",fontSize:"14px",children:o})]}),r.jsx(h,{fontSize:"14px",children:i}),S&&r.jsx(h,{fontSize:"12px",children:S})]})})]})}),Z=f.observer(({isVirtual:e,motionGroupId:t,anchorOrigin:a,transformOrigin:n,compact:o})=>{const s=y.useTheme(),i=c.useId(),{t:S}=d.useTranslation();return e?r.jsx(p,{id:`motion-group-virtual-${i}`,icon:F,color:s.palette.tertiary.main,name:S("SafetyBar.ControllerType.Virtual.lb"),label:o?null:S("SafetyBar.ControllerType.Virtual.lb"),explanation:r.jsxs(d.Trans,{i18nKey:"SafetyBar.MotionGroup.Virtual.Explanation.lb",values:{motionGroupId:t},children:["Motion group ",r.jsx("code",{children:t})," refers to a virtual robot with no physical counterpart. It can be freely manipulated without special safety precautions."]}),anchorOrigin:a,transformOrigin:n}):r.jsx(p,{id:`motion-group-physical-${i}`,icon:j,color:s.palette.primary.main,name:S("SafetyBar.ControllerType.Physical.lb"),label:o?null:S("SafetyBar.ControllerType.Physical.lb"),explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.MotionGroup.Physical.Explanation.lb",values:{motionGroupId:t},components:{code:r.jsx("code",{}),strong:r.jsx("strong",{})}}),anchorOrigin:a,transformOrigin:n})}),C=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.306 2.768c0-.424.344-.768.768-.768h.406C19.53 2 22 4.551 22 7.699c0 3.237-2.51 5.587-5.31 5.703-.84 1.595-2.478 2.677-4.36 2.677a4.845 4.845 0 0 1-3.146-1.163c-.6 1.783 0 3.922 1.79 4.99 1.929 1.149 4.395.467 5.508-1.524l.212-.378a.75.75 0 1 1 1.308.732l-.231.414c-1.524 2.725-4.9 3.66-7.54 2.085-2.716-1.618-3.432-5.037-2.129-7.599a5.22 5.22 0 0 1-.73-2.677c0-2.192 1.335-4.063 3.212-4.793-1.195-1.427-3.29-1.96-5.08-.892-1.928 1.15-2.589 3.696-1.475 5.687l.231.413a.75.75 0 0 1-1.308.732l-.212-.377c-1.524-2.726-.62-6.211 2.02-7.785 2.716-1.619 5.943-.55 7.44 1.897l.13-.001c2.739 0 4.96 2.292 4.96 5.12 0 .284-.023.563-.066.834 1.795-.354 3.288-1.96 3.288-4.095 0-2.3-1.805-4.163-4.032-4.163h-.406a.768.768 0 0 1-.768-.768Zm.496 8.191c0 .286-.033.564-.094.831a3.62 3.62 0 0 1-.672 1.415 3.425 3.425 0 0 1-2.706 1.338 3.402 3.402 0 0 1-2.384-.98 3.598 3.598 0 0 1-.852-1.306 3.677 3.677 0 0 1-.235-1.298c0-1.623 1.046-2.994 2.48-3.435a3.37 3.37 0 0 1 1.522-.107c1.665.264 2.94 1.75 2.94 3.542Z"})),P=c.forwardRef(C),$=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M19.763 16.432 13.516 5.864c-.674-1.152-2.358-1.152-3.049 0l-6.23 10.568C3.563 17.567 4.405 19 5.753 19H18.23c1.364 0 2.206-1.432 1.532-2.568ZM12 8.498c.539 0 .96.428.96.938v.066l-.32 4.708a.639.639 0 0 1-.64.592.639.639 0 0 1-.64-.592l-.32-4.708A.953.953 0 0 1 12 8.498Zm0 8.79c-.556 0-1.01-.444-1.01-.987 0-.544.454-.988 1.01-.988s1.01.444 1.01.988c0 .542-.454.987-1.01.987Z",fill:"#fff",fillOpacity:.56})),N=c.forwardRef($),Y=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M12.953 5.09a1.497 1.497 0 0 0-1.653-.518l-1.35.43a1.504 1.504 0 0 0-1.726-.376L2.858 6.97c-.736.321-1.06 1.155-.726 1.862.334.707 1.202 1.02 1.937.698l4.27-1.865 1.466 1.973v.402c0 .873-.627 1.63-1.512 1.827l-2.56.567c-1.329.295-2.27 1.431-2.27 2.74v.107c0 .26.22.469.489.469h11.117c1.329 0 2.618.435 3.656 1.233l1.665 1.28A1 1 0 0 0 22 17.47V11.062c0-.312-.108-.616-.308-.863l-3.415-4.218a1.5 1.5 0 0 0-1.618-.471l-.378.12-.866-.475a1.516 1.516 0 0 0-1.188-.114l-1.06.338-.214-.289Z"})),V=c.forwardRef(Y),q=f.observer(({operationMode:e,anchorOrigin:t,transformOrigin:a,compact:n})=>{const{t:o}=d.useTranslation(),s=y.useTheme(),i=c.useId();switch(e){case"OPERATION_MODE_AUTO":return r.jsx(p,{id:`operation-mode-auto-${i}`,icon:P,title:o("SafetyBar.OperationMode.ti"),name:o("SafetyBar.OperationMode.Automatic.ti"),label:n?null:o("SafetyBar.OperationMode.Automatic.ti"),color:s.palette.text.secondary,explanation:r.jsx(d.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:t,transformOrigin:a});case"OPERATION_MODE_MANUAL":case"OPERATION_MODE_MANUAL_T1":case"OPERATION_MODE_MANUAL_T2":return r.jsx(p,{id:`operation-mode-manual-${i}`,icon:V,color:s.palette.warning.main,title:o("SafetyBar.OperationMode.ti"),name:o("SafetyBar.OperationMode.Manual.lb"),label:n?null:o("SafetyBar.OperationMode.Manual.lb"),explanation:r.jsx(d.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:e,anchorOrigin:t,transformOrigin:a});default:return r.jsx(p,{id:`operation-mode-error-${i}`,icon:N,color:s.palette.warning.main,title:o("SafetyBar.OperationMode.ti"),name:o("SafetyBar.OperationMode.Error.lb"),label:n?null:o("SafetyBar.OperationMode.Error.lb"),explanation:r.jsx(d.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:e,anchorOrigin:t,transformOrigin:a})}}),L=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M19.763 16.432 13.516 5.864c-.674-1.152-2.358-1.152-3.049 0l-6.23 10.568C3.563 17.567 4.405 19 5.753 19H18.23c1.364 0 2.206-1.432 1.532-2.568ZM12 8.498c.539 0 .96.428.96.938v.066l-.32 4.708a.639.639 0 0 1-.64.592.639.639 0 0 1-.64-.592l-.32-4.708A.953.953 0 0 1 12 8.498Zm0 8.79c-.556 0-1.01-.444-1.01-.987 0-.544.454-.988 1.01-.988s1.01.444 1.01.988c0 .542-.454.987-1.01.987Z"})),I=c.forwardRef(L),K=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M10.24 10.636 12 13.764l1.76-3.128h-3.52Z"}),l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.364 12a6.364 6.364 0 1 1-12.728 0 6.364 6.364 0 0 1 12.728 0ZM7.909 9.273 12 16.546l4.09-7.273H7.91Z"}),l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-1.364 0a8.636 8.636 0 1 1-17.273 0 8.636 8.636 0 0 1 17.273 0Z"})),D=c.forwardRef(K),H=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M9.057 15.115c-1.681 0-3.111-.59-4.29-1.768C3.59 12.17 3 10.74 3 9.057c0-.29.021-.582.064-.876a4.1 4.1 0 0 1 .214-.844.78.78 0 0 1 .273-.36c.115-.077.244-.133.389-.168a.857.857 0 0 1 .437.008c.146.04.28.12.4.24l2.806 2.787 2.26-2.261-2.775-2.786a.903.903 0 0 1-.241-.405.875.875 0 0 1-.008-.442 1.13 1.13 0 0 1 .174-.389.82.82 0 0 1 .355-.273c.268-.107.548-.182.838-.224.29-.043.581-.064.871-.064 1.682 0 3.112.59 4.29 1.768 1.179 1.178 1.768 2.608 1.768 4.29 0 .444-.042.858-.126 1.241-.084.384-.21.755-.377 1.113l5.726 5.692A2.2 2.2 0 0 1 21 18.721a2.2 2.2 0 0 1-.662 1.617A2.2 2.2 0 0 1 18.72 21a2.173 2.173 0 0 1-1.617-.679l-5.692-5.709c-.372.161-.75.285-1.133.372-.383.087-.79.13-1.222.13Z",fill:"#fff",fillOpacity:.56})),U=c.forwardRef(H),z=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"m10.6 13.8-2.15-2.15a.948.948 0 0 0-.7-.275.948.948 0 0 0-.7.275.948.948 0 0 0-.275.7c0 .283.092.517.275.7L9.9 15.9c.2.2.433.3.7.3.267 0 .5-.1.7-.3l5.65-5.65a.948.948 0 0 0 .275-.7.948.948 0 0 0-.275-.7.948.948 0 0 0-.7-.275.948.948 0 0 0-.7.275L10.6 13.8ZM12 22a9.738 9.738 0 0 1-3.9-.788 10.099 10.099 0 0 1-3.175-2.137c-.9-.9-1.612-1.958-2.137-3.175A9.738 9.738 0 0 1 2 12c0-1.383.263-2.683.788-3.9a10.099 10.099 0 0 1 2.137-3.175c.9-.9 1.958-1.612 3.175-2.137A9.738 9.738 0 0 1 12 2c1.383 0 2.683.263 3.9.788a10.098 10.098 0 0 1 3.175 2.137c.9.9 1.613 1.958 2.137 3.175A9.738 9.738 0 0 1 22 12a9.738 9.738 0 0 1-.788 3.9 10.098 10.098 0 0 1-2.137 3.175c-.9.9-1.958 1.613-3.175 2.137A9.738 9.738 0 0 1 12 22Zm0-2c2.233 0 4.125-.775 5.675-2.325C19.225 16.125 20 14.233 20 12c0-2.233-.775-4.125-2.325-5.675C16.125 4.775 14.233 4 12 4c-2.233 0-4.125.775-5.675 2.325C4.775 7.875 4 9.767 4 12c0 2.233.775 4.125 2.325 5.675C7.875 19.225 9.767 20 12 20Z"})),k=c.forwardRef(z),W=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M9 16h6c.283 0 .52-.096.713-.287A.968.968 0 0 0 16 15V9a.967.967 0 0 0-.287-.713A.968.968 0 0 0 15 8H9a.968.968 0 0 0-.713.287A.968.968 0 0 0 8 9v6c0 .283.096.52.287.713.192.191.43.287.713.287Zm3 6a9.738 9.738 0 0 1-3.9-.788 10.099 10.099 0 0 1-3.175-2.137c-.9-.9-1.612-1.958-2.137-3.175A9.738 9.738 0 0 1 2 12c0-1.383.263-2.683.788-3.9a10.099 10.099 0 0 1 2.137-3.175c.9-.9 1.958-1.612 3.175-2.137A9.738 9.738 0 0 1 12 2c1.383 0 2.683.263 3.9.788a10.098 10.098 0 0 1 3.175 2.137c.9.9 1.613 1.958 2.137 3.175A9.738 9.738 0 0 1 22 12a9.738 9.738 0 0 1-.788 3.9 10.098 10.098 0 0 1-2.137 3.175c-.9.9-1.958 1.613-3.175 2.137A9.738 9.738 0 0 1 12 22Zm0-2c2.233 0 4.125-.775 5.675-2.325C19.225 16.125 20 14.233 20 12c0-2.233-.775-4.125-2.325-5.675C16.125 4.775 14.233 4 12 4c-2.233 0-4.125.775-5.675 2.325C4.775 7.875 4 9.767 4 12c0 2.233.775 4.125 2.325 5.675C7.875 19.225 9.767 20 12 20Z"})),G=c.forwardRef(W),J=f.observer(({safetyState:e,anchorOrigin:t,transformOrigin:a,compact:n})=>{const{t:o}=d.useTranslation(),s=y.useTheme(),i=c.useId();switch(e){case"SAFETY_STATE_NORMAL":return r.jsx(p,{id:`safety-state-normal-${i}`,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.Normal.lb"),label:n?null:o("SafetyBar.SafetyState.Normal.lb"),icon:k,color:s.palette.text.secondary,explanation:r.jsx(d.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:t,transformOrigin:a});case"SAFETY_STATE_DEVICE_EMERGENCY_STOP":case"SAFETY_STATE_ROBOT_EMERGENCY_STOP":return r.jsx(p,{id:`safety-state-estop-${i}`,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.Estop.lb"),label:n?null:o("SafetyBar.SafetyState.Estop.lb"),icon:D,color:s.palette.error.main,explanation:r.jsx(d.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:e,anchorOrigin:t,transformOrigin:a});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 r.jsx(p,{id:`safety-state-stop-${i}`,icon:G,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.Stop.lb"),label:n?null:o("SafetyBar.SafetyState.Stop.lb"),color:s.palette.warning.main,explanation:r.jsx(d.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:e,anchorOrigin:t,transformOrigin:a});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 r.jsx(p,{id:`safety-state-manual-action-required-${i}`,icon:U,color:s.palette.warning.main,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.ManualActionRequired.lb"),label:n?null:o("SafetyBar.SafetyState.ManualActionRequired.lb"),explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.SafetyState.ManualActionRequired.Explanation.lb",children:"The robot controller has entered a safety state requiring manual action to resolve."}),literalValue:e,anchorOrigin:t,transformOrigin:a});case"SAFETY_STATE_UNKNOWN":case"SAFETY_STATE_FAULT":return r.jsx(p,{id:`safety-state-error-${i}`,icon:I,color:s.palette.error.main,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.Error.lb"),label:n?null:o("SafetyBar.SafetyState.Error.lb"),explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.SafetyState.Error.Explanation.lb",children:"The robot controller has entered an unexpected safety state."}),literalValue:e,anchorOrigin:t,transformOrigin:a});default:_(e,`Unknown safety state ${e}`)}}),Q=x.externalizeComponent(f.observer(({isVirtual:e,motionGroupId:t,operationMode:a,safetyState:n,anchorOrigin:o,transformOrigin:s,compact:i=!0})=>{const S=i?1:2;return r.jsxs(E,{direction:"row",gap:S,alignItems:"center",sx:{height:"24px"},children:[r.jsx(J,{safetyState:n,anchorOrigin:o,transformOrigin:s,compact:i}),r.jsx(m,{orientation:"vertical",flexItem:!0}),r.jsx(q,{operationMode:a,anchorOrigin:o,transformOrigin:s,compact:i}),r.jsx(m,{orientation:"vertical",flexItem:!0}),r.jsx(Z,{isVirtual:e,motionGroupId:t,anchorOrigin:o,transformOrigin:s,compact:i})]})}));exports.SafetyBar=Q;exports.makeErrorMessage=R;
|
|
1
|
+
"use strict";const r=require("react/jsx-runtime"),m=require("@mui/material/Divider"),E=require("@mui/material/Stack"),f=require("mobx-react-lite"),x=require("./externalizeComponent-Bue3-Wra.cjs"),y=require("@mui/material/styles"),c=require("react"),d=require("react-i18next"),A=require("@mui/material/Popover"),g=require("@mui/material/SvgIcon"),h=require("@mui/material/Typography"),T=require("axios");function M(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,n.get?n:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const l=M(c);function _(e,t){throw new Error(`${t} ${JSON.stringify(e)}`)}function R(e){var t,a,n,o;return e instanceof T.AxiosError&&e.code==="ERR_NETWORK"?"Failed to connect to the server. Please check your internet connection.":e instanceof T.AxiosError&&e.response?`${(t=e.response)==null?void 0:t.status} ${(a=e.response)==null?void 0:a.statusText} from ${(n=e.response)==null?void 0:n.config.url}: ${JSON.stringify((o=e.response)==null?void 0:o.data)}`:e instanceof Error?e.message:`Unexpected error: ${x.tryStringifyJson(e)||e}`}const O=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M5.248 21c-.334 0-.619-.116-.853-.35a1.153 1.153 0 0 1-.351-.848c0-.333.117-.616.351-.85.234-.233.519-.35.853-.35H7.24L4.558 9.87a2.881 2.881 0 0 1-1.126-1.042A2.77 2.77 0 0 1 3 7.317c0-.793.28-1.467.838-2.023a2.774 2.774 0 0 1 2.033-.834 2.71 2.71 0 0 1 1.728.585c.494.389.832.887 1.014 1.493h3.58V5.239c0-.22.076-.406.226-.555a.76.76 0 0 1 .558-.224c.136 0 .263.035.381.104.118.07.209.167.273.292v.14l1.835-1.702a.979.979 0 0 1 .52-.279.881.881 0 0 1 .58.091l4.01 1.85a.74.74 0 0 1 .36.364.537.537 0 0 1-.002.474.592.592 0 0 1-.366.323.657.657 0 0 1-.477-.039l-3.858-1.774L13.76 6.59v1.454l2.473 2.233 3.858-1.774a.648.648 0 0 1 .485-.03.571.571 0 0 1 .358.314.513.513 0 0 1 .01.482.79.79 0 0 1-.367.357l-4.011 1.882a.881.881 0 0 1-.58.09.979.979 0 0 1-.52-.278L13.63 9.638v.14a.92.92 0 0 1-.273.275.665.665 0 0 1-.381.12.76.76 0 0 1-.558-.224.752.752 0 0 1-.225-.555V8.096h-3.58a2.82 2.82 0 0 1-.215.54 2.552 2.552 0 0 1-.323.479l5.139 9.488h2.673c.335 0 .62.116.854.35.234.233.35.516.35.849 0 .332-.116.615-.35.849a1.167 1.167 0 0 1-.854.349H5.248Zm.623-12.385c.362 0 .67-.126.924-.378a1.25 1.25 0 0 0 .38-.92 1.25 1.25 0 0 0-.38-.92 1.261 1.261 0 0 0-.924-.379 1.26 1.26 0 0 0-.925.379 1.25 1.25 0 0 0-.38.92c0 .36.127.667.38.92.254.252.562.378.925.378Z"})),j=c.forwardRef(O),B=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"m13.37 9.12 1.69 1.69 2.99-2.99-3.73-3.73-.95-.95-7.66 7.66-.95.95 3.99 3.99v3.44h7.55v-3.55l-4.72-4.72 1.79-1.79Zm-.91-2.99.91-.91 2.6 2.6-.91.91-2.6-2.6Zm-2.25 10.24h3.74l-1.34-1.34-.04-.04h-2.5l-3.25-3.25 4.59-4.59.92.92L9.5 10.9l5.33 5.33v1.48H10.2v-1.35l.01.01ZM2 2v4.99h1.41V3.4h3.58V2H2ZM22.21 2h-4.98v1.41h3.59v3.58h1.4V2h-.01ZM20.81 20.65h-3.58v1.4h4.98v-4.99h-1.4v3.59ZM3.4 17.06H2v4.98h4.99v-1.4H3.4v-3.58Z"})),F=c.forwardRef(B),p=f.observer(({id:e,icon:t,color:a,title:n,name:o,label:s,explanation:i,literalValue:S,anchorOrigin:b,transformOrigin:v})=>{const u=f.useLocalObservable(()=>({anchorEl:null,get isPopoverOpen(){return!!u.anchorEl},openPopover(w){u.anchorEl=w.currentTarget},closePopover(){u.anchorEl=null}}));return r.jsxs(r.Fragment,{children:[r.jsxs(E,{"aria-owns":u.isPopoverOpen?e:void 0,"aria-haspopup":"true",onMouseEnter:u.openPopover,onMouseLeave:u.closePopover,direction:"row",spacing:1,sx:{cursor:"pointer"},children:[r.jsx(g,{component:t,sx:{color:a}}),s&&r.jsx("div",{style:{color:a},children:s})]}),r.jsx(A,{id:e,sx:{pointerEvents:"none"},open:u.isPopoverOpen,anchorEl:u.anchorEl,anchorOrigin:b??{vertical:"bottom",horizontal:"left"},transformOrigin:v??{vertical:"top",horizontal:"left"},onClose:u.closePopover,disableRestoreFocus:!0,children:r.jsxs(E,{gap:"1rem",padding:2,maxWidth:"450px",sx:{wordWrap:"break-word"},children:[r.jsxs("div",{children:[n&&r.jsx(h,{component:"span",fontSize:"14px",children:`${n}: `}),r.jsx(h,{component:"span",color:a,fontWeight:"bold",fontSize:"14px",children:o})]}),r.jsx(h,{fontSize:"14px",children:i}),S&&r.jsx(h,{fontSize:"12px",children:S})]})})]})}),Z=f.observer(({isVirtual:e,motionGroupId:t,anchorOrigin:a,transformOrigin:n,compact:o})=>{const s=y.useTheme(),i=c.useId(),{t:S}=d.useTranslation();return e?r.jsx(p,{id:`motion-group-virtual-${i}`,icon:F,color:s.palette.tertiary.main,name:S("SafetyBar.ControllerType.Virtual.lb"),label:o?null:S("SafetyBar.ControllerType.Virtual.lb"),explanation:r.jsxs(d.Trans,{i18nKey:"SafetyBar.MotionGroup.Virtual.Explanation.lb",values:{motionGroupId:t},children:["Motion group ",r.jsx("code",{children:t})," refers to a virtual robot with no physical counterpart. It can be freely manipulated without special safety precautions."]}),anchorOrigin:a,transformOrigin:n}):r.jsx(p,{id:`motion-group-physical-${i}`,icon:j,color:s.palette.primary.main,name:S("SafetyBar.ControllerType.Physical.lb"),label:o?null:S("SafetyBar.ControllerType.Physical.lb"),explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.MotionGroup.Physical.Explanation.lb",values:{motionGroupId:t},components:{code:r.jsx("code",{}),strong:r.jsx("strong",{})}}),anchorOrigin:a,transformOrigin:n})}),C=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.306 2.768c0-.424.344-.768.768-.768h.406C19.53 2 22 4.551 22 7.699c0 3.237-2.51 5.587-5.31 5.703-.84 1.595-2.478 2.677-4.36 2.677a4.845 4.845 0 0 1-3.146-1.163c-.6 1.783 0 3.922 1.79 4.99 1.929 1.149 4.395.467 5.508-1.524l.212-.378a.75.75 0 1 1 1.308.732l-.231.414c-1.524 2.725-4.9 3.66-7.54 2.085-2.716-1.618-3.432-5.037-2.129-7.599a5.22 5.22 0 0 1-.73-2.677c0-2.192 1.335-4.063 3.212-4.793-1.195-1.427-3.29-1.96-5.08-.892-1.928 1.15-2.589 3.696-1.475 5.687l.231.413a.75.75 0 0 1-1.308.732l-.212-.377c-1.524-2.726-.62-6.211 2.02-7.785 2.716-1.619 5.943-.55 7.44 1.897l.13-.001c2.739 0 4.96 2.292 4.96 5.12 0 .284-.023.563-.066.834 1.795-.354 3.288-1.96 3.288-4.095 0-2.3-1.805-4.163-4.032-4.163h-.406a.768.768 0 0 1-.768-.768Zm.496 8.191c0 .286-.033.564-.094.831a3.62 3.62 0 0 1-.672 1.415 3.425 3.425 0 0 1-2.706 1.338 3.402 3.402 0 0 1-2.384-.98 3.598 3.598 0 0 1-.852-1.306 3.677 3.677 0 0 1-.235-1.298c0-1.623 1.046-2.994 2.48-3.435a3.37 3.37 0 0 1 1.522-.107c1.665.264 2.94 1.75 2.94 3.542Z"})),P=c.forwardRef(C),$=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M19.763 16.432 13.516 5.864c-.674-1.152-2.358-1.152-3.049 0l-6.23 10.568C3.563 17.567 4.405 19 5.753 19H18.23c1.364 0 2.206-1.432 1.532-2.568ZM12 8.498c.539 0 .96.428.96.938v.066l-.32 4.708a.639.639 0 0 1-.64.592.639.639 0 0 1-.64-.592l-.32-4.708A.953.953 0 0 1 12 8.498Zm0 8.79c-.556 0-1.01-.444-1.01-.987 0-.544.454-.988 1.01-.988s1.01.444 1.01.988c0 .542-.454.987-1.01.987Z",fill:"#fff",fillOpacity:.56})),N=c.forwardRef($),Y=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M12.953 5.09a1.497 1.497 0 0 0-1.653-.518l-1.35.43a1.504 1.504 0 0 0-1.726-.376L2.858 6.97c-.736.321-1.06 1.155-.726 1.862.334.707 1.202 1.02 1.937.698l4.27-1.865 1.466 1.973v.402c0 .873-.627 1.63-1.512 1.827l-2.56.567c-1.329.295-2.27 1.431-2.27 2.74v.107c0 .26.22.469.489.469h11.117c1.329 0 2.618.435 3.656 1.233l1.665 1.28A1 1 0 0 0 22 17.47V11.062c0-.312-.108-.616-.308-.863l-3.415-4.218a1.5 1.5 0 0 0-1.618-.471l-.378.12-.866-.475a1.516 1.516 0 0 0-1.188-.114l-1.06.338-.214-.289Z"})),V=c.forwardRef(Y),q=f.observer(({operationMode:e,anchorOrigin:t,transformOrigin:a,compact:n})=>{const{t:o}=d.useTranslation(),s=y.useTheme(),i=c.useId();switch(e){case"OPERATION_MODE_AUTO":return r.jsx(p,{id:`operation-mode-auto-${i}`,icon:P,title:o("SafetyBar.OperationMode.ti"),name:o("SafetyBar.OperationMode.Automatic.ti"),label:n?null:o("SafetyBar.OperationMode.Automatic.ti"),color:s.palette.text.secondary,explanation:r.jsx(d.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:t,transformOrigin:a});case"OPERATION_MODE_MANUAL":case"OPERATION_MODE_MANUAL_T1":case"OPERATION_MODE_MANUAL_T2":return r.jsx(p,{id:`operation-mode-manual-${i}`,icon:V,color:s.palette.warning.main,title:o("SafetyBar.OperationMode.ti"),name:o("SafetyBar.OperationMode.Manual.lb"),label:n?null:o("SafetyBar.OperationMode.Manual.lb"),explanation:r.jsx(d.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:e,anchorOrigin:t,transformOrigin:a});default:return r.jsx(p,{id:`operation-mode-error-${i}`,icon:N,color:s.palette.warning.main,title:o("SafetyBar.OperationMode.ti"),name:o("SafetyBar.OperationMode.Error.lb"),label:n?null:o("SafetyBar.OperationMode.Error.lb"),explanation:r.jsx(d.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:e,anchorOrigin:t,transformOrigin:a})}}),L=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M19.763 16.432 13.516 5.864c-.674-1.152-2.358-1.152-3.049 0l-6.23 10.568C3.563 17.567 4.405 19 5.753 19H18.23c1.364 0 2.206-1.432 1.532-2.568ZM12 8.498c.539 0 .96.428.96.938v.066l-.32 4.708a.639.639 0 0 1-.64.592.639.639 0 0 1-.64-.592l-.32-4.708A.953.953 0 0 1 12 8.498Zm0 8.79c-.556 0-1.01-.444-1.01-.987 0-.544.454-.988 1.01-.988s1.01.444 1.01.988c0 .542-.454.987-1.01.987Z"})),I=c.forwardRef(L),K=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M10.24 10.636 12 13.764l1.76-3.128h-3.52Z"}),l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.364 12a6.364 6.364 0 1 1-12.728 0 6.364 6.364 0 0 1 12.728 0ZM7.909 9.273 12 16.546l4.09-7.273H7.91Z"}),l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-1.364 0a8.636 8.636 0 1 1-17.273 0 8.636 8.636 0 0 1 17.273 0Z"})),D=c.forwardRef(K),H=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M9.057 15.115c-1.681 0-3.111-.59-4.29-1.768C3.59 12.17 3 10.74 3 9.057c0-.29.021-.582.064-.876a4.1 4.1 0 0 1 .214-.844.78.78 0 0 1 .273-.36c.115-.077.244-.133.389-.168a.857.857 0 0 1 .437.008c.146.04.28.12.4.24l2.806 2.787 2.26-2.261-2.775-2.786a.903.903 0 0 1-.241-.405.875.875 0 0 1-.008-.442 1.13 1.13 0 0 1 .174-.389.82.82 0 0 1 .355-.273c.268-.107.548-.182.838-.224.29-.043.581-.064.871-.064 1.682 0 3.112.59 4.29 1.768 1.179 1.178 1.768 2.608 1.768 4.29 0 .444-.042.858-.126 1.241-.084.384-.21.755-.377 1.113l5.726 5.692A2.2 2.2 0 0 1 21 18.721a2.2 2.2 0 0 1-.662 1.617A2.2 2.2 0 0 1 18.72 21a2.173 2.173 0 0 1-1.617-.679l-5.692-5.709c-.372.161-.75.285-1.133.372-.383.087-.79.13-1.222.13Z",fill:"#fff",fillOpacity:.56})),U=c.forwardRef(H),z=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"m10.6 13.8-2.15-2.15a.948.948 0 0 0-.7-.275.948.948 0 0 0-.7.275.948.948 0 0 0-.275.7c0 .283.092.517.275.7L9.9 15.9c.2.2.433.3.7.3.267 0 .5-.1.7-.3l5.65-5.65a.948.948 0 0 0 .275-.7.948.948 0 0 0-.275-.7.948.948 0 0 0-.7-.275.948.948 0 0 0-.7.275L10.6 13.8ZM12 22a9.738 9.738 0 0 1-3.9-.788 10.099 10.099 0 0 1-3.175-2.137c-.9-.9-1.612-1.958-2.137-3.175A9.738 9.738 0 0 1 2 12c0-1.383.263-2.683.788-3.9a10.099 10.099 0 0 1 2.137-3.175c.9-.9 1.958-1.612 3.175-2.137A9.738 9.738 0 0 1 12 2c1.383 0 2.683.263 3.9.788a10.098 10.098 0 0 1 3.175 2.137c.9.9 1.613 1.958 2.137 3.175A9.738 9.738 0 0 1 22 12a9.738 9.738 0 0 1-.788 3.9 10.098 10.098 0 0 1-2.137 3.175c-.9.9-1.958 1.613-3.175 2.137A9.738 9.738 0 0 1 12 22Zm0-2c2.233 0 4.125-.775 5.675-2.325C19.225 16.125 20 14.233 20 12c0-2.233-.775-4.125-2.325-5.675C16.125 4.775 14.233 4 12 4c-2.233 0-4.125.775-5.675 2.325C4.775 7.875 4 9.767 4 12c0 2.233.775 4.125 2.325 5.675C7.875 19.225 9.767 20 12 20Z"})),k=c.forwardRef(z),W=({title:e,titleId:t,...a},n)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:n,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M9 16h6c.283 0 .52-.096.713-.287A.968.968 0 0 0 16 15V9a.967.967 0 0 0-.287-.713A.968.968 0 0 0 15 8H9a.968.968 0 0 0-.713.287A.968.968 0 0 0 8 9v6c0 .283.096.52.287.713.192.191.43.287.713.287Zm3 6a9.738 9.738 0 0 1-3.9-.788 10.099 10.099 0 0 1-3.175-2.137c-.9-.9-1.612-1.958-2.137-3.175A9.738 9.738 0 0 1 2 12c0-1.383.263-2.683.788-3.9a10.099 10.099 0 0 1 2.137-3.175c.9-.9 1.958-1.612 3.175-2.137A9.738 9.738 0 0 1 12 2c1.383 0 2.683.263 3.9.788a10.098 10.098 0 0 1 3.175 2.137c.9.9 1.613 1.958 2.137 3.175A9.738 9.738 0 0 1 22 12a9.738 9.738 0 0 1-.788 3.9 10.098 10.098 0 0 1-2.137 3.175c-.9.9-1.958 1.613-3.175 2.137A9.738 9.738 0 0 1 12 22Zm0-2c2.233 0 4.125-.775 5.675-2.325C19.225 16.125 20 14.233 20 12c0-2.233-.775-4.125-2.325-5.675C16.125 4.775 14.233 4 12 4c-2.233 0-4.125.775-5.675 2.325C4.775 7.875 4 9.767 4 12c0 2.233.775 4.125 2.325 5.675C7.875 19.225 9.767 20 12 20Z"})),G=c.forwardRef(W),J=f.observer(({safetyState:e,anchorOrigin:t,transformOrigin:a,compact:n})=>{const{t:o}=d.useTranslation(),s=y.useTheme(),i=c.useId();switch(e){case"SAFETY_STATE_NORMAL":return r.jsx(p,{id:`safety-state-normal-${i}`,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.Normal.lb"),label:n?null:o("SafetyBar.SafetyState.Normal.lb"),icon:k,color:s.palette.text.secondary,explanation:r.jsx(d.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:t,transformOrigin:a});case"SAFETY_STATE_DEVICE_EMERGENCY_STOP":case"SAFETY_STATE_ROBOT_EMERGENCY_STOP":return r.jsx(p,{id:`safety-state-estop-${i}`,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.Estop.lb"),label:n?null:o("SafetyBar.SafetyState.Estop.lb"),icon:D,color:s.palette.error.main,explanation:r.jsx(d.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:e,anchorOrigin:t,transformOrigin:a});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 r.jsx(p,{id:`safety-state-stop-${i}`,icon:G,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.Stop.lb"),label:n?null:o("SafetyBar.SafetyState.Stop.lb"),color:s.palette.warning.main,explanation:r.jsx(d.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:e,anchorOrigin:t,transformOrigin:a});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 r.jsx(p,{id:`safety-state-manual-action-required-${i}`,icon:U,color:s.palette.warning.main,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.ManualActionRequired.lb"),label:n?null:o("SafetyBar.SafetyState.ManualActionRequired.lb"),explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.SafetyState.ManualActionRequired.Explanation.lb",children:"The robot controller has entered a safety state requiring manual action to resolve."}),literalValue:e,anchorOrigin:t,transformOrigin:a});case"SAFETY_STATE_UNKNOWN":case"SAFETY_STATE_FAULT":return r.jsx(p,{id:`safety-state-error-${i}`,icon:I,color:s.palette.error.main,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.Error.lb"),label:n?null:o("SafetyBar.SafetyState.Error.lb"),explanation:r.jsx(d.Trans,{i18nKey:"SafetyBar.SafetyState.Error.Explanation.lb",children:"The robot controller has entered an unexpected safety state."}),literalValue:e,anchorOrigin:t,transformOrigin:a});default:_(e,`Unknown safety state ${e}`)}}),Q=x.externalizeComponent(f.observer(({isVirtual:e,motionGroupId:t,operationMode:a,safetyState:n,anchorOrigin:o,transformOrigin:s,compact:i=!0})=>{const S=i?1:2;return r.jsxs(E,{direction:"row",gap:S,alignItems:"center",sx:{height:"24px"},children:[r.jsx(J,{safetyState:n,anchorOrigin:o,transformOrigin:s,compact:i}),r.jsx(m,{orientation:"vertical",flexItem:!0}),r.jsx(q,{operationMode:a,anchorOrigin:o,transformOrigin:s,compact:i}),r.jsx(m,{orientation:"vertical",flexItem:!0}),r.jsx(Z,{isVirtual:e,motionGroupId:t,anchorOrigin:o,transformOrigin:s,compact:i})]})}));exports.SafetyBar=Q;exports.makeErrorMessage=R;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const d=require("three"),g=require("react/jsx-runtime"),m=require("react"),y=require("react-i18next"),f=require("i18next"),p=require("i18next-browser-languagedetector");function h(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const a=h(d);function J(e){try{return JSON.stringify(e)}catch{return}}function B(e){const t=e.length(),o=new a.Quaternion;if(t>1e-6){const n=e.clone().normalize();o.setFromAxisAngle(n,t)}return o}function A(e){if(!e||e.length===0)return 5;const n=e.reduce((l,r)=>l+Math.abs(r.a??0)/1e3+Math.abs(r.d??0)/1e3,0)*2;return!Number.isFinite(n)||n<=0?5:n}function E(e){if(e.length<3)return console.log("Not enough vertices to define a plane"),{isCoplanar:!1};const t=new a.Vector3(e[0].x,e[0].y,e[0].z),o=new a.Vector3(e[1].x,e[1].y,e[1].z),n=new a.Vector3(e[2].x,e[2].y,e[2].z),l=new a.Vector3().subVectors(o,t),r=new a.Vector3().subVectors(n,t),c=new a.Vector3().crossVectors(l,r).normalize();for(let i=3;i<e.length;i++){const S=new a.Vector3(e[i].x,e[i].y,e[i].z),u=new a.Vector3().subVectors(S,t),b=c.dot(u);if(Math.abs(b)>1e-6)return console.log("Vertices are not on the same plane"),{isCoplanar:!1}}return{isCoplanar:!0,normal:c}}const O={"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","Jogging.StreamStateSection.lb":"Status Stream:","Jogging.StreamStateSection.RUNNING.lb":"In Bewegung","Jogging.StreamStateSection.PAUSED_BY_USER.lb":"Pausiert (Nutzer)","Jogging.StreamStateSection.PAUSED_NEAR_COLLISION.lb":"Pausiert (Kollisionsnähe)","Jogging.StreamStateSection.PAUSED_NEAR_JOINT_LIMIT.lb":"Pausiert (nahe Gelenkgrenze)","Jogging.StreamStateSection.PAUSED_NEAR_SINGULARITY.lb":"Pausiert (nahe Singularität)","Jogging.StreamStateSection.PAUSED_ON_IO.lb":"Pausiert (I/O-Ereignis)","Jogging.StreamStateSection.END_OF_TRAJECTORY.lb":"Trajektorie beendet","Jogging.StreamStateSection.WAIT_FOR_IO.lb":"Warte auf I/O","Jogging.StreamStateSection.KIND_UNKNOWN.lb":"Bereit","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"},R={"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","Jogging.StreamStateSection.lb":"State stream:","Jogging.StreamStateSection.RUNNING.lb":"Running","Jogging.StreamStateSection.PAUSED_BY_USER.lb":"Paused (by user)","Jogging.StreamStateSection.PAUSED_NEAR_COLLISION.lb":"Paused (collision proximity)","Jogging.StreamStateSection.PAUSED_NEAR_JOINT_LIMIT.lb":"Paused (near joint limit)","Jogging.StreamStateSection.PAUSED_NEAR_SINGULARITY.lb":"Paused (near singularity)","Jogging.StreamStateSection.PAUSED_ON_IO.lb":"Paused (I/O event)","Jogging.StreamStateSection.END_OF_TRAJECTORY.lb":"End of trajectory","Jogging.StreamStateSection.WAIT_FOR_IO.lb":"Waiting for I/O","Jogging.StreamStateSection.KIND_UNKNOWN.lb":"Ready","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"},s=f.createInstance();s.use(p).init({supportedLngs:["en","de"],resources:{en:{translations:R},de:{translations:O}},ns:["translations"],defaultNS:"translations",detection:{order:["navigator","htmlTag"]}});function v(e){const t=m.memo(e);return(n=>g.jsx(T,{children:g.jsx(t,{...n})}))}const T=({children:e})=>g.jsx(y.I18nextProvider,{i18n:s,children:e});exports.dhParametersToPlaneSize=A;exports.externalizeComponent=v;exports.i18n=s;exports.orientationToQuaternion=B;exports.tryStringifyJson=J;exports.verticesToCoplanarity=E;
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as o from "three";
|
|
2
2
|
import { jsx as g } from "react/jsx-runtime";
|
|
3
3
|
import { memo as d } from "react";
|
|
4
4
|
import { I18nextProvider as m } from "react-i18next";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
function
|
|
5
|
+
import y from "i18next";
|
|
6
|
+
import f from "i18next-browser-languagedetector";
|
|
7
|
+
function O(e) {
|
|
8
8
|
try {
|
|
9
9
|
return JSON.stringify(e);
|
|
10
10
|
} catch {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const t = e.length(),
|
|
14
|
+
function N(e) {
|
|
15
|
+
const t = e.length(), a = new o.Quaternion();
|
|
16
16
|
if (t > 1e-6) {
|
|
17
|
-
const
|
|
18
|
-
|
|
17
|
+
const n = e.clone().normalize();
|
|
18
|
+
a.setFromAxisAngle(n, t);
|
|
19
19
|
}
|
|
20
|
-
return
|
|
20
|
+
return a;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function T(e) {
|
|
23
23
|
if (!e || e.length === 0)
|
|
24
24
|
return 5;
|
|
25
|
-
const
|
|
26
|
-
return !Number.isFinite(
|
|
25
|
+
const n = e.reduce((l, r) => l + Math.abs(r.a ?? 0) / 1e3 + Math.abs(r.d ?? 0) / 1e3, 0) * 2;
|
|
26
|
+
return !Number.isFinite(n) || n <= 0 ? 5 : n;
|
|
27
27
|
}
|
|
28
28
|
function M(e) {
|
|
29
29
|
if (e.length < 3)
|
|
30
30
|
return console.log("Not enough vertices to define a plane"), { isCoplanar: !1 };
|
|
31
|
-
const t = new
|
|
32
|
-
for (let
|
|
33
|
-
const c = new
|
|
34
|
-
if (Math.abs(
|
|
31
|
+
const t = new o.Vector3(e[0].x, e[0].y, e[0].z), a = new o.Vector3(e[1].x, e[1].y, e[1].z), n = new o.Vector3(e[2].x, e[2].y, e[2].z), l = new o.Vector3().subVectors(a, t), r = new o.Vector3().subVectors(n, t), s = new o.Vector3().crossVectors(l, r).normalize();
|
|
32
|
+
for (let i = 3; i < e.length; i++) {
|
|
33
|
+
const c = new o.Vector3(e[i].x, e[i].y, e[i].z), u = new o.Vector3().subVectors(c, t), b = s.dot(u);
|
|
34
|
+
if (Math.abs(b) > 1e-6)
|
|
35
35
|
return console.log("Vertices are not on the same plane"), { isCoplanar: !1 };
|
|
36
36
|
}
|
|
37
37
|
return { isCoplanar: !0, normal: s };
|
|
38
38
|
}
|
|
39
|
-
const
|
|
39
|
+
const p = {
|
|
40
40
|
"Jogging.Cartesian.Translation.velocityMmPerSec.lb": "{{amount}} mm/s",
|
|
41
41
|
"Jogging.Cartesian.Rotation.velocityDegPerSec.lb": "{{amount}}°/s",
|
|
42
42
|
"Jogging.Velocity.lb": "Geschwindigkeit",
|
|
@@ -95,46 +95,7 @@ Bei einem physischen Roboter bedeutet dies im Allgemeinen, dass ein Freigabescha
|
|
|
95
95
|
"Jogging.CoordinateSystem.hlb": "Koordinatensystem",
|
|
96
96
|
"Jogging.Cartesian.bt": "Kartesisch",
|
|
97
97
|
"Jogging.Joints.bt": "Gelenke",
|
|
98
|
-
"Jogging.Velocity.bt": "Geschwindigkeit"
|
|
99
|
-
"CycleTimer.RemainingTime.lb": "Verbleibende Zeit",
|
|
100
|
-
"CycleTimer.OfTime.lb": "von {{time}}",
|
|
101
|
-
"CycleTimer.Time.lb": "{{time}}",
|
|
102
|
-
"CycleTimer.Error.lb": "Fehler",
|
|
103
|
-
"CycleTimer.WaitingForCycle.lb": "Warten auf Programmzyklus",
|
|
104
|
-
"CycleTimer.CycleTime.lb": "Zykluszeit",
|
|
105
|
-
"CycleTimer.Measuring.lb": "wird gemessen...",
|
|
106
|
-
"CycleTimer.Determined.lb": "bestimmt",
|
|
107
|
-
"Timer.error": "Fehler",
|
|
108
|
-
"ProgramControl.Start.bt": "Start",
|
|
109
|
-
"ProgramControl.Resume.bt": "Weiter",
|
|
110
|
-
"ProgramControl.Retry.bt": "Wiederholen",
|
|
111
|
-
"ProgramControl.Pause.bt": "Pause",
|
|
112
|
-
"ProgramControl.Stop.bt": "Stopp",
|
|
113
|
-
"ProgramStateIndicator.Preparing.lb": "Vorbereitung",
|
|
114
|
-
"ProgramStateIndicator.Starting.lb": "Startet",
|
|
115
|
-
"ProgramStateIndicator.Running.lb": "In Betrieb",
|
|
116
|
-
"ProgramStateIndicator.Pausing.lb": "Pausiert",
|
|
117
|
-
"ProgramStateIndicator.Stopping.lb": "Stoppt",
|
|
118
|
-
"ProgramStateIndicator.Completed.lb": "Abgeschlossen",
|
|
119
|
-
"ProgramStateIndicator.Failed.lb": "Fehlgeschlagen",
|
|
120
|
-
"ProgramStateIndicator.Error.lb": "Fehler",
|
|
121
|
-
"ProgramStateIndicator.EStop.lb": "Not-Aus",
|
|
122
|
-
"ProgramStateIndicator.Idle.lb": "Leerlauf",
|
|
123
|
-
"ProgramStateIndicator.Paused.lb": "Pausiert",
|
|
124
|
-
"ProgramStateIndicator.Ready.lb": "Bereit",
|
|
125
|
-
"ProgramStateIndicator.Stopped.lb": "Gestoppt",
|
|
126
|
-
"ProgramStateIndicator.Auto.lb": "Auto",
|
|
127
|
-
"ProgramStateIndicator.Manual.lb": "Manuell",
|
|
128
|
-
"ProgramStateIndicator.ManualT1.lb": "Manuell T1",
|
|
129
|
-
"ProgramStateIndicator.ManualT2.lb": "Manuell T2",
|
|
130
|
-
"RobotSetupReadinessIndicator.Ready.lb": "Bereit",
|
|
131
|
-
"RobotSetupReadinessIndicator.RobotDisconnected.lb": "Roboter getrennt",
|
|
132
|
-
"RobotSetupReadinessIndicator.CellOpen.lb": "Zelle offen",
|
|
133
|
-
"RobotSetupReadinessIndicator.EStop.lb": "Not-Stopp",
|
|
134
|
-
"RobotSetupReadinessIndicator.ManualMode.lb": "Manueller Modus",
|
|
135
|
-
"RobotSetupReadinessIndicator.PreconditionNotFulfilled.lb": "Voraussetzung nicht erfüllt",
|
|
136
|
-
"RobotCard.Runtime.lb": "Laufzeit",
|
|
137
|
-
"RobotCard.DriveToHome.bt": "Zur Home-Position fahren"
|
|
98
|
+
"Jogging.Velocity.bt": "Geschwindigkeit"
|
|
138
99
|
}, h = {
|
|
139
100
|
"Jogging.Cartesian.Translation.velocityMmPerSec.lb": "{{amount}} mm/s",
|
|
140
101
|
"Jogging.Cartesian.Rotation.velocityDegPerSec.lb": "{{amount}}°/s",
|
|
@@ -194,55 +155,16 @@ Bei einem physischen Roboter bedeutet dies im Allgemeinen, dass ein Freigabescha
|
|
|
194
155
|
"Jogging.CoordinateSystem.hlb": "Coordinate system",
|
|
195
156
|
"Jogging.Cartesian.bt": "Cartesian",
|
|
196
157
|
"Jogging.Joints.bt": "Joints",
|
|
197
|
-
"Jogging.Velocity.bt": "Velocity"
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
"CycleTimer.Time.lb": "{{time}}",
|
|
201
|
-
"CycleTimer.Error.lb": "Error",
|
|
202
|
-
"CycleTimer.WaitingForCycle.lb": "Waiting for program cycle",
|
|
203
|
-
"CycleTimer.CycleTime.lb": "Cycle Time",
|
|
204
|
-
"CycleTimer.Measuring.lb": "measuring...",
|
|
205
|
-
"CycleTimer.Determined.lb": "determined",
|
|
206
|
-
"Timer.error": "Error",
|
|
207
|
-
"ProgramControl.Start.bt": "Start",
|
|
208
|
-
"ProgramControl.Resume.bt": "Resume",
|
|
209
|
-
"ProgramControl.Retry.bt": "Retry",
|
|
210
|
-
"ProgramControl.Pause.bt": "Pause",
|
|
211
|
-
"ProgramControl.Stop.bt": "Stop",
|
|
212
|
-
"ProgramStateIndicator.Preparing.lb": "Preparing",
|
|
213
|
-
"ProgramStateIndicator.Starting.lb": "Starting",
|
|
214
|
-
"ProgramStateIndicator.Running.lb": "Running",
|
|
215
|
-
"ProgramStateIndicator.Pausing.lb": "Pausing",
|
|
216
|
-
"ProgramStateIndicator.Stopping.lb": "Stopping",
|
|
217
|
-
"ProgramStateIndicator.Completed.lb": "Completed",
|
|
218
|
-
"ProgramStateIndicator.Failed.lb": "Failed",
|
|
219
|
-
"ProgramStateIndicator.Error.lb": "Error",
|
|
220
|
-
"ProgramStateIndicator.EStop.lb": "E-Stop",
|
|
221
|
-
"ProgramStateIndicator.Idle.lb": "Idle",
|
|
222
|
-
"ProgramStateIndicator.Paused.lb": "Paused",
|
|
223
|
-
"ProgramStateIndicator.Ready.lb": "Ready",
|
|
224
|
-
"ProgramStateIndicator.Stopped.lb": "Stopped",
|
|
225
|
-
"ProgramStateIndicator.Auto.lb": "Auto",
|
|
226
|
-
"ProgramStateIndicator.Manual.lb": "Manual",
|
|
227
|
-
"ProgramStateIndicator.ManualT1.lb": "Manual T1",
|
|
228
|
-
"ProgramStateIndicator.ManualT2.lb": "Manual T2",
|
|
229
|
-
"RobotSetupReadinessIndicator.Ready.lb": "Ready",
|
|
230
|
-
"RobotSetupReadinessIndicator.RobotDisconnected.lb": "Robot disconnected",
|
|
231
|
-
"RobotSetupReadinessIndicator.CellOpen.lb": "Cell open",
|
|
232
|
-
"RobotSetupReadinessIndicator.EStop.lb": "E-Stop",
|
|
233
|
-
"RobotSetupReadinessIndicator.ManualMode.lb": "Manual mode",
|
|
234
|
-
"RobotSetupReadinessIndicator.PreconditionNotFulfilled.lb": "Precondition not fulfilled",
|
|
235
|
-
"RobotCard.Runtime.lb": "Runtime",
|
|
236
|
-
"RobotCard.DriveToHome.bt": "Drive to Home"
|
|
237
|
-
}, S = p.createInstance();
|
|
238
|
-
S.use(y).init({
|
|
158
|
+
"Jogging.Velocity.bt": "Velocity"
|
|
159
|
+
}, S = y.createInstance();
|
|
160
|
+
S.use(f).init({
|
|
239
161
|
supportedLngs: ["en", "de"],
|
|
240
162
|
resources: {
|
|
241
163
|
en: {
|
|
242
164
|
translations: h
|
|
243
165
|
},
|
|
244
166
|
de: {
|
|
245
|
-
translations:
|
|
167
|
+
translations: p
|
|
246
168
|
}
|
|
247
169
|
},
|
|
248
170
|
ns: ["translations"],
|
|
@@ -251,18 +173,18 @@ S.use(y).init({
|
|
|
251
173
|
order: ["navigator", "htmlTag"]
|
|
252
174
|
}
|
|
253
175
|
});
|
|
254
|
-
function
|
|
176
|
+
function I(e) {
|
|
255
177
|
const t = d(e);
|
|
256
|
-
return ((
|
|
178
|
+
return ((n) => /* @__PURE__ */ g(J, { children: /* @__PURE__ */ g(t, { ...n }) }));
|
|
257
179
|
}
|
|
258
|
-
const
|
|
180
|
+
const J = ({
|
|
259
181
|
children: e
|
|
260
182
|
}) => /* @__PURE__ */ g(m, { i18n: S, children: e });
|
|
261
183
|
export {
|
|
262
|
-
|
|
263
|
-
|
|
184
|
+
T as d,
|
|
185
|
+
I as e,
|
|
264
186
|
S as i,
|
|
265
|
-
|
|
266
|
-
|
|
187
|
+
N as o,
|
|
188
|
+
O as t,
|
|
267
189
|
M as v
|
|
268
190
|
};
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { Nova as d } from "@wandelbots/nova-js/v2";
|
|
2
|
+
import { autorun as A, observable as y, runInAction as T } from "mobx";
|
|
3
|
+
import V, { useEffect as C, useState as w, useRef as v } from "react";
|
|
4
|
+
function I(e) {
|
|
5
|
+
C(e, []);
|
|
6
|
+
}
|
|
7
|
+
function _(e) {
|
|
8
|
+
I(() => A(e));
|
|
9
|
+
}
|
|
10
|
+
function j(e) {
|
|
11
|
+
return I(() => {
|
|
12
|
+
let t;
|
|
13
|
+
function n() {
|
|
14
|
+
e(), t = requestAnimationFrame(n);
|
|
15
|
+
}
|
|
16
|
+
return t = requestAnimationFrame(n), () => {
|
|
17
|
+
cancelAnimationFrame(t);
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function k(e) {
|
|
22
|
+
return e instanceof d ? e : typeof e == "string" ? new d({ instanceUrl: e }) : new d({
|
|
23
|
+
instanceUrl: e.config.instanceUrl,
|
|
24
|
+
accessToken: e.accessToken ?? e.config.accessToken ?? void 0
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function q(e) {
|
|
28
|
+
return typeof e == "string" ? void 0 : e.config.cellId;
|
|
29
|
+
}
|
|
30
|
+
class F {
|
|
31
|
+
constructor(t = [], n = {}) {
|
|
32
|
+
this.currentValues = [], this.targetValues = [], this.previousTargetValues = [], this.targetUpdateTime = 0, this.animationId = null, this.updateCount = 0, this.velocities = [], this.animate = () => {
|
|
33
|
+
this.update(0.016666666666666666) ? this.animationId = null : this.animationId = requestAnimationFrame(this.animate);
|
|
34
|
+
}, this.options = {
|
|
35
|
+
tension: 120,
|
|
36
|
+
friction: 20,
|
|
37
|
+
threshold: 1e-3,
|
|
38
|
+
onChange: () => {
|
|
39
|
+
},
|
|
40
|
+
onComplete: () => {
|
|
41
|
+
},
|
|
42
|
+
...n
|
|
43
|
+
}, this.currentValues = [...t], this.targetValues = [...t], this.previousTargetValues = [...t], this.velocities = new Array(t.length).fill(0), this.targetUpdateTime = performance.now(), this.updateCount = 0;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Update interpolation using spring physics
|
|
47
|
+
*
|
|
48
|
+
* Call this method every frame for smooth animation. In React Three Fiber,
|
|
49
|
+
* call from within useFrame callback with the provided delta time.
|
|
50
|
+
*
|
|
51
|
+
* @param delta - Time elapsed since last update in seconds (e.g., 1/60 ≈ 0.0167 for 60fps)
|
|
52
|
+
* @returns true when interpolation is complete (all values reached their targets)
|
|
53
|
+
*/
|
|
54
|
+
update(t = 1 / 60) {
|
|
55
|
+
let n = !1, s = !0;
|
|
56
|
+
this.updateCount++;
|
|
57
|
+
const o = Math.min(t, 1 / 15), u = this.updateCount === 1 ? 0.7 : 1;
|
|
58
|
+
for (let i = 0; i < this.currentValues.length; i++) {
|
|
59
|
+
const l = this.currentValues[i], h = this.targetValues[i], g = this.velocities[i], r = h - l, a = r * this.options.tension * u, f = g * this.options.friction, c = a - f, m = g + c * o, p = l + m * o;
|
|
60
|
+
Math.abs(r) < this.options.threshold && Math.abs(m) < this.options.threshold * 10 ? this.currentValues[i] !== h && (this.currentValues[i] = h, this.velocities[i] = 0, n = !0) : (s = !1, this.currentValues[i] = p, this.velocities[i] = m, n = !0);
|
|
61
|
+
}
|
|
62
|
+
return n && this.options.onChange(this.currentValues), s && this.options.onComplete(this.currentValues), s;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Set new target values for the interpolation to move towards
|
|
66
|
+
*
|
|
67
|
+
* Includes smart blending for very rapid target updates (faster than 120fps)
|
|
68
|
+
* to prevent jarring movements when targets change frequently.
|
|
69
|
+
*/
|
|
70
|
+
setTarget(t) {
|
|
71
|
+
const n = performance.now(), s = n - this.targetUpdateTime;
|
|
72
|
+
this.previousTargetValues = [...this.targetValues], this.targetValues = [...t], this.targetUpdateTime = n, this.updateCount = 0;
|
|
73
|
+
const o = this.previousTargetValues.every(
|
|
74
|
+
(u, i) => u === this.currentValues[i]
|
|
75
|
+
);
|
|
76
|
+
if (s < 8 && s > 0 && this.previousTargetValues.length > 0 && !o) {
|
|
77
|
+
const u = Math.min(s / 8, 1);
|
|
78
|
+
for (let i = 0; i < this.targetValues.length; i++) {
|
|
79
|
+
const l = this.previousTargetValues[i] || 0, h = t[i] || 0;
|
|
80
|
+
Math.abs(h - l) > 0.1 && (this.targetValues[i] = l + (h - l) * u);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
for (; this.currentValues.length < t.length; )
|
|
84
|
+
this.currentValues.push(t[this.currentValues.length]), this.velocities.push(0);
|
|
85
|
+
this.currentValues.length > t.length && (this.currentValues = this.currentValues.slice(0, t.length), this.velocities = this.velocities.slice(0, t.length));
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get a copy of all current interpolated values
|
|
89
|
+
*/
|
|
90
|
+
getCurrentValues() {
|
|
91
|
+
return [...this.currentValues];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Get a single interpolated value by its array index
|
|
95
|
+
*/
|
|
96
|
+
getValue(t) {
|
|
97
|
+
return this.currentValues[t] ?? 0;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Check if automatic interpolation is currently running
|
|
101
|
+
*
|
|
102
|
+
* This only tracks auto-interpolation started with startAutoInterpolation().
|
|
103
|
+
* Manual update() calls are not tracked by this method.
|
|
104
|
+
*/
|
|
105
|
+
isInterpolating() {
|
|
106
|
+
return this.animationId !== null;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Stop automatic interpolation if it's running
|
|
110
|
+
*
|
|
111
|
+
* This cancels the internal animation frame loop but does not affect
|
|
112
|
+
* manual update() calls.
|
|
113
|
+
*/
|
|
114
|
+
stop() {
|
|
115
|
+
this.animationId !== null && (cancelAnimationFrame(this.animationId), this.animationId = null);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Instantly set values without interpolation
|
|
119
|
+
*/
|
|
120
|
+
setImmediate(t) {
|
|
121
|
+
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);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Update interpolation options
|
|
125
|
+
*/
|
|
126
|
+
updateOptions(t) {
|
|
127
|
+
this.options = { ...this.options, ...t };
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Start automatic interpolation with an animation loop
|
|
131
|
+
*
|
|
132
|
+
* This begins a requestAnimationFrame loop that calls update() automatically.
|
|
133
|
+
* For React Three Fiber components, prefer using manual update() calls
|
|
134
|
+
* within useFrame hooks instead.
|
|
135
|
+
*/
|
|
136
|
+
startAutoInterpolation() {
|
|
137
|
+
this.startInterpolation();
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Clean up all resources and stop any running animations
|
|
141
|
+
*
|
|
142
|
+
* This cancels any active animation frames and resets internal state.
|
|
143
|
+
* Call this when the component unmounts or is no longer needed.
|
|
144
|
+
*/
|
|
145
|
+
destroy() {
|
|
146
|
+
this.stop();
|
|
147
|
+
}
|
|
148
|
+
startInterpolation() {
|
|
149
|
+
this.animationId === null && this.animate();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function O(e = [], t = {}) {
|
|
153
|
+
const n = V.useRef(null);
|
|
154
|
+
return n.current || (n.current = new F(e, t)), V.useEffect(() => {
|
|
155
|
+
var s;
|
|
156
|
+
(s = n.current) == null || s.updateOptions(t);
|
|
157
|
+
}, [t]), V.useEffect(() => () => {
|
|
158
|
+
var s;
|
|
159
|
+
(s = n.current) == null || s.destroy();
|
|
160
|
+
}, []), [n.current];
|
|
161
|
+
}
|
|
162
|
+
function E(e, t) {
|
|
163
|
+
const [n] = w(
|
|
164
|
+
() => y({ ...e })
|
|
165
|
+
), s = v(null), o = v(null), u = v(0);
|
|
166
|
+
function i() {
|
|
167
|
+
o.current !== null && (cancelAnimationFrame(o.current), o.current = null);
|
|
168
|
+
}
|
|
169
|
+
function l() {
|
|
170
|
+
const r = s.current;
|
|
171
|
+
if (!r) return;
|
|
172
|
+
const a = performance.now(), f = (a - u.current) / 1e3;
|
|
173
|
+
u.current = a;
|
|
174
|
+
const c = r.update(f);
|
|
175
|
+
T(() => {
|
|
176
|
+
n.joint_position = r.getCurrentValues();
|
|
177
|
+
}), o.current = c ? null : requestAnimationFrame(l);
|
|
178
|
+
}
|
|
179
|
+
function h() {
|
|
180
|
+
o.current === null && (u.current = performance.now(), o.current = requestAnimationFrame(l));
|
|
181
|
+
}
|
|
182
|
+
function g(r) {
|
|
183
|
+
var f;
|
|
184
|
+
const a = r.joint_position.filter(
|
|
185
|
+
(c) => c !== void 0
|
|
186
|
+
);
|
|
187
|
+
(f = s.current) == null || f.setTarget(a), T(() => {
|
|
188
|
+
const c = r, m = n;
|
|
189
|
+
for (const p of Object.keys(c))
|
|
190
|
+
p !== "joint_position" && m[p] !== c[p] && (m[p] = c[p]);
|
|
191
|
+
}), h();
|
|
192
|
+
}
|
|
193
|
+
return I(() => {
|
|
194
|
+
const r = e.joint_position.filter(
|
|
195
|
+
(a) => a !== void 0
|
|
196
|
+
);
|
|
197
|
+
return s.current = new F(r, t), () => {
|
|
198
|
+
var a;
|
|
199
|
+
i(), (a = s.current) == null || a.destroy();
|
|
200
|
+
};
|
|
201
|
+
}), C(() => {
|
|
202
|
+
var r;
|
|
203
|
+
t && ((r = s.current) == null || r.updateOptions(t));
|
|
204
|
+
}, [t]), C(() => A(() => g(e)), [e]), n;
|
|
205
|
+
}
|
|
206
|
+
export {
|
|
207
|
+
F as V,
|
|
208
|
+
E as a,
|
|
209
|
+
_ as b,
|
|
210
|
+
k as c,
|
|
211
|
+
j as d,
|
|
212
|
+
q as e,
|
|
213
|
+
O as u
|
|
214
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const v=require("@wandelbots/nova-js/v2"),V=require("mobx"),u=require("react");function I(e){u.useEffect(e,[])}function T(e){I(()=>V.autorun(e))}function A(e){return I(()=>{let t;function n(){e(),t=requestAnimationFrame(n)}return t=requestAnimationFrame(n),()=>{cancelAnimationFrame(t)}})}function F(e){return e instanceof v.Nova?e:typeof e=="string"?new v.Nova({instanceUrl:e}):new v.Nova({instanceUrl:e.config.instanceUrl,accessToken:e.accessToken??e.config.accessToken??void 0})}function y(e){return typeof e=="string"?void 0:e.config.cellId}class C{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 o=Math.min(t,1/15),c=this.updateCount===1?.7:1;for(let i=0;i<this.currentValues.length;i++){const l=this.currentValues[i],f=this.targetValues[i],d=this.velocities[i],r=f-l,a=r*this.options.tension*c,m=d*this.options.friction,h=a-m,g=d+h*o,p=l+g*o;Math.abs(r)<this.options.threshold&&Math.abs(g)<this.options.threshold*10?this.currentValues[i]!==f&&(this.currentValues[i]=f,this.velocities[i]=0,n=!0):(s=!1,this.currentValues[i]=p,this.velocities[i]=g,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 o=this.previousTargetValues.every((c,i)=>c===this.currentValues[i]);if(s<8&&s>0&&this.previousTargetValues.length>0&&!o){const c=Math.min(s/8,1);for(let i=0;i<this.targetValues.length;i++){const l=this.previousTargetValues[i]||0,f=t[i]||0;Math.abs(f-l)>.1&&(this.targetValues[i]=l+(f-l)*c)}}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 w(e=[],t={}){const n=u.useRef(null);return n.current||(n.current=new C(e,t)),u.useEffect(()=>{var s;(s=n.current)==null||s.updateOptions(t)},[t]),u.useEffect(()=>()=>{var s;(s=n.current)==null||s.destroy()},[]),[n.current]}function R(e,t){const[n]=u.useState(()=>V.observable({...e})),s=u.useRef(null),o=u.useRef(null),c=u.useRef(0);function i(){o.current!==null&&(cancelAnimationFrame(o.current),o.current=null)}function l(){const r=s.current;if(!r)return;const a=performance.now(),m=(a-c.current)/1e3;c.current=a;const h=r.update(m);V.runInAction(()=>{n.joint_position=r.getCurrentValues()}),o.current=h?null:requestAnimationFrame(l)}function f(){o.current===null&&(c.current=performance.now(),o.current=requestAnimationFrame(l))}function d(r){var m;const a=r.joint_position.filter(h=>h!==void 0);(m=s.current)==null||m.setTarget(a),V.runInAction(()=>{const h=r,g=n;for(const p of Object.keys(h))p!=="joint_position"&&g[p]!==h[p]&&(g[p]=h[p])}),f()}return I(()=>{const r=e.joint_position.filter(a=>a!==void 0);return s.current=new C(r,t),()=>{var a;i(),(a=s.current)==null||a.destroy()}}),u.useEffect(()=>{var r;t&&((r=s.current)==null||r.updateOptions(t))},[t]),u.useEffect(()=>V.autorun(()=>d(e)),[e]),n}exports.ValueInterpolator=C;exports.cellIdOf=y;exports.createNovaClient=F;exports.useAnimationFrame=A;exports.useAutorun=T;exports.useInterpolation=w;exports.useSmoothedMotionState=R;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Stack from "@mui/material/Stack";
|
|
2
2
|
import React, { type ReactNode } from "react";
|
|
3
|
-
import type { AxisControlComponentColors } from "
|
|
3
|
+
import type { AxisControlComponentColors } from "./joggingColors";
|
|
4
4
|
import type { JoggingDirection } from "./JoggingStore";
|
|
5
5
|
type JoggingCartesianAxisControlProps = {
|
|
6
6
|
colors?: AxisControlComponentColors;
|