I'm having problem generating my script program. I did a simple code in python to get to move a UR robot to 3 different targets, wait for a DI and finally move the robot to target 4. If I run the code online, the robot goes to the 4 different targets without waiting for the DI. Then, I wanted to get deeper into the script code and noticed that the UR script code is just calling the Move_UR function (image attached) but this is not defined anywhere. Any idea why this is happening.
RoboDK won't include the code generated by a Python script into a program generated by the UI.
You should generate both programs separately. I'm not sure if there is an easy way in a URP program to call an external program though. If so, we can help you integrate it, otherwise, you may need to manually place the code of your subprogram in your UR post processor.
07-06-2020, 04:59 PM (This post was last modified: 07-06-2020, 04:59 PM by danield271.)
(07-06-2020, 02:33 PM)Albert Wrote: RoboDK won't include the code generated by a Python script into a program generated by the UI.
You should generate both programs separately. I'm not sure if there is an easy way in a URP program to call an external program though. If so, we can help you integrate it, otherwise, you may need to manually place the code of your subprogram in your UR post processor.
Hi Albert,
Thanks for your answer but I don't understand you. I would like to know just why RoboDK executes well the function waitDI(0,1) when I put it as an instruction (Image_1) but it doesn't work if I execute the function using a python code (Image 2). The robot is not waiting for Input 0 to be high but instead jumps into the next line of code. I have seen other forums (https://robodk.com/forum/Thread-Python-D...ght=waitdi) but still the problem is not solved. The guy on this forum was able to convert the python code (Image_3) into an script code (Image_4), that's what I'm trying to do but I haven't had any succeed (Image_5).
(07-06-2020, 02:33 PM)Albert Wrote: RoboDK won't include the code generated by a Python script into a program generated by the UI.
You should generate both programs separately. I'm not sure if there is an easy way in a URP program to call an external program though. If so, we can help you integrate it, otherwise, you may need to manually place the code of your subprogram in your UR post processor.
Hi Albert,
Thanks for your answer but I don't understand you. I would like to know just why RoboDK executes well the function waitDI(0,1) when I put it as an instruction (Image_1) but it doesn't work if I execute the function using a python code (Image 2). The robot is not waiting for Input 0 to be high but instead jumps into the next line of code. I have seen other forums (https://robodk.com/forum/Thread-Python-D...ght=waitdi) but still the problem is not solved. The guy on this forum was able to convert the python code (Image_3) into an script code (Image_4), that's what I'm trying to do but I haven't had any succeed (Image_5).
As soon as I comment the instruction "RDK.setRunMode(RUNMODE_RUN_ROBOT)" from the phyton code, I'm able to generate the script code (image_1), but still the robot doesn't wait for the instruction "robot_UR.waitDI(0,1)".
07-07-2020, 02:10 PM (This post was last modified: 07-07-2020, 02:13 PM by danield271.)
(07-06-2020, 07:17 PM)danield271 Wrote:
(07-06-2020, 04:59 PM)danield271 Wrote:
(07-06-2020, 02:33 PM)Albert Wrote: RoboDK won't include the code generated by a Python script into a program generated by the UI.
You should generate both programs separately. I'm not sure if there is an easy way in a URP program to call an external program though. If so, we can help you integrate it, otherwise, you may need to manually place the code of your subprogram in your UR post processor.
Hi Albert,
Thanks for your answer but I don't understand you. I would like to know just why RoboDK executes well the function waitDI(0,1) when I put it as an instruction (Image_1) but it doesn't work if I execute the function using a python code (Image 2). The robot is not waiting for Input 0 to be high but instead jumps into the next line of code. I have seen other forums (https://robodk.com/forum/Thread-Python-D...ght=waitdi) but still the problem is not solved. The guy on this forum was able to convert the python code (Image_3) into an script code (Image_4), that's what I'm trying to do but I haven't had any succeed (Image_5).
As soon as I comment the instruction "RDK.setRunMode(RUNMODE_RUN_ROBOT)" from the phyton code, I'm able to generate the script code (image_1), but still the robot doesn't wait for the instruction "robot_UR.waitDI(0,1)".
I have a new result today. If I download the .script and the .urp file to an usb and then upload the urp file to the UR's controller (offline programming), the robot actually stops waiting for DI 0 to be 1. On the other hand, if I run the program online (RDK.setRunMode(RUNMODE_RUN_ROBOT)), the robot doesn't stop for input 0. Is there anyway to fix this problem?
As you can see in the image attached, nothing is sent to the controller after executing waitDI function even after activating the option you told me "Manage I/O with RoboDK...".