How to jump to a certain line in the program via Script or Assignment

Hello, all

Is there anyway to have a program jump to a certain line in the program tree using Script or Assignment commands? Picture attached below:


I would like if “Restart=True”, to then jump to line 76 in the program tree (start back over at MoveL, T2Approach.

Bonus question: if there is also anyway I can add to the “count” in the palletization program, both when the condition is and isn’t met.

Thank you all again in advance for your help. I wasn’t able to find anything in the PolyScope Script manual.

There is not an explicit jump command, no. You can, however, put everything from line 76 on in a loop, and loop while restart == True instead. Then any code after this loop would only execute when restart == False. This should accomplish what you’re looking for.

As for adding to the count, if I’m understanding you right, all you have to do is just use an Assignment node and say var = var + 1. Logically, it sounds like you’re asking if(True OR False) which is ALWAYS true. Therefore you don’t need to make it a conditional at all, just increment the variable on its own line all the time.

3 Likes

what about jump_to_label function from urscript

1 Like

That command doesn’t exist. At least not in the URScript manual for Polyscope 5.19. Can you show the documentation for this command?

No document. But i found it in the script send from 30001 port if you set a breakpoint in the program tree

4 Likes

Wow. Had no idea this was a thing. Crazy good find. Can’t believe that isn’t documented in the Script manual

1 Like

Wait. Is this a viable script command usable within a program? Or just as a command that can be sent to the interface?

Straight up undocumented script command.


If you press play here, the first thing that shows up is “test2”

3 Likes

What. Why is that not documented anywhere … Many years of UR programming where that command would’ve been so useful so many times.

I guess it’s only really usable in PolyScope 5 with line numbering, but still. :slight_smile:

Well. I guess it’s also a bit unpractical given that it looks at line numbers and not actual labels. So if a new node is inserted in the beginning of a program, you’d have to shift all your labels.

Woah, I’ve been looking into how to achieve something similar to a Jump to label on the UR. Can you share some more on this. what does the actual script look like to achieve this?

I mean you’re looking at it. That’s the whole script. It just jumps you to that line number. As efn points out, it’s not super great, since anything that changes your line numbering will in turn change where the jump instruction goes to. I spent a little time a while ago trying to guess my way into a hidden “label” instruction but didn’t find one.

Otherwise you can check this link: Jump Flag Program Node - #4 by eric.feldmann

Maybe that’s something you can use.

Awesome, thanks for the information! That gives me a few options to try out. Still mind-blowing how UR is the only Robot Manufacturer I’ve dealt with without a jump/label command. I get why to some degree for simple applications, but for more complicated applications where you need to add in a check/retry/additional process based off certain conditions (especially after a deployment) it can become frustrating having to restructure the entire program to make it functional. It is what it is. Thanks Again!