feat: Update visibility logic for path points and add new event schemas in simulation types

This commit is contained in:
2025-04-17 17:47:27 +05:30
parent 967f1741b0
commit 686c4e60c6
4 changed files with 146 additions and 11 deletions

View File

@@ -95,7 +95,7 @@ const Agv: React.FC<ProcessContainerProps> = ({
/>
{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]} />
<meshStandardMaterial color="red" />
</mesh>

View File

@@ -456,7 +456,7 @@ export default function PathNavigator({
}, []);
return (
<group name="path-navigator-lines">
<group name="path-navigator-lines" visible={!isPlaying} >
{toPickupPath.length > 0 && (
<Line
points={toPickupPath}

View File

@@ -15,7 +15,7 @@ import {
usePlayButtonStore,
useResetButtonStore,
} from "../../../store/usePlayButtonStore";
import { usePlayAgv } from "../../../store/store";
import { usePlayAgv, useSimulationStates } from "../../../store/store";
interface ArmBotProcess {
triggerId: string;
@@ -82,6 +82,7 @@ export const useProcessAnimation = (
const [animationStates, setAnimationStates] = useState<Record<string, EnhancedProcessAnimationState>>({});
const speedRef = useRef<number>(speed);
const { PlayAgv, setPlayAgv } = usePlayAgv();
const { simulationStates } = useSimulationStates();
// Effect hooks
useEffect(() => {
@@ -521,15 +522,19 @@ export const useProcessAnimation = (
connections.forEach((connection) => {
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) {
deferredArmBotUpdates.current.push({
uuid: connectedModelUUID,
triggerId: trigger.uuid,
});
} else {
shouldLog = true;
if (!isConveyor) {
const matchingArmPath = armBotPaths.find((path) => path.modeluuid === connectedModelUUID);
if (matchingArmPath) {
deferredArmBotUpdates.current.push({
uuid: connectedModelUUID,
triggerId: trigger.uuid,
});
} else {
shouldLog = true;
}
}
});
});
@@ -592,6 +597,7 @@ export const useProcessAnimation = (
}, []);
useEffect(() => {
// console.log('deferredArmBotUpdates: ', deferredArmBotUpdates);
if (deferredArmBotUpdates.current.length > 0) {
const updates = [...deferredArmBotUpdates.current];
deferredArmBotUpdates.current = [];