# What is correct syntax for WaitUntil /inpos?

**URL:** <https://tech-community.robotics.abb.com/t/what-is-correct-syntax-for-waituntil-inpos/10714>\
**Category:** RAPID Programming\
**Created:** [April 28, 2022, 11:54pm UTC](https://tech-community.robotics.abb.com/t/what-is-correct-syntax-for-waituntil-inpos/10714 "2022-04-28T23:54:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gczerkawski](https://avatars.discourse-cdn.com/v4/letter/g/d26b3c/32.png) [@gczerkawski](https://tech-community.robotics.abb.com/u/gczerkawski)\
**Post date:** [April 28, 2022, 11:54pm UTC](https://tech-community.robotics.abb.com/t/what-is-correct-syntax-for-waituntil-inpos/10714/1 "2022-04-28T23:54:20Z")

</div>

I cannot get this syntax correct? I want to wait until the robot stops moving after getting to a position. Or waiting for the gripper to close.

---

<div class="post-metadata">

**Author:** ![Forge\_Engineering](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/forge_engineering/32/4455_2.png) [@Forge\_Engineering](https://tech-community.robotics.abb.com/u/Forge_Engineering)\
**Post date:** [April 29, 2022, 3:24am UTC](https://tech-community.robotics.abb.com/t/what-is-correct-syntax-for-waituntil-inpos/10714/2 "2022-04-29T03:24:26Z")

</div>

Hi Gczerkawski,

You Can use WaitRob to wait until the robot is in position, with

```auto
WaitRob \InPos;

```

If you use WaitUntil you must provide a True/False condition,

```auto
WaitUntil \inpos, Cond;

```

You could use this command as following to achieve the same functionality as WaitRob:

```auto
WaitUntil \inpos, TRUE;

```

This will wait until the robot is in position, and check the Cond Boolean which is just set to TRUE, so it will continue.

If you wanted to wait for a gripper as well as the robot being stopped then you would need a Boolean condition or digital input telling you when the gripper is closed, either one:

```auto
WaitUntil \inpos, b_GripperClosed = TRUE;

```

```auto
WaitUntil \inpos, diGripperClosed = 1;

```

It depends how you have your system set up.

These funcions are well documented in the ‘RAPID Instructions, Functions and Data Types (IRC5)’ Help available through File → Help → IRC5 Documentation → RAPID in RobotStudio.

Good Luck,

Harry

---

<div class="post-metadata">

**Author:** ![gczerkawski](https://avatars.discourse-cdn.com/v4/letter/g/d26b3c/32.png) [@gczerkawski](https://tech-community.robotics.abb.com/u/gczerkawski)\
**Post date:** [April 29, 2022, 3:20pm UTC](https://tech-community.robotics.abb.com/t/what-is-correct-syntax-for-waituntil-inpos/10714/3 "2022-04-29T15:20:59Z")

</div>

Thank you!

---

<div class="post-metadata">

**Author:** ![Jimli](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@Jimli](https://tech-community.robotics.abb.com/u/Jimli)\
**Post date:** [May 11, 2023, 5:23pm UTC](https://tech-community.robotics.abb.com/t/what-is-correct-syntax-for-waituntil-inpos/10714/4 "2023-05-11T17:23:10Z")

</div>

I’ll hijack this thread with a follow up question:  
If I write the code as:

```auto
WaitUntil \inpos, TRUE \Maxtime=2 \Timeflag:=bTimeout; 

```

Will the timer start if inpos=0 or will it wait indefinitly?

---

<div class="post-metadata">

**Author:** ![Jimli](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@Jimli](https://tech-community.robotics.abb.com/u/Jimli)\
**Post date:** [May 11, 2023, 5:23pm UTC](https://tech-community.robotics.abb.com/t/what-is-correct-syntax-for-waituntil-inpos/10714/5 "2023-05-11T17:23:10Z")

</div>

Hello! I’ll just hijack this thread with a follow up question:

```auto
WaitUntil \inpos, TRUE \Maxtime=2 \Timeflag:=bTimeout; 

```

If i write like this, will the timer start if inpos = 0 or will it wait until end of times?

Thanks

---

<div class="post-metadata">

**Author:** ![Forge\_Engineering](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/forge_engineering/32/4455_2.png) [@Forge\_Engineering](https://tech-community.robotics.abb.com/u/Forge_Engineering)\
**Post date:** [May 11, 2023, 10:06pm UTC](https://tech-community.robotics.abb.com/t/what-is-correct-syntax-for-waituntil-inpos/10714/6 "2023-05-11T22:06:59Z")

</div>

Hi Jimli,

It should wait until either - the robot is in position, OR, 2 seconds has passed, then it will continue. It will not wait indefinitely, unless you haven’t provided a timeout and the robot is not in position and not moving to its position.

If 2 seconds passes and the robot is not in position, it will set bTimeout to TRUE and continue. Note that if you hadn’t provided a Timeflag argument then if the timer expired it would throw an error instead.

You can always test it in your simulator!

Regards,  
Harry
