When hitting the single step button i get the error “compile error: name ‘my_function’ is not defined”. When hitting play it runs fine. Does single step operate differently where it does not compile the same way as the run button?
I am not sure, but I think “single step” just sends the URscript, that is responsible for that single line. It is actually funny, that they try to make sure to make Polyscope so user friendly and safe, but they leave this button with instructions not to use it without explaining what it actually does. Software manual says:
Make sure to stay outside the robot workspace when the Step
button is pressed. The function of the Step button can be difficult
to understand. Only use it when it is absolutely necessary
Makes sense. Thank you.
The issue is my URCap has functions is in the install node called from the program node that are probably not compiled when you hit single step as opposed to when the run button is pressed. Anyone have any suggestions on how to get around this?
Hey guys, I just hit the same issue.
I have an installation node that defines a lot of required variables (for the program node) and if I try to single step over my program node it complains that those variables are not defined.
Is there any way to check if variables are defined or not so I can add an early return or something if they’re not?
I think you just have to accept, that single step is a no no. Polyscope is meant to be used with very simple programs. Preferably with static values/positions.
I don’t know any way to check if variables are defined until you use them, but then it is too late.
Depends very much on what you are trying to do.
OK so we have shared variables and functions in the install node that are shared between all the program nodes that exist.
So it seems the install node code defined in generateScript() is NOT created when single step is pressed. Therefore nothing defined in the install node accessible from a program node in single step mode.
What are my options…
Disable the single step button! Is this possible through Java?
Detect in the generateScript() function that single step was pressed and abort the step. Perhaps throw a warning to the user. this seems more likely but how?
Option #3 (not preferred)
Move all PYTHON variables and functions to the program node. However, seems this will create excessive repeated code in each program node. Not a problem? Also will the same variable declared in each program node be shared between other program nodes?
Thank you all for the help here. Good stuff.
Hello - I was able to create a workaround for this issue, bit it’s kind of tricky and I doubt my solution would generalize to work for other people. The basic idea is that if you’re single stepping, your program node can call getInstallation.generateScript() itself. The tricky part is that you don’t want to call installation node generateScript() twice or you will get duplicate function declarations. To handle all combinations of play and single step, a complex system of flags was needed to distinguish one case from another. Hopefully, this suggestion may help you implement support for yourself.
Is there any update from UR on how to avoid this error or has the functionality of single step changed since?
This is now resolved with the e-Series debug capabilities
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.