[vtkusers] SynchroGrab4D, vtk Polaris tracking

luta sharmaatul11 at gmail.com
Sat Jul 18 00:56:54 EDT 2015


Dear David,
Thank you so much for your help. I followed your instructions and got some
success in moving ahead. However, I am NOT able to get the 3D position of
the markers. I get the values +00 or some random values when I apply the
command "Command("3D:011")" . I was expecting it to be x,y,z coordinate
value with the error value. Following is the current status of the code and
the results. Our team and I really appreciate your kind help. 

#include <vtkConeSource.h>
#include <vtkPolyData.h>
#include <vtkSmartPointer.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkRenderWindowInteractor.h>
#include "vtkNDITracker.h"
#include <string>
#include "ndicapi.h"
#include "vtkMatrix4x4.h"
#include "vtkTrackerTool.h"
using namespace std;

class Starttracker_aks 
{
vtkNDITracker* newtracker;
int x;
int tool;
const char *filename;
public:
void asignvalues()
		{ // setting up the tracker 
			newtracker
		=  vtkNDITracker::New();
		tool=3;
		filename=
"C:\\ATUL_WORKS\\SOFTWARES\\vtkptog\\Cone\\Cone_Aks\\ToolKit\\8700340Probe.rom";
		string versionname;
		int serialname;
		newtracker->SetSerialDevice("COM5:");
		newtracker->Probe(); 
		// get the values from the tracker
		cout <<"GetSerialPort:\t "<< newtracker->GetSerialPort() << "\n";
		cout <<"GetSerialDevice:\t "<< newtracker->GetSerialDevice() << "\n";
		cout <<"GetBaudRate:\t "<< newtracker->GetBaudRate() << "\n";
		// load tools
		newtracker->LoadVirtualSROM(tool,filename);
		// check status of the tracker
		int statust= newtracker->IsTracking() ;
		newtracker->Command("BEEP:1");
		*// start tracking and activate the tool handles*
		*newtracker->StartTracking();
		newtracker->Update();
		cout <<"updaterate rate:\t "<< newtracker->GetInternalUpdateRate()  <<
"\n";
		// get the 3D positions of the tool
		for(int k=1;k<3;k++)
		{
		cout << "3D coordinates:\t" << newtracker->Command("3D:011")<< "\n";
		}*
		// get world calibration matrix:
		cout << "GetWorldCalibrationMatrix:\t"<< "\n";
		vtkMatrix4x4* matrixw=newtracker->GetWorldCalibrationMatrix();
		for(int i =0 ; i<4;i++) {
			for(int j =0 ; j<4;j++){
				cout << matrixw->GetElement(i,j) << "\t" ;
			}
			cout << "\n";
		}
		// Check the current status of the tracke and tool
		versionname=GetVersion();

		vtkTrackerTool* gettool;
		gettool=newtracker->GetTool(tool);

		cout <<"Is the tracker Missing:\t "<< gettool->IsMissing() << "\n";
		cout <<"gettool variable:\t "<< gettool << "\n";
		cout <<"Version:\t "<< newtracker->GetVersion() << "\n";
		statust= newtracker->IsTracking() ;
		cout <<"current running Status:\t "<< statust << "\n";
		double updaterate= newtracker->GetInternalUpdateRate();
		cout <<"current updaterate Status:\t "<< updaterate << "\n";
		cout <<"ECHO:\t "<< newtracker->Command("ECHO:Tracker Running") << "\n";
		}
};

int main(int, char *[])
{  //  ndicapi* yourdevice;
Starttracker_aks statr;
statr.asignvalues();
return EXIT_SUCCESS; 
}

<http://vtk.1045678.n5.nabble.com/file/n5732969/ErrorDay2.jpg> 



--
View this message in context: http://vtk.1045678.n5.nabble.com/SynchroGrab4D-vtk-Polaris-tracking-tp4600704p5732969.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list