Can I simulate inpos = 0?

Is there a way to simulate inpos=0 in robotstudio.
I was trying to create a Timeout if the robot hasn't reached \inpos, but I haven't found a way to simulate it properly.



  • Hi Jimli, 

    I replied to your other question before and mentioned using the simulator, I didn't realise you had asked this question too, whoops!

    Not sure how your movement commands are set up, but you could just use v5 for the speed instead of vmax or any custom move speeds.

    Alternatively, use the flexpendant interface to turn down the speed of the robot to 10% - I find if I go too low it causes Axis Moving Errors on my system. This is a safer option so you don't accidentally leave an incorrect speed somewhere and upload it to the robot. 

    Good Luck!

  • Hi,
    Thank you for your answers!

    I still haven't been able to get inpos = 0 in robotstudio, not even when going reeaally slow in the last movement (v5 AND speed at 5-15%). 
    But I will try a bit more.
    I think it's weird, because I can't even get it to 0 when the robot is in motion.


  • Hi Jimli,

    I'm surprised the robot hasn't triggered the timeout, could you post the code? 
    I just want to confirm the wait command is running in a background task? 
  • WaitUntil \Inpos, TRUE \MaxTime:=10 \TimeFlag:=bTimeout
          IF bTimeout THEN
               Set do29;
               TPReadFK reg5,"Roboten is not in position. Press OK to restart the program from Main","Cancel",strempty,strempty,strempty,OK;
               IF reg5 = 1 THEN 
               Reset do29;
               Set do32;

    This was the code I originally wanted to use, but later I just went with a simple IF inpos=0 THEN [stuff].
    And I still don't know if it'll trigger the time-out, since I haven't been able to simulate inpos=0  ;) 

  • I forgot to say - This is not in a Background task.
  • Hi Jimli, apologies for the delayed response, I'm guessing there is a movement command before the "WaitUntil" Command, please could you send through the code before this as well in case there is something stopping the code from reaching the 'WaitUntil" command altogether. The above code looks fine, but if the movement command before this has a "fine" point instead of a corner zone then this causes program execution to wait until the robot reaches the fine point and stops before continuing onto the next command. If there is a corner zone then program execution will continue past the movement command while the robot is still moving. Just a guess. Regards, Harry
  • The last Move-instruction before this code is in another routine, but has a "fine"-point.
    MoveAbsJ jHelpPos, v1000, fine, brush\WObj:=obDeckel;

    However, between that move-instruction and the "WaitUntil"-code, a hatch is being closed and a couple of communication signals are set and so on.
    The error we have experienced might be because the robot was set in manual between these two row of codes, and must have lost "inpos"-signal that way somehow.
    Originally the code was "Waittime \inpos 0.2;" and in that syntax, the timer won't start until inpos = 1, which resulted in that the robot "got stuck" on that line, without any alarm.


  • Forge_Engineering
    edited June 7
    Hi Jimli,

    You could try changing the "fine" to "z0" which means the robot has to reach exactly that point but lets execution continue. This would allow the program pointer to read ahead and do the communication and hatch closing while the robot is moving, but then hit the wait command and stop there. Using z0 will generate a warning about corners I think as it's trying to look for another move instruction but wont find one. This is ok and it will still move to the last point as a fine point and stop there anyway.

    Good Luck,

    Post edited by Forge_Engineering on
  • lemster68
    lemster68 ✭✭✭
    The special type, switch may (only) be assigned to optional parameters and provides a means to use switch arguments, i.e. arguments that are only specified by names (not values). A value can not be transmitted to a switch parameter. The only way to use a switch parameter is to check for its presence using the predefined function Present.
    I copied this here because the \InPos is an optional switch.  Some of the earlier code you posted also had TRUE following the \InPos switch.  As I see it, WaitUntil TRUE is always TRUE, the Opposite of WaitUntil FALSE, obviously.  So TRUE will never have to wait while FALSE will wait until infinity.  Try it.
    Lee Justice
  • Well Spotted. 
  • DenisFR
    DenisFR ✭✭✭
    Using all Waitxxx \InPos is not what you want as they will wait Robot in position before doing something...
    I think you should use Triggx movement with a first trigger who set a signal at movement start and a second who reset it at end.
    You can then use
    WaitUntil mysignal=high;//To be sure movement started
    WaitUntil mysignal=low\MaxTime:=10\TimeFlag:=bTimeOut;
  • These are all great input. Some are not applicable to the problem we've had...

    But the question kind of remains: I can't seem to simulate the signal inpos = 0 in Robotstudio. So I'm wondering if anyone has succeeded with that.
    I've tried Forge_Engineering's tip, to either lower the feed in the move-command and/or lower the override, a lot of times now, but inpos never falls to 0 in Robotstudio.

    I am for the moment running Robotstudio 2022.3.2 V22.3.101910.2, if that helps.
    I might soon upgrade to the 2023 edition though.
  • DenisFR
    DenisFR ✭✭✭
    \Inpos is a switch parameter, not a value. It indicates that the procedure have to wait the robot finish its movement before doing what it have to do.
    So WaitTime\Inpos,2; First wait robot in position then start counting.