Log in or register to post comments

Use a Marker with Vuforia to initialize a Calibration for a HoloLens Scene

December 13, 2018 - 10:20am #7

Hi

What I want:

A Marker, which should be the (0,0,0) point of my Scene, should be recognized with Vuforia in my scene and place an Object at this point and after that let HoloLens do the tracking work.

 

How Can I only let Vuforial do the initialize tracking and then let HoloLens do the rest?

 

What I did:

on Vuforia:

-Create a license

-Create a target database with a marker (with 5 star rating)

-Download the database unity package, startpoint.unitypackage

in Unity3D:

-Create a 3D project

-Import the HoloLens Mixed-Reality-Toolkit

-Delete everything in the Scene

-Apply MixedReality Project Settings: (target UWP, enable XR, build for direct3d, enable .net scripting backend, set default spatial mapping layer)

-Apply MixedReality Scene Settings: (Add mixed reality prefab cam, move camera to origin, add input manager, add default prefab cursor, update world space canvases)

-Apply MixedReality Capability Settings: (Microphone, Webcam, Spatial perciption, Internet Client)

Import Package: 

-Import the startpoint.unitypackage

Scene Objects: (the HoloLens Objects are already created... like SpatialMapping, DefaultCursor, InputManager, MixedRealityCamera)

-Create a ImageTarget Vuforia object

     -> In Image Target Behaviour Script settings: select startpoint Database,  and the right image target

-Create a simple Cube as a Child of the ImageTarget

-Create a Vuforia AR Camera (no changes were done)

Vuforia Configuration:

Global:

-Add App license key

-Check: Load Object Targets on Detection

Digital Eyewear:

-Device type: Digital Eyewear

-Device Config: HoloLens

Database:

-Selet the right Databse (startpoint)

 

Testing:

Running in Unity3D Player => The simple Cube is shown on the marker

Building Unity Project => Running on HoloLens => I see the normal Objects, I see the Spatial Mapping.. But when I look at the Marker, I don't see the Cube which I placed as a child to the Target Image.

 

 

What am doing wrong? How Can I only let Vuforial do the initialize tracking and then let HoloLens do the rest?

 

Use a Marker with Vuforia to initialize a Calibration for a HoloLens Scene

December 13, 2018 - 10:50pm #6

Hi,

I don't know, how you tested the marker tracking on the Hololens, but keep in mind, that the near clipping plane of the AR Camera is per default quite far away. It is possible that the tracking does work, but you just don't see the cube. Try the debug panel from the Holotoolkit for the debug logs within the Hololens.

In addition you only need one camera in your scene, so you can add the Vuforia scripts to the mixed reality camera (both are labeled as main camera on creation, but it is only allowed to have one main camera in the scene).

To your question: If you enable the device tracker in the Vuforia options you enable "extended tracking" which does what you want. It uses marker tracking if the marker is visible and sets a Hololens worldanchor if the marker tracking is lost so the objekts of the marker keep their position and Hololens does the tracking.

You can do this manually by disabling Vuforia after your initialisation and set the worldanchor yourself.

Use a Marker with Vuforia to initialize a Calibration for a HoloLens Scene

December 14, 2018 - 5:09am #5

Thank you TStb

 

I don't know, how you tested the marker tracking on the Hololens

I just Build the Unity Project and Run it on Device with Visual Studio.

I had the Marker really near of my face and also walked like 2 meters away from the marker.

 

the near clipping plane of the AR Camera is per default quite far away

The near clipping planes of the MixedRealityCamera is 0.3 (default) (hololens one)

The near clipping planes of the ARCamera is 0.05 (default) (vuforias one)

 

Try the debug panel from the Holotoolkit for the debug logs within the Hololens.

I added two Debug.Log() to DefaultTrackableEventHandler.cs Script (which is on ImageTarget object) on OnTrackingFound() and on OnTrackingLost() ... I see them when I test it in Unity Editor (with Webcam) but I don't see this logs when I test it on HoloLens Device itself (in the Debug window of Visual Studio)

In addition you only need one camera in your scene, so you can add the Vuforia scripts to the mixed reality camera

Yes I red already once in this forum that you need only one camera.. In every Tutorial which I saw, they used 2 cameras (but it was with an old version of Vuforia, Hololens, Unity.. what a mix).  => I deleted the ARCamera and added the Vuforia scripts (Vuforia Behaviour (Script), and DefaultInitializationErrorHandler) to the mixed reality Camera.

No Success.. don't see the Objects on HoloLens and now also I don't see the WebCam View in the Unity Editor Play mode and also no tracking... When I add the ARCamera again, than I see the Webcam view and the marker is also tracked.

A closer look to the logs in Visual Studio:

Loading native plugins

  Loading PlaneFinding.dll

  Loading MicStreamSelector.dll

  Loading GpuTiming.dll

  Loading SharingClient.dll

  Loading VuforiaWrapper.dll

  Loading SpatialUnderstanding.dll

  Loading Vuforia.dll

  Loading HolographicStreamerDesktop.dll

Failed to load 'HolographicStreamerDesktop', expected x86 architecture, but was Unknown architecture. You must recompile your plugin for x86 architecture.

(Filename: C:\buildslave\unity\build\Runtime/Misc/Plugins.cpp Line: 183)

UnloadTime: 5.617407 ms

'Callibrate.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\Users\DefaultAccount\AppData\Local\DevelopmentFiles\Template3DVS.Release_x86.User\System.Diagnostics.StackTrace.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

InvalidCastException: Unable to cast object of type 'EulaVersionStrings' to type 'UnityEngine.IUnitySerializable'.

   at UnityEngine.Internal.Types.$UnityType5615.$Invoke1(Int64 instance, Int64* args)

   at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)

(Filename: <Unknown> Line: 0)

ArgumentNullException: Value cannot be null.

Parameter name: source

   at System.Linq.Enumerable.Select[TSource,TResult](IEnumerable`1 source, Func`2 selector)

   at Vuforia.PlayModeEditorUtility.NullPlayModeEditorUtility.IsVuforiaActiveAndEULAAccepted()

   at Vuforia.PlatformRuntimeInitialization.InitPlatform()

   at Vuforia.PlatformRuntimeInitialization.$Invoke0(Int64 instance, Int64* args)

   at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)

(Filename: <Unknown> Line: 0)

InvalidCastException: Unable to cast object of type 'EulaVersionStrings' to type 'UnityEngine.IUnitySerializable'.

   at UnityEngine.Internal.Types.$UnityType5615.$Invoke1(Int64 instance, Int64* args)

   at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)

(Filename: <Unknown> Line: 0)

ArgumentNullException: Value cannot be null.

Parameter name: source

   at System.Linq.Enumerable.Select[TSource,TResult](IEnumerable`1 source, Func`2 selector)

   at Vuforia.PlayModeEditorUtility.NullPlayModeEditorUtility.IsVuforiaActiveAndEULAAccepted()

   at Vuforia.VuforiaRuntime.VuforiaInitialization()

   at Vuforia.VuforiaRuntime.$Invoke18(Int64 instance, Int64* args)

   at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)

(Filename: <Unknown> Line: 0)

InvalidCastException: Unable to cast object of type 'EulaVersionStrings' to type 'UnityEngine.IUnitySerializable'.

   at UnityEngine.Internal.Types.$UnityType5615.$Invoke1(Int64 instance, Int64* args)

   at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)

(Filename: <Unknown> Line: 0)

Exception in callback: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null.

Parameter name: source

   at System.Linq.Enumerable.Select[TSource,TResult](IEnumerable`1 source, Func`2 selector)

   at Vuforia.PlayModeEditorUtility.NullPlayModeEditorUtility.IsVuforiaActiveAndEULAAccepted()

   at Vuforia.VuforiaARController.Start()

   --- End of inner exception stack trace ---

   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)

   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)

   at System.Delegate.DynamicInvokeImpl(Object[] args)

   at Vuforia.DelegateHelper.InvokeDelegate(Delegate action, Object[] args)

(Filename: C:\buildslave\unity\build\Runtime/Export/Debug.bindings.h Line: 43)

Display is Transparent

(Filename: C:\buildslave\unity\build\Runtime/Export/Debug.bindings.h Line: 43)



LOOOOOST THE OBJECT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  //this is my Debug.Log() at OnTrackingLost()

 

If you enable the device tracker in the Vuforia options you enable "extended tracking" which does what you want.

You mean > activate 'Track Device Pose'? 

and 'Tracking Mode: Positional' and 'Fusion Mode: optimize for Image Targets and Vumarks'

Don't see any 'extended tracking' options in the VuforiaConfiguration.

 

You can do this manually by disabling Vuforia after your initialisation and set the worldanchor yourself.

You mean in onTrackerFound() just call (don't know yet the API) the function to disable Vuforia, right?

 

I hope I will get this "simple" task running. Thank you for ANY advice and support! <3

Use a Marker with Vuforia to initialize a Calibration for a HoloLens Scene

December 14, 2018 - 6:27am #4

Could Somebody just give me a sample project, where the settings are done? (don't forget to delete your license key) Thank you!

I found this article: https://library.vuforia.com/articles/Training/Developing-Vuforia-Apps-for-HoloLens

 

But the menue points doesn't match with the newst version. For example in The Role of Extended Tracking in the Image Target Behaviour (Script) I don't have the "Advanced" tab. 

 

Here instead of Optical See-Through, I have 'Digital Eyewear'. But I think this is not the Problem.

 

Is there an updated article for the newst version?

 

Use a Marker with Vuforia to initialize a Calibration for a HoloLens Scene

December 14, 2018 - 4:50pm #3

Hello,

Vuforia offers a HoloLens sample project on the Unity Asset Store.

Thanks,

Vuforia Engine Support

Use a Marker with Vuforia to initialize a Calibration for a HoloLens Scene

December 18, 2018 - 5:25am #2

medabit wrote:

Hello,

Vuforia offers a HoloLens sample project on the Unity Asset Store.

Thanks,

Vuforia Engine Support

 

Hi medabit, thx for the hint. I already tried the sample and canceled this plan... because of errors... Now I tried it again: 

 

- Create a new Unity3D project

- Import the Sample Holo Vuforia project from the Store

 

- Switch to UWP and build it and run it => It works!

 

==> Now I wanted to install the Mixed Reality Toolkit, but thats not possible I get this errors in the Editor:

 

Assets/HoloToolkit/Utilities/Scripts/Editor/SceneSettingsWindow.cs(129,49): error CS0576: Namespace `global::' contains a definition with same name as alias `Cursor'

Assets/HoloToolkit/Utilities/Scripts/Editor/SceneSettingsWindow.cs(132,45): error CS1061: Type `T' does not contain a definition for `gameObject' and no extension method `gameObject' of type `T' could be found. Are you missing an assembly reference?

Assets/HoloToolkit/Utilities/Scripts/Editor/SceneSettingsWindow.cs(137,94): error CS0584: Internal compiler error: The method or operation is not implemented.

 

Do I have to delete something in the sample before I can install the MixedReality Toolkit?

 

 

 

Use a Marker with Vuforia to initialize a Calibration for a HoloLens Scene

January 23, 2019 - 4:47pm #1

Hello,

The Vuforia HoloLens sample already includes a portion of the HL Toolkit.

We suggest that you determine which features of the Toolkit you want to use, in addition to the parts already included in the sample. If you import a new version, then you may have to do clean-up if there’s conflicting code.

Good luck.

-Vuforia Engine Support

Log in or register to post comments