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