Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Script code is not working when using the function "waitDI".

#1
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.


Attached Files Thumbnail(s)
   
#2
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.
#3
(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).


Attached Files Thumbnail(s)
                   
#4
(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)".


Attached Files Thumbnail(s)
   
#5
(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?
#6
Hi Daniel, 

For the driver to manage external IOs, you need to activate this option:

   

Have a great day.
Jeremy
#7
(07-10-2020, 11:10 PM)Jeremy Wrote: Hi Daniel, 

For the driver to manage external IOs, you need to activate this option:



Have a great day.
Jeremy

Hi @Jeremy

I don't have that option on my end (image attached).

Daniel,


Attached Files Thumbnail(s)
   
#8
Hi Daniel,

Download the latest version of RoboDK from our website and you will have this option.
It comes with RoboDK 5.0

Jeremy
#9
(07-14-2020, 04:21 AM)Jeremy Wrote: Hi Daniel,

Download the latest version of RoboDK from our website and you will have this option.
It comes with RoboDK 5.0

Jeremy

Hi @Jeremy

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...". 

Daniel


Attached Files Thumbnail(s)
   
  




Users browsing this thread:
1 Guest(s)