I'm trying to set up an area ocupation function in order to comunicate with a PLC to ocupy a workspace, and I'm having trouble with the Advance.
The code:
GLOBAL DEF AREA_PETITION(AREA_Nr:IN)
INT AREA_Nr
CONTINUE
WAIT FOR $IN[AREA[AREA_Nr].I_ARLIB]
OCUPY_AREA(AREA_Nr)
END
AREA[AREA_Nr].I_ARLIB Translates to an INT from the .dat file
In OCUPY_AREA(AREA_Nr) there's a trigger, that part works like a charm.
The problem is that when the robot is comming to a point where it needs to wait for an area to be free and it's not, it will stop when the robot pointer reaches the wait instruccion even if before the robot arrives, the area is free and the wait finishes.
If the advance reaches the wait and it already is True, it will continue because of the "CONTINUE", but if the advance reaches the wait with the condition in false, then it becomes true, the advance seems to continue, but when the robot reaches the wait, it stops and starts again, like in a non CONT movement.
Is there a solution for this or am I doomed?
I can attach a video of a simulation showing the problem if needed.