I’m facing an issue with my first URcap:
My ProgramNodes use some variables setted on the instalation, and when I change a value of them(on the instalationTab) and save the instalation it doesn’t apply the changes on the URScript until I change something on the program tree and pulse play to compile.
Is there a way to notify polyscope that something has changed on a URCap to make it compile again the URScript the next time the “play” button is pressed???(even when nothing has changed int he program tree)
changes applied to both installation and programnodes apply on the urscript layer when playing or saving a robot program. This mechanism takes action when the installation and programnodes have their generateScript methods called.
To apply changes to your programnode from your installationnode, you need to call the datamodel of your installation from the programnode, in this case, a get method and the getInstallation Interface should be implemented.
To assure that the changes apply when needed, the get method should be implemented both in your openView and the generate Script method. This way, your changes will either be viewed or executed.
The “getSetupValue” method on my instalation contribution is which consult the dataModel… and it transfer the value correctly when compile, but I doesn’t apply changes until is another change in the program tree to compile.
I didn’t find the way to call the datamodel instance of my instalation contribution from my generateScript method of my programNodeContribution if that is what you are suggesting.
public void generateScript(ScripWriter writer){
if(model.get(Activated_KEY, false) == true){
Float time = new Float(model.get(Time_KEY, 0.0));
writer.appendLine("TimeToExecute = " + time.toString());
writer.appendLine(“AllowExecution = True”);
}else{
writer.appendLine(“URCap not activated”);
}
}
And the slider I have to set the time has the same context than the one “MyFirstURCap” example,… trigering an Change listener, that calls a method of the instalation contribution, wich saves the new value on the datamodel. exactly the same programing than the example and it works… when it compiles, the problem is that I need to make a change in the program tree to see the changes I made in the instalation tab applied, even when are properly saved in the datamodel of the instalation contribution.
When you say that changes on the URScript are not applied, are you looking at the .script file? To my knowledge, that file is changed only on program saving, but the actual URScript which runs when pressing the play button can be hidden.
I don’t know why this happens but it is confusing. Maybe UR staff (@jbm for example) can explain this: why the <program>.script file is updated only on program saving and not when the play button is pressed? Moreover, I think the <program>.script file is used only as a reference to understand the generated URScript code, but the actual code which is executed is hidden in another folder, can you confirm this?