# TRAP routine start is delayed

**URL:** <https://tech-community.robotics.abb.com/t/trap-routine-start-is-delayed/9019>\
**Category:** RAPID Programming\
**Created:** [August 8, 2019, 10:38am UTC](https://tech-community.robotics.abb.com/t/trap-routine-start-is-delayed/9019 "2019-08-08T10:38:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![egor](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/egor/32/2735_2.png) [@egor](https://tech-community.robotics.abb.com/u/egor)\
**Post date:** [August 8, 2019, 10:38am UTC](https://tech-community.robotics.abb.com/t/trap-routine-start-is-delayed/9019/1 "2019-08-08T10:38:41Z")

</div>

Hi, I want the TRAP routine to start right after TriggL instruction. But I don’t want to change z50 to fine or use Waittime instruction.  
Is it possible to do something?

…

TriggCheckIO Trig\_Vac1\_Check,0,di\_Vac1\_1,EQ,1\StopMove,VacInterrupt;  
TriggL pAboveConv,v300,Trig\_Vac1\_Check,z50,VacuumGrip;

_!TRAP routine must start here!_  
IF bricks\_in\_frame=1 OR THEN  
DropWObj wobj\_cnv1;  
TPWrite “Rob1 dropped wobj”;  
ENDIF

IF Rob1\_Pick\_Int=FALSE THEN

_!TRAP routine starting here in fact!_  
WaitSyncTask\InPos,Rob1\_Ready,task\_list;  
TPWrite “ROB1 WaitSyncTask”;  
ENDIF

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [August 8, 2019, 11:58am UTC](https://tech-community.robotics.abb.com/t/trap-routine-start-is-delayed/9019/2 "2019-08-08T11:58:59Z")

</div>

IF bricks\_in\_frame=1 OR THEN  
DropWObj wobj\_cnv1;  
TPWrite “Rob1 dropped wobj”;  
ENDIF

OR what? This seems incomplete.

---

<div class="post-metadata">

**Author:** ![egor](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/egor/32/2735_2.png) [@egor](https://tech-community.robotics.abb.com/u/egor)\
**Post date:** [August 8, 2019, 12:05pm UTC](https://tech-community.robotics.abb.com/t/trap-routine-start-is-delayed/9019/3 "2019-08-08T12:05:14Z")

</div>

> [@lemster68](#):
>
> IF bricks\_in\_frame=1 OR THEN  
> DropWObj wobj\_cnv1;  
> TPWrite “Rob1 dropped wobj”;  
> ENDIF
> 
> OR what? This seems incomplete.

I just deleted all unnecessary fragments of code to make it more readable. There was another condition. I forgot to delete “OR”…

---

<div class="post-metadata">

**Author:** ![SomeTekk](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/sometekk/32/151_2.png) [@SomeTekk](https://tech-community.robotics.abb.com/u/SomeTekk)\
**Post date:** [August 8, 2019, 1:45pm UTC](https://tech-community.robotics.abb.com/t/trap-routine-start-is-delayed/9019/4 "2019-08-08T13:45:31Z")

</div>

Check out ISignalDO in the RAPID instruction manual.  
…

**CONNECT sig1int WITH iroutine1;**  
**ISignalDO do\_ForceTrap, 1, sig1int;**

IF Rob1\_Pick\_Int=FALSE THEN  
_!TRAP routine starting here in fact!_

**Set do\_ForceTrap**  
WaitSyncTask\InPos,Rob1\_Ready,task\_list;  
TPWrite “ROB1 WaitSyncTask”;  
ENDIF

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [August 8, 2019, 1:48pm UTC](https://tech-community.robotics.abb.com/t/trap-routine-start-is-delayed/9019/5 "2019-08-08T13:48:14Z")

</div>

So the reason why I asked is this: put a WaitUntil condition 1 OR condition 2 OR condition 3 first.

---

<div class="post-metadata">

**Author:** ![SomeTekk](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/sometekk/32/151_2.png) [@SomeTekk](https://tech-community.robotics.abb.com/u/SomeTekk)\
**Post date:** [August 8, 2019, 3:55pm UTC](https://tech-community.robotics.abb.com/t/trap-routine-start-is-delayed/9019/6 "2019-08-08T15:55:01Z")

</div>

I need to review MORE closely (especially cutting and pasting) before posting and heading away.

Trying again. 😑

**PROC InitTrap()**  
**IDelete sig1int;**  
**CONNECT sig1int WITH iroutine1;**  
**ISignalDO do\_ForceTrap, 1, sig1int;**  
**ENDPROC**

+++++++++++++++++++++++++++++++++++++++++  
…

**InitTrap;**

…

**!TRAP routine must start here!**  
**Set do\_ForceTrap;**

IF bricks\_in\_frame=1 OR THEN  
DropWObj wobj\_cnv1;  
TPWrite “Rob1 dropped wobj”;  
ENDIF

IF Rob1\_Pick\_Int=FALSE THEN

_!TRAP routine starting here in fact!_  
WaitSyncTask\InPos,Rob1\_Ready,task\_list;  
TPWrite “ROB1 WaitSyncTask”;  
ENDIF

---

<div class="post-metadata">

**Author:** ![egor](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/egor/32/2735_2.png) [@egor](https://tech-community.robotics.abb.com/u/egor)\
**Post date:** [August 9, 2019, 6:24am UTC](https://tech-community.robotics.abb.com/t/trap-routine-start-is-delayed/9019/7 "2019-08-09T06:24:08Z")

</div>

SomeTekk, thanks for you advice! I found my own way, using second trigger \<Trig\_Pos\_Reached\>, which is checked position. If position has not been reached, the program pointer doesn’t move further:

IDelete VacInt;  
CONNECT VacInt WITH TrapPick;  
…  
!Turning on vacuum before pick position  
TriggIO Trig\_Vac\_ON,0\Start\DOp:=do\_Valve\_Rob1\_1\_on,1;  
TriggL RelTool(RelTool(Offs(pPick,x\_brick+26,y\_brick,z\_brick),0,0,0\Rz:=rot\_z\_brick+flip\_rot\_R1),0,0,0\Rx:=tilt\_x\_brick\Ry:=tilt\_y\_brick),  
v100,Trig\_Vac\_ON,z0\Inpos:=fllwtime0\_5,VacuumGrip\WObj:=wobj\_cnv1;  
!Pick position  
MoveL RelTool(RelTool(Offs(pPick,x\_brick+26,y\_brick,z\_brick+50),0,0,0\Rz:=rot\_z\_brick+flip\_rot\_R1),0,0,0\Rx:=tilt\_x\_brick\Ry:=tilt\_y\_brick),  
v150,z10,VacuumGrip\WObj:=wobj\_cnv1;  
!Check vacuum  
TriggCheckIO Trig\_Vac\_Check,0,di\_Vac1\_1,EQ,1\StopMove,VacInt;  
!The signal \<do\_PosReached\> is set to 1 when point “pAboveConv” is reached  
TriggIO Trig\_Pos\_Reached,0\DOp:=do\_PosReached,1;  
TriggL pAboveConv,v300,Trig\_Vac\_Check\T2:=Trig\_Pos\_Reached,z50,VacuumGrip;  
!If do\_PosReached = 0 it is mean that TRAP routine will run.  
WaitDO do\_PosReached,1;  
SetDO do\_PosReached,0;

!TRAP routine is running here

IF Rob1\_PickInt=FALSE THEN  
IF bricks\_in\_frame=1 THEN  
DropWObj wobj\_cnv1;  
TPWrite “Rob1 dropped wobj”;  
ENDIF

WaitSyncTask\InPos,Rob1\_Ready,task\_list;  
TPWrite “ROB1 WaitSyncTask”;  
ENDIF
