2025-04-22 17:24:30 +05:30
|
|
|
import React, { useEffect } from 'react'
|
|
|
|
|
import VehicleInstances from './instances/vehicleInstances';
|
|
|
|
|
import { useVehicleStore } from '../../../store/simulation/useVehicleStore';
|
2025-04-25 17:57:38 +05:30
|
|
|
import { useFloorItems } from '../../../store/store';
|
2025-04-22 17:24:30 +05:30
|
|
|
|
|
|
|
|
function Vehicles() {
|
|
|
|
|
|
|
|
|
|
const { vehicles, addVehicle } = useVehicleStore();
|
|
|
|
|
|
2025-04-25 17:57:38 +05:30
|
|
|
const { floorItems } = useFloorItems();
|
|
|
|
|
|
2025-04-23 12:29:16 +05:30
|
|
|
const vehicleStatusSample: 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,
|
|
|
|
|
pickUpPoint: { x: 98.71483985219794, y: 0, z: 28.66321267938962 },
|
|
|
|
|
unLoadPoint: { x: 105.71483985219794, y: 0, z: 28.66321267938962 },
|
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,
|
|
|
|
|
pickUpPoint: { x: 90, y: 0, z: 28 },
|
2025-04-23 09:13:33 +05:30
|
|
|
unLoadPoint: { x: 20, y: 0, z: 10 },
|
|
|
|
|
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-23 09:13:33 +05:30
|
|
|
}, {
|
2025-04-25 17:57:38 +05:30
|
|
|
modelUuid: "e729a4f1-11d2-4778-8d6a-468f1b4f6b79",
|
|
|
|
|
modelName: "forklift",
|
|
|
|
|
position: [98.85729337188162, 0, 38.36616546567653],
|
2025-04-22 17:24:30 +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",
|
|
|
|
|
unLoadDuration: 15,
|
|
|
|
|
loadCapacity: 5,
|
2025-04-25 17:57:38 +05:30
|
|
|
pickUpPoint: { x: 98.71483985219794, y: 0, z: 28.66321267938962 },
|
2025-04-22 17:24:30 +05:30
|
|
|
unLoadPoint: { x: 20, y: 0, z: 10 },
|
|
|
|
|
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-23 12:29:16 +05:30
|
|
|
}
|
2025-04-22 17:24:30 +05:30
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
addVehicle('123', vehicleStatusSample[0]);
|
2025-04-25 19:31:46 +05:30
|
|
|
// addVehicle('123', vehicleStatusSample[1]);
|
2025-04-25 17:57:38 +05:30
|
|
|
// addVehicle('123', vehicleStatusSample[2]);
|
2025-04-22 17:24:30 +05:30
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
console.log('vehicles: ', vehicles);
|
|
|
|
|
}, [vehicles])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
2025-04-23 12:27:02 +05:30
|
|
|
<VehicleInstances />
|
2025-04-22 17:24:30 +05:30
|
|
|
</>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Vehicles;
|