WorldViz User Forum

WorldViz User Forum (
-   Vizard (
-   -   Support for Natural Point's Optitrack system (

bennovdbogaard 10-15-2009 01:08 AM

Support for Natural Point's Optitrack system
Hey everyone,

I am having some difficulties getting data out of our Natural Point Optitrack system.

The system provides a built-in VRPN server to which Vizard can connect through the VRPN 7 module.

Connecting isn't a problem, but when I get my data with .getData(), it always returns this:

[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0]

And it doesn't change when movement takes place.

Hopefully someone can point me in the right direction. I'm using the latest version of Vizard. (3.15.0001)

Thanks in advance!

farshizzo 10-16-2009 11:41 AM

Are you connecting to the correct sensor number? When you connect to a VRPN tracker, the default sensor number is 0. If the Optitrack system is sending data over a different sensor number, then you will need to specify that when connecting to the tracker. Have a look at the documentation for the VRPN plugin for more info.

bennovdbogaard 10-20-2009 03:08 AM

I specified the sensor name myself in the VRPN server and matched it with the name in the code, considering case sensitivity and such. Still no luck. As far as I know, I'm connecting to the right sensor.

farshizzo 10-23-2009 10:40 AM

Are you getting any error/warning messages in the output window? If the VRPN client fails to receive any data after 3 seconds it will start outputting warning messages. If you don't see any warning messages, then the problem might be with the server.

Kyman2008 10-10-2012 07:20 AM

Could you post an examply code that would allow me to verify that I am connected to the VRPN output from Natural Point Optitrack?

Jeff 10-10-2012 11:38 AM

You will need to modify the code below with your tracker ID and machine name.

vrpn = viz.add('vrpn7.dle')
TRACKER_ID = "Trackable 1"
VRPN_MACHINE = "localhost"
headtracker = vrpn.addTracker(TRACKER_ID + "@" + VRPN_MACHINE, 0)

Replace 'Trackable 1' with the name given by the Tracking Tools software from Natural Point. Also make sure the software is streaming data.

Kyman2008 10-10-2012 01:27 PM

Thankyou very much I was able to connect to the server! Now, when linking the mainview to the sensors position and orientation how do I correct for the obvious difference in position that I am getting with Natural Point and the correct vizard world coordinates? Is there some refining I need to do?

Kyman2008 10-15-2012 06:16 AM

Or maybe a better stated question, I want to move around a vizard world be using natural point tracking cameras but the cameras are making my head movements reversed, i.e. when I look left the avatar looks right in the vizard virtual world. Also movements recorded by the cameras are in millimeters when movements in vizard are in meters, is there a way to change movements in millimeters to meters in vizard?

Jeff 10-16-2012 12:16 PM

The data can be swapped or scaled to match Vizard's coordinate system. Can you describe or link to some documentation that shows the coordinate system your tracker uses?

Kyman2008 10-24-2012 07:53 AM

Ok I figured out the coordinate system question, now my last question about this topic...How can I create a program that starts out in the same place in vizard everytime when you run it no matter where the position of markers are that are being tracked by natural point cameras. And after startin vizard I can still move around my virtual world by tracking the markers wth natural point cameras. Simply stated I want to start my vizard program in the same place everytime and then move around vizard world by tracking natural point markers

Jeff 10-24-2012 10:23 AM

If your viewpoint is linked to the tracker you can use the link.postTrans command to move the viewpoint to the location you would like to start from.

Kyman2008 10-24-2012 11:46 AM

Is there an example somewhere on the website of how this code is implemented?

Jeff 10-24-2012 05:20 PM

You could try something like the following to place the viewpoint just above the origin. This code is assuming the tracker coordinate system matches Vizard's:

#get pos of tracker when script starts

#link view to tracker
trackerLink =,viz.MainView)
#apply postTrans operator and negate x,z values

Kyman2008 10-25-2012 06:20 AM

Ok so I have solved this problem, but the problem of walking around my world has now arised because If I use the link command to link the mainview with the tracker the mainview will automatically jump to a random point in my world corresponding to the millimeter position data it is getting from the optitrack position data. All I want to do is calculate if there is a difference in position data between a small amount of time (i.e. the person moved) and then output this same movement in Vizard. Here is my code currently for connecting my tracker and viz.MainView. (The function for updating euler works, the update position does not work, i.e. I can't walk around my world!!)

###Link Mainview to Sensor and Begin Scene###
def updateView_Euler():

yaw, pitch, roll = headtracker.getEuler()
pitch= pitch - 10
yaw= yaw + 30


def updateView_Position():

x,y,z= headtracker.getPosition()
x = int(x)*1000
z = int(z)*1000

x2,y2,z2= headtracker.getPosition()
x2 = int(x2)*1000
z2 = int(z2)*1000

delta_x = x2 - x
delta_z = z2 - z

if delta_x > 3 :
viz.MainView.move(delta_x,0,0, viz.BODY_ORI)
if delta_z > 3:
viz.MainView.move(0,0,delta_z, viz.BODY_ORI)


Kyman2008 10-25-2012 06:22 AM

^^NOTE the correct indentation did not copy above^^

All times are GMT -7. The time now is 05:09 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC