feat: Enhance simulation with StaticMachine integration and ArmBot updates

- 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.
This commit is contained in:
2025-04-15 18:34:43 +05:30
parent 5cef9bdb8a
commit 5b42bd9c40
15 changed files with 437 additions and 135 deletions

View File

@@ -6,6 +6,7 @@ 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;
@@ -17,10 +18,19 @@ interface ArmBotState {
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([]);
@@ -38,6 +48,8 @@ function Simulation() {
setProcesses={setProcesses}
agvRef={agvRef}
MaterialRef={MaterialRef}
armBots={armBots}
setArmBots={setArmBots}
/>
<Agv
@@ -48,7 +60,8 @@ function Simulation() {
</>
)}
<ArmBot armBots={armBots} setArmBots={setArmBots} />
<StaticMachine setArmBots={setArmBots} staticMachines={staticMachines} setStaticMachines={setStaticMachines} />
<ArmBot armBots={armBots} setArmBots={setArmBots} setStaticMachines={setStaticMachines} />
</>
);
}