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.