Markers app failed to load a project when run from VS

Post Reply
martinv
Posts: 13
Joined: Tue Aug 21, 2012 5:15 am

Markers app failed to load a project when run from VS

Post by martinv » Thu Aug 23, 2012 9:55 am

Hi,

I tried the markers sample application.
I compiled it in debug with visual studio.
When I run it, it work well.
-It loads my .ttp project file
-It tracks my rigid body.

Then I decided to run it in debug mode FROM visual studio, to trace each call.
Then the TT_LoadProject return an error code: 0x00000003

Do you have any idea, why TT_LoadProject failed when I run it from visual studio ? But it succeed when I run the same application from outside visual studio ?

thank you




code of the markers sample

Code: Select all

int main(int argc, char* argv[])
{
	
    printf("== NaturalPoint Tracking Tools API Camera, Marker, Trackables Sample =======---\n");
    printf("== (C) NaturalPoint, Inc.\n\n");

    printf("Initializing NaturalPoint Devices\n");
    TT_Initialize();

    NPRESULT result;
    
    printf("Loading Project: project.ttp\n\n");
    CheckResult(TT_LoadProject("project.ttp"));

    printf("Cameras:\n");
    for(int i=0; i<TT_CameraCount(); i++)
    {
        printf("Camera #%d: %s\n", i, TT_CameraName(i));
    }

    printf("\n");

    printf("Trackables:\n");
    for(int i=0; i<TT_TrackableCount(); i++)
    {
        printf("Trackable #%d: %s\n", i, TT_TrackableName(i));
    }

    printf("\n");

    int mFrameCounter=0;

    while(!_kbhit())
    {
        result = TT_Update();

        if(result == NPRESULT_SUCCESS)
        {
            mFrameCounter++;

            if((mFrameCounter%100)==0)
            {
                printf("Frame #%d: (Markers: %d) ",mFrameCounter, TT_FrameMarkerCount());

                if(TT_TrackableCount()>0)
                {
                    float yaw,pitch,roll;
                    float x,y,z;
                    float qx,qy,qz,qw;

                    TT_TrackableLocation(0,&x,&y,&z,&qx,&qy,&qz,&qw,&yaw,&pitch,&roll);

                    if(TT_IsTrackableTracked(0))
                    {
                        printf("%s: Pos (%.2f,%.2f,%.2f) Orient (%.0f,%.0f,%.0f)\n",TT_TrackableName(0),x,y,z,yaw,pitch,roll);
                    }
                    else
                        printf("%s: Not Tracked\n",TT_TrackableName(0));
                }
                else
                    printf("\n");
            }
        }
        Sleep(1);
    }

    printf("Shuting down NaturalPoint Tracking Tools\n");
    CheckResult(TT_Shutdown());

    printf("Complete\n");
    while(!_kbhit())
    {
        Sleep(20);
    }

    TT_FinalCleanup();

	return 0;
}
Last edited by martinv on Thu Aug 23, 2012 1:05 pm, edited 0 times in total.
Reason: added code brackets

martinv
Posts: 13
Joined: Tue Aug 21, 2012 5:15 am

Re: Markers app failed to load a project when run from VS

Post by martinv » Thu Aug 23, 2012 12:45 pm

Ok I found the problem.
In visual studio, in debug mode I have forgotten to specify the working directory. So when the TT_LoadProject was started, it was not able to find the project.tpp file.

By specifying the working directory path, I can now trace the code in debug.

Post Reply