added ui for changing position of vehicles pickup-point and unloadPoint
This commit is contained in:
@@ -15,7 +15,6 @@ interface VehicleAnimatorProps {
|
||||
}
|
||||
|
||||
function VehicleAnimator({ path, handleCallBack, currentPhase, agvUuid, agvDetail, reset }: VehicleAnimatorProps) {
|
||||
// console.log('path: ', path);
|
||||
const { decrementVehicleLoad } = useVehicleStore();
|
||||
const { isPaused } = usePauseButtonStore();
|
||||
const { isPlaying } = usePlayButtonStore();
|
||||
@@ -193,7 +192,6 @@ function VehicleAnimator({ path, handleCallBack, currentPhase, agvUuid, agvDetai
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
{currentPath.length > 0 && (
|
||||
|
||||
@@ -51,10 +51,11 @@ function VehicleInstance({ agvDetail }: any) {
|
||||
|
||||
useEffect(() => {
|
||||
if (isPlaying) {
|
||||
|
||||
if (!agvDetail.isActive && agvDetail.state === 'idle' && currentPhase === 'stationed') {
|
||||
const toPickupPath = computePath(
|
||||
new THREE.Vector3(agvDetail.position[0], agvDetail.position[1], agvDetail.position[2]),
|
||||
agvDetail.point.action.pickUpPoint
|
||||
new THREE.Vector3(agvDetail?.position[0], agvDetail?.position[1], agvDetail?.position[2]),
|
||||
agvDetail?.point?.action?.pickUpPoint?.position
|
||||
);
|
||||
setPath(toPickupPath);
|
||||
setCurrentPhase('stationed-pickup');
|
||||
@@ -70,8 +71,8 @@ function VehicleInstance({ agvDetail }: any) {
|
||||
|
||||
if (agvDetail.currentLoad === agvDetail.point.action.loadCapacity) {
|
||||
const toDrop = computePath(
|
||||
agvDetail.point.action.pickUpPoint,
|
||||
agvDetail.point.action.unLoadPoint
|
||||
agvDetail.point.action.pickUpPoint.position,
|
||||
agvDetail.point.action.unLoadPoint.position
|
||||
);
|
||||
setPath(toDrop);
|
||||
setCurrentPhase('pickup-drop');
|
||||
@@ -81,8 +82,8 @@ function VehicleInstance({ agvDetail }: any) {
|
||||
}
|
||||
} else if (!agvDetail.isActive && agvDetail.state === 'idle' && currentPhase === 'dropping' && agvDetail.currentLoad === 0) {
|
||||
const dropToPickup = computePath(
|
||||
agvDetail.point.action.unLoadPoint,
|
||||
agvDetail.point.action.pickUpPoint
|
||||
agvDetail.point.action.unLoadPoint.position,
|
||||
agvDetail.point.action.pickUpPoint.position
|
||||
);
|
||||
setPath(dropToPickup);
|
||||
setCurrentPhase('drop-pickup');
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
import React from 'react'
|
||||
import VehicleInstance from './instance/vehicleInstance'
|
||||
import { useVehicleStore } from '../../../../store/simulation/useVehicleStore'
|
||||
import VehicleUI from '../../ui/vehicle/vehicleUI';
|
||||
type VehicleUIProps = {
|
||||
vehicleStatusSample: VehicleEventSchema[];
|
||||
setVehicleStatusSample: React.Dispatch<
|
||||
React.SetStateAction<VehicleEventSchema[]>
|
||||
>;
|
||||
};
|
||||
const VehicleInstances: React.FC<VehicleUIProps> = ({
|
||||
vehicleStatusSample,
|
||||
setVehicleStatusSample,
|
||||
}) => {
|
||||
|
||||
function VehicleInstances() {
|
||||
|
||||
const { vehicles } = useVehicleStore();
|
||||
|
||||
@@ -19,14 +10,9 @@ const VehicleInstances: React.FC<VehicleUIProps> = ({
|
||||
<>
|
||||
|
||||
{vehicles.map((val: any, i: any) =>
|
||||
<>
|
||||
<VehicleInstance agvDetail={val} key={i} />
|
||||
<VehicleUI
|
||||
setVehicleStatusSample={setVehicleStatusSample}
|
||||
vehicleStatusSample={vehicleStatusSample}
|
||||
vehicle={val}
|
||||
/>
|
||||
</>
|
||||
|
||||
<VehicleInstance agvDetail={val} key={i} />
|
||||
|
||||
)}
|
||||
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user