Avoiding temporary world zones reset.

Hello,
I am in a situation that I have to set up and free different temporary world zones dynamically.
I am encountering a problem that the temporary world zones are automatically erased after pptomain or pp leaves the routine where the world zones are set.
Is there a method that can keep those temporary world zones activated until they are freed?
Thanks

Why not use stationary then?

You can enable and disable from a background task – might help with having more control – mentioned in the Rapid manual under wztemporary.

Hi @lemster68
Thank you for your suggestion. However, I need to free and reactivate world zones when needed, but I can not free a stationary one. Is there way I can modify a stationary wz after it is activated?

Hi, @soup
Thank you for your suggestion.
I forgot to mention that the reason I need to activate and deactivate world zones because the maximum number of world zones is 20 and I need more.
So I have to modify and redefine and them according to TCP.

If anyone knows a way to detect pptomain event, I can then call my redefine procedure to solve this problem.

If you use a WHILE loop in the main routine you can call your world zone routine above this - thus only run when PP to main.

Thank you @graemepaulin,
That will work nicely when I run the program, but if the operator pressed pp to main without running the program, and then use jogging mode, the world zones are not activated, so there comes the risk.

So if program is not running and PP to main pressed the world zones are still reset?

@graemepaulin
Yep, It happens to me, at least on a virtual robot. I have not tried it on a real robot yet. My Robotstudio version is 6.08.

@graemepaulin

Yes, it is documented that this will occur. I think that I remember you addressing the number of WZ’s before with someone else. Despite the documentation saying 20, it is actually 40?

One other thing that you can try is the function IsStopStateEvent(\PPToMain), if you have not already come across that one yet.

Something to test: if you WZEnable from the background task, does PPtoMain in the motion task reset the zones?

@lemster68 That’s a good thought, but wouldn’t protect on a PPtoMain then a manual jog.

@soup @lemster68
Thank you guys.
I had tried setting up more than 20 world zones. And the program stopped on the 21st one.
I will take WZEnable from the background task as a final try I guess

And, even if PPtoMain in the motion task does reset the zones which were enabled in the background task, you could keep track of which zones should be enabled with a shared PERS bool or signal and quickly re-enable them after the PPtoMain.

I still don’t know why you need so many world zones, but maybe this can help you out. You can call these functions as needed to check temp wz’s in given positions.

MODULE WZ_Check
LOCAL PERS tooldata tool2:=[TRUE,[[0,270,186.3],[0,0,0,1]],[20,[1.3,38.9,92.4],[1,0,0,0],0,0,0.777]];
LOCAL PERS wobjdata wobj1:=[FALSE,TRUE,“”,[[0,0,0],[1,0,0,0]],[[0,0,0],[1,0,0,0]]];
LOCAL VAR shapedata shCheck;
LOCAL VAR wztemporary wzTempCheck;
PERS num nCylRadius:=50;
PERS num nCylHeight:=150;
PERS pos posBox1C1:=[1299,-110,1350];
PERS pos posBox1C2:=[1299,-110,1350];
PERS pos posCyl1:=[1299,-110,1350];

! This function will return a TRUE value if the robot TCP is
! inside a temporary world zone box.
FUNC bool fCheckBoxWZ(pos posLow, pos posHigh, tooldata tCheck \wobjdata wobjCheckWZBox)
VAR robtarget pCheckPos;

tool2 := tCheck;
IF Present(wobjCheckWZBox) THEN
wobj1 := wobjCheckWZBox;
ELSE
wobj1 := wobj0;
ENDIF
WZBoxDef \Inside, shCheck, posLow, posHigh;
WZFree wzTempCheck;
WZDoSet \Temp, wzTempCheck \Inside, shCheck, vdoTempPos1, high;
! Make pCheckPos equal to where the robot is at the moment.
pCheckPos := CRobT(\Tool:=tool2\WObj:=wobj1);
! Move robot to where it already is to make the necessary TCP active
MoveJ pCheckPos, v500, fine, tool2\WObj:=wobj1;
IF DOutput(vdoTempPos1) = 1 THEN
RETURN TRUE;
ELSE
RETURN FALSE;
ENDIF
ENDFUNC

! This function will return a TRUE value if the robot TCP is
! inside a temporary world zone cylinder.
FUNC bool fCheckCylWZ(pos posOrigin, num nRadius, num nHeight, tooldata tCheck \wobjdata wobjCheckWZBox)
VAR robtarget pCheckPos;

tool2 := tCheck;
IF Present(wobjCheckWZBox) THEN
wobj1 := wobjCheckWZBox;
ELSE
wobj1 := wobj0;
ENDIF
WZCylDef \Inside, shCheck, posOrigin, nRadius, nHeight;
WZFree wzTempCheck;
WZDoSet \Temp, wzTempCheck \Inside, shCheck, vdoTempPos1, high;
! Make pCheckPos equal to where the robot is at the moment.
pCheckPos := CRobT(\Tool:=tool2\WObj:=wobj1);
! Move robot to where it already is to make the necessary TCP active
MoveJ pCheckPos, v500, fine, tool2\WObj:=wobj1;
IF DOutput(vdoTempPos1) = 1 THEN
RETURN TRUE;
ELSE
RETURN FALSE;
ENDIF
ENDFUNC
ENDMODULE

Thank you very much. @soup @lemster68
The reason I need this is that my project is like carrying books into a grid like shelf. The project requires unprofessional operators to jog the robot.
And the ABB robot(760) is a four axis robot which does not support collision avoidance. So, I was trying to set up world zones only that are close to TCP.

This is maybe a bit off topic, but: How can you avoid the reset of a stationary worldzone signal after a restart? Cross connect?

@EricH
I use a PowerON event routine to set up my stationary worldzones, so the stationary worldzones are active all the time.