WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
  #1  
Old 10-15-2009, 01:08 AM
bennovdbogaard bennovdbogaard is offline
Member
 
Join Date: Oct 2009
Posts: 2
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 <vrpn>.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!
Reply With Quote
  #2  
Old 10-16-2009, 11:41 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
  #3  
Old 10-20-2009, 03:08 AM
bennovdbogaard bennovdbogaard is offline
Member
 
Join Date: Oct 2009
Posts: 2
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.
Reply With Quote
  #4  
Old 10-23-2009, 10:40 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
  #5  
Old 10-10-2012, 07:20 AM
Kyman2008 Kyman2008 is offline
Member
 
Join Date: Jul 2012
Posts: 19
Could you post an examply code that would allow me to verify that I am connected to the VRPN output from Natural Point Optitrack?
Reply With Quote
  #6  
Old 10-10-2012, 11:38 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,466
You will need to modify the code below with your tracker ID and machine name.
Code:
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.
Reply With Quote
  #7  
Old 10-10-2012, 01:27 PM
Kyman2008 Kyman2008 is offline
Member
 
Join Date: Jul 2012
Posts: 19
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?
Reply With Quote
  #8  
Old 10-15-2012, 06:16 AM
Kyman2008 Kyman2008 is offline
Member
 
Join Date: Jul 2012
Posts: 19
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?
Reply With Quote
  #9  
Old 10-16-2012, 12:16 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,466
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?
Reply With Quote
  #10  
Old 10-24-2012, 07:53 AM
Kyman2008 Kyman2008 is offline
Member
 
Join Date: Jul 2012
Posts: 19
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
Reply With Quote
  #11  
Old 10-24-2012, 10:23 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,466
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.
Reply With Quote
  #12  
Old 10-24-2012, 11:46 AM
Kyman2008 Kyman2008 is offline
Member
 
Join Date: Jul 2012
Posts: 19
Is there an example somewhere on the website of how this code is implemented?
Reply With Quote
  #13  
Old 10-24-2012, 05:20 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,466
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:
Code:
#get pos of tracker when script starts
pos=tracker.getPosition()

#link view to tracker
trackerLink = viz.link(tracker,viz.MainView)
#apply postTrans operator and negate x,z values
trackerLink.postTrans([-pos[0],pos[1],-pos[2]])
Reply With Quote
  #14  
Old 10-25-2012, 06:20 AM
Kyman2008 Kyman2008 is offline
Member
 
Join Date: Jul 2012
Posts: 19
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
viz.MainView.setEuler([-yaw,pitch,0],viz.BODY_ORI)

vizact.ontimer(0,updateView_Euler)

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)


vizact.ontimer(0,updateView_Position)
Reply With Quote
  #15  
Old 10-25-2012, 06:22 AM
Kyman2008 Kyman2008 is offline
Member
 
Join Date: Jul 2012
Posts: 19
^^NOTE the correct indentation did not copy above^^
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:22 PM.


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