From 9efa735d68a8385a73290156b73850f7233e05fe Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 08 五月 2024 10:27:24 +0800
Subject: [PATCH] #

---
 src/components/agv.jsx |   27 ++++++++++++++++++---------
 1 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/src/components/agv.jsx b/src/components/agv.jsx
index c3fb231..4588a9d 100644
--- a/src/components/agv.jsx
+++ b/src/components/agv.jsx
@@ -14,9 +14,11 @@
 } from '../config/setting'
 
 const Agv = (props) => {
-    const { agvNo, position, theta, loaderTheta, trayList, hasBox } = props;
-    const height = props.height * 0.06;
+    const { agvNo, position, trayList, hasBox } = props;
+    const theta = -props.theta;
+    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);
@@ -36,7 +38,7 @@
             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)
@@ -49,8 +51,8 @@
         }
 
         // group theta
-        if (groupTheta !== theta && props.theta) {
-            const minTheta = Common.minDiffTheta(groupTheta, theta);
+        if (groupTheta !== theta && props.theta !== null) {
+            const minTheta = Common.normalizeAngle(theta);
             new TWEEN.Tween({ value: groupTheta })
                 .to({ value: minTheta }, INTERVAL_TIME)
                 .easing(TWEEN.Easing.Linear.None)
@@ -63,7 +65,7 @@
         }
 
         // 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)
@@ -77,8 +79,13 @@
 
         // 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.normalizeAngle(loaderAbsoluteAngle);
+            // const minTheta = Common.minDiffTheta(integrateTheta, loaderAbsoluteAngle);
             new TWEEN.Tween({ value: integrateTheta })
                 .to({ value: minTheta }, INTERVAL_TIME)
                 .easing(TWEEN.Easing.Linear.None)
@@ -91,7 +98,9 @@
         }
 
         // 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)

--
Gitblit v1.9.1