RobotStudio event

Synchronization of RAPID and RAB

Options
Hi!

I tried to synchronize the PC-SDK with RAPID using a digital-output-signal which is set at the end of a movement by RAPID and reset by my C#-program. RAPID-program waits until it is reset.

From time to time it can happen that the same movement can be scheduled twice. I thought this should be no problem because of the wait-task in RAPID. But it seems the next job is fulfilled without awaiting the signal-reset from C#.

This has two negative effects: The C#-program cannot recognize both movements and the RAPID-program awaits the second resetting of the signal which never occours.

Example:
RAPID: do something + Signal=1 => C#: Wait for "1" then Signal=0 => RAPID: Wait for "0" then do something

RAPID: do something + Signal=1 => C#: Wait for "1" then Signal=0 => RAPID: Wait for "0" then do same again + Signal=1 (not set again, therefore not reset by C# and RAPID waits forever)

Any hints how to solve this or is this idea of synchronization completely stupid?

Comments

  • Ingela
    Options

    Hello,


    First of all, if you use a MoveX instruction with zone and not a  fine point, this will not work. With a fine point it might work from RAPID perspective.
    When using zones, the MoveX instruction is finished before the movement is finished, as the task will try to get next movement instruction about 200 ms before the robot is in the programmed ToPoint. You will have a signal set to 1 before the movement is finished. When  running a couple of MoveX instructions, you can see that the ProgramPointer sometimes is one step before the the MotionPointer. The reason for this is the prefetch that is done to get next instruction when using zones.
    If using RAPID TriggX instructions you can order a signal to be set at the ToPoint. That is better.
    Also, I suppose "wait-task" means WaitDO?  (Before RW 5.10 there was a bug in several WaitX instructions, which appeared in manual mode when waiting for more than 3 seconds, the instruction could then continue, but the signal was not set to the value that you expected. )
    Best regards,

    Ingela Brorsson
    Software Engineer
    ABB Robotics, Sweden
  • MaWi81
    Options
    Hi!

    Thanks for the reply. I use RW 5.10. and have tried the TriggX but it shows the same effect as MoveJDO.

    Please have a look at the code segment. The system should support something like this, hold and wait twice.
    [code]VAR triggdata synchronizer;

    TriggIO synchronizer, 0 DOp:=SYNC_OUT, 1;

    TriggJ pos1, v500, synchronizer, z200, ToolCurrent;
    WaitDO SYNC_OUT, 0;

    (movement dependent on some variables - can also be "no movement")

    TriggJ pos1, v500, synchronizer, z200, ToolCurrent;
    WaitDO SYNC_OUT, 0;
    [/code]
    C# has to know whenever the robot reaches the position pos1 and stop there in order to set jobs as completed and plan next steps.
  • Ingela
    Options

    Ok,

    ! the signal will not be set to 1 until the robot has completed the movement in the instruction
    TriggIO synchronizer, 0 DOp:=SYNC_OUT, 1;

    !using zones (z200) a prefetch of the next instruction is done about 200 ms before the robot has finished the movement, as the robot must know where to go next to be able to perform "zone"). 

    TriggJ pos1, v500, synchronizer, z200, ToolCurrent;

    !The prefetch of the instruction WaitDO SYNC_OUT, 0; is thus made about 200 ms BEFORE RAPID has set the signal to 1.

    !The signal is already 0, nothing to wait for

    WaitDO SYNC_OUT, 0;

    So, your logics doesn't work. Maybe something like this would work:

    VAR triggdata synchronizer;

    TriggIO synchronizer, 0 DOp:=SYNC_OUT, 1;

    TriggJ pos1, v500, synchronizer, z200, ToolCurrent;
    ! Wait until pos1 is reached (the signal will be set to 1 by RAPID when reaching the movement is completed)
    WaitDO SYNC_OUT, 1;
    ! Now, wait until the signal is set by PC application
    WaitDO SYNC_OUT, 0;

    NOTE:
    1) When using zones instead of finepoints, the instruction is finished before the ToPoint is reached.
    2) You will have a warning, Corner path failure, because the fetch of next movement instruction  is always set on hold by the WaitDO instructions. The result will be a fine point even though Zone is programmed. Consider whether zones are necessary.

    I hope you will find a solution.

    Best regards,

    Ingela Brorsson
    Software Engineer
    ABB Robotics, Sweden
  • MaWi81
    Options
    Now I understand what is wrong in my program. I did not realize the WaitDO-commands are also started 200ms before finishing the recent command.

    Thank you for your advice!