RobotStudio event

What is correct syntax for WaitUntil /inpos?

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.

Answers

  • Hi Gczerkawski, 

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

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

    WaitUntil \inpos, Cond;
    You could use this command as following to achieve the same functionality as WaitRob:

    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:

    WaitUntil \inpos, b_GripperClosed = TRUE;
    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


  • Thank you!
  • I'll hijack this thread with a follow up question:
    If I write the code as:
    WaitUntil \inpos, TRUE \Maxtime=2 \Timeflag:=bTimeout; 
    Will the timer start if inpos=0 or will it wait indefinitly?

  • Hello! I'll just hijack this thread with a follow up question:
    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


  • 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