RobotStudio event

about TRAP rountine

Options
Dear All,



I got a new problem when developing a PC RAB application. However, it is more related to Rapid programming. I don't know where I can post the problem so I post it here in case anyone can help.

We want to
write a "pose" data to the controller. The Rapid program on the
controller processes it when it receives the data (we use a TRAP
function to response data receiving). But it looks that the TRAP
function is not invoked. My simple Rapid code is as follows:

=============================

MODULE test



PERS pose nPose;

VAR intnum poseChanged;



PROC main()

       CONNECT poseChanged WITH processor;

       IPers nPose, poseChanged;

ENDPROC



TRAP processor

       !processing code

ENDTRAP



ENDMODULE

=============================



Can anyone help me on this issue? Many thanks.

Comments

  • RussD
    Options
    This question would be more appropriate for the General section of the forum.

     

    Try something like this, which will stay in a loop and allow you to execute the interrupt repeatedly. Probably what was happening was you would execute the code once and it would stop, which would delete the interrupt due to the program stop. You also need to call IDelete on each interrupt before you add it again, that may have given you problems as well. Finally, be careful using reserved words like TEST for module names, if you had the RAPID instruction TEST in your module it would report syntax errors.

    MODULE myTestMod

    PERS pose nPose;
    VAR intnum poseChanged;

    PROC main()

        DeleteTrap;

        AddTrap;

        WHILE TRUE DO

            WaitTime 1;

        ENDWHILE
    ENDPROC

    PROC DeleteTrap()

        IDelete poseChanged;

    ENDPROC

    PROC AddTrap()

        CONNECT poseChanged WITH processor;
        IPers nPose, poseChanged;
    ENDPROC

    TRAP processor
        !processing code
    ENDTRAP

    ENDMODULE

    Russell Drown
  • newform
    Options
    Dear Russell,

    Thanks again for your help.

    Just as you pointed out, my previous main function just run once and stops. Then it won't accept any interrupt.

    For test purpose, I sent the same pose data to the Rapid program. As there is no value change of the pose data, the TRAP function will not be invoked too This is another problem why TRAP function is not invoked.

    Thanks a lot for the information provided and time you spent. Really appreciate that.

  • newform
    Options
    Dear Russell,

    Now the trap function can be invoked. But there is another headache.

    We send data to Rapid program to process. After we get the processed result, we send a new data. It is a loop. But RAB PC program will stop after sending data for the third time. However Rapid program is till running.

    It is weird.

  • RussD
    Options
    Can you provide a sample of what you are doing in your RAB application?
    Russell Drown
  • RussD
    Options
    In your RAPID main routine you have to allow some wait time in the WHILE loop, at least 0.1 s is the recommended minimum time.
     

    Also, how fast are you sending data to the controller? If you are running in a hard loop sending data as fast as you can, then you need to do Thread.Sleep(100) to allow some time for the controller to maintain its other tasks.

     

    If you look in the controller error log, I would bet that you have lots of messages stating that the Interrupt Queue is full and requests are being dropped. This is a sign that you are sending data too fast for the system to handle. Note that the PCSDK is not meant as a real-time communicaitons medium, the controller process for communications runs at a low prioity, it is not suitable for process control.

     

    If this is not an acceptable limitation, you might want to contact your local ABB support organization to investigate the availability of a RobotWare Option called RobotReferenceInterface that makes available a comm. inteface capable of, I think, 250 Hz update rate.
    Russell Drown
  • newform
    Options
    Dear RussD,

    New data will be sent only after controller finishes computation for previous data and the result is read to PC application. Will this cause interrupt queue to be full?

    But I will try to add some wait time and test it. Many thanks

  • RussD
    Options
    I guess it depends on how long all of that takes to occur, look for error # 40206 in your robot event logs, if you see that when you are running your you will know that is the problem.
    Russell Drown
  • newform
    Options

    Dear RussD,

    There is no error of 40206 in event log.

    I added wait time in both Rapid program (1s and 100s) and PC program (1s). The problem remains unchanged. I will investigate how these programs run step by step. Hopefully, I can find some hint.

    newform2009-05-07 17:19:21
  • RussD
    Options
    When your PC program "stops", does that mean because it has thrown an exception? If so, what is the exception? If not, what happens to make it stop?
    Russell Drown
  • newform
    Options
    The "stop" means that no new data will be sent to Rapid program and no result will be updated by Rapid program. But these two programs are still running, I think. Both of them may keep waiting. But I am not sure.

    There is no any exception that will be thrown.

    These two programs just communicate with each other for the first two or three loops. Then they stop "talking". It is weird.