-
-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: ARCore-based position tracking #395
base: master
Are you sure you want to change the base?
Conversation
@@ -51,3 +51,7 @@ unzip download.zip | |||
rm download.zip | |||
fi | |||
|
|||
rm -r "arcore-android-sdk" | |||
curl -sLS https://github.com/google-ar/arcore-android-sdk/archive/refs/heads/main.zip > download.zip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note to self: we should probably tie this to the same version we pull in app/build.gradle.
CTX.lastOrientation = pose.orientation; | ||
} | ||
|
||
if (CTX.arcoreEnabled && CTX.arSession != nullptr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this pattern kinda sucks; ideally we'd set CTX.arcoreEnabled
to false
if arSession
fails to initialize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also getPose is called many times perframe, so you might want to deInit/init arcore contexts and other checks outside it.
a7635e5
to
efdafc2
Compare
Nice initiative, I didnt check the code yet, also i dont have a arCore supported device :c |
IIRC this isn't as simple as removing a check, each device has calibration data specific to it (and of course there's no public documentation on how to add that calibration data yourself). Could work to just copy the calibration data from another device and live with the inaccuracy (quick googling shows that people have spoofed the device information to report the Pixel 2 way back in 2019 and got it working, but that was a long time ago...) |
True that too, but whats the use of development or including arcore if only some set of devices can support it ? We need to have something for the others who dont have arcore too, i only think only 10% (assumptions) of devices in market support arcore |
The use is that the devices that support it can make use of it :D On a more serious note though - I can certainly see that this is a bit unfair, and would probably cause added burden to you as the maintainer (since you don't have a device to test this). However, I think having at least some devices able to use this is still better than not having this feature at all. I also hope that supporting one method for getting position can help with adding support for more methods in the future). (The only other currently-available method I know for tracking headset position is using an external method like PSMoveServiceEX + a LED bulb mounted to the HMD, but that's more involved than just running an app, and is difficult to do homebrew from my own experience.) Figuring out alternatives to ARCore is likely out-of-scope for this PR, though. |
I mean i dont have an issue adding this, but i dont have a way to test it (as of now) as long as you are okay with future pings for issues related to ARCore :p Also i dont think its that hard to add 6DOF by directly getting accelerometer reading, thought you have some knowhow regarding that. |
GLuint arTexture = 0; | ||
|
||
AlvrQuat lastOrientation = {0.f, 0.f, 0.f, 0.f}; | ||
float lastPosition[3] = {0.f, 0.f, 0.f}; | ||
|
||
float currentMagnetometerValues[4] = {0.f, 0.f, 0.f, 0.f}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, leftover from trying to fix orientation
/ok-to-test sha=6d74a41 |
/ok-to-test sha=b1b640d |
📷 Screenshots of tests:📱gvr: emulator-5554 - 11🔧 ALVRActivityTest_saveDeviceScreenBitmap🔧 InitActivityTest_saveDeviceScreenBitmap🔧 MainActivityTest_saveDeviceScreenBitmap🔧 SettingsActivityTest_saveDeviceScreenBitmap🔧 view-op-error-1🔧 view-op-error-2📱noGvr: emulator-5554 - 11🔧 InitActivityTest_saveDeviceScreenBitmap🔧 view-op-error-1For commit b1b640d |
@@ -17,6 +19,11 @@ using namespace nlohmann; | |||
|
|||
uint64_t HEAD_ID = alvr_path_string_to_id("/user/head"); | |||
|
|||
// TODO: Make this configurable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to make another cpp files because arcore itself seems to have a lot more glue code to use it.
Ok I got hold of a ArCore supported android device. I was expecting some moving in SteamVR home (translation) but thats seems not to be the case. How should one test this ? Also you can join #dev channel on discord for more discussion, if you are already on discord am not able to find your ID knuxify |
Partially fixes #93, fixes #311.
Enable HMD position tracking based on ARCore's motion tracking capabilities. Note that this only works on devices that support ARCore; see the official list for more information. (All devices on this list are supported, regardless of depth API support/camera resolution. Tracking accuracy may vary.)
Performance looks to be pretty good, though I am testing this on a Samsung Galaxy S23 which is pretty much a best-case scenario. The device does heat up after a while, but from what I've heard that's pretty standard for ARCore. However, as of writing, it's not stable enough yet to be actually used, which is why this PR is marked as a draft.
I'm opening this PR to get some feedback and perhaps some help with development. Here's a general TODO list:
Figure out pose scaling. Currently the actual speed of movement is a little out of wack, we will probably need to scale the values from ARCore.I've done some more testing and I think it's actually fine, but someone with more VR experience would need to test.maybe it just needs scaling? or maybeit's picked up from the first plane it identifies), so you'll usually end up clipping through the floor or just generally being very low. The ARCore geospatial API has the ability to get altitude data, but it must use Google's location APIs which is privacy-intrusive and has a ratelimit. I was also considering using the phone's barometer sensor and a short calibration process before each play session to determine the floor position and what scaling to use for anything higher than it, but I'm not sure if that's actually possible + wouldn't work on phones that don't have a barometer/pressure sensor.I saw somebody say that iVRy supports ARCore-based tracking (personally I didn't know that, I'd have to check) - if that's true, it'd be interesting to see how they tackle some of these problems.