RoboDK Forum
Call Plugin command from robot program可打印版本

+- RoboDK Forum (//www.sinclairbody.com/forum)
+-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN)
+--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API)
+--- Thread: Call Plugin command from robot program (/Thread-Call-Plugin-command-from-robot-program)



Call Plugin command from robot program-mvistein-05-18-2022

Is there a way to call a (blocking) plugin-command from a robot program?

一个点燃tle background to my question: In the example Synchronize-3-Robots, a python script is used for the synchronization of the three robot programs. The invocation of the python script however takes considerable time. Since I was already able to improve the performance of my application by moving from the C# API to a C++ plugin (about factor 60) I was thinking whether the synchronization of the simulation could also be performed internally (within the plugin).

Best regards,

Michael


RE: Call Plugin command from robot program-Sam-05-18-2022

Hi Michael,

I'm not sure if I understand correctly, but you can call a C++ plugin from the Python script, which can be called from a Program.
See//www.sinclairbody.com/doc/en/PythonAPI/robodk.html?highlight=plugin#robodk.robolink.Robolink.PluginCommand


RE: Call Plugin command from robot program-mvistein-05-18-2022

Hi Sam,

what I am looking for is a way to do this, but without the Python script in between (because to me it seems that launching the Python interpreter takes quite some time).

Best regards,

Michael


RE: Call Plugin command from robot program-Sam-05-19-2022

Hi Michael,

What are you trying to do exactly?

Only Python scripts can be called with a Program Call Instruction from a RoboDK Program.
Calling a RoboDK Plug-In from the Python script should not take longer than a few milliseconds.

Code:
from robolink import *
RDK = Robolink()
resp = RDK.PluginCommand("MyPlugin", plugin_command='DoSomething', value='WithThisValue')
print(resp)

You stated that you need blocking function calls, so the following might not apply: you can also use event-based code with Plug-Ins to update the robot poses on each render for instance.
Seehttps://github.com/RoboDK/Plug-In-Interface/blob/d26720cff7e7848fbca9adfa6a72bade6b67054c/robodk_interface/iapprobodk.h#L212.