I just stumbled on strange behaviour in Polyscope. After some investigation I know why it happens, but I wanted to ask the classic question: is it a bug or a feature?
I wrote a couple of ‘if’ conditions in program, Then I try to run the program and got an error in the 3rd one. Polyscope didn’t recognize an input name. I didn’t understand, why one name works and the other doesn’t.
I was puzzled for quite a long time, until I opened urp file and noticed, that in some nodes there is and in some it is missing. Turns out, if I write the input name by hand, not select it from dropdown, then it is not translated to “get_digital_input(number)” function in script.
The best solution is to automatically recognize variable names written with keyboard. If it is written inside expression field, then automatically make it reference variable.
Second best is to make the ones input from dropdown stand out. Like make it blue, bold or underline it, so we can know that this is not just text, but variable reference?
Or both.
You are indeed correct.
There is a general difference when using the Expression Editor, to generate expressions using dropdown elements such as Inputs, Outputs or even Features.
By selecting a named input, i.e. “Gripper_Open” this is translated into get_tool_digital_in(n) instead of the referenced name. This is a necessity since the name only exists in PolyScope, and hence for the controller to understand the action, PolyScope translates into the relevant command.
Same would apply to a named fieldbus input, e.g. “Conveyor_Stopped” which in URScript would become read_input_boolean_register(n).
For features, it should also be noted, that if the feature is not variable, then the actual Pose will be inserted instead of the Feature name (again, since the Feature name is unknown in the Controller).
Hence, “Plane_1” would become p[x, y, z, rx, ry, rz].
If the Feature is variable, you would select the name from the Variables tab like “Plane_2_var”, however in URScript, this variables name is actually just Plane_2 and have been initialized to the correct value by assignment in the preamble script from the Features installation node.