Universal Robots Forum

Index out of range URScript functions

I came across this issue over the past few days.

Posting it here more as a FYI to other people who may come across the issue.

If you have mulitple subprograms that use the same urscript containing defined functions, it can cause the urp compiler to generate the runtime code oddly and throw some strange errors including ‘Index out of range’ and ‘Variable not defined’ during runtime. It can occur randomly even after it has worked in previous compilations.

Even if you try to guard the script with a if conditional it will still compile in and cause the issue.

Solution is to define the functions in the main program, and suppress the calls to the script in the subprograms.
If you wish to call and test the subprograms separately you can then un-suppress them.

Hope this helps someone. Cheers.