Log in or register to post comments

Using both TMS-generated targets and UDT at the same time

December 21, 2012 - 12:21pm #1

I'm trying to simultaneously use targets generated online via TMS while also using targets that I'm capturing locally with UDT.

At the start TMS works, but once I try a UDT capture that fails the first time and then the second attempt at UDT works.  TMS does not work alongside UDT at any point though.

Hopefully you can point me in the right direction on how to setup my dataset initilizations so I can use both at the same time.

 

Initiate via UDTQCARUtils:

qUtils = [UDTQCARutils getInstance];

Call loadTrackTMSUDT:

case APPSTATUS_LOAD_TRACKER:

                NSLog(@"APPSTATUS_LOAD_TRACKER");

                // Load tracker data             

                [self performSelectorInBackground:@selector(loadTrackerTMSUDT) withObject:nil];

                break;

This code resides in QCARUtils and have copied in the dataset initialization from UDTQCARUtils

</p><p>- (<span class="s1">void</span>)loadTrackerTMSUDT</p><p class="p1">{</p><p class="p2"><span class="s2">    </span>// Background thread must have its own autorelease pool</p><p class="p3"><span class="s2">    </span>NSAutoreleasePool<span class="s2">* pool = [[</span>NSAutoreleasePool<span class="s2"> </span><span class="s3">alloc</span><span class="s2">] </span><span class="s3">init</span><span class="s2">];</span></p><p class="p1">    <span class="s1">BOOL</span> haveLoadedOneDataSet = <span class="s1">NO</span>;</p><p class="p4">    </p><p class="p5"><span class="s2">    </span><span class="s1">if</span><span class="s2"> (</span><span class="s4">targetType</span><span class="s2"> != </span>TYPE_FRAMEMARKERS<span class="s2">)</span></p><p class="p1">    {</p><p class="p2"><span class="s2">        </span>// Load all the requested datasets</p><p class="p1">        <span class="s1">for</span> (<span class="s4">DataSetItem</span> *aDataSet <span class="s1">in</span> <span class="s4">targetsList</span>)</p><p class="p1">        {</p><p class="p1">            <span class="s1">if</span> (aDataSet.<span class="s4">path</span> != <span class="s1">nil</span>)</p><p class="p1">            {</p><p class="p1">                aDataSet.<span class="s4">dataSet</span> = [<span class="s1">self</span> <span class="s5">loadDataSet</span>:aDataSet.<span class="s4">path</span>];</p><p class="p1">                <span class="s1">if</span> (haveLoadedOneDataSet == <span class="s1">NO</span>)</p><p class="p1">                {</p><p class="p1">                    <span class="s1">if</span> (aDataSet.<span class="s4">dataSet</span> != <span class="s1">nil</span>)</p><p class="p1">                    {</p><p class="p2"><span class="s2">                        </span>// activate the first one in the list</p><p class="p1">                        [<span class="s1">self</span> <span class="s5">activateDataSet</span>:aDataSet.<span class="s4">dataSet</span>];</p><p class="p1">                        haveLoadedOneDataSet = <span class="s1">YES</span>;</p><p class="p1">                    }</p><p class="p1">                }</p><p class="p1">            }</p><p class="p1">        }</p><p class="p4">        </p><p class="p2"><span class="s2">        </span>// Check that we've loaded at least one target</p><p class="p1">        <span class="s1">if</span> (!haveLoadedOneDataSet)</p><p class="p1">        {</p><p class="p6"><span class="s2">            </span><span class="s3">NSLog</span><span class="s2">(</span>@"QCARutils: Failed to load any target"<span class="s2">);</span></p><p class="p1">            <span class="s4">appStatus</span> = <span class="s5">APPSTATUS_ERROR</span>;</p><p class="p5"><span class="s2">            </span><span class="s4">errorCode</span><span class="s2"> = </span>QCAR_ERRCODE_LOAD_TARGET<span class="s2">;</span></p><p class="p1">        }</p><p class="p1">    }</p><p class="p4">    </p><p class="p4">    ////////// UDT</p><p class="p6"><span class="s2">    </span><span class="s3">NSLog</span><span class="s2">(</span>@"UDTQCARutils: LoadTrackerData"<span class="s2">);</span></p><p class="p4">    </p><p class="p2"><span class="s2">    </span>// Get the image tracker:</p><p class="p7"><span class="s2">    </span>QCAR<span class="s2">::</span>TrackerManager<span class="s2">& trackerManager = </span>QCAR<span class="s2">::</span>TrackerManager<span class="s2">::</span><span class="s5">getInstance</span><span class="s2">();</span></p><p class="p7"><span class="s2">    </span>QCAR<span class="s2">::</span>ImageTracker<span class="s2">* imageTracker = </span><span class="s1">static_cast</span><span class="s2"><</span>QCAR<span class="s2">::</span>ImageTracker<span class="s2">*>(</span></p><p class="p1">                                                                        trackerManager.<span class="s5">getTracker</span>(<span class="s4">QCAR</span>::<span class="s4">Tracker</span>::<span class="s5">IMAGE_TRACKER</span>));</p><p class="p1">    <span class="s1">if</span> (imageTracker != <span class="s1">nil</span>)</p><p class="p1">    {</p><p class="p2"><span class="s2">        </span>// Create the data set:</p><p class="p1">        <span class="s4">dataSetUserDef</span> = imageTracker-><span class="s5">createDataSet</span>();</p><p class="p1">        <span class="s1">if</span> (<span class="s4">dataSetUserDef</span> != <span class="s1">nil</span>)</p><p class="p1">        {</p><p class="p1">            <span class="s1">if</span> (!imageTracker-><span class="s5">activateDataSet</span>(<span class="s4">dataSetUserDef</span>))</p><p class="p1">            {</p><p class="p6"><span class="s2">                </span><span class="s3">NSLog</span><span class="s2">(</span>@"Failed to activate data set."<span class="s2">);</span></p><p class="p1">                <span class="s4">appStatus</span> = <span class="s5">APPSTATUS_ERROR</span>;</p><p class="p5"><span class="s2">                </span><span class="s4">errorCode</span><span class="s2"> = </span>QCAR_ERRCODE_LOAD_TARGET<span class="s2">;</span></p><p class="p1">            }</p><p class="p1">        }</p><p class="p1">    }</p><p class="p4">    </p><p class="p6"><span class="s2">    </span><span class="s3">NSLog</span><span class="s2">(</span>@"Successfully loaded and activated data set."<span class="s2">);</span></p><p class="p4">    </p><p class="p4"> </p><p class="p2"><span class="s2">    </span>// Continue execution on the main thread</p><p class="p5"><span class="s2">    </span><span class="s1">if</span><span class="s2"> (</span><span class="s4">appStatus</span><span class="s2"> != </span>APPSTATUS_ERROR<span class="s2">)</span></p><p class="p8"><span class="s2">        [</span><span class="s1">self</span><span class="s2"> </span>performSelectorOnMainThread<span class="s2">:</span><span class="s1">@selector</span><span class="s2">(bumpAppStatus) </span>withObject<span class="s2">:</span><span class="s1">nil</span><span class="s2"> </span>waitUntilDone<span class="s2">:</span><span class="s1">NO</span><span class="s2">];</span></p><p class="p4">    </p><p class="p1">    [pool <span class="s3">release</span>];</p><p class="p1">}</p><p>

LOG

TMS works fine at start:

 

INFO/AR(130) 2012-12-21 15:03:52: ImageTracker: Successfully created dataset
Successfully loaded data set.
Successfully activated data set.
UDTQCARutils: LoadTrackerData
INFO/AR(130) 2012-12-21 15:03:52: ImageTracker: Successfully created dataset
Successfully loaded and activated data set.
 
UDT fails upon first try (no TMS):
RefFreeFrame startImageTargetBuilder()
#DEBUG actionButtonPressed
TRYING UserTarget-1
#DEBUG camera button tapped
 Built target, reactivating dataset with new target
RefFreeFrame stopImageTargetBuilder()
 Attempting to transfer the trackable source to the dataset
 ERROR/AR(130) 2012-12-21 15:04:57: Failed to create Trackable because the dataset is  currently active.
 ERROR/AR(130) 2012-12-21 15:04:57: ImageTracker: Failed to activate data set because the data set is already active.
UDT works on second try, but no TMS dataset active
#DEBUG actionButtonPressed
RefFreeFrame startImageTargetBuilder()
#DEBUG add button tapped
#DEBUG badFrameQuality
#DEBUG goodFrameQuality
#DEBUG actionButtonPressed
TRYING UserTarget-2
#DEBUG camera button tapped
 Built target, reactivating dataset with new target
RefFreeFrame stopImageTargetBuilder()
 Attempting to transfer the trackable source to the dataset
 INFO/AR(130) 2012-12-21 15:05:12: Successfully created ImageTarget.

Thank you.

December 23, 2012 - 7:37am #4

Thank you.

I posted in iOS - thanks.

December 22, 2012 - 7:37am #3

I posted in iOS - thanks.

pPlease Post on iOS section

December 22, 2012 - 7:31am #2

Hi, could you post this question in the iOS section of the Forum (you will get prompt reply from there on iOS related questions)

https://developer.vuforia.com/forum/ar-technical-discussion/vuforia-sdk/ios

Thank you.

Log in or register to post comments