Log in or register to post comments

Destroying DataSet from File

May 23, 2013 - 5:42pm #1

I have a xml and dat file which I'm loading into the scene following the method described in Swappable Databases (https://developer.vuforia.com/resources/dev-guide/swappable-databases-unity). Loading the DataSet goes fine, as does deactivating it when I choose to. However, destroying the DataSet throws the following errors on iOS:

2013-05-23 14:20:51.083 vutest[4771:907] ERROR/AR(4771) 2013-05-23 14:20:51: Failed to destroy a Trackable because this dataset contains trackables loaded from a dataset file.

2013-05-23 14:20:51.084 vutest[4771:907] ERROR/AR(4771) 2013-05-23 14:20:51: Failed to destroy Trackable 'random3'.

Could not destroy trackable with id 1.

In the Unity Editor, the only error I recieve is the final one ("Could not destroy trackable with id 1."). I have tried a blank scene, importing Vuforia, and performing these steps, and end up with the same errors.

Any idea to what I am doing wrong?

Destroying DataSet from File

January 9, 2015 - 10:01am #8
Hi, try this way,

 // Destroy all active datasets
 private void DestroyDataSets()
 {

  ImageTracker imageTracker = (ImageTracker)TrackerManager.Instance.GetTracker<ImageTracker>();

  List<DataSet> dataSets = imageTracker.GetActiveDataSets ().ToList ();
  
  for (int i = 0; i < dataSets.Count; i++) 
  {

   StateManager stateManager = TrackerManager.Instance.GetStateManager ();
   List<TrackableBehaviour> tb = stateManager.GetTrackableBehaviours().ToList();
   foreach (TrackableBehaviour t in tb) 
   {
    if (dataSets [i].Contains (t.Trackable)) 
    {
     stateManager.DestroyTrackableBehavioursForTrackable (t.Trackable, true);
    }
   }

   imageTracker.DeactivateDataSet (dataSets [i]);
   imageTracker.DestroyDataSet(dataSets[i], true);

  }
 
 }

 

 

 

Destroying DataSet from File

August 20, 2014 - 7:18am #7

Well I got to destroy the targets doing this. 

        StateManager stateManager = TrackerManager.Instance.GetStateManager ();

        stateManager.DestroyTrackableBehavioursForTrackable (trackableBehaviour.Trackable);

But you only can destroy the targets created by hand.

when you have a dataSet with more targets than the targets you have created in the scene Vuforia create target automatically for all the missing targets, you can not destroy those targets without Errors. 

The solution is to have in the DataSet  only the targets that you actually are going to use, Voforia is trying to recognize all of them even if you did not create the target in the scene.

 
 

Destroying DataSet from File

May 13, 2014 - 7:17am #6

I'm having exactly the same problem. Has anyone found a solution yet?

 

Destroying DataSet from File

May 28, 2013 - 11:37am #5

I've done that in the past, yielding the same results. To double check, I did it again, and I still get the error: Could not destroy trackable with id 3.

Destroying DataSet from File

May 28, 2013 - 9:47am #4

Can I just check that you have stopped the tracker first?

 

N

Destroying DataSet from File

May 24, 2013 - 10:31am #3

Thank you, Nalin.

 

I've tried going about this several ways. Currently I'm doing this:

 

ImageTracker imageTracker = (ImageTracker)TrackerManager.Instance.GetTracker(Tracker.Type.IMAGE_TRACKER);

List<DataSet> dataSets = imageTracker.GetActiveDataSets().ToList();

for (int i = 0; i < dataSets.Count; i++) {

imageTracker.DeactivateDataSet(dataSets[i]);

}

 

Though imageTracker.DestroyAllDataSets(true) should deactivate them as well.

Whether I use the above after the loop, or imageTracker.DestoryDataSet(ds, true) in the loop, it results in the same error.

 

Edit: List for range checking.

Destroying DataSet from File

May 24, 2013 - 3:00am #2

Is the dataset that you are looking to destroy the currently active one?

If so that could be the problem.

You need to call this before you destroy it.

ImageTracker.Deactivate(DataSet dataset);

 

HTH

N

 

 

Log in or register to post comments