Compare commits
1 Commits
realTimeVi
...
simulation
| Author | SHA1 | Date | |
|---|---|---|---|
| 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,15 +522,19 @@ export const useProcessAnimation = (
|
|||||||
connections.forEach((connection) => {
|
connections.forEach((connection) => {
|
||||||
const connectedModelUUID = connection.modelUUID;
|
const connectedModelUUID = connection.modelUUID;
|
||||||
|
|
||||||
const matchingArmPath = armBotPaths.find((path) => path.modeluuid === connectedModelUUID);
|
const isConveyor = simulationStates.find((state) => state.modeluuid === connectedModelUUID && state.type === "Conveyor");
|
||||||
|
|
||||||
if (matchingArmPath) {
|
if (!isConveyor) {
|
||||||
deferredArmBotUpdates.current.push({
|
const matchingArmPath = armBotPaths.find((path) => path.modeluuid === connectedModelUUID);
|
||||||
uuid: connectedModelUUID,
|
|
||||||
triggerId: trigger.uuid,
|
if (matchingArmPath) {
|
||||||
});
|
deferredArmBotUpdates.current.push({
|
||||||
} else {
|
uuid: connectedModelUUID,
|
||||||
shouldLog = true;
|
triggerId: trigger.uuid,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
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 = [];
|
||||||
|
|||||||
@@ -193,18 +193,12 @@ export const DraggableWidget = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (visualizationSocket) {
|
if (visualizationSocket) {
|
||||||
console.log('duplicated');
|
visualizationSocket.emit("v2:viz-widget:add", duplicateWidget);
|
||||||
|
|
||||||
visualizationSocket.emit("v2:viz-widget:add", duplicateWidget, (res: any)=> {
|
|
||||||
if (res.success) {
|
|
||||||
setSelectedZone((prevZone: any) => ({
|
|
||||||
...prevZone,
|
|
||||||
widgets: [...prevZone.widgets, duplicatedWidget],
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
setSelectedZone((prevZone: any) => ({
|
||||||
|
...prevZone,
|
||||||
|
widgets: [...prevZone.widgets, duplicatedWidget],
|
||||||
|
}));
|
||||||
|
|
||||||
// const response = await duplicateWidgetApi(selectedZone.zoneId, organization, duplicatedWidget);
|
// const response = await duplicateWidgetApi(selectedZone.zoneId, organization, duplicatedWidget);
|
||||||
|
|
||||||
@@ -356,14 +350,13 @@ export const DraggableWidget = ({
|
|||||||
{/* Render charts based on widget type */}
|
{/* Render charts based on widget type */}
|
||||||
|
|
||||||
{widget.type === "progress 1" && (
|
{widget.type === "progress 1" && (
|
||||||
<ProgressCard1 key={widget.id} title={widget.title} id={widget.id} />
|
<ProgressCard1 title={widget.title} id={widget.id} />
|
||||||
)}
|
)}
|
||||||
{widget.type === "progress 2" && (
|
{widget.type === "progress 2" && (
|
||||||
<ProgressCard2 key={widget.id} title={widget.title} id={widget.id} />
|
<ProgressCard2 title={widget.title} id={widget.id} />
|
||||||
)}
|
)}
|
||||||
{widget.type === "line" && (
|
{widget.type === "line" && (
|
||||||
<LineGraphComponent
|
<LineGraphComponent
|
||||||
key={widget.id}
|
|
||||||
id={widget.id}
|
id={widget.id}
|
||||||
type={widget.type}
|
type={widget.type}
|
||||||
title={widget.title}
|
title={widget.title}
|
||||||
@@ -373,7 +366,6 @@ export const DraggableWidget = ({
|
|||||||
)}
|
)}
|
||||||
{widget.type === "bar" && (
|
{widget.type === "bar" && (
|
||||||
<BarGraphComponent
|
<BarGraphComponent
|
||||||
key={widget.id}
|
|
||||||
id={widget.id}
|
id={widget.id}
|
||||||
type={widget.type}
|
type={widget.type}
|
||||||
title={widget.title}
|
title={widget.title}
|
||||||
@@ -383,7 +375,6 @@ export const DraggableWidget = ({
|
|||||||
)}
|
)}
|
||||||
{widget.type === "pie" && (
|
{widget.type === "pie" && (
|
||||||
<PieGraphComponent
|
<PieGraphComponent
|
||||||
key={widget.id}
|
|
||||||
id={widget.id}
|
id={widget.id}
|
||||||
type={widget.type}
|
type={widget.type}
|
||||||
title={widget.title}
|
title={widget.title}
|
||||||
@@ -393,7 +384,6 @@ export const DraggableWidget = ({
|
|||||||
)}
|
)}
|
||||||
{widget.type === "doughnut" && (
|
{widget.type === "doughnut" && (
|
||||||
<DoughnutGraphComponent
|
<DoughnutGraphComponent
|
||||||
key={widget.id}
|
|
||||||
id={widget.id}
|
id={widget.id}
|
||||||
type={widget.type}
|
type={widget.type}
|
||||||
title={widget.title}
|
title={widget.title}
|
||||||
@@ -403,7 +393,6 @@ export const DraggableWidget = ({
|
|||||||
)}
|
)}
|
||||||
{widget.type === "polarArea" && (
|
{widget.type === "polarArea" && (
|
||||||
<PolarAreaGraphComponent
|
<PolarAreaGraphComponent
|
||||||
key={widget.id}
|
|
||||||
id={widget.id}
|
id={widget.id}
|
||||||
type={widget.type}
|
type={widget.type}
|
||||||
title={widget.title}
|
title={widget.title}
|
||||||
|
|||||||
@@ -273,13 +273,7 @@ export default function Dropped3dWidgets() {
|
|||||||
zoneId: selectedZone.zoneId,
|
zoneId: selectedZone.zoneId,
|
||||||
};
|
};
|
||||||
if (visualizationSocket) {
|
if (visualizationSocket) {
|
||||||
visualizationSocket.emit("v2:viz-3D-widget:add", adding3dWidget,(res:any)=>{
|
visualizationSocket.emit("v2:viz-3D-widget:add", adding3dWidget);
|
||||||
if (res.success) {
|
|
||||||
addWidget(selectedZone.zoneId, newWidget);
|
|
||||||
setRightSelect(null);
|
|
||||||
setRightClickSelected(null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
// let response = await adding3dWidgets(selectedZone.zoneId, organization, newWidget)
|
// let response = await adding3dWidgets(selectedZone.zoneId, organization, newWidget)
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ export const useDroppedObjectsStore = create<DroppedObjectsState>((set) => ({
|
|||||||
: originalObject.position.left,
|
: originalObject.position.left,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
console.log("duplicated object",duplicatedObject);
|
||||||
|
|
||||||
let duplicateFloatingWidget = {
|
let duplicateFloatingWidget = {
|
||||||
organization: organization,
|
organization: organization,
|
||||||
@@ -143,23 +144,18 @@ export const useDroppedObjectsStore = create<DroppedObjectsState>((set) => ({
|
|||||||
if (visualizationSocket) {
|
if (visualizationSocket) {
|
||||||
visualizationSocket.emit(
|
visualizationSocket.emit(
|
||||||
"v2:viz-float:addDuplicate",
|
"v2:viz-float:addDuplicate",
|
||||||
duplicateFloatingWidget,
|
duplicateFloatingWidget
|
||||||
(res:any)=>{
|
|
||||||
if (res.success) {
|
|
||||||
useDroppedObjectsStore.setState((state) => ({
|
|
||||||
zones: {
|
|
||||||
...state.zones,
|
|
||||||
[zoneName]: {
|
|
||||||
...state.zones[zoneName],
|
|
||||||
objects: [...state.zones[zoneName].objects, duplicatedObject], // Append duplicated object
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
useDroppedObjectsStore.setState((state) => ({
|
||||||
|
zones: {
|
||||||
|
...state.zones,
|
||||||
|
[zoneName]: {
|
||||||
|
...state.zones[zoneName],
|
||||||
|
objects: [...state.zones[zoneName].objects, duplicatedObject], // Append duplicated object
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
// Make async API call outside of Zustand set function
|
// Make async API call outside of Zustand set function
|
||||||
// let response = await addingFloatingWidgets(
|
// let response = await addingFloatingWidgets(
|
||||||
|
|||||||
129
app/src/types/simulationTypes.d.ts
vendored
129
app/src/types/simulationTypes.d.ts
vendored
@@ -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[];
|
||||||
|
}[] | []
|
||||||
Reference in New Issue
Block a user