Hi, <br><br>I try to communicate with a polaris NDI. For that, I want to use IGSTK. I take the example Testing\igstkPolarisTrackerTest.cxx and I have problem at the command line trackerTool2->RequestAttachToTracker( tracker );  The stream of the polaris is : <br>


<br>24589414713.185219  :    (INFO) 0. receive[10] RESETBE6F\x0D<br>24589414713.185768  :    (INFO) 1. command[10] INIT:E3A5\x0D<br>24589414713.286034  :    (INFO) 1. receive[9] OKAYA896\x0D<br>24589414713.286579  :    (INFO) 2. command[10] VER:065EE\x0D<br>


24589414713.472214  :    (INFO) 2. receive[156] Polaris Control Firmware\x0ANDI S/N: P4-01519\x0ACharacterization Date: 03/18/08\x0AFreeze Tag: POLARIS Rev 015\x0AFreeze Date: 10/11/00\x0A(C) Northern Digital Inc.\x0AD722\x0D<br>


24589414713.472832  :    (INFO) 3. command[15] COMM:40000C075\x0D<br>24589414713.518955  :    (INFO) 3. receive[9] OKAYA896\x0D<br>24589414713.536888  :    (INFO) 4. command[24] PHRQ:*********1****A4C1\x0D<br>24589414713.558434  :    (INFO) 4. receive[12] ERROR016BC2\x0D<br clear="all">


<br>I don't understand why the tracker don't want to attach my tool.<br><br>I hope you can help me.<br>Thanks.<br><br>This is my entire code : <br><br>  igstk::RealTimeClock::Initialize();<br><br>  typedef igstk::Object::LoggerType     LoggerType;<br>


  typedef itk::StdStreamLogOutput       LogOutputType;<br>  typedef igstk::TransformObserver      ObserverType;<br><br>  if( argc < 4 )<br>    {<br>    std::cerr << " Usage: " << argv[0] << "\t" <br>


                            << "Logger_Output_filename "<br>                            << "Wireless_SROM_filename "<br>                            << "Port_Number"<br>                            << std::endl;<br>


    return EXIT_FAILURE;<br>    }<br><br><br>  igstk::PolarisTrackerTool::Pointer tool = igstk::PolarisTrackerTool::New();<br><br>  igstk::SerialCommunication::Pointer <br>                     serialComm = igstk::SerialCommunication::New();<br>


<br>  PolarisTrackerTestCommand::Pointer <br>                                my_command = PolarisTrackerTestCommand::New();<br><br>  ObserverType::Pointer coordSystemAObserver = ObserverType::New();<br>  ObserverType::Pointer coordSystemAObserver2 = ObserverType::New();<br>


<br>  std::string filename = argv[1];<br>  std::cout << "Logger output saved here:\n";<br>  std::cout << filename << "\n"; <br><br>  std::ofstream loggerFile;<br>  loggerFile.open( filename.c_str() );<br>


  std::cout<<"filename.c_str "<<filename<<std::endl;<br>  LoggerType::Pointer   logger = LoggerType::New();<br>  LogOutputType::Pointer logOutput = LogOutputType::New();  <br>  logOutput->SetStream( loggerFile );<br>


  logger->AddLogOutput( logOutput );<br>  logger->SetPriorityLevel( itk::Logger::DEBUG);<br><br>  serialComm->AddObserver( itk::AnyEvent(), my_command);<br><br>  serialComm->SetLogger( logger );<br><br>  typedef igstk::SerialCommunication::PortNumberType PortNumberType; <br>


  unsigned int portNumberIntegerValue = atoi(argv[3]);<br>  PortNumberType  polarisPortNumber = PortNumberType(portNumberIntegerValue); <br>  serialComm->SetPortNumber( polarisPortNumber );<br>  serialComm->SetParity( igstk::SerialCommunication::NoParity );<br>


  serialComm->SetBaudRate( igstk::SerialCommunication::BaudRate57600 );<br>  serialComm->SetDataBits( igstk::SerialCommunication::DataBits8 );<br>  serialComm->SetStopBits( igstk::SerialCommunication::StopBits1 );<br>


  serialComm->SetHardwareHandshake( igstk::SerialCommunication::HandshakeOff );<br><br>  serialComm->SetCaptureFileName( "RecordedStreamByPolarisTrackerTest.txt" );<br>  serialComm->SetCapture( true );<br>


<br>  serialComm->OpenCommunication();<br><br>  igstk::PolarisTracker::Pointer  tracker;<br><br>  tracker = igstk::PolarisTracker::New();<br><br>  tracker->AddObserver( itk::AnyEvent(), my_command);<br><br>  tracker->SetLogger( logger );<br>


  tracker->RequestSetFrequency(20);<br>  std::cout << "SetCommunication()" << std::endl;<br>  tracker->SetCommunication( serialComm );<br><br>  std::cout << "RequestOpen()" << std::endl;<br>


  tracker->RequestOpen();<br><br>  typedef igstk::PolarisTrackerTool         TrackerToolType;<br>  typedef TrackerToolType::TransformType    TransformType;<br><br>  // instantiate and attach wireless tracker tool<br>  std::cout << "Instantiate the tracker tool: " << std::endl;<br>


  TrackerToolType::Pointer trackerTool2 = TrackerToolType::New();<br>  trackerTool2->SetLogger( logger );<br>  //Select wireless tracker tool<br>  trackerTool2->RequestSelectWirelessTrackerTool();<br>  ////Set the port number<br>


  unsigned int portNumber2 = atoi(argv[3]); <br>  //trackerTool2->RequestSetPortNumber( portNumber2 ); <br>  //Set the SROM file <br>  std::string romFile = argv[2];<br>  std::cout << "SROM file: " << romFile << std::endl;<br>


  trackerTool2->RequestSetSROMFileName( romFile );<br> //Configure<br>  trackerTool2->RequestConfigure();<br>   trackerTool2->AddObserver( itk::AnyEvent(), my_command);<br>  //Attach to the tracker<br>  trackerTool2->RequestAttachToTracker( tracker );<br>


  //Add observer to listen to events throw by the tracker tool<br>  coordSystemAObserver2->ObserveTransformEventsFrom( trackerTool2 ); <br><br>  //start tracking <br>  tracker->RequestStartTracking();<br><br>  typedef igstk::Transform            TransformType;<br>


  typedef ::itk::Vector<double, 3>    VectorType;<br>  typedef ::itk::Versor<double>       VersorType;<br><br><br>  for(unsigned int i=0; i<100; i++)<br>    {<br>    igstk::PulseGenerator::CheckTimeouts();<br>


<br>    TransformType             transform;<br>    VectorType                position;<br><br> /*   coordSystemAObserver->Clear();<br>    trackerTool->RequestGetTransformToParent();<br>    if (coordSystemAObserver->GotTransform())<br>


      {<br>      transform = coordSystemAObserver->GetTransform();<br>      if ( transform.IsValidNow() ) <br>        {<br>        position = transform.GetTranslation();<br>        std::cout << "Trackertool :" <br>


                << trackerTool->GetTrackerToolIdentifier() <br>                << "\t\t  Position = (" << position[0]<br>                << "," << position[1] << "," << position[2]<br>


                << ")" << std::endl;<br>        }<br>      }*/<br><br>    coordSystemAObserver2->Clear();<br>    trackerTool2->RequestGetTransformToParent();<br>    if (coordSystemAObserver2->GotTransform())<br>


      {<br>      transform = coordSystemAObserver2->GetTransform();<br>      if ( transform.IsValidNow() ) <br>        {<br>        position = transform.GetTranslation();<br>        std::cout << "Trackertool2:" <br>


                << trackerTool2->GetTrackerToolIdentifier() <br>                << "\t\t  Position = (" << position[0]<br>                << "," << position[1] << "," << position[2]<br>


                << ")" << std::endl;<br>        }<br>      }<br>    }<br><br>  std::cout << "RequestStopTracking()" << std::endl;<br>  tracker->RequestStopTracking();<br><br>


  std::cout << "RequestClose()" << std::endl;<br>  tracker->RequestClose();<br><br>  std::cout << "CloseCommunication()" << std::endl;<br>  serialComm->CloseCommunication();<br>


    <br><br>-- <br>Bérangère Giroud<br>