|  |  |  | 
|---|
|  |  |  | } from '../config/setting' | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const Agv = (props) => { | 
|---|
|  |  |  | const { agvNo, position, theta, loaderTheta, trayList, hasBox } = props; | 
|---|
|  |  |  | const height = props.height * 0.06; | 
|---|
|  |  |  | const { agvNo, position, theta, trayList, hasBox } = props; | 
|---|
|  |  |  | const height = props.height * 0.04; | 
|---|
|  |  |  | const forkLength = props.forkLength * 0.1; | 
|---|
|  |  |  | const loaderTheta = Number(props.loaderTheta?.toFixed(1)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const [groupPos, setGroupPos] = useState({ x: 0, y: 0, z: 0 }); | 
|---|
|  |  |  | const [groupTheta, setGroupTheta] = useState(0); | 
|---|
|  |  |  | 
|---|
|  |  |  | y: position?.[1] * REAL_COMPARE_MAP_SCALE, | 
|---|
|  |  |  | z: position?.[0] * REAL_COMPARE_MAP_SCALE + REAL_COMPARE_MAP_OFFSET_Z, | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!Common.deepEqual(groupPos, pos) && props.position) { | 
|---|
|  |  |  | if (!Common.deepEqual(groupPos, pos) && props.position !== null) { | 
|---|
|  |  |  | new TWEEN.Tween(groupPos) | 
|---|
|  |  |  | .to(pos, INTERVAL_TIME) | 
|---|
|  |  |  | .easing(TWEEN.Easing.Linear.None) | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // group theta | 
|---|
|  |  |  | if (groupTheta !== theta && props.theta) { | 
|---|
|  |  |  | const minTheta = Common.minDiffTheta(groupTheta, theta); | 
|---|
|  |  |  | if (groupTheta !== -theta && props.theta !== null) { | 
|---|
|  |  |  | const minTheta = Common.minDiffTheta(groupTheta, -theta); | 
|---|
|  |  |  | new TWEEN.Tween({ value: groupTheta }) | 
|---|
|  |  |  | .to({ value: minTheta }, INTERVAL_TIME) | 
|---|
|  |  |  | .easing(TWEEN.Easing.Linear.None) | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // loader height | 
|---|
|  |  |  | if (loaderHeight !== height && props.height) { | 
|---|
|  |  |  | if (loaderHeight !== height && props.height !== null) { | 
|---|
|  |  |  | new TWEEN.Tween({ value: loaderHeight }) | 
|---|
|  |  |  | .to({ value: height }, INTERVAL_TIME) | 
|---|
|  |  |  | .easing(TWEEN.Easing.Linear.None) | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // loader theta | 
|---|
|  |  |  | const loaderAbsoluteAngle = (theta + loaderTheta) % 360; | 
|---|
|  |  |  | if (integrateTheta !== loaderAbsoluteAngle && props.loaderTheta) { | 
|---|
|  |  |  | const minTheta = Common.minDiffTheta(integrateTheta, loaderAbsoluteAngle); | 
|---|
|  |  |  | // console.log("integrateTheta", integrateTheta); | 
|---|
|  |  |  | // console.log("theta", theta); | 
|---|
|  |  |  | // console.log("loaderTheta", loaderTheta); | 
|---|
|  |  |  | // console.log("loaderAbsoluteAngle", loaderAbsoluteAngle); | 
|---|
|  |  |  | if (integrateTheta !== loaderAbsoluteAngle && props.loaderTheta !== null) { | 
|---|
|  |  |  | // const minTheta = Common.minDiffTheta(integrateTheta, loaderAbsoluteAngle); | 
|---|
|  |  |  | new TWEEN.Tween({ value: integrateTheta }) | 
|---|
|  |  |  | .to({ value: minTheta }, INTERVAL_TIME) | 
|---|
|  |  |  | .to({ value: loaderAbsoluteAngle }, INTERVAL_TIME) | 
|---|
|  |  |  | .easing(TWEEN.Easing.Linear.None) | 
|---|
|  |  |  | .onUpdate((e) => { | 
|---|
|  |  |  | setIntegrateTheta(e.value) | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // fork lenght | 
|---|
|  |  |  | if (forkDis !== forkLength && props.forkLength) { | 
|---|
|  |  |  | // console.log("forkDis", forkDis); | 
|---|
|  |  |  | // console.log("forkLength", forkLength); | 
|---|
|  |  |  | if (forkDis !== forkLength && props.forkLength !== null) { | 
|---|
|  |  |  | new TWEEN.Tween({ value: forkDis }) | 
|---|
|  |  |  | .to({ value: forkLength }, INTERVAL_TIME) | 
|---|
|  |  |  | .easing(TWEEN.Easing.Linear.None) | 
|---|