Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
cubedparadox's avatar
cubedparadox
Honored Guest
12 years ago

[REQUEST] Dk2 Python bindings?

Hi all, I recently recieved my dk2, and would like to develop some python applications for it. I found some python bindings for older versions of the sdk, but they didn't appear to work with the dk2. Is anyone working on dk2 python support? Thanks!

9 Replies

  • "jherico" wrote:
    My python bindings are here. They're built against the latest SDK. There is example code here

    Hi, I found your bindings,but I can't seem to get them to work. When I run the RiftDemo.py, it returns an error, saying that the hmd instance has no attribute 'get_desc'. I've tried to fix the error myself, but to no prevail. any help would be appreciated, thanks!
  • "cubedparadox" wrote:
    "jherico" wrote:
    My python bindings are here. They're built against the latest SDK. There is example code here

    Hi, I found your bindings,but I can't seem to get them to work. When I run the RiftDemo.py, it returns an error, saying that the hmd instance has no attribute 'get_desc'. I've tried to fix the error myself, but to no prevail. any help would be appreciated, thanks!


    Sorry about that. I do my development in a fork and while the fork had been updated to 0.4.x, the code in the repository I linked to had not been. I've updated the main public repository to which I originally linked and it should work now.
  • "jherico" wrote:

    Sorry about that. I do my development in a fork and while the fork had been updated to 0.4.x, the code in the repository I linked to had not been. I've updated the main public repository to which I originally linked and it should work now.


    Just ran the updated code, haven't had a chance to debug it myself, but here's the error log.
  • Sorry to bump this, but are there plans to finish updating the python bindings (and examples) to 0.4.2? I see you began updating the bindings, but the examples still show v0.4.1. I'd like to use the rift with blender, which uses python for scripting plugins (and games). Thanks!
  • "cubedparadox" wrote:
    Sorry to bump this, but are there plans to finish updating the python bindings (and examples) to 0.4.2? I see you began updating the bindings, but the examples still show v0.4.1. I'd like to use the rift with blender, which uses python for scripting plugins (and games). Thanks!


    The demo app hasn't been updated since 0.4.1, but that's because there weren't any client code changes required between 0.4.1 and 0.4.2. The actual bindings (located here) were updated for 0.4.2.

    The stack trace you show basically indicates that the HMD isn't being detected by the application. This could be for any number of reasons. Do other applications detect the Rift?
  • Cgpnz's avatar
    Cgpnz
    Honored Guest
    Why python? Does an interpreted language stuff up latency or is python compiled?
    All such system calls in the examples provided should be coded in C.

    You need a higher calling for your favourite language. We need a schema to write
    scene objects into, for such languages to be useful. Unfortunately the engines all
    seem to restrict entry into their realms as single object to be manually placed etc,
    so ensuring their commercial locked and well paid for gateways. This is to always
    feed the corporate shareholders who usually end up owning the engines and CAD systems.
  • "Cgpnz" wrote:
    Why python?


    Because that's what was asked for.

    "Cgpnz" wrote:
    Does an interpreted language stuff up latency or is python compiled?


    No, and no. Python isn't compiled (or more accurately, is compiled on demand), but the fact that it's interpreted doesn't mean it will increase the latency. Modern OpenGL largely works by loading all the required data onto the video card memory and simply executing commands from the CPU. Even an interpreted language is capable of making a few dozen or hundred OpenGL commands to render a scene at a reasonable framerate. No, python isn't suitable for doing lots of intensive number crunching and simulation, but it's perfectly reasonable as a glue to hold other components together.
  • Rubocop's avatar
    Rubocop
    Honored Guest
    Hello jherico!
    Please, can you describe a way how to install python binding <for noob> :mrgreen: ?
    I'm not a expierenced programmer .. just have some scripting background.. And I don't know C++ at all.. (have a plan to dive in to it though..)
    So, If I can play with Oculus via python - that's a great news for me!

    PS: OMG! I just checked your blog!... how many usefull things there! Thanx Brad!
    PPS: Ha! looks like I got it to work! Nevertheless - i try to execute your example code and get a identical error message , that was posted earlier.. I tried it without Oculus connected... so.. lets continue.. :)

    Update:
    I've plugged in my dk2 and executed RiftDemo.py and get this error:

    not cutted image: http://snag.gy/IfK89.jpg

    PPPS: I've buying your book. Looks like thi is exactly what I need to start with Oculus dev's fun :)