@wandelbots/wandelbots-js-react-components 3.7.4-pr.feat-add-linear-axis-support.509.8e469ba → 3.7.4-pr.feat-add-linear-axis-support.509.f8a60f7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/3d.cjs.js +1 -1
- package/dist/3d.es.js +1 -1
- package/dist/{SupportedLinearAxis-Cc5zohcs.cjs → SupportedLinearAxis-BJSxJiXa.cjs} +2 -2
- package/dist/{SupportedLinearAxis-Cc5zohcs.cjs.map → SupportedLinearAxis-BJSxJiXa.cjs.map} +1 -1
- package/dist/{SupportedLinearAxis-DAK0IyqZ.js → SupportedLinearAxis-DXniSSz1.js} +2 -2
- package/dist/{SupportedLinearAxis-DAK0IyqZ.js.map → SupportedLinearAxis-DXniSSz1.js.map} +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/package.json +1 -1
- package/src/components/robots/LinearAxisAnimator.tsx +2 -2
package/dist/3d.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./SupportedLinearAxis-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./SupportedLinearAxis-BJSxJiXa.cjs");exports.CollisionSceneRenderer=e.CollisionSceneRenderer;exports.MANUFACTURER_HOME_CONFIGS=e.MANUFACTURER_HOME_CONFIGS;exports.PresetEnvironment=e.PresetEnvironment;exports.Robot=e.Robot;exports.RobotCard=e.RobotCard;exports.SafetyZonesRenderer=e.SafetyZonesRenderer;exports.SupportedLinearAxis=e.SupportedLinearAxis;exports.SupportedRobot=e.SupportedRobot;exports.TrajectoryRenderer=e.TrajectoryRenderer;exports.defaultAxisConfig=e.defaultAxisConfig;exports.defaultGetModel=e.defaultGetModel;exports.extractManufacturer=e.extractManufacturer;exports.getDefaultHomeConfig=e.getDefaultHomeConfig;
|
|
2
2
|
//# sourceMappingURL=3d.cjs.js.map
|
package/dist/3d.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as o, M as r, P as s, R as t, a as n, S as d, b as f, c as R, T as i, d as u, e as C, f as l, g as S } from "./SupportedLinearAxis-
|
|
1
|
+
import { C as o, M as r, P as s, R as t, a as n, S as d, b as f, c as R, T as i, d as u, e as C, f as l, g as S } from "./SupportedLinearAxis-DXniSSz1.js";
|
|
2
2
|
export {
|
|
3
3
|
o as CollisionSceneRenderer,
|
|
4
4
|
r as MANUFACTURER_HOME_CONFIGS,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const t=require("./externalizeComponent-CkVWk2F_.cjs"),g=require("three"),q=require("three-stdlib"),_=require("@react-three/fiber"),M=require("@react-three/drei"),E=require("@mui/material"),oe=require("mobx-react-lite"),m=require("react"),ie=require("react-i18next"),y=require("./interpolation-DZhBKo-u.cjs"),W=require("react-error-boundary");function ae(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const j=ae(g);function ue(e){switch(e.shape_type){case"convex_hull":return new q.ConvexGeometry(e.vertices.map(n=>new j.Vector3(n[0]/1e3,n[1]/1e3,n[2]/1e3)));case"box":return new j.BoxGeometry(e.size_x/1e3,e.size_y/1e3,e.size_z/1e3);case"sphere":return new j.SphereGeometry(e.radius/1e3);case"capsule":return new j.CapsuleGeometry(e.radius/1e3,e.cylinder_height/1e3);case"cylinder":return new j.CylinderGeometry(e.radius/1e3,e.radius/1e3,e.height/1e3);case"rectangle":return new j.BoxGeometry(e.size_x/1e3,e.size_y/1e3,0);default:return console.warn(`${e.shape_type} is not supported`),new j.BufferGeometry}}function ce({name:e,collider:r,children:n}){var l,u;const a=((l=r.pose)==null?void 0:l.position)??[0,0,0],o=((u=r.pose)==null?void 0:u.orientation)??[0,0,0];return r.margin&&console.warn(`${e} margin is not supported`),t.jsxRuntimeExports.jsx("mesh",{name:e,position:new j.Vector3(a[0],a[1],a[2]).divideScalar(1e3),rotation:new j.Euler(o[0],o[1],o[2],"XYZ"),geometry:ue(r.shape),children:n})}function le({name:e,colliders:r,meshChildrenProvider:n,...a}){return t.jsxRuntimeExports.jsx("group",{name:e,...a,children:Object.entries(r).map(([o,l])=>t.jsxRuntimeExports.jsx(ce,{name:o,collider:l,children:n(o,l)},o))})}function xe({scene:e,meshChildrenProvider:r}){const n=e.colliders;return t.jsxRuntimeExports.jsx("group",{children:n&&t.jsxRuntimeExports.jsx(le,{meshChildrenProvider:r,colliders:n})})}function F(){return t.jsxRuntimeExports.jsx(M.Environment,{children:t.jsxRuntimeExports.jsx(pe,{})})}function pe({positions:e=[2,0,2,0,2,0,2,0]}){return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(M.Lightformer,{intensity:5,"rotation-x":Math.PI/2,position:[0,5,-9],scale:[10,10,1]}),t.jsxRuntimeExports.jsx("group",{rotation:[0,.5,0],children:t.jsxRuntimeExports.jsx("group",{children:e.map((r,n)=>t.jsxRuntimeExports.jsx(M.Lightformer,{form:"circle",intensity:5,rotation:[Math.PI/2,0,0],position:[r,4,n*4],scale:[3,1,1]},n))})}),t.jsxRuntimeExports.jsx(M.Lightformer,{intensity:40,"rotation-y":Math.PI/2,position:[-5,1,-1],scale:[20,.1,1]}),t.jsxRuntimeExports.jsx(M.Lightformer,{intensity:20,"rotation-y":-Math.PI,position:[-5,-2,-1],scale:[20,.1,1]}),t.jsxRuntimeExports.jsx(M.Lightformer,{"rotation-y":Math.PI/2,position:[-5,-1,-1],scale:[20,.5,1],intensity:5}),t.jsxRuntimeExports.jsx(M.Lightformer,{"rotation-y":-Math.PI/2,position:[10,1,0],scale:[20,1,1],intensity:10}),t.jsxRuntimeExports.jsx(M.Lightformer,{form:"ring",color:"white",intensity:5,scale:10,position:[-15,4,-18],target:[0,0,0]})]})}function me(e){if(e.length<3)return console.log("Not enough vertices to define a plane"),{isCoplanar:!1};const r=new j.Vector3(e[0].x,e[0].y,e[0].z),n=new j.Vector3(e[1].x,e[1].y,e[1].z),a=new j.Vector3(e[2].x,e[2].y,e[2].z),o=new j.Vector3().subVectors(n,r),l=new j.Vector3().subVectors(a,r),u=new j.Vector3().crossVectors(o,l).normalize();for(let x=3;x<e.length;x++){const c=new j.Vector3(e[x].x,e[x].y,e[x].z),f=new j.Vector3().subVectors(c,r),p=u.dot(f);if(Math.abs(p)>1e-6)return console.log("Vertices are not on the same plane"),{isCoplanar:!1}}return{isCoplanar:!0,normal:u}}function fe({safetyZones:e,...r}){return t.jsxRuntimeExports.jsx("group",{...r,children:e.map((n,a)=>{let o=[];return n.geometry&&(n.geometry.compound?o=n.geometry.compound.child_geometries:n.geometry.convex_hull&&(o=[n.geometry])),o.map((l,u)=>{if(!l.convex_hull)return null;const x=l.convex_hull.vertices.map(p=>new j.Vector3(p.x/1e3,p.y/1e3,p.z/1e3)),c=me(x);if(c.isCoplanar&&c.normal){const s=new j.Vector3().addVectors(x[0],c.normal.multiplyScalar(1e-4));x.push(s)}let f;try{f=new q.ConvexGeometry(x)}catch(p){return console.log("Error creating ConvexGeometry:",p),null}return t.jsxRuntimeExports.jsx("mesh",{geometry:f,children:t.jsxRuntimeExports.jsx("meshStandardMaterial",{attach:"material",color:"#009f4d",opacity:.2,depthTest:!1,depthWrite:!1,transparent:!0,polygonOffset:!0,polygonOffsetFactor:-u},a)},`${a}-${u}`)})})})}function de({trajectory:e,...r}){var a;const n=((a=e.trajectory)==null?void 0:a.map(o=>o.tcp_pose?new j.Vector3(o.tcp_pose.position.x/1e3,o.tcp_pose.position.z/1e3,-o.tcp_pose.position.y/1e3):null).filter(o=>o!==null))||[];return t.jsxRuntimeExports.jsx("group",{...r,children:n.length>0&&t.jsxRuntimeExports.jsx(M.Line,{points:n,lineWidth:3,polygonOffset:!0,polygonOffsetFactor:10,polygonOffsetUnits:10})})}const A=new Map;async function T(e){if(A.has(e))return A.get(e);const r=(async()=>{var l;const a=new y.NovaClient({instanceUrl:""}),o=a.api.motionGroupModels;(l=o.axios)!=null&&l.interceptors&&o.axios.interceptors.request.use(u=>{var x;return(x=u.url)!=null&&x.includes("/glb")&&(u.responseType="blob"),u});try{const u=await a.api.motionGroupModels.getMotionGroupGlbModel(e);return URL.createObjectURL(u)}catch(u){throw console.error("Failed to fetch model:",u),u}})();return A.set(e,r),r}function H(e){function r(n){return n.children.length===0?[n]:[n,...n.children.flatMap(a=>r(a))]}return r(e).filter(n=>$(n))}function J(e){return e.name.endsWith("_FLG")}function $(e){return/_J[0-9]+$/.test(e.name)}function he(e,r){let n;function a(o){if(J(o)){if(n)throw Error(`Found multiple flange groups in robot model ${r}; first ${n.name} then ${o.name}. Only one _FLG group is allowed.`);n=o}$(o),o.children.map(a)}if(a(e.scene),!n)throw Error(`No flange group found in robot model ${r}. Flange must be identified with a name ending in _FLG.`);return{gltf:e}}function N({rapidlyChangingMotionState:e,dhParameters:r,onRotationChanged:n,children:a}){const o=m.useRef([]),l=m.useRef([]),u=m.useRef(null),{invalidate:x}=_.useThree();m.useEffect(()=>{const s=e.joint_position.filter(i=>i!==void 0);return u.current=new y.ValueInterpolator(s,{tension:120,friction:20,threshold:.001}),()=>{var i;(i=u.current)==null||i.destroy()}},[]),_.useFrame((s,i)=>{if(u.current){const d=u.current.update(i);f(),d||x()}});function c(s){s&&(l.current=H(s),f(),x())}function f(){var i;const s=((i=u.current)==null?void 0:i.getCurrentValues())||[];if(n)n(l.current,s);else for(const[d,R]of l.current.entries()){const h=r[d],w=h.theta||0,b=h.reverse_rotation_direction?-1:1;R.rotation.y=b*(s[d]||0)+w}}const p=m.useCallback(()=>{const s=e.joint_position.filter(i=>i!==void 0);requestAnimationFrame(()=>{var i;o.current=s,(i=u.current)==null||i.setTarget(s)})},[e]);return m.useEffect(()=>{p()},[e,p]),y.useAutorun(()=>{p()}),t.jsxRuntimeExports.jsx("group",{ref:c,children:a})}const je="line",Re="mesh";function ge({rapidlyChangingMotionState:e,dhParameters:r,...n}){const a=new g.Matrix4,o=m.useRef([]),l=m.useRef([]);m.useEffect(()=>{o.current=new Array(r.length).fill(null),l.current=new Array(r.length).fill(null)},[r.length]);function u(f,p){const s=new g.Vector3,i=new g.Quaternion,d=new g.Vector3;a.decompose(s,i,d);const R=s.clone(),h=new g.Matrix4().makeRotationY(f.theta+p*(f.reverse_rotation_direction?-1:1)).multiply(new g.Matrix4().makeTranslation(0,f.d/1e3,0)).multiply(new g.Matrix4().makeTranslation(f.a/1e3,0,0)).multiply(new g.Matrix4().makeRotationX(f.alpha));return a.multiply(h),a.decompose(s,i,d),{a:R,b:s}}function x(f,p,s,i){if(!r)return;const d=r[f];if(!d)return;const{a:R,b:h}=u(d,i);p.geometry.setPositions([R.toArray(),h.toArray()].flat()),s.position.set(h.x,h.y,h.z)}function c(f,p){a.identity();for(let s=0;s<Math.min(f.length,p.length);s++){const i=o.current[s],d=l.current[s];i&&d&&x(s,i,d,p[s])}}return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(N,{rapidlyChangingMotionState:e,dhParameters:r,onRotationChanged:c,children:t.jsxRuntimeExports.jsxs("group",{...n,name:"Scene",children:[t.jsxRuntimeExports.jsxs("mesh",{children:[t.jsxRuntimeExports.jsx("sphereGeometry",{args:[.01,32,32]}),t.jsxRuntimeExports.jsx("meshStandardMaterial",{color:"black",depthTest:!0})]}),r.map((f,p)=>{const{a:s,b:i}=u(f,e.joint_position[p]??0),d=`dhrobot_J0${p}`;return t.jsxRuntimeExports.jsxs("group",{name:d,children:[t.jsxRuntimeExports.jsx(M.Line,{ref:R=>{o.current[p]=R},name:je,points:[s,i],color:"white",lineWidth:5}),t.jsxRuntimeExports.jsxs("mesh",{ref:R=>{l.current[p]=R},name:Re,position:i,children:[t.jsxRuntimeExports.jsx("sphereGeometry",{args:[.01,32,32]}),t.jsxRuntimeExports.jsx("meshStandardMaterial",{color:"black",depthTest:!0})]},"mesh_"+p)]},d)})]})})})}const Ee=console.warn;function Y(){return m.useEffect(()=>{console.warn=e=>{e!=="Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"&&Ee(e)}},[]),t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{})}function ye(e){return e.type==="Mesh"}function be({url:e,flangeRef:r,postModelRender:n,...a}){const o=M.useGLTF(e);let l;try{l=he(o,"robot.glb").gltf}catch(c){throw c}const u=m.useCallback(c=>{c&&n&&n()},[n]);function x(c){try{return ye(c)?c.geometry?t.jsxRuntimeExports.jsx("mesh",{name:c.name,geometry:c.geometry,material:c.material,position:c.position,rotation:c.rotation},c.uuid):t.jsxRuntimeExports.jsx("group",{name:c.name,position:c.position,rotation:c.rotation},c.uuid):t.jsxRuntimeExports.jsx("group",{name:c.name,position:c.position,rotation:c.rotation,ref:J(c)?r:void 0,children:c.children.map(x)},c.uuid)}catch(f){return console.warn("Error rendering node",c.name,f),null}}return t.jsxRuntimeExports.jsx("group",{...a,dispose:null,ref:u,children:x(l.scene)})}function X({modelURL:e,flangeRef:r,postModelRender:n,...a}){const[o,l]=m.useState(null);return m.useEffect(()=>{(async()=>{try{if(typeof e=="string")l(e);else{const x=await e;l(x)}}catch(x){console.error("Failed to resolve model URL:",x)}})()},[e]),o?t.jsxRuntimeExports.jsx(be,{url:o,flangeRef:r,postModelRender:n,...a}):null}const K=(e,r)=>{e.userData.isGhost||(e.traverse(n=>{if(n instanceof j.Mesh){n.material instanceof j.Material&&(n.material.colorWrite=!1);const a=n.clone(),o=n.clone();a.material=new j.MeshStandardMaterial({depthTest:!0,depthWrite:!0,colorWrite:!1,polygonOffset:!0,polygonOffsetFactor:-1,side:j.DoubleSide}),a.userData.isGhost=!0,o.material=new j.MeshStandardMaterial({color:r,opacity:.3,depthTest:!0,depthWrite:!1,transparent:!0,polygonOffset:!0,polygonOffsetFactor:-2,side:j.DoubleSide}),o.userData.isGhost=!0,n.parent&&(n.parent.add(a),n.parent.add(o))}}),e.userData.isGhost=!0)},Q=e=>{if(!e.userData.isGhost)return;const r=[];e.traverse(n=>{var a;n instanceof j.Mesh&&((a=n.userData)!=null&&a.isGhost?r.push(n):n.material instanceof j.Material&&(n.material.colorWrite=!0))}),r.forEach(n=>{n.parent&&n.parent.remove(n)}),e.userData.isGhost=!1},Z=t.externalizeComponent(({rapidlyChangingMotionState:e,modelFromController:r,dhParameters:n,getModel:a=T,flangeRef:o,postModelRender:l,transparentColor:u,...x})=>{const[c,f]=m.useState(null),p=m.useCallback(i=>{f(i)},[]);m.useEffect(()=>{c&&(u?K(c,u):Q(c))},[c,u]);const s=t.jsxRuntimeExports.jsx(ge,{rapidlyChangingMotionState:e,dhParameters:n,...x});return t.jsxRuntimeExports.jsxs(W.ErrorBoundary,{fallback:s,onError:i=>{console.warn(i)},children:[t.jsxRuntimeExports.jsx(m.Suspense,{fallback:s,children:t.jsxRuntimeExports.jsx("group",{ref:p,children:t.jsxRuntimeExports.jsx(N,{rapidlyChangingMotionState:e,dhParameters:n,children:t.jsxRuntimeExports.jsx(X,{modelURL:(()=>{const i=a(r);if(!i){const d=new Blob([],{type:"model/gltf-binary"}),R=new File([d],`${r}.glb`,{type:"model/gltf-binary"});return Promise.resolve(URL.createObjectURL(R))}return i})(),postModelRender:l,flangeRef:o,...x})})})}),t.jsxRuntimeExports.jsx(Y,{})]})});function ee({connectedMotionGroup:e,getModel:r=T,flangeRef:n,transparentColor:a,postModelRender:o,...l}){return e.dhParameters?t.jsxRuntimeExports.jsx(Z,{rapidlyChangingMotionState:e.rapidlyChangingMotionState,modelFromController:e.modelFromController||"",dhParameters:e.dhParameters,getModel:r,flangeRef:n,transparentColor:a,postModelRender:o,...l}):null}const we=t.externalizeComponent(oe.observer(({robotName:e,programState:r,safetyState:n,operationMode:a,driveToHomeEnabled:o=!1,onDriveToHomePress:l,onDriveToHomeRelease:u,connectedMotionGroup:x,robotComponent:c=ee,customContentComponent:f,className:p})=>{var O;const s=E.useTheme(),{t:i}=ie.useTranslation(),[d,R]=m.useState(!1),h=m.useRef(null),w=m.useRef(null),[b,C]=m.useState(!1),[L,re]=m.useState({width:400,height:600}),[ke,se]=m.useState(0);m.useEffect(()=>{const S=()=>{if(w.current){const{offsetWidth:z,offsetHeight:U}=w.current;C(z>U),re({width:z,height:U})}};S();const P=new ResizeObserver(S);return w.current&&P.observe(w.current),()=>{P.disconnect()}},[]);const B=m.useCallback(()=>{se(S=>S+1)},[]),k=m.useCallback(()=>{!o||!l||(R(!0),l())},[o,l]),G=m.useCallback(()=>{!o||!u||(R(!1),u())},[o,u]),D=m.useCallback(()=>{d&&u&&(R(!1),u())},[d,u]),v=b?L.width<350:L.height<200,V=b?L.height<310:L.height<450;return t.jsxRuntimeExports.jsx(E.Card,{ref:w,className:p,sx:{width:"100%",height:"100%",display:"flex",flexDirection:b?"row":"column",position:"relative",overflow:"hidden",minWidth:{xs:180,sm:220,md:250},minHeight:b?{xs:200,sm:240,md:260}:{xs:150,sm:180,md:220},border:`1px solid ${s.palette.divider}`,borderRadius:"18px",boxShadow:"none",backgroundColor:((O=s.palette.backgroundPaperElevation)==null?void 0:O[8])||"#2A2A3F",backgroundImage:"none"},children:b?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(E.Box,{sx:{flex:"0 0 50%",position:"relative",height:"100%",minHeight:"100%",maxHeight:"100%",borderRadius:1,m:{xs:1.5,sm:2,md:3},mr:{xs:.75,sm:1,md:1.5},overflow:"hidden",display:v?"none":"block"},children:!v&&t.jsxRuntimeExports.jsxs(_.Canvas,{orthographic:!0,camera:{position:[3,2,3],zoom:1},shadows:!0,frameloop:"demand",style:{borderRadius:s.shape.borderRadius,width:"100%",height:"100%",background:"transparent",position:"absolute",top:0,left:0},dpr:[1,2],gl:{alpha:!0,antialias:!0},children:[t.jsxRuntimeExports.jsx(F,{}),t.jsxRuntimeExports.jsx(M.Bounds,{fit:!0,observe:!0,margin:1,maxDuration:1,children:t.jsxRuntimeExports.jsx(c,{connectedMotionGroup:x,postModelRender:B})})]})}),t.jsxRuntimeExports.jsxs(E.Box,{sx:{flex:"1",display:"flex",flexDirection:"column",justifyContent:"flex-start",width:v?"100%":"50%"},children:[t.jsxRuntimeExports.jsxs(E.Box,{sx:{p:{xs:1.5,sm:2,md:3},pb:{xs:1,sm:1.5,md:2},textAlign:"left"},children:[t.jsxRuntimeExports.jsx(E.Typography,{variant:"h6",component:"h2",sx:{mb:1},children:e}),t.jsxRuntimeExports.jsx(y.ProgramStateIndicator,{programState:r,safetyState:n,operationMode:a})]}),t.jsxRuntimeExports.jsxs(E.Box,{sx:{p:{xs:1.5,sm:2,md:3},pt:0,flex:"1",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[!V&&f&&t.jsxRuntimeExports.jsxs(E.Box,{children:[t.jsxRuntimeExports.jsx(f,{}),t.jsxRuntimeExports.jsx(E.Divider,{sx:{mt:1,mb:0,borderColor:s.palette.divider,opacity:.5}})]}),t.jsxRuntimeExports.jsx(E.Box,{sx:{mt:!V&&f?"auto":0},children:t.jsxRuntimeExports.jsx(E.Box,{sx:{display:"flex",justifyContent:"flex-start",mt:{xs:1,sm:1.5,md:2},mb:{xs:.5,sm:.75,md:1}},children:t.jsxRuntimeExports.jsx(E.Button,{ref:h,variant:"contained",color:"secondary",size:"small",disabled:!o,onMouseDown:k,onMouseUp:G,onMouseLeave:D,onTouchStart:k,onTouchEnd:G,sx:{textTransform:"none",px:1.5,py:.5},children:i("RobotCard.DriveToHome.bt")})})})]})]})]}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(E.Box,{sx:{p:3,height:"100%",display:"flex",flexDirection:"column"},children:[t.jsxRuntimeExports.jsxs(E.Box,{children:[t.jsxRuntimeExports.jsx(E.Typography,{variant:"h6",component:"h2",sx:{mb:1},children:e}),t.jsxRuntimeExports.jsx(y.ProgramStateIndicator,{programState:r,safetyState:n,operationMode:a})]}),t.jsxRuntimeExports.jsx(E.Box,{sx:{flex:v?0:1,position:"relative",minHeight:v?0:{xs:120,sm:150,md:200},height:v?0:"auto",borderRadius:1,overflow:"hidden",display:v?"none":"block"},children:!v&&t.jsxRuntimeExports.jsxs(_.Canvas,{orthographic:!0,camera:{position:[3,2,3],zoom:1},shadows:!0,frameloop:"demand",style:{borderRadius:s.shape.borderRadius,width:"100%",height:"100%",background:"transparent",position:"absolute"},dpr:[1,2],gl:{alpha:!0,antialias:!0},children:[t.jsxRuntimeExports.jsx(F,{}),t.jsxRuntimeExports.jsx(M.Bounds,{fit:!0,clip:!0,observe:!0,margin:1,maxDuration:1,children:t.jsxRuntimeExports.jsx(c,{connectedMotionGroup:x,postModelRender:B})})]})}),t.jsxRuntimeExports.jsxs(E.Box,{children:[!V&&f&&t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(f,{}),t.jsxRuntimeExports.jsx(E.Divider,{sx:{mt:1,mb:0,borderColor:s.palette.divider,opacity:.5}})]}),t.jsxRuntimeExports.jsx(E.Box,{sx:{display:"flex",justifyContent:"flex-start",mt:!V&&f?{xs:1,sm:2,md:5}:{xs:.5,sm:1,md:2},mb:{xs:.5,sm:.75,md:1}},children:t.jsxRuntimeExports.jsx(E.Button,{ref:h,variant:"contained",color:"secondary",size:"small",disabled:!o,onMouseDown:k,onMouseUp:G,onMouseLeave:D,onTouchStart:k,onTouchEnd:G,sx:{textTransform:"none",px:1.5,py:.5},children:i("RobotCard.DriveToHome.bt")})})]})]})})})})),Me=Array(6).fill(2*Math.PI),I={[y.Manufacturer.Abb]:[0,0,0,0,Math.PI/2,0,0],[y.Manufacturer.Fanuc]:[0,0,0,0,-Math.PI/2,0,0],[y.Manufacturer.Yaskawa]:[0,0,0,0,-Math.PI/2,0,0],[y.Manufacturer.Kuka]:[0,-Math.PI/2,Math.PI/2,0,Math.PI/2,0,0],[y.Manufacturer.Universalrobots]:[0,-Math.PI/2,-Math.PI/2,-Math.PI/2,Math.PI/2,-Math.PI/2,0]};function te(e){const[r]=e.split("_");switch(r){case"ABB":return y.Manufacturer.Abb;case"FANUC":return y.Manufacturer.Fanuc;case"YASKAWA":return y.Manufacturer.Yaskawa;case"KUKA":return y.Manufacturer.Kuka;case"UniversalRobots":return y.Manufacturer.Universalrobots;default:return null}}function ve(e,r){const n=te(e);return n&&n in I?I[n]:r||null}function ne({rapidlyChangingMotionState:e,dhParameters:r,onTranslationChanged:n,children:a}){const o=m.useRef([]),l=m.useRef([]),u=m.useRef(null),{invalidate:x}=_.useThree();m.useEffect(()=>{const s=e.joint_position.filter(i=>i!==void 0);return u.current=new y.ValueInterpolator(s,{tension:120,friction:20,threshold:.001}),()=>{var i;(i=u.current)==null||i.destroy()}},[]),_.useFrame((s,i)=>{if(u.current){const d=u.current.update(i);f(),d||x()}});function c(s){s&&(l.current=H(s),f(),x())}function f(){var i;const s=((i=u.current)==null?void 0:i.getCurrentValues())||[];if(n)n(l.current,s);else for(const[d,R]of l.current.entries()){const w=r[d].reverse_rotation_direction?-1:1;R.position.y=w*(s[d]||0)/1e3}}const p=m.useCallback(()=>{const s=e.joint_position.filter(i=>i!==void 0);requestAnimationFrame(()=>{var i;o.current=s,(i=u.current)==null||i.setTarget(s)})},[e]);return m.useEffect(()=>{p()},[e,p]),y.useAutorun(()=>{p()}),t.jsxRuntimeExports.jsx("group",{ref:c,children:a})}function _e({rapidlyChangingMotionState:e,dhParameters:r,...n}){const a=new g.Matrix4,o=m.useRef(null),l=m.useRef(null);function u(f){const p=new g.Matrix4;for(let R=0;R<r.length;R++){const h=r[R],w=f[R]??0,b=new g.Matrix4().makeRotationY(h.theta).multiply(new g.Matrix4().makeTranslation(h.a/1e3,(h.d+w*(h.reverse_rotation_direction?-1:1))/1e3,0)).multiply(new g.Matrix4().makeRotationX(h.alpha));p.multiply(b)}const s=new g.Vector3,i=new g.Quaternion,d=new g.Vector3;return p.decompose(s,i,d),s}const x=u(e.joint_position);function c(f,p){a.identity();let s=new g.Vector3;for(let h=0;h<r.length;h++){const w=p[h]??0,b=r[h],C=new g.Matrix4().makeRotationY(b.theta).multiply(new g.Matrix4().makeTranslation(b.a/1e3,(b.d+w*(b.reverse_rotation_direction?-1:1))/1e3,0)).multiply(new g.Matrix4().makeRotationX(b.alpha));a.multiply(C)}const i=new g.Vector3,d=new g.Quaternion,R=new g.Vector3;if(a.decompose(i,d,R),s=i,o.current&&o.current.position.set(s.x,s.y,s.z),l.current){const h=l.current.geometry;h&&h.setPositions&&h.setPositions([0,0,0,s.x,s.y,s.z])}}return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(ne,{rapidlyChangingMotionState:e,dhParameters:r,onTranslationChanged:c,children:t.jsxRuntimeExports.jsxs("group",{...n,name:"Scene",children:[t.jsxRuntimeExports.jsxs("mesh",{name:"Base",position:[0,0,0],children:[t.jsxRuntimeExports.jsx("sphereGeometry",{args:[.02,32,32]}),t.jsxRuntimeExports.jsx("meshStandardMaterial",{color:"green",depthTest:!0})]}),t.jsxRuntimeExports.jsx(M.Line,{ref:l,points:[new g.Vector3(0,0,0),x],color:"White",lineWidth:5}),t.jsxRuntimeExports.jsxs("mesh",{ref:o,name:"TCP",position:x,children:[t.jsxRuntimeExports.jsx("sphereGeometry",{args:[.025,32,32]}),t.jsxRuntimeExports.jsx("meshStandardMaterial",{color:"red",depthTest:!0})]})]})})})}const Le=t.externalizeComponent(({rapidlyChangingMotionState:e,modelFromController:r,dhParameters:n,getModel:a=T,flangeRef:o,postModelRender:l,transparentColor:u,...x})=>{const[c,f]=m.useState(null),p=m.useCallback(i=>{f(i)},[]);m.useEffect(()=>{c&&(u?K(c,u):Q(c))},[c,u]);const s=t.jsxRuntimeExports.jsx(_e,{rapidlyChangingMotionState:e,dhParameters:n,...x});return t.jsxRuntimeExports.jsxs(W.ErrorBoundary,{fallback:s,onError:i=>{console.warn(i)},children:[t.jsxRuntimeExports.jsx(m.Suspense,{fallback:s,children:t.jsxRuntimeExports.jsx("group",{ref:p,children:t.jsxRuntimeExports.jsx(ne,{rapidlyChangingMotionState:e,dhParameters:n,children:t.jsxRuntimeExports.jsx(X,{modelURL:(()=>{const i=a(r);if(!i){const d=new Blob([],{type:"model/gltf-binary"}),R=new File([d],`${r}.glb`,{type:"model/gltf-binary"});return Promise.resolve(URL.createObjectURL(R))}return i})(),postModelRender:l,flangeRef:o,...x})})})}),t.jsxRuntimeExports.jsx(Y,{})]})});exports.CollisionSceneRenderer=xe;exports.MANUFACTURER_HOME_CONFIGS=I;exports.PresetEnvironment=F;exports.Robot=ee;exports.RobotCard=we;exports.SafetyZonesRenderer=fe;exports.SupportedLinearAxis=Le;exports.SupportedRobot=Z;exports.TrajectoryRenderer=de;exports.defaultAxisConfig=Me;exports.defaultGetModel=T;exports.extractManufacturer=te;exports.getDefaultHomeConfig=ve;
|
|
2
|
-
//# sourceMappingURL=SupportedLinearAxis-
|
|
1
|
+
"use strict";const t=require("./externalizeComponent-CkVWk2F_.cjs"),g=require("three"),q=require("three-stdlib"),_=require("@react-three/fiber"),M=require("@react-three/drei"),E=require("@mui/material"),oe=require("mobx-react-lite"),m=require("react"),ie=require("react-i18next"),y=require("./interpolation-DZhBKo-u.cjs"),W=require("react-error-boundary");function ae(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const j=ae(g);function ue(e){switch(e.shape_type){case"convex_hull":return new q.ConvexGeometry(e.vertices.map(n=>new j.Vector3(n[0]/1e3,n[1]/1e3,n[2]/1e3)));case"box":return new j.BoxGeometry(e.size_x/1e3,e.size_y/1e3,e.size_z/1e3);case"sphere":return new j.SphereGeometry(e.radius/1e3);case"capsule":return new j.CapsuleGeometry(e.radius/1e3,e.cylinder_height/1e3);case"cylinder":return new j.CylinderGeometry(e.radius/1e3,e.radius/1e3,e.height/1e3);case"rectangle":return new j.BoxGeometry(e.size_x/1e3,e.size_y/1e3,0);default:return console.warn(`${e.shape_type} is not supported`),new j.BufferGeometry}}function ce({name:e,collider:r,children:n}){var l,u;const a=((l=r.pose)==null?void 0:l.position)??[0,0,0],o=((u=r.pose)==null?void 0:u.orientation)??[0,0,0];return r.margin&&console.warn(`${e} margin is not supported`),t.jsxRuntimeExports.jsx("mesh",{name:e,position:new j.Vector3(a[0],a[1],a[2]).divideScalar(1e3),rotation:new j.Euler(o[0],o[1],o[2],"XYZ"),geometry:ue(r.shape),children:n})}function le({name:e,colliders:r,meshChildrenProvider:n,...a}){return t.jsxRuntimeExports.jsx("group",{name:e,...a,children:Object.entries(r).map(([o,l])=>t.jsxRuntimeExports.jsx(ce,{name:o,collider:l,children:n(o,l)},o))})}function xe({scene:e,meshChildrenProvider:r}){const n=e.colliders;return t.jsxRuntimeExports.jsx("group",{children:n&&t.jsxRuntimeExports.jsx(le,{meshChildrenProvider:r,colliders:n})})}function F(){return t.jsxRuntimeExports.jsx(M.Environment,{children:t.jsxRuntimeExports.jsx(pe,{})})}function pe({positions:e=[2,0,2,0,2,0,2,0]}){return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(M.Lightformer,{intensity:5,"rotation-x":Math.PI/2,position:[0,5,-9],scale:[10,10,1]}),t.jsxRuntimeExports.jsx("group",{rotation:[0,.5,0],children:t.jsxRuntimeExports.jsx("group",{children:e.map((r,n)=>t.jsxRuntimeExports.jsx(M.Lightformer,{form:"circle",intensity:5,rotation:[Math.PI/2,0,0],position:[r,4,n*4],scale:[3,1,1]},n))})}),t.jsxRuntimeExports.jsx(M.Lightformer,{intensity:40,"rotation-y":Math.PI/2,position:[-5,1,-1],scale:[20,.1,1]}),t.jsxRuntimeExports.jsx(M.Lightformer,{intensity:20,"rotation-y":-Math.PI,position:[-5,-2,-1],scale:[20,.1,1]}),t.jsxRuntimeExports.jsx(M.Lightformer,{"rotation-y":Math.PI/2,position:[-5,-1,-1],scale:[20,.5,1],intensity:5}),t.jsxRuntimeExports.jsx(M.Lightformer,{"rotation-y":-Math.PI/2,position:[10,1,0],scale:[20,1,1],intensity:10}),t.jsxRuntimeExports.jsx(M.Lightformer,{form:"ring",color:"white",intensity:5,scale:10,position:[-15,4,-18],target:[0,0,0]})]})}function me(e){if(e.length<3)return console.log("Not enough vertices to define a plane"),{isCoplanar:!1};const r=new j.Vector3(e[0].x,e[0].y,e[0].z),n=new j.Vector3(e[1].x,e[1].y,e[1].z),a=new j.Vector3(e[2].x,e[2].y,e[2].z),o=new j.Vector3().subVectors(n,r),l=new j.Vector3().subVectors(a,r),u=new j.Vector3().crossVectors(o,l).normalize();for(let x=3;x<e.length;x++){const c=new j.Vector3(e[x].x,e[x].y,e[x].z),f=new j.Vector3().subVectors(c,r),p=u.dot(f);if(Math.abs(p)>1e-6)return console.log("Vertices are not on the same plane"),{isCoplanar:!1}}return{isCoplanar:!0,normal:u}}function fe({safetyZones:e,...r}){return t.jsxRuntimeExports.jsx("group",{...r,children:e.map((n,a)=>{let o=[];return n.geometry&&(n.geometry.compound?o=n.geometry.compound.child_geometries:n.geometry.convex_hull&&(o=[n.geometry])),o.map((l,u)=>{if(!l.convex_hull)return null;const x=l.convex_hull.vertices.map(p=>new j.Vector3(p.x/1e3,p.y/1e3,p.z/1e3)),c=me(x);if(c.isCoplanar&&c.normal){const s=new j.Vector3().addVectors(x[0],c.normal.multiplyScalar(1e-4));x.push(s)}let f;try{f=new q.ConvexGeometry(x)}catch(p){return console.log("Error creating ConvexGeometry:",p),null}return t.jsxRuntimeExports.jsx("mesh",{geometry:f,children:t.jsxRuntimeExports.jsx("meshStandardMaterial",{attach:"material",color:"#009f4d",opacity:.2,depthTest:!1,depthWrite:!1,transparent:!0,polygonOffset:!0,polygonOffsetFactor:-u},a)},`${a}-${u}`)})})})}function de({trajectory:e,...r}){var a;const n=((a=e.trajectory)==null?void 0:a.map(o=>o.tcp_pose?new j.Vector3(o.tcp_pose.position.x/1e3,o.tcp_pose.position.z/1e3,-o.tcp_pose.position.y/1e3):null).filter(o=>o!==null))||[];return t.jsxRuntimeExports.jsx("group",{...r,children:n.length>0&&t.jsxRuntimeExports.jsx(M.Line,{points:n,lineWidth:3,polygonOffset:!0,polygonOffsetFactor:10,polygonOffsetUnits:10})})}const A=new Map;async function T(e){if(A.has(e))return A.get(e);const r=(async()=>{var l;const a=new y.NovaClient({instanceUrl:""}),o=a.api.motionGroupModels;(l=o.axios)!=null&&l.interceptors&&o.axios.interceptors.request.use(u=>{var x;return(x=u.url)!=null&&x.includes("/glb")&&(u.responseType="blob"),u});try{const u=await a.api.motionGroupModels.getMotionGroupGlbModel(e);return URL.createObjectURL(u)}catch(u){throw console.error("Failed to fetch model:",u),u}})();return A.set(e,r),r}function H(e){function r(n){return n.children.length===0?[n]:[n,...n.children.flatMap(a=>r(a))]}return r(e).filter(n=>$(n))}function J(e){return e.name.endsWith("_FLG")}function $(e){return/_J[0-9]+$/.test(e.name)}function he(e,r){let n;function a(o){if(J(o)){if(n)throw Error(`Found multiple flange groups in robot model ${r}; first ${n.name} then ${o.name}. Only one _FLG group is allowed.`);n=o}$(o),o.children.map(a)}if(a(e.scene),!n)throw Error(`No flange group found in robot model ${r}. Flange must be identified with a name ending in _FLG.`);return{gltf:e}}function N({rapidlyChangingMotionState:e,dhParameters:r,onRotationChanged:n,children:a}){const o=m.useRef([]),l=m.useRef([]),u=m.useRef(null),{invalidate:x}=_.useThree();m.useEffect(()=>{const s=e.joint_position.filter(i=>i!==void 0);return u.current=new y.ValueInterpolator(s,{tension:120,friction:20,threshold:.001}),()=>{var i;(i=u.current)==null||i.destroy()}},[]),_.useFrame((s,i)=>{if(u.current){const d=u.current.update(i);f(),d||x()}});function c(s){s&&(l.current=H(s),f(),x())}function f(){var i;const s=((i=u.current)==null?void 0:i.getCurrentValues())||[];if(n)n(l.current,s);else for(const[d,R]of l.current.entries()){const h=r[d],w=h.theta||0,b=h.reverse_rotation_direction?-1:1;R.rotation.y=b*(s[d]||0)+w}}const p=m.useCallback(()=>{const s=e.joint_position.filter(i=>i!==void 0);requestAnimationFrame(()=>{var i;o.current=s,(i=u.current)==null||i.setTarget(s)})},[e]);return m.useEffect(()=>{p()},[e,p]),y.useAutorun(()=>{p()}),t.jsxRuntimeExports.jsx("group",{ref:c,children:a})}const je="line",Re="mesh";function ge({rapidlyChangingMotionState:e,dhParameters:r,...n}){const a=new g.Matrix4,o=m.useRef([]),l=m.useRef([]);m.useEffect(()=>{o.current=new Array(r.length).fill(null),l.current=new Array(r.length).fill(null)},[r.length]);function u(f,p){const s=new g.Vector3,i=new g.Quaternion,d=new g.Vector3;a.decompose(s,i,d);const R=s.clone(),h=new g.Matrix4().makeRotationY(f.theta+p*(f.reverse_rotation_direction?-1:1)).multiply(new g.Matrix4().makeTranslation(0,f.d/1e3,0)).multiply(new g.Matrix4().makeTranslation(f.a/1e3,0,0)).multiply(new g.Matrix4().makeRotationX(f.alpha));return a.multiply(h),a.decompose(s,i,d),{a:R,b:s}}function x(f,p,s,i){if(!r)return;const d=r[f];if(!d)return;const{a:R,b:h}=u(d,i);p.geometry.setPositions([R.toArray(),h.toArray()].flat()),s.position.set(h.x,h.y,h.z)}function c(f,p){a.identity();for(let s=0;s<Math.min(f.length,p.length);s++){const i=o.current[s],d=l.current[s];i&&d&&x(s,i,d,p[s])}}return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(N,{rapidlyChangingMotionState:e,dhParameters:r,onRotationChanged:c,children:t.jsxRuntimeExports.jsxs("group",{...n,name:"Scene",children:[t.jsxRuntimeExports.jsxs("mesh",{children:[t.jsxRuntimeExports.jsx("sphereGeometry",{args:[.01,32,32]}),t.jsxRuntimeExports.jsx("meshStandardMaterial",{color:"black",depthTest:!0})]}),r.map((f,p)=>{const{a:s,b:i}=u(f,e.joint_position[p]??0),d=`dhrobot_J0${p}`;return t.jsxRuntimeExports.jsxs("group",{name:d,children:[t.jsxRuntimeExports.jsx(M.Line,{ref:R=>{o.current[p]=R},name:je,points:[s,i],color:"white",lineWidth:5}),t.jsxRuntimeExports.jsxs("mesh",{ref:R=>{l.current[p]=R},name:Re,position:i,children:[t.jsxRuntimeExports.jsx("sphereGeometry",{args:[.01,32,32]}),t.jsxRuntimeExports.jsx("meshStandardMaterial",{color:"black",depthTest:!0})]},"mesh_"+p)]},d)})]})})})}const Ee=console.warn;function Y(){return m.useEffect(()=>{console.warn=e=>{e!=="Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"&&Ee(e)}},[]),t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{})}function ye(e){return e.type==="Mesh"}function be({url:e,flangeRef:r,postModelRender:n,...a}){const o=M.useGLTF(e);let l;try{l=he(o,"robot.glb").gltf}catch(c){throw c}const u=m.useCallback(c=>{c&&n&&n()},[n]);function x(c){try{return ye(c)?c.geometry?t.jsxRuntimeExports.jsx("mesh",{name:c.name,geometry:c.geometry,material:c.material,position:c.position,rotation:c.rotation},c.uuid):t.jsxRuntimeExports.jsx("group",{name:c.name,position:c.position,rotation:c.rotation},c.uuid):t.jsxRuntimeExports.jsx("group",{name:c.name,position:c.position,rotation:c.rotation,ref:J(c)?r:void 0,children:c.children.map(x)},c.uuid)}catch(f){return console.warn("Error rendering node",c.name,f),null}}return t.jsxRuntimeExports.jsx("group",{...a,dispose:null,ref:u,children:x(l.scene)})}function X({modelURL:e,flangeRef:r,postModelRender:n,...a}){const[o,l]=m.useState(null);return m.useEffect(()=>{(async()=>{try{if(typeof e=="string")l(e);else{const x=await e;l(x)}}catch(x){console.error("Failed to resolve model URL:",x)}})()},[e]),o?t.jsxRuntimeExports.jsx(be,{url:o,flangeRef:r,postModelRender:n,...a}):null}const K=(e,r)=>{e.userData.isGhost||(e.traverse(n=>{if(n instanceof j.Mesh){n.material instanceof j.Material&&(n.material.colorWrite=!1);const a=n.clone(),o=n.clone();a.material=new j.MeshStandardMaterial({depthTest:!0,depthWrite:!0,colorWrite:!1,polygonOffset:!0,polygonOffsetFactor:-1,side:j.DoubleSide}),a.userData.isGhost=!0,o.material=new j.MeshStandardMaterial({color:r,opacity:.3,depthTest:!0,depthWrite:!1,transparent:!0,polygonOffset:!0,polygonOffsetFactor:-2,side:j.DoubleSide}),o.userData.isGhost=!0,n.parent&&(n.parent.add(a),n.parent.add(o))}}),e.userData.isGhost=!0)},Q=e=>{if(!e.userData.isGhost)return;const r=[];e.traverse(n=>{var a;n instanceof j.Mesh&&((a=n.userData)!=null&&a.isGhost?r.push(n):n.material instanceof j.Material&&(n.material.colorWrite=!0))}),r.forEach(n=>{n.parent&&n.parent.remove(n)}),e.userData.isGhost=!1},Z=t.externalizeComponent(({rapidlyChangingMotionState:e,modelFromController:r,dhParameters:n,getModel:a=T,flangeRef:o,postModelRender:l,transparentColor:u,...x})=>{const[c,f]=m.useState(null),p=m.useCallback(i=>{f(i)},[]);m.useEffect(()=>{c&&(u?K(c,u):Q(c))},[c,u]);const s=t.jsxRuntimeExports.jsx(ge,{rapidlyChangingMotionState:e,dhParameters:n,...x});return t.jsxRuntimeExports.jsxs(W.ErrorBoundary,{fallback:s,onError:i=>{console.warn(i)},children:[t.jsxRuntimeExports.jsx(m.Suspense,{fallback:s,children:t.jsxRuntimeExports.jsx("group",{ref:p,children:t.jsxRuntimeExports.jsx(N,{rapidlyChangingMotionState:e,dhParameters:n,children:t.jsxRuntimeExports.jsx(X,{modelURL:(()=>{const i=a(r);if(!i){const d=new Blob([],{type:"model/gltf-binary"}),R=new File([d],`${r}.glb`,{type:"model/gltf-binary"});return Promise.resolve(URL.createObjectURL(R))}return i})(),postModelRender:l,flangeRef:o,...x})})})}),t.jsxRuntimeExports.jsx(Y,{})]})});function ee({connectedMotionGroup:e,getModel:r=T,flangeRef:n,transparentColor:a,postModelRender:o,...l}){return e.dhParameters?t.jsxRuntimeExports.jsx(Z,{rapidlyChangingMotionState:e.rapidlyChangingMotionState,modelFromController:e.modelFromController||"",dhParameters:e.dhParameters,getModel:r,flangeRef:n,transparentColor:a,postModelRender:o,...l}):null}const we=t.externalizeComponent(oe.observer(({robotName:e,programState:r,safetyState:n,operationMode:a,driveToHomeEnabled:o=!1,onDriveToHomePress:l,onDriveToHomeRelease:u,connectedMotionGroup:x,robotComponent:c=ee,customContentComponent:f,className:p})=>{var O;const s=E.useTheme(),{t:i}=ie.useTranslation(),[d,R]=m.useState(!1),h=m.useRef(null),w=m.useRef(null),[b,C]=m.useState(!1),[L,re]=m.useState({width:400,height:600}),[ke,se]=m.useState(0);m.useEffect(()=>{const S=()=>{if(w.current){const{offsetWidth:z,offsetHeight:U}=w.current;C(z>U),re({width:z,height:U})}};S();const P=new ResizeObserver(S);return w.current&&P.observe(w.current),()=>{P.disconnect()}},[]);const B=m.useCallback(()=>{se(S=>S+1)},[]),k=m.useCallback(()=>{!o||!l||(R(!0),l())},[o,l]),G=m.useCallback(()=>{!o||!u||(R(!1),u())},[o,u]),D=m.useCallback(()=>{d&&u&&(R(!1),u())},[d,u]),v=b?L.width<350:L.height<200,V=b?L.height<310:L.height<450;return t.jsxRuntimeExports.jsx(E.Card,{ref:w,className:p,sx:{width:"100%",height:"100%",display:"flex",flexDirection:b?"row":"column",position:"relative",overflow:"hidden",minWidth:{xs:180,sm:220,md:250},minHeight:b?{xs:200,sm:240,md:260}:{xs:150,sm:180,md:220},border:`1px solid ${s.palette.divider}`,borderRadius:"18px",boxShadow:"none",backgroundColor:((O=s.palette.backgroundPaperElevation)==null?void 0:O[8])||"#2A2A3F",backgroundImage:"none"},children:b?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(E.Box,{sx:{flex:"0 0 50%",position:"relative",height:"100%",minHeight:"100%",maxHeight:"100%",borderRadius:1,m:{xs:1.5,sm:2,md:3},mr:{xs:.75,sm:1,md:1.5},overflow:"hidden",display:v?"none":"block"},children:!v&&t.jsxRuntimeExports.jsxs(_.Canvas,{orthographic:!0,camera:{position:[3,2,3],zoom:1},shadows:!0,frameloop:"demand",style:{borderRadius:s.shape.borderRadius,width:"100%",height:"100%",background:"transparent",position:"absolute",top:0,left:0},dpr:[1,2],gl:{alpha:!0,antialias:!0},children:[t.jsxRuntimeExports.jsx(F,{}),t.jsxRuntimeExports.jsx(M.Bounds,{fit:!0,observe:!0,margin:1,maxDuration:1,children:t.jsxRuntimeExports.jsx(c,{connectedMotionGroup:x,postModelRender:B})})]})}),t.jsxRuntimeExports.jsxs(E.Box,{sx:{flex:"1",display:"flex",flexDirection:"column",justifyContent:"flex-start",width:v?"100%":"50%"},children:[t.jsxRuntimeExports.jsxs(E.Box,{sx:{p:{xs:1.5,sm:2,md:3},pb:{xs:1,sm:1.5,md:2},textAlign:"left"},children:[t.jsxRuntimeExports.jsx(E.Typography,{variant:"h6",component:"h2",sx:{mb:1},children:e}),t.jsxRuntimeExports.jsx(y.ProgramStateIndicator,{programState:r,safetyState:n,operationMode:a})]}),t.jsxRuntimeExports.jsxs(E.Box,{sx:{p:{xs:1.5,sm:2,md:3},pt:0,flex:"1",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[!V&&f&&t.jsxRuntimeExports.jsxs(E.Box,{children:[t.jsxRuntimeExports.jsx(f,{}),t.jsxRuntimeExports.jsx(E.Divider,{sx:{mt:1,mb:0,borderColor:s.palette.divider,opacity:.5}})]}),t.jsxRuntimeExports.jsx(E.Box,{sx:{mt:!V&&f?"auto":0},children:t.jsxRuntimeExports.jsx(E.Box,{sx:{display:"flex",justifyContent:"flex-start",mt:{xs:1,sm:1.5,md:2},mb:{xs:.5,sm:.75,md:1}},children:t.jsxRuntimeExports.jsx(E.Button,{ref:h,variant:"contained",color:"secondary",size:"small",disabled:!o,onMouseDown:k,onMouseUp:G,onMouseLeave:D,onTouchStart:k,onTouchEnd:G,sx:{textTransform:"none",px:1.5,py:.5},children:i("RobotCard.DriveToHome.bt")})})})]})]})]}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs(E.Box,{sx:{p:3,height:"100%",display:"flex",flexDirection:"column"},children:[t.jsxRuntimeExports.jsxs(E.Box,{children:[t.jsxRuntimeExports.jsx(E.Typography,{variant:"h6",component:"h2",sx:{mb:1},children:e}),t.jsxRuntimeExports.jsx(y.ProgramStateIndicator,{programState:r,safetyState:n,operationMode:a})]}),t.jsxRuntimeExports.jsx(E.Box,{sx:{flex:v?0:1,position:"relative",minHeight:v?0:{xs:120,sm:150,md:200},height:v?0:"auto",borderRadius:1,overflow:"hidden",display:v?"none":"block"},children:!v&&t.jsxRuntimeExports.jsxs(_.Canvas,{orthographic:!0,camera:{position:[3,2,3],zoom:1},shadows:!0,frameloop:"demand",style:{borderRadius:s.shape.borderRadius,width:"100%",height:"100%",background:"transparent",position:"absolute"},dpr:[1,2],gl:{alpha:!0,antialias:!0},children:[t.jsxRuntimeExports.jsx(F,{}),t.jsxRuntimeExports.jsx(M.Bounds,{fit:!0,clip:!0,observe:!0,margin:1,maxDuration:1,children:t.jsxRuntimeExports.jsx(c,{connectedMotionGroup:x,postModelRender:B})})]})}),t.jsxRuntimeExports.jsxs(E.Box,{children:[!V&&f&&t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(f,{}),t.jsxRuntimeExports.jsx(E.Divider,{sx:{mt:1,mb:0,borderColor:s.palette.divider,opacity:.5}})]}),t.jsxRuntimeExports.jsx(E.Box,{sx:{display:"flex",justifyContent:"flex-start",mt:!V&&f?{xs:1,sm:2,md:5}:{xs:.5,sm:1,md:2},mb:{xs:.5,sm:.75,md:1}},children:t.jsxRuntimeExports.jsx(E.Button,{ref:h,variant:"contained",color:"secondary",size:"small",disabled:!o,onMouseDown:k,onMouseUp:G,onMouseLeave:D,onTouchStart:k,onTouchEnd:G,sx:{textTransform:"none",px:1.5,py:.5},children:i("RobotCard.DriveToHome.bt")})})]})]})})})})),Me=Array(6).fill(2*Math.PI),I={[y.Manufacturer.Abb]:[0,0,0,0,Math.PI/2,0,0],[y.Manufacturer.Fanuc]:[0,0,0,0,-Math.PI/2,0,0],[y.Manufacturer.Yaskawa]:[0,0,0,0,-Math.PI/2,0,0],[y.Manufacturer.Kuka]:[0,-Math.PI/2,Math.PI/2,0,Math.PI/2,0,0],[y.Manufacturer.Universalrobots]:[0,-Math.PI/2,-Math.PI/2,-Math.PI/2,Math.PI/2,-Math.PI/2,0]};function te(e){const[r]=e.split("_");switch(r){case"ABB":return y.Manufacturer.Abb;case"FANUC":return y.Manufacturer.Fanuc;case"YASKAWA":return y.Manufacturer.Yaskawa;case"KUKA":return y.Manufacturer.Kuka;case"UniversalRobots":return y.Manufacturer.Universalrobots;default:return null}}function ve(e,r){const n=te(e);return n&&n in I?I[n]:r||null}function ne({rapidlyChangingMotionState:e,dhParameters:r,onTranslationChanged:n,children:a}){const o=m.useRef([]),l=m.useRef([]),u=m.useRef(null),{invalidate:x}=_.useThree();m.useEffect(()=>{const s=e.joint_position.filter(i=>i!==void 0);return u.current=new y.ValueInterpolator(s,{tension:120,friction:20,threshold:.001}),()=>{var i;(i=u.current)==null||i.destroy()}},[]),_.useFrame((s,i)=>{if(u.current){const d=u.current.update(i);f(),d||x()}});function c(s){s&&(l.current=H(s),f(),x())}function f(){var i;const s=((i=u.current)==null?void 0:i.getCurrentValues())||[];if(n)n(l.current,s);else for(const[d,R]of l.current.entries()){const w=r[d].reverse_rotation_direction?-1:1;R.position.x=w*(s[d]||0)/1e3}}const p=m.useCallback(()=>{const s=e.joint_position.filter(i=>i!==void 0);requestAnimationFrame(()=>{var i;o.current=s,(i=u.current)==null||i.setTarget(s)})},[e]);return m.useEffect(()=>{p()},[e,p]),y.useAutorun(()=>{p()}),t.jsxRuntimeExports.jsx("group",{ref:c,children:a})}function _e({rapidlyChangingMotionState:e,dhParameters:r,...n}){const a=new g.Matrix4,o=m.useRef(null),l=m.useRef(null);function u(f){const p=new g.Matrix4;for(let R=0;R<r.length;R++){const h=r[R],w=f[R]??0,b=new g.Matrix4().makeRotationY(h.theta).multiply(new g.Matrix4().makeTranslation(h.a/1e3,(h.d+w*(h.reverse_rotation_direction?-1:1))/1e3,0)).multiply(new g.Matrix4().makeRotationX(h.alpha));p.multiply(b)}const s=new g.Vector3,i=new g.Quaternion,d=new g.Vector3;return p.decompose(s,i,d),s}const x=u(e.joint_position);function c(f,p){a.identity();let s=new g.Vector3;for(let h=0;h<r.length;h++){const w=p[h]??0,b=r[h],C=new g.Matrix4().makeRotationY(b.theta).multiply(new g.Matrix4().makeTranslation(b.a/1e3,(b.d+w*(b.reverse_rotation_direction?-1:1))/1e3,0)).multiply(new g.Matrix4().makeRotationX(b.alpha));a.multiply(C)}const i=new g.Vector3,d=new g.Quaternion,R=new g.Vector3;if(a.decompose(i,d,R),s=i,o.current&&o.current.position.set(s.x,s.y,s.z),l.current){const h=l.current.geometry;h&&h.setPositions&&h.setPositions([0,0,0,s.x,s.y,s.z])}}return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsx(ne,{rapidlyChangingMotionState:e,dhParameters:r,onTranslationChanged:c,children:t.jsxRuntimeExports.jsxs("group",{...n,name:"Scene",children:[t.jsxRuntimeExports.jsxs("mesh",{name:"Base",position:[0,0,0],children:[t.jsxRuntimeExports.jsx("sphereGeometry",{args:[.02,32,32]}),t.jsxRuntimeExports.jsx("meshStandardMaterial",{color:"green",depthTest:!0})]}),t.jsxRuntimeExports.jsx(M.Line,{ref:l,points:[new g.Vector3(0,0,0),x],color:"White",lineWidth:5}),t.jsxRuntimeExports.jsxs("mesh",{ref:o,name:"TCP",position:x,children:[t.jsxRuntimeExports.jsx("sphereGeometry",{args:[.025,32,32]}),t.jsxRuntimeExports.jsx("meshStandardMaterial",{color:"red",depthTest:!0})]})]})})})}const Le=t.externalizeComponent(({rapidlyChangingMotionState:e,modelFromController:r,dhParameters:n,getModel:a=T,flangeRef:o,postModelRender:l,transparentColor:u,...x})=>{const[c,f]=m.useState(null),p=m.useCallback(i=>{f(i)},[]);m.useEffect(()=>{c&&(u?K(c,u):Q(c))},[c,u]);const s=t.jsxRuntimeExports.jsx(_e,{rapidlyChangingMotionState:e,dhParameters:n,...x});return t.jsxRuntimeExports.jsxs(W.ErrorBoundary,{fallback:s,onError:i=>{console.warn(i)},children:[t.jsxRuntimeExports.jsx(m.Suspense,{fallback:s,children:t.jsxRuntimeExports.jsx("group",{ref:p,children:t.jsxRuntimeExports.jsx(ne,{rapidlyChangingMotionState:e,dhParameters:n,children:t.jsxRuntimeExports.jsx(X,{modelURL:(()=>{const i=a(r);if(!i){const d=new Blob([],{type:"model/gltf-binary"}),R=new File([d],`${r}.glb`,{type:"model/gltf-binary"});return Promise.resolve(URL.createObjectURL(R))}return i})(),postModelRender:l,flangeRef:o,...x})})})}),t.jsxRuntimeExports.jsx(Y,{})]})});exports.CollisionSceneRenderer=xe;exports.MANUFACTURER_HOME_CONFIGS=I;exports.PresetEnvironment=F;exports.Robot=ee;exports.RobotCard=we;exports.SafetyZonesRenderer=fe;exports.SupportedLinearAxis=Le;exports.SupportedRobot=Z;exports.TrajectoryRenderer=de;exports.defaultAxisConfig=Me;exports.defaultGetModel=T;exports.extractManufacturer=te;exports.getDefaultHomeConfig=ve;
|
|
2
|
+
//# sourceMappingURL=SupportedLinearAxis-BJSxJiXa.cjs.map
|