Switch between saved TCP's via Script?

Noob question ::

I know I can use set_tcp() to set override current tcp to whatever I want.

What I would like to do is to set_tcp() to one of my saved TCP’s in installation.

So if I have TCP1 and TCP2 saved in installation, I would like to switch between them as active one during program.

So like set_tcp(TCP1) - this does not work as its a non program variable, right?

Reading the script manual for the set_tcp command, looks like you would need to spell out the TCP info and not just call the saved TCP

Example command: set_tcp(p[0.,.2,.3,0.,3.14,0.])
• Example Parameters:
• – pose = p[0.,.2,.3,0.,3.14,0.] → tool center point is set to x=0mm, y=200mm,
z=300mm, rotation vector is rx=0 deg, ry=180 deg, rz=0 deg. In tool coordinates

Thanks for reply.

That part I understand, yet what we need is an option to pull these values from the installation TCP node.
For example : if I have manually taught 3x TCP’s - TCP1, TCP2, TCP3

And I set TCP1 as default TCP.

I would like to be able to either set different default TCP in program (like set TCP2 as default)

or

pull the values of TCP2 or TCP3, assign them to a variable or array and then use them with set_tcp() command.

Use case has 20x different TCP’s that need to be calibrated.

karlis,
It may be possible to access the TCP data with a URCap.
and pass it into an array or variables.
but I’m not an expert.
@eric.feldmann
wrote a great TCP Selector URCap.
He might be able to point you in the right direction.

Yeah, in URCap it easy peasy.
but for some testing, fault finding, doing it with urscript would be perfect.

Your second approach is likely what you’ll have to do, minus the “pull the values” part. You’ll have to manually enter the data into the variables and assign them at the top of the function, for example. I’m not exactly sure on your use-case for needing it in URScript only (maybe you’re talking over Python or something), but you should be able to use a CAP to write the variables into your runtime script first thing, then anywhere else you use the set_tcp() command would be fine.

For example:
URCap creates an array in script that is size 20. It iterates through each TCP that it has access to the Installation Contribution and populates the URScript array. It writes this array immediately before program execution because URCap Installation Node contributions contribute their script before any program node. Now the array is accessible for the rest of the program execution.

Does that make sense?

1 Like

Hey Eric,

yes, that’s the approach I though we might have to take if a simple script command one doesn’t exist.

Thank you all so much for support!