<div dir="ltr">Hi Atul,<div><br></div><div>Get the tool positions from the vtkTrackerTool objects.  For example:</div><div><br></div><div>for (int k = 0; k < 10000; k++)</div><div>  {</div><div>  vtkTransform *toolTransform = gettool->GetTransform();</div><div>  double position[3] = { 0.0, 0.0, 0.0 };</div><div>  toolTransform->TransformPoint(position, position);</div><div>  if (gettool->IsMissing())</div><div>      {</div><div>      cout << "MISSING" << endl;</div><div>      }</div><div>  else</div><div>      {</div><div>      cout << position[0] << " " << position[1] << " " << position[2] << endl;</div><div>      }</div><div><div>  ::Sleep(200); // wait for 200 milliseconds before trying again<br></div></div><div>  }</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 17, 2015 at 10:56 PM, luta <span dir="ltr"><<a href="mailto:sharmaatul11@gmail.com" target="_blank">sharmaatul11@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear David,<br>
Thank you so much for your help. I followed your instructions and got some<br>
success in moving ahead. However, I am NOT able to get the 3D position of<br>
the markers. I get the values +00 or some random values when I apply the<br>
command "Command("3D:011")" . I was expecting it to be x,y,z coordinate<br>
value with the error value. Following is the current status of the code and<br>
the results. Our team and I really appreciate your kind help.<br>
<span class=""><br>
#include <vtkConeSource.h><br>
#include <vtkPolyData.h><br>
#include <vtkSmartPointer.h><br>
#include <vtkPolyDataMapper.h><br>
#include <vtkActor.h><br>
#include <vtkRenderWindow.h><br>
#include <vtkRenderer.h><br>
#include <vtkRenderWindowInteractor.h><br>
#include "vtkNDITracker.h"<br>
#include <string><br>
#include "ndicapi.h"<br>
</span>#include "vtkMatrix4x4.h"<br>
#include "vtkTrackerTool.h"<br>
<span class="">using namespace std;<br>
<br>
class Starttracker_aks<br>
</span><span class="">{<br>
vtkNDITracker* newtracker;<br>
int x;<br>
int tool;<br>
const char *filename;<br>
</span>public:<br>
void asignvalues()<br>
                { // setting up the tracker<br>
                        newtracker<br>
                =  vtkNDITracker::New();<br>
                tool=3;<br>
                filename=<br>
"C:\\ATUL_WORKS\\SOFTWARES\\vtkptog\\Cone\\Cone_Aks\\ToolKit\\8700340Probe.rom";<br>
<span class="">                string versionname;<br>
                int serialname;<br>
                newtracker->SetSerialDevice("COM5:");<br>
</span>                newtracker->Probe();<br>
                // get the values from the tracker<br>
                cout <<"GetSerialPort:\t "<< newtracker->GetSerialPort() << "\n";<br>
                cout <<"GetSerialDevice:\t "<< newtracker->GetSerialDevice() << "\n";<br>
                cout <<"GetBaudRate:\t "<< newtracker->GetBaudRate() << "\n";<br>
                // load tools<br>
                newtracker->LoadVirtualSROM(tool,filename);<br>
                // check status of the tracker<br>
                int statust= newtracker->IsTracking() ;<br>
                newtracker->Command("BEEP:1");<br>
                *// start tracking and activate the tool handles*<br>
                *newtracker->StartTracking();<br>
                newtracker->Update();<br>
                cout <<"updaterate rate:\t "<< newtracker->GetInternalUpdateRate()  <<<br>
"\n";<br>
                // get the 3D positions of the tool<br>
                for(int k=1;k<3;k++)<br>
                {<br>
                cout << "3D coordinates:\t" << newtracker->Command("3D:011")<< "\n";<br>
                }*<br>
                // get world calibration matrix:<br>
                cout << "GetWorldCalibrationMatrix:\t"<< "\n";<br>
                vtkMatrix4x4* matrixw=newtracker->GetWorldCalibrationMatrix();<br>
                for(int i =0 ; i<4;i++) {<br>
                        for(int j =0 ; j<4;j++){<br>
                                cout << matrixw->GetElement(i,j) << "\t" ;<br>
                        }<br>
                        cout << "\n";<br>
                }<br>
                // Check the current status of the tracke and tool<br>
                versionname=GetVersion();<br>
<br>
                vtkTrackerTool* gettool;<br>
                gettool=newtracker->GetTool(tool);<br>
<br>
                cout <<"Is the tracker Missing:\t "<< gettool->IsMissing() << "\n";<br>
                cout <<"gettool variable:\t "<< gettool << "\n";<br>
                cout <<"Version:\t "<< newtracker->GetVersion() << "\n";<br>
                statust= newtracker->IsTracking() ;<br>
                cout <<"current running Status:\t "<< statust << "\n";<br>
                double updaterate= newtracker->GetInternalUpdateRate();<br>
                cout <<"current updaterate Status:\t "<< updaterate << "\n";<br>
                cout <<"ECHO:\t "<< newtracker->Command("ECHO:Tracker Running") << "\n";<br>
<span class="">                }<br>
};<br>
<br>
int main(int, char *[])<br>
</span>{  //  ndicapi* yourdevice;<br>
<span class="">Starttracker_aks statr;<br>
statr.asignvalues();<br>
return EXIT_SUCCESS;<br>
}<br>
<br>
</span><<a href="http://vtk.1045678.n5.nabble.com/file/n5732969/ErrorDay2.jpg" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.com/file/n5732969/ErrorDay2.jpg</a>><br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/SynchroGrab4D-vtk-Polaris-tracking-tp4600704p5732969.html" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.com/SynchroGrab4D-vtk-Polaris-tracking-tp4600704p5732969.html</a><br>
<div class="HOEnZb"><div class="h5">Sent from the VTK - Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</div></div></blockquote></div><br></div>