Using OpenIGTLink in IGSTK

From IGSTK

Jump to: navigation, search

Contents

How to build Sandbox with OpenIGTLink support

  1. Download OpenIGTLink library and build it
    1. SVN version: [ http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink/ ]
    2. Snapshot zip file ( 03-17-2009 ) [1]
  2. Turn on IGSTK_USE_OpenIGTLink option in the main CVS
  3. Specify OpenIGTLink library directory ( Set OpenIGTLink_DIR cmake variable )


For debugging purposes and to evaluate the IGSTK transformation broadcasting application described below you can use the ReceiveServer OpenIGTLink example program.

Broadcast Tracking data using OpenIGTLink

To broadcast tracking data using IGSTK all you need to do is compile the example programs and create an xml file that is appropriate for your setup. The relevant example is found in the OIGTLinkTrackerBroadcasting directory. By default a command line program is generated (OIGTLinkTrackerBroadcasting). If you have set the Cmakelists flag USE_FLTK to ON a second program with a UI is also generated (OIGTLinkTrackerBroadcastingUI). Both programs receive as input an xml file that contains the relevant setup (communication settings, which tools to track, is one of the tools a dynamic reference frame, tool calibration information).

The programs support all tracking systems supported by IGSTK with minimal effort on the user side. That is, the user need only edit an xml file describing the current configuration.

What data is sent:

  1. If a tool is designated as a dynamic reference frame its transformations will not be sent.
  2. If a calibration file is specified for the tool this transformation is compounded with that reported by the tracker. For example, when using a tracked pointer with calibration information denoting the transformation to the tool's tip, the tip's location and orientation are the reported transformation.
  3. If one of the tools is designated as a dynamic reference frame then all reported transformations are relative to that tool. If the reference frame or the tool cannot be tracked no data is sent (waving the tool in front of the vicra system won't help if the reference is in the desk drawer).

An example configuration using Northern Digital Inc.'s vicra tracker:


<?xml version="1.0" encoding="ISO-8859-1"?>
 

<tracking_system type = "polaris vicra">
              <!--acquire data from the tracker at this rate-->
    <refresh_rate> 20 </refresh_rate>
              <!--serial communication settings-->
    <serial_communication> 
      <com_port>5</com_port>
      <baud_rate>115200</baud_rate> 
      <data_bits>8</data_bits>
      <parity>N</parity> 
      <stop_bits>1</stop_bits> 
      <hand_shake>0</hand_shake> 
    </serial_communication>

             <!--use this tool as a dynamic reference frame, the tool's-->
             <!--transformations will not be sent                      -->
    <tool usage="reference">
      <name> reference frame </name> 
      <srom_file>E:/users/xmlFiles/drf.rom</srom_file>
    </tool>

              <!--send this tools transformations to the given addresses-->
              <!--this will be the probe's tip location+orientation     -->
              <!--relative to the reference tool                        -->
    <tool>
      <name> bayonet probe </name> 
      <srom_file>E:/users/xmlFiles/bayonetProbe.rom</srom_file>      
      <calibration_file>E:/users/xmlFiles/bayonetCalibration.xml</calibration_file>
      <send_to> 127.0.0.1:1001 </send_to> 
      <send_to> 127.0.0.1:1002 </send_to>
    </tool>


</tracking_system>

If on the other hand you want your application to perform the dynamic referencing the above xml file will change to:


<?xml version="1.0" encoding="ISO-8859-1"?>
 

<tracking_system type = "polaris vicra">
              <!--acquire data from the tracker at this rate-->
    <refresh_rate> 20 </refresh_rate>
              <!--serial communication settings-->
    <serial_communication> 
      <com_port>5</com_port>
      <baud_rate>115200</baud_rate> 
      <data_bits>8</data_bits>
      <parity>N</parity> 
      <stop_bits>1</stop_bits> 
      <hand_shake>0</hand_shake> 
    </serial_communication>

    <tool>
      <name> reference frame </name> 
      <srom_file>E:/users/xmlFiles/drf.rom</srom_file>
      <send_to> 127.0.0.1:1003 </send_to> 
    </tool>

              <!--send this tools transformations to the given addresses-->
              <!--this will be the probe's tip location+orientation     -->
              <!--relative to the tracking device                       -->
    <tool>
      <name> bayonet probe </name> 
      <srom_file>E:/users/xmlFiles/bayonetProbe.rom</srom_file>      
      <calibration_file>E:/users/xmlFiles/bayonetCalibration.xml</calibration_file>
      <send_to> 127.0.0.1:1001 </send_to> 
      <send_to> 127.0.0.1:1002 </send_to>
    </tool>


</tracking_system>

And to round things up, a sample calibration file:


<?xml version="1.0" encoding="ISO-8859-1"?>
 
<precomputed_transform>
  
  <description>
      Vicra bayonet probe calibration
  </description>
  
  <computation_date>
      Monday March 2 12:00:00 2009
  </computation_date>

          <!--calibration data:  qx qy qz qw tx ty tz --> 
  <transformation estimation_error = "0.5">
      0 0 0 1 -18.26 1.41 -157.15
  </transformation>

</precomputed_transform>

Unit test

  • igstkTrackerToolObserverToOpenIGTLinkRelayTest
    • This test generates transform information using Circular simulated tracker. The transform data is observed by the TrackerTool observer and then converted into OpenIGTLink protocol and broadcasted out to particular hostname/port
    • Command line arguments: hostname portnumber numberOfTransformsToSend angularSpeed(degrees/second) trackerFrequency(Hz)
  • igstkOpenIGTLinkReceiverTest
    • Listens to transform and other OpenIGTLink protocol supported data types and print
    • Command line arguments: portnumber


How to run the test

  • Run the Receiver test first

./igstkSandboxTests igstkOpenIGTLinkReceiverTest 16666
Test timeout computed to be: 1500
AC = 3

  • Run the relay test ( in a different terminal )

./igstkTrackerTests igstkTrackerToolObserverToOpenIGTLinkRelayTest localhost 16666 1000 100 10


You should see in the receiver test terminal

"============"
Receiving TRANSFORM data type.
"============="
1, 0, 0, -2.08304
0, 1, 0, 9.78064
0, 0, 1, 0
0, 0, 0, 1
"============="
"============="
1, 0, 0, -3.75712
Receiving TRANSFORM data type.
0, 1, 0, 9.26737
0, 0, 1, 0
0, 0, 0, 1

etc...

Personal tools
TOOLBOX
LANGUAGES