#
luxiaotao1123
2024-05-08 d026e41e49dc17eaaefd96b0c69f560ffc728483
#
3个文件已修改
37 ■■■■■ 已修改文件
src/components/agv.jsx 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/config/setting.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/warehouse.jsx 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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)
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
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);
                }