Our URCap we wrote controls a motor from the UR. We are adding a feature to wait for the motor to finish making its move before proceeding onto the next program node.
We have stripped down the bug into the most basic code in order to show the problem.
Versions
We tried
- SDK 1.4.4 and also SDK 1.9.0
- Polyscope versions 5.3, 5.4, 5.5, 5.6, 5.7, 5.8
Impact
UR program does not play all the way through
Issue details
We are getting a really weird “bug” that we have been attempting to fix for several weeks now. The issue arises whenever we put a While Loop into our URCap ProgramNodeContribution generatescript. The UR program will play our URCap node and then the program will stop after the execution of our URCap node (when program should not stop). This only occurs:
1.) If there is a While Loop function in our URCap generatescript function
2.) When the program is first loaded (either by opening the program or if program is auto-loaded on boot-up), we initialize the robot and press play without pressing any other buttons.
Use Case and Setup
While loop in a URCap ProgramNodeContribution generatescript
Steps to Reproduce
Place this code in your ProgramNodeContribution generateScript function.
This can be the only script generated in the URCap.
writer.assign(“ioVal”, “False”);
writer.whileCondition(“ioVal==False”);
writer.assign(“ioVal”, “get_standard_digital_in(0)”);
writer.sync();
writer.end();
Create a UR program, insert URCap node and a Wait into program. Save program. Open any other program or power off the robot. Load the program with URCap node (either by opening the program or if program is auto-loaded on boot-up), initialize the robot and press play without pressing any other buttons.
Expected Behavior
We would expect the program to play all the way through all the program nodes after the digital input goes high.
Actual Behavior
The actual behavior is that the UR program stops shortly after executing our URCap node
Workaround Suggestion
1.) Remove While Loop. If we removed the while loop in our URCap, program would also run flawlessly
2.) Load the program and then click any node in the program tree (any other node except the URCap node).
- For example, we had a “Movej” node and a “Wait” node in the program. If we clicked on one of those nodes, and press play, program would run flawlessly. If we loaded the program and did nothing else but hit play, program would execute up to our URCap node and then the UR program would stop (no errors in the log file).