Lin_rel {z - 300} ; run 300 mm in negative z direction starting at the current position
Fubini
Lin_rel {z - 300} ; run 300 mm in negative z direction starting at the current position
Fubini
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:
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
DEF test ()
INI
INTERRUPT DECL 10 WHEN $IN[16] == TRUE DO IRSTOP ( )
PTP HOME
Movement()
; After interrupt and "resume" program continues here
$ADVANCE=3
PTP HOME
END
DEF movement()
$ADVANCE = 0 ; this is not necessary if a wait sec 0.1
; at the end of movement()
INTERRUPT ON 10
PTP P1 ; C_DIS has no effect here because $advance is 0
PTP P2
INTERRUPT OFF 10
END
DEF IRSTOP ( )
BRAKE
WAIT FOR IN (15 )
WAIT Time 0.2 sec
RESUME
END
Display More
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
DEF Main()
INI
INTERRUPT DECL 10 WHEN $IN[15] == TRUE DO SLOWDOWN ( ) ; Trigger at 60% of desired force value
INTERRUPT DECL 20 WHEN $IN[16] == TRUE DO STOP ( ) ; Trigger at 95% of desired force value
For i = 1 TO 50 000
PTP HOME
Move_Fast() ; After interrupt 10 and "resume" program continues here
Move_Slow() ; After interrupt 20 and "resume" program continues here
$ADVANCE=3
ENDFOR
END
DEF Move_Fast()
$ADVANCE = 0
$OV_PRO=100 ; full speed
INTERRUPT ON 10
LIN P1 ; C_DIS has no effect here because $advance is 0
INTERRUPT OFF 10
END
DEF Move_Slow() ; Same program but slow
$ADVANCE = 0
$OV_PRO=10 ; 10% of full programmed speed
INTERRUPT ON 20
LIN P1 ; C_DIS has no effect here because $advance is 0
INTERRUPT OFF 20
END
DEF STOP()
BRAKE ; OR BRAKE_F
WAIT Time 0.2 sec
RESUME
END
DEF SLOWDOWN()
BRAKE ; Or maybe not
$OV_PRO=10
RESUME
END
Display More
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.
You need to be a member in order to leave a comment