Logging Sensor Data from the Oculus Rift DK2

Last year I purchased an Oculus Rift DK2 – I’d like to say I bought it as a developer, but really I just wanted to play around with virtual reality stuff. I mean, who doesn’t?

This year my final year project is centred around a “3D Viewing Platform”, or “tele-presence” system. What a perfect opportunity to put my DK2 to good use!

My part of this group project involves getting the Rift running an a single-board-computer, capturing stereoscopic images from two webcams, doing a bunch of processing with those images (maybe some OpenCV / HUD stuff) – and then figuring out a good, low-latency solution to transmit the output to the headset via wireless.

At this stage, it looks like we’ll be mounting the cameras on a servo-based camera gimbal – that’s someone else’s job, but still something I’m interested in investigating. In order to figure out the hardware and software for the gimbal system, we need to know what requirements the system has to meet – one of which is how quickly the user might want to turn their head while looking around.

Of course, this is probably the sort of thing we could have just Googled – but this is an opportunity to do some science, dammit!

We decided the best way to go about this was to strap a Rift to someone’s face, pass-through a camera feed from the front of the Rift, and see what rates they look around at while doing a few different basic tasks.

With that in mind, I’ve written a small Java-based program that reads the sensor data coming in from the DK2, and logs that data to a text file. It’s a pretty simple program, but I’ve put it up in case anyone else finds it handy.

You can find this program up on GitHub.

Figuring out an easy solution for passing through a webcam feed was a bit beyond my powers on short notice – LiveViewRift grabs a webcam feed fine, but it projects everything to a virtual screen – we need something that will fix the image to the HMD, without doing any orientation tracking.

We ended up using a Leap Motion demo passthrough app – added bonus now we can see (only) in IR! If anyone knows of a good solution for getting a webcam feed to display straight to the Rift (for both eyes / distortion etc) let me know!

We haven’t yet done any analysis on the data we’ve got – but once we do, I’ll update this post with the details.

 

3 comments

  1. Good Afternoon,

    I am a high school student currently involved in an independent research pursuit in the effects of VR on the brain. I am interested in using your program to analyze the head movements of my subjects. I am using an Oculus Rift DK2 running environments built in Unreal Engine 4 on a custom PC running Win7 and am hoping to run your program alongside my environments in order to track data points that I can then analyze using my algorithm. However, I have little experience with the Oculus. I was wondering if you would be able to advise me on how to run your program, from GitHub, alongside my Unreal Engine environments. In order to get the program to work do I need to have the environment running on the Oculus and then run your program in the command line?

    Thanks,
    Kyle

    1. Hi Kyle,

      Sounds like an interesting research project you’re doing! I’d like to help you out, but it’s been a while since I worked on this project. I was running the GitHub code inside of Eclipse, running on my MacBook. I’m not sure how cross-platform things are – but AFAIK everything should be runnable under Windows. I’d recommend against the latest commit (I started playing with networking stuff and it may be non-functional) – there’s a release 0.1 that I used successfully.

      You should be able to run the datalogger alongside UE4 – but I haven’t specifically tested this. I did have it run alongside another program that used the DK2 without issue, so I believe you’ll be all right.

      So, I’d suggest:

      • Download Eclipse
      • Open / Import Downloaded Project
      • Run Project with Rift Connected
      • Try opening before / after UE4 program is running

      If you run into a specific problem or error, let me know and I’ll try and help out.

      Best of luck with your research!
      -Chris

  2. Hi Chris,
    I would like to use your code (version 0.1) to get the head rotation while I am using the Oculus with another app (facebook spaces) but I do not manage to run the application. I am using Eclipse and I have java installed. When I run the project I get the “exception in thread main: Unable to initialize HMD” message. My Oculus Rift Dk2 is connected to the PC with the main Oculus control window open.
    Am I missing anything?
    Many thanks!
    F.

Leave a Reply to chrisbuildsadmin Cancel reply

Your email address will not be published. Required fields are marked *