RobotStudio event

Multithreading in RAPID

I was wondering whether RAPID supports multithreading since I can't find any documentation on it. The problem at hand is that I want to control the robot while receiving updates to the robtarget through TCP/IP.

Best Answer

  • graafderk
    graafderk
    Answer ✓
    When you have the option Multitasking in your controller, you can add tasks not connected to any mechanical device. However, if the additional task takes too much resources from the controller, it might slow down movements in another task.

Answers

  • The only thing the task should handle is the communication with an external pc, that shouldn't require too much resources (I hope?). Thanks for the quick answer!
  • I'd guess not. A few years back, a colleague tried running the RAPID web server from the robotapps (<a href="https://robotapps.robotstudio.com/Details.aspx?fileId=8ab579e5-9b4a-462e-92b8-e00b5d4a7560">https://robotapps.robotstudio.com/Details.aspx?fileId=8ab579e5-9b4a-462e-92b8-e00b5d4a7560</a>, now superseded by the awesome new robot web services), which would influence the movement speed when the robot was moving while someone tried accessing the server. I would expect receiving a few bytes now and then wouldn't have too much influence, but don't expect fast movements while running cpu heavy computations.
  • larstoc
    larstoc
    edited February 2015
    <div><span style="font-size: 10pt;">I found out how to activate a task, but I can't seem to properly find a way how to use it. The main modules are in the task created when making the system, but I can't seem to find a way to create modules for the new task. It might be very trivial, but there is not much documentation on it. On example can be as follows: Lets say I have two tasks, RobotControl and RobotCommunication. The RobotControl task was made upon system creation and you can access the modules by going to Rapid -> <system name> -> Rapid -> RobotControl -> module.  However, I can't find a way to create any modules or access the new task, RobotCommunication, at all. Any help is welcome!</span><br></div><div><span style="font-size: 10pt;"><br></span></div><div><span style="font-size: 10pt;"><br></span></div><div><span style="font-size: 10pt;">EDIT: I found out the error, it was that both tasks were set to motion task, which is not possible. Now that only one of them are defined as motion task a new task appeared in the RAPID section. Hopefully this will help someone out.</span></div>
  • You just need to right click the task (RobotCommunication) then you will get an option to create a new module.

    You then need to create a persistent variable in both tasks, then when the variable is changed in one task it is also updated in the other task.

    btw. make sure that you only declare them with a value in one of the tasks
    e.g.
    TASK1:

    PERS NUM Value:=1;

    TASK2:

    PERS NUM Value;

    and don't make them task persistence:
    TASK PERS NUM Value;