Skip to content

Latest commit

 

History

History
71 lines (60 loc) · 1.54 KB

File metadata and controls

71 lines (60 loc) · 1.54 KB

Poapi

Python module and shell interface for the NDI Optotrak API

Python usage

Example usage of the module:

#!/usr/bin/env python
import poapi

optotrak = poapi.Poapi()
print optotrak.OAPIGetVersionString()

a fully functional script:

#!/usr/bin/env python
import poapi, time

optotrak = poapi.Poapi()
optotrak.TransputerInitializeSystem()
optotrak.OptotrakLoadCameraParameters("standard")
optotrak.OptotrakActivateMarkers()
time.sleep(1)
print (optotrak.DataGetLatest3D())

Usually the python functions are called the same way as the original C functions. Sometimes we use the additional capabilities of Python. A few examples:

C:

char s[1024]
OptoGetLastError(s, 1024)
// nu bevat s de error string

Python:

s = OptoGetLastError()

C:

float a = 1.0, b = 2.0;
OdauSetAnalogOutputs(ODAU2, a, b, 0)
// nu zijn  a en b gewijzigd in de nieuwe waarden, bijvoorbeeld 3.0 en 4.0

Python:

a, b = OdauSetAnalogOutputs("ODAU2", 1.0, 2.0, 0) 

Shell usage

You can also use the shell directly, without python. Execute the poapi program from the command line and start typing your functions. Function output will appear on the next line.

terra:Poapi> ./poapi
TransputerDetermineSystemCfg()
0
TransputerLoadSystem()
0

Ethernet

An additional script is present to find the ip-address of the optotrak scu for use in the optotrak ini file:

terra:Poapi> ./findScu.pl
scan range: 131.174.111.26/24 for Northern Digital
Northern Digital SCU, IP: 131.174.111.1, MAC: e8:39:35:39:03:d1