• Thanks a lot, that really helps.

Just struggling to understand the best way to work an interrupt

• Can I set a distance at which the 2nd point is away from the 1st, say 300mm Z- and then use interrupt to stop motion.

Yes. Fubini's method is one way, though I should point out that as written it will move in the Z axis of the active Base. You would need to append #TOOL to the end of the motion command to move along the Tool Z axis.

The other method would be to calculate the endpoint and use a "normal" motion command, like so:

Code
``````DECL POS _EndPoint
...
_EndPoint = StartPoint : {X 0,Y 0,Z -300,A 0,B 0,C 0}
LIN _EndPoint``````

The Geometric Operator ':' basically performs a 6-DOF transform of one FRAME variable by another. Using it on POS or E6POS variables also works, as those variables implicitly include a "Frame" variable as part of their larger data set.

• Hi,

Can the velocity of this movement be changed then?

• Hi,

So I found this code below on this forum and I think it is along the lines of what I need. It was detailed that if I abort the movement and do different things. I should use this. I'm guessing is this case IRSTOP() is the interrupt program that runs when input is on.

1st point is PTP home (in my case this will be my 0 load position)

Movement() will be the subprogram that that moves robot down and turns interrupt on. Not sure about turning it off and when.

Let me know if im on the right track with this.

Thanks

• Hi ! The example you have is the right one.

For the interrupts, you need 3 programs.

A master that manages the loop and the declarations, the one that contains the movement to be interrupted, and a final one with the interrupt routine.

To vary the speed of the robot in real time, you can use an analog input or another digital input of KRC4 (if you have one) and modify \$ OV_PRO to slow down the robot when you approach the setpoint.

• I think this type of code will be work for another digital input.

Otherwise you can modify in "real time" the \$OV_PRO value by attaching it at \$ANIN value

• Hi,

Thanks a lot for that.

Is it possible to just slow down the below bit:

Lin_rel {z - 300} ; run 300 mm in negative z direction starting at the current position

• I think i never tryied interrupt a lin_rel motion.

But i think you can modify speed in the same way replacing lin XP1 by lin_rel{z - 300}

To modify speed you can decrease two variables :

\$OV_PRO : override programmed speed between 0 and 100 (%)

\$Vel.cp : programmed TCP speed between 0.00 and 2.00 (m/s)

• You can control the speed by setting \$VEL.CP (m/s). This value is retentive until another command changes it. You need to keep in mind that any Inline-Form LIN or CIRC motion command inherently changes \$VEL.CP.

Your ISR should always have INTERRUPT x OFF at the very beginning, to "debounce" the Interrupt.

Also, you're changing \$ADVANCE to 0, but never set it back to the previous value. Rather than changing ADVANCE, I would suggest setting a WAIT SEC 0 or similar to "break" the Advance Run Pointer at the end of the Movement() program. The key here is to ensure the ARP doesn't make it back to Test() before the interrupt fires.