when running a Robot Program, it comes to Situations where URCaps in the Program Tree are randomly opened and closed which also triggers the openView() and closeView() methods.
This behavior causes issues for us, because we implemented serveral method callings in the openView() method, e.g. setting a Profinet IO which then calls another program through a socket because there is still no interface for doing this with the URCap API. Doing so, the Main Robot Program is stopped because of the new Socket Program.
Is this random open/close behavior desired or can i consider this a bug?
Is there a workaround to prevent calling the openView() on Robot Program Runtime? (without calling another socket function to read the state which overloads the thing even more)
The only thing i an think of for a work around is having your calls wrapped behind a boolean field that is set to false in generate script to avoid them being called when a program is running, and using the dashboard server to monitor the program state to set the field back to true so that methods are called again once the program has stopped, not the cleanest solution though.
the idea with the field in generateScript is good, the resetting is the problem tho. i could also use a IO which has prog-stop low behavior and read that back with the DigitalIO Interface or RTDE to reset the field… sigh
It would also cause another problem when saving a program: the field should be immedeately resetted because the view would no longer be updated
Actually having thought about it a little more, you could just query the dashboard server everytime
openview() is called, and simply check whether the program running flag is high, and use that to check whether or not to run your methods. I think this should get around the saving/not resetting field issue
i ended up using the realtime interface because it responds faster than the dashboard server. Still not a cool solution but it works for now