![]() |
|
#1
|
|||
|
|||
The hand data is continuously updating with the sensor in the while loop (approximately every 16 ms). The target data updates only when it changes its position. So everytime the target location changes, which is like every 15 seconds, the hand data stops being recieved for a moment and the target data is updated. I want these two to be able to run at the same time without effecting eachother. I belive this happens because of the viz.director call but I dont know how else to do it. Does this clarify my question?
|
#2
|
|||
|
|||
Without proper formatting, I can't really tell what your code is doing. Are you getting any error messages in your script? I notice you have a try...except clause, but you silently ignore the message. Try removing the try..except and allow exceptions to be printed.
|
#3
|
|||
|
|||
I think the problem here is the blocking nature of the socket calls in the director functions combined with the sudo threaded nature of director functions.
My theory: Vizard allocates some CPU time to director functions every frame. Because only one thread/director function can access the Python interpriter at a time, if a director function takes all the time Vizard allocates for director functions in a frame, the other director functions will not get executed in that frame. The solution is to make you director function call non-blocking (aka faster) network functions, or bust some C code to use real threads. Farshizzo, does this make sense? Maybe all you need is to add a viz.waitframe() call in the while loops to yield CPU to other director functions? As a side note, multi-threading really messes with my mind.
__________________
Paul Elliott WorldViz LLC |
#4
|
|||
|
|||
Adding the viz.waitframe() minimized the lag to a reasonable value. Thank you both for your input.
|
![]() |
Thread Tools | |
Display Modes | Rate This Thread |
|
|