July 12, 2018 at 8:38 pm #737535
I’m trying to make the Leap Motion work with H3D in linux (which is surprisingly much harder to do than in windows). I got it to mostly work using the Leap python documentation and it can now communicate cursor positions with H3D.
The issue I’m facing is with flickering in the leap cursor (represented as a sphere in the scene) and some delay when moving my hand quickly in the environment above the leap. The leap-provided diagnostics screen shows no lag, but for some reason there is some in H3D.
The way I set it up might be to blame, or it could be that in combination with the difference in the leap and H3D frequencies (If I understand correctly, H3D updates the scene at 60Hz +- 4Hz and the leap runs at anywhere between 100-120Hz). The message from the leap is read in the python script associated with the x3d file by listening to a UDP channel message.
Another observation I made is that the flickering seems worse when the objects in the scene interact (example: the leap sphere is going inside a semi-transparent spherical target). I should mention that the robot sphere in the same scene does not exhibit any of these issues (Using –deviceinfo argument for that).
I attached the code files I’m using. The first file to run is Controller_leap.py in the calibration folder.
Edit: Fixed statement about robot, using –deviceinfo, not HDEVJuly 12, 2018 at 8:38 pm #727905August 2, 2018 at 9:14 am #737536
In my opinion, i doubt the cause of the flickering is due to the frequency between h3d rendering and the leap motion update if h3d is at 60 hz.
Are you sure that your example is running at around 60HZ in H3D ? At 60hz, you should not notice heavy flickering unless your device is moving really fast.
One potential issue might be in the controller_leap.py.
Not sure what is the frequency of the data polling and sending there. If somehow that one is slow, then it can also cause the flickering. I would recommend you to monitor the frequency there.
So, in conclusion , please check the actual fps in your example, and check the frequency of the UDP package sending . Either of them being slow can cause the problem you have.August 16, 2018 at 8:19 pm #737542
Thanks for the suggestions, hao.
I tried a few things and eventually just gave up on using the UDP channel altogether. I incorporated grabbing the leap data into the main protocol (python script node in H3D). I also upgraded the display adapter driver and turned off all funky anti-aliasing stuff. This seems to have reduced the problem but did not eliminate it.
you mentioned checking the fps, is there a way to do that within the python/H3D environment? I’m not sure how I would go about monitoring fps in this case.August 17, 2018 at 8:04 am #737543
there are many ways to monitor the h3d frame rate. First in h3dviewer, you can press F8 to bring up a ui which displays the frame rates.
Or you can use some other gaming fps monitor tools such as fraps to monitor the fps of the application. Since h3d is a rendering program like a game, you will also get frame rate data through those tools.
If your frame rate is good enough, the lagging issue should not be that serious as you described.
You must be logged in to reply to this topic.