The problem is simple: the "head" of the robot moves along the main trajectory. And it has two sensors.
Interrupt 5 is called when the first sensor is triggered and let the robot simply memorize the current value of $ POS_ACT in currentXYZ (E6POS).
And "head" begins to move along additional trajectory.
Interrupt 4 is activated when the second sensor is triggered, which simply should "cancel" the execution of the current additional trajectory and return the head to PTP currentXYZ, exit interrupt 4 and then immediately from 5 and continue the main trajectory.
But I can't even store coordinates in currentXYZ = $ POS_ACT - I get error. Something like "you can't save runtime data in the main program".
The code - I threw out everything that does not belong to the problem.
===
&ACCESS RV
DEF b01( )
E6POS currentXYZ;
;FOLD INI
;FOLD BASISTECH INI
GLOBAL INTERRUPT DECL 5 WHEN $MEAS_PULSE[3]==TRUE DO found()
INTERRUPT ON 5
GLOBAL INTERRUPT DECL 4 WHEN $MEAS_PULSE[1]==TRUE DO stop_heat()
INTERRUPT ON 4
BAS ( #INITMOV,0 )
;ENDFOLD (BASISTECH INI)
;FOLD USER INI
;ENDFOLD (USER INI)
;ENDFOLD (INI)
$BASE = $NULLFRAME;
$TOOL = $NULLFRAME;
$IPO_MODE = #BASE;
$OV_PRO=100
LOOP
PTP {A1 0, A2 -90, A3 90, A4 90, A5 0, A6 0}
LIN_REL {Z -2000}; main trajectory
LIN_REL {Z 2000}
ENDLOOP
END
def found()
BRAKE F
INTERRUPT OFF 5 ; founded - 1st trigger is ON
INTERRUPT ON 4 ; closeup check on - activate INT for 2nd trigger
currentXYZ = $POS_ACT
PTP_REL {X 200}; added trajectory
INTERRUPT OFF 4
INTERRUPT ON 5
end
def stop_heat()
BRAKE F
PTP currentXYZ
end
===
Whatz wrong?