I'm moving my robot over a curved path on a flat surface. This path is computer generated, and can have a lot of bends. As a result of this, it might encounter the software stop for axis 6 (it will, most of the time ). To counter this, i want to rotate my tool by 360 degrees when i see this happening. I cannot do this beforehand, as placement of the base can have an effect on where this might occur.
So what i've done is the following. (i'm on krc2 btw)
Interrupt decl 3 when $AXIS_ACT.A6 < -350 DO RotateLeft() ; When axis 6 rotates to its negative maximum, start sub routine RotateLeft
Interrupt decl 4 when $AXIS_ACT.A6 > 350 DO RotateRight() ; When axis 6 rotates to its positive maximum, start sub routine RotateRight
My main program looks a bit like this btw:
LIN {X 106.042, Y 0.0, Z 0.0, A 0.0, B 0.0, C 0.0}C_DIS
LIN {X 118.741, Y 0.0, Z 0.0, A 0.0, B 0.0, C 0.0}C_DIS
LIN {X 123.0, Y 0.0, Z 0.0, A 1.635, B 0.0, C 0.0}C_DIS
LIN {X 134.209, Y 0.32, Z 0.0, A 6.904, B 0.0, C 0.0}C_DIS
LIN {X 145.341, Y 1.668, Z 0.0, A 12.176, B 0.0, C 0.0}C_DIS
LIN {X 156.302, Y 4.033, Z 0.0, A 17.446, B 0.0, C 0.0}C_DIS
LIN {X 167.0, Y 7.395, Z 0.0, A 22.711, B 0.0, C 0.0}C_DIS
LIN {X 177.343, Y 11.724, Z 0.0, A 27.984, B 0.0, C 0.0}C_DIS
LIN {X 187.246, Y 16.986, Z 0.0, A 33.251, B 0.0, C 0.0}C_DIS
In the subroutine i do the following:
DEF RotateRight()
LIN_REL {Z 50}
LIN_REL {A -120}
LIN_REL {A -120}
LIN_REL {A -120}
LIN_REL {Z -50}
END
But now it needs to resume the normal program when done. And i can't get this to work. I've tried numerous combinations of brake and resume, but the robot wont budge. Stupidly, when i jst release the run button, clear the error and press the run button again, it resumes exactly as intended.
Does anybody know a workaround for this behavior? (i know i could just check the rotation of axis 6 after every movement, but i don't feel this is an elegant solution) Suggestions for a whole different approach are also welcome.