Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
H3D.org Feeds

Forum Index


Board index » All Posts




Using Leap Motion with H3D
#1
Not too shy to talk
Not too shy to talk


Hello,

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 HDEV

Attach file:


Link only for registered users

Posted on: 7/12 22:38
Top


Re: Running H3D window on second screen
#2
Not too shy to talk
Not too shy to talk


Reporting on the solution for this (not perfect, but a good fix for my needs)

When calling H3D, I'm now running it as a bash script with H3DLoad calling the x3d visual scene file. I'm using the --deviceinfo argument to specify my robot, and -f for full screen. I'm running the bash script from a terminal that I had moved to the second monitor, and that seems to do the trick.

Posted on: 7/12 22:24
Top


Privacy Policy
#3
Webmaster
Webmaster


Dear Forum users,

We are updating our Privacy Policy for you to understand what information we collect and why we collect it.

If you have added your Real Name to your profile on the H3DAPI.org website, please be aware that we have removed it. If you add it back into your profile, it means that you consent to it being shared with other users on the website. Please see the link to our privacy policy below for how your personal data that you may enter will be used. You can also find this policy on our website at: http://www.h3dapi.org/modules/gdpr/privacy_policy.php.

If you have any questions or concerns about this privacy policy, please don’t hesitate to contact us at support@sensegraphics.com.

Posted on: 5/24 14:56
Top


Re: Running H3D window on second screen
#4
Webmaster
Webmaster


In H3DViewer it is implemented in H3DViewerApp.cpp in the
MyApp::OnInit function.

Also double check H3DLoad command lines so I am not completely out of the blue, but I can't find anything in the code regarding this.

Posted on: 5/24 7:42
Top


Re: Running H3D window on second screen
#5
Not too shy to talk
Not too shy to talk


I have the latest trunk compiled on Linux, I can take a crack at it. Can you point me to where this is implemented in H3DViewer?

Posted on: 5/23 19:53
Top


Re: Running H3D window on second screen
#6
Webmaster
Webmaster


We have a task in our backlog (not the public one) about unifying the command line options for H3DLoad/H3DViewer.
For H3DViewer you can set the position/size (at least if you build the latest trunk).
For H3DLoad I am afraid it looks like only size can be set. If you are not opposed to modifying this yourself you could just add a similar option to your H3DLoad as the one that is in H3DViewer.

Posted on: 5/22 9:09
Top


Running H3D window on second screen
#7
Not too shy to talk
Not too shy to talk


Hello,

I am trying to run an H3D process on my second screen under Ubuntu. Previously, I was using python to handle this in Windows through the win32process library. This library does not exist under Linux, and the subprocess library in python doesn't seem to have this functionality, at least not under Linux.

Basically, what I need is for H3D to always run in fullscreen on my second monitor when it's called.

In my x3d file, I currently have:
<H3DWindowNode fullscreen='1' />


This gets called in python through:
subprocess.Popen(['H3DLoad'process_name], stdout=PIPEstderr=PIPE)

where process_name is the path to the x3d file.

From my understanding of the H3DWindowNode documentation, there doesn't seem to be an option to 'select a screen' or to set the pixel position of one of the window corners, unless it's a field/option I'm not seeing. What is the way to achieve this under Linux?

Thanks,
-Yaz

Posted on: 5/20 20:16
Top


Re: RuntimeError: UnableToCreatePythonField: fieldAsPythonObject()
#8
Webmaster
Webmaster


It looks like you are mixing concepts a bit.

traverseSG is using the update function of the class Trial which kind of looks like an class that should inherit from the field types in H3DInterface and should be using the routing system.

Whichever system you are using ( traverseSG or the other setup with fields and routes) does not really matter but it was a bit confusing to me at first.

If this code is correct, then the first time traverseSG will be called the cylinder will change to the new color. Which color are you actually seeing when you start the program (maybe it changes so fast that you do not notice).

And finally, this really looks like some kind of recursive issue.
If your x3d file is called Trials.x3d then you can see that it includes the python script file Trials.py which then loads Trials.x3d which then loads Trials.py and I really do not know what to expect in this case (the module should only load once, but it is still quite weird).
You can either use the references field to give the node you are interested in to python or use getNamedNode() function in python.

Posted on: 5/14 9:10
Top


RuntimeError: UnableToCreatePythonField: fieldAsPythonObject()
#9
Not too shy to talk
Not too shy to talk


I am trying to work out the setValue() ' routing' approach, but this error keeps coming up.
Also, when I try updating the color of an object with self.dn["MAT"].diffuseColor.setValue(RGB(1,0,0)) for instance, the object does not change color.
I suspect that this error is the reason, but I can't figure out how to solve it. Here's the X3D:

<X3D
   <
Scene
      <!--
OBJECT--> 
      <
Shape
         <
Appearance
            <
Material DEF="MAT" diffuseColor="1 0 0"/> 
         </
Appearance
         <
Cylinder/> 
      </
Shape

      <
PythonScript DEF="PS" url="Trials.py"/>
   </
Scene>
</
X3D>


And the Python:

from H3DInterface import *

class 
Trial():
   
def __init__(self):
      
self.nodeself.dn createX3DNodeFromURL("Trials.x3d")
      
self.new_color RGB(010)
   
def update(self):
      
self.dn["MAT"].diffuseColor.setValue(self.changeColor())

   
def changeColor(self):
      return 
self.new_color

trial 
Trial()

def traverseSG():
   
trial.update()

Posted on: 5/10 11:27
Top


Re: How can I update SmoothSurface stiffness with python?
#10
Webmaster
Webmaster


UpdateStiffness is a wrapper name. Look at the base class for this particular field and you can see that it inherits from SFFloat. The field itself is inputOutput so you can treat it as an SFFloat field just fine.

The purpose of this particular field is to properly transfer the value it is set to into the haptic loop at some point.

Posted on: 5/2 8:15
Top



TopTop
(1) 2 3 4 ... 963 »






(C) 2012 SenseGraphics AB    ---    Powered by XOOPS