Troubleshooting Vive Focus: Raw Data from Camera

SOLVED
Livio
Settler

Troubleshooting Vive Focus: Raw Data from Camera

We're working on a Unity app that uses the raw data from the Vive Focus cameras to show a "camera passthrough" experience. We use this to help the user set up our app and configure it if they're having trouble with it.

 

We used the camera passthrough sample that came with the SDK (unity plugin), and it mostly works great. But occassionally the camera data just stops working in certain builds, and we're having a very difficult time detecting what's going wrong. Here's our experience:

  1. In one build, camera data comes in. We check in our code into version control.
  2. We make changes to the project's code. Build again, this time camera doesn't work.
  3. We undo the changes we made (we tell source control to undo all changes, reverting to the build where camera was confirmed to work). Then we build again, and this time camera STILL doesn't work.

We maintain an archive of all of our builds, and when we load old builds, camera DOES work. But when we re-compile the code for those same builds, then it breaks again. There must be something outside of our source control that we're not aware of that is affecting camera. Maybe it's a bug in the build system?

 

When I look at the logs I don't see a clear error that seems related to the camera functionality. Is there a particular keyword that I should search for in the logs that might help me troubleshoot this?

 

Other things we've tried:

  • In Unity, doing Assets > Reimport All didn't fix it.
  • Doing a fresh clone of our repository DID fix it. Changing our build settings broke it again. The only settings we changed were Package Name and Product Name (we wanted to have two builds installed side-by-side for comparison). Reverting the changes to the build settings DOES NOT fix it.
  • Restarting Unity, restarting our computers, and restarting the Vive Focus has no effect.
  • Deleting the Library folder doesn't work, though we are using Unity Cache Server, which makes us think that "Reimport" would have had a greater effect, but as stated above, it didn't work either.

This does seem like a bug with the build system. Any other ideas on how to solve this?

 

Thanks.

 

_Alex
Pioneer

Re: Troubleshooting Vive Focus: Raw Data from Camera

Recently got my hands on Focus and playing with Unity, seems like I may have same problem, camera didn't work from the start even on examples. What I did basically is load CameraTexture_Test example scene, looked at the white cube, realized that I currently have no camera permissions, got them through PermissionMgr_Test example, tried to load CameraTexture_Test back just to find that it is not working anymore. ~5 seconds of completely black screen after Unity logo and then autoexit to launcher. 

Unity 2017.4.0f1, wavesdk 2.0.32, ROM 1.21.1405.1
Don't know how to check logs yet.

Vive Staff

Re: Troubleshooting Vive Focus: Raw Data from Camera

@Livio @_Alex could you use logcat to dump all logs when you hit the issue?

Not sure if it's caused by Unity version? Build system or else, thus logs may help for the hint.

Thanks.

Livio
Settler

Re: Troubleshooting Vive Focus: Raw Data from Camera

I attached two logs. One from a build where the camera works, another from a build where the camera doesn't work. When the program boots up, I print the message "WE DID IT!" to the log, so you can search for that as a marker.

 

I'm using Unity version 2017.3.1f1. Our app overrides the default Android activity (we made sure to extend WVRUnityVRActivity), both builds do this. Specifically we create an AAR file in android studio that contains our custom activity, we import that into Unity, and in Unity we configure the Android build system to use Gradle instead of "Internal" (internal runs into manifest merge issues on activity names even though the activity that triggers the error has identical package names in both manifests)

Vive Staff

Re: Troubleshooting Vive Focus: Raw Data from Camera

Please check if you include permission request code before you initial camera.

Let us know if it's resolved on your side.

Thanks.

Livio
Settler
Solution

Re: Troubleshooting Vive Focus: Raw Data from Camera

Thanks! The problem was in fact the permissions. We had defined it in the manifest, but they weren't auto-granted.

 

For troubleshooting, a quick workaround is to go into Android system menu > apps > [our app] > permissions, and then grant the camera permission manually. When installing the APK over ADB, you can add -g option to auto-grant all runtime permissions.

 

For production, you can use the WaveVR SDK sample called "VR Permissions" to display an android system prompt to the user asking for them to grant the app the appropriate permissions.

Vive Staff

Re: Troubleshooting Vive Focus: Raw Data from Camera

@Livio thanks for your great summary for both trouble shooting and formal design. I believe it's very helpful for many developers.

_Alex
Pioneer

Re: Troubleshooting Vive Focus: Raw Data from Camera

Played a little more with the rawdata and found the following:
CameraTexture is working for me as far as "Development build" option is unchecked. Which pretty much proves that I did all permissions stuff right, if I understand correctly. If I check "Development build" before building, app crashes when I'm enabling GameObject which has CameraTextureSample.cs on it, or instantly, if it is enabled from the start.

I also found another scenario. After reloading scene (by 

SceneManager.LoadScene(SceneManager.GetActiveScene().name);

), it also crashes on making Gameobject with CameraTexture active.

Message me if more info required to reproduce that behaviour

Vive Staff

Re: Troubleshooting Vive Focus: Raw Data from Camera

@_Alex I've PM you for more info., please check.

tobiaslatta
Contributor

Re: Troubleshooting Vive Focus: Raw Data from Camera

I am having the same issue with the crash of CameraTexture_Test scene when development build is ticked.

How did you resolve the problem? I am running Wave SDK 2.1.8 on Unity 2018.3.0f2