Saturday, 13 July 2013

Oculus Rift, servo-controlled camera and a bit of Raspberry Pi

I got my hands on an Oculus Rift this week (thanks Paul!). The OVR SDK is really neat and clean!

This is what I've done so far:


This runs on my desktop PC. Just out of curiosity, I tried the OVR SDK on the Raspberry Pi as well.

The ARM architecture isn't officially supported by the Oculus guys but it compiled almost OK. The only thing I had to change was a bit of assembler code. As far as understand, the "dmb" instruction doesn't exist on armv6 (which is the Pi's instruction set). After a bit of research, here is the black magic alternative I've found:

In file Kernel/OVR_Atomic.h, struct AtomicOpsRawBase (around line 100):

#elif defined(OVR_CPU_ARM)
// http://www.jonmasters.org/blog/2012/11/13/arm-atomic-operations/
#define MB()  __asm__ __volatile__ ("mcr p15, 0, r0, c7, c10, 5" : : : "memory")

struct FullSync { inline FullSync() { MB(); } ~FullSync() { MB(); } };
struct AcquireSync { inline AcquireSync() { } ~AcquireSync() { MB(); } };
struct ReleaseSync { inline ReleaseSync() { MB(); } };

Another thing I didn't fix was the name of the output directory for the lib which is still "i386".

Unfortunately, the OculusWorldDemo doesn't work. First, it doesn't find the HMD device. Also there seems to be a more global issue with X11+OpenGL on the Raspberry Pi. I haven't had a chance to look at that yet.

On the good side though, the Sensor is properly detected, and by adding few lines to the initialization code, I could get some readings...  (oh and thanks Synergy for the remote mouse! Instructions to build it for the Pi here)


The Sensor is not particularly useful on its own, but that means that the servo-controlled camera test above would also work on the Pi.

Now I need to work on displaying useful stuff on the Rift.You've probably guessed where this is all going...

5 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Pretty cool. I want to get binocular vision on an RC car or plane ;)

    ReplyDelete
  3. WoW! That is some impressive stuff u did there. how you managed to grab the HID input of the Rift on the PI?

    ReplyDelete
  4. and a tutorial fro scratch for connection using SDK and RasPi
    that will be more social and useful for all of us

    ReplyDelete