feat: Add isActive property to ArmBot state and update IKAnimationController logic
refactor: Remove commented console logs in ProcessAnimator and useProcessAnimations
This commit is contained in:
parent
f7e4f5c580
commit
8e491a0002
|
@ -53,7 +53,8 @@ const ArmBot = ({ armBots, setArmBots, setStaticMachines }: ArmBotProps) => {
|
||||||
material: "default",
|
material: "default",
|
||||||
triggerId: '',
|
triggerId: '',
|
||||||
actions: bot.points.actions,
|
actions: bot.points.actions,
|
||||||
connections: bot.points.connections
|
connections: bot.points.connections,
|
||||||
|
isActive: false
|
||||||
}));
|
}));
|
||||||
setArmBots(initialStates);
|
setArmBots(initialStates);
|
||||||
}, [simulationStates, isReset]);
|
}, [simulationStates, isReset]);
|
||||||
|
|
|
@ -347,7 +347,7 @@ const IKAnimationController = ({
|
||||||
if (matchedMachine.type === "Conveyor") {
|
if (matchedMachine.type === "Conveyor") {
|
||||||
setArmBots((prev) =>
|
setArmBots((prev) =>
|
||||||
prev.map((arm) => {
|
prev.map((arm) => {
|
||||||
if (arm.uuid === uuid) {
|
if (arm.uuid === uuid && arm.isActive === true) {
|
||||||
return {
|
return {
|
||||||
...arm,
|
...arm,
|
||||||
isActive: false,
|
isActive: false,
|
||||||
|
|
|
@ -169,9 +169,9 @@ const ProcessAnimator: React.FC<ProcessContainerProps> = ({
|
||||||
|
|
||||||
const spawnPoint = findSpawnPoint(process);
|
const spawnPoint = findSpawnPoint(process);
|
||||||
if (!spawnPoint || !spawnPoint.actions) {
|
if (!spawnPoint || !spawnPoint.actions) {
|
||||||
console.log(
|
// console.log(
|
||||||
`Process ${process.id} has no valid spawn point or actions`
|
// `Process ${process.id} has no valid spawn point or actions`
|
||||||
);
|
// );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,10 +255,10 @@ const ProcessAnimator: React.FC<ProcessContainerProps> = ({
|
||||||
|
|
||||||
// Check connection status with debugging
|
// Check connection status with debugging
|
||||||
const isConnected = isConnectedToActiveArmBot(process.id);
|
const isConnected = isConnectedToActiveArmBot(process.id);
|
||||||
console.log(
|
// console.log(
|
||||||
`Process ${process.id} animation - connected:`,
|
// `Process ${process.id} animation - connected:`,
|
||||||
isConnected
|
// isConnected
|
||||||
);
|
// );
|
||||||
|
|
||||||
if (isConnected) {
|
if (isConnected) {
|
||||||
// Stop all animations when connected to active arm bot
|
// Stop all animations when connected to active arm bot
|
||||||
|
@ -293,9 +293,9 @@ const ProcessAnimator: React.FC<ProcessContainerProps> = ({
|
||||||
currentTime - processState.processDelayStartTime >=
|
currentTime - processState.processDelayStartTime >=
|
||||||
effectiveDelayTime
|
effectiveDelayTime
|
||||||
) {
|
) {
|
||||||
console.log(
|
// console.log(
|
||||||
`Process ${process.id} delay completed, resuming animation`
|
// `Process ${process.id} delay completed, resuming animation`
|
||||||
);
|
// );
|
||||||
newStates[process.id] = {
|
newStates[process.id] = {
|
||||||
...processState,
|
...processState,
|
||||||
isProcessDelaying: false,
|
isProcessDelaying: false,
|
||||||
|
@ -331,9 +331,9 @@ const ProcessAnimator: React.FC<ProcessContainerProps> = ({
|
||||||
[];
|
[];
|
||||||
|
|
||||||
if (path.length < 2) {
|
if (path.length < 2) {
|
||||||
console.log(
|
// console.log(
|
||||||
`Process ${process.id} has insufficient path points: ${path.length}`
|
// `Process ${process.id} has insufficient path points: ${path.length}`
|
||||||
);
|
// );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,9 +348,9 @@ const ProcessAnimator: React.FC<ProcessContainerProps> = ({
|
||||||
|
|
||||||
const currentRef = gltf?.scene ? obj.ref.current : obj.ref.current;
|
const currentRef = gltf?.scene ? obj.ref.current : obj.ref.current;
|
||||||
if (!currentRef) {
|
if (!currentRef) {
|
||||||
console.log(
|
// console.log(
|
||||||
`No reference for object ${objectId}, skipping animation`
|
// `No reference for object ${objectId}, skipping animation`
|
||||||
);
|
// );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,9 +378,9 @@ const ProcessAnimator: React.FC<ProcessContainerProps> = ({
|
||||||
stateRef.currentDelayDuration / speedRef.current;
|
stateRef.currentDelayDuration / speedRef.current;
|
||||||
|
|
||||||
if (currentTime - stateRef.delayStartTime >= effectiveDelayTime) {
|
if (currentTime - stateRef.delayStartTime >= effectiveDelayTime) {
|
||||||
console.log(
|
// console.log(
|
||||||
`Delay complete for object ${objectId}, resuming animation`
|
// `Delay complete for object ${objectId}, resuming animation`
|
||||||
);
|
// );
|
||||||
stateRef.isDelaying = false;
|
stateRef.isDelaying = false;
|
||||||
stateRef.delayComplete = true;
|
stateRef.delayComplete = true;
|
||||||
stateRef.isAnimating = true;
|
stateRef.isAnimating = true;
|
||||||
|
@ -408,9 +408,9 @@ const ProcessAnimator: React.FC<ProcessContainerProps> = ({
|
||||||
|
|
||||||
// Skip non-animating objects
|
// Skip non-animating objects
|
||||||
if (!stateRef.isAnimating) {
|
if (!stateRef.isAnimating) {
|
||||||
console.log(
|
// console.log(
|
||||||
`Object ${objectId} not animating, skipping animation updates`
|
// `Object ${objectId} not animating, skipping animation updates`
|
||||||
);
|
// );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,9 +454,9 @@ const ProcessAnimator: React.FC<ProcessContainerProps> = ({
|
||||||
|
|
||||||
if (shouldHide) {
|
if (shouldHide) {
|
||||||
if (isAgvPicking) {
|
if (isAgvPicking) {
|
||||||
console.log(
|
// console.log(
|
||||||
`AGV picking at last point for object ${objectId}, hiding object`
|
// `AGV picking at last point for object ${objectId}, hiding object`
|
||||||
);
|
// );
|
||||||
updatedObjects[objectId] = {
|
updatedObjects[objectId] = {
|
||||||
...obj,
|
...obj,
|
||||||
visible: false,
|
visible: false,
|
||||||
|
@ -517,14 +517,14 @@ const ProcessAnimator: React.FC<ProcessContainerProps> = ({
|
||||||
if (stateRef.delayComplete && stateRef.progress < 0.01) {
|
if (stateRef.delayComplete && stateRef.progress < 0.01) {
|
||||||
stateRef.progress = 0.05;
|
stateRef.progress = 0.05;
|
||||||
stateRef.delayComplete = false;
|
stateRef.delayComplete = false;
|
||||||
console.log(
|
// console.log(
|
||||||
`Boosting progress for object ${objectId} after delay`
|
// `Boosting progress for object ${objectId} after delay`
|
||||||
);
|
// );
|
||||||
} else {
|
} else {
|
||||||
stateRef.progress += movement / distance;
|
stateRef.progress += movement / distance;
|
||||||
console.log(
|
// console.log(
|
||||||
`Object ${objectId} progress: ${stateRef.progress.toFixed(3)}`
|
// `Object ${objectId} progress: ${stateRef.progress.toFixed(3)}`
|
||||||
);
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle point transition
|
// Handle point transition
|
||||||
|
|
|
@ -514,8 +514,6 @@ export const useProcessAnimation = (
|
||||||
|
|
||||||
newTriggerCounts[triggerKey] = (newTriggerCounts[triggerKey] || 0) + 1;
|
newTriggerCounts[triggerKey] = (newTriggerCounts[triggerKey] || 0) + 1;
|
||||||
|
|
||||||
shouldLog = true;
|
|
||||||
|
|
||||||
newTriggerLogs.push({ timestamp: currentTime, pointId: point.uuid, objectId, triggerId: trigger.uuid, });
|
newTriggerLogs.push({ timestamp: currentTime, pointId: point.uuid, objectId, triggerId: trigger.uuid, });
|
||||||
|
|
||||||
const connections = point.connections?.targets || [];
|
const connections = point.connections?.targets || [];
|
||||||
|
@ -530,6 +528,8 @@ export const useProcessAnimation = (
|
||||||
uuid: connectedModelUUID,
|
uuid: connectedModelUUID,
|
||||||
triggerId: trigger.uuid,
|
triggerId: trigger.uuid,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
shouldLog = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue