# variable tracking while the robot is moving, without stopping

• in the for loop, linear movement is performed so that it does not stop at every point of the loop, but continues with C_DIS :

Code
``````FOR _Index = 1 TO PointsNo
LIN FrameArr_01[_Index] C_DIS
ENDFOR``````

Is it possible to use an interrupt or some other method to monitor the value of the input, without stopping the robot, and without losing continuity?

It is only necessary to monitor if there is a change in the input in order to use that information later

• ## Lemster68Feb 22nd 2023

• You could use an Trigger with a UP Call for this if its only this single motion command und you want to evaluate at a specific point on the track. If its more global an Interrupt is also possible. As long as you do not stop the robot (using the BRAKE command inside the interrupt) it will not stop.

Fubini

• The simplistic way would be:

Code
``````FOR _Index = 1 TO PointsNo
LIN FrameArr_01[_Index] C_DIS
CONTINUE
IF \$IN[1] THEN
EXIT ; exit the FOR loop
ENDIF
ENDFOR``````

The CONTINUE command prevents the very next line, and only that line, from breaking the Advance Run Pointer. This allows the continuous C_DIS motion without interruption.

However, the CONTINUE command has side effects. In this example, if \$IN[1] became True while _Index was 5, the loop would continue running until _Index reached a value of 5+\$ADVANCE. Since \$ADVANCE is usually 3 by default, this would mean that the loop would always make 3 more motions after \$IN became True before the loop would exit. So the loop would continue to _Index=8 before exiting.

This is because the Advance Run Pointer pre-loads the next several motions (set by \$ADVANCE) into the motion planner, along with any non-motion code between those motions. In a loop like this, if the Main Run Pointer were executing the move for _Index=5, the ARP would already be _Index=8, and the \$IN evaluation would take place in the Advance Run, not the Main Run.

This can be tweaked slightly by changing \$ADVANCE to a smaller value, but setting \$ADVANCE=0 would have the same effect as removing C_DIS from the LIN command. So you would have to keep \$ADVANCE at 1 or higher to achieve smooth motion.

If this is not workable, you can use an Interrupt as Fubini suggested, but you would probably need to place the FOR loop into its own subroutine, so that the BRAKE and RESUME commands in the Interrupt routine would terminate the entire FOR loop.

• is it possible to use this program but without EXIT because I don't want to stop the movement, let's say just set the value errorNo=100

Code
``````FOR _Index = 1 TO PointsNo
LIN FrameArr_01[_Index] C_DIS
CONTINUE
IF \$IN[1] THEN
errorNo=100 ;
ENDIF
ENDFOR``````

Thank you all

• is it possible to use this program but without EXIT because I don't want to stop the movement, let's say just set the value errorNo=100

Yes, with the timing caveats I mentioned. This is partly why the use of the CONTINUE command is discouraged except in very specific situations.

If you don't need to set the error number precisely at a specific point in the loop, then the code you posted should work fine.

If you needed more precise timing, you could use an Interrupt or even a Trigger:

Inside Trigger subroutines is one of those situations where the CONTINUE command is most often used, b/c keeping them inside a Trigger routine prevents the potentially negative side effects I mentioned earlier.

• you did not state which variable you want to track. but if you want value of something saved while robot program is running you have options. for example you can use submit interpreter. and yes you can use an interrupt.

but suppose you want to save things every time event occurs (button is pressed), you may want to declare variables that can be used to store info. for example

in \$CONFIG.DAT:

Code
``````SIGNAL PbSaveVariable \$IN[666] ; specify input
DECL BOOL PbSaveVariableOld = FALSE
DECL INT SaveButtonPressCount = 0
DECL E6AXIS SavedJointPosition = {E1 0}
DECL E6POS SavedCartesianPosition = {E1 0}
DECL DATE SaveDate = ``````

and in SPS.SUB

2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly