2025-04-29 10:18:05 +05:30
|
|
|
import React, { useEffect, useState } from "react";
|
|
|
|
|
import VehicleInstances from "./instances/vehicleInstances";
|
|
|
|
|
import { useVehicleStore } from "../../../store/simulation/useVehicleStore";
|
|
|
|
|
import { useFloorItems } from "../../../store/store";
|
2025-04-30 09:15:21 +05:30
|
|
|
import { useSelectedEventData, useSelectedEventSphere } from "../../../store/simulation/useSimulationStore";
|
2025-04-29 10:18:05 +05:30
|
|
|
import VehicleUI from "../ui/vehicle/vehicleUI";
|
2025-04-30 09:15:21 +05:30
|
|
|
import { usePlayButtonStore } from "../../../store/usePlayButtonStore";
|
2025-04-22 17:24:30 +05:30
|
|
|
function Vehicles() {
|
|
|
|
|
|
|
|
|
|
const { vehicles, addVehicle } = useVehicleStore();
|
2025-04-30 09:15:21 +05:30
|
|
|
const { selectedEventSphere } = useSelectedEventSphere();
|
|
|
|
|
const { selectedEventData } = useSelectedEventData();
|
2025-04-25 17:57:38 +05:30
|
|
|
const { floorItems } = useFloorItems();
|
2025-04-30 09:15:21 +05:30
|
|
|
const { isPlaying } = usePlayButtonStore();
|
2025-04-25 17:57:38 +05:30
|
|
|
|
2025-04-29 12:56:20 +05:30
|
|
|
const [vehicleStatusSample, setVehicleStatusSample] = useState<
|
|
|
|
|
VehicleEventSchema[]
|
|
|
|
|
>([
|
2025-04-22 17:24:30 +05:30
|
|
|
{
|
2025-04-25 17:57:38 +05:30
|
|
|
modelUuid: "9356f710-4727-4b50-bdb2-9c1e747ecc74",
|
2025-04-23 09:13:33 +05:30
|
|
|
modelName: "AGV",
|
2025-04-25 17:57:38 +05:30
|
|
|
position: [97.9252965204558, 0, 37.96138815638661],
|
2025-04-22 17:24:30 +05:30
|
|
|
rotation: [0, 0, 0],
|
|
|
|
|
state: "idle",
|
|
|
|
|
type: "vehicle",
|
|
|
|
|
speed: 2.5,
|
|
|
|
|
point: {
|
|
|
|
|
uuid: "point-789",
|
2025-04-23 12:27:02 +05:30
|
|
|
position: [0, 1, 0],
|
2025-04-22 17:24:30 +05:30
|
|
|
rotation: [0, 0, 0],
|
|
|
|
|
action: {
|
|
|
|
|
actionUuid: "action-456",
|
|
|
|
|
actionName: "Deliver to Zone A",
|
|
|
|
|
actionType: "travel",
|
2025-04-25 17:57:38 +05:30
|
|
|
unLoadDuration: 10,
|
|
|
|
|
loadCapacity: 2,
|
2025-04-30 11:46:20 +05:30
|
|
|
steeringAngle:0,
|
2025-04-29 10:33:30 +05:30
|
|
|
pickUpPoint: { position: { x: 98.71483985219794, y: 0, z: 28.66321267938962 }, rotation: { x: 0, y: 0, z: 0 } },
|
|
|
|
|
unLoadPoint: { position: { x: 105.71483985219794, y: 0, z: 28.66321267938962 }, rotation: { x: 0, y: 0, z: 0 } },
|
2025-04-22 17:24:30 +05:30
|
|
|
triggers: [
|
|
|
|
|
{
|
|
|
|
|
triggerUuid: "trig-001",
|
|
|
|
|
triggerName: "Start Travel",
|
|
|
|
|
triggerType: "onComplete",
|
|
|
|
|
delay: 0,
|
|
|
|
|
triggeredAsset: {
|
|
|
|
|
triggeredModel: { modelName: "ArmBot-X", modelUuid: "arm-001" },
|
|
|
|
|
triggeredPoint: { pointName: "Pickup Arm Point", pointUuid: "arm-point-01" },
|
|
|
|
|
triggeredAction: { actionName: "Grab Widget", actionUuid: "grab-001" }
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
triggerUuid: "trig-002",
|
|
|
|
|
triggerName: "Complete Travel",
|
|
|
|
|
triggerType: "onComplete",
|
|
|
|
|
delay: 2,
|
|
|
|
|
triggeredAsset: null
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
2025-04-23 12:29:16 +05:30
|
|
|
}
|
2025-04-22 17:24:30 +05:30
|
|
|
},
|
|
|
|
|
{
|
2025-04-25 17:57:38 +05:30
|
|
|
modelUuid: "b06960bb-3d2e-41f7-a646-335f389c68b4",
|
2025-04-23 09:13:33 +05:30
|
|
|
modelName: "AGV",
|
2025-04-25 17:57:38 +05:30
|
|
|
position: [89.61609306554463, 0, 33.634136622267356],
|
2025-04-23 09:13:33 +05:30
|
|
|
rotation: [0, 0, 0],
|
|
|
|
|
state: "idle",
|
|
|
|
|
type: "vehicle",
|
|
|
|
|
speed: 2.5,
|
|
|
|
|
point: {
|
|
|
|
|
uuid: "point-789",
|
|
|
|
|
position: [0, 1, 0],
|
|
|
|
|
rotation: [0, 0, 0],
|
|
|
|
|
action: {
|
|
|
|
|
actionUuid: "action-456",
|
|
|
|
|
actionName: "Deliver to Zone A",
|
|
|
|
|
actionType: "travel",
|
2025-04-25 17:57:38 +05:30
|
|
|
unLoadDuration: 10,
|
|
|
|
|
loadCapacity: 2,
|
2025-04-30 11:46:20 +05:30
|
|
|
steeringAngle:0,
|
2025-04-29 12:56:20 +05:30
|
|
|
pickUpPoint: null,
|
|
|
|
|
unLoadPoint: null,
|
2025-04-23 09:13:33 +05:30
|
|
|
triggers: [
|
|
|
|
|
{
|
|
|
|
|
triggerUuid: "trig-001",
|
|
|
|
|
triggerName: "Start Travel",
|
|
|
|
|
triggerType: "onStart",
|
|
|
|
|
delay: 0,
|
|
|
|
|
triggeredAsset: {
|
|
|
|
|
triggeredModel: { modelName: "ArmBot-X", modelUuid: "arm-001" },
|
|
|
|
|
triggeredPoint: { pointName: "Pickup Arm Point", pointUuid: "arm-point-01" },
|
|
|
|
|
triggeredAction: { actionName: "Grab Widget", actionUuid: "grab-001" }
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
triggerUuid: "trig-002",
|
|
|
|
|
triggerName: "Complete Travel",
|
|
|
|
|
triggerType: "onComplete",
|
|
|
|
|
delay: 2,
|
|
|
|
|
triggeredAsset: null
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
2025-04-25 17:57:38 +05:30
|
|
|
}
|
2025-04-29 10:33:30 +05:30
|
|
|
},
|
2025-04-30 09:15:21 +05:30
|
|
|
// {
|
|
|
|
|
// modelUuid: "cd7d0584-0684-42b4-b051-9e882c1914aa",
|
|
|
|
|
// modelName: "AGV",
|
|
|
|
|
// position: [105.90938758014703, 0, 31.584209911095215],
|
|
|
|
|
// rotation: [0, 0, 0],
|
|
|
|
|
// state: "idle",
|
|
|
|
|
// type: "vehicle",
|
|
|
|
|
// speed: 2.5,
|
|
|
|
|
// point: {
|
|
|
|
|
// uuid: "point-789",
|
|
|
|
|
// position: [0, 1, 0],
|
|
|
|
|
// rotation: [0, 0, 0],
|
|
|
|
|
// action: {
|
|
|
|
|
// actionUuid: "action-456",
|
|
|
|
|
// actionName: "Deliver to Zone A",
|
|
|
|
|
// actionType: "travel",
|
|
|
|
|
// unLoadDuration: 10,
|
|
|
|
|
// loadCapacity: 2,
|
2025-04-30 11:49:15 +05:30
|
|
|
// steeringAngle:0,
|
2025-04-30 09:15:21 +05:30
|
|
|
// pickUpPoint: null,
|
|
|
|
|
// unLoadPoint: null,
|
|
|
|
|
// triggers: [
|
|
|
|
|
// {
|
|
|
|
|
// triggerUuid: "trig-001",
|
|
|
|
|
// triggerName: "Start Travel",
|
|
|
|
|
// triggerType: "onStart",
|
|
|
|
|
// delay: 0,
|
|
|
|
|
// triggeredAsset: {
|
|
|
|
|
// triggeredModel: { modelName: "ArmBot-X", modelUuid: "arm-001" },
|
|
|
|
|
// triggeredPoint: { pointName: "Pickup Arm Point", pointUuid: "arm-point-01" },
|
|
|
|
|
// triggeredAction: { actionName: "Grab Widget", actionUuid: "grab-001" }
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// triggerUuid: "trig-002",
|
|
|
|
|
// triggerName: "Complete Travel",
|
|
|
|
|
// triggerType: "onComplete",
|
|
|
|
|
// delay: 2,
|
|
|
|
|
// triggeredAsset: null
|
|
|
|
|
// }
|
|
|
|
|
// ]
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// },
|
2025-04-29 12:56:20 +05:30
|
|
|
// {
|
|
|
|
|
// modelUuid: "e729a4f1-11d2-4778-8d6a-468f1b4f6b79",
|
|
|
|
|
// modelName: "forklift",
|
|
|
|
|
// position: [98.85729337188162, 0, 38.36616546567653],
|
|
|
|
|
// rotation: [0, 0, 0],
|
|
|
|
|
// state: "idle",
|
|
|
|
|
// type: "vehicle",
|
|
|
|
|
// speed: 2.5,
|
|
|
|
|
// point: {
|
|
|
|
|
// uuid: "point-789",
|
|
|
|
|
// position: [0, 1, 0],
|
|
|
|
|
// rotation: [0, 0, 0],
|
|
|
|
|
// action: {
|
|
|
|
|
// actionUuid: "action-456",
|
|
|
|
|
// actionName: "Deliver to Zone A",
|
|
|
|
|
// actionType: "travel",
|
|
|
|
|
// unLoadDuration: 15,
|
|
|
|
|
// loadCapacity: 5,
|
2025-04-30 11:49:15 +05:30
|
|
|
// steeringAngle:0,
|
2025-04-29 12:56:20 +05:30
|
|
|
// pickUpPoint: null,
|
|
|
|
|
// unLoadPoint: null,
|
|
|
|
|
// triggers: [
|
|
|
|
|
// {
|
|
|
|
|
// triggerUuid: "trig-001",
|
|
|
|
|
// triggerName: "Start Travel",
|
|
|
|
|
// triggerType: "onStart",
|
|
|
|
|
// delay: 0,
|
|
|
|
|
// triggeredAsset: {
|
|
|
|
|
// triggeredModel: { modelName: "ArmBot-X", modelUuid: "arm-001" },
|
|
|
|
|
// triggeredPoint: { pointName: "Pickup Arm Point", pointUuid: "arm-point-01" },
|
|
|
|
|
// triggeredAction: { actionName: "Grab Widget", actionUuid: "grab-001" }
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// triggerUuid: "trig-002",
|
|
|
|
|
// triggerName: "Complete Travel",
|
|
|
|
|
// triggerType: "onComplete",
|
|
|
|
|
// delay: 2,
|
|
|
|
|
// triggeredAsset: null
|
|
|
|
|
// }
|
|
|
|
|
// ]
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
]);
|
|
|
|
|
useEffect(() => {
|
2025-04-30 11:49:58 +05:30
|
|
|
// console.log('vehicles: ', vehicles);
|
2025-04-29 12:56:20 +05:30
|
|
|
}, [vehicles])
|
2025-04-22 17:24:30 +05:30
|
|
|
|
|
|
|
|
useEffect(() => {
|
2025-04-29 12:56:20 +05:30
|
|
|
addVehicle("123", vehicleStatusSample[0]);
|
|
|
|
|
addVehicle('123', vehicleStatusSample[1]);
|
2025-04-25 17:57:38 +05:30
|
|
|
// addVehicle('123', vehicleStatusSample[2]);
|
2025-04-29 12:56:20 +05:30
|
|
|
}, []);
|
2025-04-22 17:24:30 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
2025-04-23 12:27:02 +05:30
|
|
|
<VehicleInstances />
|
2025-04-30 09:15:21 +05:30
|
|
|
{selectedEventSphere && selectedEventData?.data.type === "vehicle" && !isPlaying &&
|
|
|
|
|
< VehicleUI />
|
|
|
|
|
}
|
2025-04-22 17:24:30 +05:30
|
|
|
</>
|
2025-04-29 12:56:20 +05:30
|
|
|
);
|
2025-04-22 17:24:30 +05:30
|
|
|
}
|
|
|
|
|
|
2025-04-29 10:18:05 +05:30
|
|
|
export default Vehicles;
|
2025-04-22 17:24:30 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|