Hi everyone!
I’m new in the forum and need some help.
Actually i’m programming two robots with World Zones, both robots share two cubes that i define with the following program:
VAR wzstationary Z1_AfterVision;
VAR wzstationary Z2_BeforeVision;
PROC rPowerOnWZ()
!data for WZ
VAR shapedata volumeZ1_AfterV;
VAR shapedata volumeZ2_BeforeV;
!cube corners
CONST pos C1Z1:=[1050,-770,571];
CONST pos C2Z1:=[2900,-3270,1700];
CONST pos C1Z2:=[-1050,-770,571];
CONST pos C2Z2:=[-2900,-3270,1700];
!wz definition
WZBoxDef Inside,volumeZ1_AfterV,C1Z1,C2Z1;
WZBoxDef Inside,volumeZ2_BeforeV,C1Z2,C2Z2;
!wz do activated when inside
WZDoSet Stat,Z1_AfterVision,Inside,volumeZ1_AfterV,do_wzAfterV_Free,0;
WZDoSet Stat,Z2_BeforeVision,Inside,volumeZ2_BeforeV,do_wzBeforeV_Free,0;
RETURN;
ENDPROC
is all correct, when the robots come into de zone the DO will set in 0, but also I want to lock that zone when one robot is inside, the other must wait to entry, i tryed with that code:
proc wz_supervision()
!data for WZ
VAR shapedata volZ1_AfterV;
VAR shapedata volZ2_BeforeV;
!cube corners
CONST pos C1Z1:=[1050,-770,571];
CONST pos C2Z1:=[2900,-3270,1700];
CONST pos C1Z2:=[-1050,-770,571];
CONST pos C2Z2:=[-2900,-3270,1700];
!wz definition
WZBoxDef Inside,volZ1_AfterV,C1Z1,C2Z1;
WZBoxDef Inside,volZ2_BeforeV,C1Z2,C2Z2;
WzFree Z1_AfterVision_sup;
WzFree Z2_BeforeVision_sup;
WZLimSup Temp,Z1_AfterVision_sup,volZ1_AfterV;
WZLimSup Temp,Z2_BeforeVision_sup,volZ2_BeforeV;
WzDisable Z1_AfterVision_sup;
WzDisable Z2_BeforeVision_sup;
if di_wzAfterV_Free=0 then
WZEnable Z1_AfterVision_sup;
elseif di_wzBeforeV_Free=0 then
WZEnable Z1_BeforeVision_sup;
else
endif
RETURN;
endproc
is correct or i’m doing someting strange?A? to resume i need to lock a zone while R1 is inside and R2 will come when the zone is free.
thanks!!