armbot circular path updated and ui dynamic updation

This commit is contained in:
2025-05-02 17:35:52 +05:30
parent 764e235a5f
commit d83b934e61
10 changed files with 438 additions and 698 deletions

View File

@@ -2,24 +2,26 @@ import { useEffect } from "react";
import RoboticArmInstances from "./instances/roboticArmInstances";
import { useArmBotStore } from "../../../store/simulation/useArmBotStore";
import { useFloorItems } from "../../../store/store";
import { useSelectedEventData, useSelectedEventSphere } from "../../../store/simulation/useSimulationStore";
import { useEventsStore } from "../../../store/simulation/useEventsStore";
import { useSelectedEventData, useSelectedEventSphere, useSelectedProduct } from "../../../store/simulation/useSimulationStore";
import { useProductStore } from "../../../store/simulation/useProductStore";
import { usePlayButtonStore } from "../../../store/usePlayButtonStore";
import ArmBotUI from "../ui/arm/armBotUI";
function RoboticArm() {
const { armBots, addArmBot, removeArmBot } = useArmBotStore();
const { addEvent } = useEventsStore();
const { getProductById } = useProductStore();
const { selectedProduct } = useSelectedProduct();
const { selectedEventSphere } = useSelectedEventSphere();
const { selectedEventData } = useSelectedEventData();
const { isPlaying } = usePlayButtonStore();
const { floorItems } = useFloorItems();
const armBotStatusSample: RoboticArmEventSchema[] = [
{
state: "idle",
modelUuid: "3abf5d46-b59e-4e6b-9c02-a4634b64b82d",
modelUuid: "8790b4d5-fb6e-49e0-8161-04945fe3fdc4",
modelName: "ArmBot-X200",
position: [0.20849215906958463, 0, 0.32079278127773675],
position: [4.317833205016363, 0, -3.2829924989068715],
rotation: [-1.3768690876192207e-15, 1.4883085074751308, 1.5407776675834467e-15],
type: "roboticArm",
speed: 1.5,
@@ -156,24 +158,36 @@ function RoboticArm() {
];
useEffect(() => {
if (selectedProduct.productId) {
const product = getProductById(selectedProduct.productId);
if (product) {
product.eventDatas.forEach(events => {
if (events.type === 'roboticArm') {
removeArmBot(events.modelUuid);
addArmBot(selectedProduct.productId, events);
}
});
}
}
}, [selectedProduct]);
removeArmBot(armBotStatusSample[0].modelUuid);
addArmBot('123', armBotStatusSample[0]);
// addArmBot('123', armBotStatusSample[1]);
// addCurrentAction('armbot-xyz-001', 'action-001');
}, []);
// useEffect(()=>{
// // removeArmBot("123", armBotStatusSample[0]);
// addArmBot("123", armBotStatusSample[0]);
// },[])
useEffect(() => {
}, [armBots])
useEffect(() => {
console.log('isPlaying: ', isPlaying);
console.log('selectedEventData: ', selectedEventData);
console.log('selectedEventSphere: ', selectedEventSphere);
}, [selectedEventData, selectedEventSphere, isPlaying]);
return (
<>
<RoboticArmInstances />
{selectedEventSphere && selectedEventData?.data.type === "roboticArm" && !isPlaying &&
{selectedEventSphere && selectedEventData?.data.type === "roboticArm" &&
< ArmBotUI />
}
</>