- Added StaticMachine component to manage static machine states and interactions. - Implemented StaticMachineInstances for handling individual machine behaviors. - Updated ArmBot and related components to support interactions with static machines. - Refactored process handling to include ArmBot actions and trigger management. - Improved type definitions for simulation types to accommodate new features.
70 lines
2.5 KiB
TypeScript
70 lines
2.5 KiB
TypeScript
import { useState, useRef } from "react";
|
|
import * as THREE from "three";
|
|
import PathCreation from "./path/pathCreation";
|
|
import PathConnector from "./path/pathConnector";
|
|
import useModuleStore from "../../store/useModuleStore";
|
|
import ProcessContainer from "./process/processContainer";
|
|
import Agv from "../builder/agv/agv";
|
|
import ArmBot from "./armbot/ArmBot";
|
|
import StaticMachine from "./staticMachine/staticMachine";
|
|
|
|
interface ArmBotState {
|
|
uuid: string;
|
|
position: [number, number, number];
|
|
rotation: [number, number, number];
|
|
status: string;
|
|
material: string;
|
|
triggerId: string;
|
|
actions: { uuid: string; name: string; speed: number; processes: { triggerId: string; startPoint: string; endPoint: string }[]; };
|
|
}
|
|
|
|
interface StaticMachineState {
|
|
uuid: string;
|
|
status: string;
|
|
actions: { uuid: string; name: string; buffer: number; material: string; };
|
|
machineTriggerId: string;
|
|
connectedArmBot: string;
|
|
}
|
|
|
|
function Simulation() {
|
|
const { activeModule } = useModuleStore();
|
|
const pathsGroupRef = useRef() as React.MutableRefObject<THREE.Group>;
|
|
const [armBots, setArmBots] = useState<ArmBotState[]>([]);
|
|
const [staticMachines, setStaticMachines] = useState<StaticMachineState[]>([]);
|
|
const [processes, setProcesses] = useState<any[]>([]);
|
|
const agvRef = useRef([]);
|
|
const MaterialRef = useRef([]);
|
|
|
|
return (
|
|
<>
|
|
{activeModule === "simulation" && (
|
|
<>
|
|
<PathCreation pathsGroupRef={pathsGroupRef} />
|
|
|
|
<PathConnector pathsGroupRef={pathsGroupRef} />
|
|
|
|
<ProcessContainer
|
|
processes={processes}
|
|
setProcesses={setProcesses}
|
|
agvRef={agvRef}
|
|
MaterialRef={MaterialRef}
|
|
armBots={armBots}
|
|
setArmBots={setArmBots}
|
|
/>
|
|
|
|
<Agv
|
|
processes={processes}
|
|
agvRef={agvRef}
|
|
MaterialRef={MaterialRef}
|
|
/>
|
|
|
|
</>
|
|
)}
|
|
<StaticMachine setArmBots={setArmBots} staticMachines={staticMachines} setStaticMachines={setStaticMachines} />
|
|
<ArmBot armBots={armBots} setArmBots={setArmBots} setStaticMachines={setStaticMachines} />
|
|
</>
|
|
);
|
|
}
|
|
|
|
export default Simulation;
|