Good morning to all,
I’m trying to figure out how to add a “Before Start” section and fill it, in the same way we generate script using all the ProgramNodeContribution’s classes.
Thank you in advance.
Matteo
Recognition Robotics Inc
Good morning to all,
I’m trying to figure out how to add a “Before Start” section and fill it, in the same way we generate script using all the ProgramNodeContribution’s classes.
Thank you in advance.
Matteo
Recognition Robotics Inc
Highlight the Robot Program node. Then you can enable Before Start.
I don’t think you have access to that from the API. That lives in the Robot Program node which is in Polyscope. Generally, your CAP is supposed to exist as its own node and live inside the structure of Polyscope. Often times that means lacking the ability to mimic things you can do on the TP. For what it’s worth, script generated in your Installation Node will execute before your program scripts, so if you’re just trying to do some initializations, I’d just put it there.
Ah. I didn’t even see this was posted in another section …
Right, that’s my purpose, mimic a global variable initialization once, in the same way we can manually do with Installation Variables.
You are saying that implementing an InstallationNodeContribution, then everything I’ll initialise inside his generateScript method, will be also available inside my program node when running?
Thanks
Correct. Just be sure to declare it as a global and then you should be able to call it from your program node.
Here I set some runstates of some IO, as well as declare some global variables. Always be sure to assign them a value, as this is how URScript knows what datatype they are.
Great thank you,
I was using the same pattern, but inside the ProgramNodeContribution generateScript method. And I was having this init phase called at every cycle of the Program node (essentially generated inside the while(true) section of the *.script file when saving or running.
Yep. The installation’s generateScript will only run 1 time each time you press play, rather than at every instance of the Program Node.