So, I have a URCap which captures waypoints in the installation tab, saves them in the DataModel and allows them to be added as waypoint nodes in the program tab.
What I want to do now is, after adding a waypoint node in the program tab, for any changes made to the waypoint in the installation tab to be reflected to the corresponding waypoint node in the program tab.
Q1. Is there a way to achieve this easily using URCaps API?
Q2. As I am unable to find an answer to Q1, I devised a workaround by saving flags in the DataModel.
ChangeFlag && RegisterFlag are initially false when a waypoint node is added in the program, RegisterFlag = true; when a waypoint is updated in the installation tab, ChangeFlag = true if ChangeFlag && RegisterFlag = true, update waypoint node with new values from DataModel
Which brings me to Q2. Is there a way to change the parameters (Speed, Acceleration, Blend) of a waypoint already added in the program?
Q3. Also, when a waypoint node is deleted from the program, I need to set RegisterFlag back to false. Is there a way to know when a node has been deleted? A listener on the delete icon, perhaps?
I think for answer 1 you could save the name of the waypoint in the program tab and then just retrieve the Pose data/ joint positions (however you saved it in Installation) from the Installation when you want to use the point. Assuming you are making a URCap which it sounds like you are.
I have considered that, too, but I was hoping someone knows an easier way because it’s really complicated to program.
Also, after retrieving the data from the installation tab, do you know if I can update the corresponding node in the program tab?
Because my research up to now tells me that nodes added to the program cannot be changed programatically using java.
There are a couple of different ways of doing that but the way I mentioned above would only save the waypoints name in the program nodes datamodel. Then whenever you want to use the waypoint (moveTo, generate script), you just pull it from the installation so that it always uses what is currently set up in your installation node. You would also want to create a check to make sure that the waypoint still exists in the isDefined function of your Program Node.
Also, you can retrieve an instance of your installation node contribution so that you can use public methods from the installation in the program node. An example of this is shown in HelloWorld Example provided by UR. (getInstallation)