Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Digital Input Wait Method Broken
#1
In my code I use the command, "robot.waitDI(1,1)" to pause the program until the robot receives a high signal on digital input 1, but the robot never actually waits when the program is run regardless of what the input value is. The robot I am trying to run the program on is a UR10 which has a digital input "ON region" of 11V-30V according to the manual. I have confirmed that digital input 1 is receiving 0V using a digital multimeter and have even tried running the command with all of the digital inputs completely disconnected from any possible voltage source but the program still skips right over this instruction. The strangest part is that the input wait method worked exactly as expected when I replicated my Python program using the "Set or Wait I/O Instruction" button in the RoboDK graphical interface. After realizing this, I generated a UR script from both the UI program and Python program I created and they were identical, so I can only assume that this behavior is due to some kind of software error. I have attached my Python code as well as the UR scripts generated from both the UI and Python versions of my program. Any help getting this method to work would be greatly appreciated as it is essential to my project.


Attached Files
.txt   IOwaitMalfunctionPythonCode.txt (Size: 526 bytes / Downloads: 63)
.txt   IOwaitURscriptPython.txt (Size: 922 bytes / Downloads: 56)
.txt   IOwaitURscriptUIversion.txt (Size: 728 bytes / Downloads: 54)
#2
I'm not sure I understand the issue. 

If you are planning to move the real robot and use the inputs/outputs of the robot I recommend you to make sure you have this setting unchecked:
Tools-Options-Motion-Manage I/O with RoboDK when connected to a robot
(it is unchecked by default)

If the previous solution doesn't work, it would help if you can provide the RDK file.

You can also run this code as a test:

Code:
RDK = Robolink()
robot = RDK.Item('UR10')
robot.Connect()  # Make sure you are connected to the robot
RDK.setRunMode(RUNMODE_RUN_ROBOT) # Trigger robot commands on the real robot
robot.MoveJ(point3)
robot.waitDI(1,1) # This should wait for the real Input 1 to be set to True/On
robot.MoveJ(point4)


A more detailed example is available here:
https://robodk.com/doc/en/PythonAPI/exam...rogramming
#3
Hello Albert,

We tried using waitDI method today and in our cases it doesn't work as intended as well.

We can see the input is off on the controller. While it's off, as we are waiting for it to be on (1), this function should wait at least the ms defined. However, it doesn't wait anything.

Edit: It would also be lovely, if we could have it return whether it received the signal or timed out.
Edit 2: It seems to work as a program in RoboDK only when it receives a signal. Timeout is discarded.
#4
+1 on this...
It would be great that this function returns a value 1/0 in case the signal has been received, with this we'll be able to make If statements with inputs instead of just waiting...
#5
I don't think the timeout is implemented when using the robot driver. It it is not implemented it should wait permanently. This may highly depend on the robot controller. We are writing it down as an improvement request.

Just to be sure that you are waiting for the correct input you should uncheck the following option:
  • Tools-Options-Motion-Manage I/O with RoboDK when connected to a robot
The latest UR robots have some inputs and outputs on the tool. Are those the inputs you are checking?
If so, you should address them as input/output 11 for input/out output 1, 12->2, etc.
#6
(04-02-2019, 04:35 PM)Albert Wrote: I'm not sure I understand the issue. 

If you are planning to move the real robot and use the inputs/outputs of the robot I recommend you to make sure you have this setting unchecked:
Tools-Options-Motion-Manage I/O with RoboDK when connected to a robot
(it is unchecked by default)

If the previous solution doesn't work, it would help if you can provide the RDK file.

You can also run this code as a test:

Code:
RDK = Robolink()
robot = RDK.Item('UR10')
robot.Connect()  # Make sure you are connected to the robot
RDK.setRunMode(RUNMODE_RUN_ROBOT) # Trigger robot commands on the real robot
robot.MoveJ(point3)
robot.waitDI(1,1) # This should wait for the real Input 1 to be set to True/On
robot.MoveJ(point4)


A more detailed example is available here:
https://robodk.com/doc/en/PythonAPI/exam...rogramming

Has there been any progress on getting the waitDI() method to work properly? I tried running the example code provided by Albert, making sure that the 'Manage I/O with RoboDK when connected to a robot' option is unchecked but the waitDI() method still does not cause the robot to wait for any amount of time. I am not checking the tool inputs and have tried running the method for all 8 of the regular digital inputs on the UR10 with the same result each time. As requested, I have attached my station file and have also included the code I am running to test the method. Any help resolving this issue would be greatly appreciated.

Test Code:
Quote:RDK = robolink.Robolink()
robot = RDK.Item('UR10')
point1 = RDK.Item('Target 5')
point2 = RDK.Item('Target 6')
robot.Connect()  # Make sure you are connected to the robot
RDK.setRunMode(robolink.RUNMODE_RUN_ROBOT) # Trigger robot commands on the real robot
robot.MoveJ(point1)
robot.waitDI(5,0) # This should wait for the real Input 1 to be set to True/On
robot.MoveJ(point2)    
#7
Keep in mind that tool Inputs/Outputs are mapped to Inputs/Outputs 11 and over.

Taking a look at the generated UR script code I see that the program looks correct. This section of code will wait for the digital input 1 to be True/On/1.
Code:
 while (get_standard_digital_in(1) != True):
   sync()
 end
  




Users browsing this thread:
1 Guest(s)