OSVR / OSVR-Core

The core libraries, applications, and plugins of the OSVR software platform.
Apache License 2.0
330 stars 124 forks source link

Support android motion sensors as plugin, make an OSVR Android #164

Closed feilen closed 9 years ago

feilen commented 9 years ago

If we can create some form of plugin that talks to the Android API when used on an Android target, we can use the Motion Sensors part of the API: http://developer.android.com/guide/topics/sensors/sensors_motion.html to access what the phone believes the current orientation of itself is. That would allow us to support using Android without the need for root.

With that in mind, it may also be beneficial to create an Android app which acts as a simple wrapper to start the osvr_server instance when an app requests it, and close it when the app exits. This would mean not having to manually start the OSVR server via SSH, which simply goes against how Android apps are supposed to work.

You could edit the OSVR configuration inside of that app too (hopefully graphically), which seems like it would be the best way to support Android moving forward (rather than the clunky hack it currently has to use)

feilen commented 9 years ago

Hopefully this evening, although I won't make any promises, I'll see what I can do to figure out how to wrap the Java-based Motion Sensors interface back into a plugin that OSVR can use. I've had some experience with wrapping using SWIG, but SWIG is generally intended for wrapping C++ libraries and letting a Java/C#/etc program access them, rather than the other way around.

rpavlik commented 9 years ago

You might find some inspiration in one of the VRPN Android projects, that I believe did that (the sensor thing). Think it's this file and neighboring code - was a course project, so there's docs and things. https://github.com/vrpn/vrpn/blob/master/vrpn_android/comp523android/src/edu/unc/cs/vrpn/AccelerometerListener.java

Would be nice if Google's Cardboard tracking stuff (which I get the impression extends the built-in sensors somehow) could be plugged in.

I think the idea for Android going forward is to have a service and a GUI, yes, but not necessarily related to this code.

feilen commented 9 years ago

Oh, perfect! That's probably exactly what I'm looking for. I may even be able to restructure the oculus-rift plugin to use this, since it already uses VRPN.

rpavlik commented 9 years ago

Have you had a chance to work on this at all?

feilen commented 9 years ago

I unfortunately have not. I did manage to root my phone, but I've been rather tied up with my job and some community events on Steam.

I was hoping to do it on the weekend but I haven't had a free weekend since last month. Have you got any news?

On Tue, Jul 14, 2015 at 12:45 PM, Ryan Pavlik notifications@github.com wrote:

Have you had a chance to work on this at all?

— Reply to this email directly or view it on GitHub https://github.com/OSVR/OSVR-Core/issues/164#issuecomment-121304617.

feilen commented 9 years ago

It appears as though some work is already being done for this on the OSVR Android Build git. Excellent! I'll see if there isn't a chance I can improve the Linux build system/paths instead, since that was the next thing on my list.

rpavlik commented 9 years ago

The server app would also be useful, probably more useful than the Linux build system at the moment (those are quick updates for me when I get a chance).

JeroMiya commented 9 years ago

There is now a simple plugin for Android which uses the built-in sensors for head-tracking. It's using the built in sensor fusion from android (the software rotation vector sensor). There need to be some enhancements in the long term, such as predictive tracking and custom sensor fusion/filtering like the Cardboard SDK does, but it's usable: https://github.com/OSVR/OSVR-Android-Plugins