Log in or register to post comments

Update from 4.105 to 4.2.3, no tracking in Android

June 19, 2015 - 3:58am #1

Hello,

I'm using Unity 5.1.1 on a Nexus 5 with 4.105, and using:

IEnumerable<TrackableBehaviour> activeTrackables = sm.GetActiveTrackableBehaviours();

activeTrackables is set to 1 when my marker is tracked and everything works, on PC with webcam and on Android.

I've updated to Vuforia 4.2.3, entered the new longer Licence key, and run on PC, activetrackables is set to 1 and my app works.

When used on Android, activetrackables is always 0, my marker doesn't get tracked.

Any hint? bug or I'm doing something wrong?

Thanks,

Mattia

 

Update from 4.105 to 4.2.3, no tracking in Android

June 23, 2015 - 7:40am #11

Ok I found the issue, and is that in 4.2.3 in file DataSetLoadBehaviour.cs this part:

        void Awake()
        {
            #if UNITY_ANDROID
            AddOSSpecificExternalDatasetSearchDirs();
#endif //UNITY_ANDROID
        }

is missing.
Was present in 4.105.

Without this, AddOSSpecificExternalDatasetSearchDirs(); never gets called, and without that not even:

AddExternalDatasetSearchDir(externalStorageDirectory + "/Android/data/" + packageName + "/files/QCAR/");

and this explains while my extracted dataset never get loaded.

I copied that part in 4.2.3 DataSetLoadBehaviour.cs and now it's working.

Why the brand new project was working with split binary without modification? I have no idea.
Maybe the size of the split binary makes the difference? (600kb in the test project, 99Mb in mine)

It seems that I solved for now, but you should investigate why the Awake part was removed.
Is AddOSSpecificExternalDatasetSearchDirs(); called anywhere else?

thanks for the help!

 

 

Update from 4.105 to 4.2.3, no tracking in Android

June 23, 2015 - 7:24am #10

Hi,

...Done that, and starting from scratch with a basic project (load and main scene, dataset extraction) works with both binary and split binary, now I'm trying to trace the problem in my code...

 

Ok, this confirms at least that the API still works as expected in 4.2.3.

 

Now, coming to the specific issue of your project, you can check whether the Dataset exists with the Dataset/.Exists() API, see:

https://developer.vuforia.com/resources/api/unity/class_vuforia_1_1_data_set

This should tell you if the Dataset has been loaded (although your latest test code suggests it is not).

 

One thing I suspect is that perhaps something else might go wrong before even reaching the Dataset loading point, which you should be able to identify by analyzing the logs...

 

as a second suggestion, have you tried starting from the basic simple project that works and gradually add stuff on it, to spot what causes the issue ?

 

Update from 4.105 to 4.2.3, no tracking in Android

June 23, 2015 - 7:04am #9

Hello

AlessandroB wrote:

Have you checked that:

  • the Split Binary option is still enabled in the Android Player Settings, after you  upgraded from 4.0.105 to 4.2.3 ?

Yes, the fact itself that I enable the split binary, breaks my project.
Actually, coming from 4.105, with split binary, was working, then I upgraded and stopped.
I tried to disable split binary, and works, with 4.2.3.

AlessandroB wrote:
  • the Load Dataset XXX and Activate Dataset XXX checkboxes are still enabled in the ARCamera inspector ?

Yes, always.

AlessandroB wrote:

One thing to also test would be to create a new project with a minimal repro case that uses those scripts to extract and load the datasets, using the Split Binary option; this would allow excluding that the issue might have been caused by a migration / upgrade issue (e.g. something that might have gone wrong when upgrading from 4.0.105 to 4.2.3)

Done that, and starting from scratch with a basic project (load and main scene, dataset extraction) works with both binary and split binary, now I'm trying to trace the problem in my code if it's there, so I've added:

IEnumerable<TrackableBehaviour> trackables = sm.GetTrackableBehaviours();
IEnumerable<TrackableBehaviour> activeTrackables = sm.GetActiveTrackableBehaviours();

in the update function, and results using:
- no split binary: trackables.Count() = 2 and activeTrackables.Count()=1 when tracking
- split binary: trackables.Count() = 0 and activeTrackables.Count()=0 never tracking

What function can I use to check if my dataset is actually loaded? it seems is not.
And if not, how can I try to reload it by code, and try/catch what goes wrong?

UPDATE:

ObjectTracker objectTracker = TrackerManager.Instance.GetTracker<ObjectTracker>();
IEnumerable<DataSet> datasets = objectTracker.GetDataSets();
IEnumerable<DataSet> activeDataSets = objectTracker.GetActiveDataSets();

datasets.Count() and activeDataSets.Count() both = 0 with split binary.
1 and 1 with 4.2.3 no split binary, or with 4.105 split binary.

ARCamera.SetActive(true) happens several seconds after the extraction, when I press a button.

thanks

 

Update from 4.105 to 4.2.3, no tracking in Android

June 22, 2015 - 8:53am #8

Have you checked that:

  • the Split Binary option is still enabled in the Android Player Settings, after you  upgraded from 4.0.105 to 4.2.3 ?
  • the Load Dataset XXX and Activate Dataset XXX checkboxes are still enabled in the ARCamera inspector ?

One thing to also test would be to create a new project with a minimal repro case that uses those scripts to extract and load the datasets, using the Split Binary option; this would allow excluding that the issue might have been caused by a migration / upgrade issue (e.g. something that might have gone wrong when upgrading from 4.0.105 to 4.2.3)

 

Update from 4.105 to 4.2.3, no tracking in Android

June 22, 2015 - 8:08am #7

Not a timing issue. After the initial loading my app enters a menu with a normal camera, and only after I press a button I activate the ARCamera, so a few seconds pass.

And never had this issue with 4.105.

My files mydataset.dat and mydataset.xml are extracted to /sdcard/Android/data/com.mycompany.mypackage/files/QCAR (and are there, I checked).

Is it the correct location? Is there any other place where vuforia may be looking for the files? (because I'm quite convinced by now that the problem is that Vuforia doesn't find/load the dataset when I split the binary)

Is there a function I can use to force the load, giving path and filenames?

thanks

 

Update from 4.105 to 4.2.3, no tracking in Android

June 22, 2015 - 7:49am #6

Nothing should have change between 4.0.105 and 4.2.3 in that regard.

Could it be just a timing issue, i.e. the files are extracted on the sd card, but the device OS does not really complete the file writing (on storage) before Vuforia attempts to read them when you load the new scene ?

A simple test to check this would be to wait a few milliseconds before actually Loading the Vuforia scene; this could be done in Unity with a StartCoroutine and using a WaitForSeconds( ... );

 

Update from 4.105 to 4.2.3, no tracking in Android

June 22, 2015 - 3:49am #5

Thanks for the suggestion, but Vuforia was started but still not tracking.

But I found that with splitting binary doesn't work, withhout it works.

Problem is that with 4.105, with the following code:

string[] filesInOBB = { "mydataset.dat""mydataset.xml" };
        foreach (var filename in filesInOBB)
        {
            string uri = Application.streamingAssetsPath + "/QCAR/" + filename;
 
            string outputFilePath = Application.persistentDataPath + "/QCAR/" + filename;
            if (!Directory.Exists(Path.GetDirectoryName(outputFilePath)))
                Directory.CreateDirectory(Path.GetDirectoryName(outputFilePath));
 
            var www = new WWW(uri);
            yield return www;
 
            Save(www, outputFilePath);
            yield return new WaitForEndOfFrame();
        }
 
        // When done extracting the datasets, Start Vuforia AR scene
        if (!error)
        {

            Application.LoadLevel("Main");
        }
        else
        {
            panelError.SetActive(true);
            Text text = GameObject.Find("Text").GetComponent<Text>();
            text.text = errorText;            
        }

dataset was correctly extracted.

I checked on the phone, and dat and xml are correctly extracted in that directory, but with 4.2.3 they seems to be not picked up.

So far, with my tests:
4.105: PC, Android (splitted binary yes and no) all work

4.2.3: PC, Android not splitted works, and Android splitted doesn't work
 

Any more suggestions?
Has 4.2.3 changed the directory where I'm supposed to extract the dataset?

 

Thanks

Update from 4.105 to 4.2.3, no tracking in Android

June 22, 2015 - 2:54am #4

...Is there a code I can run in my update function, along with...

 

you can register a Vuforia started callback, something like:

private bool mVuforiaStarted = false;

void Start() {
    QCARBehaviour vuforia = FindObjectOfType<QCARBehaviour>();
    vuforia.RegisterQCARStartedCallback ( OnVuforiaStarted );
}

private void OnVuforiaStarted() {
    mVuforiaStarted = true;
}

Then you can query the mVuforiaStarted boolean flag in your update function, to know whether Vuforia is currently running.

 

 

Update from 4.105 to 4.2.3, no tracking in Android

June 22, 2015 - 2:27am #3

Hello , I tried everything but still not working on Android.

I tried deletion of Library folder, that has been rebuilt at next start.

And reset alle Load, Artivate, imageTargets... but no effect.
But I don't think that it can depends on those settings, because when running on my PC with the webcam, works perfectly.

Is there a code I can run in my update function, along with

IEnumerable<TrackableBehaviour> activeTrackables = sm.GetActiveTrackableBehaviours();

to check that vuforia is operative, I mean that my dataset is loaded and active?
I suspect that the problem is with the dataset.

PS. maybe off topic, but is there any way also to have Unity run in debug mode, app running on device, and hierarchy and inspector attacched to the process running on device?
I know how to do that with script debugging with VisualStudio, with SyntaxTree plugin, I wonder if it is possibly with the Unity editor itself.

Thanks.
 

Update from 4.105 to 4.2.3, no tracking in Android

June 20, 2015 - 11:47pm #2

The API you mention works correctly in 4.2.3; probably here you're simply facing some migration / upgrade issue.

Try the following:

- close the Unity project

- delete the Library folder under your project

- re-open Unity (this will automatically generate a new "Library" folder)

- verify that you don't have any compile error in the Unity Editor console

- rebuild and run

If it still does not work, you can remove the ARCamera object from your scene and re-drag it again into the scene (and re-configure it with any additional custom components / scripts you might need to have in your ARCamera);

Aslo, make sure to check that the "Load Data Set XXX" and "Activate Data Set XXX" are selected in the ARCamera inspector. Finally, for any Target in your scene, you may want to re-select the Dataset and target in the inspector.

HTH.

 

 

 

Log in or register to post comments