As an UR+ developer I would like via the SDK to detect when a user has removed/disabled a programnode from the program tree by either deleting, cut or suppressing the node.
Since I wan’t to be able to handle global states correctly after the node has disappeared. I find this feature to be quite important since a program node even though deleted aren’t disposed/freed from memory right away.
Is there a workaround for this? Or any plan to implement it?
i absolutely agree this would be a nice feature.
i’m actually using urcaps capsuled inside a urcap which can manage the deletion of child urcap nodes as a workaround for that but i don’t know if that fits your needs.
functions like onDelete() or onSupress() inside the Contribution class, triggered just before calling the action would be nice
Hi there! I agree with @dhv . I think this, as well as other related node information, should have a easy way to be accessed.
For the URCap I’ve been develping I needed to know the total count of my nodes that were active (not supressed) in the user program.
These were some of my needs and the things I found out:
My program needs to know my node count nearly from the beginning of the user code
My URScript generation Java methods are called when the user press play or when the program is saved
Installation node is called first, the each ‘active’ (non supressed) node in the order it appears in the tree.
After some researching I ended up with the following workaround:
- In my Installation Node URScript generation Java method: I reset to 0 a Java variable to hold the count, defined in the installNodeContrib class.
- In the URScript generation Java method for each of the nodeContrib I want to count, I increased this var
- Each time this Java var is updated, it is passed via socket to a Python daemon, using JSON in my case
- This daemon sends this count to the user program script code, at runtime. How? I connect python daemon with robot via RTDE. And in the Script generation for my installation node I define and run a thread that continuosly checks this value from RTDE and updates a global variable. This variable I use later in the URScript generated for each node.
Long way… should be an easier one, right?
If you need help with this tell me.
I would like to second this request. The proposal of @dmartin shows how much extra work is needed just to get an actual count of his nodes. We need to figure out which exact nodes are active/passive/deleted for communicating and visualizing correctly with our backend , which is even more work, if at all possible.
I would also like to second this request.
I would like to have a thread that runs as long as the node is active, but it just keeps running as it is now.