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

---
 src/config/setting.js  |    2 +-
 src/core/warehouse.jsx |    8 ++++----
 src/components/agv.jsx |   27 +++++++++++++++++----------
 3 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/src/components/agv.jsx b/src/components/agv.jsx
index c3fb231..c96cf8c 100644
--- a/src/components/agv.jsx
+++ b/src/components/agv.jsx
@@ -14,9 +14,10 @@
 } 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);
@@ -36,7 +37,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 +50,8 @@
         }
 
         // 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)
@@ -63,7 +64,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,10 +78,14 @@
 
         // 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)
@@ -91,7 +96,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)
diff --git a/src/config/setting.js b/src/config/setting.js
index ccf63af..7892d4f 100644
--- a/src/config/setting.js
+++ b/src/config/setting.js
@@ -6,7 +6,7 @@
 
 export const DEBUG = false;
 
-export const INTERVAL_TIME = 500;
+export const INTERVAL_TIME = 1000;
 
 // model scale rate
 
diff --git a/src/core/warehouse.jsx b/src/core/warehouse.jsx
index b25b63c..b23b8b0 100644
--- a/src/core/warehouse.jsx
+++ b/src/core/warehouse.jsx
@@ -27,12 +27,12 @@
     useEffect(() => {
         const timer = setInterval(() => {
             console.log('do');
-            getBoxData().then(res => {
-                setBoxData(res);
-            })
+            // getBoxData().then(res => {
+            //     setBoxData(res);
+            // })
 
             getAgvData().then(res => {
-                console.log(JSON.stringify(res))
+                // console.log(JSON.stringify(res))
                 if (res && res.length > 0) {
                     setAgvData(res);
                 }

--
Gitblit v1.9.1