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

@@ -11,11 +11,23 @@ import { ProcessData } from "./types";
import { useSimulationStates } from "../../../store/store";
import { retrieveGLTF } from "../../../utils/indexDB/idbUtils";
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 ProcessContainerProps {
processes: ProcessData[];
setProcesses: React.Dispatch<React.SetStateAction<any[]>>;
agvRef: any;
MaterialRef: any;
armBots: ArmBotState[];
setArmBots: React.Dispatch<React.SetStateAction<ArmBotState[]>>;
}
const ProcessAnimator: React.FC<ProcessContainerProps> = ({
@@ -23,6 +35,8 @@ const ProcessAnimator: React.FC<ProcessContainerProps> = ({
setProcesses,
agvRef,
MaterialRef,
armBots,
setArmBots
}) => {
const gltf = useLoader(GLTFLoader, crate) as GLTF;
const groupRef = useRef<THREE.Group>(null);
@@ -42,7 +56,7 @@ const ProcessAnimator: React.FC<ProcessContainerProps> = ({
getPointDataForAnimationIndex,
processes: processedProcesses,
checkAndCountTriggers,
} = useProcessAnimation(processes, setProcesses, agvRef);
} = useProcessAnimation(processes, setProcesses, agvRef, armBots, setArmBots);
const baseMaterials = useMemo(() => ({
Box: new THREE.MeshStandardMaterial({ color: 0x8b4513 }),