Difference between revisions of "NaviTrack Tutorial:Integrating:Passing coordinates data"

From NAMIC Wiki
Jump to: navigation, search
Line 6: Line 6:
 
=Sending side=
 
=Sending side=
 
==Modify MyTutorialModule==
 
==Modify MyTutorialModule==
 +
void MyTutorialModule::setTracker(std::vector<float> pos,std::vector<float> quat)
 +
{
 +
  if (pos.size() != 3 || quat.size() != 4) {
 +
    std::cout << "MyTutorialModule::setTracker(): illegal vector size." << std::endl;
 +
    return;
 +
  }
 +
 +
  if(source!=NULL)
 +
    {
 +
      ot::Event *event = new ot::Event();
 +
      event->setAttribute("position",pos);
 +
      event->setAttribute("orientation",quat);
 +
      event->timeStamp();
 +
      source->updateObservers( *event );
 +
    }
 +
}
 +
 
==pushpos.cxx==
 
==pushpos.cxx==
  

Revision as of 04:19, 25 May 2007

Home < NaviTrack Tutorial:Integrating:Passing coordinates data

What you need to do

  1. Create NaviTrack module to provide a node that can be accessed by you application.
  2. Modify your application to push and pull NaviTrack events cyclically with certain interval.
  3. Create NaviTrack configuration XML file to build tree structure of data flow.

Sending side

Modify MyTutorialModule

void MyTutorialModule::setTracker(std::vector<float> pos,std::vector<float> quat)
{
  if (pos.size() != 3 || quat.size() != 4) {
    std::cout << "MyTutorialModule::setTracker(): illegal vector size." << std::endl;
    return;
  }

  if(source!=NULL)
    {
      ot::Event *event = new ot::Event();
      event->setAttribute("position",pos);
      event->setAttribute("orientation",quat);
      event->timeStamp();
      source->updateObservers( *event );
    }
}

pushpos.cxx

Receiving side

Modify MyTutorialSink

pullpos.cxx

Testing

Let's try to send position data from pushpos to pullpos program through network.

Configure NaviTrack XML files

tutorial_source.xml (for pushpos)

tutorial_sink.xml (for pullpos)

Run the programs

Open two terminals and go to the directory where the programs exists.

Terminal 1 (pushpos: sending side)

$ ./pushpos tutorial_source.xml

Terminal 2 (pullpos: receiving side)

$ ./pullpos tutorial_sink.xml





Back to Integrating into your application.