Vizard 7 » Reference » Input Devices » Position and Orientation Trackers » NDI Optotrak
7.6

NDI Optotrak plug-in

This plug-in provides support for the NDI Optotrak motion capture device. The Optotrak plug-in supports both position and rotation data.

Initialization

The Optotrak plug-in is implemented as a Vizard extension. When creating the Optotrak extension, you must specify the IP address or hostname of the Optotrak server as the 'mesg' argument. You can also specify the port number by adding a ':' followed by the port number to the address string. The default port is 3020.

 

The Optotrak extension object has the following methods/constants:

Method

Description

<optotrak>.getBodyList()

Returns a list of all the 6DOF bodies on the server.

<optotrak>.getBody(val)

Returns the body with the given name or index. The name is case sensitive.

<optotrak>.getMarkerList()

Returns a list of all the 3DOF markers on the server.

<optotrak>.getMarker(val)

Returns the marker with the given name or index. The name is case sensitive.

<optotrak>.getAnalogSensor()

Return the sensor object containing all the analog data on the server.

<optotrak>.getAnalogData()

Return a list containing all the analog data. Equivalent to calling <optotrak>.getAnalogSensor().getData()

The Optotrak body objects have the following methods in addition to the standard extension sensor methods:

Method

Description

<body>.getMarkerList()

Returns a list of all the 3DOF markers that belong to the body.

<body>.getMarker(val)

Returns the marker with the given name or index that belongs to the body. The name is case sensitive.

The Optotrak analog sensor contains the following methods in addition to the standard extension sensor methods:

Method

Description

<analog>.getChannelNames()

Returns a list of all the analog channel names.

Example

The following example shows how to connect to an Optotrak server and get a handle to the first body and marker. It will also print out the name of the body and marker objects:

opto = viz.add('optotrak.dle',0,'192.168.0.114')
body = opto.getBody(0)
marker = opto.getMarker(0)

print( body.getName())
print( marker.getName())

The following example shows how to iterate through all the marker objects and link each one to a node:

for m in opto.getMarkerList():
    ball = viz.add('white_ball.wrl',color=viz.RED,cache=viz.CACHE_CLONE)
    viz.link(m,ball)

You can also connect to multiple Optotrak servers simultaneously. The next example connects to two different servers and prints the body names of each server:

opto1 = viz.add('optotrak.dle',0,'media3')

for b in opto1.getBodyList():
    print( b.getName())
   
opto2 = viz.add('optotrak.dle',0,'dev15')

for b in opto2.getBodyList():
    print( b.getName())