How to add and control the child nodes using If ElseIf condition - URScript

The situation is that, the robot should start moving after checking the condition for the input signal.
I need to control the movement of the robot (to stop the robot), if suddenly the input signal changes in between the movement.
I am using the “move nodes” as the children. The URCap for checking the signals.

The actual result i am facing is the child nodes(move nodes) are totally skipped after checking the condition (Digital Input).
Other nodes are executed(example: sleep).

I am developing the URCap using URScript and creating the child node using java (createSubtree()).
I am using thread and while loop for the continuous expression checking.

I am calling the thread function from the Installation node to the Program node.

I also included the writer.writeChildren() method, but still the skipping continues. I am not sure where i am going wrong.

If there is an alternative way to achieve this process, i very much appreciate that as well (without the child nodes, just the URCap controlling the Move node added from the Polyscope).

Thank you in advance, for your help.

It should be working as expected (define thread with installation, call it for continous checking…)
Can you show me your generateScript function of your urcap (installation and contribution) and the tree structure of the child nodes?

to be honest i’m confused of all this threads inside your functions so this how i would do to achieve your desired function:
contribution:

grafik

then use writer.writeChilden() ~ robot will move to child node if signal was detected within 2 seconds otherwise the robot will be in halt. (cycles = 1000 because of 2ms clock cycle on e-series)
for continous checking the signal while moving you should implement a Thread inside your installation node that is called right before you need it.
Note that Threads don’t have access to any move or stop commands. you can bypass this (and implement sth like a real interrupt) by using a bridge to I/O which are set to e.g. stop robot

Thanks a lot for your quick response!

I will implement the above mentioned and get back to you with the status.

Thanks again for your help.

Hi,

Do you know the cycles for the CB-Series?

Thanks.

for CB Series its 8 ms :wink:

Thank you. :slightly_smiling_face: