Universal Robots Forum

URCap execute on robot program node

What part of the robot program node is executed when urcap is executed?

the generateScript() and all of URCaps Child nodes if using writeChildren()

1 Like

generateScript() is called when the program is started (as well as when its saved)
This link provides details of when each function is called by the robot: https://plus.universal-robots.com/getting-started/principle-of-program-node-integration/

1 Like

When I put my function in the generateScript, it executes it in preparation for starting the robot program. Can I get my function to run when I run a robot program instead of preparing it?

what exactly is your task? if you need initialization of e.g. some additional hardware you might wanna use a InstallationNode.

I want to add the URCap to the program node and let the function I created work when I run the robot program.

please answer about my question…
Thank you.

If you want the script that your URCap generates to be run as soon as you press play, then put your URCap node at the top of the “Before Start” sequence of the robot program. The robot program will run the script generated by your URCap when the program sequence reaches your URCap’s node in the program, you can’t specify when in a program your URCap will run its script.

The order in which script is run is:
Installation node script -> before start script -> robot program.

When I insert my function in the generateScript(), the robot program starts after my function is executed in preparation before starting the robot program. My function is not executed in the robot program execution process.

Note, that anything that needs to happen at “runtime” while the program is running, should happen in URScript.
Hence, your Java methods are used when configuring the program, while they should all lead up to execution of URScript code.

The following articles may help you investigate this principle:
https://plus.universal-robots.com/getting-started/ur-software-architecture/
https://plus.universal-robots.com/getting-started/myfirsturcap-introduction/

2 Likes

Thank you.

Is it not possible to run my function in URScript?

It is my goal to move the robot when performing my URCap like robotiq’s wrist camera.

Java functions cannot be called from URScript.
But if you take a look at URScript, you will find that it is pretty good at making the robot move.

2 Likes

Is there any way to perform the function I created when my URCap is done on the program node?

1 Like