Would like to seek some ideas from the community on how to improve some features I have in the URCap I’m developing.
I have a thread in a program node that constantly checks for a value of a certain digital input at a fixed interval (egs every 1 second).
If the input is detected to be “HI”, the background process will execute a script function to get the current TCP pose and create a waypoint node under this parent program node. If “LO”, do nothing.
What I notice is that as the thread is executing, navigation around the polyscope UI (egs clicking another node, any other button, etc) is laggy. The lag is more prevalent when the interval of the thread is made shorter. Once I have navigated away from the program node (that executes the thread), the lag disappears - which is expected since the thread only executes when the program node is being selected.
My main intention is to have the URCap populate a waypoint node on a button press (connected to the monitored digital input) Any ideas on how to go about this better?
How are you monitoring the digital input? If you are regularly calling socket communication, it will lag tremendously. If you’re using the build-in Java API, you shouldn’t see too much lag. I’ve done almost exactly what you’re describing here for the same purpose and didn’t see any crazy amount of lag.
Ah that explains it. Using the IOModel interface resolved the issue! Thanks Eric