feat: Update visibility logic for path points and add new event schemas in simulation types
This commit is contained in:
parent
967f1741b0
commit
686c4e60c6
|
@ -95,7 +95,7 @@ const Agv: React.FC<ProcessContainerProps> = ({
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{pair.points.slice(1).map((point, idx) => (
|
{pair.points.slice(1).map((point, idx) => (
|
||||||
<mesh position={[point.x, point.y, point.z]} key={idx}>
|
<mesh position={[point.x, point.y, point.z]} key={idx} visible={!isPlaying}>
|
||||||
<sphereGeometry args={[0.3, 15, 15]} />
|
<sphereGeometry args={[0.3, 15, 15]} />
|
||||||
<meshStandardMaterial color="red" />
|
<meshStandardMaterial color="red" />
|
||||||
</mesh>
|
</mesh>
|
||||||
|
|
|
@ -456,7 +456,7 @@ export default function PathNavigator({
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<group name="path-navigator-lines">
|
<group name="path-navigator-lines" visible={!isPlaying} >
|
||||||
{toPickupPath.length > 0 && (
|
{toPickupPath.length > 0 && (
|
||||||
<Line
|
<Line
|
||||||
points={toPickupPath}
|
points={toPickupPath}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import {
|
||||||
usePlayButtonStore,
|
usePlayButtonStore,
|
||||||
useResetButtonStore,
|
useResetButtonStore,
|
||||||
} from "../../../store/usePlayButtonStore";
|
} from "../../../store/usePlayButtonStore";
|
||||||
import { usePlayAgv } from "../../../store/store";
|
import { usePlayAgv, useSimulationStates } from "../../../store/store";
|
||||||
|
|
||||||
interface ArmBotProcess {
|
interface ArmBotProcess {
|
||||||
triggerId: string;
|
triggerId: string;
|
||||||
|
@ -82,6 +82,7 @@ export const useProcessAnimation = (
|
||||||
const [animationStates, setAnimationStates] = useState<Record<string, EnhancedProcessAnimationState>>({});
|
const [animationStates, setAnimationStates] = useState<Record<string, EnhancedProcessAnimationState>>({});
|
||||||
const speedRef = useRef<number>(speed);
|
const speedRef = useRef<number>(speed);
|
||||||
const { PlayAgv, setPlayAgv } = usePlayAgv();
|
const { PlayAgv, setPlayAgv } = usePlayAgv();
|
||||||
|
const { simulationStates } = useSimulationStates();
|
||||||
|
|
||||||
// Effect hooks
|
// Effect hooks
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -521,6 +522,9 @@ export const useProcessAnimation = (
|
||||||
connections.forEach((connection) => {
|
connections.forEach((connection) => {
|
||||||
const connectedModelUUID = connection.modelUUID;
|
const connectedModelUUID = connection.modelUUID;
|
||||||
|
|
||||||
|
const isConveyor = simulationStates.find((state) => state.modeluuid === connectedModelUUID && state.type === "Conveyor");
|
||||||
|
|
||||||
|
if (!isConveyor) {
|
||||||
const matchingArmPath = armBotPaths.find((path) => path.modeluuid === connectedModelUUID);
|
const matchingArmPath = armBotPaths.find((path) => path.modeluuid === connectedModelUUID);
|
||||||
|
|
||||||
if (matchingArmPath) {
|
if (matchingArmPath) {
|
||||||
|
@ -531,6 +535,7 @@ export const useProcessAnimation = (
|
||||||
} else {
|
} else {
|
||||||
shouldLog = true;
|
shouldLog = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -592,6 +597,7 @@ export const useProcessAnimation = (
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// console.log('deferredArmBotUpdates: ', deferredArmBotUpdates);
|
||||||
if (deferredArmBotUpdates.current.length > 0) {
|
if (deferredArmBotUpdates.current.length > 0) {
|
||||||
const updates = [...deferredArmBotUpdates.current];
|
const updates = [...deferredArmBotUpdates.current];
|
||||||
deferredArmBotUpdates.current = [];
|
deferredArmBotUpdates.current = [];
|
||||||
|
|
|
@ -161,3 +161,132 @@ export type EventData = {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
interface AssetEventSchema {
|
||||||
|
modelUuid: string;
|
||||||
|
modelName: string;
|
||||||
|
position: [number, number, number];
|
||||||
|
rotation: [number, number, number];
|
||||||
|
state: "idle" | "running" | "stopped" | "disabled" | "error";
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TriggerSchema {
|
||||||
|
triggerUuid: string;
|
||||||
|
triggerName: string;
|
||||||
|
triggerType: "onComplete" | "onStart" | "onStop" | "delay" | "onError";
|
||||||
|
delay: number;
|
||||||
|
triggeredAsset: {
|
||||||
|
triggeredModel: { modelName: string, modelUuid: string };
|
||||||
|
triggeredAction: { actionName: string, actionUuid: string };
|
||||||
|
} | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TransferPointSchema {
|
||||||
|
uuid: string;
|
||||||
|
position: [number, number, number];
|
||||||
|
rotation: [number, number, number];
|
||||||
|
actions: {
|
||||||
|
actionUuid: string;
|
||||||
|
actionName: string;
|
||||||
|
actionType: "default" | "spawn" | "swap" | "despawn";
|
||||||
|
material: string | "inherit";
|
||||||
|
delay: number | "inherit";
|
||||||
|
spawnInterval: number | "inherit";
|
||||||
|
spawnCount: number | "inherit";
|
||||||
|
triggers: TriggerSchema[] | [];
|
||||||
|
}[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface VehiclePointSchema {
|
||||||
|
uuid: string;
|
||||||
|
position: [number, number, number];
|
||||||
|
rotation: [number, number, number];
|
||||||
|
actions: {
|
||||||
|
actionUuid: string;
|
||||||
|
actionName: string;
|
||||||
|
actionType: "travel";
|
||||||
|
material: string;
|
||||||
|
unLoadDuration: number;
|
||||||
|
loadCapacity: number;
|
||||||
|
pickUpPoint: { x: number; y: number, z: number } | {};
|
||||||
|
unLoadPoint: { x: number; y: number, z: number } | {};
|
||||||
|
triggers: TriggerSchema[] | [];
|
||||||
|
}[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface RoboticArmPointSchema {
|
||||||
|
uuid: string;
|
||||||
|
position: [number, number, number];
|
||||||
|
rotation: [number, number, number];
|
||||||
|
actions: {
|
||||||
|
actionUuid: string;
|
||||||
|
actionName: string;
|
||||||
|
actionType: "pickAndPlace";
|
||||||
|
process: { startPoint: string; endPoint: string };
|
||||||
|
triggers: TriggerSchema[] | [];
|
||||||
|
}[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface MachinePointSchema {
|
||||||
|
uuid: string;
|
||||||
|
position: [number, number, number];
|
||||||
|
rotation: [number, number, number];
|
||||||
|
actions: {
|
||||||
|
actionUuid: string;
|
||||||
|
actionName: string;
|
||||||
|
actionType: "process";
|
||||||
|
processTime: number;
|
||||||
|
swapMaterial: string;
|
||||||
|
triggers: TriggerSchema[] | [];
|
||||||
|
}[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface StoragePointSchema {
|
||||||
|
uuid: string;
|
||||||
|
position: [number, number, number];
|
||||||
|
rotation: [number, number, number];
|
||||||
|
actions: {
|
||||||
|
actionUuid: string;
|
||||||
|
actionName: string;
|
||||||
|
actionType: "storage";
|
||||||
|
materials: { materialName: string; materialId: string; quantity: number }[];
|
||||||
|
storageCapacity: number;
|
||||||
|
}[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TransferEventSchema extends AssetEventSchema {
|
||||||
|
type: "transfer";
|
||||||
|
speed: number;
|
||||||
|
points: TransferPointSchema[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface VehicleSchemaEvent extends AssetEventSchema {
|
||||||
|
type: "vehicle";
|
||||||
|
speed: number;
|
||||||
|
point: VehiclePointSchema;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface RoboticArmSchemaEvent extends AssetEventSchema {
|
||||||
|
type: "roboticArm";
|
||||||
|
speed: number;
|
||||||
|
point: RoboticArmPointSchema;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface MachineSchemaEvent extends AssetEventSchema {
|
||||||
|
type: "machine";
|
||||||
|
point: MachinePointSchema;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface StorageSchemaEvent extends AssetEventSchema {
|
||||||
|
type: "storageUnit";
|
||||||
|
point: StoragePointSchema;
|
||||||
|
}
|
||||||
|
|
||||||
|
type EventsSchema = TransferEventSchema | VehicleSchemaEvent | RoboticArmSchemaEvent | MachineSchemaEvent | StorageSchemaEvent | [];
|
||||||
|
|
||||||
|
type productsSchema = {
|
||||||
|
productName: string;
|
||||||
|
productId: string;
|
||||||
|
eventsData: EventsSchema[];
|
||||||
|
}[] | []
|
Loading…
Reference in New Issue