Hello,
I’m a student who currently works his way into Robotstudio. After many problems I have finally found one which I was not able to solve through research. So I beg for help ![]()
I tried to use a custom signal which I created on the Virtual Flex Pendant to check in my Rapid Code if the robot nears a Collision Set. On the Virtual Flex Pendant I created a new Unit for the signal and defined it as output and to start with low. Then I used the Event Manager to define the output of the signal as high, if a Collision Set is neared.
If I used the following piece of code after a move-instruction (doMotSupOn is the name of the custom signal) it sometimes worked after a while, but some other times it did nothing:
IF Doutput(doMotSupOn) = 1 THEN
TPWrite "Works";
ENDIF
When i did it with interrupts, nothing happened. I tried it similar to the code example that got posted here:
VAR intnum testint;
TRAP CollisionTrap
!Reset doMotSupOn;
TPWrite "Interrupt";
IDelete testint;
!ExitCycle;
ENDTRAP
PROC InitCollision()
!Reset doMotSupOn;
IDelete testint;
CONNECT testint WITH CollisionTrap;
ISignalDO doMotSupOn, 1, testint;
ENDPROC
I don’t understand where my mistake is. The signal must have been set to high sometimes or else it wouldn’t have entered the if-clause in the first example, right? Or is my approach just totally wrong it doesn’t work without the option Collision Detection installed on the robot?
Regards,
Tim