Python API: setDO and waitDI cause crash- Printable Version +- RoboDK Forum (//www.sinclairbody.com/forum) +-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN) + - - -论坛:RoboDK错误(//www.sinclairbody.com/forum/Forum-RoboDK-bugs) +--- Thread: Python API: setDO and waitDI cause crash (/Thread-Python-API-setDO-and-waitDI-cause-crash) |
Python API: setDO and waitDI cause crash-DavidG-06-01-2019 Hi, I would like to set digital input or output instructions using the API, but RoboDK keeps crashing when I try. 出于测试目的,我created a program which contains program calls (see attachment). These program calls trigger a python script and the python script is supposed to manage the IO instructions. Here is the python code:
Code:
from robolink import *
RE: Python API: setDO and waitDI cause crash-Albert-06-03-2019 Hi David, This is supposed to work. I was unable to reproduce the crash. If you want to manipulate inputs/outputs on the robot (Run on robot option) you can trigger robot.Connect() before you operate on the robot variable. Another option would be to add this snippet of code to force changing the run mode if you are connected to the robot:
Code:
status, message = robot.ConnectedState()
Can you provide an RDK project that reproduces your crash? Albert RE: Python API: setDO and waitDI cause crash-DavidG-06-03-2019 Hi Albert, that could already be the solution. I do not call robot.Connect() or RDK.setRunMode in the python script because the robot is already connected via the GUI and I expected that to be sufficient. I will try your fix tomorrow and get back here with the results. Thanks a lot. RE: Python API: setDO and waitDI cause crash-DavidG-06-04-2019 I have tried several versions, but none of them is working. The attached RDK project contains five programs that call five slightly different python scripts, all of them cause RoboDK to crash. Please note that I changed your suggested code from RUNMODE_RUN_ON_ROBOT to RUNMODE_RUN_ROBOT. RE: Python API: setDO and waitDI cause crash-Albert-06-10-2019 The crash happens because the robot name you provide doesn't exist: robot=RDK.Item('KUKA KR 6 R900',itemtype) If you specify a name there has to be a name match (KUKA KR 6 R900 sixx in this case). Alternatively, you can just provide an empty string: robot=RDK.Item('',itemtype) We just published a new update to avoid the RoboDK crash. However, you'll still get an error in your code so the easiest will be to just provide an empty string when you get the robot. RE: Python API: setDO and waitDI cause crash-DavidG-06-20-2019 Sorry for bothering you with that and thank you for looking into the issue. In every other script I got this correct but obviously did not copy paste it in this case... |